A free open source IT asset/license management system
Updated bootstrap tables
snipe55b9f1207df5
diff --git a/public/js/FileSaver.min.js b/public/js/FileSaver.min.jsindex b1cb31daef..9a1e397f20 100644--- a/public/js/FileSaver.min.js+++ b/public/js/FileSaver.min.js@@ -1,7 +1,2 @@/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */-var saveAs=saveAs||"undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator)||function(a){"use strict";if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var k=a.document,n=k.createElementNS("http://www.w3.org/1999/xhtml","a"),w="download"in n,x=function(c){var e=k.createEvent("MouseEvents");e.initMouseEvent("click",!0,!1,a,0,0,0,0,0,!1,!1,!1,!1,0,null);c.dispatchEvent(e)},q=a.webkitRequestFileSystem,u=a.requestFileSystem||q||a.mozRequestFileSystem,-y=function(c){(a.setImmediate||a.setTimeout)(function(){throw c;},0)},r=0,s=function(c){var e=function(){"string"===typeof c?(a.URL||a.webkitURL||a).revokeObjectURL(c):c.remove()};a.chrome?e():setTimeout(e,500)},t=function(c,a,d){a=[].concat(a);for(var b=a.length;b--;){var l=c["on"+a[b]];if("function"===typeof l)try{l.call(c,d||c)}catch(f){y(f)}}},m=function(c,e){var d=this,b=c.type,l=!1,f,p,k=function(){t(d,["writestart","progress","write","writeend"])},g=function(){if(l||!f)f=(a.URL||a.webkitURL||-a).createObjectURL(c);p?p.location.href=f:void 0==a.open(f,"_blank")&&"undefined"!==typeof safari&&(a.location.href=f);d.readyState=d.DONE;k();s(f)},h=function(a){return function(){if(d.readyState!==d.DONE)return a.apply(this,arguments)}},m={create:!0,exclusive:!1},v;d.readyState=d.INIT;e||(e="download");if(w)f=(a.URL||a.webkitURL||a).createObjectURL(c),n.href=f,n.download=e,x(n),d.readyState=d.DONE,k(),s(f);else{a.chrome&&b&&"application/octet-stream"!==b&&(v=c.slice||c.webkitSlice,c=v.call(c,0,-c.size,"application/octet-stream"),l=!0);q&&"download"!==e&&(e+=".download");if("application/octet-stream"===b||q)p=a;u?(r+=c.size,u(a.TEMPORARY,r,h(function(a){a.root.getDirectory("saved",m,h(function(a){var b=function(){a.getFile(e,m,h(function(a){a.createWriter(h(function(b){b.onwriteend=function(b){p.location.href=a.toURL();d.readyState=d.DONE;t(d,"writeend",b);s(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&g()};["writestart","progress","write","abort"].forEach(function(a){b["on"+-a]=d["on"+a]});b.write(c);d.abort=function(){b.abort();d.readyState=d.DONE};d.readyState=d.WRITING}),g)}),g)};a.getFile(e,{create:!1},h(function(a){a.remove();b()}),h(function(a){a.code===a.NOT_FOUND_ERR?b():g()}))}),g)}),g)):g()}},b=m.prototype;b.abort=function(){this.readyState=this.DONE;t(this,"abort")};b.readyState=b.INIT=0;b.WRITING=1;b.DONE=2;b.error=b.onwritestart=b.onprogress=b.onwrite=b.onabort=b.onerror=b.onwriteend=null;return function(a,b){return new m(a,b)}}}("undefined"!==typeof self&&-self||"undefined"!==typeof window&&window||this.content);"undefined"!==typeof module&&null!==module?module.exports=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});\ No newline at end of file+var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},v=function(t,u,d){if(!d){t=p(t)}var v=this,w=t.type,m=w===s,y,h=function(){l(v,"writestart progress write writeend".split(" "))},S=function(){if((f||m&&i)&&e.FileReader){var r=new FileReader;r.onloadend=function(){var t=f?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");var n=e.open(t,"_blank");if(!n)e.location.href=t;t=undefined;v.readyState=v.DONE;h()};r.readAsDataURL(t);v.readyState=v.INIT;return}if(!y){y=n().createObjectURL(t)}if(m){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}v.readyState=v.DONE;h();c(y)};v.readyState=v.INIT;if(o){y=n().createObjectURL(t);setTimeout(function(){r.href=y;r.download=u;a(r);h();c(y);v.readyState=v.DONE});return}S()},w=v.prototype,m=function(e,t,n){return new v(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=p(e)}return navigator.msSaveOrOpenBlob(e,t)}}w.abort=function(){};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return m}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!==null){define("FileSaver.js",function(){return saveAs})}diff --git a/public/js/bootstrap-table.js b/public/js/bootstrap-table.jsindex 1c891bbc54..9813921f5b 100755--- a/public/js/bootstrap-table.js+++ b/public/js/bootstrap-table.js@@ -1,10 +1,10 @@/*** @author zhixin wen <[email protected]>- * version: 1.9.1+ * version: 1.11.1* https://github.com/wenzhixin/bootstrap-table/*/-!function ($) {+(function ($) {'use strict';// TOOLS DEFINITION@@ -140,7 +140,7 @@return func;}if (typeof func === 'function') {- return func.apply(self, args);+ return func.apply(self, args || []);}if (!func && typeof name === 'string' && sprintf.apply(this, [name].concat(args))) {return sprintf.apply(this, [name].concat(args));@@ -180,25 +180,16 @@var escapeHTML = function (text) {if (typeof text === 'string') {return text- .replace(/&/g, "&")- .replace(/</g, "<")- .replace(/>/g, ">")- .replace(/"/g, """)- .replace(/'/g, "'");+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"')+ .replace(/'/g, ''')+ .replace(/`/g, '`');}return text;};- var getRealHeight = function ($el) {- var height = 0;- $el.children().each(function () {- if (height < $(this).outerHeight(true)) {- height = $(this).outerHeight(true);- }- });- return height;- };-var getRealDataAttr = function (dataAttr) {for (var attr in dataAttr) {var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();@@ -211,17 +202,66 @@return dataAttr;};- var getItemField = function (item, field) {+ var getItemField = function (item, field, escape) {var value = item;if (typeof field !== 'string' || item.hasOwnProperty(field)) {- return item[field];+ return escape ? escapeHTML(item[field]) : item[field];}var props = field.split('.');for (var p in props) {- value = value[props[p]];+ if (props.hasOwnProperty(p)) {+ value = value && value[props[p]];+ }+ }+ return escape ? escapeHTML(value) : value;+ };++ var isIEBrowser = function () {+ return !!(navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./));+ };++ var objectKeys = function () {+ // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys+ if (!Object.keys) {+ Object.keys = (function() {+ var hasOwnProperty = Object.prototype.hasOwnProperty,+ hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),+ dontEnums = [+ 'toString',+ 'toLocaleString',+ 'valueOf',+ 'hasOwnProperty',+ 'isPrototypeOf',+ 'propertyIsEnumerable',+ 'constructor'+ ],+ dontEnumsLength = dontEnums.length;++ return function(obj) {+ if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {+ throw new TypeError('Object.keys called on non-object');+ }++ var result = [], prop, i;++ for (prop in obj) {+ if (hasOwnProperty.call(obj, prop)) {+ result.push(prop);+ }+ }++ if (hasDontEnumBug) {+ for (i = 0; i < dontEnumsLength; i++) {+ if (hasOwnProperty.call(obj, dontEnums[i])) {+ result.push(dontEnums[i]);+ }+ }+ }+ return result;+ };+ }());}- return value;};// BOOTSTRAP TABLE CLASS DEFINITION@@ -239,14 +279,17 @@BootstrapTable.DEFAULTS = {classes: 'table table-hover',+ sortClass: undefined,locale: undefined,height: undefined,undefinedText: '-',sortName: undefined,sortOrder: 'asc',+ sortStable: false,striped: false,columns: [[]],data: [],+ totalField: 'total',dataField: 'rows',method: 'get',url: undefined,@@ -254,11 +297,7 @@cache: true,contentType: 'application/json',dataType: 'json',- ajaxOptions: {- headers: {- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')- }- },+ ajaxOptions: {},queryParams: function (params) {return params;},@@ -268,6 +307,7 @@},pagination: false,onlyInfoPagination: false,+ paginationLoop: true,sidePagination: 'client', // client or servertotalRows: 0, // server side need to setpageNumber: 1,@@ -276,11 +316,10 @@paginationHAlign: 'right', //right, leftpaginationVAlign: 'bottom', //bottom, top, bothpaginationDetailHAlign: 'left', //right, left- paginationFirstText: '«',paginationPreText: '‹',paginationNextText: '›',- paginationLastText: '»',search: false,+ searchOnEnterKey: false,strictSearch: false,searchAlign: 'right',selectItemName: 'btSelectItem',@@ -292,6 +331,7 @@showToggle: false,buttonsAlign: 'right',smartDisplay: true,+ escape: false,minimumCountColumns: 1,idField: undefined,uniqueId: undefined,@@ -312,6 +352,7 @@searchTimeOut: 500,searchText: '',iconSize: undefined,+ buttonsClass: 'default',iconsPrefix: 'glyphicon', // glyphicon of fa (font awesome)icons: {paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',@@ -323,6 +364,10 @@detailClose: 'glyphicon-minus icon-minus'},+ customSearch: $.noop,++ customSort: $.noop,+rowStyle: function (row, index) {return {};},@@ -331,6 +376,10 @@return {};},+ footerStyle: function (row, index) {+ return {};+ },+onAll: function (name, args) {return false;},@@ -403,19 +452,22 @@onRefreshOptions: function (options) {return false;},+ onRefresh: function (params) {+ return false;+ },onResetView: function () {return false;}};- BootstrapTable.LOCALES = [];+ BootstrapTable.LOCALES = {};- BootstrapTable.LOCALES['en-US'] = BootstrapTable.LOCALES['en'] = {+ BootstrapTable.LOCALES['en-US'] = BootstrapTable.LOCALES.en = {formatLoadingMessage: function () {return 'Loading, please wait...';},formatRecordsPerPage: function (pageNumber) {- return sprintf('%s records per page', pageNumber);+ return sprintf('%s rows per page', pageNumber);},formatShowingRows: function (pageFrom, pageTo, totalRows) {return sprintf('Showing %s to %s of %s rows', pageFrom, pageTo, totalRows);@@ -474,7 +526,8 @@cellStyle: undefined,searchable: true,searchFormatter: true,- cardVisible: true+ cardVisible: true,+ escape : false};BootstrapTable.EVENTS = {@@ -502,7 +555,8 @@'expand-row.bs.table': 'onExpandRow','collapse-row.bs.table': 'onCollapseRow','refresh-options.bs.table': 'onRefreshOptions',- 'reset-view.bs.table': 'onResetView'+ 'reset-view.bs.table': 'onResetView',+ 'refresh.bs.table': 'onRefresh'};BootstrapTable.prototype.init = function () {@@ -511,6 +565,7 @@this.initTable();this.initHeader();this.initData();+ this.initHiddenRows();this.initFooter();this.initToolbar();this.initPagination();@@ -523,7 +578,7 @@if (this.options.locale) {var parts = this.options.locale.split(/-|_/);parts[0].toLowerCase();- parts[1] && parts[1].toUpperCase();+ if (parts[1]) parts[1].toUpperCase();if ($.fn.bootstrapTable.locales[this.options.locale]) {// locale as requested$.extend(this.options, $.fn.bootstrapTable.locales[this.options.locale]);@@ -593,6 +648,10 @@var column = [];$(this).find('th').each(function () {+ // Fix #2014 - getFieldIndex and elsewhere assume this is string, causes issues if not+ if (typeof $(this).data('field') !== 'undefined') {+ $(this).data('field', $(this).data('field') + '');+ }column.push($.extend({}, {title: $(this).html(),'class': $(this).attr('class'),@@ -627,7 +686,8 @@return;}- this.$el.find('>tbody>tr').each(function () {+ var m = [];+ this.$el.find('>tbody>tr').each(function (y) {var row = {};// save tr's id, class and data-* attributes@@ -635,20 +695,38 @@row._class = $(this).attr('class');row._data = getRealDataAttr($(this).data());- $(this).find('td').each(function (i) {- var field = that.columns[i].field;+ $(this).find('>td').each(function (x) {+ var $this = $(this),+ cspan = +$this.attr('colspan') || 1,+ rspan = +$this.attr('rowspan') || 1,+ tx, ty;++ for (; m[y] && m[y][x]; x++); //skip already occupied cells in current row++ for (tx = x; tx < x + cspan; tx++) { //mark matrix elements occupied by current cell with true+ for (ty = y; ty < y + rspan; ty++) {+ if (!m[ty]) { //fill missing rows+ m[ty] = [];+ }+ m[ty][tx] = true;+ }+ }++ var field = that.columns[x].field;row[field] = $(this).html();// save td's id, class and data-* attributesrow['_' + field + '_id'] = $(this).attr('id');row['_' + field + '_class'] = $(this).attr('class');row['_' + field + '_rowspan'] = $(this).attr('rowspan');+ row['_' + field + '_colspan'] = $(this).attr('colspan');row['_' + field + '_title'] = $(this).attr('title');row['_' + field + '_data'] = getRealDataAttr($(this).data());});data.push(row);});this.options.data = data;+ if (data.length) this.fromHtml = true;};BootstrapTable.prototype.initHeader = function () {@@ -671,7 +749,7 @@$.each(this.options.columns, function (i, columns) {html.push('<tr>');- if (i == 0 && !that.options.cardView && that.options.detailView) {+ if (i === 0 && !that.options.cardView && that.options.detailView) {html.push(sprintf('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',that.options.columns.length));}@@ -733,13 +811,12 @@sprintf(' rowspan="%s"', column.rowspan),sprintf(' colspan="%s"', column.colspan),sprintf(' data-field="%s"', column.field),- "tabindex='0'",'>');html.push(sprintf('<div class="th-inner %s">', that.options.sortable && column.sortable ?'sortable both' : ''));- text = column.title;+ text = that.options.escape ? escapeHTML(column.title) : column.title;if (column.checkbox) {if (!that.options.singleSelect && that.options.checkboxHeader) {@@ -767,7 +844,14 @@$(this).data(visibleColumns[$(this).data('field')]);});this.$container.off('click', '.th-inner').on('click', '.th-inner', function (event) {- if (that.options.sortable && $(this).parent().data().sortable) {+ var target = $(this);++ if (that.options.detailView) {+ if (target.closest('.bootstrap-table')[0] !== that.$container[0])+ return false;+ }++ if (that.options.sortable && target.parent().data().sortable) {that.onSort(event);}});@@ -781,6 +865,7 @@}});+ $(window).off('resize.bootstrap-table');if (!this.options.showHeader || this.options.cardView) {this.$header.hide();this.$tableHeader.hide();@@ -791,15 +876,15 @@this.$tableLoading.css('top', this.$header.outerHeight() + 1);// Assign the correct sortable arrowthis.getCaret();+ $(window).on('resize.bootstrap-table', $.proxy(this.resetWidth, this));}this.$selectAll = this.$header.find('[name="btSelectAll"]');- this.$container.off('click', '[name="btSelectAll"]')- .on('click', '[name="btSelectAll"]', function () {- var checked = $(this).prop('checked');- that[checked ? 'checkAll' : 'uncheckAll']();- that.updateSelected();- });+ this.$selectAll.off('click').on('click', function () {+ var checked = $(this).prop('checked');+ that[checked ? 'checkAll' : 'uncheckAll']();+ that.updateSelected();+ });};BootstrapTable.prototype.initFooter = function () {@@ -842,15 +927,27 @@var that = this,name = this.options.sortName,order = this.options.sortOrder === 'desc' ? -1 : 1,- index = $.inArray(this.options.sortName, this.header.fields);+ index = $.inArray(this.options.sortName, this.header.fields),+ timeoutId = 0;++ if (this.options.customSort !== $.noop) {+ this.options.customSort.apply(this, [this.options.sortName, this.options.sortOrder]);+ return;+ }if (index !== -1) {+ if (this.options.sortStable) {+ $.each(this.data, function (i, row) {+ if (!row.hasOwnProperty('_position')) row._position = i;+ });+ }+this.data.sort(function (a, b) {if (that.header.sortNames[index]) {name = that.header.sortNames[index];}- var aa = getItemField(a, name),- bb = getItemField(b, name),+ var aa = getItemField(a, name, that.options.escape),+ bb = getItemField(b, name, that.options.escape),value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]);if (value !== undefined) {@@ -865,6 +962,11 @@bb = '';}+ if (that.options.sortStable && aa === bb) {+ aa = a._position;+ bb = b._position;+ }+// IF both values are numeric, do a numeric comparisonif ($.isNumeric(aa) && $.isNumeric(bb)) {// Convert numerical values form string to float.@@ -891,6 +993,17 @@return order;});++ if (this.options.sortClass !== undefined) {+ clearTimeout(timeoutId);+ timeoutId = setTimeout(function () {+ that.$el.removeClass(that.options.sortClass);+ var index = that.$header.find(sprintf('[data-field="%s"]',+ that.options.sortName).index() + 1);+ that.$el.find(sprintf('tr td:nth-child(%s)', index))+ .addClass(that.options.sortClass);+ }, 250);+ }}};@@ -930,10 +1043,13 @@$search,switchableCount = 0;+ if (this.$toolbar.find('.bs-bars').children().length) {+ $('body').append($(this.options.toolbar));+ }this.$toolbar.html('');if (typeof this.options.toolbar === 'string' || typeof this.options.toolbar === 'object') {- $(sprintf('<div class="bars pull-%s"></div>', this.options.toolbarAlign))+ $(sprintf('<div class="bs-bars pull-%s"></div>', this.options.toolbarAlign)).appendTo(this.$toolbar).append($(this.options.toolbar));}@@ -947,34 +1063,40 @@}if (this.options.showPaginationSwitch) {- html.push(sprintf('<button class="btn btn-default" type="button" name="paginationSwitch" title="%s">',- this.options.formatPaginationSwitch()),+ html.push(sprintf('<button class="btn' ++ sprintf(' btn-%s', this.options.buttonsClass) ++ sprintf(' btn-%s', this.options.iconSize) ++ '" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',+ this.options.formatPaginationSwitch()),sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.paginationSwitchDown),'</button>');}if (this.options.showRefresh) {- html.push(sprintf('<button class="btn btn-default' +- sprintf(' btn-%s', this.options.iconSize) +- '" type="button" name="refresh" title="%s">',- this.options.formatRefresh()),+ html.push(sprintf('<button class="btn' ++ sprintf(' btn-%s', this.options.buttonsClass) ++ sprintf(' btn-%s', this.options.iconSize) ++ '" type="button" name="refresh" aria-label="refresh" title="%s">',+ this.options.formatRefresh()),sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh),'</button>');}if (this.options.showToggle) {- html.push(sprintf('<button class="btn btn-default' +- sprintf(' btn-%s', this.options.iconSize) +- '" type="button" name="toggle" title="%s">',- this.options.formatToggle()),+ html.push(sprintf('<button class="btn' ++ sprintf(' btn-%s', this.options.buttonsClass) ++ sprintf(' btn-%s', this.options.iconSize) ++ '" type="button" name="toggle" aria-label="toggle" title="%s">',+ this.options.formatToggle()),sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle),'</button>');}if (this.options.showColumns) {html.push(sprintf('<div class="keep-open btn-group" title="%s">',- this.options.formatColumns()),- '<button type="button" class="btn btn-default' ++ this.options.formatColumns()),+ '<button type="button" aria-label="columns" class="btn' ++ sprintf(' btn-%s', this.options.buttonsClass) +sprintf(' btn-%s', this.options.iconSize) +' dropdown-toggle" data-toggle="dropdown">',sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.columns),@@ -987,14 +1109,14 @@return;}- if (that.options.cardView && (!column.cardVisible)) {+ if (that.options.cardView && !column.cardVisible) {return;}var checked = column.visible ? ' checked="checked"' : '';if (column.switchable) {- html.push(sprintf('<li>' ++ html.push(sprintf('<li role="menuitem">' +'<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>' +'</li>', column.field, i, checked, column.title));switchableCount++;@@ -1006,7 +1128,7 @@html.push('</div>');- // Fix #188: this.showToolbar is for extentions+ // Fix #188: this.showToolbar is for extensionsif (this.showToolbar || html.length > 2) {this.$toolbar.append(html.join(''));}@@ -1024,8 +1146,8 @@if (this.options.showToggle) {this.$toolbar.find('button[name="toggle"]').off('click').on('click', function () {- that.toggleView();- });+ that.toggleView();+ });}if (this.options.showColumns) {@@ -1041,8 +1163,7 @@$keepOpen.find('input').off('click').on('click', function () {var $this = $(this);- that.toggleColumn(getFieldIndex(that.columns,- $(this).data('field')), $this.prop('checked'), false);+ that.toggleColumn($(this).val(), $this.prop('checked'), false);that.trigger('column-switch', $(this).data('field'), $this.prop('checked'));});}@@ -1059,12 +1180,29 @@this.$toolbar.append(html.join(''));$search = this.$toolbar.find('.search input');- $search.off('keyup drop').on('keyup drop', function (event) {+ $search.off('keyup drop blur').on('keyup drop blur', function (event) {+ if (that.options.searchOnEnterKey && event.keyCode !== 13) {+ return;+ }++ if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {+ return;+ }+clearTimeout(timeoutId); // doesn't matter if it's 0timeoutId = setTimeout(function () {that.onSearch(event);}, that.options.searchTimeOut);});++ if (isIEBrowser()) {+ $search.off('mouseup').on('mouseup', function (event) {+ clearTimeout(timeoutId); // doesn't matter if it's 0+ timeoutId = setTimeout(function () {+ that.onSearch(event);+ }, that.options.searchTimeOut);+ });+ }}};@@ -1080,6 +1218,7 @@return;}this.searchText = text;+ this.options.searchText = text;this.options.pageNumber = 1;this.initSearch();@@ -1091,17 +1230,20 @@var that = this;if (this.options.sidePagination !== 'server') {- var s = this.searchText && this.searchText.toLowerCase();+ if (this.options.customSearch !== $.noop) {+ this.options.customSearch.apply(this, [this.searchText]);+ return;+ }++ var s = this.searchText && (this.options.escape ?+ escapeHTML(this.searchText) : this.searchText).toLowerCase();var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;// Check filterthis.data = f ? $.grep(this.options.data, function (item, i) {for (var key in f) {- if ($.isArray(f[key])) {- if ($.inArray(item[key], f[key]) === -1) {- return false;- }- } else if (item[key] !== f[key]) {+ if ($.isArray(f[key]) && $.inArray(item[key], f[key]) === -1 ||+ !$.isArray(f[key]) && item[key] !== f[key]) {return false;}}@@ -1109,20 +1251,33 @@}) : this.options.data;this.data = s ? $.grep(this.data, function (item, i) {- for (var key in item) {- key = $.isNumeric(key) ? parseInt(key, 10) : key;- var value = item[key],- column = that.columns[getFieldIndex(that.columns, key)],- j = $.inArray(key, that.header.fields);-- // Fix #142: search use formated data- if (column && column.searchFormatter) {- value = calculateObjectValue(column,- that.header.formatters[j], [value, item, i], value);+ for (var j = 0; j < that.header.fields.length; j++) {++ if (!that.header.searchables[j]) {+ continue;}- var index = $.inArray(key, that.header.fields);- if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {+ var key = $.isNumeric(that.header.fields[j]) ? parseInt(that.header.fields[j], 10) : that.header.fields[j];+ var column = that.columns[getFieldIndex(that.columns, key)];+ var value;++ if (typeof key === 'string') {+ value = item;+ var props = key.split('.');+ for (var prop_index = 0; prop_index < props.length; prop_index++) {+ value = value[props[prop_index]];+ }++ // Fix #142: respect searchForamtter boolean+ if (column && column.searchFormatter) {+ value = calculateObjectValue(column,+ that.header.formatters[j], [value, item, i], value);+ }+ } else {+ value = item[key];+ }++ if (typeof value === 'string' || typeof value === 'number') {if (that.options.strictSearch) {if ((value + '').toLowerCase() === s) {return true;@@ -1155,7 +1310,8 @@$first, $pre,$next, $last,$number,- data = this.getData();+ data = this.getData(),+ pageList = this.options.pageList;if (this.options.sidePagination !== 'server') {this.options.totalRows = data.length;@@ -1195,27 +1351,27 @@'<div class="pull-' + this.options.paginationDetailHAlign + ' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination ? this.options.formatDetailPagination(this.options.totalRows) :- this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),+ this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),'</span>');if (!this.options.onlyInfoPagination) {html.push('<span class="page-list">');var pageNumber = [- sprintf('<span class="btn-group %s">',- this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?- 'dropdown' : 'dropup'),- '<button type="button" class="btn btn-default ' +- sprintf(' btn-%s', this.options.iconSize) +- ' dropdown-toggle" data-toggle="dropdown">',- '<span class="page-size">',- $allSelected ? this.options.formatAllRows() : this.options.pageSize,- '</span>',- ' <span class="caret"></span>',- '</button>',- '<ul class="dropdown-menu" role="menu">'- ],- pageList = this.options.pageList;+ sprintf('<span class="btn-group %s">',+ this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?+ 'dropdown' : 'dropup'),+ '<button type="button" class="btn' ++ sprintf(' btn-%s', this.options.buttonsClass) ++ sprintf(' btn-%s', this.options.iconSize) ++ ' dropdown-toggle" data-toggle="dropdown">',+ '<span class="page-size">',+ $allSelected ? this.options.formatAllRows() : this.options.pageSize,+ '</span>',+ ' <span class="caret"></span>',+ '</button>',+ '<ul class="dropdown-menu" role="menu">'+ ];if (typeof this.options.pageList === 'string') {var list = this.options.pageList.replace('[', '').replace(']', '')@@ -1229,14 +1385,14 @@}$.each(pageList, function (i, page) {- if (!that.options.smartDisplay || i === 0 || pageList[i - 1] <= that.options.totalRows) {+ if (!that.options.smartDisplay || i === 0 || pageList[i - 1] < that.options.totalRows) {var active;if ($allSelected) {active = page === that.options.formatAllRows() ? ' class="active"' : '';} else {active = page === that.options.pageSize ? ' class="active"' : '';}- pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));+ pageNumber.push(sprintf('<li role="menuitem"%s><a href="#">%s</a></li>', active, page));}});pageNumber.push('</ul></span>');@@ -1247,8 +1403,7 @@html.push('</div>','<div class="pull-' + this.options.paginationHAlign + ' pagination">','<ul class="pagination' + sprintf(' pagination-%s', this.options.iconSize) + '">',- '<li class="page-first"><a href="javascript:void(0)">' + this.options.paginationFirstText + '</a></li>',- '<li class="page-pre"><a href="javascript:void(0)">' + this.options.paginationPreText + '</a></li>');+ '<li class="page-pre"><a href="#">' + this.options.paginationPreText + '</a></li>');if (this.totalPages < 5) {from = 1;@@ -1265,18 +1420,71 @@from = to - 4;}}++ if (this.totalPages >= 6) {+ if (this.options.pageNumber >= 3) {+ html.push('<li class="page-first' + (1 === this.options.pageNumber ? ' active' : '') + '">',+ '<a href="#">', 1, '</a>',+ '</li>');++ from++;+ }++ if (this.options.pageNumber >= 4) {+ if (this.options.pageNumber == 4 || this.totalPages == 6 || this.totalPages == 7) {+ from--;+ } else {+ html.push('<li class="page-first-separator disabled">',+ '<a href="#">...</a>',+ '</li>');+ }++ to--;+ }+ }++ if (this.totalPages >= 7) {+ if (this.options.pageNumber >= (this.totalPages - 2)) {+ from--;+ }+ }++ if (this.totalPages == 6) {+ if (this.options.pageNumber >= (this.totalPages - 2)) {+ to++;+ }+ } else if (this.totalPages >= 7) {+ if (this.totalPages == 7 || this.options.pageNumber >= (this.totalPages - 3)) {+ to++;+ }+ }+for (i = from; i <= to; i++) {html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',- '<a href="javascript:void(0)">', i, '</a>',+ '<a href="#">', i, '</a>','</li>');}+ if (this.totalPages >= 8) {+ if (this.options.pageNumber <= (this.totalPages - 4)) {+ html.push('<li class="page-last-separator disabled">',+ '<a href="#">...</a>',+ '</li>');+ }+ }++ if (this.totalPages >= 6) {+ if (this.options.pageNumber <= (this.totalPages - 3)) {+ html.push('<li class="page-last' + (this.totalPages === this.options.pageNumber ? ' active' : '') + '">',+ '<a href="#">', this.totalPages, '</a>',+ '</li>');+ }+ }+html.push(- '<li class="page-next"><a href="javascript:void(0)">' + this.options.paginationNextText + '</a></li>',- '<li class="page-last"><a href="javascript:void(0)">' + this.options.paginationLastText + '</a></li>',+ '<li class="page-next"><a href="#">' + this.options.paginationNextText + '</a></li>','</ul>','</div>');-}this.$pagination.html(html.join(''));@@ -1288,14 +1496,6 @@$last = this.$pagination.find('.page-last');$number = this.$pagination.find('.page-number');- if (this.options.pageNumber <= 1) {- $first.addClass('disabled');- $pre.addClass('disabled');- }- if (this.options.pageNumber >= this.totalPages) {- $next.addClass('disabled');- $last.addClass('disabled');- }if (this.options.smartDisplay) {if (this.totalPages <= 1) {this.$pagination.find('div.pagination').hide();@@ -1307,6 +1507,16 @@// when data is empty, hide the paginationthis.$pagination[this.getData().length ? 'show' : 'hide']();}++ if (!this.options.paginationLoop) {+ if (this.options.pageNumber === 1) {+ $pre.addClass('disabled');+ }+ if (this.options.pageNumber === this.totalPages) {+ $next.addClass('disabled');+ }+ }+if ($allSelected) {this.options.pageSize = this.options.formatAllRows();}@@ -1348,26 +1558,39 @@this.$toolbar.find('.page-size').text(this.options.pageSize);this.updatePagination(event);+ return false;};BootstrapTable.prototype.onPageFirst = function (event) {this.options.pageNumber = 1;this.updatePagination(event);+ return false;};BootstrapTable.prototype.onPagePre = function (event) {- this.options.pageNumber--;+ if ((this.options.pageNumber - 1) === 0) {+ this.options.pageNumber = this.options.totalPages;+ } else {+ this.options.pageNumber--;+ }this.updatePagination(event);+ return false;};BootstrapTable.prototype.onPageNext = function (event) {- this.options.pageNumber++;+ if ((this.options.pageNumber + 1) > this.options.totalPages) {+ this.options.pageNumber = 1;+ } else {+ this.options.pageNumber++;+ }this.updatePagination(event);+ return false;};BootstrapTable.prototype.onPageLast = function (event) {this.options.pageNumber = this.totalPages;this.updatePagination(event);+ return false;};BootstrapTable.prototype.onPageNumber = function (event) {@@ -1376,55 +1599,138 @@}this.options.pageNumber = +$(event.currentTarget).text();this.updatePagination(event);+ return false;};- BootstrapTable.prototype.initBody = function (fixedScroll) {- var that = this,+ BootstrapTable.prototype.initRow = function(item, i, data, parentDom) {+ var that=this,+ key,html = [],- data = this.getData();+ style = {},+ csses = [],+ data_ = '',+ attributes = {},+ htmlAttributes = [];- this.trigger('pre-body', data);+ if ($.inArray(item, this.hiddenRows) > -1) {+ return;+ }- this.$body = this.$el.find('>tbody');- if (!this.$body.length) {- this.$body = $('<tbody></tbody>').appendTo(this.$el);+ style = calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);++ if (style && style.css) {+ for (key in style.css) {+ csses.push(key + ': ' + style.css[key]);+ }}- //Fix #389 Bootstrap-table-flatJSON is not working+ attributes = calculateObjectValue(this.options,+ this.options.rowAttributes, [item, i], attributes);- if (!this.options.pagination || this.options.sidePagination === 'server') {- this.pageFrom = 1;- this.pageTo = data.length;+ if (attributes) {+ for (key in attributes) {+ htmlAttributes.push(sprintf('%s="%s"', key, escapeHTML(attributes[key])));+ }}- for (var i = this.pageFrom - 1; i < this.pageTo; i++) {- var key,- item = data[i],- style = {},- csses = [],+ if (item._data && !$.isEmptyObject(item._data)) {+ $.each(item._data, function(k, v) {+ // ignore data-index+ if (k === 'index') {+ return;+ }+ data_ += sprintf(' data-%s="%s"', k, v);+ });+ }++ html.push('<tr',+ sprintf(' %s', htmlAttributes.join(' ')),+ sprintf(' id="%s"', $.isArray(item) ? undefined : item._id),+ sprintf(' class="%s"', style.classes || ($.isArray(item) ? undefined : item._class)),+ sprintf(' data-index="%s"', i),+ sprintf(' data-uniqueid="%s"', item[this.options.uniqueId]),+ sprintf('%s', data_),+ '>'+ );++ if (this.options.cardView) {+ html.push(sprintf('<td colspan="%s"><div class="card-views">', this.header.fields.length));+ }++ if (!this.options.cardView && this.options.detailView) {+ html.push('<td>',+ '<a class="detail-icon" href="#">',+ sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.detailOpen),+ '</a>',+ '</td>');+ }++ $.each(this.header.fields, function(j, field) {+ var text = '',+ value_ = getItemField(item, field, that.options.escape),+ value = '',+ type = '',+ cellStyle = {},+ id_ = '',+ class_ = that.header.classes[j],data_ = '',- attributes = {},- htmlAttributes = [];+ rowspan_ = '',+ colspan_ = '',+ title_ = '',+ column = that.columns[j];- style = calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);+ if (that.fromHtml && typeof value_ === 'undefined') {+ return;+ }- if (style && style.css) {- for (key in style.css) {- csses.push(key + ': ' + style.css[key]);- }+ if (!column.visible) {+ return;}- attributes = calculateObjectValue(this.options,- this.options.rowAttributes, [item, i], attributes);+ if (that.options.cardView && (!column.cardVisible)) {+ return;+ }++ if (column.escape) {+ value_ = escapeHTML(value_);+ }- if (attributes) {- for (key in attributes) {- htmlAttributes.push(sprintf('%s="%s"', key, escapeHTML(attributes[key])));+ style = sprintf('style="%s"', csses.concat(that.header.styles[j]).join('; '));++ // handle td's id and class+ if (item['_' + field + '_id']) {+ id_ = sprintf(' id="%s"', item['_' + field + '_id']);+ }+ if (item['_' + field + '_class']) {+ class_ = sprintf(' class="%s"', item['_' + field + '_class']);+ }+ if (item['_' + field + '_rowspan']) {+ rowspan_ = sprintf(' rowspan="%s"', item['_' + field + '_rowspan']);+ }+ if (item['_' + field + '_colspan']) {+ colspan_ = sprintf(' colspan="%s"', item['_' + field + '_colspan']);+ }+ if (item['_' + field + '_title']) {+ title_ = sprintf(' title="%s"', item['_' + field + '_title']);+ }+ cellStyle = calculateObjectValue(that.header,+ that.header.cellStyles[j], [value_, item, i, field], cellStyle);+ if (cellStyle.classes) {+ class_ = sprintf(' class="%s"', cellStyle.classes);+ }+ if (cellStyle.css) {+ var csses_ = [];+ for (var key in cellStyle.css) {+ csses_.push(key + ': ' + cellStyle.css[key]);}+ style = sprintf('style="%s"', csses_.concat(that.header.styles[j]).join('; '));}- if (item._data && !$.isEmptyObject(item._data)) {- $.each(item._data, function (k, v) {+ value = calculateObjectValue(column,+ that.header.formatters[j], [value_, item, i], value_);++ if (item['_' + field + '_data'] && !$.isEmptyObject(item['_' + field + '_data'])) {+ $.each(item['_' + field + '_data'], function(k, v) {// ignore data-indexif (k === 'index') {return;@@ -1433,146 +1739,101 @@});}- html.push('<tr',- sprintf(' %s', htmlAttributes.join(' ')),- sprintf(' id="%s"', $.isArray(item) ? undefined : item._id),- sprintf(' class="%s"', style.classes || ($.isArray(item) ? undefined : item._class)),- sprintf(' data-index="%s"', i),- sprintf(' data-uniqueid="%s"', item[this.options.uniqueId]),- sprintf('%s', data_),- '>'- );-- if (this.options.cardView) {- html.push(sprintf('<td colspan="%s">', this.header.fields.length));+ if (column.checkbox || column.radio) {+ type = column.checkbox ? 'checkbox' : type;+ type = column.radio ? 'radio' : type;++ text = [sprintf(that.options.cardView ?+ '<div class="card-view %s">' : '<td class="bs-checkbox %s">', column['class'] || ''),+ '<input' ++ sprintf(' data-index="%s"', i) ++ sprintf(' name="%s"', that.options.selectItemName) ++ sprintf(' type="%s"', type) ++ sprintf(' value="%s"', item[that.options.idField]) ++ sprintf(' checked="%s"', value === true ||+ (value_ || value && value.checked) ? 'checked' : undefined) ++ sprintf(' disabled="%s"', !column.checkboxEnabled ||+ (value && value.disabled) ? 'disabled' : undefined) ++ ' />',+ that.header.formatters[j] && typeof value === 'string' ? value : '',+ that.options.cardView ? '</div>' : '</td>'+ ].join('');++ item[that.header.stateField] = value === true || (value && value.checked);+ } else {+ value = typeof value === 'undefined' || value === null ?+ that.options.undefinedText : value;++ text = that.options.cardView ? ['<div class="card-view">',+ that.options.showHeader ? sprintf('<span class="title" %s>%s</span>', style,+ getPropertyFromOther(that.columns, 'field', 'title', field)) : '',+ sprintf('<span class="value">%s</span>', value),+ '</div>'+ ].join('') : [sprintf('<td%s %s %s %s %s %s %s>',+ id_, class_, style, data_, rowspan_, colspan_, title_),+ value,+ '</td>'+ ].join('');++ // Hide empty data on Card view when smartDisplay is set to true.+ if (that.options.cardView && that.options.smartDisplay && value === '') {+ // Should set a placeholder for event binding correct fieldIndex+ text = '<div class="card-view"></div>';+ }}- if (!this.options.cardView && this.options.detailView) {- html.push('<td>',- '<a class="detail-icon" href="javascript:">',- sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.detailOpen),- '</a>',- '</td>');- }+ html.push(text);+ });- $.each(this.header.fields, function (j, field) {- var text = '',- value = getItemField(item, field),- type = '',- cellStyle = {},- id_ = '',- class_ = that.header.classes[j],- data_ = '',- rowspan_ = '',- title_ = '',- column = that.columns[getFieldIndex(that.columns, field)];-- if (!column.visible) {- return;- }+ if (this.options.cardView) {+ html.push('</div></td>');+ }+ html.push('</tr>');- style = sprintf('style="%s"', csses.concat(that.header.styles[j]).join('; '));+ return html.join(' ');+ };- value = calculateObjectValue(column,- that.header.formatters[j], [value, item, i], value);+ BootstrapTable.prototype.initBody = function (fixedScroll) {+ var that = this,+ html = [],+ data = this.getData();- // handle td's id and class- if (item['_' + field + '_id']) {- id_ = sprintf(' id="%s"', item['_' + field + '_id']);- }- if (item['_' + field + '_class']) {- class_ = sprintf(' class="%s"', item['_' + field + '_class']);- }- if (item['_' + field + '_rowspan']) {- rowspan_ = sprintf(' rowspan="%s"', item['_' + field + '_rowspan']);- }- if (item['_' + field + '_title']) {- title_ = sprintf(' title="%s"', item['_' + field + '_title']);- }- cellStyle = calculateObjectValue(that.header,- that.header.cellStyles[j], [value, item, i], cellStyle);- if (cellStyle.classes) {- class_ = sprintf(' class="%s"', cellStyle.classes);- }- if (cellStyle.css) {- var csses_ = [];- for (var key in cellStyle.css) {- csses_.push(key + ': ' + cellStyle.css[key]);- }- style = sprintf('style="%s"', csses_.concat(that.header.styles[j]).join('; '));- }+ this.trigger('pre-body', data);- if (item['_' + field + '_data'] && !$.isEmptyObject(item['_' + field + '_data'])) {- $.each(item['_' + field + '_data'], function (k, v) {- // ignore data-index- if (k === 'index') {- return;- }- data_ += sprintf(' data-%s="%s"', k, v);- });- }+ this.$body = this.$el.find('>tbody');+ if (!this.$body.length) {+ this.$body = $('<tbody></tbody>').appendTo(this.$el);+ }- if (column.checkbox || column.radio) {- type = column.checkbox ? 'checkbox' : type;- type = column.radio ? 'radio' : type;-- text = [that.options.cardView ?- '<div class="card-view">' : '<td class="bs-checkbox">',- '<input' +- sprintf(' data-index="%s"', i) +- sprintf(' name="%s"', that.options.selectItemName) +- sprintf(' type="%s"', type) +- sprintf(' value="%s"', item[that.options.idField]) +- sprintf(' checked="%s"', value === true ||- (value && value.checked) ? 'checked' : undefined) +- sprintf(' disabled="%s"', !column.checkboxEnabled ||- (value && value.disabled) ? 'disabled' : undefined) +- ' />',- that.header.formatters[j] && typeof value === 'string' ? value : '',- that.options.cardView ? '</div>' : '</td>'- ].join('');-- item[that.header.stateField] = value === true || (value && value.checked);- } else {- value = typeof value === 'undefined' || value === null ?- that.options.undefinedText : value;-- text = that.options.cardView ? ['<div class="card-view">',- that.options.showHeader ? sprintf('<span class="title" %s>%s</span>', style,- getPropertyFromOther(that.columns, 'field', 'title', field)) : '',- sprintf('<span class="value">%s</span>', value),- '</div>'- ].join('') : [sprintf('<td%s %s %s %s %s %s>', id_, class_, style, data_, rowspan_, title_),- value,- '</td>'- ].join('');-- // Hide empty data on Card view when smartDisplay is set to true.- if (that.options.cardView && that.options.smartDisplay && value === '') {- // Should set a placeholder for event binding correct fieldIndex- text = '<div class="card-view"></div>';- }- }+ //Fix #389 Bootstrap-table-flatJSON is not working- html.push(text);- });+ if (!this.options.pagination || this.options.sidePagination === 'server') {+ this.pageFrom = 1;+ this.pageTo = data.length;+ }- if (this.options.cardView) {- html.push('</td>');- }+ var trFragments = $(document.createDocumentFragment());+ var hasTr;- html.push('</tr>');+ for (var i = this.pageFrom - 1; i < this.pageTo; i++) {+ var item = data[i];+ var tr = this.initRow(item, i, data, trFragments);+ hasTr = hasTr || !!tr;+ if (tr&&tr!==true) {+ trFragments.append(tr);+ }}// show no records- if (!html.length) {- html.push('<tr class="no-records-found">',+ if (!hasTr) {+ trFragments.append('<tr class="no-records-found">' +sprintf('<td colspan="%s">%s</td>',- this.$header.find('th').length, this.options.formatNoMatches()),+ this.$header.find('th').length,+ this.options.formatNoMatches()) +'</tr>');}- this.$body.html(html.join(''));+ this.$body.html(trFragments);if (!fixedScroll) {this.scrollTo(0);@@ -1584,16 +1845,17 @@$tr = $td.parent(),item = that.data[$tr.data('index')],index = $td[0].cellIndex,- field = that.header.fields[that.options.detailView && !that.options.cardView ? index - 1 : index],+ fields = that.getVisibleFields(),+ field = fields[that.options.detailView && !that.options.cardView ? index - 1 : index],column = that.columns[getFieldIndex(that.columns, field)],- value = getItemField(item, field);+ value = getItemField(item, field, that.options.escape);if ($td.find('.detail-icon').length) {return;}that.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);- that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr);+ that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field);// if click to select - then trigger the checkbox/radio clickif (e.type === 'click' && that.options.clickToSelect && column.clickToSelect) {@@ -1613,16 +1875,20 @@// remove and updateif ($tr.next().is('tr.detail-view')) {$this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen));- $tr.next().remove();that.trigger('collapse-row', index, row);+ $tr.next().remove();} else {$this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose));- $tr.after(sprintf('<tr class="detail-view"><td colspan="%s">%s</td></tr>',- $tr.find('td').length, calculateObjectValue(that.options,- that.options.detailFormatter, [index, row], '')));- that.trigger('expand-row', index, row, $tr.next().find('td'));+ $tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.find('td').length));+ var $element = $tr.next().find('td');+ var content = calculateObjectValue(that.options, that.options.detailFormatter, [index, row, $element], '');+ if($element.length === 1) {+ $element.append(content);+ }+ that.trigger('expand-row', index, row, $element);}that.resetView();+ return false;});this.$selectItem = this.$body.find(sprintf('[name="%s"]', this.options.selectItemName));@@ -1691,23 +1957,26 @@this.updateSelected();this.resetView();- this.trigger('post-body');+ this.trigger('post-body', data);};- BootstrapTable.prototype.initServer = function (silent, query) {+ BootstrapTable.prototype.initServer = function (silent, query, url) {var that = this,data = {},params = {- pageSize: this.options.pageSize === this.options.formatAllRows() ?- this.options.totalRows : this.options.pageSize,- pageNumber: this.options.pageNumber,searchText: this.searchText,sortName: this.options.sortName,sortOrder: this.options.sortOrder},request;- if (!this.options.url && !this.options.ajax) {+ if (this.options.pagination) {+ params.pageSize = this.options.pageSize === this.options.formatAllRows() ?+ this.options.totalRows : this.options.pageSize;+ params.pageNumber = this.options.pageNumber;+ }++ if (!(url || this.options.url) && !this.options.ajax) {return;}@@ -1717,16 +1986,17 @@sort: params.sortName,order: params.sortOrder};+if (this.options.pagination) {- params.limit = this.options.pageSize === this.options.formatAllRows() ?- this.options.totalRows : this.options.pageSize;params.offset = this.options.pageSize === this.options.formatAllRows() ?0 : this.options.pageSize * (this.options.pageNumber - 1);+ params.limit = this.options.pageSize === this.options.formatAllRows() ?+ this.options.totalRows : this.options.pageSize;}}if (!($.isEmptyObject(this.filterColumnsPartial))) {- params['filter'] = JSON.stringify(this.filterColumnsPartial, null);+ params.filter = JSON.stringify(this.filterColumnsPartial, null);}data = calculateObjectValue(this.options, this.options.queryParams, [params], data);@@ -1743,7 +2013,7 @@}request = $.extend({}, calculateObjectValue(null, this.options.ajaxOptions), {type: this.options.method,- url: this.options.url,+ url: url || this.options.url,data: this.options.contentType === 'application/json' && this.options.method === 'post' ?JSON.stringify(data) : data,cache: this.options.cache,@@ -1754,21 +2024,21 @@that.load(res);that.trigger('load-success', res);+ if (!silent) that.$tableLoading.hide();},error: function (res) {that.trigger('load-error', res.status, res);- },- complete: function () {- if (!silent) {- that.$tableLoading.hide();- }+ if (!silent) that.$tableLoading.hide();}});if (this.options.ajax) {calculateObjectValue(this, this.options.ajax, [request], null);} else {- $.ajax(request);+ if (this._xhr && this._xhr.readyState !== 4) {+ this._xhr.abort();+ }+ this._xhr = $.ajax(request);}};@@ -1820,6 +2090,7 @@row[that.header.stateField] = false;}});+ this.initHiddenRows();};BootstrapTable.prototype.trigger = function (name) {@@ -1893,7 +2164,8 @@that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data());});- var visibleFields = this.getVisibleFields();+ var visibleFields = this.getVisibleFields(),+ $ths = this.$header_.find('th');this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) {var $this = $(this),@@ -1906,8 +2178,12 @@index = i - 1;}- that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index]))- .find('.fht-cell').width($this.innerWidth());+ var $th = that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index]));+ if ($th.length > 1) {+ $th = $($ths[$this[0].cellIndex]);+ }++ $th.find('.fht-cell').width($this.innerWidth());});// horizontal scroll event// TODO: it's probably better improving the layout than binding to scroll event@@ -1935,8 +2211,11 @@}$.each(this.columns, function (i, column) {- var falign = '', // footer align style- style = '',+ var key,+ falign = '', // footer align style+ valign = '',+ csses = [],+ style = {},class_ = sprintf(' class="%s"', column['class']);if (!column.visible) {@@ -1948,9 +2227,17 @@}falign = sprintf('text-align: %s; ', column.falign ? column.falign : column.align);- style = sprintf('vertical-align: %s; ', column.valign);+ valign = sprintf('vertical-align: %s; ', column.valign);++ style = calculateObjectValue(null, that.options.footerStyle);- html.push('<td', class_, sprintf(' style="%s"', falign + style), '>');+ if (style && style.css) {+ for (key in style.css) {+ csses.push(key + ': ' + style.css[key]);+ }+ }++ html.push('<td', class_, sprintf(' style="%s"', falign + valign + csses.concat().join('; ')), '>');html.push('<div class="th-inner">');html.push(calculateObjectValue(column, column.footerFormatter, [data], ' ') || ' ');@@ -1962,6 +2249,7 @@});this.$tableFooter.find('tr').html(html.join(''));+ this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this),this.$el.is(':hidden') ? 100 : 0);@@ -2019,17 +2307,6 @@}};- BootstrapTable.prototype.toggleRow = function (index, uniqueId, visible) {- if (index === -1) {- return;- }-- this.$body.find(typeof index !== 'undefined' ?- sprintf('tr[data-index="%s"]', index) :- sprintf('tr[data-uniqueid="%s"]', uniqueId))- [visible ? 'show' : 'hide']();- };-BootstrapTable.prototype.getVisibleFields = function () {var that = this,visibleFields = [];@@ -2059,8 +2336,8 @@this.$selectItem.length === this.$selectItem.filter(':checked').length);if (this.options.height) {- var toolbarHeight = getRealHeight(this.$toolbar),- paginationHeight = getRealHeight(this.$pagination),+ var toolbarHeight = this.$toolbar.outerHeight(true),+ paginationHeight = this.$pagination.outerHeight(true),height = this.options.height - toolbarHeight - paginationHeight;this.$tableContainer.css('height', height + 'px');@@ -2070,6 +2347,7 @@// remove the element cssthis.$el.css('margin-top', '0');this.$tableContainer.css('padding-bottom', '0');+ this.$tableFooter.hide();return;}@@ -2106,7 +2384,7 @@// #431: support paginationif (this.options.sidePagination === 'server') {- this.options.totalRows = data.total;+ this.options.totalRows = data[this.options.totalField];fixedScroll = data.fixedScroll;data = data[this.options.dataField];} else if (!$.isArray(data)) { // support fixedScroll@@ -2124,6 +2402,7 @@this.initData(data, 'append');this.initSearch();this.initPagination();+ this.initSort();this.initBody(true);};@@ -2131,6 +2410,7 @@this.initData(data, 'prepend');this.initSearch();this.initPagination();+ this.initSort();this.initBody(true);};@@ -2150,6 +2430,9 @@}if ($.inArray(row[params.field], params.values) !== -1) {this.options.data.splice(i, 1);+ if (this.options.sidePagination === 'server') {+ this.options.totalRows -= 1;+ }}}@@ -2159,6 +2442,7 @@this.initSearch();this.initPagination();+ this.initSort();this.initBody(true);};@@ -2225,19 +2509,26 @@};BootstrapTable.prototype.updateByUniqueId = function (params) {- var rowId;+ var that = this;+ var allParams = $.isArray(params) ? params : [ params ];- if (!params.hasOwnProperty('id') || !params.hasOwnProperty('row')) {- return;- }+ $.each(allParams, function(i, params) {+ var rowId;- rowId = $.inArray(this.getRowByUniqueId(params.id), this.options.data);+ if (!params.hasOwnProperty('id') || !params.hasOwnProperty('row')) {+ return;+ }- if (rowId === -1) {- return;- }+ rowId = $.inArray(that.getRowByUniqueId(params.id), that.options.data);- $.extend(this.data[rowId], params.row);+ if (rowId === -1) {+ return;+ }+ $.extend(that.options.data[rowId], params.row);+ });++ this.initSearch();+ this.initPagination();this.initSort();this.initBody(true);};@@ -2254,36 +2545,68 @@};BootstrapTable.prototype.updateRow = function (params) {- if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {- return;- }- $.extend(this.data[params.index], params.row);+ var that = this;+ var allParams = $.isArray(params) ? params : [ params ];++ $.each(allParams, function(i, params) {+ if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {+ return;+ }+ $.extend(that.options.data[params.index], params.row);+ });++ this.initSearch();+ this.initPagination();this.initSort();this.initBody(true);};+ BootstrapTable.prototype.initHiddenRows = function () {+ this.hiddenRows = [];+ };+BootstrapTable.prototype.showRow = function (params) {- if (!params.hasOwnProperty('index') || !params.hasOwnProperty('uniqueId')) {- return;- }- this.toggleRow(params.index, params.uniqueId, true);+ this.toggleRow(params, true);};BootstrapTable.prototype.hideRow = function (params) {- if (!params.hasOwnProperty('index') || !params.hasOwnProperty('uniqueId')) {+ this.toggleRow(params, false);+ };++ BootstrapTable.prototype.toggleRow = function (params, visible) {+ var row, index;++ if (params.hasOwnProperty('index')) {+ row = this.getData()[params.index];+ } else if (params.hasOwnProperty('uniqueId')) {+ row = this.getRowByUniqueId(params.uniqueId);+ }++ if (!row) {return;}- this.toggleRow(params.index, params.uniqueId, false);++ index = $.inArray(row, this.hiddenRows);++ if (!visible && index === -1) {+ this.hiddenRows.push(row);+ } else if (visible && index > -1) {+ this.hiddenRows.splice(index, 1);+ }+ this.initBody(true);};- BootstrapTable.prototype.getRowsHidden = function (show) {- var rows = $(this.$body[0]).children().filter(':hidden'),- i = 0;- if (show) {- for (; i < rows.length; i++) {- $(rows[i]).show();+ BootstrapTable.prototype.getHiddenRows = function (show) {+ var that = this,+ data = this.getData(),+ rows = [];++ $.each(data, function (i, row) {+ if ($.inArray(row, that.hiddenRows) > -1) {+ rows.push(row);}- }+ });+ this.hiddenRows = rows;return rows;};@@ -2322,6 +2645,10 @@return;}this.data[params.index][params.field] = params.value;++ if (params.reinit === false) {+ return;+ }this.initSort();this.initBody(true);};@@ -2333,8 +2660,9 @@BootstrapTable.prototype.getSelections = function () {var that = this;- return $.grep(this.data, function (row) {- return row[that.header.stateField];+ return $.grep(this.options.data, function (row) {+ // fix #2424: from html with checkbox+ return row[that.header.stateField] === true;});};@@ -2354,6 +2682,20 @@this.checkAll_(false);};+ BootstrapTable.prototype.checkInvert = function () {+ var that = this;+ var rows = that.$selectItem.filter(':enabled');+ var checked = rows.filter(':checked');+ rows.each(function() {+ $(this).prop('checked', !$(this).prop('checked'));+ });+ that.updateRows();+ that.updateSelected();+ that.trigger('uncheck-some', checked);+ checked = that.getSelections();+ that.trigger('check-some', checked);+ };+BootstrapTable.prototype.checkAll_ = function (checked) {var rows;if (!checked) {@@ -2446,9 +2788,16 @@BootstrapTable.prototype.refresh = function (params) {if (params && params.url) {this.options.url = params.url;- this.options.pageNumber = 1;}- this.initServer(params && params.silent, params && params.query);+ if (params && params.pageNumber) {+ this.options.pageNumber = params.pageNumber;+ }+ if (params && params.pageSize) {+ this.options.pageSize = params.pageSize;+ }+ this.initServer(params && params.silent,+ params && params.query, params && params.url);+ this.trigger('refresh', params);};BootstrapTable.prototype.resetWidth = function () {@@ -2474,6 +2823,38 @@});};+ BootstrapTable.prototype.getVisibleColumns = function () {+ return $.grep(this.columns, function (column) {+ return column.visible;+ });+ };++ BootstrapTable.prototype.toggleAllColumns = function (visible) {+ $.each(this.columns, function (i, column) {+ this.columns[i].visible = visible;+ });++ this.initHeader();+ this.initSearch();+ this.initPagination();+ this.initBody();+ if (this.options.showColumns) {+ var $items = this.$toolbar.find('.keep-open input').prop('disabled', false);++ if ($items.filter(':checked').length <= this.options.minimumCountColumns) {+ $items.filter(':checked').prop('disabled', true);+ }+ }+ };++ BootstrapTable.prototype.showAllColumns = function () {+ this.toggleAllColumns(true);+ };++ BootstrapTable.prototype.hideAllColumns = function () {+ this.toggleAllColumns(false);+ };+BootstrapTable.prototype.filterBy = function (columns) {this.filterColumns = $.isEmptyObject(columns) ? {} : columns;this.options.pageNumber = 1;@@ -2529,7 +2910,7 @@BootstrapTable.prototype.refreshOptions = function (options) {//If the objects are equivalent then avoid the call of destroy / init methods- if (compareObjects(this.options, options, false)) {+ if (compareObjects(this.options, options, true)) {return;}this.options = $.extend(this.options, options);@@ -2608,6 +2989,21 @@}};+ BootstrapTable.prototype.updateFormatText = function (name, text) {+ if (this.options[sprintf('format%s', name)]) {+ if (typeof text === 'string') {+ this.options[sprintf('format%s', name)] = function () {+ return text;+ };+ } else if (typeof text === 'function') {+ this.options[sprintf('format%s', name)] = text;+ }+ }+ this.initToolbar();+ this.initPagination();+ this.initBody();+ };+// BOOTSTRAP TABLE PLUGIN DEFINITION// =======================@@ -2616,9 +3012,9 @@'getSelections', 'getAllSelections', 'getData','load', 'append', 'prepend', 'remove', 'removeAll','insertRow', 'updateRow', 'updateCell', 'updateByUniqueId', 'removeByUniqueId',- 'getRowByUniqueId', 'showRow', 'hideRow', 'getRowsHidden',+ 'getRowByUniqueId', 'showRow', 'hideRow', 'getHiddenRows','mergeCells',- 'checkAll', 'uncheckAll',+ 'checkAll', 'uncheckAll', 'checkInvert','check', 'uncheck','checkBy', 'uncheckBy','refresh',@@ -2626,7 +3022,8 @@'resetWidth','destroy','showLoading', 'hideLoading',- 'showColumn', 'hideColumn', 'getHiddenColumns',+ 'showColumn', 'hideColumn', 'getHiddenColumns', 'getVisibleColumns',+ 'showAllColumns', 'hideAllColumns','filterBy','scrollTo','getScrollPosition',@@ -2635,7 +3032,8 @@'toggleView','refreshOptions','resetSearch',- 'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows'+ 'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows',+ 'updateFormatText'];$.fn.bootstrapTable = function (option) {@@ -2681,7 +3079,10 @@sprintf: sprintf,getFieldIndex: getFieldIndex,compareObjects: compareObjects,- calculateObjectValue: calculateObjectValue+ calculateObjectValue: calculateObjectValue,+ getItemField: getItemField,+ objectKeys: objectKeys,+ isIEBrowser: isIEBrowser};// BOOTSTRAP TABLE INIT@@ -2690,5 +3091,4 @@$(function () {$('[data-toggle="table"]').bootstrapTable();});--}(jQuery);+})(jQuery);diff --git a/public/js/bootstrap-table.min.js b/public/js/bootstrap-table.min.jsindex 3fe39fc786..9723e1a67d 100755--- a/public/js/bootstrap-table.min.js+++ b/public/js/bootstrap-table.min.js@@ -1,8 +1,8 @@/*-* bootstrap-table - v1.10.1 - 2016-02-17+* bootstrap-table - v1.11.1 - 2017-02-22* https://github.com/wenzhixin/bootstrap-table-* Copyright (c) 2016 zhixin wen+* Copyright (c) 2017 zhixin wen* Licensed MIT License*/-!function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`"):a},k=function(b){var c=0;return b.children().each(function(){c<a(this).outerHeight(!0)&&(c=a(this).outerHeight(!0))}),c},l=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},m=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)d=d&&d[e[f]];return c?j(d):d},n=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},o=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};o.DEFAULTS={classes:"table table-hover",locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",striped:!1,columns:[[]],data:[],dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"‹",paginationNextText:"›",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},rowStyle:function(){return{}},rowAttributes:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onResetView:function(){return!1}},o.LOCALES=[],o.LOCALES["en-US"]=o.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s records per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(o.DEFAULTS,o.LOCALES["en-US"]),o.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0},o.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView"},o.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},o.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},o.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},o.prototype.initTable=function(){var b=this,c=[],d=[];this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},o.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),this.options.data.length||(this.$el.find(">tbody>tr").each(function(){var c={};c._id=a(this).attr("id"),c._class=a(this).attr("class"),c._data=l(a(this).data()),a(this).find("td").each(function(d){var e=b.columns[d].field;c[e]=a(this).html(),c["_"+e+"_id"]=a(this).attr("id"),c["_"+e+"_class"]=a(this).attr("class"),c["_"+e+"_rowspan"]=a(this).attr("rowspan"),c["_"+e+"_title"]=a(this).attr("title"),c["_"+e+"_data"]=l(a(this).data())}),d.push(c)}),this.options.data=d)},o.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0==f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",j="",k=c(' class="%s"',f["class"]),l=(b.options.sortOrder||f.order,"px"),m=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(l="%"),f.width&&"string"==typeof f.width&&(m=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),j=c("vertical-align: %s; ",f.valign),j+=c("width: %s; ",!f.checkbox&&!f.radio||m?m?m+l:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+j,b.header.classes[f.fieldIndex]=k,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):k,c(' style="%s"',h+j),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),"tabindex='0'",">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret()),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},o.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},o.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},o.prototype.initSort=function(){var b=this,c=this.options.sortName,d="desc"===this.options.sortOrder?-1:1,e=a.inArray(this.options.sortName,this.header.fields);-1!==e&&this.data.sort(function(f,g){b.header.sortNames[e]&&(c=b.header.sortNames[e]);var i=m(f,c,b.options.escape),j=m(g,c,b.options.escape),k=h(b.header,b.header.sorters[e],[i,j]);return void 0!==k?d*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*d:d):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*d:d))})},o.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},o.prototype.initToolbar=function(){var b,d,f=this,g=[],i=0,j=0;this.$toolbar.find(".bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),g=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&g.push(c('<button class="btn btn-default" type="button" name="paginationSwitch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&g.push(c('<button class="btn btn-default'+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&g.push(c('<button class="btn btn-default'+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(g.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" class="btn btn-default'+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||f.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(g.push(c('<li><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),j++)}}),g.push("</ul>","</div>")),g.push("</div>"),(this.showToolbar||g.length>2)&&this.$toolbar.append(g.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){f.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),j<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);f.toggleColumn(e(f.columns,a(this).data("field")),b.prop("checked"),!1),f.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(g=[],g.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(g.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop").on("keyup drop",function(a){f.options.searchOnEnterKey&&13!==a.keyCode||(clearTimeout(i),i=setTimeout(function(){f.onSearch(a)},f.options.searchTimeOut))}),n()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(i),i=setTimeout(function(){f.onSearch(a)},f.options.searchTimeOut)}))},o.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},o.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){var c=this.searchText&&this.searchText.toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])){if(-1===a.inArray(b[c],d[c]))return!1}else if(b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g in d){g=a.isNumeric(g)?parseInt(g,10):g;var i=d[g],j=b.columns[e(b.columns,g)],k=a.inArray(g,b.header.fields);j&&j.searchFormatter&&(i=h(j,b.header.formatters[k],[i,d,f],i));var l=a.inArray(g,b.header.fields);if(-1!==l&&b.header.searchables[l]&&("string"==typeof i||"number"==typeof i))if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},o.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData();if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var p="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),p)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var q=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn btn-default '+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'],r=this.options.pageList;if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");r=[],a.each(s,function(a,b){r.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(r,function(a,b){if(!l.options.smartDisplay||0===a||r[a-1]<=l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",q.push(c('<li%s><a href="javascript:void(0)">%s</a></li>',d,b))}}),q.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(q.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="javascript:void(0)">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="javascript:void(0)">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="javascript:void(0)">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="javascript:void(0)">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="javascript:void(0)">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="javascript:void(0)">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="javascript:void(0)">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(r.length<2||this.options.totalRows<=r[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},o.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},o.prototype.onPageListChange=function(b){var c=a(b.currentTarget);c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b)},o.prototype.onPageFirst=function(a){this.options.pageNumber=1,this.updatePagination(a)},o.prototype.onPagePre=function(a){this.options.pageNumber-1==0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a)},o.prototype.onPageNext=function(a){this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a)},o.prototype.onPageLast=function(a){this.options.pageNumber=this.totalPages,this.updatePagination(a)},o.prototype.onPageNumber=function(b){this.options.pageNumber!==+a(b.currentTarget).text()&&(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b))},o.prototype.initBody=function(b){var f=this,g=[],i=this.getData();this.trigger("pre-body",i),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=i.length);for(var k=this.pageFrom-1;k<this.pageTo;k++){var l,n=i[k],o={},p=[],q="",r={},s=[];if(o=h(this.options,this.options.rowStyle,[n,k],o),o&&o.css)for(l in o.css)p.push(l+": "+o.css[l]);if(r=h(this.options,this.options.rowAttributes,[n,k],r))for(l in r)s.push(c('%s="%s"',l,j(r[l])));n._data&&!a.isEmptyObject(n._data)&&a.each(n._data,function(a,b){"index"!==a&&(q+=c(' data-%s="%s"',a,b))}),g.push("<tr",c(" %s",s.join(" ")),c(' id="%s"',a.isArray(n)?void 0:n._id),c(' class="%s"',o.classes||(a.isArray(n)?void 0:n._class)),c(' data-index="%s"',k),c(' data-uniqueid="%s"',n[this.options.uniqueId]),c("%s",q),">"),this.options.cardView&&g.push(c('<td colspan="%s">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&g.push("<td>",'<a class="detail-icon" href="javascript:">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(b,i){var j="",l=m(n,i,f.options.escape),q="",r={},s="",t=f.header.classes[b],u="",v="",w="",x=f.columns[e(f.columns,i)];if(x.visible){if(o=c('style="%s"',p.concat(f.header.styles[b]).join("; ")),l=h(x,f.header.formatters[b],[l,n,k],l),n["_"+i+"_id"]&&(s=c(' id="%s"',n["_"+i+"_id"])),n["_"+i+"_class"]&&(t=c(' class="%s"',n["_"+i+"_class"])),n["_"+i+"_rowspan"]&&(v=c(' rowspan="%s"',n["_"+i+"_rowspan"])),n["_"+i+"_title"]&&(w=c(' title="%s"',n["_"+i+"_title"])),r=h(f.header,f.header.cellStyles[b],[l,n,k],r),r.classes&&(t=c(' class="%s"',r.classes)),r.css){var y=[];for(var z in r.css)y.push(z+": "+r.css[z]);o=c('style="%s"',y.concat(f.header.styles[b]).join("; "))}n["_"+i+"_data"]&&!a.isEmptyObject(n["_"+i+"_data"])&&a.each(n["_"+i+"_data"],function(a,b){"index"!==a&&(u+=c(' data-%s="%s"',a,b))}),x.checkbox||x.radio?(q=x.checkbox?"checkbox":q,q=x.radio?"radio":q,j=[c(f.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',x["class"]||""),"<input"+c(' data-index="%s"',k)+c(' name="%s"',f.options.selectItemName)+c(' type="%s"',q)+c(' value="%s"',n[f.options.idField])+c(' checked="%s"',l===!0||l&&l.checked?"checked":void 0)+c(' disabled="%s"',!x.checkboxEnabled||l&&l.disabled?"disabled":void 0)+" />",f.header.formatters[b]&&"string"==typeof l?l:"",f.options.cardView?"</div>":"</td>"].join(""),n[f.header.stateField]=l===!0||l&&l.checked):(l="undefined"==typeof l||null===l?f.options.undefinedText:l,j=f.options.cardView?['<div class="card-view">',f.options.showHeader?c('<span class="title" %s>%s</span>',o,d(f.columns,"field","title",i)):"",c('<span class="value">%s</span>',l),"</div>"].join(""):[c("<td%s %s %s %s %s %s>",s,t,o,u,v,w),l,"</td>"].join(""),f.options.cardView&&f.options.smartDisplay&&""===l&&(j='<div class="card-view"></div>')),g.push(j)}}),this.options.cardView&&g.push("</td>"),g.push("</tr>")}g.length||g.push('<tr class="no-records-found">',c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches()),"</tr>"),this.$body.html(g.join("")),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var d=a(this),g=d.parent(),h=f.data[g.data("index")],i=d[0].cellIndex,j=f.header.fields[f.options.detailView&&!f.options.cardView?i-1:i],k=f.columns[e(f.columns,j)],l=m(h,j,f.options.escape);if(!d.find(".detail-icon").length&&(f.trigger("click"===b.type?"click-cell":"dbl-click-cell",j,l,h,d),f.trigger("click"===b.type?"click-row":"dbl-click-row",h,g),"click"===b.type&&f.options.clickToSelect&&k.clickToSelect)){var n=g.find(c('[name="%s"]',f.options.selectItemName));n.length&&n[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),d=b.parent().parent(),e=d.data("index"),g=i[e];if(d.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",f.options.iconsPrefix,f.options.icons.detailOpen)),d.next().remove(),f.trigger("collapse-row",e,g);else{b.find("i").attr("class",c("%s %s",f.options.iconsPrefix,f.options.icons.detailClose)),d.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',d.find("td").length));var j=d.next().find("td"),k=h(f.options,f.options.detailFormatter,[e,g,j],"");1===j.length&&j.append(k),f.trigger("expand-row",e,g,j)}f.resetView()}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),d=c.prop("checked"),e=f.data[c.data("index")];f.options.maintainSelected&&a(this).is(":radio")&&a.each(f.options.data,function(a,b){b[f.header.stateField]=!1}),e[f.header.stateField]=d,f.options.singleSelect&&(f.$selectItem.not(this).each(function(){f.data[a(this).data("index")][f.header.stateField]=!1}),f.$selectItem.filter(":checked").not(this).prop("checked",!1)),f.updateSelected(),f.trigger(d?"check":"uncheck",e,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var d=f.header.fields[b],e=a.inArray(d,f.getVisibleFields());f.options.detailView&&!f.options.cardView&&(e+=1);for(var g in c)f.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(f.options.cardView?".card-view":"td").eq(e),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),e=f.data[c],g=e[d];l.apply(this,[a,g,e,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body")},o.prototype.initServer=function(b,c){var d,e=this,f={},g={-searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(g.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,g.pageNumber=this.options.pageNumber),(this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(g={search:g.searchText,sort:g.sortName,order:g.sortOrder},this.options.pagination&&(g.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,g.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1))),a.isEmptyObject(this.filterColumnsPartial)||(g.filter=JSON.stringify(this.filterColumnsPartial,null)),f=h(this.options,this.options.queryParams,[g],f),a.extend(f,c||{}),f!==!1&&(b||this.$tableLoading.show(),d=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(f):f,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(e.options,e.options.responseHandler,[a],a),e.load(a),e.trigger("load-success",a),b||e.$tableLoading.hide()},error:function(a){e.trigger("load-error",a.status,a),b||e.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[d],null):a.ajax(d)))},o.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},o.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},o.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},o.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},o.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)})},o.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[o.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},o.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},o.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields();this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1),h.$header_.find(c('th[data-field="%s"]',l[e])).find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},o.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner"> </div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g="",i="",j=c(' class="%s"',f["class"]);f.visible&&(!b.options.cardView||f.cardVisible)&&(g=c("text-align: %s; ",f.falign?f.falign:f.align),i=c("vertical-align: %s; ",f.valign),e.push("<td",j,c(' style="%s"',g+i),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d]," ")||" "),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>"))}),this.$tableFooter.find("tr").html(e.join("")),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},o.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},o.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},o.prototype.toggleRow=function(a,b,d){-1!==a&&this.$body.find("undefined"!=typeof a?c('tr[data-index="%s"]',a):c('tr[data-uniqueid="%s"]',b))[d?"show":"hide"]()},o.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},o.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=k(this.$toolbar),d=k(this.$pagination),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),void this.$tableContainer.css("padding-bottom","0")):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},o.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},o.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b.total,c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},o.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&this.options.data.splice(c,1);e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},o.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},o.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.updateByUniqueId=function(b){var c;b.hasOwnProperty("id")&&b.hasOwnProperty("row")&&(c=a.inArray(this.getRowByUniqueId(b.id),this.options.data),-1!==c&&(a.extend(this.data[c],b.row),this.initSort(),this.initBody(!0)))},o.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},o.prototype.updateRow=function(b){b.hasOwnProperty("index")&&b.hasOwnProperty("row")&&(a.extend(this.data[b.index],b.row),this.initSort(),this.initBody(!0))},o.prototype.showRow=function(a){(a.hasOwnProperty("index")||a.hasOwnProperty("uniqueId"))&&this.toggleRow(a.index,a.uniqueId,!0)},o.prototype.hideRow=function(a){(a.hasOwnProperty("index")||a.hasOwnProperty("uniqueId"))&&this.toggleRow(a.index,a.uniqueId,!1)},o.prototype.getRowsHidden=function(b){var c=a(this.$body[0]).children().filter(":hidden"),d=0;if(b)for(;d<c.length;d++)a(c[d]).show();return c},o.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},o.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},o.prototype.getOptions=function(){return this.options},o.prototype.getSelections=function(){var b=this;return a.grep(this.data,function(a){return a[b.header.stateField]})},o.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},o.prototype.checkAll=function(){this.checkAll_(!0)},o.prototype.uncheckAll=function(){this.checkAll_(!1)},o.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},o.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},o.prototype.check=function(a){this.check_(!0,a)},o.prototype.uncheck=function(a){this.check_(!1,a)},o.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},o.prototype.checkBy=function(a){this.checkBy_(!0,a)},o.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},o.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},o.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},o.prototype.showLoading=function(){this.$tableLoading.show()},o.prototype.hideLoading=function(){this.$tableLoading.hide()},o.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},o.prototype.refresh=function(a){a&&a.url&&(this.options.url=a.url,this.options.pageNumber=1),this.initServer(a&&a.silent,a&&a.query)},o.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},o.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},o.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},o.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},o.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},o.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},o.prototype.getScrollPosition=function(){return this.scrollTo()},o.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},o.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},o.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},o.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},o.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},o.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},o.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},o.prototype.expandRow=function(a){this.expandRow_(!0,a)},o.prototype.collapseRow=function(a){this.expandRow_(!1,a)},o.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},o.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},o.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var p=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getRowsHidden","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},o.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,p)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new o(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=o,a.fn.bootstrapTable.defaults=o.DEFAULTS,a.fn.bootstrapTable.columnDefaults=o.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=o.LOCALES,a.fn.bootstrapTable.methods=p,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery);\ No newline at end of file+!function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e||[]):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`"):a},k=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},l=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)e.hasOwnProperty(f)&&(d=d&&d[e[f]]);return c?j(d):d},m=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},n=function(){Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}())},o=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};o.DEFAULTS={classes:"table table-hover",sortClass:void 0,locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"‹",paginationNextText:"›",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:a.noop,customSort:a.noop,rowStyle:function(){return{}},rowAttributes:function(){return{}},footerStyle:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onRefresh:function(){return!1},onResetView:function(){return!1}},o.LOCALES={},o.LOCALES["en-US"]=o.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s rows per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(o.DEFAULTS,o.LOCALES["en-US"]),o.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0,escape:!1},o.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},o.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},o.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},o.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},o.prototype.initTable=function(){var b=this,c=[],d=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){"undefined"!=typeof a(this).data("field")&&a(this).data("field",a(this).data("field")+""),b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},o.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),!this.options.data.length){var e=[];this.$el.find(">tbody>tr").each(function(c){var f={};f._id=a(this).attr("id"),f._class=a(this).attr("class"),f._data=k(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,l=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+l>h;h++)e[h]||(e[h]=[]),e[h][g]=!0;var m=b.columns[d].field;f[m]=a(this).html(),f["_"+m+"_id"]=a(this).attr("id"),f["_"+m+"_class"]=a(this).attr("class"),f["_"+m+"_rowspan"]=a(this).attr("rowspan"),f["_"+m+"_colspan"]=a(this).attr("colspan"),f["_"+m+"_title"]=a(this).attr("title"),f["_"+m+"_data"]=k(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},o.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0===f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",k="",l=c(' class="%s"',f["class"]),m=(b.options.sortOrder||f.order,"px"),n=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(m="%"),f.width&&"string"==typeof f.width&&(n=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),k=c("vertical-align: %s; ",f.valign),k+=c("width: %s; ",!f.checkbox&&!f.radio||n?n?n+m:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+k,b.header.classes[f.fieldIndex]=l,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):l,c(' style="%s"',h+k),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=b.options.escape?j(f.title):f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return b.options.detailView&&d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),a(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),a(window).on("resize.bootstrap-table",a.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},o.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},o.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},o.prototype.initSort=function(){var b=this,d=this.options.sortName,e="desc"===this.options.sortOrder?-1:1,f=a.inArray(this.options.sortName,this.header.fields),g=0;return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==f&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(c,g){b.header.sortNames[f]&&(d=b.header.sortNames[f]);var i=l(c,d,b.options.escape),j=l(g,d,b.options.escape),k=h(b.header,b.header.sorters[f],[i,j]);return void 0!==k?e*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=c._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*e:e):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*e:e))}),void 0!==this.options.sortClass&&(clearTimeout(g),g=setTimeout(function(){b.$el.removeClass(b.options.sortClass);var a=b.$header.find(c('[data-field="%s"]',b.options.sortName).index()+1);b.$el.find(c("tr td:nth-child(%s)",a)).addClass(b.options.sortClass)},250))))},o.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},o.prototype.initToolbar=function(){var b,d,e=this,f=[],g=0,i=0;this.$toolbar.find(".bs-bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),f=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(f.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||e.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(f.push(c('<li role="menuitem"><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),i++)}}),f.push("</ul>","</div>")),f.push("</div>"),(this.showToolbar||f.length>2)&&this.$toolbar.append(f.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){e.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),i<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);e.toggleColumn(a(this).val(),b.prop("checked"),!1),e.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(f=[],f.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(f.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop blur").on("keyup drop blur",function(b){e.options.searchOnEnterKey&&13!==b.keyCode||a.inArray(b.keyCode,[37,38,39,40])>-1||(clearTimeout(g),g=setTimeout(function(){e.onSearch(b)},e.options.searchTimeOut))}),m()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},o.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},o.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==a.noop)return void this.options.customSearch.apply(this,[this.searchText]);var c=this.searchText&&(this.options.escape?j(this.searchText):this.searchText).toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])&&-1===a.inArray(b[c],d[c])||!a.isArray(d[c])&&b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g=0;g<b.header.fields.length;g++)if(b.header.searchables[g]){var i,j=a.isNumeric(b.header.fields[g])?parseInt(b.header.fields[g],10):b.header.fields[g],k=b.columns[e(b.columns,j)];if("string"==typeof j){i=d;for(var l=j.split("."),m=0;m<l.length;m++)i=i[l[m]];k&&k.searchFormatter&&(i=h(k,b.header.formatters[g],[i,d,f],i))}else i=d[j];if("string"==typeof i||"number"==typeof i)if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},o.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData(),p=this.options.pageList;if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var q="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),q)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var r=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");p=[],a.each(s,function(a,b){p.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(p,function(a,b){if(!l.options.smartDisplay||0===a||p[a-1]<l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",r.push(c('<li role="menuitem"%s><a href="#">%s</a></li>',d,b))}}),r.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(r.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="#">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(p.length<2||this.options.totalRows<=p[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),this.options.paginationLoop||(1===this.options.pageNumber&&h.addClass("disabled"),this.options.pageNumber===this.totalPages&&i.addClass("disabled")),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},o.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},o.prototype.onPageListChange=function(b){var c=a(b.currentTarget);return c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b),!1},o.prototype.onPageFirst=function(a){return this.options.pageNumber=1,this.updatePagination(a),!1},o.prototype.onPagePre=function(a){return this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a),!1},o.prototype.onPageNext=function(a){return this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a),!1},o.prototype.onPageLast=function(a){return this.options.pageNumber=this.totalPages,this.updatePagination(a),!1},o.prototype.onPageNumber=function(b){return this.options.pageNumber!==+a(b.currentTarget).text()?(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b),!1):void 0},o.prototype.initRow=function(b,e){var f,g=this,i=[],k={},m=[],n="",o={},p=[];if(!(a.inArray(b,this.hiddenRows)>-1)){if(k=h(this.options,this.options.rowStyle,[b,e],k),k&&k.css)for(f in k.css)m.push(f+": "+k.css[f]);if(o=h(this.options,this.options.rowAttributes,[b,e],o))for(f in o)p.push(c('%s="%s"',f,j(o[f])));return b._data&&!a.isEmptyObject(b._data)&&a.each(b._data,function(a,b){"index"!==a&&(n+=c(' data-%s="%s"',a,b))}),i.push("<tr",c(" %s",p.join(" ")),c(' id="%s"',a.isArray(b)?void 0:b._id),c(' class="%s"',k.classes||(a.isArray(b)?void 0:b._class)),c(' data-index="%s"',e),c(' data-uniqueid="%s"',b[this.options.uniqueId]),c("%s",n),">"),this.options.cardView&&i.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&i.push("<td>",'<a class="detail-icon" href="#">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(f,n){var o="",p=l(b,n,g.options.escape),q="",r="",s={},t="",u=g.header.classes[f],v="",w="",x="",y="",z=g.columns[f];if(!(g.fromHtml&&"undefined"==typeof p||!z.visible||g.options.cardView&&!z.cardVisible)){if(z.escape&&(p=j(p)),k=c('style="%s"',m.concat(g.header.styles[f]).join("; ")),b["_"+n+"_id"]&&(t=c(' id="%s"',b["_"+n+"_id"])),b["_"+n+"_class"]&&(u=c(' class="%s"',b["_"+n+"_class"])),b["_"+n+"_rowspan"]&&(w=c(' rowspan="%s"',b["_"+n+"_rowspan"])),b["_"+n+"_colspan"]&&(x=c(' colspan="%s"',b["_"+n+"_colspan"])),b["_"+n+"_title"]&&(y=c(' title="%s"',b["_"+n+"_title"])),s=h(g.header,g.header.cellStyles[f],[p,b,e,n],s),s.classes&&(u=c(' class="%s"',s.classes)),s.css){var A=[];for(var B in s.css)A.push(B+": "+s.css[B]);k=c('style="%s"',A.concat(g.header.styles[f]).join("; "))}q=h(z,g.header.formatters[f],[p,b,e],p),b["_"+n+"_data"]&&!a.isEmptyObject(b["_"+n+"_data"])&&a.each(b["_"+n+"_data"],function(a,b){"index"!==a&&(v+=c(' data-%s="%s"',a,b))}),z.checkbox||z.radio?(r=z.checkbox?"checkbox":r,r=z.radio?"radio":r,o=[c(g.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',z["class"]||""),"<input"+c(' data-index="%s"',e)+c(' name="%s"',g.options.selectItemName)+c(' type="%s"',r)+c(' value="%s"',b[g.options.idField])+c(' checked="%s"',q===!0||p||q&&q.checked?"checked":void 0)+c(' disabled="%s"',!z.checkboxEnabled||q&&q.disabled?"disabled":void 0)+" />",g.header.formatters[f]&&"string"==typeof q?q:"",g.options.cardView?"</div>":"</td>"].join(""),b[g.header.stateField]=q===!0||q&&q.checked):(q="undefined"==typeof q||null===q?g.options.undefinedText:q,o=g.options.cardView?['<div class="card-view">',g.options.showHeader?c('<span class="title" %s>%s</span>',k,d(g.columns,"field","title",n)):"",c('<span class="value">%s</span>',q),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",t,u,k,v,w,x,y),q,"</td>"].join(""),g.options.cardView&&g.options.smartDisplay&&""===q&&(o='<div class="card-view"></div>')),i.push(o)}}),this.options.cardView&&i.push("</div></td>"),i.push("</tr>"),i.join(" ")}},o.prototype.initBody=function(b){var d=this,f=this.getData();this.trigger("pre-body",f),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=f.length);for(var g,i=a(document.createDocumentFragment()),j=this.pageFrom-1;j<this.pageTo;j++){+ var k=f[j],m=this.initRow(k,j,f,i);g=g||!!m,m&&m!==!0&&i.append(m)}g||i.append('<tr class="no-records-found">'+c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>"),this.$body.html(i),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var f=a(this),g=f.parent(),h=d.data[g.data("index")],i=f[0].cellIndex,j=d.getVisibleFields(),k=j[d.options.detailView&&!d.options.cardView?i-1:i],m=d.columns[e(d.columns,k)],n=l(h,k,d.options.escape);if(!f.find(".detail-icon").length&&(d.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,f),d.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),"click"===b.type&&d.options.clickToSelect&&m.clickToSelect)){var o=g.find(c('[name="%s"]',d.options.selectItemName));o.length&&o[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),e=b.parent().parent(),g=e.data("index"),i=f[g];if(e.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailOpen)),d.trigger("collapse-row",g,i),e.next().remove();else{b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailClose)),e.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',e.find("td").length));var j=e.next().find("td"),k=h(d.options,d.options.detailFormatter,[g,i,j],"");1===j.length&&j.append(k),d.trigger("expand-row",g,i,j)}return d.resetView(),!1}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),e=c.prop("checked"),f=d.data[c.data("index")];d.options.maintainSelected&&a(this).is(":radio")&&a.each(d.options.data,function(a,b){b[d.header.stateField]=!1}),f[d.header.stateField]=e,d.options.singleSelect&&(d.$selectItem.not(this).each(function(){d.data[a(this).data("index")][d.header.stateField]=!1}),d.$selectItem.filter(":checked").not(this).prop("checked",!1)),d.updateSelected(),d.trigger(e?"check":"uncheck",f,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var e=d.header.fields[b],f=a.inArray(e,d.getVisibleFields());d.options.detailView&&!d.options.cardView&&(f+=1);for(var g in c)d.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(d.options.cardView?".card-view":"td").eq(f),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),f=d.data[c],g=f[e];l.apply(this,[a,g,f,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",f)},o.prototype.initServer=function(b,c,d){var e,f=this,g={},i={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(i.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,i.pageNumber=this.options.pageNumber),(d||this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(i={search:i.searchText,sort:i.sortName,order:i.sortOrder},this.options.pagination&&(i.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),i.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)),a.isEmptyObject(this.filterColumnsPartial)||(i.filter=JSON.stringify(this.filterColumnsPartial,null)),g=h(this.options,this.options.queryParams,[i],g),a.extend(g,c||{}),g!==!1&&(b||this.$tableLoading.show(),e=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(g):g,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(f.options,f.options.responseHandler,[a],a),f.load(a),f.trigger("load-success",a),b||f.$tableLoading.hide()},error:function(a){f.trigger("load-error",a.status,a),b||f.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[e],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(e))))},o.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},o.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},o.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},o.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},o.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)}),this.initHiddenRows()},o.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[o.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},o.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},o.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields(),m=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1);var f=h.$header_.find(c('th[data-field="%s"]',l[e]));f.length>1&&(f=a(m[d[0].cellIndex])),f.find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},o.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner"> </div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g,i="",j="",k=[],l={},m=c(' class="%s"',f["class"]);if(f.visible&&(!b.options.cardView||f.cardVisible)){if(i=c("text-align: %s; ",f.falign?f.falign:f.align),j=c("vertical-align: %s; ",f.valign),l=h(null,b.options.footerStyle),l&&l.css)for(g in l.css)k.push(g+": "+l.css[g]);e.push("<td",m,c(' style="%s"',i+j+k.concat().join("; ")),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d]," ")||" "),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>")}}),this.$tableFooter.find("tr").html(e.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},o.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},o.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},o.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},o.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=this.$toolbar.outerHeight(!0),d=this.$pagination.outerHeight(!0),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide()):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},o.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},o.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b[this.options.totalField],c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},o.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&(this.options.data.splice(c,1),"server"===this.options.sidePagination&&(this.options.totalRows-=1));e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},o.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},o.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.updateByUniqueId=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){var e;d.hasOwnProperty("id")&&d.hasOwnProperty("row")&&(e=a.inArray(c.getRowByUniqueId(d.id),c.options.data),-1!==e&&a.extend(c.options.data[e],d.row))}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},o.prototype.updateRow=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){d.hasOwnProperty("index")&&d.hasOwnProperty("row")&&a.extend(c.options.data[d.index],d.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.initHiddenRows=function(){this.hiddenRows=[]},o.prototype.showRow=function(a){this.toggleRow(a,!0)},o.prototype.hideRow=function(a){this.toggleRow(a,!1)},o.prototype.toggleRow=function(b,c){var d,e;b.hasOwnProperty("index")?d=this.getData()[b.index]:b.hasOwnProperty("uniqueId")&&(d=this.getRowByUniqueId(b.uniqueId)),d&&(e=a.inArray(d,this.hiddenRows),c||-1!==e?c&&e>-1&&this.hiddenRows.splice(e,1):this.hiddenRows.push(d),this.initBody(!0))},o.prototype.getHiddenRows=function(){var b=this,c=this.getData(),d=[];return a.each(c,function(c,e){a.inArray(e,b.hiddenRows)>-1&&d.push(e)}),this.hiddenRows=d,d},o.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},o.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},o.prototype.getOptions=function(){return this.options},o.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]===!0})},o.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},o.prototype.checkAll=function(){this.checkAll_(!0)},o.prototype.uncheckAll=function(){this.checkAll_(!1)},o.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},o.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},o.prototype.check=function(a){this.check_(!0,a)},o.prototype.uncheck=function(a){this.check_(!1,a)},o.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},o.prototype.checkBy=function(a){this.checkBy_(!0,a)},o.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},o.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},o.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},o.prototype.showLoading=function(){this.$tableLoading.show()},o.prototype.hideLoading=function(){this.$tableLoading.hide()},o.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},o.prototype.refresh=function(a){a&&a.url&&(this.options.url=a.url),a&&a.pageNumber&&(this.options.pageNumber=a.pageNumber),a&&a.pageSize&&(this.options.pageSize=a.pageSize),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},o.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},o.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},o.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},o.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},o.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},o.prototype.toggleAllColumns=function(b){if(a.each(this.columns,function(a){this.columns[a].visible=b}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var c=this.$toolbar.find(".keep-open input").prop("disabled",!1);c.filter(":checked").length<=this.options.minimumCountColumns&&c.filter(":checked").prop("disabled",!0)}},o.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},o.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},o.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},o.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},o.prototype.getScrollPosition=function(){return this.scrollTo()},o.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},o.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},o.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},o.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},o.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},o.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},o.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},o.prototype.expandRow=function(a){this.expandRow_(!0,a)},o.prototype.collapseRow=function(a){this.expandRow_(!1,a)},o.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},o.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},o.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var p=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},o.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,p)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new o(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=o,a.fn.bootstrapTable.defaults=o.DEFAULTS,a.fn.bootstrapTable.columnDefaults=o.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=o.LOCALES,a.fn.bootstrapTable.methods=p,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:l,objectKeys:n,isIEBrowser:m},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery);diff --git a/public/js/extensions/export/tableExport.js b/public/js/extensions/export/tableExport.jsindex b3d1a125f8..124621767c 100644--- a/public/js/extensions/export/tableExport.js+++ b/public/js/extensions/export/tableExport.js@@ -1,1324 +1,2232 @@/*** @preserve tableExport.jquery.plugin*- * Copyright (c) 2015,2016 hhurz, https://github.com/hhurz/tableExport.jquery.plugin- * Original work Copyright (c) 2014 Giri Raj, https://github.com/kayalshri/+ * Version 1.9.8*- * Licensed under the MIT License, http://opensource.org/licenses/mit-license- */+ * Copyright (c) 2015-2017 hhurz, https://github.com/hhurz+ *+ * Original Work Copyright (c) 2014 Giri Raj+ *+ * Licensed under the MIT License+ **/(function ($) {- $.fn.extend({- tableExport: function (options) {- var defaults = {- consoleLog: false,- csvEnclosure: '"',- csvSeparator: ',',- csvUseBOM: true,- displayTableName: false,- escape: false,- excelstyles: [], // e.g. ['border-bottom', 'border-top', 'border-left', 'border-right']- fileName: 'tableExport',- htmlContent: false,- ignoreColumn: [],- ignoreRow:[],- jsonScope: 'all', // head, data, all- jspdf: {orientation: 'p',- unit: 'pt',- format: 'a4', // jspdf page format or 'bestfit' for autmatic paper format selection- margins: {left: 20, right: 10, top: 10, bottom: 10},- autotable: {styles: {cellPadding: 2,- rowHeight: 12,- fontSize: 8,- fillColor: 255, // color value or 'inherit' to use css background-color from html table- textColor: 50, // color value or 'inherit' to use css color from html table- fontStyle: 'normal', // normal, bold, italic, bolditalic or 'inherit' to use css font-weight and fonst-style from html table- overflow: 'ellipsize', // visible, hidden, ellipsize or linebreak- halign: 'left', // left, center, right- valign: 'middle' // top, middle, bottom- },- headerStyles: {fillColor: [52, 73, 94],- textColor: 255,- fontStyle: 'bold',- halign: 'center'- },- alternateRowStyles: {fillColor: 245- },- tableExport: {onAfterAutotable: null,- onBeforeAutotable: null,- onTable: null- }- }- },- numbers: {html: {decimalMark: '.',- thousandsSeparator: ','+ $.fn.extend({+ tableExport: function (options) {+ var defaults = {+ consoleLog: false,+ csvEnclosure: '"',+ csvSeparator: ',',+ csvUseBOM: true,+ displayTableName: false,+ escape: false,+ excelFileFormat: 'xlshtml', // xmlss = XML Spreadsheet 2003 file format (XMLSS), xlshtml = Excel 2000 html format+ excelRTL: false, // true = Set Excel option 'DisplayRightToLeft'+ excelstyles: [], // e.g. ['border-bottom', 'border-top', 'border-left', 'border-right']+ exportHiddenCells: false, // true = speed up export of large tables with hidden cells (hidden cells will be exported !)+ fileName: 'tableExport',+ htmlContent: false,+ ignoreColumn: [],+ ignoreRow: [],+ jsonScope: 'all', // head, data, all+ jspdf: {+ orientation: 'p',+ unit: 'pt',+ format: 'a4', // jspdf page format or 'bestfit' for autmatic paper format selection+ margins: {left: 20, right: 10, top: 10, bottom: 10},+ onDocCreated: null,+ autotable: {+ styles: {+ cellPadding: 2,+ rowHeight: 12,+ fontSize: 8,+ fillColor: 255, // color value or 'inherit' to use css background-color from html table+ textColor: 50, // color value or 'inherit' to use css color from html table+ fontStyle: 'normal', // normal, bold, italic, bolditalic or 'inherit' to use css font-weight and fonst-style from html table+ overflow: 'ellipsize', // visible, hidden, ellipsize or linebreak+ halign: 'left', // left, center, right+ valign: 'middle' // top, middle, bottom},- output: {decimalMark: '.',- thousandsSeparator: ','- }- },- onCellData: null,- onCellHtmlData: null,- outputMode: 'file', // 'file', 'string' or 'base64'- tbodySelector: 'tr',- theadSelector: 'tr',- tableName: 'myTableName',- type: 'csv', // 'csv', 'txt', 'sql', 'json', 'xml', 'excel', 'doc', 'png' or 'pdf'- worksheetName: 'xlsWorksheetName'- };-- var FONT_ROW_RATIO = 1.15;- var el = this;- var DownloadEvt = null;- var $hrows = [];- var $rows = [];- var rowIndex = 0;- var rowspans = [];- var trData = '';- var colNames = [];-- $.extend(true, defaults, options);-- colNames = GetColumnNames (el);-- if (defaults.type == 'csv' || defaults.type == 'txt') {-- var csvData = "";- var rowlength = 0;- rowIndex = 0;-- function CollectCsvData (tgroup, tselector, rowselector, length) {-- $rows = $(el).find(tgroup).first().find(tselector);- $rows.each(function () {- trData = "";- ForEachVisibleCell(this, rowselector, rowIndex, length + $rows.length,- function (cell, row, col) {- trData += csvString(cell, row, col) + defaults.csvSeparator;- });- trData = $.trim(trData).substring(0, trData.length - 1);- if (trData.length > 0) {-- if (csvData.length > 0)- csvData += "\n";+ headerStyles: {+ fillColor: [52, 73, 94],+ textColor: 255,+ fontStyle: 'bold',+ halign: 'center'+ },+ alternateRowStyles: {+ fillColor: 245+ },+ tableExport: {+ doc: null, // jsPDF doc object. If set, an already created doc will be used to export to+ onAfterAutotable: null,+ onBeforeAutotable: null,+ onAutotableText: null,+ onTable: null,+ outputImages: true+ }+ }+ },+ numbers: {+ html: {+ decimalMark: '.',+ thousandsSeparator: ','+ },+ output: { // set output: false to keep number format in exported output+ decimalMark: '.',+ thousandsSeparator: ','+ }+ },+ onCellData: null,+ onCellHtmlData: null,+ onIgnoreRow: null, // onIgnoreRow($tr, rowIndex): function should return true to not export a row+ onMsoNumberFormat: null, // Excel 2000 html format only. See readme.md for more information about msonumberformat+ outputMode: 'file', // 'file', 'string', 'base64' or 'window' (experimental)+ pdfmake: {+ enabled: false, // true: use pdfmake instead of jspdf and jspdf-autotable (experimental)+ docDefinition: {+ pageOrientation: 'portrait', // 'portrait' or 'landscape'+ defaultStyle: {+ font: 'Roboto' // default is 'Roboto', for arabic font set this option to 'Mirza' and include mirza_fonts.js+ }+ },+ fonts: {}+ },+ tbodySelector: 'tr',+ tfootSelector: 'tr', // set empty ('') to prevent export of tfoot rows+ theadSelector: 'tr',+ tableName: 'Table',+ type: 'csv', // 'csv', 'tsv', 'txt', 'sql', 'json', 'xml', 'excel', 'doc', 'png' or 'pdf'+ worksheetName: ''+ };- csvData += trData;- }- rowIndex++;- });+ var FONT_ROW_RATIO = 1.15;+ var el = this;+ var DownloadEvt = null;+ var $hrows = [];+ var $rows = [];+ var rowIndex = 0;+ var trData = '';+ var colNames = [];+ var ranges = [];+ var blob;+ var $hiddenTableElements = [];+ var checkCellVisibilty = false;- return $rows.length;- }+ $.extend(true, defaults, options);- rowlength += CollectCsvData ('thead', defaults.theadSelector, 'th,td', rowlength);- rowlength += CollectCsvData ('tbody', defaults.tbodySelector, 'td', rowlength);- CollectCsvData ('tfoot', defaults.tbodySelector, 'td', rowlength);+ colNames = GetColumnNames(el);- csvData += "\n";+ if ( defaults.type == 'csv' || defaults.type == 'tsv' || defaults.type == 'txt' ) {- //output- if (defaults.consoleLog === true)- console.log(csvData);+ var csvData = "";+ var rowlength = 0;+ ranges = [];+ rowIndex = 0;- if (defaults.outputMode === 'string')- return csvData;+ function csvString (cell, rowIndex, colIndex) {+ var result = '';- if (defaults.outputMode === 'base64')- return base64encode(csvData);+ if ( cell !== null ) {+ var dataString = parseString(cell, rowIndex, colIndex);- try {- var blob = new Blob([csvData], {type: "text/" + (defaults.type == 'csv' ? 'csv' : 'plain') + ";charset=utf-8"});- saveAs(blob, defaults.fileName + '.' + defaults.type, (defaults.type != 'csv' || defaults.csvUseBOM === false));- }- catch (e) {- downloadFile(defaults.fileName + '.' + defaults.type,- 'data:text/' + (defaults.type == 'csv' ? 'csv' : 'plain') + ';charset=utf-8,' + ((defaults.type == 'csv' && defaults.csvUseBOM)? '\ufeff' : ''),- csvData);- }+ var csvValue = (dataString === null || dataString === '') ? '' : dataString.toString();- } else if (defaults.type == 'sql') {-- // Header- rowIndex = 0;- var tdData = "INSERT INTO `" + defaults.tableName + "` (";- $hrows = $(el).find('thead').first().find(defaults.theadSelector);- $hrows.each(function () {- ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,- function (cell, row, col) {- tdData += "'" + parseString(cell, row, col) + "',";- });- rowIndex++;- tdData = $.trim(tdData);- tdData = $.trim(tdData).substring(0, tdData.length - 1);- });- tdData += ") VALUES ";- // Row vs Column- $rows = $(el).find('tbody').first().find(defaults.tbodySelector);- $rows.each(function () {- trData = "";- ForEachVisibleCell(this, 'td', rowIndex, $hrows.length + $rows.length,- function (cell, row, col) {- trData += "'" + parseString(cell, row, col) + "',";- });- if (trData.length > 3) {- tdData += "(" + trData;- tdData = $.trim(tdData).substring(0, tdData.length - 1);- tdData += "),";- }- rowIndex++;- });-- tdData = $.trim(tdData).substring(0, tdData.length - 1);- tdData += ";";-- //output- if (defaults.consoleLog === true)- console.log(tdData);-- if (defaults.outputMode === 'string')- return tdData;-- if (defaults.outputMode === 'base64')- return base64encode(tdData);-- try {- var blob = new Blob([tdData], {type: "text/plain;charset=utf-8"});- saveAs(blob, defaults.fileName + '.sql');- }- catch (e) {- downloadFile(defaults.fileName + '.sql',- 'data:application/sql;charset=utf-8,',- tdData);- }+ if ( defaults.type == 'tsv' ) {+ if ( dataString instanceof Date )+ dataString.toLocaleString();- } else if (defaults.type == 'json') {-- var jsonHeaderArray = [];- $hrows = $(el).find('thead').first().find(defaults.theadSelector);- $hrows.each(function () {- var jsonArrayTd = [];-- ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,- function (cell, row, col) {- jsonArrayTd.push(parseString(cell, row, col));- });- jsonHeaderArray.push(jsonArrayTd);- });-- var jsonArray = [];- $rows = $(el).find('tbody').first().find(defaults.tbodySelector);- $rows.each(function () {- var jsonObjectTd = {};-- var colIndex = 0;- ForEachVisibleCell(this, 'td', rowIndex, $hrows.length + $rows.length,- function (cell, row, col) {- if (jsonHeaderArray.length) {- jsonObjectTd[jsonHeaderArray[jsonHeaderArray.length-1][colIndex]] = parseString(cell, row, col);- } else {- jsonObjectTd[colIndex] = parseString(cell, row, col);+ // According to http://www.iana.org/assignments/media-types/text/tab-separated-values+ // are fields that contain tabs not allowable in tsv encoding+ result = replaceAll(csvValue, '\t', ' ');+ }+ else {+ // Takes a string and encapsulates it (by default in double-quotes) if it+ // contains the csv field separator, spaces, or linebreaks.+ if ( dataString instanceof Date )+ result = defaults.csvEnclosure + dataString.toLocaleString() + defaults.csvEnclosure;+ else {+ result = replaceAll(csvValue, defaults.csvEnclosure, defaults.csvEnclosure + defaults.csvEnclosure);++ if ( result.indexOf(defaults.csvSeparator) >= 0 || /[\r\n ]/g.test(result) )+ result = defaults.csvEnclosure + result + defaults.csvEnclosure;+ }+ }}- colIndex++;- });- if ($.isEmptyObject(jsonObjectTd) == false)- jsonArray.push(jsonObjectTd);- rowIndex++;- });+ return result;+ }- var sdata = "";+ var CollectCsvData = function ($rows, rowselector, length) {- if (defaults.jsonScope == 'head')- sdata = JSON.stringify(jsonHeaderArray);- else if (defaults.jsonScope == 'data')- sdata = JSON.stringify(jsonArray);- else // all- sdata = JSON.stringify({header: jsonHeaderArray, data: jsonArray});+ $rows.each(function () {+ trData = "";+ ForEachVisibleCell(this, rowselector, rowIndex, length + $rows.length,+ function (cell, row, col) {+ trData += csvString(cell, row, col) + (defaults.type == 'tsv' ? '\t' : defaults.csvSeparator);+ });+ trData = $.trim(trData).substring(0, trData.length - 1);+ if ( trData.length > 0 ) {- if (defaults.consoleLog === true)- console.log(sdata);+ if ( csvData.length > 0 )+ csvData += "\n";- if (defaults.outputMode === 'string')- return sdata;+ csvData += trData;+ }+ rowIndex++;+ });- if (defaults.outputMode === 'base64')- return base64encode(sdata);+ return $rows.length;+ };- try {- var blob = new Blob([sdata], {type: "application/json;charset=utf-8"});- saveAs(blob, defaults.fileName + '.json');- }- catch (e) {- downloadFile(defaults.fileName + '.json',- 'data:application/json;charset=utf-8;base64,',- sdata);- }+ rowlength += CollectCsvData($(el).find('thead').first().find(defaults.theadSelector), 'th,td', rowlength);+ findTablePart($(el),'tbody').each(function () {+ rowlength += CollectCsvData(findRows($(this), defaults.tbodySelector), 'td,th', rowlength);+ });+ if ( defaults.tfootSelector.length )+ CollectCsvData($(el).find('tfoot').first().find(defaults.tfootSelector), 'td,th', rowlength);- } else if (defaults.type === 'xml') {-- rowIndex = 0;- var xml = '<?xml version="1.0" encoding="utf-8"?>';- xml += '<tabledata><fields>';-- // Header- $hrows = $(el).find('thead').first().find(defaults.theadSelector);- $hrows.each(function () {-- ForEachVisibleCell(this, 'th,td', rowIndex, $rows.length,- function (cell, row, col) {- xml += "<field>" + parseString(cell, row, col) + "</field>";- });- rowIndex++;- });- xml += '</fields><data>';-- // Row Vs Column- var rowCount = 1;- $rows = $(el).find('tbody').first().find(defaults.tbodySelector);- $rows.each(function () {- var colCount = 1;- trData = "";- ForEachVisibleCell(this, 'td', rowIndex, $hrows.length + $rows.length,- function (cell, row, col) {- trData += "<column-" + colCount + ">" + parseString(cell, row, col) + "</column-" + colCount + ">";- colCount++;- });- if (trData.length > 0 && trData != "<column-1></column-1>") {- xml += '<row id="' + rowCount + '">' + trData + '</row>';- rowCount++;- }-- rowIndex++;- });- xml += '</data></tabledata>';-- //output- if (defaults.consoleLog === true)- console.log(xml);-- if (defaults.outputMode === 'string')- return xml;-- if (defaults.outputMode === 'base64')- return base64encode(xml);-- try {- var blob = new Blob([xml], {type: "application/xml;charset=utf-8"});- saveAs(blob, defaults.fileName + '.xml');- }- catch (e) {- downloadFile(defaults.fileName + '.xml',- 'data:application/xml;charset=utf-8;base64,',- xml);- }+ csvData += "\n";- } else if (defaults.type == 'excel' || defaults.type == 'xls' || defaults.type == 'word' || defaults.type == 'doc') {-- var MSDocType = (defaults.type == 'excel' || defaults.type == 'xls') ? 'excel' : 'word';- var MSDocExt = (MSDocType == 'excel') ? 'xls' : 'doc';- var MSDocSchema = (MSDocExt == 'xls') ? 'xmlns:x="urn:schemas-microsoft-com:office:excel"' : 'xmlns:w="urn:schemas-microsoft-com:office:word"';- var $tables = $(el).filter(function() {- return $(this).data("tableexport-display") != 'none' &&- ($(this).is(':visible') ||- $(this).data("tableexport-display") == 'always');- });- var docData = '';-- $tables.each(function(){- rowIndex = 0;-- colNames = GetColumnNames (this);-- docData += '<table><thead>';- // Header- $hrows = $(this).find('thead').first().find(defaults.theadSelector);- $hrows.each(function() {- trData = "";- ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,- function(cell, row, col) {- if (cell != null) {- var thstyle = '';- trData += '<th';- for (var styles in defaults.excelstyles) {- if (defaults.excelstyles.hasOwnProperty(styles)) {- var thcss = $(cell).css(defaults.excelstyles[styles]);- if (thcss != '' && thcss !='0px none rgb(0, 0, 0)') {- if (thstyle == '')- thstyle = 'style="';- thstyle += defaults.excelstyles[styles] + ':' + thcss + ';';- }- }- }- if (thstyle != '' )- trData += ' ' + thstyle + '"';- if ($(cell).is("[colspan]"))- trData += ' colspan="' + $(cell).attr('colspan') + '"';- if ($(cell).is("[rowspan]"))- trData += ' rowspan="' + $(cell).attr('rowspan') + '"';- trData += '>' + parseString(cell, row, col) + '</th>';+ //output+ if ( defaults.consoleLog === true )+ console.log(csvData);++ if ( defaults.outputMode === 'string' )+ return csvData;++ if ( defaults.outputMode === 'base64' )+ return base64encode(csvData);++ if ( defaults.outputMode === 'window' ) {+ downloadFile(false, 'data:text/' + (defaults.type == 'csv' ? 'csv' : 'plain') + ';charset=utf-8,', csvData);+ return;}- });- if (trData.length > 0)- docData += '<tr>' + trData + '</tr>';- rowIndex++;- });-- docData += '</thead><tbody>';- // Row Vs Column- $rows = $(this).find('tbody').first().find(defaults.tbodySelector);- $rows.each(function() {- trData = "";- ForEachVisibleCell(this, 'td', rowIndex, $hrows.length + $rows.length,- function(cell, row, col) {- if (cell != null) {- var tdstyle = '';- var tdcss = $(cell).data("tableexport-msonumberformat");-- if (typeof tdcss == 'undefined' && typeof defaults.onMsoNumberFormat === 'function')- tdcss = defaults.onMsoNumberFormat(cell, row, col);-- if (typeof tdcss != 'undefined' && tdcss != '') {- if (tdstyle == '')- tdstyle = 'style="';- tdstyle = 'style="mso-number-format:' + tdcss + ';';- }-- trData += '<td';- for (var styles in defaults.excelstyles) {- if (defaults.excelstyles.hasOwnProperty(styles)) {- tdcss = $(cell).css(defaults.excelstyles[styles]);- if (tdcss != '' && tdcss !='0px none rgb(0, 0, 0)') {- if (tdstyle == '')- tdstyle = 'style="';- tdstyle += defaults.excelstyles[styles] + ':' + tdcss + ';';- }++ try {+ blob = new Blob([csvData], {type: "text/" + (defaults.type == 'csv' ? 'csv' : 'plain') + ";charset=utf-8"});+ saveAs(blob, defaults.fileName + '.' + defaults.type, (defaults.type != 'csv' || defaults.csvUseBOM === false));+ }+ catch (e) {+ downloadFile(defaults.fileName + '.' + defaults.type,+ 'data:text/' + (defaults.type == 'csv' ? 'csv' : 'plain') + ';charset=utf-8,' + ((defaults.type == 'csv' && defaults.csvUseBOM) ? '\ufeff' : ''),+ csvData);+ }++ } else if ( defaults.type == 'sql' ) {++ // Header+ rowIndex = 0;+ ranges = [];+ var tdData = "INSERT INTO `" + defaults.tableName + "` (";+ $hrows = $(el).find('thead').first().find(defaults.theadSelector);+ $hrows.each(function () {+ ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,+ function (cell, row, col) {+ tdData += "'" + parseString(cell, row, col) + "',";+ });+ rowIndex++;+ tdData = $.trim(tdData);+ tdData = $.trim(tdData).substring(0, tdData.length - 1);+ });+ tdData += ") VALUES ";++ // Data+ $rows = collectRows ($(el));+ $($rows).each(function () {+ trData = "";+ ForEachVisibleCell(this, 'td,th', rowIndex, $hrows.length + $rows.length,+ function (cell, row, col) {+ trData += "'" + parseString(cell, row, col) + "',";+ });+ if ( trData.length > 3 ) {+ tdData += "(" + trData;+ tdData = $.trim(tdData).substring(0, tdData.length - 1);+ tdData += "),";}- }- if (tdstyle != '' )- trData += ' ' + tdstyle + '"';- if ($(cell).is("[colspan]"))- trData += ' colspan="' + $(cell).attr('colspan') + '"';- if ($(cell).is("[rowspan]"))- trData += ' rowspan="' + $(cell).attr('rowspan') + '"';- trData += '>' + parseString(cell, row, col) + '</td>';+ rowIndex++;+ });++ tdData = $.trim(tdData).substring(0, tdData.length - 1);+ tdData += ";";++ // Output+ if ( defaults.consoleLog === true )+ console.log(tdData);++ if ( defaults.outputMode === 'string' )+ return tdData;++ if ( defaults.outputMode === 'base64' )+ return base64encode(tdData);++ try {+ blob = new Blob([tdData], {type: "text/plain;charset=utf-8"});+ saveAs(blob, defaults.fileName + '.sql');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.sql',+ 'data:application/sql;charset=utf-8,',+ tdData);}- });- if (trData.length > 0)- docData += '<tr>' + trData + '</tr>';- rowIndex++;- });-- if (defaults.displayTableName)- docData += '<tr><td></td></tr><tr><td></td></tr><tr><td>' + parseString($('<p>' + defaults.tableName + '</p>')) + '</td></tr>';-- docData += '</tbody></table>';-- if (defaults.consoleLog === true)- console.log(docData);- });-- var docFile = '<html xmlns:o="urn:schemas-microsoft-com:office:office" ' + MSDocSchema + ' xmlns="http://www.w3.org/TR/REC-html40">';- docFile += '<meta http-equiv="content-type" content="application/vnd.ms-' + MSDocType + '; charset=UTF-8">';- docFile += "<head>";- if (MSDocType === 'excel') {- docFile += "<!--[if gte mso 9]>";- docFile += "<xml>";- docFile += "<x:ExcelWorkbook>";- docFile += "<x:ExcelWorksheets>";- docFile += "<x:ExcelWorksheet>";- docFile += "<x:Name>";- docFile += defaults.worksheetName;- docFile += "</x:Name>";- docFile += "<x:WorksheetOptions>";- docFile += "<x:DisplayGridlines/>";- docFile += "</x:WorksheetOptions>";- docFile += "</x:ExcelWorksheet>";- docFile += "</x:ExcelWorksheets>";- docFile += "</x:ExcelWorkbook>";- docFile += "</xml>";- docFile += "<![endif]-->";- }- docFile += "</head>";- docFile += "<body>";- docFile += docData;- docFile += "</body>";- docFile += "</html>";- if (defaults.consoleLog === true)- console.log(docFile);+ } else if ( defaults.type == 'json' ) {+ var jsonHeaderArray = [];+ ranges = [];+ $hrows = $(el).find('thead').first().find(defaults.theadSelector);+ $hrows.each(function () {+ var jsonArrayTd = [];++ ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,+ function (cell, row, col) {+ jsonArrayTd.push(parseString(cell, row, col));+ });+ jsonHeaderArray.push(jsonArrayTd);+ });++ // Data+ var jsonArray = [];++ $rows = collectRows ($(el));+ $($rows).each(function () {+ var jsonObjectTd = {};+ var colIndex = 0;++ ForEachVisibleCell(this, 'td,th', rowIndex, $hrows.length + $rows.length,+ function (cell, row, col) {+ if ( jsonHeaderArray.length ) {+ jsonObjectTd[jsonHeaderArray[jsonHeaderArray.length - 1][colIndex]] = parseString(cell, row, col);+ } else {+ jsonObjectTd[colIndex] = parseString(cell, row, col);+ }+ colIndex++;+ });+ if ( $.isEmptyObject(jsonObjectTd) === false )+ jsonArray.push(jsonObjectTd);- if (defaults.outputMode === 'string')- return docFile;+ rowIndex++;+ });- if (defaults.outputMode === 'base64')- return base64encode(docFile);+ var sdata = "";- try {- var blob = new Blob([docFile], {type: 'application/vnd.ms-' + defaults.type});- saveAs(blob, defaults.fileName + '.' + MSDocExt);- }- catch (e) {- downloadFile(defaults.fileName + '.' + MSDocExt,- 'data:application/vnd.ms-' + MSDocType + ';base64,',- docFile);- }+ if ( defaults.jsonScope == 'head' )+ sdata = JSON.stringify(jsonHeaderArray);+ else if ( defaults.jsonScope == 'data' )+ sdata = JSON.stringify(jsonArray);+ else // all+ sdata = JSON.stringify({header: jsonHeaderArray, data: jsonArray});- } else if (defaults.type == 'png') {- html2canvas($(el)[0], {- allowTaint: true,- background: '#fff',- onrendered: function (canvas) {+ if ( defaults.consoleLog === true )+ console.log(sdata);- var image = canvas.toDataURL();- image = image.substring(22); // remove data stuff+ if ( defaults.outputMode === 'string' )+ return sdata;- var byteString = atob(image);- var buffer = new ArrayBuffer(byteString.length);- var intArray = new Uint8Array(buffer);+ if ( defaults.outputMode === 'base64' )+ return base64encode(sdata);- for (var i = 0; i < byteString.length; i++)- intArray[i] = byteString.charCodeAt(i);+ try {+ blob = new Blob([sdata], {type: "application/json;charset=utf-8"});+ saveAs(blob, defaults.fileName + '.json');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.json',+ 'data:application/json;charset=utf-8;base64,',+ sdata);+ }- if (defaults.consoleLog === true)- console.log(byteString);+ } else if ( defaults.type === 'xml' ) {+ rowIndex = 0;+ ranges = [];+ var xml = '<?xml version="1.0" encoding="utf-8"?>';+ xml += '<tabledata><fields>';++ // Header+ $hrows = $(el).find('thead').first().find(defaults.theadSelector);+ $hrows.each(function () {++ ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,+ function (cell, row, col) {+ xml += "<field>" + parseString(cell, row, col) + "</field>";+ });+ rowIndex++;+ });+ xml += '</fields><data>';++ // Data+ var rowCount = 1;++ $rows = collectRows ($(el));+ $($rows).each(function () {+ var colCount = 1;+ trData = "";+ ForEachVisibleCell(this, 'td,th', rowIndex, $hrows.length + $rows.length,+ function (cell, row, col) {+ trData += "<column-" + colCount + ">" + parseString(cell, row, col) + "</column-" + colCount + ">";+ colCount++;+ });+ if ( trData.length > 0 && trData != "<column-1></column-1>" ) {+ xml += '<row id="' + rowCount + '">' + trData + '</row>';+ rowCount++;+ }- if (defaults.outputMode === 'string')- return byteString;+ rowIndex++;+ });+ xml += '</data></tabledata>';- if (defaults.outputMode === 'base64')- return base64encode(image);+ // Output+ if ( defaults.consoleLog === true )+ console.log(xml);- try {- var blob = new Blob([buffer], {type: "image/png"});- saveAs(blob, defaults.fileName + '.png');- }- catch (e) {- downloadFile(defaults.fileName + '.png',- 'data:image/png;base64,',- image);+ if ( defaults.outputMode === 'string' )+ return xml;++ if ( defaults.outputMode === 'base64' )+ return base64encode(xml);++ try {+ blob = new Blob([xml], {type: "application/xml;charset=utf-8"});+ saveAs(blob, defaults.fileName + '.xml');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.xml',+ 'data:application/xml;charset=utf-8;base64,',+ xml);+ }}- }- });-- } else if (defaults.type == 'pdf') {- if (defaults.jspdf.autotable === false) {- var addHtmlOptions = {- dim: {- w: getPropertyUnitValue($(el).first().get(0), 'width', 'mm'),- h: getPropertyUnitValue($(el).first().get(0), 'height', 'mm')- },- pagesplit: false- };-- var doc = new jsPDF(defaults.jspdf.orientation, defaults.jspdf.unit, defaults.jspdf.format);- doc.addHTML($(el).first(),- defaults.jspdf.margins.left,- defaults.jspdf.margins.top,- addHtmlOptions,- function () {- jsPdfOutput(doc);- });- //delete doc;- }- else {- // pdf output using jsPDF AutoTable plugin- // https://github.com/simonbengtsson/jsPDF-AutoTable-- var teOptions = defaults.jspdf.autotable.tableExport;-- // When setting jspdf.format to 'bestfit' tableExport tries to choose- // the minimum required paper format and orientation in which the table- // (or tables in multitable mode) completely fits without column adjustment- if (typeof defaults.jspdf.format === 'string' && defaults.jspdf.format.toLowerCase() === 'bestfit') {- var pageFormats = {- 'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],- 'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],- 'a4': [595.28, 841.89]- };- var rk = '', ro = '';- var mw = 0;-- $(el).filter(':visible').each(function () {- if ($(this).css('display') != 'none') {- var w = getPropertyUnitValue($(this).get(0), 'width', 'pt');-- if (w > mw) {- if (w > pageFormats['a0'][0]) {- rk = 'a0';- ro = 'l';- }- for (var key in pageFormats) {- if (pageFormats.hasOwnProperty(key)) {- if (pageFormats[key][1] > w) {- rk = key;- ro = 'l';- if (pageFormats[key][0] > w)- ro = 'p';- }+ else if ( defaults.type === 'excel' && defaults.excelFileFormat === 'xmlss' ) {+ var docDatas = [];+ var docNames = [];++ $(el).filter(function () {+ return isVisible($(this));+ }).each(function () {+ var $table = $(this);++ var ssName = '';+ if ( typeof defaults.worksheetName === 'string' && defaults.worksheetName.length )+ ssName = defaults.worksheetName + ' ' + (docNames.length + 1);+ else if ( typeof defaults.worksheetName[docNames.length] !== 'undefined' )+ ssName = defaults.worksheetName[docNames.length];+ if ( ! ssName.length )+ ssName = $table.find('caption').text() || '';+ if ( ! ssName.length )+ ssName = 'Table ' + (docNames.length + 1);+ ssName = ssName.replace(/[\\\/[\]*:?'"]/g,'').substring(0,31).trim();++ docNames.push($('<div />').text(ssName).html());++ if ( defaults.exportHiddenCells === false ) {+ $hiddenTableElements = $table.find("tr, th, td").filter(":hidden");+ checkCellVisibilty = $hiddenTableElements.length > 0;+ }++ rowIndex = 0;+ colNames = GetColumnNames(this);+ docData = '<Table>\r';++ function CollectXmlssData ($rows, rowselector, length) {+ var spans = [];++ $($rows).each(function () {+ var ssIndex = 0;+ var nCols = 0;+ trData = "";++ ForEachVisibleCell(this, 'td,th', rowIndex, length + $rows.length,+ function (cell, row, col) {+ if ( cell !== null ) {+ var style = "";+ var data = parseString(cell, row, col);+ var type = "String";++ if ( jQuery.isNumeric(data) !== false ) {+ type = "Number";+ }+ else {+ var number = parsePercent(data);+ if ( number !== false ) {+ data = number;+ type = "Number";+ style += ' ss:StyleID="pct1"';+ }+ }++ if ( type !== "Number" )+ data = data.replace(/\n/g, '<br>');++ var colspan = parseInt(cell.getAttribute('colspan'));+ var rowspan = parseInt(cell.getAttribute('rowspan'));++ // Skip spans+ spans.forEach(function (range) {+ if ( rowIndex >= range.s.r && rowIndex <= range.e.r && nCols >= range.s.c && nCols <= range.e.c ) {+ for ( var i = 0; i <= range.e.c - range.s.c; ++i ) {+ nCols++;+ ssIndex++;+ }+ }+ });++ // Handle Row Span+ if ( rowspan || colspan ) {+ rowspan = rowspan || 1;+ colspan = colspan || 1;+ spans.push({+ s: {r: rowIndex, c: nCols},+ e: {r: rowIndex + rowspan - 1, c: nCols + colspan - 1}+ });+ }++ // Handle Colspan+ if ( colspan > 1 ) {+ style += ' ss:MergeAcross="' + (colspan-1) + '"';+ nCols += (colspan - 1);+ }++ if ( rowspan > 1 ) {+ style += ' ss:MergeDown="' + (rowspan-1) + '" ss:StyleID="rsp1"';+ }++ if ( ssIndex > 0 ) {+ style += ' ss:Index="' + (nCols+1) + '"';+ ssIndex = 0;+ }++ trData += '<Cell' + style + '><Data ss:Type="' + type + '">' ++ $('<div />').text(data).html() ++ '</Data></Cell>\r';+ nCols++;+ }+ });+ if ( trData.length > 0 )+ docData += '<Row ss:AutoFitHeight="0">\r' + trData + '</Row>\r';+ rowIndex++;+ });++ return $rows.length;}- }- mw = w;++ var rowLength = 0;+ rowLength += CollectXmlssData ($table.find('thead').first().find(defaults.theadSelector), 'th,td', rowLength);+ CollectXmlssData (collectRows ($table), 'td,th', rowLength);++ docData += '</Table>\r';+ docDatas.push(docData);++ if ( defaults.consoleLog === true )+ console.log(docData);+ });++ var count = {};+ var firstOccurences = {};+ var item, itemCount;+ for (var n = 0, c = docNames.length; n < c; n++)+ {+ item = docNames[n];+ itemCount = count[item];+ itemCount = count[item] = (itemCount == null ? 1 : itemCount + 1);++ if( itemCount == 2 )+ docNames[firstOccurences[item]] = docNames[firstOccurences[item]].substring(0,29) + "-1";+ if( count[ item ] > 1 )+ docNames[n] = docNames[n].substring(0,29) + "-" + count[item];+ else+ firstOccurences[item] = n;}- }- });- defaults.jspdf.format = (rk == '' ? 'a4' : rk);- defaults.jspdf.orientation = (ro == '' ? 'w' : ro);- }-- // The jsPDF doc object is stored in defaults.jspdf.autotable.tableExport,- // thus it can be accessed from any callback function- teOptions.doc = new jsPDF(defaults.jspdf.orientation,- defaults.jspdf.unit,- defaults.jspdf.format);-- $(el).filter(function() {- return $(this).data("tableexport-display") != 'none' &&- ($(this).is(':visible') ||- $(this).data("tableexport-display") == 'always');- }).each(function () {- var colKey;- var rowIndex = 0;-- colNames = GetColumnNames (this);-- teOptions.columns = [];- teOptions.rows = [];- teOptions.rowoptions = {};-- // onTable: optional callback function for every matching table that can be used- // to modify the tableExport options or to skip the output of a particular table- // if the table selector targets multiple tables- if (typeof teOptions.onTable === 'function')- if (teOptions.onTable($(this), defaults) === false)- return true; // continue to next iteration step (table)-- // each table works with an own copy of AutoTable options- defaults.jspdf.autotable.tableExport = null; // avoid deep recursion error- var atOptions = $.extend(true, {}, defaults.jspdf.autotable);- defaults.jspdf.autotable.tableExport = teOptions;-- atOptions.margin = {};- $.extend(true, atOptions.margin, defaults.jspdf.margins);- atOptions.tableExport = teOptions;-- // Fix jsPDF Autotable's row height calculation- if (typeof atOptions.beforePageContent !== 'function') {- atOptions.beforePageContent = function (data) {- if (data.pageCount == 1) {- var all = data.table.rows.concat(data.table.headerRow);- all.forEach(function (row) {- if ( row.height > 0 ) {- row.height += (2 - FONT_ROW_RATIO) / 2 * row.styles.fontSize;- data.table.height += (2 - FONT_ROW_RATIO) / 2 * row.styles.fontSize;++ var CreationDate = new Date().toISOString();+ var xmlssDocFile = '<?xml version="1.0" encoding="UTF-8"?>\r' ++ '<?mso-application progid="Excel.Sheet"?>\r' ++ '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r' ++ ' xmlns:o="urn:schemas-microsoft-com:office:office"\r' ++ ' xmlns:x="urn:schemas-microsoft-com:office:excel"\r' ++ ' xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r' ++ ' xmlns:html="http://www.w3.org/TR/REC-html40">\r' ++ '<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r' ++ ' <Created>' + CreationDate + '</Created>\r' ++ '</DocumentProperties>\r' ++ '<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r' ++ ' <AllowPNG/>\r' ++ '</OfficeDocumentSettings>\r' ++ '<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r' ++ ' <WindowHeight>9000</WindowHeight>\r' ++ ' <WindowWidth>13860</WindowWidth>\r' ++ ' <WindowTopX>0</WindowTopX>\r' ++ ' <WindowTopY>0</WindowTopY>\r' ++ ' <ProtectStructure>False</ProtectStructure>\r' ++ ' <ProtectWindows>False</ProtectWindows>\r' ++ '</ExcelWorkbook>\r' ++ '<Styles>\r' ++ ' <Style ss:ID="Default" ss:Name="Normal">\r' ++ ' <Alignment ss:Vertical="Bottom"/>\r' ++ ' <Borders/>\r' ++ ' <Font/>\r' ++ ' <Interior/>\r' ++ ' <NumberFormat/>\r' ++ ' <Protection/>\r' ++ ' </Style>\r' ++ ' <Style ss:ID="rsp1">\r' ++ ' <Alignment ss:Vertical="Center"/>\r' ++ ' </Style>\r' ++ ' <Style ss:ID="pct1">\r' ++ ' <NumberFormat ss:Format="Percent"/>\r' ++ ' </Style>\r' ++ '</Styles>\r';++ for ( var j = 0; j < docDatas.length; j++ ) {+ xmlssDocFile += '<Worksheet ss:Name="' + docNames[j] + '" ss:RightToLeft="' + (defaults.excelRTL ? '1' : '0') + '">\r' ++ docDatas[j];+ if (defaults.excelRTL) {+ xmlssDocFile += '<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r' ++ '<DisplayRightToLeft/>\r' ++ '</WorksheetOptions>\r';}- });+ else+ xmlssDocFile += '<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r';+ xmlssDocFile += '</Worksheet>\r';+ }++ xmlssDocFile += '</Workbook>\r';++ if ( defaults.consoleLog === true )+ console.log(xmlssDocFile);++ if ( defaults.outputMode === 'string' )+ return xmlssDocFile;++ if ( defaults.outputMode === 'base64' )+ return base64encode(xmlssDocFile);++ try {+ blob = new Blob([xmlssDocFile], {type: "application/xml;charset=utf-8"});+ saveAs(blob, defaults.fileName + '.xml');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.xml',+ 'data:application/xml;charset=utf-8;base64,',+ xmlssDocFile);}- }}+ else if ( defaults.type == 'excel' || defaults.type == 'xls' || defaults.type == 'word' || defaults.type == 'doc' ) {++ var MSDocType = (defaults.type == 'excel' || defaults.type == 'xls') ? 'excel' : 'word';+ var MSDocExt = (MSDocType == 'excel') ? 'xls' : 'doc';+ var MSDocSchema = 'xmlns:x="urn:schemas-microsoft-com:office:' + MSDocType + '"';+ var docData = '';+ var docName = '';++ $(el).filter(function () {+ return isVisible($(this));+ }).each(function () {+ var $table = $(this);++ if (docName === '') {+ docName = defaults.worksheetName || $table.find('caption').text() || 'Table';+ docName = docName.replace(/[\\\/[\]*:?'"]/g, '').substring(0, 31).trim();+ }- if (typeof atOptions.createdHeaderCell !== 'function') {- // apply some original css styles to pdf header cells- atOptions.createdHeaderCell = function (cell, data) {+ if ( defaults.exportHiddenCells === false ) {+ $hiddenTableElements = $table.find("tr, th, td").filter(":hidden");+ checkCellVisibilty = $hiddenTableElements.length > 0;+ }++ rowIndex = 0;+ ranges = [];+ colNames = GetColumnNames(this);++ // Header+ docData += '<table><thead>';+ $hrows = $table.find('thead').first().find(defaults.theadSelector);+ $hrows.each(function () {+ trData = "";+ ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,+ function (cell, row, col) {+ if ( cell !== null ) {+ var thstyle = '';+ trData += '<th';+ for ( var styles in defaults.excelstyles ) {+ if ( defaults.excelstyles.hasOwnProperty(styles) ) {+ var thcss = $(cell).css(defaults.excelstyles[styles]);+ if ( thcss !== '' && thcss != '0px none rgb(0, 0, 0)' && thcss != 'rgba(0, 0, 0, 0)' ) {+ thstyle += (thstyle === '') ? 'style="' : ';';+ thstyle += defaults.excelstyles[styles] + ':' + thcss;+ }+ }+ }+ if ( thstyle !== '' )+ trData += ' ' + thstyle + '"';+ if ( $(cell).is("[colspan]") )+ trData += ' colspan="' + $(cell).attr('colspan') + '"';+ if ( $(cell).is("[rowspan]") )+ trData += ' rowspan="' + $(cell).attr('rowspan') + '"';+ trData += '>' + parseString(cell, row, col) + '</th>';+ }+ });+ if ( trData.length > 0 )+ docData += '<tr>' + trData + '</tr>';+ rowIndex++;+ });+ docData += '</thead><tbody>';++ // Data+ $rows = collectRows ($table);+ $($rows).each(function () {+ var $row = $(this);+ trData = "";+ ForEachVisibleCell(this, 'td,th', rowIndex, $hrows.length + $rows.length,+ function (cell, row, col) {+ if ( cell !== null ) {+ var tdvalue = parseString(cell, row, col);+ var tdstyle = '';+ var tdcss = $(cell).data("tableexport-msonumberformat");++ if ( typeof tdcss == 'undefined' && typeof defaults.onMsoNumberFormat === 'function' )+ tdcss = defaults.onMsoNumberFormat(cell, row, col);++ if ( typeof tdcss != 'undefined' && tdcss !== '' )+ tdstyle = 'style="mso-number-format:\'' + tdcss + '\'';++ for ( var cssStyle in defaults.excelstyles ) {+ if ( defaults.excelstyles.hasOwnProperty(cssStyle) ) {+ tdcss = $(cell).css(defaults.excelstyles[cssStyle]);+ if ( tdcss === '' )+ tdcss = $row.css(defaults.excelstyles[cssStyle]);++ if ( tdcss !== '' && tdcss != '0px none rgb(0, 0, 0)' && tdcss != 'rgba(0, 0, 0, 0)' ) {+ tdstyle += (tdstyle === '') ? 'style="' : ';';+ tdstyle += defaults.excelstyles[cssStyle] + ':' + tdcss;+ }+ }+ }+ trData += '<td';+ if ( tdstyle !== '' )+ trData += ' ' + tdstyle + '"';+ if ( $(cell).is("[colspan]") )+ trData += ' colspan="' + $(cell).attr('colspan') + '"';+ if ( $(cell).is("[rowspan]") )+ trData += ' rowspan="' + $(cell).attr('rowspan') + '"';++ if ( typeof tdvalue === 'string' && tdvalue != '' )+ tdvalue = tdvalue.replace(/\n/g, '<br>');++ trData += '>' + tdvalue + '</td>';+ }+ });+ if ( trData.length > 0 )+ docData += '<tr>' + trData + '</tr>';+ rowIndex++;+ });++ if ( defaults.displayTableName )+ docData += '<tr><td></td></tr><tr><td></td></tr><tr><td>' + parseString($('<p>' + defaults.tableName + '</p>')) + '</td></tr>';++ docData += '</tbody></table>';++ if ( defaults.consoleLog === true )+ console.log(docData);+ });++ //noinspection XmlUnusedNamespaceDeclaration+ var docFile = '<html xmlns:o="urn:schemas-microsoft-com:office:office" ' + MSDocSchema + ' xmlns="http://www.w3.org/TR/REC-html40">';+ docFile += '<meta http-equiv="content-type" content="application/vnd.ms-' + MSDocType + '; charset=UTF-8">';+ docFile += "<head>";+ if (MSDocType === 'excel') {+ docFile += "<!--[if gte mso 9]>";+ docFile += "<xml>";+ docFile += "<x:ExcelWorkbook>";+ docFile += "<x:ExcelWorksheets>";+ docFile += "<x:ExcelWorksheet>";+ docFile += "<x:Name>";+ docFile += docName;+ docFile += "</x:Name>";+ docFile += "<x:WorksheetOptions>";+ docFile += "<x:DisplayGridlines/>";+ if (defaults.excelRTL)+ docFile += "<x:DisplayRightToLeft/>";+ docFile += "</x:WorksheetOptions>";+ docFile += "</x:ExcelWorksheet>";+ docFile += "</x:ExcelWorksheets>";+ docFile += "</x:ExcelWorkbook>";+ docFile += "</xml>";+ docFile += "<![endif]-->";+ }+ docFile += "<style>br {mso-data-placement:same-cell;}</style>";+ docFile += "</head>";+ docFile += "<body>";+ docFile += docData;+ docFile += "</body>";+ docFile += "</html>";- // jsPDF AutoTable plugin v2.0.14 fix: each cell needs its own styles object- cell.styles = $.extend({}, data.row.styles);+ if ( defaults.consoleLog === true )+ console.log(docFile);- if (typeof teOptions.columns [data.column.dataKey] != 'undefined') {- var col = teOptions.columns [data.column.dataKey];+ if ( defaults.outputMode === 'string' )+ return docFile;- if (typeof col.rect != 'undefined') {- var rh;+ if ( defaults.outputMode === 'base64' )+ return base64encode(docFile);- cell.contentWidth = col.rect.width;+ try {+ blob = new Blob([docFile], {type: 'application/vnd.ms-' + defaults.type});+ saveAs(blob, defaults.fileName + '.' + MSDocExt);+ }+ catch (e) {+ downloadFile(defaults.fileName + '.' + MSDocExt,+ 'data:application/vnd.ms-' + MSDocType + ';base64,',+ docFile);+ }++ } else if ( defaults.type == 'xlsx' ) {++ var data = [];+ var spans = [];+ rowIndex = 0;++ $rows = $(el).find('thead').first().find(defaults.theadSelector);+ $rows.push.apply($rows, collectRows ($(el)));++ $($rows).each(function () {+ var cols = [];+ ForEachVisibleCell(this, 'th,td', rowIndex, $rows.length,+ function (cell, row, col) {+ if ( typeof cell !== 'undefined' && cell !== null ) {++ var cellValue = parseString(cell, row, col);++ var colspan = parseInt(cell.getAttribute('colspan'));+ var rowspan = parseInt(cell.getAttribute('rowspan'));++ // Skip span ranges+ spans.forEach(function (range) {+ if ( rowIndex >= range.s.r && rowIndex <= range.e.r && cols.length >= range.s.c && cols.length <= range.e.c ) {+ for ( var i = 0; i <= range.e.c - range.s.c; ++i )+ cols.push(null);+ }+ });++ // Handle Row Span+ if ( rowspan || colspan ) {+ rowspan = rowspan || 1;+ colspan = colspan || 1;+ spans.push({+ s: {r: rowIndex, c: cols.length},+ e: {r: rowIndex + rowspan - 1, c: cols.length + colspan - 1}+ });+ }++ // Handle Value+ if ( typeof defaults.onCellData !== 'function' ) {++ // Type conversion+ if ( cellValue !== "" && cellValue == +cellValue )+ cellValue = +cellValue;+ }+ cols.push(cellValue !== "" ? cellValue : null);++ // Handle Colspan+ if ( colspan )+ for ( var k = 0; k < colspan - 1; ++k )+ cols.push(null);+ }+ });+ data.push(cols);+ rowIndex++;+ });- if (typeof teOptions.heightRatio == 'undefined' || teOptions.heightRatio == 0) {- if (data.row.raw [data.column.dataKey].rowspan)- rh = data.row.raw [data.column.dataKey].rect.height / data.row.raw [data.column.dataKey].rowspan;- else- rh = data.row.raw [data.column.dataKey].rect.height;+ //noinspection JSPotentiallyInvalidConstructorUsage+ var wb = new jx_Workbook(),+ ws = jx_createSheet(data);- teOptions.heightRatio = cell.styles.rowHeight / rh;+ // add span ranges to worksheet+ ws['!merges'] = spans;++ // add worksheet to workbook+ wb.SheetNames.push(defaults.worksheetName);+ wb.Sheets[defaults.worksheetName] = ws;++ var wbout = XLSX.write(wb, {bookType: defaults.type, bookSST: false, type: 'binary'});++ try {+ blob = new Blob([jx_s2ab(wbout)], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'});+ saveAs(blob, defaults.fileName + '.' + defaults.type);+ }+ catch (e) {+ downloadFile(defaults.fileName + '.' + defaults.type,+ 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,',+ jx_s2ab(wbout));+ }++ } else if ( defaults.type == 'png' ) {+ //html2canvas($(el)[0], {+ // onrendered: function (canvas) {+ html2canvas($(el)[0]).then(+ function (canvas) {++ var image = canvas.toDataURL();+ var byteString = atob(image.substring(22)); // remove data stuff+ var buffer = new ArrayBuffer(byteString.length);+ var intArray = new Uint8Array(buffer);++ for ( var i = 0; i < byteString.length; i++ )+ intArray[i] = byteString.charCodeAt(i);++ if ( defaults.consoleLog === true )+ console.log(byteString);++ if ( defaults.outputMode === 'string' )+ return byteString;++ if ( defaults.outputMode === 'base64' )+ return base64encode(image);++ if ( defaults.outputMode === 'window' ) {+ window.open(image);+ return;+ }++ try {+ blob = new Blob([buffer], {type: "image/png"});+ saveAs(blob, defaults.fileName + '.png');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.png', 'data:image/png,', blob);+ }+ //}+ });++ } else if ( defaults.type == 'pdf' ) {++ if ( defaults.pdfmake.enabled === true ) {+ // pdf output using pdfmake+ // https://github.com/bpampuch/pdfmake++ var widths = [];+ var body = [];+ rowIndex = 0;+ ranges = [];++ var CollectPdfmakeData = function ($rows, colselector, length) {+ var rlength = 0;++ $($rows).each(function () {+ var r = [];++ ForEachVisibleCell(this, colselector, rowIndex, length,+ function (cell, row, col) {+ if ( typeof cell !== 'undefined' && cell !== null ) {++ var colspan = parseInt(cell.getAttribute('colspan'));+ var rowspan = parseInt(cell.getAttribute('rowspan'));++ var cellValue = parseString(cell, row, col) || " ";++ if ( colspan > 1 || rowspan > 1 ) {+ colspan = colspan || 1;+ rowspan = rowspan || 1;+ r.push({colSpan: colspan, rowSpan: rowspan, text: cellValue});+ }+ else+ r.push(cellValue);+ }+ else+ r.push(" ");+ });++ if ( r.length )+ body.push(r);++ if ( rlength < r.length )+ rlength = r.length;++ rowIndex++;+ });++ return rlength;+ };++ $hrows = $(this).find('thead').first().find(defaults.theadSelector);++ var colcount = CollectPdfmakeData($hrows, 'th,td', $hrows.length);++ for ( var i = widths.length; i < colcount; i++ )+ widths.push("*");++ // Data+ $rows = collectRows ($(this));++ CollectPdfmakeData($rows, 'th,td', $hrows.length + $rows.length);++ var docDefinition = {+ content: [{+ table: {+ headerRows: $hrows.length,+ widths: widths,+ body: body+ }+ }]+ };++ $.extend(true, docDefinition, defaults.pdfmake.docDefinition);++ pdfMake.fonts = {+ Roboto: {+ normal: 'Roboto-Regular.ttf',+ bold: 'Roboto-Medium.ttf',+ italics: 'Roboto-Italic.ttf',+ bolditalics: 'Roboto-MediumItalic.ttf'+ }+ };++ $.extend(true, pdfMake.fonts, defaults.pdfmake.fonts);++ pdfMake.createPdf(docDefinition).getBuffer(function (buffer) {++ try {+ var blob = new Blob([buffer], {type: "application/pdf"});+ saveAs(blob, defaults.fileName + '.pdf');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.pdf',+ 'data:application/pdf;base64,',+ buffer);+ }+ });++ }+ else if ( defaults.jspdf.autotable === false ) {+ // pdf output using jsPDF's core html support++ var addHtmlOptions = {+ dim: {+ w: getPropertyUnitValue($(el).first().get(0), 'width', 'mm'),+ h: getPropertyUnitValue($(el).first().get(0), 'height', 'mm')+ },+ pagesplit: false+ };++ var doc = new jsPDF(defaults.jspdf.orientation, defaults.jspdf.unit, defaults.jspdf.format);+ doc.addHTML($(el).first(),+ defaults.jspdf.margins.left,+ defaults.jspdf.margins.top,+ addHtmlOptions,+ function () {+ jsPdfOutput(doc, false);+ });+ //delete doc;+ }+ else {+ // pdf output using jsPDF AutoTable plugin+ // https://github.com/simonbengtsson/jsPDF-AutoTable++ var teOptions = defaults.jspdf.autotable.tableExport;++ // When setting jspdf.format to 'bestfit' tableExport tries to choose+ // the minimum required paper format and orientation in which the table+ // (or tables in multitable mode) completely fits without column adjustment+ if ( typeof defaults.jspdf.format === 'string' && defaults.jspdf.format.toLowerCase() === 'bestfit' ) {+ var pageFormats = {+ 'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],+ 'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],+ 'a4': [595.28, 841.89]+ };+ var rk = '', ro = '';+ var mw = 0;++ $(el).each(function () {+ if ( isVisible($(this)) ) {+ var w = getPropertyUnitValue($(this).get(0), 'width', 'pt');++ if ( w > mw ) {+ if ( w > pageFormats.a0[0] ) {+ rk = 'a0';+ ro = 'l';+ }+ for ( var key in pageFormats ) {+ if ( pageFormats.hasOwnProperty(key) ) {+ if ( pageFormats[key][1] > w ) {+ rk = key;+ ro = 'l';+ if ( pageFormats[key][0] > w )+ ro = 'p';+ }+ }+ }+ mw = w;+ }+ }+ });+ defaults.jspdf.format = (rk === '' ? 'a4' : rk);+ defaults.jspdf.orientation = (ro === '' ? 'w' : ro);+ }++ // The jsPDF doc object is stored in defaults.jspdf.autotable.tableExport,+ // thus it can be accessed from any callback function+ if ( teOptions.doc == null ) {+ teOptions.doc = new jsPDF(defaults.jspdf.orientation,+ defaults.jspdf.unit,+ defaults.jspdf.format);++ if ( typeof defaults.jspdf.onDocCreated === 'function' )+ defaults.jspdf.onDocCreated(teOptions.doc);+ }++ if ( teOptions.outputImages === true )+ teOptions.images = {};++ if ( typeof teOptions.images != 'undefined' ) {+ $(el).filter(function () {+ return isVisible($(this));+ }).each(function () {+ var rowCount = 0;+ ranges = [];++ if ( defaults.exportHiddenCells === false ) {+ $hiddenTableElements = $(this).find("tr, th, td").filter(":hidden");+ checkCellVisibilty = $hiddenTableElements.length > 0;+ }++ $hrows = $(this).find('thead').find(defaults.theadSelector);+ $rows = collectRows ($(this));++ $($rows).each(function () {+ ForEachVisibleCell(this, 'td,th', $hrows.length + rowCount, $hrows.length + $rows.length,+ function (cell) {+ if ( typeof cell !== 'undefined' && cell !== null ) {+ var kids = $(cell).children();+ if ( typeof kids != 'undefined' && kids.length > 0 )+ collectImages(cell, kids, teOptions);+ }+ });+ rowCount++;+ });+ });++ $hrows = [];+ $rows = [];}- rh = data.row.raw [data.column.dataKey].rect.height * teOptions.heightRatio;- if (rh > cell.styles.rowHeight)- cell.styles.rowHeight = rh;- }-- if (typeof col.style != 'undefined' && col.style.hidden !== true) {- cell.styles.halign = col.style.align;- if (atOptions.styles.fillColor === 'inherit')- cell.styles.fillColor = col.style.bcolor;- if (atOptions.styles.textColor === 'inherit')- cell.styles.textColor = col.style.color;- if (atOptions.styles.fontStyle === 'inherit')- cell.styles.fontStyle = col.style.fstyle;- }+ loadImages(teOptions, function () {+ $(el).filter(function () {+ return isVisible($(this));+ }).each(function () {+ var colKey;+ rowIndex = 0;+ ranges = [];++ if ( defaults.exportHiddenCells === false ) {+ $hiddenTableElements = $(this).find("tr, th, td").filter(":hidden");+ checkCellVisibilty = $hiddenTableElements.length > 0;+ }++ colNames = GetColumnNames(this);++ teOptions.columns = [];+ teOptions.rows = [];+ teOptions.rowoptions = {};++ // onTable: optional callback function for every matching table that can be used+ // to modify the tableExport options or to skip the output of a particular table+ // if the table selector targets multiple tables+ if ( typeof teOptions.onTable === 'function' )+ if ( teOptions.onTable($(this), defaults) === false )+ return true; // continue to next iteration step (table)++ // each table works with an own copy of AutoTable options+ defaults.jspdf.autotable.tableExport = null; // avoid deep recursion error+ var atOptions = $.extend(true, {}, defaults.jspdf.autotable);+ defaults.jspdf.autotable.tableExport = teOptions;++ atOptions.margin = {};+ $.extend(true, atOptions.margin, defaults.jspdf.margins);+ atOptions.tableExport = teOptions;++ // Fix jsPDF Autotable's row height calculation+ if ( typeof atOptions.beforePageContent !== 'function' ) {+ atOptions.beforePageContent = function (data) {+ if ( data.pageCount == 1 ) {+ var all = data.table.rows.concat(data.table.headerRow);+ all.forEach(function (row) {+ if ( row.height > 0 ) {+ row.height += (2 - FONT_ROW_RATIO) / 2 * row.styles.fontSize;+ data.table.height += (2 - FONT_ROW_RATIO) / 2 * row.styles.fontSize;+ }+ });+ }+ };+ }++ if ( typeof atOptions.createdHeaderCell !== 'function' ) {+ // apply some original css styles to pdf header cells+ atOptions.createdHeaderCell = function (cell, data) {++ // jsPDF AutoTable plugin v2.0.14 fix: each cell needs its own styles object+ cell.styles = $.extend({}, data.row.styles);++ if ( typeof teOptions.columns [data.column.dataKey] != 'undefined' ) {+ var col = teOptions.columns [data.column.dataKey];++ if ( typeof col.rect != 'undefined' ) {+ var rh;++ cell.contentWidth = col.rect.width;++ if ( typeof teOptions.heightRatio == 'undefined' || teOptions.heightRatio === 0 ) {+ if ( data.row.raw [data.column.dataKey].rowspan )+ rh = data.row.raw [data.column.dataKey].rect.height / data.row.raw [data.column.dataKey].rowspan;+ else+ rh = data.row.raw [data.column.dataKey].rect.height;++ teOptions.heightRatio = cell.styles.rowHeight / rh;+ }++ rh = data.row.raw [data.column.dataKey].rect.height * teOptions.heightRatio;+ if ( rh > cell.styles.rowHeight )+ cell.styles.rowHeight = rh;+ }++ if ( typeof col.style != 'undefined' && col.style.hidden !== true ) {+ cell.styles.halign = col.style.align;+ if ( atOptions.styles.fillColor === 'inherit' )+ cell.styles.fillColor = col.style.bcolor;+ if ( atOptions.styles.textColor === 'inherit' )+ cell.styles.textColor = col.style.color;+ if ( atOptions.styles.fontStyle === 'inherit' )+ cell.styles.fontStyle = col.style.fstyle;+ }+ }+ };+ }++ if ( typeof atOptions.createdCell !== 'function' ) {+ // apply some original css styles to pdf table cells+ atOptions.createdCell = function (cell, data) {+ var rowopt = teOptions.rowoptions [data.row.index + ":" + data.column.dataKey];++ if ( typeof rowopt != 'undefined' &&+ typeof rowopt.style != 'undefined' &&+ rowopt.style.hidden !== true ) {+ cell.styles.halign = rowopt.style.align;+ if ( atOptions.styles.fillColor === 'inherit' )+ cell.styles.fillColor = rowopt.style.bcolor;+ if ( atOptions.styles.textColor === 'inherit' )+ cell.styles.textColor = rowopt.style.color;+ if ( atOptions.styles.fontStyle === 'inherit' )+ cell.styles.fontStyle = rowopt.style.fstyle;+ }+ };+ }++ if ( typeof atOptions.drawHeaderCell !== 'function' ) {+ atOptions.drawHeaderCell = function (cell, data) {+ var colopt = teOptions.columns [data.column.dataKey];++ if ( (colopt.style.hasOwnProperty("hidden") !== true || colopt.style.hidden !== true) &&+ colopt.rowIndex >= 0 )+ return prepareAutoTableText(cell, data, colopt);+ else+ return false; // cell is hidden+ };+ }++ if ( typeof atOptions.drawCell !== 'function' ) {+ atOptions.drawCell = function (cell, data) {+ var rowopt = teOptions.rowoptions [data.row.index + ":" + data.column.dataKey];+ if ( prepareAutoTableText(cell, data, rowopt) ) {++ teOptions.doc.rect(cell.x, cell.y, cell.width, cell.height, cell.styles.fillStyle);++ if ( typeof rowopt != 'undefined' && typeof rowopt.kids != 'undefined' && rowopt.kids.length > 0 ) {++ var dh = cell.height / rowopt.rect.height;+ if ( dh > teOptions.dh || typeof teOptions.dh == 'undefined' )+ teOptions.dh = dh;+ teOptions.dw = cell.width / rowopt.rect.width;++ var y = cell.textPos.y;+ drawAutotableElements(cell, rowopt.kids, teOptions);+ cell.textPos.y = y;+ drawAutotableText(cell, rowopt.kids, teOptions);+ }+ else+ drawAutotableText(cell, {}, teOptions);+ }+ return false;+ };+ }++ // collect header and data rows+ teOptions.headerrows = [];+ $hrows = $(this).find('thead').find(defaults.theadSelector);+ $hrows.each(function () {+ colKey = 0;+ teOptions.headerrows[rowIndex] = [];++ ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,+ function (cell, row, col) {+ var obj = getCellStyles(cell);+ obj.title = parseString(cell, row, col);+ obj.key = colKey++;+ obj.rowIndex = rowIndex;+ teOptions.headerrows[rowIndex].push(obj);+ });+ rowIndex++;+ });++ if ( rowIndex > 0 ) {+ // iterate through last row+ var lastrow = rowIndex - 1;+ while ( lastrow >= 0 ) {+ $.each(teOptions.headerrows[lastrow], function () {+ var obj = this;++ if ( lastrow > 0 && this.rect === null )+ obj = teOptions.headerrows[lastrow - 1][this.key];++ if ( obj !== null && obj.rowIndex >= 0 &&+ (obj.style.hasOwnProperty("hidden") !== true || obj.style.hidden !== true) )+ teOptions.columns.push(obj);+ });++ lastrow = (teOptions.columns.length > 0) ? -1 : lastrow - 1;+ }+ }++ var rowCount = 0;+ $rows = [];+ $rows = collectRows ($(this));+ $($rows).each(function () {+ var rowData = [];+ colKey = 0;++ ForEachVisibleCell(this, 'td,th', rowIndex, $hrows.length + $rows.length,+ function (cell, row, col) {+ var obj;++ if ( typeof teOptions.columns[colKey] === 'undefined' ) {+ // jsPDF-Autotable needs columns. Thus define hidden ones for tables without thead+ obj = {+ title: '',+ key: colKey,+ style: {+ hidden: true+ }+ };+ teOptions.columns.push(obj);+ }+ if ( typeof cell !== 'undefined' && cell !== null ) {+ obj = getCellStyles(cell);+ obj.kids = $(cell).children();+ teOptions.rowoptions [rowCount + ":" + colKey++] = obj;+ }+ else {+ obj = $.extend(true, {}, teOptions.rowoptions [rowCount + ":" + (colKey - 1)]);+ obj.colspan = -1;+ teOptions.rowoptions [rowCount + ":" + colKey++] = obj;+ }++ rowData.push(parseString(cell, row, col));+ });+ if ( rowData.length ) {+ teOptions.rows.push(rowData);+ rowCount++;+ }+ rowIndex++;+ });++ // onBeforeAutotable: optional callback function before calling+ // jsPDF AutoTable that can be used to modify the AutoTable options+ if ( typeof teOptions.onBeforeAutotable === 'function' )+ teOptions.onBeforeAutotable($(this), teOptions.columns, teOptions.rows, atOptions);++ teOptions.doc.autoTable(teOptions.columns, teOptions.rows, atOptions);++ // onAfterAutotable: optional callback function after returning+ // from jsPDF AutoTable that can be used to modify the AutoTable options+ if ( typeof teOptions.onAfterAutotable === 'function' )+ teOptions.onAfterAutotable($(this), atOptions);++ // set the start position for the next table (in case there is one)+ defaults.jspdf.autotable.startY = teOptions.doc.autoTableEndPosY() + atOptions.margin.top;++ });++ jsPdfOutput(teOptions.doc, (typeof teOptions.images != 'undefined' && jQuery.isEmptyObject(teOptions.images) === false));++ if ( typeof teOptions.headerrows != 'undefined' )+ teOptions.headerrows.length = 0;+ if ( typeof teOptions.columns != 'undefined' )+ teOptions.columns.length = 0;+ if ( typeof teOptions.rows != 'undefined' )+ teOptions.rows.length = 0;+ delete teOptions.doc;+ teOptions.doc = null;+ });}- }}- if (typeof atOptions.createdCell !== 'function') {- // apply some original css styles to pdf table cells- atOptions.createdCell = function (cell, data) {- var rowopt = teOptions.rowoptions [data.row.index + ":" + data.column.dataKey];-- if (typeof rowopt != 'undefined' &&- typeof rowopt.style != 'undefined' &&- rowopt.style.hidden !== true) {- cell.styles.halign = rowopt.style.align;- if (atOptions.styles.fillColor === 'inherit')- cell.styles.fillColor = rowopt.style.bcolor;- if (atOptions.styles.textColor === 'inherit')- cell.styles.textColor = rowopt.style.color;- if (atOptions.styles.fontStyle === 'inherit')- cell.styles.fontStyle = rowopt.style.fstyle;+ /*+ function FindColObject (objects, colIndex, rowIndex) {+ var result = null;+ $.each(objects, function () {+ if ( this.rowIndex == rowIndex && this.key == colIndex ) {+ result = this;+ return false;+ }+ });+ return result;+ }+ */+ function collectRows ($table) {+ var result = [];+ findTablePart($table,'tbody').each(function () {+ result.push.apply(result, findRows($(this), defaults.tbodySelector));+ });+ if ( defaults.tfootSelector.length ) {+ findTablePart($table,'tfoot').each(function () {+ result.push.apply(result, findRows($(this), defaults.tfootSelector));+ });}- }+ return result;}- if (typeof atOptions.drawHeaderCell !== 'function') {- atOptions.drawHeaderCell = function (cell, data) {- var colopt = teOptions.columns [data.column.dataKey];+ function findTablePart ($table, type) {+ var tl = $table.parents('table').length;+ return $table.find(type).filter (function () {+ return $(this).closest('table').parents('table').length === tl;+ });+ }- if ((colopt.style.hasOwnProperty("hidden") != true || colopt.style.hidden !== true) &&- colopt.rowIndex >= 0 )- return prepareAutoTableText (cell, data, colopt);- else- return false; // cell is hidden- }+ function findRows ($tpart, rowSelector) {+ return $tpart.find(rowSelector).filter (function () {+ return $(this).find('table').length === 0 && $(this).parents('table').length === 1;+ });}- if (typeof atOptions.drawCell !== 'function') {- atOptions.drawCell = function (cell, data) {- var rowopt = teOptions.rowoptions [data.row.index + ":" + data.column.dataKey];- if ( prepareAutoTableText (cell, data, rowopt) ) {+ function GetColumnNames (table) {+ var result = [];+ $(table).find('thead').first().find('th').each(function (index, el) {+ if ( $(el).attr("data-field") !== undefined )+ result[index] = $(el).attr("data-field");+ else+ result[index] = index.toString();+ });+ return result;+ }- teOptions.doc.rect(cell.x, cell.y, cell.width, cell.height, cell.styles.fillStyle);+ function isVisible ($element) {+ var isCell = typeof $element[0].cellIndex !== 'undefined';+ var isRow = typeof $element[0].rowIndex !== 'undefined';+ var isElementVisible = (isCell || isRow) ? isTableElementVisible($element) : $element.is(':visible');+ var tableexportDisplay = $element.data("tableexport-display");- if (typeof rowopt != 'undefined' && typeof rowopt.kids != 'undefined' && rowopt.kids.length > 0) {+ if (isCell && tableexportDisplay != 'none' && tableexportDisplay != 'always') {+ $element = $($element[0].parentNode);+ isRow = typeof $element[0].rowIndex !== 'undefined';+ tableexportDisplay = $element.data("tableexport-display");+ }+ if (isRow && tableexportDisplay != 'none' && tableexportDisplay != 'always') {+ tableexportDisplay = $element.closest('table').data("tableexport-display");+ }- var dh = cell.height / rowopt.rect.height;- if ( dh > teOptions.dh || typeof teOptions.dh == 'undefined' )- teOptions.dh = dh;- teOptions.dw = cell.width / rowopt.rect.width;+ return tableexportDisplay !== 'none' && (isElementVisible == true || tableexportDisplay == 'always');+ }- drawCellElements (cell, rowopt.kids, teOptions);- }- teOptions.doc.autoTableText(cell.text, cell.textPos.x, cell.textPos.y, {- halign: cell.styles.halign,- valign: cell.styles.valign- });+ function isTableElementVisible ($element) {+ var hiddenEls = [];++ if ( checkCellVisibilty ) {+ hiddenEls = $hiddenTableElements.filter (function () {+ var found = false;++ if (this.nodeType == $element[0].nodeType) {+ if (typeof this.rowIndex !== 'undefined' && this.rowIndex == $element[0].rowIndex)+ found = true;+ else if (typeof this.cellIndex !== 'undefined' && this.cellIndex == $element[0].cellIndex &&+ typeof this.parentNode.rowIndex !== 'undefined' &&+ typeof $element[0].parentNode.rowIndex !== 'undefined' &&+ this.parentNode.rowIndex == $element[0].parentNode.rowIndex)+ found = true;+ }+ return found;+ });}- return false;- }+ return (checkCellVisibilty == false || hiddenEls.length == 0);}- // collect header and data rows- teOptions.headerrows = [];- $hrows = $(this).find('thead').find(defaults.theadSelector);- $hrows.each(function () {- colKey = 0;-- teOptions.headerrows[rowIndex] = [];-- ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,- function (cell, row, col) {- var obj = getCellStyles (cell);- obj.title = parseString(cell, row, col);- obj.key = colKey++;- obj.rowIndex = rowIndex;- teOptions.headerrows[rowIndex].push(obj);- });- rowIndex++;- });-- if (rowIndex > 0) {- // iterate through last row- $.each(teOptions.headerrows[rowIndex-1], function () {- if (rowIndex > 1 && this.rect == null)- obj = teOptions.headerrows[rowIndex-2][this.key];+ function isColumnIgnored ($cell, rowLength, colIndex) {+ var result = false;++ if (isVisible($cell)) {+ if ( defaults.ignoreColumn.length > 0 ) {+ if ( $.inArray(colIndex, defaults.ignoreColumn) != -1 ||+ $.inArray(colIndex - rowLength, defaults.ignoreColumn) != -1 ||+ (colNames.length > colIndex && typeof colNames[colIndex] != 'undefined' &&+ $.inArray(colNames[colIndex], defaults.ignoreColumn) != -1) )+ result = true;+ }+ }else- obj = this;+ result = true;- if (obj != null)- teOptions.columns.push(obj);- });+ return result;}- var rowCount = 0;- $rows = $(this).find('tbody').find(defaults.tbodySelector);- $rows.each(function () {- var rowData = [];- colKey = 0;-- ForEachVisibleCell(this, 'td', rowIndex, $hrows.length + $rows.length,- function (cell, row, col) {- if (typeof teOptions.columns[colKey] === 'undefined') {- // jsPDF-Autotable needs columns. Thus define hidden ones for tables without thead- var obj = {- title: '',- key: colKey,- style: {- hidden: true+ function ForEachVisibleCell (tableRow, selector, rowIndex, rowCount, cellcallback) {+ if ( typeof (cellcallback) === 'function' ) {+ var ignoreRow = false;++ if (typeof defaults.onIgnoreRow === 'function')+ ignoreRow = defaults.onIgnoreRow($(tableRow), rowIndex);++ if (ignoreRow === false &&+ $.inArray(rowIndex, defaults.ignoreRow) == -1 &&+ $.inArray(rowIndex - rowCount, defaults.ignoreRow) == -1 &&+ isVisible($(tableRow))) {++ var $cells = $(tableRow).find(selector);+ var cellCount = 0;++ $cells.each(function (colIndex) {+ var $cell = $(this);+ var c;+ var colspan = parseInt(this.getAttribute('colspan'));+ var rowspan = parseInt(this.getAttribute('rowspan'));++ // Skip ranges+ ranges.forEach(function (range) {+ if ( rowIndex >= range.s.r && rowIndex <= range.e.r && cellCount >= range.s.c && cellCount <= range.e.c ) {+ for ( c = 0; c <= range.e.c - range.s.c; ++c )+ cellcallback(null, rowIndex, cellCount++);+ }+ });++ if ( isColumnIgnored($cell, $cells.length, colIndex) === false ) {+ // Handle Row Span+ if ( rowspan || colspan ) {+ rowspan = rowspan || 1;+ colspan = colspan || 1;+ ranges.push({+ s: {r: rowIndex, c: cellCount},+ e: {r: rowIndex + rowspan - 1, c: cellCount + colspan - 1}+ });+ }++ // Handle Value+ cellcallback(this, rowIndex, cellCount++);}- };- teOptions.columns.push(obj);- }- if (typeof cell !== 'undefined' && cell != null) {- var obj = getCellStyles (cell);- obj.kids = $(cell).children();- teOptions.rowoptions [rowCount + ":" + colKey++] = obj;++ // Handle Colspan+ if ( colspan )+ for ( c = 0; c < colspan - 1; ++c )+ cellcallback(null, rowIndex, cellCount++);+ });++ // Skip ranges+ ranges.forEach(function (range) {+ if ( rowIndex >= range.s.r && rowIndex <= range.e.r && cellCount >= range.s.c && cellCount <= range.e.c ) {+ for ( c = 0; c <= range.e.c - range.s.c; ++c )+ cellcallback(null, rowIndex, cellCount++);+ }+ });+ }+ }+ }++ function jsPdfOutput (doc, hasimages) {+ if ( defaults.consoleLog === true )+ console.log(doc.output());++ if ( defaults.outputMode === 'string' )+ return doc.output();++ if ( defaults.outputMode === 'base64' )+ return base64encode(doc.output());++ if ( defaults.outputMode === 'window' ) {+ window.URL = window.URL || window.webkitURL;+ window.open(window.URL.createObjectURL(doc.output("blob")));+ return;+ }++ try {+ var blob = doc.output('blob');+ saveAs(blob, defaults.fileName + '.pdf');+ }+ catch (e) {+ downloadFile(defaults.fileName + '.pdf',+ 'data:application/pdf' + (hasimages ? '' : ';base64') + ',',+ hasimages ? doc.output('blob') : doc.output());+ }+ }++ function prepareAutoTableText (cell, data, cellopt) {+ var cs = 0;+ if ( typeof cellopt !== 'undefined' )+ cs = cellopt.colspan;++ if ( cs >= 0 ) {+ // colspan handling+ var cellWidth = cell.width;+ var textPosX = cell.textPos.x;+ var i = data.table.columns.indexOf(data.column);++ for ( var c = 1; c < cs; c++ ) {+ var column = data.table.columns[i + c];+ cellWidth += column.width;+ }++ if ( cs > 1 ) {+ if ( cell.styles.halign === 'right' )+ textPosX = cell.textPos.x + cellWidth - cell.width;+ else if ( cell.styles.halign === 'center' )+ textPosX = cell.textPos.x + (cellWidth - cell.width) / 2;+ }++ cell.width = cellWidth;+ cell.textPos.x = textPosX;++ if ( typeof cellopt !== 'undefined' && cellopt.rowspan > 1 )+ cell.height = cell.height * cellopt.rowspan;++ // fix jsPDF's calculation of text position+ if ( cell.styles.valign === 'middle' || cell.styles.valign === 'bottom' ) {+ var splittedText = typeof cell.text === 'string' ? cell.text.split(/\r\n|\r|\n/g) : cell.text;+ var lineCount = splittedText.length || 1;+ if ( lineCount > 2 )+ cell.textPos.y -= ((2 - FONT_ROW_RATIO) / 2 * data.row.styles.fontSize) * (lineCount - 2) / 3;+ }+ return true;+ }+ else+ return false; // cell is hidden (colspan = -1), don't draw it+ }++ function collectImages (cell, elements, teOptions) {+ if ( typeof teOptions.images != 'undefined' ) {+ elements.each(function () {+ var kids = $(this).children();++ if ( $(this).is("img") ) {+ var hash = strHashCode(this.src);++ teOptions.images[hash] = {+ url: this.src,+ src: this.src+ };}- else {- var obj = $.extend(true, {}, teOptions.rowoptions [rowCount + ":" + (colKey-1)]);- obj.colspan = -1;- teOptions.rowoptions [rowCount + ":" + colKey++] = obj;++ if ( typeof kids != 'undefined' && kids.length > 0 )+ collectImages(cell, kids, teOptions);+ });+ }+ }++ function loadImages (teOptions, callback) {+ var i;+ var imageCount = 0;+ var x = 0;++ function done () {+ callback(imageCount);+ }++ function loadImage (image) {+ if ( !image.url )+ return;+ var img = new Image();+ imageCount = ++x;+ img.crossOrigin = 'Anonymous';+ img.onerror = img.onload = function () {+ if ( img.complete ) {++ if ( img.src.indexOf('data:image/') === 0 ) {+ img.width = image.width || img.width || 0;+ img.height = image.height || img.height || 0;+ }++ if ( img.width + img.height ) {+ var canvas = document.createElement("canvas");+ var ctx = canvas.getContext("2d");++ canvas.width = img.width;+ canvas.height = img.height;+ ctx.drawImage(img, 0, 0);++ image.src = canvas.toDataURL("image/jpeg");+ }}+ if ( !--x )+ done();+ };+ img.src = image.url;+ }- rowData.push(parseString(cell, row, col));- });- if (rowData.length) {- teOptions.rows.push(rowData);- rowCount++- }- rowIndex++;- });-- // onBeforeAutotable: optional callback function before calling- // jsPDF AutoTable that can be used to modify the AutoTable options- if (typeof teOptions.onBeforeAutotable === 'function')- teOptions.onBeforeAutotable($(this), teOptions.columns, teOptions.rows, atOptions);-- teOptions.doc.autoTable(teOptions.columns, teOptions.rows, atOptions);-- // onAfterAutotable: optional callback function after returning- // from jsPDF AutoTable that can be used to modify the AutoTable options- if (typeof teOptions.onAfterAutotable === 'function')- teOptions.onAfterAutotable($(this), atOptions);-- // set the start position for the next table (in case there is one)- defaults.jspdf.autotable.startY = teOptions.doc.autoTableEndPosY() + atOptions.margin.top;- });-- jsPdfOutput(teOptions.doc);-- if (typeof teOptions.headerrows != 'undefined')- teOptions.headerrows.length = 0;- if (typeof teOptions.columns != 'undefined')- teOptions.columns.length = 0;- if (typeof teOptions.rows != 'undefined')- teOptions.rows.length = 0;- delete teOptions.doc;- teOptions.doc = null;- }- }-- function FindColObject (objects, colIndex, rowIndex) {- var result = null;- $.each(objects, function () {- if (this.rowIndex == rowIndex && this.key == colIndex) {- result = this;- return false;- }- });- return result;- }-- function GetColumnNames (table) {- var result = [];- $(table).find('thead').first().find('th').each(function(index, el) {- if ($(el).attr("data-field") !== undefined)- result[index] = $(el).attr("data-field");- else- result[index] = index.toString();- });- return result;- }-- function isColumnIgnored($row, colIndex) {- var result = false;- if (defaults.ignoreColumn.length > 0) {- if (typeof defaults.ignoreColumn[0] == 'string') {- if (colNames.length > colIndex && typeof colNames[colIndex] != 'undefined')- if ($.inArray(colNames[colIndex], defaults.ignoreColumn) != -1)- result = true;- }- else if (typeof defaults.ignoreColumn[0] == 'number') {- if ($.inArray(colIndex, defaults.ignoreColumn) != -1 ||- $.inArray(colIndex-$row.length, defaults.ignoreColumn) != -1)- result = true;- }- }- return result;- }-- function ForEachVisibleCell(tableRow, selector, rowIndex, rowCount, cellcallback) {- if ($.inArray(rowIndex, defaults.ignoreRow) == -1 &&- $.inArray(rowIndex-rowCount, defaults.ignoreRow) == -1) {-- var $row = $(tableRow).filter(function() {- return $(this).data("tableexport-display") != 'none' &&- ($(this).is(':visible') ||- $(this).data("tableexport-display") == 'always' ||- $(this).closest('table').data("tableexport-display") == 'always');- }).find(selector);-- var rowColspan = 0;- var rowColIndex = 0;-- $row.each(function (colIndex) {- if ($(this).data("tableexport-display") == 'always' ||- ($(this).css('display') != 'none' &&- $(this).css('visibility') != 'hidden' &&- $(this).data("tableexport-display") != 'none')) {- if (isColumnIgnored($row, colIndex) == false) {- if (typeof (cellcallback) === "function") {- var c, Colspan = 0;- var r, Rowspan = 0;-- // handle rowspans from previous rows- if (typeof rowspans[rowIndex] != 'undefined' && rowspans[rowIndex].length > 0) {- for (c = 0; c <= colIndex; c++) {- if (typeof rowspans[rowIndex][c] != 'undefined') {- cellcallback(null, rowIndex, c);- delete rowspans[rowIndex][c];- colIndex++;- }+ if ( typeof teOptions.images != 'undefined' ) {+ for ( i in teOptions.images )+ if ( teOptions.images.hasOwnProperty(i) )+ loadImage(teOptions.images[i]);+ }++ return x || done();+ }++ function drawAutotableElements (cell, elements, teOptions) {+ elements.each(function () {+ var kids = $(this).children();+ var uy = 0;++ if ( $(this).is("div") ) {+ var bcolor = rgb2array(getStyle(this, 'background-color'), [255, 255, 255]);+ var lcolor = rgb2array(getStyle(this, 'border-top-color'), [0, 0, 0]);+ var lwidth = getPropertyUnitValue(this, 'border-top-width', defaults.jspdf.unit);++ var r = this.getBoundingClientRect();+ var ux = this.offsetLeft * teOptions.dw;+ uy = this.offsetTop * teOptions.dh;+ var uw = r.width * teOptions.dw;+ var uh = r.height * teOptions.dh;++ teOptions.doc.setDrawColor.apply(undefined, lcolor);+ teOptions.doc.setFillColor.apply(undefined, bcolor);+ teOptions.doc.setLineWidth(lwidth);+ teOptions.doc.rect(cell.x + ux, cell.y + uy, uw, uh, lwidth ? "FD" : "F");+ }+ else if ( $(this).is("img") ) {+ if ( typeof teOptions.images != 'undefined' ) {+ var hash = strHashCode(this.src);+ var image = teOptions.images[hash];++ if ( typeof image != 'undefined' ) {++ var arCell = cell.width / cell.height;+ var arImg = this.width / this.height;+ var imgWidth = cell.width;+ var imgHeight = cell.height;+ var px2pt = 0.264583 * 72 / 25.4;++ if ( arImg <= arCell ) {+ imgHeight = Math.min(cell.height, this.height);+ imgWidth = this.width * imgHeight / this.height;+ }+ else if ( arImg > arCell ) {+ imgWidth = Math.min(cell.width, this.width);+ imgHeight = this.height * imgWidth / this.width;+ }++ imgWidth *= px2pt;+ imgHeight *= px2pt;++ if ( imgHeight < cell.height )+ uy = (cell.height - imgHeight) / 2;++ try {+ teOptions.doc.addImage(image.src, cell.textPos.x, cell.y + uy, imgWidth, imgHeight);+ }+ catch (e) {+ // TODO: IE -> convert png to jpeg+ }+ cell.textPos.x += imgWidth;+ }+ }}- }- rowColIndex = colIndex;- if ($(this).is("[colspan]")) {- Colspan = parseInt($(this).attr('colspan'));- rowColspan += Colspan > 0 ? Colspan - 1 : 0;- }+ if ( typeof kids != 'undefined' && kids.length > 0 )+ drawAutotableElements(cell, kids, teOptions);+ });+ }++ function drawAutotableText (cell, texttags, teOptions) {+ if ( typeof teOptions.onAutotableText === 'function' ) {+ teOptions.onAutotableText(teOptions.doc, cell, texttags);+ }+ else {+ var x = cell.textPos.x;+ var y = cell.textPos.y;+ var style = {halign: cell.styles.halign, valign: cell.styles.valign};++ if ( texttags.length ) {+ var tag = texttags[0];+ while ( tag.previousSibling )+ tag = tag.previousSibling;- if ($(this).is("[rowspan]"))- Rowspan = parseInt($(this).attr('rowspan'));+ var b = false, i = false;- // output content of current cell- cellcallback(this, rowIndex, colIndex);+ while ( tag ) {+ var txt = tag.innerText || tag.textContent || "";- // handle colspan of current cell- for (c = 0; c < Colspan - 1; c++)- cellcallback(null, rowIndex, colIndex + c);+ txt = ((txt.length && txt[0] == " ") ? " " : "") ++ $.trim(txt) ++ ((txt.length > 1 && txt[txt.length - 1] == " ") ? " " : "");- // store rowspan for following rows- if (Rowspan) {- for (r = 1; r < Rowspan; r++) {- if (typeof rowspans[rowIndex + r] == 'undefined')- rowspans[rowIndex + r] = [];+ if ( $(tag).is("br") ) {+ x = cell.textPos.x;+ y += teOptions.doc.internal.getFontSize();+ }++ if ( $(tag).is("b") )+ b = true;+ else if ( $(tag).is("i") )+ i = true;++ if ( b || i )+ teOptions.doc.setFontType((b && i) ? "bolditalic" : b ? "bold" : "italic");++ var w = teOptions.doc.getStringUnitWidth(txt) * teOptions.doc.internal.getFontSize();++ if ( w ) {+ if ( cell.styles.overflow === 'linebreak' &&+ x > cell.textPos.x && (x + w) > (cell.textPos.x + cell.width) ) {+ var chars = ".,!%*;:=-";+ if ( chars.indexOf(txt.charAt(0)) >= 0 ) {+ var s = txt.charAt(0);+ w = teOptions.doc.getStringUnitWidth(s) * teOptions.doc.internal.getFontSize();+ if ( (x + w) <= (cell.textPos.x + cell.width) ) {+ teOptions.doc.autoTableText(s, x, y, style);+ txt = txt.substring(1, txt.length);+ }+ w = teOptions.doc.getStringUnitWidth(txt) * teOptions.doc.internal.getFontSize();+ }+ x = cell.textPos.x;+ y += teOptions.doc.internal.getFontSize();+ }++ while ( txt.length && (x + w) > (cell.textPos.x + cell.width) ) {+ txt = txt.substring(0, txt.length - 1);+ w = teOptions.doc.getStringUnitWidth(txt) * teOptions.doc.internal.getFontSize();+ }++ teOptions.doc.autoTableText(txt, x, y, style);+ x += w;+ }- rowspans[rowIndex + r][colIndex + rowColspan] = "";+ if ( b || i ) {+ if ( $(tag).is("b") )+ b = false;+ else if ( $(tag).is("i") )+ i = false;++ teOptions.doc.setFontType((!b && !i) ? "normal" : b ? "bold" : "italic");+ }- for (c = 1; c < Colspan; c++)- rowspans[rowIndex + r][colIndex + rowColspan - c] = "";+ tag = tag.nextSibling;+ }+ cell.textPos.x = x;+ cell.textPos.y = y;+ }+ else {+ teOptions.doc.autoTableText(cell.text, cell.textPos.x, cell.textPos.y, style);}- }}- }}- });- // handle rowspans from previous rows- if (typeof rowspans[rowIndex] != 'undefined' && rowspans[rowIndex].length > 0) {- for (c = 0; c <= rowspans[rowIndex].length; c++) {- if (typeof rowspans[rowIndex][c] != 'undefined') {- cellcallback(null, rowIndex, c);- delete rowspans[rowIndex][c];- }++ function escapeRegExp (string) {+ return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");+ }++ function replaceAll (string, find, replace) {+ return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);}- }- }- }- function jsPdfOutput(doc) {- if (defaults.consoleLog === true)- console.log(doc.output());+ function parseNumber (value) {+ value = value || "0";+ value = replaceAll(value, defaults.numbers.html.thousandsSeparator, '');+ value = replaceAll(value, defaults.numbers.html.decimalMark, '.');- if (defaults.outputMode === 'string')- return doc.output();+ return typeof value === "number" || jQuery.isNumeric(value) !== false ? value : false;+ }- if (defaults.outputMode === 'base64')- return base64encode(doc.output());+ function parsePercent (value) {+ if ( value.indexOf("%") > -1 ) {+ value = parseNumber(value.replace(/%/g, ""));+ if ( value !== false )+ value = value / 100;+ }+ else+ value = false;+ return value;+ }- try {- var blob = doc.output('blob');- saveAs(blob, defaults.fileName + '.pdf');- }- catch (e) {- downloadFile(defaults.fileName + '.pdf',- 'data:application/pdf;base64,',- doc.output());- }- }-- function prepareAutoTableText (cell, data, cellopt) {- var cs = 0;- if ( typeof cellopt != 'undefined' )- cs = cellopt.colspan;-- if ( cs >= 0 ) {- // colspan handling- var cellWidth = cell.width;- var textPosX = cell.textPos.x;- var i = data.table.columns.indexOf(data.column);-- for (var c = 1; c < cs; c++) {- var column = data.table.columns[i+c];- cellWidth += column.width;- }-- if ( cs > 1 ) {- if ( cell.styles.halign === 'right' )- textPosX = cell.textPos.x + cellWidth - cell.width;- else if ( cell.styles.halign === 'center' )- textPosX = cell.textPos.x + (cellWidth - cell.width) / 2;- }-- cell.width = cellWidth;- cell.textPos.x = textPosX;-- if ( typeof cellopt != 'undefined' && cellopt.rowspan > 1 )- cell.height = cell.height * cellopt.rowspan;-- // fix jsPDF's calculation of text position- if ( cell.styles.valign === 'middle' || cell.styles.valign === 'bottom' ) {- var splittedText = typeof cell.text === 'string' ? cell.text.split(/\r\n|\r|\n/g) : cell.text;- var lineCount = splittedText.length || 1;- if (lineCount > 2)- cell.textPos.y -= ((2 - FONT_ROW_RATIO) / 2 * data.row.styles.fontSize) * (lineCount-2) / 3 ;- }- return true;- }- else- return false; // cell is hidden (colspan = -1), don't draw it- }-- function drawCellElements (cell, elements, teOptions) {- elements.each(function () {- var kids = $(this).children();-- if ( $(this).is("div") ) {- var bcolor = rgb2array(getStyle(this, 'background-color'), [255, 255, 255]);- var lcolor = rgb2array(getStyle(this, 'border-top-color'), [0, 0, 0]);- var lwidth = getPropertyUnitValue(this, 'border-top-width', defaults.jspdf.unit);-- var r = this.getBoundingClientRect();- var ux = this.offsetLeft * teOptions.dw;- var uy = this.offsetTop * teOptions.dh;- var uw = r.width * teOptions.dw;- var uh = r.height * teOptions.dh;-- teOptions.doc.setDrawColor.apply (undefined, lcolor);- teOptions.doc.setFillColor.apply (undefined, bcolor);- teOptions.doc.setLineWidth (lwidth);- teOptions.doc.rect(cell.x + ux, cell.y + uy, uw, uh, lwidth ? "FD" : "F");- }-- if (typeof kids != 'undefined' && kids.length > 0)- drawCellElements (cell, kids, teOptions);- });- }-- function escapeRegExp(string) {- return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");- }-- function replaceAll(string, find, replace) {- return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);- }-- // Takes a string and encapsulates it (by default in double-quotes) if it- // contains the csv field separator, spaces, or linebreaks.- function csvString(cell, rowIndex, colIndex) {- var result = '';-- if (cell != null) {- var dataString = parseString(cell, rowIndex, colIndex);-- var csvValue = (dataString === null || dataString == '') ? '' : dataString.toString();-- if (dataString instanceof Date)- result = defaults.csvEnclosure + dataString.toLocaleString() + defaults.csvEnclosure;- else {- result = replaceAll(csvValue, defaults.csvEnclosure, defaults.csvEnclosure + defaults.csvEnclosure);-- if (result.indexOf(defaults.csvSeparator) >= 0 || /[\r\n ]/g.test(result))- result = defaults.csvEnclosure + result + defaults.csvEnclosure;- }- }+ function parseString (cell, rowIndex, colIndex) {+ var result = '';- return result;- }-- function parseNumber(value) {- value = value || "0";- value = replaceAll(value, defaults.numbers.html.decimalMark, '.');- value = replaceAll(value, defaults.numbers.html.thousandsSeparator, '');-- return typeof value === "number" || jQuery.isNumeric(value) !== false ? value : false;- }--- function parseString(cell, rowIndex, colIndex) {- var result = '';-- if (cell != null) {- var $cell = $(cell);- var htmlData;-- if ($cell[0].hasAttribute("data-tableexport-value"))- htmlData = $cell.data("tableexport-value");- else- htmlData = $cell.html();-- if (typeof defaults.onCellHtmlData === 'function')- htmlData = defaults.onCellHtmlData($cell, rowIndex, colIndex, htmlData);-- if (defaults.htmlContent === true) {- result = $.trim(htmlData);- }- else {- var text = htmlData.replace(/\n/g,'\u2028').replace(/<br\s*[\/]?>/gi, '\u2060');- var obj = $('<div/>').html(text).contents();- text = '';- $.each(obj.text().split("\u2028"), function(i, v) {- if (i > 0)- text += " ";- text += $.trim(v);- });-- $.each(text.split("\u2060"), function(i, v) {- if (i > 0)- result += "\n";- result += $.trim(v).replace(/\u00AD/g, ""); // remove soft hyphens- });-- if (defaults.numbers.html.decimalMark != defaults.numbers.output.decimalMark ||- defaults.numbers.html.thousandsSeparator != defaults.numbers.output.thousandsSeparator) {- var number = parseNumber (result);-- if ( number !== false ) {- var frac = ("" + number).split('.');- if ( frac.length == 1 )- frac[1] = "";- var mod = frac[0].length > 3 ? frac[0].length % 3 : 0;-- result = (number < 0 ? "-" : "") +- (defaults.numbers.output.thousandsSeparator ? ((mod ? frac[0].substr(0, mod) + defaults.numbers.output.thousandsSeparator : "") + frac[0].substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + defaults.numbers.output.thousandsSeparator)) : frac[0]) +- (frac[1].length ? defaults.numbers.output.decimalMark + frac[1] : "");- }+ if ( cell !== null ) {+ var $cell = $(cell);+ var htmlData;++ if ( $cell[0].hasAttribute("data-tableexport-value") ) {+ htmlData = $cell.data("tableexport-value");+ htmlData = htmlData ? htmlData + '' : ''+ }+ else {+ htmlData = $cell.html();++ if ( typeof defaults.onCellHtmlData === 'function' )+ htmlData = defaults.onCellHtmlData($cell, rowIndex, colIndex, htmlData);+ else if ( htmlData != '' ) {+ var html = $.parseHTML(htmlData);+ var inputidx = 0;+ var selectidx = 0;++ htmlData = '';+ $.each(html, function () {+ if ( $(this).is("input") )+ htmlData += $cell.find('input').eq(inputidx++).val();+ else if ( $(this).is("select") )+ htmlData += $cell.find('select option:selected').eq(selectidx++).text();+ else {+ if ( typeof $(this).html() === 'undefined' )+ htmlData += $(this).text();+ else if ( jQuery().bootstrapTable === undefined ||+ ($(this).hasClass('filterControl') !== true &&+ $(cell).parents('.detail-view').length === 0) )+ htmlData += $(this).html();+ }+ });+ }+ }++ if ( defaults.htmlContent === true ) {+ result = $.trim(htmlData);+ }+ else if ( htmlData && htmlData != '' ) {+ var cellFormat = $(cell).data("tableexport-cellformat");++ if ( cellFormat != '' ) {+ var text = htmlData.replace(/\n/g, '\u2028').replace(/<br\s*[\/]?>/gi, '\u2060');+ var obj = $('<div/>').html(text).contents();+ var number = false;+ text = '';+ $.each(obj.text().split("\u2028"), function (i, v) {+ if ( i > 0 )+ text += " ";+ text += $.trim(v);+ });++ $.each(text.split("\u2060"), function (i, v) {+ if ( i > 0 )+ result += "\n";+ result += $.trim(v).replace(/\u00AD/g, ""); // remove soft hyphens+ });++ if ( defaults.type == 'json' ||+ (defaults.type === 'excel' && defaults.excelFileFormat === 'xmlss') ||+ defaults.numbers.output === false ) {+ number = parseNumber(result);++ if ( number !== false )+ result = Number(number);+ }+ else if ( defaults.numbers.html.decimalMark != defaults.numbers.output.decimalMark ||+ defaults.numbers.html.thousandsSeparator != defaults.numbers.output.thousandsSeparator ) {+ number = parseNumber(result);++ if ( number !== false ) {+ var frac = ("" + number.substr(number < 0 ? 1 : 0)).split('.');+ if ( frac.length == 1 )+ frac[1] = "";+ var mod = frac[0].length > 3 ? frac[0].length % 3 : 0;++ result = (number < 0 ? "-" : "") ++ (defaults.numbers.output.thousandsSeparator ? ((mod ? frac[0].substr(0, mod) + defaults.numbers.output.thousandsSeparator : "") + frac[0].substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + defaults.numbers.output.thousandsSeparator)) : frac[0]) ++ (frac[1].length ? defaults.numbers.output.decimalMark + frac[1] : "");+ }+ }+ }+ else+ result = htmlData;+ }++ if ( defaults.escape === true ) {+ //noinspection JSDeprecatedSymbols+ result = escape(result);+ }++ if ( typeof defaults.onCellData === 'function' ) {+ result = defaults.onCellData($cell, rowIndex, colIndex, result);+ }+ }++ return result;}- }- if (defaults.escape === true) {- result = escape(result);- }+ //noinspection JSUnusedLocalSymbols+ function hyphenate (a, b, c) {+ return b + "-" + c.toLowerCase();+ }- if (typeof defaults.onCellData === 'function') {- result = defaults.onCellData($cell, rowIndex, colIndex, result);- }- }+ function rgb2array (rgb_string, default_result) {+ var re = /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;+ var bits = re.exec(rgb_string);+ var result = default_result;+ if ( bits )+ result = [parseInt(bits[1]), parseInt(bits[2]), parseInt(bits[3])];+ return result;+ }- return result;- }-- function hyphenate(a, b, c) {- return b + "-" + c.toLowerCase();- }-- function rgb2array(rgb_string, default_result) {- var re = /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;- var bits = re.exec(rgb_string);- var result = default_result;- if (bits)- result = [ parseInt(bits[1]), parseInt(bits[2]), parseInt(bits[3]) ];- return result;- }-- function getCellStyles (cell) {- var a = getStyle(cell, 'text-align');- var fw = getStyle(cell, 'font-weight');- var fs = getStyle(cell, 'font-style');- var f = '';- if (a == 'start')- a = getStyle(cell, 'direction') == 'rtl' ? 'right' : 'left';- if (fw >= 700)- f = 'bold';- if (fs == 'italic')- f += fs;- if (f == '')- f = 'normal';-- var result = {- style: {- align: a,- bcolor: rgb2array(getStyle(cell, 'background-color'), [255, 255, 255]),- color: rgb2array(getStyle(cell, 'color'), [0, 0, 0]),- fstyle: f- },- colspan: (parseInt($(cell).attr('colspan')) || 0),- rowspan: (parseInt($(cell).attr('rowspan')) || 0)- };-- if (cell !== null) {- var r = cell.getBoundingClientRect();- result.rect = {- width: r.width,- height: r.height- };- }+ function getCellStyles (cell) {+ var a = getStyle(cell, 'text-align');+ var fw = getStyle(cell, 'font-weight');+ var fs = getStyle(cell, 'font-style');+ var f = '';+ if ( a == 'start' )+ a = getStyle(cell, 'direction') == 'rtl' ? 'right' : 'left';+ if ( fw >= 700 )+ f = 'bold';+ if ( fs == 'italic' )+ f += fs;+ if ( f === '' )+ f = 'normal';++ var result = {+ style: {+ align: a,+ bcolor: rgb2array(getStyle(cell, 'background-color'), [255, 255, 255]),+ color: rgb2array(getStyle(cell, 'color'), [0, 0, 0]),+ fstyle: f+ },+ colspan: (parseInt($(cell).attr('colspan')) || 0),+ rowspan: (parseInt($(cell).attr('rowspan')) || 0)+ };++ if ( cell !== null ) {+ var r = cell.getBoundingClientRect();+ result.rect = {+ width: r.width,+ height: r.height+ };+ }- return result;- }-- // get computed style property- function getStyle(target, prop) {- try {- if (window.getComputedStyle) { // gecko and webkit- prop = prop.replace(/([a-z])([A-Z])/, hyphenate); // requires hyphenated, not camel- return window.getComputedStyle(target, null).getPropertyValue(prop);- }- if (target.currentStyle) { // ie- return target.currentStyle[prop];- }- return target.style[prop];- }- catch (e) {- }- return "";- }+ return result;+ }- function getUnitValue(parent, value, unit) {- var baseline = 100; // any number serves+ // get computed style property+ function getStyle (target, prop) {+ try {+ if ( window.getComputedStyle ) { // gecko and webkit+ prop = prop.replace(/([a-z])([A-Z])/, hyphenate); // requires hyphenated, not camel+ return window.getComputedStyle(target, null).getPropertyValue(prop);+ }+ if ( target.currentStyle ) { // ie+ return target.currentStyle[prop];+ }+ return target.style[prop];+ }+ catch (e) {+ }+ return "";+ }- var temp = document.createElement("div"); // create temporary element- temp.style.overflow = "hidden"; // in case baseline is set too low- temp.style.visibility = "hidden"; // no need to show it+ function getUnitValue (parent, value, unit) {+ var baseline = 100; // any number serves- parent.appendChild(temp); // insert it into the parent for em, ex and %+ var temp = document.createElement("div"); // create temporary element+ temp.style.overflow = "hidden"; // in case baseline is set too low+ temp.style.visibility = "hidden"; // no need to show it- temp.style.width = baseline + unit;- var factor = baseline / temp.offsetWidth;+ parent.appendChild(temp); // insert it into the parent for em, ex and %- parent.removeChild(temp); // clean up+ temp.style.width = baseline + unit;+ var factor = baseline / temp.offsetWidth;- return (value * factor);- }+ parent.removeChild(temp); // clean up- function getPropertyUnitValue(target, prop, unit) {- var value = getStyle(target, prop); // get the computed style value+ return (value * factor);+ }- var numeric = value.match(/\d+/); // get the numeric component- if (numeric !== null) {- numeric = numeric[0]; // get the string+ function getPropertyUnitValue (target, prop, unit) {+ var value = getStyle(target, prop); // get the computed style value- return getUnitValue (target.parentElement, numeric, unit);- }- return 0;- }-- function downloadFile(filename, header, data) {-- var ua = window.navigator.userAgent;- if (ua.indexOf("MSIE ") > 0 || !!ua.match(/Trident.*rv\:11\./)) {- // Internet Explorer (<= 9) workaround by Darryl (https://github.com/dawiong/tableExport.jquery.plugin)- // based on sampopes answer on http://stackoverflow.com/questions/22317951- // ! Not working for json and pdf format !- var frame = document.createElement("iframe");-- if (frame) {- document.body.appendChild(frame);- frame.setAttribute("style", "display:none");- frame.contentDocument.open("txt/html", "replace");- frame.contentDocument.write(data);- frame.contentDocument.close();- frame.focus();-- frame.contentDocument.execCommand("SaveAs", true, filename);- document.body.removeChild(frame);- }- }- else {- var DownloadLink = document.createElement('a');+ var numeric = value.match(/\d+/); // get the numeric component+ if ( numeric !== null ) {+ numeric = numeric[0]; // get the string- if (DownloadLink) {- DownloadLink.style.display = 'none';- DownloadLink.download = filename;+ return getUnitValue(target.parentElement, numeric, unit);+ }+ return 0;+ }++ function jx_Workbook () {+ if ( !(this instanceof jx_Workbook) ) {+ //noinspection JSPotentiallyInvalidConstructorUsage+ return new jx_Workbook();+ }+ this.SheetNames = [];+ this.Sheets = {};+ }- if (header.toLowerCase().indexOf("base64,") >= 0)- DownloadLink.href = header + base64encode(data);- else- DownloadLink.href = header + encodeURIComponent(data);+ function jx_s2ab (s) {+ var buf = new ArrayBuffer(s.length);+ var view = new Uint8Array(buf);+ for ( var i = 0; i != s.length; ++i ) view[i] = s.charCodeAt(i) & 0xFF;+ return buf;+ }++ function jx_datenum (v, date1904) {+ if ( date1904 ) v += 1462;+ var epoch = Date.parse(v);+ return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);+ }- document.body.appendChild(DownloadLink);+ function jx_createSheet (data) {+ var ws = {};+ var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};+ for ( var R = 0; R != data.length; ++R ) {+ for ( var C = 0; C != data[R].length; ++C ) {+ if ( range.s.r > R ) range.s.r = R;+ if ( range.s.c > C ) range.s.c = C;+ if ( range.e.r < R ) range.e.r = R;+ if ( range.e.c < C ) range.e.c = C;+ var cell = {v: data[R][C]};+ if ( cell.v === null ) continue;+ var cell_ref = XLSX.utils.encode_cell({c: C, r: R});++ if ( typeof cell.v === 'number' ) cell.t = 'n';+ else if ( typeof cell.v === 'boolean' ) cell.t = 'b';+ else if ( cell.v instanceof Date ) {+ cell.t = 'n';+ cell.z = XLSX.SSF._table[14];+ cell.v = jx_datenum(cell.v);+ }+ else cell.t = 's';+ ws[cell_ref] = cell;+ }+ }- if (document.createEvent) {- if (DownloadEvt == null)- DownloadEvt = document.createEvent('MouseEvents');+ if ( range.s.c < 10000000 ) ws['!ref'] = XLSX.utils.encode_range(range);+ return ws;+ }- DownloadEvt.initEvent('click', true, false);- DownloadLink.dispatchEvent(DownloadEvt);+ function strHashCode (str) {+ var hash = 0, i, chr, len;+ if ( str.length === 0 ) return hash;+ for ( i = 0, len = str.length; i < len; i++ ) {+ chr = str.charCodeAt(i);+ hash = ((hash << 5) - hash) + chr;+ hash |= 0; // Convert to 32bit integer+ }+ return hash;}- else if (document.createEventObject)- DownloadLink.fireEvent('onclick');- else if (typeof DownloadLink.onclick == 'function')- DownloadLink.onclick();- document.body.removeChild(DownloadLink);- }- }- }-- function utf8Encode(string) {- string = string.replace(/\x0d\x0a/g, "\x0a");- var utftext = "";- for (var n = 0; n < string.length; n++) {- var c = string.charCodeAt(n);- if (c < 128) {- utftext += String.fromCharCode(c);- }- else if ((c > 127) && (c < 2048)) {- utftext += String.fromCharCode((c >> 6) | 192);- utftext += String.fromCharCode((c & 63) | 128);- }- else {- utftext += String.fromCharCode((c >> 12) | 224);- utftext += String.fromCharCode(((c >> 6) & 63) | 128);- utftext += String.fromCharCode((c & 63) | 128);- }- }- return utftext;- }-- function base64encode(input) {- var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";- var output = "";- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;- var i = 0;- input = utf8Encode(input);- while (i < input.length) {- chr1 = input.charCodeAt(i++);- chr2 = input.charCodeAt(i++);- chr3 = input.charCodeAt(i++);- enc1 = chr1 >> 2;- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);- enc4 = chr3 & 63;- if (isNaN(chr2)) {- enc3 = enc4 = 64;- } else if (isNaN(chr3)) {- enc4 = 64;- }- output = output +- keyStr.charAt(enc1) + keyStr.charAt(enc2) +- keyStr.charAt(enc3) + keyStr.charAt(enc4);- }- return output;- }+ function downloadFile (filename, header, data) {+ var ua = window.navigator.userAgent;+ if ( filename !== false && window.navigator.msSaveOrOpenBlob ) {+ //noinspection JSUnresolvedFunction+ window.navigator.msSaveOrOpenBlob(new Blob([data]), filename);+ }+ else if ( filename !== false && (ua.indexOf("MSIE ") > 0 || !!ua.match(/Trident.*rv\:11\./)) ) {+ // Internet Explorer (<= 9) workaround by Darryl (https://github.com/dawiong/tableExport.jquery.plugin)+ // based on sampopes answer on http://stackoverflow.com/questions/22317951+ // ! Not working for json and pdf format !+ var frame = document.createElement("iframe");++ if ( frame ) {+ document.body.appendChild(frame);+ frame.setAttribute("style", "display:none");+ frame.contentDocument.open("txt/html", "replace");+ frame.contentDocument.write(data);+ frame.contentDocument.close();+ frame.focus();++ frame.contentDocument.execCommand("SaveAs", true, filename);+ document.body.removeChild(frame);+ }+ }+ else {+ var DownloadLink = document.createElement('a');++ if ( DownloadLink ) {+ var blobUrl = null;++ DownloadLink.style.display = 'none';+ if ( filename !== false )+ DownloadLink.download = filename;+ else+ DownloadLink.target = '_blank';++ if ( typeof data == 'object' ) {+ window.URL = window.URL || window.webkitURL;+ blobUrl = window.URL.createObjectURL(data);+ DownloadLink.href = blobUrl;+ }+ else if ( header.toLowerCase().indexOf("base64,") >= 0 )+ DownloadLink.href = header + base64encode(data);+ else+ DownloadLink.href = header + encodeURIComponent(data);- return this;- }- });+ document.body.appendChild(DownloadLink);++ if ( document.createEvent ) {+ if ( DownloadEvt === null )+ DownloadEvt = document.createEvent('MouseEvents');++ DownloadEvt.initEvent('click', true, false);+ DownloadLink.dispatchEvent(DownloadEvt);+ }+ else if ( document.createEventObject )+ DownloadLink.fireEvent('onclick');+ else if ( typeof DownloadLink.onclick == 'function' )+ DownloadLink.onclick();++ setTimeout(function(){+ if ( blobUrl )+ window.URL.revokeObjectURL(blobUrl);+ document.body.removeChild(DownloadLink);+ }, 100);+ }+ }+ }++ function utf8Encode (text) {+ if (typeof text === 'string') {+ text = text.replace(/\x0d\x0a/g, "\x0a");+ var utftext = "";+ for ( var n = 0; n < text.length; n++ ) {+ var c = text.charCodeAt(n);+ if ( c < 128 ) {+ utftext += String.fromCharCode(c);+ }+ else if ( (c > 127) && (c < 2048) ) {+ utftext += String.fromCharCode((c >> 6) | 192);+ utftext += String.fromCharCode((c & 63) | 128);+ }+ else {+ utftext += String.fromCharCode((c >> 12) | 224);+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);+ utftext += String.fromCharCode((c & 63) | 128);+ }+ }+ return utftext;+ }+ return text;+ }++ function base64encode (input) {+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;+ var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";+ var output = "";+ var i = 0;+ input = utf8Encode(input);+ while ( i < input.length ) {+ chr1 = input.charCodeAt(i++);+ chr2 = input.charCodeAt(i++);+ chr3 = input.charCodeAt(i++);+ enc1 = chr1 >> 2;+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);+ enc4 = chr3 & 63;+ if ( isNaN(chr2) ) {+ enc3 = enc4 = 64;+ } else if ( isNaN(chr3) ) {+ enc4 = 64;+ }+ output = output ++ keyStr.charAt(enc1) + keyStr.charAt(enc2) ++ keyStr.charAt(enc3) + keyStr.charAt(enc4);+ }+ return output;+ }++ return this;+ }+ });})(jQuery);diff --git a/public/js/extensions/export/tableExport.min.js b/public/js/extensions/export/tableExport.min.jsnew file mode 100644index 0000000000..7844ddfac0--- /dev/null+++ b/public/js/extensions/export/tableExport.min.js@@ -0,0 +1,77 @@+/*+ tableExport.jquery.plugin++ Version 1.9.8++ Copyright (c) 2015-2017 hhurz, https://github.com/hhurz++ Original Work Copyright (c) 2014 Giri Raj++ Licensed under the MIT License+*/+var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,f,u){c instanceof String&&(c=String(c));for(var C=c.length,D=0;D<C;D++){var O=c[D];if(f.call(u,O,D,c))return{i:D,v:O}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,f,u){c!=Array.prototype&&c!=Object.prototype&&(c[f]=u.value)};+$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,f,u,C){if(f){u=$jscomp.global;c=c.split(".");for(C=0;C<c.length-1;C++){var D=c[C];D in u||(u[D]={});u=u[D]}c=c[c.length-1];C=u[c];f=f(C);f!=C&&null!=f&&$jscomp.defineProperty(u,c,{configurable:!0,writable:!0,value:f})}};+$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,u){return $jscomp.findInternal(this,c,u).v}},"es6","es3");+(function(c){c.fn.extend({tableExport:function(f){function u(b){var e=[];C(b,"tbody").each(function(){e.push.apply(e,D(c(this),a.tbodySelector))});a.tfootSelector.length&&C(b,"tfoot").each(function(){e.push.apply(e,D(c(this),a.tfootSelector))});return e}function C(b,e){var a=b.parents("table").length;return b.find(e).filter(function(){return c(this).closest("table").parents("table").length===a})}function D(b,e){return b.find(e).filter(function(){return 0===c(this).find("table").length&&1===c(this).parents("table").length})}+ function O(b){var e=[];c(b).find("thead").first().find("th").each(function(b,a){void 0!==c(a).attr("data-field")?e[b]=c(a).attr("data-field"):e[b]=b.toString()});return e}function P(b){var e="undefined"!==typeof b[0].cellIndex,a="undefined"!==typeof b[0].rowIndex,r=e||a?ya(b):b.is(":visible"),g=b.data("tableexport-display");e&&"none"!=g&&"always"!=g&&(b=c(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,g=b.data("tableexport-display"));a&&"none"!=g&&"always"!=g&&(g=b.closest("table").data("tableexport-display"));+ return"none"!==g&&(1==r||"always"==g)}function ya(b){var e=[];R&&(e=K.filter(function(){var e=!1;this.nodeType==b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex==b[0].rowIndex?e=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex==b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex==b[0].parentNode.rowIndex&&(e=!0));return e}));return 0==R||0==e.length}function za(b,e,k){var r=!1;P(b)?0<a.ignoreColumn.length&&+ (-1!=c.inArray(k,a.ignoreColumn)||-1!=c.inArray(k-e,a.ignoreColumn)||Q.length>k&&"undefined"!=typeof Q[k]&&-1!=c.inArray(Q[k],a.ignoreColumn))&&(r=!0):r=!0;return r}function B(b,e,k,r,g){if("function"===typeof g){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(c(b),k));if(!1===h&&-1==c.inArray(k,a.ignoreRow)&&-1==c.inArray(k-r,a.ignoreRow)&&P(c(b))){var x=c(b).find(e),q=0;x.each(function(b){var e=c(this),a,h=parseInt(this.getAttribute("colspan")),r=parseInt(this.getAttribute("rowspan"));+ G.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&q>=b.s.c&&q<=b.e.c)for(a=0;a<=b.e.c-b.s.c;++a)g(null,k,q++)});if(!1===za(e,x.length,b)){if(r||h)h=h||1,G.push({s:{r:k,c:q},e:{r:k+(r||1)-1,c:q+h-1}});g(this,k,q++)}if(h)for(a=0;a<h-1;++a)g(null,k,q++)});G.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&q>=b.s.c&&q<=b.e.c)for(Y=0;Y<=b.e.c-b.s.c;++Y)g(null,k,q++)})}}}function la(b,e){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());+ if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var k=b.output("blob");saveAs(k,a.fileName+".pdf")}catch(r){H(a.fileName+".pdf","data:application/pdf"+(e?"":";base64")+",",e?b.output("blob"):b.output())}}function ma(b,e,a){var k=0;"undefined"!==typeof a&&(k=a.colspan);if(0<=k){for(var g=b.width,c=b.textPos.x,x=e.table.columns.indexOf(e.column),q=1;q<k;q++)g+=e.table.columns[x+q].width;1<k&&("right"===b.styles.halign?+ c=b.textPos.x+g-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(g-b.width)/2));b.width=g;b.textPos.x=c;"undefined"!==typeof a&&1<a.rowspan&&(b.height*=a.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)a=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<a&&(b.textPos.y-=(2-1.15)/2*e.row.styles.fontSize*(a-2)/3);return!0}return!1}function na(b,a,k){"undefined"!=typeof k.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var e=oa(this.src);+ k.images[e]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&na(b,a,k)})}function Aa(b,a){function e(b){if(b.url){var e=new Image;g=++h;e.crossOrigin="Anonymous";e.onerror=e.onload=function(){if(e.complete&&(0===e.src.indexOf("data:image/")&&(e.width=b.width||e.width||0,e.height=b.height||e.height||0),e.width+e.height)){var k=document.createElement("canvas"),c=k.getContext("2d");k.width=e.width;k.height=e.height;c.drawImage(e,0,0);b.src=k.toDataURL("image/jpeg")}--h||a(g)};e.src=b.url}}+ var c,g=0,h=0;if("undefined"!=typeof b.images)for(c in b.images)b.images.hasOwnProperty(c)&&e(b.images[c]);(b=h)||(a(g),b=void 0);return b}function pa(b,e,k){e.each(function(){var e=c(this).children(),g=0;if(c(this).is("div")){var h=Z(M(this,"background-color"),[255,255,255]),x=Z(M(this,"border-top-color"),[0,0,0]),q=aa(this,"border-top-width",a.jspdf.unit),d=this.getBoundingClientRect(),f=this.offsetLeft*k.dw;g=this.offsetTop*k.dh;var l=d.width*k.dw;d=d.height*k.dh;k.doc.setDrawColor.apply(void 0,+ x);k.doc.setFillColor.apply(void 0,h);k.doc.setLineWidth(q);k.doc.rect(b.x+f,b.y+g,l,d,q?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof k.images&&(h=oa(this.src),h=k.images[h],"undefined"!=typeof h)){x=b.width/b.height;q=this.width/this.height;f=b.width;l=b.height;d=19.049976/25.4;q<=x?(l=Math.min(b.height,this.height),f=this.width*l/this.height):q>x&&(f=Math.min(b.width,this.width),l=this.height*f/this.width);f*=d;l*=d;l<b.height&&(g=(b.height-l)/2);try{k.doc.addImage(h.src,b.textPos.x,+ b.y+g,f,l)}catch(Ea){}b.textPos.x+=f}"undefined"!=typeof e&&0<e.length&&pa(b,e,k)})}function qa(b,e,a){if("function"===typeof a.onAutotableText)a.onAutotableText(a.doc,b,e);else{var k=b.textPos.x,g=b.textPos.y,h={halign:b.styles.halign,valign:b.styles.valign};if(e.length){for(e=e[0];e.previousSibling;)e=e.previousSibling;for(var x=!1,q=!1;e;){var d=e.innerText||e.textContent||"";d=(d.length&&" "==d[0]?" ":"")+c.trim(d)+(1<d.length&&" "==d[d.length-1]?" ":"");c(e).is("br")&&(k=b.textPos.x,g+=a.doc.internal.getFontSize());+ c(e).is("b")?x=!0:c(e).is("i")&&(q=!0);(x||q)&&a.doc.setFontType(x&&q?"bolditalic":x?"bold":"italic");var f=a.doc.getStringUnitWidth(d)*a.doc.internal.getFontSize();if(f){if("linebreak"===b.styles.overflow&&k>b.textPos.x&&k+f>b.textPos.x+b.width){if(0<=".,!%*;:=-".indexOf(d.charAt(0))){var l=d.charAt(0);f=a.doc.getStringUnitWidth(l)*a.doc.internal.getFontSize();k+f<=b.textPos.x+b.width&&(a.doc.autoTableText(l,k,g,h),d=d.substring(1,d.length));f=a.doc.getStringUnitWidth(d)*a.doc.internal.getFontSize()}k=+ b.textPos.x;g+=a.doc.internal.getFontSize()}for(;d.length&&k+f>b.textPos.x+b.width;)d=d.substring(0,d.length-1),f=a.doc.getStringUnitWidth(d)*a.doc.internal.getFontSize();a.doc.autoTableText(d,k,g,h);k+=f}if(x||q)c(e).is("b")?x=!1:c(e).is("i")&&(q=!1),a.doc.setFontType(x||q?x?"bold":"italic":"normal");e=e.nextSibling}b.textPos.x=k;b.textPos.y=g}else a.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}}function ba(b,a,c){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),+ "g"),c)}function ea(b){b=ba(b||"0",a.numbers.html.thousandsSeparator,"");b=ba(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ba(b){-1<b.indexOf("%")?(b=ea(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function z(b,e,k){var r="";if(null!==b){var g=c(b);if(g[0].hasAttribute("data-tableexport-value"))var h=(h=g.data("tableexport-value"))?h+"":"";else if(h=g.html(),"function"===typeof a.onCellHtmlData)h=a.onCellHtmlData(g,e,k,h);else if(""!=h){var d=+ c.parseHTML(h),f=0,l=0;h="";c.each(d,function(){if(c(this).is("input"))h+=g.find("input").eq(f++).val();else if(c(this).is("select"))h+=g.find("select option:selected").eq(l++).text();else if("undefined"===typeof c(this).html())h+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl")&&0===c(b).parents(".detail-view").length)h+=c(this).html()})}if(!0===a.htmlContent)r=c.trim(h);else if(h&&""!=h)if(""!=c(b).data("tableexport-cellformat")){var n=h.replace(/\n/g,+ "\u2028").replace(/<br\s*[\/]?>/gi,"\u2060"),m=c("<div/>").html(n).contents();d=!1;n="";c.each(m.text().split("\u2028"),function(b,a){0<b&&(n+=" ");n+=c.trim(a)});c.each(n.split("\u2060"),function(b,a){0<b&&(r+="\n");r+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||"excel"===a.type&&"xmlss"===a.excelFileFormat||!1===a.numbers.output)d=ea(r),!1!==d&&(r=Number(d));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(d=+ ea(r),!1!==d){m=(""+d.substr(0>d?1:0)).split(".");1==m.length&&(m[1]="");var p=3<m[0].length?m[0].length%3:0;r=(0>d?"-":"")+(a.numbers.output.thousandsSeparator?(p?m[0].substr(0,p)+a.numbers.output.thousandsSeparator:"")+m[0].substr(p).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):m[0])+(m[1].length?a.numbers.output.decimalMark+m[1]:"")}}else r=h;!0===a.escape&&(r=escape(r));"function"===typeof a.onCellData&&(r=a.onCellData(g,e,k,r))}return r}function Ca(b,a,c){return a+"-"+c.toLowerCase()}+ function Z(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&(a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function ra(b){var a=M(b,"text-align"),k=M(b,"font-weight"),r=M(b,"font-style"),g="";"start"==a&&(a="rtl"==M(b,"direction")?"right":"left");700<=k&&(g="bold");"italic"==r&&(g+=r);""===g&&(g="normal");a={style:{align:a,bcolor:Z(M(b,"background-color"),[255,255,255]),color:Z(M(b,"color"),[0,0,0]),fstyle:g},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))||+ 0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function M(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,Ca),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(k){}return""}function aa(b,a,c){a=M(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var e=document.createElement("div");e.style.overflow="hidden";e.style.visibility="hidden";b.appendChild(e);e.style.width=100+c;c=100/+ e.offsetWidth;b.removeChild(e);return a*c}return 0}function fa(){if(!(this instanceof fa))return new fa;this.SheetNames=[];this.Sheets={}}function sa(b){for(var a=new ArrayBuffer(b.length),c=new Uint8Array(a),d=0;d!=b.length;++d)c[d]=b.charCodeAt(d)&255;return a}function Da(b){for(var a={},c={s:{c:1E7,r:1E7},e:{c:0,r:0}},d=0;d!=b.length;++d)for(var g=0;g!=b[d].length;++g){c.s.r>d&&(c.s.r=d);c.s.c>g&&(c.s.c=g);c.e.r<d&&(c.e.r=d);c.e.c<g&&(c.e.c=g);var h={v:b[d][g]};if(null!==h.v){var f=XLSX.utils.encode_cell({c:g,+ r:d});if("number"===typeof h.v)h.t="n";else if("boolean"===typeof h.v)h.t="b";else if(h.v instanceof Date){h.t="n";h.z=XLSX.SSF._table[14];var q=h;var l=(Date.parse(h.v)-new Date(Date.UTC(1899,11,30)))/864E5;q.v=l}else h.t="s";a[f]=h}}1E7>c.s.c&&(a["!ref"]=XLSX.utils.encode_range(c));return a}function oa(b){var a=0,c;if(0===b.length)return a;var d=0;for(c=b.length;d<c;d++){var g=b.charCodeAt(d);a=(a<<5)-a+g;a|=0}return a}function H(b,a,c){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([c]),+ b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(a=document.createElement("iframe"))document.body.appendChild(a),a.setAttribute("style","display:none"),a.contentDocument.open("txt/html","replace"),a.contentDocument.write(c),a.contentDocument.close(),a.focus(),a.contentDocument.execCommand("SaveAs",!0,b),document.body.removeChild(a)}else{var g=document.createElement("a");if(g){var h=null;g.style.display="none";!1!==b?g.download=b:g.target="_blank";"object"==typeof c?(window.URL=+ window.URL||window.webkitURL,h=window.URL.createObjectURL(c),g.href=h):0<=a.toLowerCase().indexOf("base64,")?g.href=a+L(c):g.href=a+encodeURIComponent(c);document.body.appendChild(g);if(document.createEvent)null===ca&&(ca=document.createEvent("MouseEvents")),ca.initEvent("click",!0,!1),g.dispatchEvent(ca);else if(document.createEventObject)g.fireEvent("onclick");else if("function"==typeof g.onclick)g.onclick();setTimeout(function(){h&&window.URL.revokeObjectURL(h);document.body.removeChild(g)},100)}}}+ function L(a){var b,c="",d=0;if("string"===typeof a){a=a.replace(/\x0d\x0a/g,"\n");var g="";for(b=0;b<a.length;b++){var h=a.charCodeAt(b);128>h?g+=String.fromCharCode(h):(127<h&&2048>h?g+=String.fromCharCode(h>>6|192):(g+=String.fromCharCode(h>>12|224),g+=String.fromCharCode(h>>6&63|128)),g+=String.fromCharCode(h&63|128))}a=g}for(;d<a.length;){var f=a.charCodeAt(d++);g=a.charCodeAt(d++);b=a.charCodeAt(d++);h=f>>2;f=(f&3)<<4|g>>4;var q=(g&15)<<2|b>>6;var l=b&63;isNaN(g)?q=l=64:isNaN(b)&&(l=64);c=c++ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)}return c}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelFileFormat:"xlshtml",excelRTL:!1,excelstyles:[],exportHiddenCells:!1,fileName:"tableExport",+ htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,+ onAutotableText:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,onIgnoreRow:null,onMsoNumberFormat:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv",worksheetName:""},v=this,ca=null,p=[],t=[],l=0,m="",Q=[],G=[],+ K=[],R=!1;c.extend(!0,a,f);Q=O(v);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var I="",U=0;G=[];l=0;var ha=function(b,e,k){b.each(function(){m="";B(this,e,l,k+b.length,function(b,c,e){var g=m,h="";if(null!==b)if(b=z(b,c,e),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&&b.toLocaleString(),h=ba(c,"\t"," ");else if(b instanceof Date)h=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(h=ba(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=h.indexOf(a.csvSeparator)||/[\r\n ]/g.test(h))h=+ a.csvEnclosure+h+a.csvEnclosure;m=g+(h+("tsv"==a.type?"\t":a.csvSeparator))});m=c.trim(m).substring(0,m.length-1);0<m.length&&(0<I.length&&(I+="\n"),I+=m);l++});return b.length};U+=ha(c(v).find("thead").first().find(a.theadSelector),"th,td",U);C(c(v),"tbody").each(function(){U+=ha(D(c(this),a.tbodySelector),"td,th",U)});a.tfootSelector.length&&ha(c(v).find("tfoot").first().find(a.tfootSelector),"td,th",U);I+="\n";!0===a.consoleLog&&console.log(I);if("string"===a.outputMode)return I;if("base64"===+ a.outputMode)return L(I);if("window"===a.outputMode){H(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",I);return}try{var A=new Blob([I],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(A,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){H(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),I)}}else if("sql"==a.type){l=0;G=[];var w="INSERT INTO `"+a.tableName+"` (";p=c(v).find("thead").first().find(a.theadSelector);+ p.each(function(){B(this,"th,td",l,p.length,function(a,c,k){w+="'"+z(a,c,k)+"',"});l++;w=c.trim(w);w=c.trim(w).substring(0,w.length-1)});w+=") VALUES ";t=u(c(v));c(t).each(function(){m="";B(this,"td,th",l,p.length+t.length,function(a,c,k){m+="'"+z(a,c,k)+"',"});3<m.length&&(w+="("+m,w=c.trim(w).substring(0,w.length-1),w+="),");l++});w=c.trim(w).substring(0,w.length-1);w+=";";!0===a.consoleLog&&console.log(w);if("string"===a.outputMode)return w;if("base64"===a.outputMode)return L(w);try{A=new Blob([w],+ {type:"text/plain;charset=utf-8"}),saveAs(A,a.fileName+".sql")}catch(b){H(a.fileName+".sql","data:application/sql;charset=utf-8,",w)}}else if("json"==a.type){var S=[];G=[];p=c(v).find("thead").first().find(a.theadSelector);p.each(function(){var a=[];B(this,"th,td",l,p.length,function(b,c,d){a.push(z(b,c,d))});S.push(a)});var ia=[];t=u(c(v));c(t).each(function(){var a={},e=0;B(this,"td,th",l,p.length+t.length,function(b,c,g){S.length?a[S[S.length-1][e]]=z(b,c,g):a[e]=z(b,c,g);e++});!1===c.isEmptyObject(a)&&+ ia.push(a);l++});f="";f="head"==a.jsonScope?JSON.stringify(S):"data"==a.jsonScope?JSON.stringify(ia):JSON.stringify({header:S,data:ia});!0===a.consoleLog&&console.log(f);if("string"===a.outputMode)return f;if("base64"===a.outputMode)return L(f);try{A=new Blob([f],{type:"application/json;charset=utf-8"}),saveAs(A,a.fileName+".json")}catch(b){H(a.fileName+".json","data:application/json;charset=utf-8;base64,",f)}}else if("xml"===a.type){l=0;G=[];var J='<?xml version="1.0" encoding="utf-8"?>';J+="<tabledata><fields>";+ p=c(v).find("thead").first().find(a.theadSelector);p.each(function(){B(this,"th,td",l,p.length,function(a,c,d){J+="<field>"+z(a,c,d)+"</field>"});l++});J+="</fields><data>";var ta=1;t=u(c(v));c(t).each(function(){var a=1;m="";B(this,"td,th",l,p.length+t.length,function(b,c,d){m+="<column-"+a+">"+z(b,c,d)+"</column-"+a+">";a++});0<m.length&&"<column-1></column-1>"!=m&&(J+='<row id="'+ta+'">'+m+"</row>",ta++);l++});J+="</data></tabledata>";!0===a.consoleLog&&console.log(J);if("string"===a.outputMode)return J;+ if("base64"===a.outputMode)return L(J);try{A=new Blob([J],{type:"application/xml;charset=utf-8"}),saveAs(A,a.fileName+".xml")}catch(b){H(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",J)}}else if("excel"===a.type&&"xmlss"===a.excelFileFormat){var ja=[],F=[];c(v).filter(function(){return P(c(this))}).each(function(){function b(a,b,e){var g=[];c(a).each(function(){var b=0,h=0;m="";B(this,"td,th",l,e+a.length,function(a,e,d){if(null!==a){var k="";e=z(a,e,d);d="String";if(!1!==jQuery.isNumeric(e))d=+ "Number";else{var f=Ba(e);!1!==f&&(e=f,d="Number",k+=' ss:StyleID="pct1"')}"Number"!==d&&(e=e.replace(/\n/g,"<br>"));f=parseInt(a.getAttribute("colspan"));a=parseInt(a.getAttribute("rowspan"));g.forEach(function(a){if(l>=a.s.r&&l<=a.e.r&&h>=a.s.c&&h<=a.e.c)for(var c=0;c<=a.e.c-a.s.c;++c)h++,b++});if(a||f)a=a||1,f=f||1,g.push({s:{r:l,c:h},e:{r:l+a-1,c:h+f-1}});1<f&&(k+=' ss:MergeAcross="'+(f-1)+'"',h+=f-1);1<a&&(k+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(k+=' ss:Index="'+(h+1)+'"',b=0);+ m+="<Cell"+k+'><Data ss:Type="'+d+'">'+c("<div />").text(e).html()+"</Data></Cell>\r";h++}});0<m.length&&(E+='<Row ss:AutoFitHeight="0">\r'+m+"</Row>\r");l++});return a.length}var e=c(this),d="";"string"===typeof a.worksheetName&&a.worksheetName.length?d=a.worksheetName+" "+(F.length+1):"undefined"!==typeof a.worksheetName[F.length]&&(d=a.worksheetName[F.length]);d.length||(d=e.find("caption").text()||"");d.length||(d="Table "+(F.length+1));d=d.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31).trim();+ F.push(c("<div />").text(d).html());!1===a.exportHiddenCells&&(K=e.find("tr, th, td").filter(":hidden"),R=0<K.length);l=0;Q=O(this);E="<Table>\r";d=0;d+=b(e.find("thead").first().find(a.theadSelector),"th,td",d);b(u(e),"td,th",d);E+="</Table>\r";ja.push(E);!0===a.consoleLog&&console.log(E)});f={};for(var y={},n,N,T=0,Y=F.length;T<Y;T++)n=F[T],N=f[n],N=f[n]=null==N?1:N+1,2==N&&(F[y[n]]=F[y[n]].substring(0,29)+"-1"),1<f[n]?F[T]=F[T].substring(0,29)+"-"+f[n]:y[n]=T;f='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'++ (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';+ for(y=0;y<ja.length;y++)f+='<Worksheet ss:Name="'+F[y]+'" ss:RightToLeft="'+(a.excelRTL?"1":"0")+'">\r'+ja[y],f=a.excelRTL?f+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':f+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',f+="</Worksheet>\r";f+="</Workbook>\r";!0===a.consoleLog&&console.log(f);if("string"===a.outputMode)return f;if("base64"===a.outputMode)return L(f);try{A=new Blob([f],{type:"application/xml;charset=utf-8"}),+ saveAs(A,a.fileName+".xml")}catch(b){H(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",f)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){f="excel"==a.type||"xls"==a.type?"excel":"word";y="excel"==f?"xls":"doc";n='xmlns:x="urn:schemas-microsoft-com:office:'+f+'"';var E="",V="";c(v).filter(function(){return P(c(this))}).each(function(){var b=c(this);""===V&&(V=a.worksheetName||b.find("caption").text()||"Table",V=V.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31).trim());+ !1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),R=0<K.length);l=0;G=[];Q=O(this);E+="<table><thead>";p=b.find("thead").first().find(a.theadSelector);p.each(function(){m="";B(this,"th,td",l,p.length,function(b,d,f){if(null!==b){var e="";m+="<th";for(var h in a.excelstyles)if(a.excelstyles.hasOwnProperty(h)){var k=c(b).css(a.excelstyles[h]);""!==k&&"0px none rgb(0, 0, 0)"!=k&&"rgba(0, 0, 0, 0)"!=k&&(e+=""===e?'style="':";",e+=a.excelstyles[h]+":"+k)}""!==e&&(m+=" "+e+'"');c(b).is("[colspan]")&&+ (m+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(m+=' rowspan="'+c(b).attr("rowspan")+'"');m+=">"+z(b,d,f)+"</th>"}});0<m.length&&(E+="<tr>"+m+"</tr>");l++});E+="</thead><tbody>";t=u(b);c(t).each(function(){var b=c(this);m="";B(this,"td,th",l,p.length+t.length,function(e,d,g){if(null!==e){var h=z(e,d,g),k="",f=c(e).data("tableexport-msonumberformat");"undefined"==typeof f&&"function"===typeof a.onMsoNumberFormat&&(f=a.onMsoNumberFormat(e,d,g));"undefined"!=typeof f&&""!==f&&(k="style=\"mso-number-format:'"++ f+"'");for(var l in a.excelstyles)a.excelstyles.hasOwnProperty(l)&&(f=c(e).css(a.excelstyles[l]),""===f&&(f=b.css(a.excelstyles[l])),""!==f&&"0px none rgb(0, 0, 0)"!=f&&"rgba(0, 0, 0, 0)"!=f&&(k+=""===k?'style="':";",k+=a.excelstyles[l]+":"+f));m+="<td";""!==k&&(m+=" "+k+'"');c(e).is("[colspan]")&&(m+=' colspan="'+c(e).attr("colspan")+'"');c(e).is("[rowspan]")&&(m+=' rowspan="'+c(e).attr("rowspan")+'"');"string"===typeof h&&""!=h&&(h=h.replace(/\n/g,"<br>"));m+=">"+h+"</td>"}});0<m.length&&(E+="<tr>"++ m+"</tr>");l++});a.displayTableName&&(E+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+z(c("<p>"+a.tableName+"</p>"))+"</td></tr>");E+="</tbody></table>";!0===a.consoleLog&&console.log(E)});n='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+n+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+f+'; charset=UTF-8">')+"<head>";"excel"===f&&(n+="\x3c!--[if gte mso 9]>",n+="<xml>",n+="<x:ExcelWorkbook>",n+="<x:ExcelWorksheets>",n+="<x:ExcelWorksheet>",+ n+="<x:Name>",n+=V,n+="</x:Name>",n+="<x:WorksheetOptions>",n+="<x:DisplayGridlines/>",a.excelRTL&&(n+="<x:DisplayRightToLeft/>"),n+="</x:WorksheetOptions>",n+="</x:ExcelWorksheet>",n+="</x:ExcelWorksheets>",n+="</x:ExcelWorkbook>",n+="</xml>",n+="<![endif]--\x3e");n+="<style>br {mso-data-placement:same-cell;}</style>";n+="</head>";n+="<body>";n+=E;n+="</body>";n+="</html>";!0===a.consoleLog&&console.log(n);if("string"===a.outputMode)return n;if("base64"===a.outputMode)return L(n);try{A=new Blob([n],+ {type:"application/vnd.ms-"+a.type}),saveAs(A,a.fileName+"."+y)}catch(b){H(a.fileName+"."+y,"data:application/vnd.ms-"+f+";base64,",n)}}else if("xlsx"==a.type){var ua=[],ka=[];l=0;t=c(v).find("thead").first().find(a.theadSelector);t.push.apply(t,u(c(v)));c(t).each(function(){var b=[];B(this,"th,td",l,t.length,function(c,d,f){if("undefined"!==typeof c&&null!==c){f=z(c,d,f);d=parseInt(c.getAttribute("colspan"));c=parseInt(c.getAttribute("rowspan"));ka.forEach(function(a){if(l>=a.s.r&&l<=a.e.r&&b.length>=+ a.s.c&&b.length<=a.e.c)for(var c=0;c<=a.e.c-a.s.c;++c)b.push(null)});if(c||d)d=d||1,ka.push({s:{r:l,c:b.length},e:{r:l+(c||1)-1,c:b.length+d-1}});"function"!==typeof a.onCellData&&""!==f&&f==+f&&(f=+f);b.push(""!==f?f:null);if(d)for(c=0;c<d-1;++c)b.push(null)}});ua.push(b);l++});f=new fa;y=Da(ua);y["!merges"]=ka;f.SheetNames.push(a.worksheetName);f.Sheets[a.worksheetName]=y;f=XLSX.write(f,{bookType:a.type,bookSST:!1,type:"binary"});try{A=new Blob([sa(f)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),+ saveAs(A,a.fileName+"."+a.type)}catch(b){H(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",sa(f))}}else if("png"==a.type)html2canvas(c(v)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length),f=new Uint8Array(d),g=0;g<c.length;g++)f[g]=c.charCodeAt(g);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);if("window"===a.outputMode)window.open(b);+ else try{A=new Blob([d],{type:"image/png"}),saveAs(A,a.fileName+".png")}catch(h){H(a.fileName+".png","data:image/png,",A)}});else if("pdf"==a.type)if(!0===a.pdfmake.enabled){f=[];var va=[];l=0;G=[];y=function(a,d,f){var b=0;c(a).each(function(){var a=[];B(this,d,l,f,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),g=parseInt(b.getAttribute("rowspan"));b=z(b,c,d)||" ";1<e||1<g?a.push({colSpan:e||1,rowSpan:g||1,text:b}):a.push(b)}else a.push(" ")});a.length&&+ va.push(a);b<a.length&&(b=a.length);l++});return b};p=c(this).find("thead").first().find(a.theadSelector);n=y(p,"th,td",p.length);for(N=f.length;N<n;N++)f.push("*");t=u(c(this));y(t,"th,td",p.length+t.length);f={content:[{table:{headerRows:p.length,widths:f,body:va}}]};c.extend(!0,f,a.pdfmake.docDefinition);pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};c.extend(!0,pdfMake.fonts,a.pdfmake.fonts);pdfMake.createPdf(f).getBuffer(function(b){try{var c=+ new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(k){H(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){f={dim:{w:aa(c(v).first().get(0),"width","mm"),h:aa(c(v).first().get(0),"height","mm")},pagesplit:!1};var wa=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);wa.addHTML(c(v).first(),a.jspdf.margins.left,a.jspdf.margins.top,f,function(){la(wa,!1)})}else{var d=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&+ "bestfit"===a.jspdf.format.toLowerCase()){var W={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},da="",X="",xa=0;c(v).each(function(){if(P(c(this))){var a=aa(c(this).get(0),"width","pt");if(a>xa){a>W.a0[0]&&(da="a0",X="l");for(var d in W)W.hasOwnProperty(d)&&W[d][1]>a&&(da=d,X="l",W[d][0]>a&&(X="p"));xa=a}}});a.jspdf.format=""===da?"a4":da;a.jspdf.orientation=""===X?"w":X}if(null==d.doc&&(d.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),+ "function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(d.doc);!0===d.outputImages&&(d.images={});"undefined"!=typeof d.images&&(c(v).filter(function(){return P(c(this))}).each(function(){var b=0;G=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),R=0<K.length);p=c(this).find("thead").find(a.theadSelector);t=u(c(this));c(t).each(function(){B(this,"td,th",p.length+b,p.length+t.length,function(a){if("undefined"!==typeof a&&null!==a){var b=c(a).children();"undefined"!=+ typeof b&&0<b.length&&na(a,b,d)}});b++})}),p=[],t=[]);Aa(d,function(){c(v).filter(function(){return P(c(this))}).each(function(){var b;l=0;G=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),R=0<K.length);Q=O(this);d.columns=[];d.rows=[];d.rowoptions={};if("function"===typeof d.onTable&&!1===d.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var e=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=d;e.margin={};c.extend(!0,e.margin,a.jspdf.margins);+ e.tableExport=d;"function"!==typeof e.beforePageContent&&(e.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=(2-1.15)/2*b.styles.fontSize)})});"function"!==typeof e.createdHeaderCell&&(e.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof d.columns[b.column.dataKey]){var g=d.columns[b.column.dataKey];if("undefined"!=typeof g.rect){a.contentWidth=+ g.rect.width;if("undefined"==typeof d.heightRatio||0===d.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;d.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*d.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}"undefined"!=typeof g.style&&!0!==g.style.hidden&&(a.styles.halign=g.style.align,"inherit"===e.styles.fillColor&&(a.styles.fillColor=g.style.bcolor),+ "inherit"===e.styles.textColor&&(a.styles.textColor=g.style.color),"inherit"===e.styles.fontStyle&&(a.styles.fontStyle=g.style.fstyle))}});"function"!==typeof e.createdCell&&(e.createdCell=function(a,b){b=d.rowoptions[b.row.index+":"+b.column.dataKey];"undefined"!=typeof b&&"undefined"!=typeof b.style&&!0!==b.style.hidden&&(a.styles.halign=b.style.align,"inherit"===e.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===e.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===+ e.styles.fontStyle&&(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof e.drawHeaderCell&&(e.drawHeaderCell=function(a,b){var c=d.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?ma(a,b,c):!1});"function"!==typeof e.drawCell&&(e.drawCell=function(a,b){var c=d.rowoptions[b.row.index+":"+b.column.dataKey];if(ma(a,b,c))if(d.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!=typeof c&&"undefined"!=typeof c.kids&&0<c.kids.length){b=+ a.height/c.rect.height;if(b>d.dh||"undefined"==typeof d.dh)d.dh=b;d.dw=a.width/c.rect.width;b=a.textPos.y;pa(a,c.kids,d);a.textPos.y=b;qa(a,c.kids,d)}else qa(a,{},d);return!1});d.headerrows=[];p=c(this).find("thead").find(a.theadSelector);p.each(function(){b=0;d.headerrows[l]=[];B(this,"th,td",l,p.length,function(a,c,e){var f=ra(a);f.title=z(a,c,e);f.key=b++;f.rowIndex=l;d.headerrows[l].push(f)});l++});if(0<l)for(var f=l-1;0<=f;)c.each(d.headerrows[f],function(){var a=this;0<f&&null===this.rect&&+ (a=d.headerrows[f-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&d.columns.push(a)}),f=0<d.columns.length?-1:f-1;var m=0;t=[];t=u(c(this));c(t).each(function(){var a=[];b=0;B(this,"td,th",l,p.length+t.length,function(e,f,g){if("undefined"===typeof d.columns[b]){var h={title:"",key:b,style:{hidden:!0}};d.columns.push(h)}"undefined"!==typeof e&&null!==e?(h=ra(e),h.kids=c(e).children()):(h=c.extend(!0,{},d.rowoptions[m+":"+(b-1)]),h.colspan=-1);d.rowoptions[m++ ":"+b++]=h;a.push(z(e,f,g))});a.length&&(d.rows.push(a),m++);l++});if("function"===typeof d.onBeforeAutotable)d.onBeforeAutotable(c(this),d.columns,d.rows,e);d.doc.autoTable(d.columns,d.rows,e);if("function"===typeof d.onAfterAutotable)d.onAfterAutotable(c(this),e);a.jspdf.autotable.startY=d.doc.autoTableEndPosY()+e.margin.top});la(d.doc,"undefined"!=typeof d.images&&!1===jQuery.isEmptyObject(d.images));"undefined"!=typeof d.headerrows&&(d.headerrows.length=0);"undefined"!=typeof d.columns&&(d.columns.length=+ 0);"undefined"!=typeof d.rows&&(d.rows.length=0);delete d.doc;d.doc=null})}return this}})})(jQuery);diff --git a/public/js/extensions/toolbar/bootstrap-table-toolbar.js b/public/js/extensions/toolbar/bootstrap-table-toolbar.jsindex fd4e585933..e54bf936ce 100755--- a/public/js/extensions/toolbar/bootstrap-table-toolbar.js+++ b/public/js/extensions/toolbar/bootstrap-table-toolbar.js@@ -108,7 +108,7 @@$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);var BootstrapTable = $.fn.bootstrapTable.Constructor,- _initToolbar = BootstrapTable.prototype.initToolbar,+ _initToolbar = BootstrapTable.prototype.initToolbar,_load = BootstrapTable.prototype.load,_initSearch = BootstrapTable.prototype.initSearch;@@ -131,7 +131,7 @@html = [];html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));- html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));+ html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" aria-label="advanced search" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))html.push('</button></div>');@@ -139,8 +139,8 @@that.$toolbar.find('button[name="advancedSearch"]').off('click').on('click', function() {- showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);- });+ showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);+ });};BootstrapTable.prototype.load = function(data) {@@ -181,8 +181,8 @@[value, item, i], value);if (!($.inArray(key, that.header.fields) !== -1 &&- (typeof value === 'string' || typeof value === 'number') &&- (value + '').toLowerCase().indexOf(fval) !== -1)) {+ (typeof value === 'string' || typeof value === 'number') &&+ (value + '').toLowerCase().indexOf(fval) !== -1)) {return false;}}diff --git a/public/js/extensions/toolbar/bootstrap-table-toolbar.min.js b/public/js/extensions/toolbar/bootstrap-table-toolbar.min.jsindex f5a6490e9e..5626a8419d 100755--- a/public/js/extensions/toolbar/bootstrap-table-toolbar.min.js+++ b/public/js/extensions/toolbar/bootstrap-table-toolbar.min.js@@ -1,7 +1,7 @@/*-* bootstrap-table - v1.9.1 - 2015-10-25+* bootstrap-table - v1.11.1 - 2017-02-22* https://github.com/wenzhixin/bootstrap-table-* Copyright (c) 2015 zhixin wen+* Copyright (c) 2017 zhixin wen* Licensed MIT License*/-!function(a){"use strict";var b=!1,c=a.fn.bootstrapTable.utils.sprintf,d=function(b,d,f,g){if(a("#avdSearchModal_"+g.options.idTable).hasClass("modal"))a("#avdSearchModal_"+g.options.idTable).modal();else{var h=c('<div id="avdSearchModal%s" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">',"_"+g.options.idTable);h+='<div class="modal-dialog modal-xs">',h+=' <div class="modal-content">',h+=' <div class="modal-header">',h+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true" >×</button>',h+=c(' <h4 class="modal-title">%s</h4>',d),h+=" </div>",h+=' <div class="modal-body modal-body-custom">',h+=c(' <div class="container-fluid" id="avdSearchModalContent%s" style="padding-right: 0px;padding-left: 0px;" >',"_"+g.options.idTable),h+=" </div>",h+=" </div>",h+=" </div>",h+=" </div>",h+="</div>",a("body").append(a(h));var i=e(b,f,g),j=0;a("#avdSearchModalContent_"+g.options.idTable).append(i.join("")),a("#"+g.options.idForm).off("keyup blur","input").on("keyup blur","input",function(a){clearTimeout(j),j=setTimeout(function(){g.onColumnAdvancedSearch(a)},g.options.searchTimeOut)}),a("#btnCloseAvd_"+g.options.idTable).click(function(){a("#avdSearchModal_"+g.options.idTable).modal("hide")}),a("#avdSearchModal_"+g.options.idTable).modal()}},e=function(a,b,d){var e=[];e.push(c('<form class="form-horizontal" id="%s" action="%s" >',d.options.idForm,d.options.actionForm));for(var f in a){var g=a[f];!g.checkbox&&g.visible&&g.searchable&&(e.push('<div class="form-group">'),e.push(c('<label class="col-sm-4 control-label">%s</label>',g.title)),e.push('<div class="col-sm-6">'),e.push(c('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">',g.field,g.title,g.field)),e.push("</div>"),e.push("</div>"))}return e.push('<div class="form-group">'),e.push('<div class="col-sm-offset-9 col-sm-3">'),e.push(c('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>',"_"+d.options.idTable,b)),e.push("</div>"),e.push("</div>"),e.push("</form>"),e};a.extend(a.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:"advancedSearch",actionForm:"",idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),a.extend(a.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:"glyphicon-chevron-down"}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":"onColumnAdvancedSearch"}),a.extend(a.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var f=a.fn.bootstrapTable.Constructor,g=f.prototype.initToolbar,h=f.prototype.load,i=f.prototype.initSearch;f.prototype.initToolbar=function(){if(g.apply(this,Array.prototype.slice.apply(arguments)),this.options.search&&this.options.advancedSearch&&this.options.idTable){var a=this,b=[];b.push(c('<div class="columns columns-%s btn-group pull-%s" role="group">',this.options.buttonsAlign,this.options.buttonsAlign)),b.push(c('<button class="btn btn-default%s" type="button" name="advancedSearch" title="%s">',void 0===a.options.iconSize?"":" btn-"+a.options.iconSize,a.options.formatAdvancedSearch())),b.push(c('<i class="%s %s"></i>',a.options.iconsPrefix,a.options.icons.advancedSearchIcon)),b.push("</button></div>"),a.$toolbar.prepend(b.join("")),a.$toolbar.find('button[name="advancedSearch"]').off("click").on("click",function(){d(a.columns,a.options.formatAdvancedSearch(),a.options.formatAdvancedCloseButton(),a)})}},f.prototype.load=function(){if(h.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch&&"undefined"!=typeof this.options.idTable&&!b){var c=parseInt(a(".bootstrap-table").height());c+=10,a("#"+this.options.idTable).bootstrapTable("resetView",{height:c}),b=!0}},f.prototype.initSearch=function(){if(i.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch){var b=this,c=a.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=c?a.grep(this.data,function(d,e){for(var f in c){var g=c[f].toLowerCase(),h=d[f];if(h=a.fn.bootstrapTable.utils.calculateObjectValue(b.header,b.header.formatters[a.inArray(f,b.header.fields)],[h,d,e],h),-1===a.inArray(f,b.header.fields)||"string"!=typeof h&&"number"!=typeof h||-1===(h+"").toLowerCase().indexOf(g))return!1}return!0}):this.data}},f.prototype.onColumnAdvancedSearch=function(b){var c=a.trim(a(b.currentTarget).val()),d=a(b.currentTarget)[0].id;a.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),c?this.filterColumnsPartial[d]=c:delete this.filterColumnsPartial[d],this.options.pageNumber=1,this.onSearch(b),this.updatePagination(),this.trigger("column-advanced-search",d,c)}}(jQuery);\ No newline at end of file+!function(a){"use strict";var b=!1,c=a.fn.bootstrapTable.utils.sprintf,d=function(b,d,f,g){if(a("#avdSearchModal_"+g.options.idTable).hasClass("modal"))a("#avdSearchModal_"+g.options.idTable).modal();else{var h=c('<div id="avdSearchModal%s" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">',"_"+g.options.idTable);h+='<div class="modal-dialog modal-xs">',h+=' <div class="modal-content">',h+=' <div class="modal-header">',h+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true" >×</button>',h+=c(' <h4 class="modal-title">%s</h4>',d),h+=" </div>",h+=' <div class="modal-body modal-body-custom">',h+=c(' <div class="container-fluid" id="avdSearchModalContent%s" style="padding-right: 0px;padding-left: 0px;" >',"_"+g.options.idTable),h+=" </div>",h+=" </div>",h+=" </div>",h+=" </div>",h+="</div>",a("body").append(a(h));var i=e(b,f,g),j=0;a("#avdSearchModalContent_"+g.options.idTable).append(i.join("")),a("#"+g.options.idForm).off("keyup blur","input").on("keyup blur","input",function(a){clearTimeout(j),j=setTimeout(function(){g.onColumnAdvancedSearch(a)},g.options.searchTimeOut)}),a("#btnCloseAvd_"+g.options.idTable).click(function(){a("#avdSearchModal_"+g.options.idTable).modal("hide")}),a("#avdSearchModal_"+g.options.idTable).modal()}},e=function(a,b,d){var e=[];e.push(c('<form class="form-horizontal" id="%s" action="%s" >',d.options.idForm,d.options.actionForm));for(var f in a){var g=a[f];!g.checkbox&&g.visible&&g.searchable&&(e.push('<div class="form-group">'),e.push(c('<label class="col-sm-4 control-label">%s</label>',g.title)),e.push('<div class="col-sm-6">'),e.push(c('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">',g.field,g.title,g.field)),e.push("</div>"),e.push("</div>"))}return e.push('<div class="form-group">'),e.push('<div class="col-sm-offset-9 col-sm-3">'),e.push(c('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>',"_"+d.options.idTable,b)),e.push("</div>"),e.push("</div>"),e.push("</form>"),e};a.extend(a.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:"advancedSearch",actionForm:"",idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),a.extend(a.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:"glyphicon-chevron-down"}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":"onColumnAdvancedSearch"}),a.extend(a.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var f=a.fn.bootstrapTable.Constructor,g=f.prototype.initToolbar,h=f.prototype.load,i=f.prototype.initSearch;f.prototype.initToolbar=function(){if(g.apply(this,Array.prototype.slice.apply(arguments)),this.options.search&&this.options.advancedSearch&&this.options.idTable){var a=this,b=[];b.push(c('<div class="columns columns-%s btn-group pull-%s" role="group">',this.options.buttonsAlign,this.options.buttonsAlign)),b.push(c('<button class="btn btn-default%s" type="button" name="advancedSearch" aria-label="advanced search" title="%s">',void 0===a.options.iconSize?"":" btn-"+a.options.iconSize,a.options.formatAdvancedSearch())),b.push(c('<i class="%s %s"></i>',a.options.iconsPrefix,a.options.icons.advancedSearchIcon)),b.push("</button></div>"),a.$toolbar.prepend(b.join("")),a.$toolbar.find('button[name="advancedSearch"]').off("click").on("click",function(){d(a.columns,a.options.formatAdvancedSearch(),a.options.formatAdvancedCloseButton(),a)})}},f.prototype.load=function(){if(h.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch&&"undefined"!=typeof this.options.idTable&&!b){var c=parseInt(a(".bootstrap-table").height());c+=10,a("#"+this.options.idTable).bootstrapTable("resetView",{height:c}),b=!0}},f.prototype.initSearch=function(){if(i.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch){var b=this,c=a.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=c?a.grep(this.data,function(d,e){for(var f in c){var g=c[f].toLowerCase(),h=d[f];if(h=a.fn.bootstrapTable.utils.calculateObjectValue(b.header,b.header.formatters[a.inArray(f,b.header.fields)],[h,d,e],h),-1===a.inArray(f,b.header.fields)||"string"!=typeof h&&"number"!=typeof h||-1===(h+"").toLowerCase().indexOf(g))return!1}return!0}):this.data}},f.prototype.onColumnAdvancedSearch=function(b){var c=a.trim(a(b.currentTarget).val()),d=a(b.currentTarget)[0].id;a.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),c?this.filterColumnsPartial[d]=c:delete this.filterColumnsPartial[d],this.options.pageNumber=1,this.onSearch(b),this.updatePagination(),this.trigger("column-advanced-search",d,c)}}(jQuery);diff --git a/public/js/jspdf.min.js b/public/js/jspdf.min.jsindex 4ba3b3c17e..e842d43616 100644--- a/public/js/jspdf.min.js+++ b/public/js/jspdf.min.js@@ -1,17003 +1,164 @@-(function (global, factory) {- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :- typeof define === 'function' && define.amd ? define(factory) :- (global.jspdf = factory());-}(this, function () { 'use strict';-- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {- return typeof obj;- } : function (obj) {- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;- };-- /** @preserve- * jsPDF - PDF Document creation from JavaScript- * Version 1.3.2 Built on 2016-09-30T20:33:17.116Z- * CommitID 7d854cc77d- *- * Copyright (c) 2010-2014 James Hall <[email protected]>, https://github.com/MrRio/jsPDF- * 2010 Aaron Spike, https://github.com/acspike- * 2012 Willow Systems Corporation, willow-systems.com- * 2012 Pablo Hess, https://github.com/pablohess- * 2012 Florian Jenett, https://github.com/fjenett- * 2013 Warren Weckesser, https://github.com/warrenweckesser- * 2013 Youssef Beddad, https://github.com/lifof- * 2013 Lee Driscoll, https://github.com/lsdriscoll- * 2013 Stefan Slonevskiy, https://github.com/stefslon- * 2013 Jeremy Morel, https://github.com/jmorel- * 2013 Christoph Hartmann, https://github.com/chris-rock- * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria- * 2014 James Makes, https://github.com/dollaruw- * 2014 Diego Casorran, https://github.com/diegocr- * 2014 Steven Spungin, https://github.com/Flamenco- * 2014 Kenneth Glassey, https://github.com/Gavvers- *- * Licensed under the MIT License- *- * Contributor(s):- * siefkenj, ahwolf, rickygu, Midnith, saintclair, eaparango,- * kim3er, mfo, alnorth, Flamenco- */-- /**- * Creates new jsPDF document object instance.- *- * @class- * @param orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l")- * @param unit Measurement unit to be used when coordinates are specified.- * One of "pt" (points), "mm" (Default), "cm", "in"- * @param format One of 'pageFormats' as shown below, default: a4- * @returns {jsPDF}- * @name jsPDF- */- var jsPDF = function (global) {- 'use strict';-- var pdfVersion = '1.3',- pageFormats = { // Size in pt of various paper formats- 'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],- 'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],- 'a4': [595.28, 841.89], 'a5': [419.53, 595.28],- 'a6': [297.64, 419.53], 'a7': [209.76, 297.64],- 'a8': [147.40, 209.76], 'a9': [104.88, 147.40],- 'a10': [73.70, 104.88], 'b0': [2834.65, 4008.19],- 'b1': [2004.09, 2834.65], 'b2': [1417.32, 2004.09],- 'b3': [1000.63, 1417.32], 'b4': [708.66, 1000.63],- 'b5': [498.90, 708.66], 'b6': [354.33, 498.90],- 'b7': [249.45, 354.33], 'b8': [175.75, 249.45],- 'b9': [124.72, 175.75], 'b10': [87.87, 124.72],- 'c0': [2599.37, 3676.54], 'c1': [1836.85, 2599.37],- 'c2': [1298.27, 1836.85], 'c3': [918.43, 1298.27],- 'c4': [649.13, 918.43], 'c5': [459.21, 649.13],- 'c6': [323.15, 459.21], 'c7': [229.61, 323.15],- 'c8': [161.57, 229.61], 'c9': [113.39, 161.57],- 'c10': [79.37, 113.39], 'dl': [311.81, 623.62],- 'letter': [612, 792],- 'government-letter': [576, 756],- 'legal': [612, 1008],- 'junior-legal': [576, 360],- 'ledger': [1224, 792],- 'tabloid': [792, 1224],- 'credit-card': [153, 243]- };-- /**- * jsPDF's Internal PubSub Implementation.- * See mrrio.github.io/jsPDF/doc/symbols/PubSub.html- * Backward compatible rewritten on 2014 by- * Diego Casorran, https://github.com/diegocr- *- * @class- * @name PubSub- */- function PubSub(context) {- var topics = {};-- this.subscribe = function (topic, callback, once) {- if (typeof callback !== 'function') {- return false;- }-- if (!topics.hasOwnProperty(topic)) {- topics[topic] = {};- }-- var id = Math.random().toString(35);- topics[topic][id] = [callback, !!once];-- return id;- };-- this.unsubscribe = function (token) {- for (var topic in topics) {- if (topics[topic][token]) {- delete topics[topic][token];- return true;- }- }- return false;- };-- this.publish = function (topic) {- if (topics.hasOwnProperty(topic)) {- var args = Array.prototype.slice.call(arguments, 1),- idr = [];-- for (var id in topics[topic]) {- var sub = topics[topic][id];- try {- sub[0].apply(context, args);- } catch (ex) {- if (global.console) {- console.error('jsPDF PubSub Error', ex.message, ex);- }- }- if (sub[1]) idr.push(id);- }- if (idr.length) idr.forEach(this.unsubscribe);- }- };- }-- /**- * @constructor- * @private- */- function jsPDF(orientation, unit, format, compressPdf) {- var options = {};-- if ((typeof orientation === 'undefined' ? 'undefined' : _typeof(orientation)) === 'object') {- options = orientation;-- orientation = options.orientation;- unit = options.unit || unit;- format = options.format || format;- compressPdf = options.compress || options.compressPdf || compressPdf;- }-- // Default options- unit = unit || 'mm';- format = format || 'a4';- orientation = ('' + (orientation || 'P')).toLowerCase();-- var format_as_string = ('' + format).toLowerCase(),- compress = !!compressPdf && typeof Uint8Array === 'function',- textColor = options.textColor || '0 g',- drawColor = options.drawColor || '0 G',- activeFontSize = options.fontSize || 16,- lineHeightProportion = options.lineHeight || 1.15,- lineWidth = options.lineWidth || 0.200025,- // 2mm- objectNumber = 2,- // 'n' Current object number- outToPages = !1,- // switches where out() prints. outToPages true = push to pages obj. outToPages false = doc builder content- offsets = [],- // List of offsets. Activated and reset by buildDocument(). Pupulated by various calls buildDocument makes.- fonts = {},- // collection of font objects, where key is fontKey - a dynamically created label for a given font.- fontmap = {},- // mapping structure fontName > fontStyle > font key - performance layer. See addFont()- activeFontKey,- // will be string representing the KEY of the font as combination of fontName + fontStyle- k,- // Scale factor- tmp,- page = 0,- currentPage,- pages = [],- pagesContext = [],- // same index as pages and pagedim- pagedim = [],- content = [],- additionalObjects = [],- lineCapID = 0,- lineJoinID = 0,- content_length = 0,- pageWidth,- pageHeight,- pageMode,- zoomMode,- layoutMode,- documentProperties = {- 'title': '',- 'subject': '',- 'author': '',- 'keywords': '',- 'creator': ''- },- API = {},- events = new PubSub(API),--- /////////////////////- // Private functions- /////////////////////- f2 = function f2(number) {- return number.toFixed(2); // Ie, %.2f- },- f3 = function f3(number) {- return number.toFixed(3); // Ie, %.3f- },- padd2 = function padd2(number) {- return ('0' + parseInt(number)).slice(-2);- },- out = function out(string) {- if (outToPages) {- /* set by beginPage */- pages[currentPage].push(string);- } else {- // +1 for '\n' that will be used to join 'content'- content_length += string.length + 1;- content.push(string);- }- },- newObject = function newObject() {- // Begin a new object- objectNumber++;- offsets[objectNumber] = content_length;- out(objectNumber + ' 0 obj');- return objectNumber;- },-- // Does not output the object until after the pages have been output.- // Returns an object containing the objectId and content.- // All pages have been added so the object ID can be estimated to start right after.- // This does not modify the current objectNumber; It must be updated after the newObjects are output.- newAdditionalObject = function newAdditionalObject() {- var objId = pages.length * 2 + 1;- objId += additionalObjects.length;- var obj = { objId: objId, content: '' };- additionalObjects.push(obj);- return obj;- },-- // Does not output the object. The caller must call newObjectDeferredBegin(oid) before outputing any data- newObjectDeferred = function newObjectDeferred() {- objectNumber++;- offsets[objectNumber] = function () {- return content_length;- };- return objectNumber;- },- newObjectDeferredBegin = function newObjectDeferredBegin(oid) {- offsets[oid] = content_length;- },- putStream = function putStream(str) {- out('stream');- out(str);- out('endstream');- },- putPages = function putPages() {- var n,- p,- arr,- i,- deflater,- adler32,- adler32cs,- wPt,- hPt,- pageObjectNumbers = [];-- adler32cs = global.adler32cs || jsPDF.adler32cs;- if (compress && typeof adler32cs === 'undefined') {- compress = false;- }-- // outToPages = false as set in endDocument(). out() writes to content.-- for (n = 1; n <= page; n++) {- pageObjectNumbers.push(newObject());- wPt = (pageWidth = pagedim[n].width) * k;- hPt = (pageHeight = pagedim[n].height) * k;- out('<</Type /Page');- out('/Parent 1 0 R');- out('/Resources 2 0 R');- out('/MediaBox [0 0 ' + f2(wPt) + ' ' + f2(hPt) + ']');- // Added for annotation plugin- events.publish('putPage', { pageNumber: n, page: pages[n] });- out('/Contents ' + (objectNumber + 1) + ' 0 R');- out('>>');- out('endobj');-- // Page content- p = pages[n].join('\n');- newObject();- if (compress) {- arr = [];- i = p.length;- while (i--) {- arr[i] = p.charCodeAt(i);- }- adler32 = adler32cs.from(p);- deflater = new Deflater(6);- deflater.append(new Uint8Array(arr));- p = deflater.flush();- arr = new Uint8Array(p.length + 6);- arr.set(new Uint8Array([120, 156])), arr.set(p, 2);- arr.set(new Uint8Array([adler32 & 0xFF, adler32 >> 8 & 0xFF, adler32 >> 16 & 0xFF, adler32 >> 24 & 0xFF]), p.length + 2);- p = String.fromCharCode.apply(null, arr);- out('<</Length ' + p.length + ' /Filter [/FlateDecode]>>');- } else {- out('<</Length ' + p.length + '>>');- }- putStream(p);- out('endobj');- }- offsets[1] = content_length;- out('1 0 obj');- out('<</Type /Pages');- var kids = '/Kids [';- for (i = 0; i < page; i++) {- kids += pageObjectNumbers[i] + ' 0 R ';- }- out(kids + ']');- out('/Count ' + page);- out('>>');- out('endobj');- events.publish('postPutPages');- },- putFont = function putFont(font) {- font.objectNumber = newObject();- out('<</BaseFont/' + font.PostScriptName + '/Type/Font');- if (typeof font.encoding === 'string') {- out('/Encoding/' + font.encoding);- }- out('/Subtype/Type1>>');- out('endobj');- },- putFonts = function putFonts() {- for (var fontKey in fonts) {- if (fonts.hasOwnProperty(fontKey)) {- putFont(fonts[fontKey]);- }- }- },- putXobjectDict = function putXobjectDict() {- // Loop through images, or other data objects- events.publish('putXobjectDict');- },- putResourceDictionary = function putResourceDictionary() {- out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');- out('/Font <<');-- // Do this for each font, the '1' bit is the index of the font- for (var fontKey in fonts) {- if (fonts.hasOwnProperty(fontKey)) {- out('/' + fontKey + ' ' + fonts[fontKey].objectNumber + ' 0 R');- }- }- out('>>');- out('/XObject <<');- putXobjectDict();- out('>>');- },- putResources = function putResources() {- putFonts();- events.publish('putResources');- // Resource dictionary- offsets[2] = content_length;- out('2 0 obj');- out('<<');- putResourceDictionary();- out('>>');- out('endobj');- events.publish('postPutResources');- },- putAdditionalObjects = function putAdditionalObjects() {- events.publish('putAdditionalObjects');- for (var i = 0; i < additionalObjects.length; i++) {- var obj = additionalObjects[i];- offsets[obj.objId] = content_length;- out(obj.objId + ' 0 obj');- out(obj.content);- ;- out('endobj');- }- objectNumber += additionalObjects.length;- events.publish('postPutAdditionalObjects');- },- addToFontDictionary = function addToFontDictionary(fontKey, fontName, fontStyle) {- // this is mapping structure for quick font key lookup.- // returns the KEY of the font (ex: "F1") for a given- // pair of font name and type (ex: "Arial". "Italic")- if (!fontmap.hasOwnProperty(fontName)) {- fontmap[fontName] = {};- }- fontmap[fontName][fontStyle] = fontKey;- },-- /**- * FontObject describes a particular font as member of an instnace of jsPDF- *- * It's a collection of properties like 'id' (to be used in PDF stream),- * 'fontName' (font's family name), 'fontStyle' (font's style variant label)- *- * @class- * @public- * @property id {String} PDF-document-instance-specific label assinged to the font.- * @property PostScriptName {String} PDF specification full name for the font- * @property encoding {Object} Encoding_name-to-Font_metrics_object mapping.- * @name FontObject- */- addFont = function addFont(PostScriptName, fontName, fontStyle, encoding) {- var fontKey = 'F' + (Object.keys(fonts).length + 1).toString(10),-- // This is FontObject- font = fonts[fontKey] = {- 'id': fontKey,- 'PostScriptName': PostScriptName,- 'fontName': fontName,- 'fontStyle': fontStyle,- 'encoding': encoding,- 'metadata': {}- };- addToFontDictionary(fontKey, fontName, fontStyle);- events.publish('addFont', font);-- return fontKey;- },- addFonts = function addFonts() {-- var HELVETICA = "helvetica",- TIMES = "times",- COURIER = "courier",- NORMAL = "normal",- BOLD = "bold",- ITALIC = "italic",- BOLD_ITALIC = "bolditalic",- encoding = 'StandardEncoding',- ZAPF = "zapfdingbats",- standardFonts = [['Helvetica', HELVETICA, NORMAL], ['Helvetica-Bold', HELVETICA, BOLD], ['Helvetica-Oblique', HELVETICA, ITALIC], ['Helvetica-BoldOblique', HELVETICA, BOLD_ITALIC], ['Courier', COURIER, NORMAL], ['Courier-Bold', COURIER, BOLD], ['Courier-Oblique', COURIER, ITALIC], ['Courier-BoldOblique', COURIER, BOLD_ITALIC], ['Times-Roman', TIMES, NORMAL], ['Times-Bold', TIMES, BOLD], ['Times-Italic', TIMES, ITALIC], ['Times-BoldItalic', TIMES, BOLD_ITALIC], ['ZapfDingbats', ZAPF]];-- for (var i = 0, l = standardFonts.length; i < l; i++) {- var fontKey = addFont(standardFonts[i][0], standardFonts[i][1], standardFonts[i][2], encoding);-- // adding aliases for standard fonts, this time matching the capitalization- var parts = standardFonts[i][0].split('-');- addToFontDictionary(fontKey, parts[0], parts[1] || '');- }- events.publish('addFonts', { fonts: fonts, dictionary: fontmap });- },- SAFE = function __safeCall(fn) {- fn.foo = function __safeCallWrapper() {- try {- return fn.apply(this, arguments);- } catch (e) {- var stack = e.stack || '';- if (~stack.indexOf(' at ')) stack = stack.split(" at ")[1];- var m = "Error in function " + stack.split("\n")[0].split('<')[0] + ": " + e.message;- if (global.console) {- global.console.error(m, e);- if (global.alert) alert(m);- } else {- throw new Error(m);- }- }- };- fn.foo.bar = fn;- return fn.foo;- },- to8bitStream = function to8bitStream(text, flags) {- /**- * PDF 1.3 spec:- * "For text strings encoded in Unicode, the first two bytes must be 254 followed by- * 255, representing the Unicode byte order marker, U+FEFF. (This sequence conflicts- * with the PDFDocEncoding character sequence thorn ydieresis, which is unlikely- * to be a meaningful beginning of a word or phrase.) The remainder of the- * string consists of Unicode character codes, according to the UTF-16 encoding- * specified in the Unicode standard, version 2.0. Commonly used Unicode values- * are represented as 2 bytes per character, with the high-order byte appearing first- * in the string."- *- * In other words, if there are chars in a string with char code above 255, we- * recode the string to UCS2 BE - string doubles in length and BOM is prepended.- *- * HOWEVER!- * Actual *content* (body) text (as opposed to strings used in document properties etc)- * does NOT expect BOM. There, it is treated as a literal GID (Glyph ID)- *- * Because of Adobe's focus on "you subset your fonts!" you are not supposed to have- * a font that maps directly Unicode (UCS2 / UTF16BE) code to font GID, but you could- * fudge it with "Identity-H" encoding and custom CIDtoGID map that mimics Unicode- * code page. There, however, all characters in the stream are treated as GIDs,- * including BOM, which is the reason we need to skip BOM in content text (i.e. that- * that is tied to a font).- *- * To signal this "special" PDFEscape / to8bitStream handling mode,- * API.text() function sets (unless you overwrite it with manual values- * given to API.text(.., flags) )- * flags.autoencode = true- * flags.noBOM = true- *- * ===================================================================================- * `flags` properties relied upon:- * .sourceEncoding = string with encoding label.- * "Unicode" by default. = encoding of the incoming text.- * pass some non-existing encoding name- * (ex: 'Do not touch my strings! I know what I am doing.')- * to make encoding code skip the encoding step.- * .outputEncoding = Either valid PDF encoding name- * (must be supported by jsPDF font metrics, otherwise no encoding)- * or a JS object, where key = sourceCharCode, value = outputCharCode- * missing keys will be treated as: sourceCharCode === outputCharCode- * .noBOM- * See comment higher above for explanation for why this is important- * .autoencode- * See comment higher above for explanation for why this is important- */-- var i, l, sourceEncoding, encodingBlock, outputEncoding, newtext, isUnicode, ch, bch;-- flags = flags || {};- sourceEncoding = flags.sourceEncoding || 'Unicode';- outputEncoding = flags.outputEncoding;-- // This 'encoding' section relies on font metrics format- // attached to font objects by, among others,- // "Willow Systems' standard_font_metrics plugin"- // see jspdf.plugin.standard_font_metrics.js for format- // of the font.metadata.encoding Object.- // It should be something like- // .encoding = {'codePages':['WinANSI....'], 'WinANSI...':{code:code, ...}}- // .widths = {0:width, code:width, ..., 'fof':divisor}- // .kerning = {code:{previous_char_code:shift, ..., 'fof':-divisor},...}- if ((flags.autoencode || outputEncoding) && fonts[activeFontKey].metadata && fonts[activeFontKey].metadata[sourceEncoding] && fonts[activeFontKey].metadata[sourceEncoding].encoding) {- encodingBlock = fonts[activeFontKey].metadata[sourceEncoding].encoding;-- // each font has default encoding. Some have it clearly defined.- if (!outputEncoding && fonts[activeFontKey].encoding) {- outputEncoding = fonts[activeFontKey].encoding;- }-- // Hmmm, the above did not work? Let's try again, in different place.- if (!outputEncoding && encodingBlock.codePages) {- outputEncoding = encodingBlock.codePages[0]; // let's say, first one is the default- }-- if (typeof outputEncoding === 'string') {- outputEncoding = encodingBlock[outputEncoding];- }- // we want output encoding to be a JS Object, where- // key = sourceEncoding's character code and- // value = outputEncoding's character code.- if (outputEncoding) {- isUnicode = false;- newtext = [];- for (i = 0, l = text.length; i < l; i++) {- ch = outputEncoding[text.charCodeAt(i)];- if (ch) {- newtext.push(String.fromCharCode(ch));- } else {- newtext.push(text[i]);- }-- // since we are looping over chars anyway, might as well- // check for residual unicodeness- if (newtext[i].charCodeAt(0) >> 8) {- /* more than 255 */- isUnicode = true;- }- }- text = newtext.join('');- }- }-- i = text.length;- // isUnicode may be set to false above. Hence the triple-equal to undefined- while (isUnicode === undefined && i !== 0) {- if (text.charCodeAt(i - 1) >> 8) {- /* more than 255 */- isUnicode = true;- }- i--;- }- if (!isUnicode) {- return text;- }-- newtext = flags.noBOM ? [] : [254, 255];- for (i = 0, l = text.length; i < l; i++) {- ch = text.charCodeAt(i);- bch = ch >> 8; // divide by 256- if (bch >> 8) {- /* something left after dividing by 256 second time */- throw new Error("Character at position " + i + " of string '" + text + "' exceeds 16bits. Cannot be encoded into UCS-2 BE");- }- newtext.push(bch);- newtext.push(ch - (bch << 8));- }- return String.fromCharCode.apply(undefined, newtext);- },- pdfEscape = function pdfEscape(text, flags) {- /**- * Replace '/', '(', and ')' with pdf-safe versions- *- * Doing to8bitStream does NOT make this PDF display unicode text. For that- * we also need to reference a unicode font and embed it - royal pain in the rear.- *- * There is still a benefit to to8bitStream - PDF simply cannot handle 16bit chars,- * which JavaScript Strings are happy to provide. So, while we still cannot display- * 2-byte characters property, at least CONDITIONALLY converting (entire string containing)- * 16bit chars to (USC-2-BE) 2-bytes per char + BOM streams we ensure that entire PDF- * is still parseable.- * This will allow immediate support for unicode in document properties strings.- */- return to8bitStream(text, flags).replace(/\\/g, '\\\\').replace(/\(/g, '\\(').replace(/\)/g, '\\)');- },- putInfo = function putInfo() {- out('/Producer (jsPDF ' + jsPDF.version + ')');- for (var key in documentProperties) {- if (documentProperties.hasOwnProperty(key) && documentProperties[key]) {- out('/' + key.substr(0, 1).toUpperCase() + key.substr(1) + ' (' + pdfEscape(documentProperties[key]) + ')');- }- }- var created = new Date(),- tzoffset = created.getTimezoneOffset(),- tzsign = tzoffset < 0 ? '+' : '-',- tzhour = Math.floor(Math.abs(tzoffset / 60)),- tzmin = Math.abs(tzoffset % 60),- tzstr = [tzsign, padd2(tzhour), "'", padd2(tzmin), "'"].join('');- out(['/CreationDate (D:', created.getFullYear(), padd2(created.getMonth() + 1), padd2(created.getDate()), padd2(created.getHours()), padd2(created.getMinutes()), padd2(created.getSeconds()), tzstr, ')'].join(''));- },- putCatalog = function putCatalog() {- out('/Type /Catalog');- out('/Pages 1 0 R');- // PDF13ref Section 7.2.1- if (!zoomMode) zoomMode = 'fullwidth';- switch (zoomMode) {- case 'fullwidth':- out('/OpenAction [3 0 R /FitH null]');- break;- case 'fullheight':- out('/OpenAction [3 0 R /FitV null]');- break;- case 'fullpage':- out('/OpenAction [3 0 R /Fit]');- break;- case 'original':- out('/OpenAction [3 0 R /XYZ null null 1]');- break;- default:- var pcn = '' + zoomMode;- if (pcn.substr(pcn.length - 1) === '%') zoomMode = parseInt(zoomMode) / 100;- if (typeof zoomMode === 'number') {- out('/OpenAction [3 0 R /XYZ null null ' + f2(zoomMode) + ']');- }- }- if (!layoutMode) layoutMode = 'continuous';- switch (layoutMode) {- case 'continuous':- out('/PageLayout /OneColumn');- break;- case 'single':- out('/PageLayout /SinglePage');- break;- case 'two':- case 'twoleft':- out('/PageLayout /TwoColumnLeft');- break;- case 'tworight':- out('/PageLayout /TwoColumnRight');- break;- }- if (pageMode) {- /**- * A name object specifying how the document should be displayed when opened:- * UseNone : Neither document outline nor thumbnail images visible -- DEFAULT- * UseOutlines : Document outline visible- * UseThumbs : Thumbnail images visible- * FullScreen : Full-screen mode, with no menu bar, window controls, or any other window visible- */- out('/PageMode /' + pageMode);- }- events.publish('putCatalog');- },- putTrailer = function putTrailer() {- out('/Size ' + (objectNumber + 1));- out('/Root ' + objectNumber + ' 0 R');- out('/Info ' + (objectNumber - 1) + ' 0 R');- },- beginPage = function beginPage(width, height) {- // Dimensions are stored as user units and converted to points on output- var orientation = typeof height === 'string' && height.toLowerCase();- if (typeof width === 'string') {- var format = width.toLowerCase();- if (pageFormats.hasOwnProperty(format)) {- width = pageFormats[format][0] / k;- height = pageFormats[format][1] / k;- }- }- if (Array.isArray(width)) {- height = width[1];- width = width[0];- }- if (orientation) {- switch (orientation.substr(0, 1)) {- case 'l':- if (height > width) orientation = 's';- break;- case 'p':- if (width > height) orientation = 's';- break;- }- if (orientation === 's') {- tmp = width;- width = height;- height = tmp;- }- }- outToPages = true;- pages[++page] = [];- pagedim[page] = {- width: Number(width) || pageWidth,- height: Number(height) || pageHeight- };- pagesContext[page] = {};- _setPage(page);- },- _addPage = function _addPage() {- beginPage.apply(this, arguments);- // Set line width- out(f2(lineWidth * k) + ' w');- // Set draw color- out(drawColor);- // resurrecting non-default line caps, joins- if (lineCapID !== 0) {- out(lineCapID + ' J');- }- if (lineJoinID !== 0) {- out(lineJoinID + ' j');- }- events.publish('addPage', { pageNumber: page });- },- _deletePage = function _deletePage(n) {- if (n > 0 && n <= page) {- pages.splice(n, 1);- pagedim.splice(n, 1);- page--;- if (currentPage > page) {- currentPage = page;- }- this.setPage(currentPage);- }- },- _setPage = function _setPage(n) {- if (n > 0 && n <= page) {- currentPage = n;- pageWidth = pagedim[n].width;- pageHeight = pagedim[n].height;- }- },-- /**- * Returns a document-specific font key - a label assigned to a- * font name + font type combination at the time the font was added- * to the font inventory.- *- * Font key is used as label for the desired font for a block of text- * to be added to the PDF document stream.- * @private- * @function- * @param fontName {String} can be undefined on "falthy" to indicate "use current"- * @param fontStyle {String} can be undefined on "falthy" to indicate "use current"- * @returns {String} Font key.- */- _getFont = function _getFont(fontName, fontStyle) {- var key;-- fontName = fontName !== undefined ? fontName : fonts[activeFontKey].fontName;- fontStyle = fontStyle !== undefined ? fontStyle : fonts[activeFontKey].fontStyle;-- if (fontName !== undefined) {- fontName = fontName.toLowerCase();- }- switch (fontName) {- case 'sans-serif':- case 'verdana':- case 'arial':- case 'helvetica':- fontName = 'helvetica';- break;- case 'fixed':- case 'monospace':- case 'terminal':- case 'courier':- fontName = 'courier';- break;- case 'serif':- case 'cursive':- case 'fantasy':- default:- fontName = 'times';- break;- }-- try {- // get a string like 'F3' - the KEY corresponding tot he font + type combination.- key = fontmap[fontName][fontStyle];- } catch (e) {}-- if (!key) {- //throw new Error("Unable to look up font label for font '" + fontName + "', '"- //+ fontStyle + "'. Refer to getFontList() for available fonts.");- key = fontmap['times'][fontStyle];- if (key == null) {- key = fontmap['times']['normal'];- }- }- return key;- },- buildDocument = function buildDocument() {- outToPages = false; // switches out() to content-- objectNumber = 2;- content_length = 0;- content = [];- offsets = [];- additionalObjects = [];- // Added for AcroForm- events.publish('buildDocument');-- // putHeader()- out('%PDF-' + pdfVersion);-- putPages();-- // Must happen after putPages- // Modifies current object Id- putAdditionalObjects();-- putResources();-- // Info- newObject();- out('<<');- putInfo();- out('>>');- out('endobj');-- // Catalog- newObject();- out('<<');- putCatalog();- out('>>');- out('endobj');-- // Cross-ref- var o = content_length,- i,- p = "0000000000";- out('xref');- out('0 ' + (objectNumber + 1));- out(p + ' 65535 f ');- for (i = 1; i <= objectNumber; i++) {- var offset = offsets[i];- if (typeof offset === 'function') {- out((p + offsets[i]()).slice(-10) + ' 00000 n ');- } else {- out((p + offsets[i]).slice(-10) + ' 00000 n ');- }- }- // Trailer- out('trailer');- out('<<');- putTrailer();- out('>>');- out('startxref');- out('' + o);- out('%%EOF');-- outToPages = true;-- return content.join('\n');- },- getStyle = function getStyle(style) {- // see path-painting operators in PDF spec- var op = 'S'; // stroke- if (style === 'F') {- op = 'f'; // fill- } else if (style === 'FD' || style === 'DF') {- op = 'B'; // both- } else if (style === 'f' || style === 'f*' || style === 'B' || style === 'B*') {- /*- Allow direct use of these PDF path-painting operators:- - f fill using nonzero winding number rule- - f* fill using even-odd rule- - B fill then stroke with fill using non-zero winding number rule- - B* fill then stroke with fill using even-odd rule- */- op = style;- }- return op;- },- getArrayBuffer = function getArrayBuffer() {- var data = buildDocument(),- len = data.length,- ab = new ArrayBuffer(len),- u8 = new Uint8Array(ab);-- while (len--) {- u8[len] = data.charCodeAt(len);- }return ab;- },- getBlob = function getBlob() {- return new Blob([getArrayBuffer()], { type: "application/pdf" });- },-- /**- * Generates the PDF document.- *- * If `type` argument is undefined, output is raw body of resulting PDF returned as a string.- *- * @param {String} type A string identifying one of the possible output types.- * @param {Object} options An object providing some additional signalling to PDF generator.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name output- */- _output = SAFE(function (type, options) {- var datauri = ('' + type).substr(0, 6) === 'dataur' ? 'data:application/pdf;base64,' + btoa(buildDocument()) : 0;-- switch (type) {- case undefined:- return buildDocument();- case 'save':- if (navigator.getUserMedia) {- if (global.URL === undefined || global.URL.createObjectURL === undefined) {- return API.output('dataurlnewwindow');- }- }- saveAs(getBlob(), options);- if (typeof saveAs.unload === 'function') {- if (global.setTimeout) {- setTimeout(saveAs.unload, 911);- }- }- break;- case 'arraybuffer':- return getArrayBuffer();- case 'blob':- return getBlob();- case 'bloburi':- case 'bloburl':- // User is responsible of calling revokeObjectURL- return global.URL && global.URL.createObjectURL(getBlob()) || void 0;- case 'datauristring':- case 'dataurlstring':- return datauri;- case 'dataurlnewwindow':- var nW = global.open(datauri);- if (nW || typeof safari === "undefined") return nW;- /* pass through */- case 'datauri':- case 'dataurl':- return global.document.location.href = datauri;- default:- throw new Error('Output type "' + type + '" is not supported.');- }- // @TODO: Add different output options- });-- switch (unit) {- case 'pt':- k = 1;- break;- case 'mm':- k = 72 / 25.4000508;- break;- case 'cm':- k = 72 / 2.54000508;- break;- case 'in':- k = 72;- break;- case 'px':- k = 96 / 72;- break;- case 'pc':- k = 12;- break;- case 'em':- k = 12;- break;- case 'ex':- k = 6;- break;- default:- throw 'Invalid unit: ' + unit;- }-- //---------------------------------------- // Public API-- /**- * Object exposing internal API to plugins- * @public- */- API.internal = {- 'pdfEscape': pdfEscape,- 'getStyle': getStyle,- /**- * Returns {FontObject} describing a particular font.- * @public- * @function- * @param fontName {String} (Optional) Font's family name- * @param fontStyle {String} (Optional) Font's style variation name (Example:"Italic")- * @returns {FontObject}- */- 'getFont': function getFont() {- return fonts[_getFont.apply(API, arguments)];- },- 'getFontSize': function getFontSize() {- return activeFontSize;- },- 'getLineHeight': function getLineHeight() {- return activeFontSize * lineHeightProportion;- },- 'write': function write(string1 /*, string2, string3, etc */) {- out(arguments.length === 1 ? string1 : Array.prototype.join.call(arguments, ' '));- },- 'getCoordinateString': function getCoordinateString(value) {- return f2(value * k);- },- 'getVerticalCoordinateString': function getVerticalCoordinateString(value) {- return f2((pageHeight - value) * k);- },- 'collections': {},- 'newObject': newObject,- 'newAdditionalObject': newAdditionalObject,- 'newObjectDeferred': newObjectDeferred,- 'newObjectDeferredBegin': newObjectDeferredBegin,- 'putStream': putStream,- 'events': events,- // ratio that you use in multiplication of a given "size" number to arrive to 'point'- // units of measurement.- // scaleFactor is set at initialization of the document and calculated against the stated- // default measurement units for the document.- // If default is "mm", k is the number that will turn number in 'mm' into 'points' number.- // through multiplication.- 'scaleFactor': k,- 'pageSize': {- get width() {- return pageWidth;- },- get height() {- return pageHeight;- }- },- 'output': function output(type, options) {- return _output(type, options);- },- 'getNumberOfPages': function getNumberOfPages() {- return pages.length - 1;- },- 'pages': pages,- 'out': out,- 'f2': f2,- 'getPageInfo': function getPageInfo(pageNumberOneBased) {- var objId = (pageNumberOneBased - 1) * 2 + 3;- return { objId: objId, pageNumber: pageNumberOneBased, pageContext: pagesContext[pageNumberOneBased] };- },- 'getCurrentPageInfo': function getCurrentPageInfo() {- var objId = (currentPage - 1) * 2 + 3;- return { objId: objId, pageNumber: currentPage, pageContext: pagesContext[currentPage] };- },- 'getPDFVersion': function getPDFVersion() {- return pdfVersion;- }- };-- /**- * Adds (and transfers the focus to) new page to the PDF document.- * @function- * @returns {jsPDF}- *- * @methodOf jsPDF#- * @name addPage- */- API.addPage = function () {- _addPage.apply(this, arguments);- return this;- };- API.setPage = function () {- _setPage.apply(this, arguments);- return this;- };- API.insertPage = function (beforePage) {- this.addPage();- this.movePage(currentPage, beforePage);- return this;- };- API.movePage = function (targetPage, beforePage) {- if (targetPage > beforePage) {- var tmpPages = pages[targetPage];- var tmpPagedim = pagedim[targetPage];- var tmpPagesContext = pagesContext[targetPage];- for (var i = targetPage; i > beforePage; i--) {- pages[i] = pages[i - 1];- pagedim[i] = pagedim[i - 1];- pagesContext[i] = pagesContext[i - 1];- }- pages[beforePage] = tmpPages;- pagedim[beforePage] = tmpPagedim;- pagesContext[beforePage] = tmpPagesContext;- this.setPage(beforePage);- } else if (targetPage < beforePage) {- var tmpPages = pages[targetPage];- var tmpPagedim = pagedim[targetPage];- var tmpPagesContext = pagesContext[targetPage];- for (var i = targetPage; i < beforePage; i++) {- pages[i] = pages[i + 1];- pagedim[i] = pagedim[i + 1];- pagesContext[i] = pagesContext[i + 1];- }- pages[beforePage] = tmpPages;- pagedim[beforePage] = tmpPagedim;- pagesContext[beforePage] = tmpPagesContext;- this.setPage(beforePage);- }- return this;- };-- API.deletePage = function () {- _deletePage.apply(this, arguments);- return this;- };- API.setDisplayMode = function (zoom, layout, pmode) {- zoomMode = zoom;- layoutMode = layout;- pageMode = pmode;- return this;- },-- /**- * Adds text to page. Supports adding multiline text when 'text' argument is an Array of Strings.- *- * @function- * @param {String|Array} text String or array of strings to be added to the page. Each line is shifted one line down per font, spacing settings declared before this call.- * @param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Object} flags Collection of settings signalling how the text must be encoded. Defaults are sane. If you think you want to pass some flags, you likely can read the source.- * @returns {jsPDF}- * @methodOf jsPDF#- * @name text- */- API.text = function (text, x, y, flags, angle, align) {- /**- * Inserts something like this into PDF- * BT- * /F1 16 Tf % Font name + size- * 16 TL % How many units down for next line in multiline text- * 0 g % color- * 28.35 813.54 Td % position- * (line one) Tj- * T* (line two) Tj- * T* (line three) Tj- * ET- */- function ESC(s) {- s = s.split("\t").join(Array(options.TabLen || 9).join(" "));- return pdfEscape(s, flags);- }-- // Pre-August-2012 the order of arguments was function(x, y, text, flags)- // in effort to make all calls have similar signature like- // function(data, coordinates... , miscellaneous)- // this method had its args flipped.- // code below allows backward compatibility with old arg order.- if (typeof text === 'number') {- tmp = y;- y = x;- x = text;- text = tmp;- }-- // If there are any newlines in text, we assume- // the user wanted to print multiple lines, so break the- // text up into an array. If the text is already an array,- // we assume the user knows what they are doing.- // Convert text into an array anyway to simplify- // later code.- if (typeof text === 'string') {- if (text.match(/[\n\r]/)) {- text = text.split(/\r\n|\r|\n/g);- } else {- text = [text];- }- }- if (typeof angle === 'string') {- align = angle;- angle = null;- }- if (typeof flags === 'string') {- align = flags;- flags = null;- }- if (typeof flags === 'number') {- angle = flags;- flags = null;- }- var xtra = '',- mode = 'Td',- todo;- if (angle) {- angle *= Math.PI / 180;- var c = Math.cos(angle),- s = Math.sin(angle);- xtra = [f2(c), f2(s), f2(s * -1), f2(c), ''].join(" ");- mode = 'Tm';- }- flags = flags || {};- if (!('noBOM' in flags)) flags.noBOM = true;- if (!('autoencode' in flags)) flags.autoencode = true;-- var strokeOption = '';- var pageContext = this.internal.getCurrentPageInfo().pageContext;- if (true === flags.stroke) {- if (pageContext.lastTextWasStroke !== true) {- strokeOption = '1 Tr\n';- pageContext.lastTextWasStroke = true;- }- } else {- if (pageContext.lastTextWasStroke) {- strokeOption = '0 Tr\n';- }- pageContext.lastTextWasStroke = false;- }-- if (typeof this._runningPageHeight === 'undefined') {- this._runningPageHeight = 0;- }-- if (typeof text === 'string') {- text = ESC(text);- } else if (Object.prototype.toString.call(text) === '[object Array]') {- // we don't want to destroy original text array, so cloning it- var sa = text.concat(),- da = [],- len = sa.length;- // we do array.join('text that must not be PDFescaped")- // thus, pdfEscape each component separately- while (len--) {- da.push(ESC(sa.shift()));- }- var linesLeft = Math.ceil((pageHeight - y - this._runningPageHeight) * k / (activeFontSize * lineHeightProportion));- if (0 <= linesLeft && linesLeft < da.length + 1) {- //todo = da.splice(linesLeft-1);- }-- if (align) {- var left,- prevX,- maxLineLength,- leading = activeFontSize * lineHeightProportion,- lineWidths = text.map(function (v) {- return this.getStringUnitWidth(v) * activeFontSize / k;- }, this);- maxLineLength = Math.max.apply(Math, lineWidths);- // The first line uses the "main" Td setting,- // and the subsequent lines are offset by the- // previous line's x coordinate.- if (align === "center") {- // The passed in x coordinate defines- // the center point.- left = x - maxLineLength / 2;- x -= lineWidths[0] / 2;- } else if (align === "right") {- // The passed in x coordinate defines the- // rightmost point of the text.- left = x - maxLineLength;- x -= lineWidths[0];- } else {- throw new Error('Unrecognized alignment option, use "center" or "right".');- }- prevX = x;- text = da[0];- for (var i = 1, len = da.length; i < len; i++) {- var delta = maxLineLength - lineWidths[i];- if (align === "center") delta /= 2;- // T* = x-offset leading Td ( text )- text += ") Tj\n" + (left - prevX + delta) + " -" + leading + " Td (" + da[i];- prevX = left + delta;- }- } else {- text = da.join(") Tj\nT* (");- }- } else {- throw new Error('Type of text must be string or Array. "' + text + '" is not recognized.');- }- // Using "'" ("go next line and render text" mark) would save space but would complicate our rendering code, templates-- // BT .. ET does NOT have default settings for Tf. You must state that explicitely every time for BT .. ET- // if you want text transformation matrix (+ multiline) to work reliably (which reads sizes of things from font declarations)- // Thus, there is NO useful, *reliable* concept of "default" font for a page.- // The fact that "default" (reuse font used before) font worked before in basic cases is an accident- // - readers dealing smartly with brokenness of jsPDF's markup.-- var curY;-- if (todo) {- //this.addPage();- //this._runningPageHeight += y - (activeFontSize * 1.7 / k);- //curY = f2(pageHeight - activeFontSize * 1.7 /k);- } else {- curY = f2((pageHeight - y) * k);- }- //curY = f2((pageHeight - (y - this._runningPageHeight)) * k);-- // if (curY < 0){- // console.log('auto page break');- // this.addPage();- // this._runningPageHeight = y - (activeFontSize * 1.7 / k);- // curY = f2(pageHeight - activeFontSize * 1.7 /k);- // }-- out('BT\n/' + activeFontKey + ' ' + activeFontSize + ' Tf\n' + // font face, style, size- activeFontSize * lineHeightProportion + ' TL\n' + // line spacing- strokeOption + // stroke option- textColor + '\n' + xtra + f2(x * k) + ' ' + curY + ' ' + mode + '\n(' + text + ') Tj\nET');-- if (todo) {- //this.text( todo, x, activeFontSize * 1.7 / k);- //this.text( todo, x, this._runningPageHeight + (activeFontSize * 1.7 / k));- this.text(todo, x, y); // + (activeFontSize * 1.7 / k));- }-- return this;- };-- API.lstext = function (text, x, y, spacing) {- for (var i = 0, len = text.length; i < len; i++, x += spacing) {- this.text(text[i], x, y);- }- };-- API.line = function (x1, y1, x2, y2) {- return this.lines([[x2 - x1, y2 - y1]], x1, y1);- };-- API.clip = function () {- // By patrick-roberts, github.com/MrRio/jsPDF/issues/328- // Call .clip() after calling .rect() with a style argument of null- out('W'); // clip- out('S'); // stroke path; necessary for clip to work- };-- /**- * This fixes the previous function clip(). Perhaps the 'stroke path' hack was due to the missing 'n' instruction?- * We introduce the fixed version so as to not break API.- * @param fillRule- */- API.clip_fixed = function (fillRule) {- // Call .clip() after calling drawing ops with a style argument of null- // W is the PDF clipping op- if ('evenodd' === fillRule) {- out('W*');- } else {- out('W');- }- // End the path object without filling or stroking it.- // This operator is a path-painting no-op, used primarily for the side effect of changing the current clipping path- // (see Section 4.4.3, “Clipping Path Operators”)- out('n');- };-- /**- * Adds series of curves (straight lines or cubic bezier curves) to canvas, starting at `x`, `y` coordinates.- * All data points in `lines` are relative to last line origin.- * `x`, `y` become x1,y1 for first line / curve in the set.- * For lines you only need to specify [x2, y2] - (ending point) vector against x1, y1 starting point.- * For bezier curves you need to specify [x2,y2,x3,y3,x4,y4] - vectors to control points 1, 2, ending point. All vectors are against the start of the curve - x1,y1.- *- * @example .lines([[2,2],[-2,2],[1,1,2,2,3,3],[2,1]], 212,110, 10) // line, line, bezier curve, line- * @param {Array} lines Array of *vector* shifts as pairs (lines) or sextets (cubic bezier curves).- * @param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} scale (Defaults to [1.0,1.0]) x,y Scaling factor for all vectors. Elements can be any floating number Sub-one makes drawing smaller. Over-one grows the drawing. Negative flips the direction.- * @param {String} style A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.- * @param {Boolean} closed If true, the path is closed with a straight line from the end of the last curve to the starting point.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name lines- */- API.lines = function (lines, x, y, scale, style, closed) {- var scalex, scaley, i, l, leg, x2, y2, x3, y3, x4, y4;-- // Pre-August-2012 the order of arguments was function(x, y, lines, scale, style)- // in effort to make all calls have similar signature like- // function(content, coordinateX, coordinateY , miscellaneous)- // this method had its args flipped.- // code below allows backward compatibility with old arg order.- if (typeof lines === 'number') {- tmp = y;- y = x;- x = lines;- lines = tmp;- }-- scale = scale || [1, 1];-- // starting point- out(f3(x * k) + ' ' + f3((pageHeight - y) * k) + ' m ');-- scalex = scale[0];- scaley = scale[1];- l = lines.length;- //, x2, y2 // bezier only. In page default measurement "units", *after* scaling- //, x3, y3 // bezier only. In page default measurement "units", *after* scaling- // ending point for all, lines and bezier. . In page default measurement "units", *after* scaling- x4 = x; // last / ending point = starting point for first item.- y4 = y; // last / ending point = starting point for first item.-- for (i = 0; i < l; i++) {- leg = lines[i];- if (leg.length === 2) {- // simple line- x4 = leg[0] * scalex + x4; // here last x4 was prior ending point- y4 = leg[1] * scaley + y4; // here last y4 was prior ending point- out(f3(x4 * k) + ' ' + f3((pageHeight - y4) * k) + ' l');- } else {- // bezier curve- x2 = leg[0] * scalex + x4; // here last x4 is prior ending point- y2 = leg[1] * scaley + y4; // here last y4 is prior ending point- x3 = leg[2] * scalex + x4; // here last x4 is prior ending point- y3 = leg[3] * scaley + y4; // here last y4 is prior ending point- x4 = leg[4] * scalex + x4; // here last x4 was prior ending point- y4 = leg[5] * scaley + y4; // here last y4 was prior ending point- out(f3(x2 * k) + ' ' + f3((pageHeight - y2) * k) + ' ' + f3(x3 * k) + ' ' + f3((pageHeight - y3) * k) + ' ' + f3(x4 * k) + ' ' + f3((pageHeight - y4) * k) + ' c');- }- }-- if (closed) {- out(' h');- }-- // stroking / filling / both the path- if (style !== null) {- out(getStyle(style));- }- return this;- };-- /**- * Adds a rectangle to PDF- *- * @param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} w Width (in units declared at inception of PDF document)- * @param {Number} h Height (in units declared at inception of PDF document)- * @param {String} style A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name rect- */- API.rect = function (x, y, w, h, style) {- var op = getStyle(style);- out([f2(x * k), f2((pageHeight - y) * k), f2(w * k), f2(-h * k), 're'].join(' '));-- if (style !== null) {- out(getStyle(style));- }-- return this;- };-- /**- * Adds a triangle to PDF- *- * @param {Number} x1 Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y1 Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} x2 Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y2 Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} x3 Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y3 Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {String} style A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name triangle- */- API.triangle = function (x1, y1, x2, y2, x3, y3, style) {- this.lines([[x2 - x1, y2 - y1], // vector to point 2- [x3 - x2, y3 - y2], // vector to point 3- [x1 - x3, y1 - y3] // closing vector back to point 1- ], x1, y1, // start of path- [1, 1], style, true);- return this;- };-- /**- * Adds a rectangle with rounded corners to PDF- *- * @param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} w Width (in units declared at inception of PDF document)- * @param {Number} h Height (in units declared at inception of PDF document)- * @param {Number} rx Radius along x axis (in units declared at inception of PDF document)- * @param {Number} rx Radius along y axis (in units declared at inception of PDF document)- * @param {String} style A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name roundedRect- */- API.roundedRect = function (x, y, w, h, rx, ry, style) {- var MyArc = 4 / 3 * (Math.SQRT2 - 1);- this.lines([[w - 2 * rx, 0], [rx * MyArc, 0, rx, ry - ry * MyArc, rx, ry], [0, h - 2 * ry], [0, ry * MyArc, -(rx * MyArc), ry, -rx, ry], [-w + 2 * rx, 0], [-(rx * MyArc), 0, -rx, -(ry * MyArc), -rx, -ry], [0, -h + 2 * ry], [0, -(ry * MyArc), rx * MyArc, -ry, rx, -ry]], x + rx, y, // start of path- [1, 1], style);- return this;- };-- /**- * Adds an ellipse to PDF- *- * @param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} rx Radius along x axis (in units declared at inception of PDF document)- * @param {Number} rx Radius along y axis (in units declared at inception of PDF document)- * @param {String} style A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name ellipse- */- API.ellipse = function (x, y, rx, ry, style) {- var lx = 4 / 3 * (Math.SQRT2 - 1) * rx,- ly = 4 / 3 * (Math.SQRT2 - 1) * ry;-- out([f2((x + rx) * k), f2((pageHeight - y) * k), 'm', f2((x + rx) * k), f2((pageHeight - (y - ly)) * k), f2((x + lx) * k), f2((pageHeight - (y - ry)) * k), f2(x * k), f2((pageHeight - (y - ry)) * k), 'c'].join(' '));- out([f2((x - lx) * k), f2((pageHeight - (y - ry)) * k), f2((x - rx) * k), f2((pageHeight - (y - ly)) * k), f2((x - rx) * k), f2((pageHeight - y) * k), 'c'].join(' '));- out([f2((x - rx) * k), f2((pageHeight - (y + ly)) * k), f2((x - lx) * k), f2((pageHeight - (y + ry)) * k), f2(x * k), f2((pageHeight - (y + ry)) * k), 'c'].join(' '));- out([f2((x + lx) * k), f2((pageHeight - (y + ry)) * k), f2((x + rx) * k), f2((pageHeight - (y + ly)) * k), f2((x + rx) * k), f2((pageHeight - y) * k), 'c'].join(' '));-- if (style !== null) {- out(getStyle(style));- }-- return this;- };-- /**- * Adds an circle to PDF- *- * @param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page- * @param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page- * @param {Number} r Radius (in units declared at inception of PDF document)- * @param {String} style A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name circle- */- API.circle = function (x, y, r, style) {- return this.ellipse(x, y, r, r, style);- };-- /**- * Adds a properties to the PDF document- *- * @param {Object} A property_name-to-property_value object structure.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setProperties- */- API.setProperties = function (properties) {- // copying only those properties we can render.- for (var property in documentProperties) {- if (documentProperties.hasOwnProperty(property) && properties[property]) {- documentProperties[property] = properties[property];- }- }- return this;- };-- /**- * Sets font size for upcoming text elements.- *- * @param {Number} size Font size in points.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setFontSize- */- API.setFontSize = function (size) {- activeFontSize = size;- return this;- };-- /**- * Sets text font face, variant for upcoming text elements.- * See output of jsPDF.getFontList() for possible font names, styles.- *- * @param {String} fontName Font name or family. Example: "times"- * @param {String} fontStyle Font style or variant. Example: "italic"- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setFont- */- API.setFont = function (fontName, fontStyle) {- activeFontKey = _getFont(fontName, fontStyle);- // if font is not found, the above line blows up and we never go further- return this;- };-- /**- * Switches font style or variant for upcoming text elements,- * while keeping the font face or family same.- * See output of jsPDF.getFontList() for possible font names, styles.- *- * @param {String} style Font style or variant. Example: "italic"- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setFontStyle- */- API.setFontStyle = API.setFontType = function (style) {- activeFontKey = _getFont(undefined, style);- // if font is not found, the above line blows up and we never go further- return this;- };-- /**- * Returns an object - a tree of fontName to fontStyle relationships available to- * active PDF document.- *- * @public- * @function- * @returns {Object} Like {'times':['normal', 'italic', ... ], 'arial':['normal', 'bold', ... ], ... }- * @methodOf jsPDF#- * @name getFontList- */- API.getFontList = function () {- // TODO: iterate over fonts array or return copy of fontmap instead in case more are ever added.- var list = {},- fontName,- fontStyle,- tmp;-- for (fontName in fontmap) {- if (fontmap.hasOwnProperty(fontName)) {- list[fontName] = tmp = [];- for (fontStyle in fontmap[fontName]) {- if (fontmap[fontName].hasOwnProperty(fontStyle)) {- tmp.push(fontStyle);- }- }- }- }-- return list;- };-- /**- * Add a custom font.- *- * @param {String} Postscript name of the Font. Example: "Menlo-Regular"- * @param {String} Name of font-family from @font-face definition. Example: "Menlo Regular"- * @param {String} Font style. Example: "normal"- * @function- * @returns the {fontKey} (same as the internal method)- * @methodOf jsPDF#- * @name addFont- */- API.addFont = function (postScriptName, fontName, fontStyle) {- addFont(postScriptName, fontName, fontStyle, 'StandardEncoding');- };-- /**- * Sets line width for upcoming lines.- *- * @param {Number} width Line width (in units declared at inception of PDF document)- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setLineWidth- */- API.setLineWidth = function (width) {- out((width * k).toFixed(2) + ' w');- return this;- };-- /**- * Sets the stroke color for upcoming elements.- *- * Depending on the number of arguments given, Gray, RGB, or CMYK- * color space is implied.- *- * When only ch1 is given, "Gray" color space is implied and it- * must be a value in the range from 0.00 (solid black) to to 1.00 (white)- * if values are communicated as String types, or in range from 0 (black)- * to 255 (white) if communicated as Number type.- * The RGB-like 0-255 range is provided for backward compatibility.- *- * When only ch1,ch2,ch3 are given, "RGB" color space is implied and each- * value must be in the range from 0.00 (minimum intensity) to to 1.00- * (max intensity) if values are communicated as String types, or- * from 0 (min intensity) to to 255 (max intensity) if values are communicated- * as Number types.- * The RGB-like 0-255 range is provided for backward compatibility.- *- * When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each- * value must be a in the range from 0.00 (0% concentration) to to- * 1.00 (100% concentration)- *- * Because JavaScript treats fixed point numbers badly (rounds to- * floating point nearest to binary representation) it is highly advised to- * communicate the fractional numbers as String types, not JavaScript Number type.- *- * @param {Number|String} ch1 Color channel value- * @param {Number|String} ch2 Color channel value- * @param {Number|String} ch3 Color channel value- * @param {Number|String} ch4 Color channel value- *- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setDrawColor- */- API.setDrawColor = function (ch1, ch2, ch3, ch4) {- var color;- if (ch2 === undefined || ch4 === undefined && ch1 === ch2 === ch3) {- // Gray color space.- if (typeof ch1 === 'string') {- color = ch1 + ' G';- } else {- color = f2(ch1 / 255) + ' G';- }- } else if (ch4 === undefined) {- // RGB- if (typeof ch1 === 'string') {- color = [ch1, ch2, ch3, 'RG'].join(' ');- } else {- color = [f2(ch1 / 255), f2(ch2 / 255), f2(ch3 / 255), 'RG'].join(' ');- }- } else {- // CMYK- if (typeof ch1 === 'string') {- color = [ch1, ch2, ch3, ch4, 'K'].join(' ');- } else {- color = [f2(ch1), f2(ch2), f2(ch3), f2(ch4), 'K'].join(' ');- }- }-- out(color);- return this;- };-- /**- * Sets the fill color for upcoming elements.- *- * Depending on the number of arguments given, Gray, RGB, or CMYK- * color space is implied.- *- * When only ch1 is given, "Gray" color space is implied and it- * must be a value in the range from 0.00 (solid black) to to 1.00 (white)- * if values are communicated as String types, or in range from 0 (black)- * to 255 (white) if communicated as Number type.- * The RGB-like 0-255 range is provided for backward compatibility.- *- * When only ch1,ch2,ch3 are given, "RGB" color space is implied and each- * value must be in the range from 0.00 (minimum intensity) to to 1.00- * (max intensity) if values are communicated as String types, or- * from 0 (min intensity) to to 255 (max intensity) if values are communicated- * as Number types.- * The RGB-like 0-255 range is provided for backward compatibility.- *- * When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each- * value must be a in the range from 0.00 (0% concentration) to to- * 1.00 (100% concentration)- *- * Because JavaScript treats fixed point numbers badly (rounds to- * floating point nearest to binary representation) it is highly advised to- * communicate the fractional numbers as String types, not JavaScript Number type.- *- * @param {Number|String} ch1 Color channel value- * @param {Number|String} ch2 Color channel value- * @param {Number|String} ch3 Color channel value- * @param {Number|String} ch4 Color channel value- *- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setFillColor- */- API.setFillColor = function (ch1, ch2, ch3, ch4) {- var color;-- if (ch2 === undefined || ch4 === undefined && ch1 === ch2 === ch3) {- // Gray color space.- if (typeof ch1 === 'string') {- color = ch1 + ' g';- } else {- color = f2(ch1 / 255) + ' g';- }- } else if (ch4 === undefined || (typeof ch4 === 'undefined' ? 'undefined' : _typeof(ch4)) === 'object') {- // RGB- if (typeof ch1 === 'string') {- color = [ch1, ch2, ch3, 'rg'].join(' ');- } else {- color = [f2(ch1 / 255), f2(ch2 / 255), f2(ch3 / 255), 'rg'].join(' ');- }- if (ch4 && ch4.a === 0) {- //TODO Implement transparency.- //WORKAROUND use white for now- color = ['255', '255', '255', 'rg'].join(' ');- }- } else {- // CMYK- if (typeof ch1 === 'string') {- color = [ch1, ch2, ch3, ch4, 'k'].join(' ');- } else {- color = [f2(ch1), f2(ch2), f2(ch3), f2(ch4), 'k'].join(' ');- }- }-- out(color);- return this;- };-- /**- * Sets the text color for upcoming elements.- * If only one, first argument is given,- * treats the value as gray-scale color value.- *- * @param {Number} r Red channel color value in range 0-255 or {String} r color value in hexadecimal, example: '#FFFFFF'- * @param {Number} g Green channel color value in range 0-255- * @param {Number} b Blue channel color value in range 0-255- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setTextColor- */- API.setTextColor = function (r, g, b) {- if (typeof r === 'string' && /^#[0-9A-Fa-f]{6}$/.test(r)) {- var hex = parseInt(r.substr(1), 16);- r = hex >> 16 & 255;- g = hex >> 8 & 255;- b = hex & 255;- }-- if (r === 0 && g === 0 && b === 0 || typeof g === 'undefined') {- textColor = f3(r / 255) + ' g';- } else {- textColor = [f3(r / 255), f3(g / 255), f3(b / 255), 'rg'].join(' ');- }- return this;- };-- /**- * Is an Object providing a mapping from human-readable to- * integer flag values designating the varieties of line cap- * and join styles.- *- * @returns {Object}- * @fieldOf jsPDF#- * @name CapJoinStyles- */- API.CapJoinStyles = {- 0: 0,- 'butt': 0,- 'but': 0,- 'miter': 0,- 1: 1,- 'round': 1,- 'rounded': 1,- 'circle': 1,- 2: 2,- 'projecting': 2,- 'project': 2,- 'square': 2,- 'bevel': 2- };-- /**- * Sets the line cap styles- * See {jsPDF.CapJoinStyles} for variants- *- * @param {String|Number} style A string or number identifying the type of line cap- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setLineCap- */- API.setLineCap = function (style) {- var id = this.CapJoinStyles[style];- if (id === undefined) {- throw new Error("Line cap style of '" + style + "' is not recognized. See or extend .CapJoinStyles property for valid styles");- }- lineCapID = id;- out(id + ' J');-- return this;- };-- /**- * Sets the line join styles- * See {jsPDF.CapJoinStyles} for variants- *- * @param {String|Number} style A string or number identifying the type of line join- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name setLineJoin- */- API.setLineJoin = function (style) {- var id = this.CapJoinStyles[style];- if (id === undefined) {- throw new Error("Line join style of '" + style + "' is not recognized. See or extend .CapJoinStyles property for valid styles");- }- lineJoinID = id;- out(id + ' j');-- return this;- };-- // Output is both an internal (for plugins) and external function- API.output = _output;-- /**- * Saves as PDF document. An alias of jsPDF.output('save', 'filename.pdf')- * @param {String} filename The filename including extension.- *- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name save- */- API.save = function (filename) {- API.output('save', filename);- };-- // applying plugins (more methods) ON TOP of built-in API.- // this is intentional as we allow plugins to override- // built-ins- for (var plugin in jsPDF.API) {- if (jsPDF.API.hasOwnProperty(plugin)) {- if (plugin === 'events' && jsPDF.API.events.length) {- (function (events, newEvents) {-- // jsPDF.API.events is a JS Array of Arrays- // where each Array is a pair of event name, handler- // Events were added by plugins to the jsPDF instantiator.- // These are always added to the new instance and some ran- // during instantiation.- var eventname, handler_and_args, i;-- for (i = newEvents.length - 1; i !== -1; i--) {- // subscribe takes 3 args: 'topic', function, runonce_flag- // if undefined, runonce is false.- // users can attach callback directly,- // or they can attach an array with [callback, runonce_flag]- // that's what the "apply" magic is for below.- eventname = newEvents[i][0];- handler_and_args = newEvents[i][1];- events.subscribe.apply(events, [eventname].concat(typeof handler_and_args === 'function' ? [handler_and_args] : handler_and_args));- }- })(events, jsPDF.API.events);- } else {- API[plugin] = jsPDF.API[plugin];- }- }- }-- //////////////////////////////////////////////////////- // continuing initialization of jsPDF Document object- //////////////////////////////////////////////////////- // Add the first page automatically- addFonts();- activeFontKey = 'F1';- _addPage(format, orientation);-- events.publish('initialized');- return API;- }-- /**- * jsPDF.API is a STATIC property of jsPDF class.- * jsPDF.API is an object you can add methods and properties to.- * The methods / properties you add will show up in new jsPDF objects.- *- * One property is prepopulated. It is the 'events' Object. Plugin authors can add topics,- * callbacks to this object. These will be reassigned to all new instances of jsPDF.- * Examples:- * jsPDF.API.events['initialized'] = function(){ 'this' is API object }- * jsPDF.API.events['addFont'] = function(added_font_object){ 'this' is API object }- *- * @static- * @public- * @memberOf jsPDF- * @name API- *- * @example- * jsPDF.API.mymethod = function(){- * // 'this' will be ref to internal API object. see jsPDF source- * // , so you can refer to built-in methods like so:- * // this.line(....)- * // this.text(....)- * }- * var pdfdoc = new jsPDF()- * pdfdoc.mymethod() // <- !!!!!!- */- jsPDF.API = { events: [] };- jsPDF.version = "1.3.2 2016-09-30T20:33:17.116Z:jameshall";-- if (typeof define === 'function' && define.amd) {- define('jsPDF', function () {- return jsPDF;- });- } else if (typeof module !== 'undefined' && module.exports) {- module.exports = jsPDF;- } else {- global.jsPDF = jsPDF;- }- return jsPDF;- }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || undefined);- /*rollup-keeper-start*/window.tmp = jsPDF;-- /**- * jsPDF AcroForm Plugin- * Copyright (c) 2016 Alexander Weidt, https://github.com/BiggA94- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- (window.AcroForm = function (jsPDFAPI) {- 'use strict';-- var AcroForm = window.AcroForm;-- AcroForm.scale = function (x) {- return x * (acroformPlugin.internal.scaleFactor / 1); // 1 = (96 / 72)- };- AcroForm.antiScale = function (x) {- return 1 / acroformPlugin.internal.scaleFactor * x;- };-- var acroformPlugin = {- fields: [],- xForms: [],- /**- * acroFormDictionaryRoot contains information about the AcroForm Dictionary- * 0: The Event-Token, the AcroFormDictionaryCallback has- * 1: The Object ID of the Root- */- acroFormDictionaryRoot: null,- /**- * After the PDF gets evaluated, the reference to the root has to be reset,- * this indicates, whether the root has already been printed out- */- printedOut: false,- internal: null- };-- jsPDF.API.acroformPlugin = acroformPlugin;-- var annotReferenceCallback = function annotReferenceCallback() {- for (var i in this.acroformPlugin.acroFormDictionaryRoot.Fields) {- var formObject = this.acroformPlugin.acroFormDictionaryRoot.Fields[i];- // add Annot Reference!- if (formObject.hasAnnotation) {- // If theres an Annotation Widget in the Form Object, put the Reference in the /Annot array- createAnnotationReference.call(this, formObject);- }- }- };-- var createAcroForm = function createAcroForm() {- if (this.acroformPlugin.acroFormDictionaryRoot) {- //return;- throw new Error("Exception while creating AcroformDictionary");- }-- // The Object Number of the AcroForm Dictionary- this.acroformPlugin.acroFormDictionaryRoot = new AcroForm.AcroFormDictionary();-- this.acroformPlugin.internal = this.internal;-- // add Callback for creating the AcroForm Dictionary- this.acroformPlugin.acroFormDictionaryRoot._eventID = this.internal.events.subscribe('postPutResources', AcroFormDictionaryCallback);-- this.internal.events.subscribe('buildDocument', annotReferenceCallback); //buildDocument-- // Register event, that is triggered when the DocumentCatalog is written, in order to add /AcroForm- this.internal.events.subscribe('putCatalog', putCatalogCallback);-- // Register event, that creates all Fields- this.internal.events.subscribe('postPutPages', createFieldCallback);- };-- /**- * Create the Reference to the widgetAnnotation, so that it gets referenced in the Annot[] int the+- * (Requires the Annotation Plugin)- */- var createAnnotationReference = function createAnnotationReference(object) {- var options = {- type: 'reference',- object: object- };- jsPDF.API.annotationPlugin.annotations[this.internal.getPageInfo(object.page).pageNumber].push(options);- };-- var putForm = function putForm(formObject) {- if (this.acroformPlugin.printedOut) {- this.acroformPlugin.printedOut = false;- this.acroformPlugin.acroFormDictionaryRoot = null;- }- if (!this.acroformPlugin.acroFormDictionaryRoot) {- createAcroForm.call(this);- }- this.acroformPlugin.acroFormDictionaryRoot.Fields.push(formObject);- };-- // Callbacks-- var putCatalogCallback = function putCatalogCallback() {- //Put reference to AcroForm to DocumentCatalog- if (typeof this.acroformPlugin.acroFormDictionaryRoot != 'undefined') {- // for safety, shouldn't normally be the case- this.internal.write('/AcroForm ' + this.acroformPlugin.acroFormDictionaryRoot.objId + ' ' + 0 + ' R');- } else {- console.log('Root missing...');- }- };-- /**- * Adds /Acroform X 0 R to Document Catalog,- * and creates the AcroForm Dictionary- */- var AcroFormDictionaryCallback = function AcroFormDictionaryCallback() {- // Remove event- this.internal.events.unsubscribe(this.acroformPlugin.acroFormDictionaryRoot._eventID);-- delete this.acroformPlugin.acroFormDictionaryRoot._eventID;-- this.acroformPlugin.printedOut = true;- };-- /**- * Creates the single Fields and writes them into the Document- *- * If fieldArray is set, use the fields that are inside it instead of the fields from the AcroRoot- * (for the FormXObjects...)- */- var createFieldCallback = function createFieldCallback(fieldArray) {- var standardFields = !fieldArray;-- if (!fieldArray) {- // in case there is no fieldArray specified, we want to print out the Fields of the AcroForm- // Print out Root- this.internal.newObjectDeferredBegin(this.acroformPlugin.acroFormDictionaryRoot.objId);- this.internal.out(this.acroformPlugin.acroFormDictionaryRoot.getString());- }-- var fieldArray = fieldArray || this.acroformPlugin.acroFormDictionaryRoot.Kids;-- for (var i in fieldArray) {- var key = i;- var form = fieldArray[i];-- var oldRect = form.Rect;-- if (form.Rect) {- form.Rect = AcroForm.internal.calculateCoordinates.call(this, form.Rect);- }-- // Start Writing the Object- this.internal.newObjectDeferredBegin(form.objId);-- var content = "";- content += form.objId + " 0 obj\n";-- content += "<<\n" + form.getContent();-- form.Rect = oldRect;-- if (form.hasAppearanceStream && !form.appearanceStreamContent) {- // Calculate Appearance- var appearance = AcroForm.internal.calculateAppearanceStream.call(this, form);- content += "/AP << /N " + appearance + " >>\n";-- this.acroformPlugin.xForms.push(appearance);- }-- // Assume AppearanceStreamContent is a Array with N,R,D (at least one of them!)- if (form.appearanceStreamContent) {- content += "/AP << ";- // Iterate over N,R and D- for (var k in form.appearanceStreamContent) {- var value = form.appearanceStreamContent[k];- content += "/" + k + " ";- content += "<< ";- if (Object.keys(value).length >= 1 || Array.isArray(value)) {- // appearanceStream is an Array or Object!- for (var i in value) {- var obj = value[i];- if (typeof obj === 'function') {- // if Function is referenced, call it in order to get the FormXObject- obj = obj.call(this, form);- }- content += "/" + i + " " + obj + " ";-- // In case the XForm is already used, e.g. OffState of CheckBoxes, don't add it- if (!(this.acroformPlugin.xForms.indexOf(obj) >= 0)) this.acroformPlugin.xForms.push(obj);- }- } else {- var obj = value;- if (typeof obj === 'function') {- // if Function is referenced, call it in order to get the FormXObject- obj = obj.call(this, form);- }- content += "/" + i + " " + obj + " \n";- if (!(this.acroformPlugin.xForms.indexOf(obj) >= 0)) this.acroformPlugin.xForms.push(obj);- }- content += " >>\n";- }-- // appearance stream is a normal Object..- content += ">>\n";- }-- content += ">>\nendobj\n";-- this.internal.out(content);- }- if (standardFields) {- createXFormObjectCallback.call(this, this.acroformPlugin.xForms);- }- };-- var createXFormObjectCallback = function createXFormObjectCallback(fieldArray) {- for (var i in fieldArray) {- var key = i;- var form = fieldArray[i];- // Start Writing the Object- this.internal.newObjectDeferredBegin(form && form.objId);-- var content = "";- content += form ? form.getString() : '';- this.internal.out(content);-- delete fieldArray[key];- }- };-- // Public:-- jsPDFAPI.addField = function (fieldObject) {- //var opt = parseOptions(fieldObject);- if (fieldObject instanceof AcroForm.TextField) {- addTextField.call(this, fieldObject);- } else if (fieldObject instanceof AcroForm.ChoiceField) {- addChoiceField.call(this, fieldObject);- } else if (fieldObject instanceof AcroForm.Button) {- addButton.call(this, fieldObject);- } else if (fieldObject instanceof AcroForm.ChildClass) {- putForm.call(this, fieldObject);- } else if (fieldObject) {- // try to put..- putForm.call(this, fieldObject);- }- fieldObject.page = this.acroformPlugin.internal.getCurrentPageInfo().pageNumber;- return this;- };-- // ############### sort in:-- /**- * Button- * FT = Btn- */- var addButton = function addButton(options) {- var options = options || new AcroForm.Field();-- options.FT = '/Btn';-- /**- * Calculating the Ff entry:- *- * The Ff entry contains flags, that have to be set bitwise- * In the Following the number in the Comment is the BitPosition- */- var flags = options.Ff || 0;-- // 17, Pushbutton- if (options.pushbutton) {- // Options.pushbutton should be 1 or 0- flags = AcroForm.internal.setBitPosition(flags, 17);- delete options.pushbutton;- }-- //16, Radio- if (options.radio) {- //flags = options.Ff | options.radio << 15;- flags = AcroForm.internal.setBitPosition(flags, 16);- delete options.radio;- }-- // 15, NoToggleToOff (Radio buttons only- if (options.noToggleToOff) {- //flags = options.Ff | options.noToggleToOff << 14;- flags = AcroForm.internal.setBitPosition(flags, 15);- //delete options.noToggleToOff;- }-- // In case, there is no Flag set, it is a check-box- options.Ff = flags;-- putForm.call(this, options);- };-- var addTextField = function addTextField(options) {- var options = options || new AcroForm.Field();-- options.FT = '/Tx';-- /**- * Calculating the Ff entry:- *- * The Ff entry contains flags, that have to be set bitwise- * In the Following the number in the Comment is the BitPosition- */-- var flags = options.Ff || 0;-- // 13, multiline- if (options.multiline) {- // Set Flag- flags = flags | 1 << 12;- // Remove multiline from FieldObject- //delete options.multiline;- }-- // 14, Password- if (options.password) {- flags = flags | 1 << 13;- //delete options.password;- }-- // 21, FileSelect, PDF 1.4...- if (options.fileSelect) {- flags = flags | 1 << 20;- //delete options.fileSelect;- }-- // 23, DoNotSpellCheck, PDF 1.4...- if (options.doNotSpellCheck) {- flags = flags | 1 << 22;- //delete options.doNotSpellCheck;- }-- // 24, DoNotScroll, PDF 1.4...- if (options.doNotScroll) {- flags = flags | 1 << 23;- //delete options.doNotScroll;- }-- options.Ff = options.Ff || flags;-- // Add field- putForm.call(this, options);- };-- var addChoiceField = function addChoiceField(opt) {- var options = opt || new AcroForm.Field();-- options.FT = '/Ch';-- /**- * Calculating the Ff entry:- *- * The Ff entry contains flags, that have to be set bitwise- * In the Following the number in the Comment is the BitPosition- */-- var flags = options.Ff || 0;-- // 18, Combo (If not set, the choiceField is a listBox!!)- if (options.combo) {- // Set Flag- flags = AcroForm.internal.setBitPosition(flags, 18);- // Remove combo from FieldObject- delete options.combo;- }-- // 19, Edit- if (options.edit) {- flags = AcroForm.internal.setBitPosition(flags, 19);- delete options.edit;- }-- // 20, Sort- if (options.sort) {- flags = AcroForm.internal.setBitPosition(flags, 20);- delete options.sort;- }-- // 22, MultiSelect (PDF 1.4)- if (options.multiSelect && this.internal.getPDFVersion() >= 1.4) {- flags = AcroForm.internal.setBitPosition(flags, 22);- delete options.multiSelect;- }-- // 23, DoNotSpellCheck (PDF 1.4)- if (options.doNotSpellCheck && this.internal.getPDFVersion() >= 1.4) {- flags = AcroForm.internal.setBitPosition(flags, 23);- delete options.doNotSpellCheck;- }-- options.Ff = flags;-- //options.hasAnnotation = true;-- // Add field- putForm.call(this, options);- };- })(jsPDF.API);-- var AcroForm = window.AcroForm;-- AcroForm.internal = {};-- AcroForm.createFormXObject = function (formObject) {- var xobj = new AcroForm.FormXObject();- var height = AcroForm.Appearance.internal.getHeight(formObject) || 0;- var width = AcroForm.Appearance.internal.getWidth(formObject) || 0;- xobj.BBox = [0, 0, width, height];- return xobj;- };-- // Contains Methods for creating standard appearances- AcroForm.Appearance = {- CheckBox: {- createAppearanceStream: function createAppearanceStream() {- var appearance = {- N: {- On: AcroForm.Appearance.CheckBox.YesNormal- },- D: {- On: AcroForm.Appearance.CheckBox.YesPushDown,- Off: AcroForm.Appearance.CheckBox.OffPushDown- }- };-- return appearance;- },- /**- * If any other icons are needed, the number between the brackets can be changed- * @returns {string}- */- createMK: function createMK() {- // 3-> Hook- return "<< /CA (3)>>";- },- /**- * Returns the standard On Appearance for a CheckBox- * @returns {AcroForm.FormXObject}- */- YesPushDown: function YesPushDown(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- // F13 is ZapfDingbats (Symbolic)- formObject.Q = 1; // set text-alignment as centered- var calcRes = AcroForm.internal.calculateX(formObject, "3", "ZapfDingbats", 50);- stream += "0.749023 g\n\- 0 0 " + AcroForm.Appearance.internal.getWidth(formObject) + " " + AcroForm.Appearance.internal.getHeight(formObject) + " re\n\- f\n\- BMC\n\- q\n\- 0 0 1 rg\n\- /F13 " + calcRes.fontSize + " Tf 0 g\n\- BT\n";- stream += calcRes.text;- stream += "ET\n\- Q\n\- EMC\n";- xobj.stream = stream;- return xobj;- },-- YesNormal: function YesNormal(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- formObject.Q = 1; // set text-alignment as centered- var calcRes = AcroForm.internal.calculateX(formObject, "3", "ZapfDingbats", AcroForm.Appearance.internal.getHeight(formObject) * 0.9);- stream += "1 g\n\-0 0 " + AcroForm.Appearance.internal.getWidth(formObject) + " " + AcroForm.Appearance.internal.getHeight(formObject) + " re\n\-f\n\-q\n\-0 0 1 rg\n\-0 0 " + (AcroForm.Appearance.internal.getWidth(formObject) - 1) + " " + (AcroForm.Appearance.internal.getHeight(formObject) - 1) + " re\n\-W\n\-n\n\-0 g\n\-BT\n\-/F13 " + calcRes.fontSize + " Tf 0 g\n";- stream += calcRes.text;- stream += "ET\n\- Q\n";- xobj.stream = stream;- return xobj;- },-- /**- * Returns the standard Off Appearance for a CheckBox- * @returns {AcroForm.FormXObject}- */- OffPushDown: function OffPushDown(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- stream += "0.749023 g\n\- 0 0 " + AcroForm.Appearance.internal.getWidth(formObject) + " " + AcroForm.Appearance.internal.getHeight(formObject) + " re\n\- f\n";- xobj.stream = stream;- return xobj;- }- },-- RadioButton: {- Circle: {- createAppearanceStream: function createAppearanceStream(name) {- var appearanceStreamContent = {- D: {- 'Off': AcroForm.Appearance.RadioButton.Circle.OffPushDown- },- N: {}- };- appearanceStreamContent.N[name] = AcroForm.Appearance.RadioButton.Circle.YesNormal;- appearanceStreamContent.D[name] = AcroForm.Appearance.RadioButton.Circle.YesPushDown;- return appearanceStreamContent;- },- createMK: function createMK() {- return "<< /CA (l)>>";- },-- YesNormal: function YesNormal(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- // Make the Radius of the Circle relative to min(height, width) of formObject- var DotRadius = AcroForm.Appearance.internal.getWidth(formObject) <= AcroForm.Appearance.internal.getHeight(formObject) ? AcroForm.Appearance.internal.getWidth(formObject) / 4 : AcroForm.Appearance.internal.getHeight(formObject) / 4;- // The Borderpadding...- DotRadius *= 0.9;- var c = AcroForm.Appearance.internal.Bezier_C;- /*- The Following is a Circle created with Bezier-Curves.- */- stream += "q\n\-1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\-" + DotRadius + " 0 m\n\-" + DotRadius + " " + DotRadius * c + " " + DotRadius * c + " " + DotRadius + " 0 " + DotRadius + " c\n\--" + DotRadius * c + " " + DotRadius + " -" + DotRadius + " " + DotRadius * c + " -" + DotRadius + " 0 c\n\--" + DotRadius + " -" + DotRadius * c + " -" + DotRadius * c + " -" + DotRadius + " 0 -" + DotRadius + " c\n\-" + DotRadius * c + " -" + DotRadius + " " + DotRadius + " -" + DotRadius * c + " " + DotRadius + " 0 c\n\-f\n\-Q\n";- xobj.stream = stream;- return xobj;- },- YesPushDown: function YesPushDown(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- var DotRadius = AcroForm.Appearance.internal.getWidth(formObject) <= AcroForm.Appearance.internal.getHeight(formObject) ? AcroForm.Appearance.internal.getWidth(formObject) / 4 : AcroForm.Appearance.internal.getHeight(formObject) / 4;- // The Borderpadding...- DotRadius *= 0.9;- // Save results for later use; no need to waste processor ticks on doing math- var k = DotRadius * 2;- // var c = AcroForm.Appearance.internal.Bezier_C;- var kc = k * AcroForm.Appearance.internal.Bezier_C;- var dc = DotRadius * AcroForm.Appearance.internal.Bezier_C;- // stream += "0.749023 g\n\- // q\n\- // 1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\- // " + DotRadius * 2 + " 0 m\n\- // " + DotRadius * 2 + " " + DotRadius * 2 * c + " " + DotRadius * 2 * c + " " + DotRadius * 2 + " 0 " + DotRadius * 2 + " c\n\- // -" + DotRadius * 2 * c + " " + DotRadius * 2 + " -" + DotRadius * 2 + " " + DotRadius * 2 * c + " -" + DotRadius * 2 + " 0 c\n\- // -" + DotRadius * 2 + " -" + DotRadius * 2 * c + " -" + DotRadius * 2 * c + " -" + DotRadius * 2 + " 0 -" + DotRadius * 2 + " c\n\- // " + DotRadius * 2 * c + " -" + DotRadius * 2 + " " + DotRadius * 2 + " -" + DotRadius * 2 * c + " " + DotRadius * 2 + " 0 c\n\- // f\n\- // Q\n\- // 0 g\n\- // q\n\- // 1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\- // " + DotRadius + " 0 m\n\- // " + DotRadius + " " + DotRadius * c + " " + DotRadius * c + " " + DotRadius + " 0 " + DotRadius + " c\n\- // -" + DotRadius * c + " " + DotRadius + " -" + DotRadius + " " + DotRadius * c + " -" + DotRadius + " 0 c\n\- // -" + DotRadius + " -" + DotRadius * c + " -" + DotRadius * c + " -" + DotRadius + " 0 -" + DotRadius + " c\n\- // " + DotRadius * c + " -" + DotRadius + " " + DotRadius + " -" + DotRadius * c + " " + DotRadius + " 0 c\n\- // f\n\- // Q\n";-- // FASTER VERSION with less processor ticks spent on math operations- stream += "0.749023 g\n\- q\n\- 1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\-" + k + " 0 m\n\-" + k + " " + kc + " " + kc + " " + k + " 0 " + k + " c\n\--" + kc + " " + k + " -" + k + " " + kc + " -" + k + " 0 c\n\--" + k + " -" + kc + " -" + kc + " -" + k + " 0 -" + k + " c\n\-" + kc + " -" + k + " " + k + " -" + kc + " " + k + " 0 c\n\- f\n\- Q\n\- 0 g\n\- q\n\- 1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\-" + DotRadius + " 0 m\n\-" + DotRadius + " " + dc + " " + dc + " " + DotRadius + " 0 " + DotRadius + " c\n\--" + dc + " " + DotRadius + " -" + DotRadius + " " + dc + " -" + DotRadius + " 0 c\n\--" + DotRadius + " -" + dc + " -" + dc + " -" + DotRadius + " 0 -" + DotRadius + " c\n\-" + dc + " -" + DotRadius + " " + DotRadius + " -" + dc + " " + DotRadius + " 0 c\n\- f\n\- Q\n";- xobj.stream = stream;- return xobj;- },- OffPushDown: function OffPushDown(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- var DotRadius = AcroForm.Appearance.internal.getWidth(formObject) <= AcroForm.Appearance.internal.getHeight(formObject) ? AcroForm.Appearance.internal.getWidth(formObject) / 4 : AcroForm.Appearance.internal.getHeight(formObject) / 4;- // The Borderpadding...- DotRadius *= 0.9;- // Save results for later use; no need to waste processor ticks on doing math- var k = DotRadius * 2;- // var c = AcroForm.Appearance.internal.Bezier_C;- var kc = k * AcroForm.Appearance.internal.Bezier_C;- // stream += "0.749023 g\n\- // q\n\- // 1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\- // " + DotRadius * 2 + " 0 m\n\- // " + DotRadius * 2 + " " + DotRadius * 2 * c + " " + DotRadius * 2 * c + " " + DotRadius * 2 + " 0 " + DotRadius * 2 + " c\n\- // -" + DotRadius * 2 * c + " " + DotRadius * 2 + " -" + DotRadius * 2 + " " + DotRadius * 2 * c + " -" + DotRadius * 2 + " 0 c\n\- // -" + DotRadius * 2 + " -" + DotRadius * 2 * c + " -" + DotRadius * 2 * c + " -" + DotRadius * 2 + " 0 -" + DotRadius * 2 + " c\n\- // " + DotRadius * 2 * c + " -" + DotRadius * 2 + " " + DotRadius * 2 + " -" + DotRadius * 2 * c + " " + DotRadius * 2 + " 0 c\n\- // f\n\- // Q\n";-- // FASTER VERSION with less processor ticks spent on math operations- stream += "0.749023 g\n\- q\n\- 1 0 0 1 " + AcroForm.Appearance.internal.getWidth(formObject) / 2 + " " + AcroForm.Appearance.internal.getHeight(formObject) / 2 + " cm\n\-" + k + " 0 m\n\-" + k + " " + kc + " " + kc + " " + k + " 0 " + k + " c\n\--" + kc + " " + k + " -" + k + " " + kc + " -" + k + " 0 c\n\--" + k + " -" + kc + " -" + kc + " -" + k + " 0 -" + k + " c\n\-" + kc + " -" + k + " " + k + " -" + kc + " " + k + " 0 c\n\- f\n\- Q\n";- xobj.stream = stream;- return xobj;- }- },-- Cross: {- /**- * Creates the Actual AppearanceDictionary-References- * @param name- * @returns- */- createAppearanceStream: function createAppearanceStream(name) {- var appearanceStreamContent = {- D: {- 'Off': AcroForm.Appearance.RadioButton.Cross.OffPushDown- },- N: {}- };- appearanceStreamContent.N[name] = AcroForm.Appearance.RadioButton.Cross.YesNormal;- appearanceStreamContent.D[name] = AcroForm.Appearance.RadioButton.Cross.YesPushDown;- return appearanceStreamContent;- },- createMK: function createMK() {- return "<< /CA (8)>>";- },-- YesNormal: function YesNormal(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- var cross = AcroForm.Appearance.internal.calculateCross(formObject);- stream += "q\n\- 1 1 " + (AcroForm.Appearance.internal.getWidth(formObject) - 2) + " " + (AcroForm.Appearance.internal.getHeight(formObject) - 2) + " re\n\- W\n\- n\n\- " + cross.x1.x + " " + cross.x1.y + " m\n\- " + cross.x2.x + " " + cross.x2.y + " l\n\- " + cross.x4.x + " " + cross.x4.y + " m\n\- " + cross.x3.x + " " + cross.x3.y + " l\n\- s\n\- Q\n";- xobj.stream = stream;- return xobj;- },- YesPushDown: function YesPushDown(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var cross = AcroForm.Appearance.internal.calculateCross(formObject);- var stream = "";- stream += "0.749023 g\n\- 0 0 " + AcroForm.Appearance.internal.getWidth(formObject) + " " + AcroForm.Appearance.internal.getHeight(formObject) + " re\n\- f\n\- q\n\- 1 1 " + (AcroForm.Appearance.internal.getWidth(formObject) - 2) + " " + (AcroForm.Appearance.internal.getHeight(formObject) - 2) + " re\n\- W\n\- n\n\- " + cross.x1.x + " " + cross.x1.y + " m\n\- " + cross.x2.x + " " + cross.x2.y + " l\n\- " + cross.x4.x + " " + cross.x4.y + " m\n\- " + cross.x3.x + " " + cross.x3.y + " l\n\- s\n\- Q\n";- xobj.stream = stream;- return xobj;- },- OffPushDown: function OffPushDown(formObject) {- var xobj = AcroForm.createFormXObject(formObject);- var stream = "";- stream += "0.749023 g\n\- 0 0 " + AcroForm.Appearance.internal.getWidth(formObject) + " " + AcroForm.Appearance.internal.getHeight(formObject) + " re\n\- f\n";- xobj.stream = stream;- return xobj;- }- }- },-- /**- * Returns the standard Appearance- * @returns {AcroForm.FormXObject}- */- createDefaultAppearanceStream: function createDefaultAppearanceStream(formObject) {- var stream = "";- // Set Helvetica to Standard Font (size: auto)- // Color: Black- stream += "/Helv 0 Tf 0 g";- return stream;- }- };-- AcroForm.Appearance.internal = {- Bezier_C: 0.551915024494,-- calculateCross: function calculateCross(formObject) {- var min = function min(x, y) {- return x > y ? y : x;- };-- var width = AcroForm.Appearance.internal.getWidth(formObject);- var height = AcroForm.Appearance.internal.getHeight(formObject);- var a = min(width, height);- var crossSize = a;- var borderPadding = 2; // The Padding in px--- var cross = {- x1: { // upperLeft- x: (width - a) / 2,- y: (height - a) / 2 + a },- x2: { // lowerRight- x: (width - a) / 2 + a,- y: (height - a) / 2 //borderPadding- },- x3: { // lowerLeft- x: (width - a) / 2,- y: (height - a) / 2 //borderPadding- },- x4: { // upperRight- x: (width - a) / 2 + a,- y: (height - a) / 2 + a }- };-- return cross;- }- };- AcroForm.Appearance.internal.getWidth = function (formObject) {- return formObject.Rect[2]; //(formObject.Rect[2] - formObject.Rect[0]) || 0;- };- AcroForm.Appearance.internal.getHeight = function (formObject) {- return formObject.Rect[3]; //(formObject.Rect[1] - formObject.Rect[3]) || 0;- };-- // ##########################-- //### For inheritance:- AcroForm.internal.inherit = function (child, parent) {- var ObjectCreate = Object.create || function (o) {- var F = function F() {};- F.prototype = o;- return new F();- };- child.prototype = Object.create(parent.prototype);- child.prototype.constructor = child;- };-- // ### Handy Functions:-- AcroForm.internal.arrayToPdfArray = function (array) {- if (Array.isArray(array)) {- var content = ' [';- for (var i in array) {- var element = array[i].toString();- content += element;- content += i < array.length - 1 ? ' ' : '';- }- content += ']';-- return content;- }- };-- AcroForm.internal.toPdfString = function (string) {- string = string || "";-- // put Bracket at the Beginning of the String- if (string.indexOf('(') !== 0) {- string = '(' + string;- }-- if (string.substring(string.length - 1) != ')') {- string += '(';- }- return string;- };-- // ##########################- // Classes- // ##########################--- AcroForm.PDFObject = function () {- // The Object ID in the PDF Object Model- // todo- var _objId;- Object.defineProperty(this, 'objId', {- get: function get() {- if (!_objId) {- if (this.internal) {- _objId = this.internal.newObjectDeferred();- } else if (jsPDF.API.acroformPlugin.internal) {- // todo - find better option, that doesn't rely on a Global Static var- _objId = jsPDF.API.acroformPlugin.internal.newObjectDeferred();- }- }- if (!_objId) {- console.log("Couldn't create Object ID");- }- return _objId;- },- configurable: false- });- };-- AcroForm.PDFObject.prototype.toString = function () {- return this.objId + " 0 R";- };-- AcroForm.PDFObject.prototype.getString = function () {- var res = this.objId + " 0 obj\n<<";- var content = this.getContent();-- res += content + ">>\n";- if (this.stream) {- res += "stream\n";- res += this.stream;- res += "endstream\n";- }- res += "endobj\n";- return res;- };-- AcroForm.PDFObject.prototype.getContent = function () {- /**- * Prints out all enumerable Variables from the Object- * @param fieldObject- * @returns {string}- */- var createContentFromFieldObject = function createContentFromFieldObject(fieldObject) {- var content = '';-- var keys = Object.keys(fieldObject).filter(function (key) {- return key != 'content' && key != 'appearanceStreamContent' && key.substring(0, 1) != "_";- });-- for (var i in keys) {- var key = keys[i];- var value = fieldObject[key];-- /*if (key == 'Rect' && value) {- value = AcroForm.internal.calculateCoordinates.call(jsPDF.API.acroformPlugin.internal, value);- }*/-- if (value) {- if (Array.isArray(value)) {- content += '/' + key + ' ' + AcroForm.internal.arrayToPdfArray(value) + "\n";- } else if (value instanceof AcroForm.PDFObject) {- // In case it is a reference to another PDFObject, take the referennce number- content += '/' + key + ' ' + value.objId + " 0 R" + "\n";- } else {- content += '/' + key + ' ' + value + '\n';- }- }- }- return content;- };-- var object = "";-- object += createContentFromFieldObject(this);- return object;- };-- AcroForm.FormXObject = function () {- AcroForm.PDFObject.call(this);- this.Type = "/XObject";- this.Subtype = "/Form";- this.FormType = 1;- this.BBox;- this.Matrix;- this.Resources = "2 0 R";- this.PieceInfo;- var _stream;- Object.defineProperty(this, 'Length', {- enumerable: true,- get: function get() {- return _stream !== undefined ? _stream.length : 0;- }- });- Object.defineProperty(this, 'stream', {- enumerable: false,- set: function set(val) {- _stream = val;- },- get: function get() {- if (_stream) {- return _stream;- } else {- return null;- }- }- });- };-- AcroForm.internal.inherit(AcroForm.FormXObject, AcroForm.PDFObject);-- AcroForm.AcroFormDictionary = function () {- AcroForm.PDFObject.call(this);- var _Kids = [];- Object.defineProperty(this, 'Kids', {- enumerable: false,- configurable: true,- get: function get() {- if (_Kids.length > 0) {- return _Kids;- } else {- return;- }- }- });- Object.defineProperty(this, 'Fields', {- enumerable: true,- configurable: true,- get: function get() {- return _Kids;- }- });- // Default Appearance- this.DA;- };-- AcroForm.internal.inherit(AcroForm.AcroFormDictionary, AcroForm.PDFObject);-- // ##### The Objects, the User can Create:--- // The Field Object contains the Variables, that every Field needs- // Rectangle for Appearance: lower_left_X, lower_left_Y, width, height- AcroForm.Field = function () {- 'use strict';-- AcroForm.PDFObject.call(this);-- var _Rect;- Object.defineProperty(this, 'Rect', {- enumerable: true,- configurable: false,- get: function get() {- if (!_Rect) {- return;- }- var tmp = _Rect;- //var calculatedRes = AcroForm.internal.calculateCoordinates(_Rect); // do later!- return tmp;- },- set: function set(val) {- _Rect = val;- }- });-- var _FT = "";- Object.defineProperty(this, 'FT', {- enumerable: true,- set: function set(val) {- _FT = val;- },- get: function get() {- return _FT;- }- });- /**- * The Partial name of the Field Object.- * It has to be unique.- */- var _T;-- Object.defineProperty(this, 'T', {- enumerable: true,- configurable: false,- set: function set(val) {- _T = val;- },- get: function get() {- if (!_T || _T.length < 1) {- if (this instanceof AcroForm.ChildClass) {- // In case of a Child from a Radio´Group, you don't need a FieldName!!!- return;- }- return "(FieldObject" + AcroForm.Field.FieldNum++ + ")";- }- if (_T.substring(0, 1) == "(" && _T.substring(_T.length - 1)) {- return _T;- }- return "(" + _T + ")";- }- });-- var _DA;- // Defines the default appearance (Needed for variable Text)- Object.defineProperty(this, 'DA', {- enumerable: true,- get: function get() {- if (!_DA) {- return;- }- return '(' + _DA + ')';- },- set: function set(val) {- _DA = val;- }- });-- var _DV;- // Defines the default value- Object.defineProperty(this, 'DV', {- enumerable: true,- configurable: true,- get: function get() {- if (!_DV) {- return;- }- return _DV;- },- set: function set(val) {- _DV = val;- }- });-- //this.Type = "/Annot";- //this.Subtype = "/Widget";- Object.defineProperty(this, 'Type', {- enumerable: true,- get: function get() {- return this.hasAnnotation ? "/Annot" : null;- }- });-- Object.defineProperty(this, 'Subtype', {- enumerable: true,- get: function get() {- return this.hasAnnotation ? "/Widget" : null;- }- });-- /**- *- * @type {Array}- */- this.BG;-- Object.defineProperty(this, 'hasAnnotation', {- enumerable: false,- get: function get() {- if (this.Rect || this.BC || this.BG) {- return true;- }- return false;- }- });-- Object.defineProperty(this, 'hasAppearanceStream', {- enumerable: false,- configurable: true,- writable: true- });-- Object.defineProperty(this, 'page', {- enumerable: false,- configurable: true,- writable: true- });- };- AcroForm.Field.FieldNum = 0;-- AcroForm.internal.inherit(AcroForm.Field, AcroForm.PDFObject);-- AcroForm.ChoiceField = function () {- AcroForm.Field.call(this);- // Field Type = Choice Field- this.FT = "/Ch";- // options- this.Opt = [];- this.V = '()';- // Top Index- this.TI = 0;- /**- * Defines, whether the- * @type {boolean}- */- this.combo = false;- /**- * Defines, whether the Choice Field is an Edit Field.- * An Edit Field is automatically an Combo Field.- */- Object.defineProperty(this, 'edit', {- enumerable: true,- set: function set(val) {- if (val == true) {- this._edit = true;- // ComboBox has to be true- this.combo = true;- } else {- this._edit = false;- }- },- get: function get() {- if (!this._edit) {- return false;- }- return this._edit;- },- configurable: false- });- this.hasAppearanceStream = true;- Object.defineProperty(this, 'V', {- get: function get() {- AcroForm.internal.toPdfString();- }- });- };- AcroForm.internal.inherit(AcroForm.ChoiceField, AcroForm.Field);- window["ChoiceField"] = AcroForm.ChoiceField;-- AcroForm.ListBox = function () {- AcroForm.ChoiceField.call(this);- //var combo = true;- };- AcroForm.internal.inherit(AcroForm.ListBox, AcroForm.ChoiceField);- window["ListBox"] = AcroForm.ListBox;-- AcroForm.ComboBox = function () {- AcroForm.ListBox.call(this);- this.combo = true;- };- AcroForm.internal.inherit(AcroForm.ComboBox, AcroForm.ListBox);- window["ComboBox"] = AcroForm.ComboBox;-- AcroForm.EditBox = function () {- AcroForm.ComboBox.call(this);- this.edit = true;- };- AcroForm.internal.inherit(AcroForm.EditBox, AcroForm.ComboBox);- window["EditBox"] = AcroForm.EditBox;-- AcroForm.Button = function () {- AcroForm.Field.call(this);- this.FT = "/Btn";- //this.hasAnnotation = true;- };- AcroForm.internal.inherit(AcroForm.Button, AcroForm.Field);- window["Button"] = AcroForm.Button;-- AcroForm.PushButton = function () {- AcroForm.Button.call(this);- this.pushbutton = true;- };- AcroForm.internal.inherit(AcroForm.PushButton, AcroForm.Button);- window["PushButton"] = AcroForm.PushButton;-- AcroForm.RadioButton = function () {- AcroForm.Button.call(this);- this.radio = true;- var _Kids = [];- Object.defineProperty(this, 'Kids', {- enumerable: true,- get: function get() {- if (_Kids.length > 0) {- return _Kids;- }- }- });-- Object.defineProperty(this, '__Kids', {- get: function get() {- return _Kids;- }- });-- var _noToggleToOff;-- Object.defineProperty(this, 'noToggleToOff', {- enumerable: false,- get: function get() {- return _noToggleToOff;- },- set: function set(val) {- _noToggleToOff = val;- }- });-- //this.hasAnnotation = false;- };- AcroForm.internal.inherit(AcroForm.RadioButton, AcroForm.Button);- window["RadioButton"] = AcroForm.RadioButton;-- /*- * The Child classs of a RadioButton (the radioGroup)- * -> The single Buttons- */- AcroForm.ChildClass = function (parent, name) {- AcroForm.Field.call(this);- this.Parent = parent;-- // todo: set AppearanceType as variable that can be set from the outside...- this._AppearanceType = AcroForm.Appearance.RadioButton.Circle; // The Default appearanceType is the Circle- this.appearanceStreamContent = this._AppearanceType.createAppearanceStream(name);-- // Set Print in the Annot Flag- this.F = AcroForm.internal.setBitPosition(this.F, 3, 1);-- // Set AppearanceCharacteristicsDictionary with default appearance if field is not interacting with user- this.MK = this._AppearanceType.createMK(); // (8) -> Cross, (1)-> Circle, ()-> nothing-- // Default Appearance is Off- this.AS = "/Off"; // + name;-- this._Name = name;- };- AcroForm.internal.inherit(AcroForm.ChildClass, AcroForm.Field);-- AcroForm.RadioButton.prototype.setAppearance = function (appearance) {- if (!('createAppearanceStream' in appearance && 'createMK' in appearance)) {- console.log("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");- return;- }- for (var i in this.__Kids) {- var child = this.__Kids[i];-- child.appearanceStreamContent = appearance.createAppearanceStream(child._Name);- child.MK = appearance.createMK();- }- };-- AcroForm.RadioButton.prototype.createOption = function (name) {- var parent = this;- var kidCount = this.__Kids.length;-- // Create new Child for RadioGroup- var child = new AcroForm.ChildClass(parent, name);- // Add to Parent- this.__Kids.push(child);-- jsPDF.API.addField(child);-- return child;- };-- AcroForm.CheckBox = function () {- Button.call(this);- this.appearanceStreamContent = AcroForm.Appearance.CheckBox.createAppearanceStream();- this.MK = AcroForm.Appearance.CheckBox.createMK();- this.AS = "/On";- this.V = "/On";- };- AcroForm.internal.inherit(AcroForm.CheckBox, AcroForm.Button);- window["CheckBox"] = AcroForm.CheckBox;-- AcroForm.TextField = function () {- AcroForm.Field.call(this);- this.DA = AcroForm.Appearance.createDefaultAppearanceStream();- this.F = 4;- var _V;- Object.defineProperty(this, 'V', {- get: function get() {- if (_V) {- return "(" + _V + ")";- } else {- return _V;- }- },- enumerable: true,- set: function set(val) {- _V = val;- }- });-- var _DV;- Object.defineProperty(this, 'DV', {- get: function get() {- if (_DV) {- return "(" + _DV + ")";- } else {- return _DV;- }- },- enumerable: true,- set: function set(val) {- _DV = val;- }- });-- var _multiline = false;- Object.defineProperty(this, 'multiline', {- enumerable: false,- get: function get() {- return _multiline;- },- set: function set(val) {- _multiline = val;- }- });-- //this.multiline = false;- //this.password = false;- /**- * For PDF 1.4- * @type {boolean}- */- //this.fileSelect = false;- /**- * For PDF 1.4- * @type {boolean}- */- //this.doNotSpellCheck = false;- /**- * For PDF 1.4- * @type {boolean}- */- //this.doNotScroll = false;-- var _MaxLen = false;- Object.defineProperty(this, 'MaxLen', {- enumerable: true,- get: function get() {- return _MaxLen;- },- set: function set(val) {- _MaxLen = val;- }- });-- Object.defineProperty(this, 'hasAppearanceStream', {- enumerable: false,- get: function get() {- return this.V || this.DV;- }- });- };- AcroForm.internal.inherit(AcroForm.TextField, AcroForm.Field);- window["TextField"] = AcroForm.TextField;-- AcroForm.PasswordField = function () {- TextField.call(this);- Object.defineProperty(this, 'password', {- value: true,- enumerable: false,- configurable: false,- writable: false- });- };- AcroForm.internal.inherit(AcroForm.PasswordField, AcroForm.TextField);- window["PasswordField"] = AcroForm.PasswordField;-- // ############ internal functions-- /*- * small workaround for calculating the TextMetric approximately- * @param text- * @param fontsize- * @returns {TextMetrics} (Has Height and Width)- */- AcroForm.internal.calculateFontSpace = function (text, fontsize, fonttype) {- var fonttype = fonttype || "helvetica";- //re-use canvas object for speed improvements- var canvas = AcroForm.internal.calculateFontSpace.canvas || (AcroForm.internal.calculateFontSpace.canvas = document.createElement('canvas'));-- var context = canvas.getContext('2d');- context.save();- var newFont = fontsize + " " + fonttype;- context.font = newFont;- var res = context.measureText(text);- context.fontcolor = 'black';- // Calculate height:- var context = canvas.getContext('2d');- res.height = context.measureText("3").width * 1.5; // 3 because in ZapfDingbats its a Hook and a 3 in normal fonts- context.restore();-- var width = res.width;-- return res;- };-- AcroForm.internal.calculateX = function (formObject, text, font, maxFontSize) {- var maxFontSize = maxFontSize || 12;- var font = font || "helvetica";- var returnValue = {- text: "",- fontSize: ""- };- // Remove Brackets- text = text.substr(0, 1) == '(' ? text.substr(1) : text;- text = text.substr(text.length - 1) == ')' ? text.substr(0, text.length - 1) : text;- // split into array of words- var textSplit = text.split(' ');-- /**- * the color could be ((alpha)||(r,g,b)||(c,m,y,k))- * @type {string}- */- var color = "0 g\n";- var fontSize = maxFontSize; // The Starting fontSize (The Maximum)- var lineSpacing = 2;- var borderPadding = 2;-- var height = AcroForm.Appearance.internal.getHeight(formObject) || 0;- height = height < 0 ? -height : height;- var width = AcroForm.Appearance.internal.getWidth(formObject) || 0;- width = width < 0 ? -width : width;-- var isSmallerThanWidth = function isSmallerThanWidth(i, lastLine, fontSize) {- if (i + 1 < textSplit.length) {- var tmp = lastLine + " " + textSplit[i + 1];- var TextWidth = AcroForm.internal.calculateFontSpace(tmp, fontSize + "px", font).width;- var FieldWidth = width - 2 * borderPadding;- return TextWidth <= FieldWidth;- } else {- return false;- }- };-- fontSize++;- FontSize: while (true) {- var text = "";- fontSize--;- var textHeight = AcroForm.internal.calculateFontSpace("3", fontSize + "px", font).height;- var startY = formObject.multiline ? height - fontSize : (height - textHeight) / 2;- startY += lineSpacing;- var startX = -borderPadding;-- var lastX = startX,- lastY = startY;- var firstWordInLine = 0,- lastWordInLine = 0;- var lastLength = 0;-- var y = 0;- if (fontSize == 0) {- // In case, the Text doesn't fit at all- fontSize = 12;- text = "(...) Tj\n";- text += "% Width of Text: " + AcroForm.internal.calculateFontSpace(text, "1px").width + ", FieldWidth:" + width + "\n";- break;- }-- lastLength = AcroForm.internal.calculateFontSpace(textSplit[0] + " ", fontSize + "px", font).width;-- var lastLine = "";- var lineCount = 0;- Line: for (var i in textSplit) {- lastLine += textSplit[i] + " ";- // Remove last blank- lastLine = lastLine.substr(lastLine.length - 1) == " " ? lastLine.substr(0, lastLine.length - 1) : lastLine;- var key = parseInt(i);- lastLength = AcroForm.internal.calculateFontSpace(lastLine + " ", fontSize + "px", font).width;- var nextLineIsSmaller = isSmallerThanWidth(key, lastLine, fontSize);- var isLastWord = i >= textSplit.length - 1;- if (nextLineIsSmaller && !isLastWord) {- lastLine += " ";- continue; // Line- } else if (!nextLineIsSmaller && !isLastWord) {- if (!formObject.multiline) {- continue FontSize;- } else {- if ((textHeight + lineSpacing) * (lineCount + 2) + lineSpacing > height) {- // If the Text is higher than the FieldObject- continue FontSize;- }- lastWordInLine = key;- // go on- }- } else if (isLastWord) {- lastWordInLine = key;- } else {- if (formObject.multiline && (textHeight + lineSpacing) * (lineCount + 2) + lineSpacing > height) {- // If the Text is higher than the FieldObject- continue FontSize;- }- }-- var line = '';-- for (var x = firstWordInLine; x <= lastWordInLine; x++) {- line += textSplit[x] + ' ';- }-- // Remove last blank- line = line.substr(line.length - 1) == " " ? line.substr(0, line.length - 1) : line;- //lastLength -= blankSpace.width;- lastLength = AcroForm.internal.calculateFontSpace(line, fontSize + "px", font).width;-- // Calculate startX- switch (formObject.Q) {- case 2:- // Right justified- startX = width - lastLength - borderPadding;- break;- case 1:- // Q = 1 := Text-Alignment: Center- startX = (width - lastLength) / 2;- break;- case 0:- default:- startX = borderPadding;- break;- }- text += startX + ' ' + lastY + ' Td\n';- text += '(' + line + ') Tj\n';- // reset X in PDF- text += -startX + ' 0 Td\n';-- // After a Line, adjust y position- lastY = -(fontSize + lineSpacing);- lastX = startX;-- // Reset for next iteration step- lastLength = 0;- firstWordInLine = lastWordInLine + 1;- lineCount++;-- lastLine = "";- continue Line;- }- break;- }-- returnValue.text = text;- returnValue.fontSize = fontSize;-- return returnValue;- };-- AcroForm.internal.calculateAppearanceStream = function (formObject) {- if (formObject.appearanceStreamContent) {- // If appearanceStream is already set, use it- return formObject.appearanceStreamContent;- }-- if (!formObject.V && !formObject.DV) {- return;- }-- // else calculate it-- var stream = '';-- var text = formObject.V || formObject.DV;-- var calcRes = AcroForm.internal.calculateX(formObject, text);-- stream += '/Tx BMC\n' + 'q\n' +- //color + '\n' +- '/F1 ' + calcRes.fontSize + ' Tf\n' +- // Text Matrix- '1 0 0 1 0 0 Tm\n';- // Begin Text- stream += 'BT\n';- stream += calcRes.text;- // End Text- stream += 'ET\n';- stream += 'Q\n' + 'EMC\n';-- var appearanceStreamContent = new AcroForm.createFormXObject(formObject);-- appearanceStreamContent.stream = stream;-- var appearance = {- N: {- 'Normal': appearanceStreamContent- }- };-- return appearanceStreamContent;- };-- /*- * Converts the Parameters from x,y,w,h to lowerLeftX, lowerLeftY, upperRightX, upperRightY- * @param x- * @param y- * @param w- * @param h- * @returns {*[]}- */- AcroForm.internal.calculateCoordinates = function (x, y, w, h) {- var coordinates = {};-- if (this.internal) {- var mmtopx = function mmtopx(x) {- return x * this.internal.scaleFactor;- };-- if (Array.isArray(x)) {- x[0] = AcroForm.scale(x[0]);- x[1] = AcroForm.scale(x[1]);- x[2] = AcroForm.scale(x[2]);- x[3] = AcroForm.scale(x[3]);-- coordinates.lowerLeft_X = x[0] || 0;- coordinates.lowerLeft_Y = mmtopx.call(this, this.internal.pageSize.height) - x[3] - x[1] || 0;- coordinates.upperRight_X = x[0] + x[2] || 0;- coordinates.upperRight_Y = mmtopx.call(this, this.internal.pageSize.height) - x[1] || 0;- } else {- x = AcroForm.scale(x);- y = AcroForm.scale(y);- w = AcroForm.scale(w);- h = AcroForm.scale(h);- coordinates.lowerLeft_X = x || 0;- coordinates.lowerLeft_Y = this.internal.pageSize.height - y || 0;- coordinates.upperRight_X = x + w || 0;- coordinates.upperRight_Y = this.internal.pageSize.height - y + h || 0;- }- } else {- // old method, that is fallback, if we can't get the pageheight, the coordinate-system starts from lower left- if (Array.isArray(x)) {- coordinates.lowerLeft_X = x[0] || 0;- coordinates.lowerLeft_Y = x[1] || 0;- coordinates.upperRight_X = x[0] + x[2] || 0;- coordinates.upperRight_Y = x[1] + x[3] || 0;- } else {- coordinates.lowerLeft_X = x || 0;- coordinates.lowerLeft_Y = y || 0;- coordinates.upperRight_X = x + w || 0;- coordinates.upperRight_Y = y + h || 0;- }- }-- return [coordinates.lowerLeft_X, coordinates.lowerLeft_Y, coordinates.upperRight_X, coordinates.upperRight_Y];- };-- AcroForm.internal.calculateColor = function (r, g, b) {- var color = new Array(3);- color.r = r | 0;- color.g = g | 0;- color.b = b | 0;- return color;- };-- AcroForm.internal.getBitPosition = function (variable, position) {- variable = variable || 0;- var bitMask = 1;- bitMask = bitMask << position - 1;- return variable | bitMask;- };-- AcroForm.internal.setBitPosition = function (variable, position, value) {- variable = variable || 0;- value = value || 1;-- var bitMask = 1;- bitMask = bitMask << position - 1;-- if (value == 1) {- // Set the Bit to 1- var variable = variable | bitMask;- } else {- // Set the Bit to 0- var variable = variable & ~bitMask;- }-- return variable;- };-- /**- * jsPDF addHTML PlugIn- * Copyright (c) 2014 Diego Casorran- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- (function (jsPDFAPI) {- 'use strict';-- /**- * Renders an HTML element to canvas object which added to the PDF- *- * This PlugIn requires html2canvas: https://github.com/niklasvh/html2canvas- * OR rasterizeHTML: https://github.com/cburgmer/rasterizeHTML.js- *- * @public- * @function- * @param element {Mixed} HTML Element, or anything supported by html2canvas.- * @param x {Number} starting X coordinate in jsPDF instance's declared units.- * @param y {Number} starting Y coordinate in jsPDF instance's declared units.- * @param options {Object} Additional options, check the code below.- * @param callback {Function} to call when the rendering has finished.- *- * NOTE: Every parameter is optional except 'element' and 'callback', in such- * case the image is positioned at 0x0 covering the whole PDF document- * size. Ie, to easily take screenshots of webpages saving them to PDF.- */-- jsPDFAPI.addHTML = function (element, x, y, options, callback) {- 'use strict';-- if (typeof html2canvas === 'undefined' && typeof rasterizeHTML === 'undefined') throw new Error('You need either ' + 'https://github.com/niklasvh/html2canvas' + ' or https://github.com/cburgmer/rasterizeHTML.js');-- if (typeof x !== 'number') {- options = x;- callback = y;- }-- if (typeof options === 'function') {- callback = options;- options = null;- }-- var I = this.internal,- K = I.scaleFactor,- W = I.pageSize.width,- H = I.pageSize.height;-- options = options || {};- options.onrendered = function (obj) {- x = parseInt(x) || 0;- y = parseInt(y) || 0;- var dim = options.dim || {};- var h = dim.h || 0;- var w = dim.w || Math.min(W, obj.width / K) - x;-- var format = 'JPEG';- if (options.format) format = options.format;-- if (obj.height > H && options.pagesplit) {- var crop = function () {- var cy = 0;- while (1) {- var canvas = document.createElement('canvas');- canvas.width = Math.min(W * K, obj.width);- canvas.height = Math.min(H * K, obj.height - cy);- var ctx = canvas.getContext('2d');- ctx.drawImage(obj, 0, cy, obj.width, canvas.height, 0, 0, canvas.width, canvas.height);- var args = [canvas, x, cy ? 0 : y, canvas.width / K, canvas.height / K, format, null, 'SLOW'];- this.addImage.apply(this, args);- cy += canvas.height;- if (cy >= obj.height) break;- this.addPage();- }- callback(w, cy, null, args);- }.bind(this);- if (obj.nodeName === 'CANVAS') {- var img = new Image();- img.onload = crop;- img.src = obj.toDataURL("image/png");- obj = img;- } else {- crop();- }- } else {- var alias = Math.random().toString(35);- var args = [obj, x, y, w, h, format, alias, 'SLOW'];-- this.addImage.apply(this, args);-- callback(w, h, alias, args);- }- }.bind(this);-- if (typeof html2canvas !== 'undefined' && !options.rstz) {- return html2canvas(element, options);- }-- if (typeof rasterizeHTML !== 'undefined') {- var meth = 'drawDocument';- if (typeof element === 'string') {- meth = /^http/.test(element) ? 'drawURL' : 'drawHTML';- }- options.width = options.width || W * K;- return rasterizeHTML[meth](element, void 0, options).then(function (r) {- options.onrendered(r.image);- }, function (e) {- callback(null, e);- });- }-- return null;- };- })(jsPDF.API);-- /** @preserve- * jsPDF addImage plugin- * Copyright (c) 2012 Jason Siefken, https://github.com/siefkenj/- * 2013 Chris Dowling, https://github.com/gingerchris- * 2013 Trinh Ho, https://github.com/ineedfat- * 2013 Edwin Alejandro Perez, https://github.com/eaparango- * 2013 Norah Smith, https://github.com/burnburnrocket- * 2014 Diego Casorran, https://github.com/diegocr- * 2014 James Robb, https://github.com/jamesbrobb- *- *- */-- ;(function (jsPDFAPI) {- 'use strict';-- var namespace = 'addImage_',- supported_image_types = ['jpeg', 'jpg', 'png'];-- // Image functionality ported from pdf.js- var putImage = function putImage(img) {-- var objectNumber = this.internal.newObject(),- out = this.internal.write,- putStream = this.internal.putStream;-- img['n'] = objectNumber;-- out('<</Type /XObject');- out('/Subtype /Image');- out('/Width ' + img['w']);- out('/Height ' + img['h']);- if (img['cs'] === this.color_spaces.INDEXED) {- out('/ColorSpace [/Indexed /DeviceRGB '- // if an indexed png defines more than one colour with transparency, we've created a smask- + (img['pal'].length / 3 - 1) + ' ' + ('smask' in img ? objectNumber + 2 : objectNumber + 1) + ' 0 R]');- } else {- out('/ColorSpace /' + img['cs']);- if (img['cs'] === this.color_spaces.DEVICE_CMYK) {- out('/Decode [1 0 1 0 1 0 1 0]');- }- }- out('/BitsPerComponent ' + img['bpc']);- if ('f' in img) {- out('/Filter /' + img['f']);- }- if ('dp' in img) {- out('/DecodeParms <<' + img['dp'] + '>>');- }- if ('trns' in img && img['trns'].constructor == Array) {- var trns = '',- i = 0,- len = img['trns'].length;- for (; i < len; i++) {- trns += img['trns'][i] + ' ' + img['trns'][i] + ' ';- }out('/Mask [' + trns + ']');- }- if ('smask' in img) {- out('/SMask ' + (objectNumber + 1) + ' 0 R');- }- out('/Length ' + img['data'].length + '>>');-- putStream(img['data']);-- out('endobj');-- // Soft mask- if ('smask' in img) {- var dp = '/Predictor ' + img['p'] + ' /Colors 1 /BitsPerComponent ' + img['bpc'] + ' /Columns ' + img['w'];- var smask = { 'w': img['w'], 'h': img['h'], 'cs': 'DeviceGray', 'bpc': img['bpc'], 'dp': dp, 'data': img['smask'] };- if ('f' in img) smask.f = img['f'];- putImage.call(this, smask);- }-- //Palette- if (img['cs'] === this.color_spaces.INDEXED) {-- this.internal.newObject();- //out('<< /Filter / ' + img['f'] +' /Length ' + img['pal'].length + '>>');- //putStream(zlib.compress(img['pal']));- out('<< /Length ' + img['pal'].length + '>>');- putStream(this.arrayBufferToBinaryString(new Uint8Array(img['pal'])));- out('endobj');- }- },- putResourcesCallback = function putResourcesCallback() {- var images = this.internal.collections[namespace + 'images'];- for (var i in images) {- putImage.call(this, images[i]);- }- },- putXObjectsDictCallback = function putXObjectsDictCallback() {- var images = this.internal.collections[namespace + 'images'],- out = this.internal.write,- image;- for (var i in images) {- image = images[i];- out('/I' + image['i'], image['n'], '0', 'R');- }- },- checkCompressValue = function checkCompressValue(value) {- if (value && typeof value === 'string') value = value.toUpperCase();- return value in jsPDFAPI.image_compression ? value : jsPDFAPI.image_compression.NONE;- },- getImages = function getImages() {- var images = this.internal.collections[namespace + 'images'];- //first run, so initialise stuff- if (!images) {- this.internal.collections[namespace + 'images'] = images = {};- this.internal.events.subscribe('putResources', putResourcesCallback);- this.internal.events.subscribe('putXobjectDict', putXObjectsDictCallback);- }-- return images;- },- getImageIndex = function getImageIndex(images) {- var imageIndex = 0;-- if (images) {- // this is NOT the first time this method is ran on this instance of jsPDF object.- imageIndex = Object.keys ? Object.keys(images).length : function (o) {- var i = 0;- for (var e in o) {- if (o.hasOwnProperty(e)) {- i++;- }- }- return i;- }(images);- }-- return imageIndex;- },- notDefined = function notDefined(value) {- return typeof value === 'undefined' || value === null;- },- generateAliasFromData = function generateAliasFromData(data) {- return typeof data === 'string' && jsPDFAPI.sHashCode(data);- },- doesNotSupportImageType = function doesNotSupportImageType(type) {- return supported_image_types.indexOf(type) === -1;- },- processMethodNotEnabled = function processMethodNotEnabled(type) {- return typeof jsPDFAPI['process' + type.toUpperCase()] !== 'function';- },- isDOMElement = function isDOMElement(object) {- return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object.nodeType === 1;- },- createDataURIFromElement = function createDataURIFromElement(element, format, angle) {-- //if element is an image which uses data url definition, just return the dataurl- if (element.nodeName === 'IMG' && element.hasAttribute('src')) {- var src = '' + element.getAttribute('src');- if (!angle && src.indexOf('data:image/') === 0) return src;-- // only if the user doesn't care about a format- if (!format && /\.png(?:[?#].*)?$/i.test(src)) format = 'png';- }-- if (element.nodeName === 'CANVAS') {- var canvas = element;- } else {- var canvas = document.createElement('canvas');- canvas.width = element.clientWidth || element.width;- canvas.height = element.clientHeight || element.height;-- var ctx = canvas.getContext('2d');- if (!ctx) {- throw 'addImage requires canvas to be supported by browser.';- }- if (angle) {- var x,- y,- b,- c,- s,- w,- h,- to_radians = Math.PI / 180,- angleInRadians;-- if ((typeof angle === 'undefined' ? 'undefined' : _typeof(angle)) === 'object') {- x = angle.x;- y = angle.y;- b = angle.bg;- angle = angle.angle;- }- angleInRadians = angle * to_radians;- c = Math.abs(Math.cos(angleInRadians));- s = Math.abs(Math.sin(angleInRadians));- w = canvas.width;- h = canvas.height;- canvas.width = h * s + w * c;- canvas.height = h * c + w * s;-- if (isNaN(x)) x = canvas.width / 2;- if (isNaN(y)) y = canvas.height / 2;-- ctx.clearRect(0, 0, canvas.width, canvas.height);- ctx.fillStyle = b || 'white';- ctx.fillRect(0, 0, canvas.width, canvas.height);- ctx.save();- ctx.translate(x, y);- ctx.rotate(angleInRadians);- ctx.drawImage(element, -(w / 2), -(h / 2));- ctx.rotate(-angleInRadians);- ctx.translate(-x, -y);- ctx.restore();- } else {- ctx.drawImage(element, 0, 0, canvas.width, canvas.height);- }- }- return canvas.toDataURL(('' + format).toLowerCase() == 'png' ? 'image/png' : 'image/jpeg');- },- checkImagesForAlias = function checkImagesForAlias(alias, images) {- var cached_info;- if (images) {- for (var e in images) {- if (alias === images[e].alias) {- cached_info = images[e];- break;- }- }- }- return cached_info;- },- determineWidthAndHeight = function determineWidthAndHeight(w, h, info) {- if (!w && !h) {- w = -96;- h = -96;- }- if (w < 0) {- w = -1 * info['w'] * 72 / w / this.internal.scaleFactor;- }- if (h < 0) {- h = -1 * info['h'] * 72 / h / this.internal.scaleFactor;- }- if (w === 0) {- w = h * info['w'] / info['h'];- }- if (h === 0) {- h = w * info['h'] / info['w'];- }-- return [w, h];- },- writeImageToPDF = function writeImageToPDF(x, y, w, h, info, index, images) {- var dims = determineWidthAndHeight.call(this, w, h, info),- coord = this.internal.getCoordinateString,- vcoord = this.internal.getVerticalCoordinateString;-- w = dims[0];- h = dims[1];-- images[index] = info;-- this.internal.write('q', coord(w), '0 0', coord(h) // TODO: check if this should be shifted by vcoord- , coord(x), vcoord(y + h), 'cm /I' + info['i'], 'Do Q');- };-- /**- * COLOR SPACES- */- jsPDFAPI.color_spaces = {- DEVICE_RGB: 'DeviceRGB',- DEVICE_GRAY: 'DeviceGray',- DEVICE_CMYK: 'DeviceCMYK',- CAL_GREY: 'CalGray',- CAL_RGB: 'CalRGB',- LAB: 'Lab',- ICC_BASED: 'ICCBased',- INDEXED: 'Indexed',- PATTERN: 'Pattern',- SEPARATION: 'Separation',- DEVICE_N: 'DeviceN'- };-- /**- * DECODE METHODS- */- jsPDFAPI.decode = {- DCT_DECODE: 'DCTDecode',- FLATE_DECODE: 'FlateDecode',- LZW_DECODE: 'LZWDecode',- JPX_DECODE: 'JPXDecode',- JBIG2_DECODE: 'JBIG2Decode',- ASCII85_DECODE: 'ASCII85Decode',- ASCII_HEX_DECODE: 'ASCIIHexDecode',- RUN_LENGTH_DECODE: 'RunLengthDecode',- CCITT_FAX_DECODE: 'CCITTFaxDecode'- };-- /**- * IMAGE COMPRESSION TYPES- */- jsPDFAPI.image_compression = {- NONE: 'NONE',- FAST: 'FAST',- MEDIUM: 'MEDIUM',- SLOW: 'SLOW'- };-- jsPDFAPI.sHashCode = function (str) {- return Array.prototype.reduce && str.split("").reduce(function (a, b) {- a = (a << 5) - a + b.charCodeAt(0);return a & a;- }, 0);- };-- jsPDFAPI.isString = function (object) {- return typeof object === 'string';- };-- /**- * Strips out and returns info from a valid base64 data URI- * @param {String[dataURI]} a valid data URI of format 'data:[<MIME-type>][;base64],<data>'- * @returns an Array containing the following- * [0] the complete data URI- * [1] <MIME-type>- * [2] format - the second part of the mime-type i.e 'png' in 'image/png'- * [4] <data>- */- jsPDFAPI.extractInfoFromBase64DataURI = function (dataURI) {- return (/^data:([\w]+?\/([\w]+?));base64,(.+?)$/g.exec(dataURI)- );- };-- /**- * Check to see if ArrayBuffer is supported- */- jsPDFAPI.supportsArrayBuffer = function () {- return typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined';- };-- /**- * Tests supplied object to determine if ArrayBuffer- * @param {Object[object]}- */- jsPDFAPI.isArrayBuffer = function (object) {- if (!this.supportsArrayBuffer()) return false;- return object instanceof ArrayBuffer;- };-- /**- * Tests supplied object to determine if it implements the ArrayBufferView (TypedArray) interface- * @param {Object[object]}- */- jsPDFAPI.isArrayBufferView = function (object) {- if (!this.supportsArrayBuffer()) return false;- if (typeof Uint32Array === 'undefined') return false;- return object instanceof Int8Array || object instanceof Uint8Array || typeof Uint8ClampedArray !== 'undefined' && object instanceof Uint8ClampedArray || object instanceof Int16Array || object instanceof Uint16Array || object instanceof Int32Array || object instanceof Uint32Array || object instanceof Float32Array || object instanceof Float64Array;- };-- /**- * Exactly what it says on the tin- */- jsPDFAPI.binaryStringToUint8Array = function (binary_string) {- /*- * not sure how efficient this will be will bigger files. Is there a native method?- */- var len = binary_string.length;- var bytes = new Uint8Array(len);- for (var i = 0; i < len; i++) {- bytes[i] = binary_string.charCodeAt(i);- }- return bytes;- };-- /**- * @see this discussion- * http://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers- *- * As stated, i imagine the method below is highly inefficent for large files.- *- * Also of note from Mozilla,- *- * "However, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats)."- *- * https://developer.mozilla.org/en-US/Add-ons/Code_snippets/StringView- *- * Although i'm strugglig to see how StringView solves this issue? Doesn't appear to be a direct method for conversion?- *- * Async method using Blob and FileReader could be best, but i'm not sure how to fit it into the flow?- */- jsPDFAPI.arrayBufferToBinaryString = function (buffer) {- /*if('TextDecoder' in window){- var decoder = new TextDecoder('ascii');- return decoder.decode(buffer);- }*/-- if (this.isArrayBuffer(buffer)) buffer = new Uint8Array(buffer);-- var binary_string = '';- var len = buffer.byteLength;- for (var i = 0; i < len; i++) {- binary_string += String.fromCharCode(buffer[i]);- }- return binary_string;- /*- * Another solution is the method below - convert array buffer straight to base64 and then use atob- */- //return atob(this.arrayBufferToBase64(buffer));- };-- /**- * Converts an ArrayBuffer directly to base64- *- * Taken from here- *- * http://jsperf.com/encoding-xhr-image-data/31- *- * Need to test if this is a better solution for larger files- *- */- jsPDFAPI.arrayBufferToBase64 = function (arrayBuffer) {- var base64 = '';- var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';-- var bytes = new Uint8Array(arrayBuffer);- var byteLength = bytes.byteLength;- var byteRemainder = byteLength % 3;- var mainLength = byteLength - byteRemainder;-- var a, b, c, d;- var chunk;-- // Main loop deals with bytes in chunks of 3- for (var i = 0; i < mainLength; i = i + 3) {- // Combine the three bytes into a single integer- chunk = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2];-- // Use bitmasks to extract 6-bit segments from the triplet- a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18- b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12- c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6- d = chunk & 63; // 63 = 2^6 - 1-- // Convert the raw binary segments to the appropriate ASCII encoding- base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];- }-- // Deal with the remaining bytes and padding- if (byteRemainder == 1) {- chunk = bytes[mainLength];-- a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2-- // Set the 4 least significant bits to zero- b = (chunk & 3) << 4; // 3 = 2^2 - 1-- base64 += encodings[a] + encodings[b] + '==';- } else if (byteRemainder == 2) {- chunk = bytes[mainLength] << 8 | bytes[mainLength + 1];-- a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10- b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4-- // Set the 2 least significant bits to zero- c = (chunk & 15) << 2; // 15 = 2^4 - 1-- base64 += encodings[a] + encodings[b] + encodings[c] + '=';- }-- return base64;- };-- jsPDFAPI.createImageInfo = function (data, wd, ht, cs, bpc, f, imageIndex, alias, dp, trns, pal, smask, p) {- var info = {- alias: alias,- w: wd,- h: ht,- cs: cs,- bpc: bpc,- i: imageIndex,- data: data- // n: objectNumber will be added by putImage code- };-- if (f) info.f = f;- if (dp) info.dp = dp;- if (trns) info.trns = trns;- if (pal) info.pal = pal;- if (smask) info.smask = smask;- if (p) info.p = p; // predictor parameter for PNG compression-- return info;- };-- jsPDFAPI.addImage = function (imageData, format, x, y, w, h, alias, compression, rotation) {- 'use strict';-- if (typeof format !== 'string') {- var tmp = h;- h = w;- w = y;- y = x;- x = format;- format = tmp;- }-- if ((typeof imageData === 'undefined' ? 'undefined' : _typeof(imageData)) === 'object' && !isDOMElement(imageData) && "imageData" in imageData) {- var options = imageData;-- imageData = options.imageData;- format = options.format || format;- x = options.x || x || 0;- y = options.y || y || 0;- w = options.w || w;- h = options.h || h;- alias = options.alias || alias;- compression = options.compression || compression;- rotation = options.rotation || options.angle || rotation;- }-- if (isNaN(x) || isNaN(y)) {- console.error('jsPDF.addImage: Invalid coordinates', arguments);- throw new Error('Invalid coordinates passed to jsPDF.addImage');- }-- var images = getImages.call(this),- info;-- if (!(info = checkImagesForAlias(imageData, images))) {- var dataAsBinaryString;-- if (isDOMElement(imageData)) imageData = createDataURIFromElement(imageData, format, rotation);-- if (notDefined(alias)) alias = generateAliasFromData(imageData);-- if (!(info = checkImagesForAlias(alias, images))) {-- if (this.isString(imageData)) {-- var base64Info = this.extractInfoFromBase64DataURI(imageData);-- if (base64Info) {-- format = base64Info[2];- imageData = atob(base64Info[3]); //convert to binary string- } else {-- if (imageData.charCodeAt(0) === 0x89 && imageData.charCodeAt(1) === 0x50 && imageData.charCodeAt(2) === 0x4e && imageData.charCodeAt(3) === 0x47) format = 'png';- }- }- format = (format || 'JPEG').toLowerCase();-- if (doesNotSupportImageType(format)) throw new Error('addImage currently only supports formats ' + supported_image_types + ', not \'' + format + '\'');-- if (processMethodNotEnabled(format)) throw new Error('please ensure that the plugin for \'' + format + '\' support is added');-- /**- * need to test if it's more efficient to convert all binary strings- * to TypedArray - or should we just leave and process as string?- */- if (this.supportsArrayBuffer()) {- // no need to convert if imageData is already uint8array- if (!(imageData instanceof Uint8Array)) {- dataAsBinaryString = imageData;- imageData = this.binaryStringToUint8Array(imageData);- }- }-- info = this['process' + format.toUpperCase()](imageData, getImageIndex(images), alias, checkCompressValue(compression), dataAsBinaryString);-- if (!info) throw new Error('An unkwown error occurred whilst processing the image');- }- }-- writeImageToPDF.call(this, x, y, w, h, info, info.i, images);-- return this;- };-- /**- * JPEG SUPPORT- **/-- //takes a string imgData containing the raw bytes of- //a jpeg image and returns [width, height]- //Algorithm from: http://www.64lines.com/jpeg-width-height- var getJpegSize = function getJpegSize(imgData) {- 'use strict';-- var width, height, numcomponents;- // Verify we have a valid jpeg header 0xff,0xd8,0xff,0xe0,?,?,'J','F','I','F',0x00- if (!imgData.charCodeAt(0) === 0xff || !imgData.charCodeAt(1) === 0xd8 || !imgData.charCodeAt(2) === 0xff || !imgData.charCodeAt(3) === 0xe0 || !imgData.charCodeAt(6) === 'J'.charCodeAt(0) || !imgData.charCodeAt(7) === 'F'.charCodeAt(0) || !imgData.charCodeAt(8) === 'I'.charCodeAt(0) || !imgData.charCodeAt(9) === 'F'.charCodeAt(0) || !imgData.charCodeAt(10) === 0x00) {- throw new Error('getJpegSize requires a binary string jpeg file');- }- var blockLength = imgData.charCodeAt(4) * 256 + imgData.charCodeAt(5);- var i = 4,- len = imgData.length;- while (i < len) {- i += blockLength;- if (imgData.charCodeAt(i) !== 0xff) {- throw new Error('getJpegSize could not find the size of the image');- }- if (imgData.charCodeAt(i + 1) === 0xc0 || //(SOF) Huffman - Baseline DCT- imgData.charCodeAt(i + 1) === 0xc1 || //(SOF) Huffman - Extended sequential DCT- imgData.charCodeAt(i + 1) === 0xc2 || // Progressive DCT (SOF2)- imgData.charCodeAt(i + 1) === 0xc3 || // Spatial (sequential) lossless (SOF3)- imgData.charCodeAt(i + 1) === 0xc4 || // Differential sequential DCT (SOF5)- imgData.charCodeAt(i + 1) === 0xc5 || // Differential progressive DCT (SOF6)- imgData.charCodeAt(i + 1) === 0xc6 || // Differential spatial (SOF7)- imgData.charCodeAt(i + 1) === 0xc7) {- height = imgData.charCodeAt(i + 5) * 256 + imgData.charCodeAt(i + 6);- width = imgData.charCodeAt(i + 7) * 256 + imgData.charCodeAt(i + 8);- numcomponents = imgData.charCodeAt(i + 9);- return [width, height, numcomponents];- } else {- i += 2;- blockLength = imgData.charCodeAt(i) * 256 + imgData.charCodeAt(i + 1);- }- }- },- getJpegSizeFromBytes = function getJpegSizeFromBytes(data) {-- var hdr = data[0] << 8 | data[1];-- if (hdr !== 0xFFD8) throw new Error('Supplied data is not a JPEG');-- var len = data.length,- block = (data[4] << 8) + data[5],- pos = 4,- bytes,- width,- height,- numcomponents;-- while (pos < len) {- pos += block;- bytes = readBytes(data, pos);- block = (bytes[2] << 8) + bytes[3];- if ((bytes[1] === 0xC0 || bytes[1] === 0xC2) && bytes[0] === 0xFF && block > 7) {- bytes = readBytes(data, pos + 5);- width = (bytes[2] << 8) + bytes[3];- height = (bytes[0] << 8) + bytes[1];- numcomponents = bytes[4];- return { width: width, height: height, numcomponents: numcomponents };- }-- pos += 2;- }-- throw new Error('getJpegSizeFromBytes could not find the size of the image');- },- readBytes = function readBytes(data, offset) {- return data.subarray(offset, offset + 5);- };-- jsPDFAPI.processJPEG = function (data, index, alias, compression, dataAsBinaryString) {- 'use strict';-- var colorSpace = this.color_spaces.DEVICE_RGB,- filter = this.decode.DCT_DECODE,- bpc = 8,- dims;-- if (this.isString(data)) {- dims = getJpegSize(data);- return this.createImageInfo(data, dims[0], dims[1], dims[3] == 1 ? this.color_spaces.DEVICE_GRAY : colorSpace, bpc, filter, index, alias);- }-- if (this.isArrayBuffer(data)) data = new Uint8Array(data);-- if (this.isArrayBufferView(data)) {-- dims = getJpegSizeFromBytes(data);-- // if we already have a stored binary string rep use that- data = dataAsBinaryString || this.arrayBufferToBinaryString(data);-- return this.createImageInfo(data, dims.width, dims.height, dims.numcomponents == 1 ? this.color_spaces.DEVICE_GRAY : colorSpace, bpc, filter, index, alias);- }-- return null;- };-- jsPDFAPI.processJPG = function () /*data, index, alias, compression, dataAsBinaryString*/{- return this.processJPEG.apply(this, arguments);- };- })(jsPDF.API);-- /**- * jsPDF Annotations PlugIn- * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- /**- * There are many types of annotations in a PDF document. Annotations are placed- * on a page at a particular location. They are not 'attached' to an object.- * <br />- * This plugin current supports <br />- * <li> Goto Page (set pageNumber and top in options)- * <li> Goto Name (set name and top in options)- * <li> Goto URL (set url in options)- * <p>- * The destination magnification factor can also be specified when goto is a page number or a named destination. (see documentation below)- * (set magFactor in options). XYZ is the default.- * </p>- * <p>- * Links, Text, Popup, and FreeText are supported.- * </p>- * <p>- * Options In PDF spec Not Implemented Yet- * <li> link border- * <li> named target- * <li> page coordinates- * <li> destination page scaling and layout- * <li> actions other than URL and GotoPage- * <li> background / hover actions- * </p>- */-- /*- Destination Magnification Factors- See PDF 1.3 Page 386 for meanings and options-- [supported]- XYZ (options; left top zoom)- Fit (no options)- FitH (options: top)- FitV (options: left)-- [not supported]- FitR- FitB- FitBH- FitBV- */-- (function (jsPDFAPI) {- 'use strict';-- var annotationPlugin = {-- /**- * An array of arrays, indexed by <em>pageNumber</em>.- */- annotations: [],-- f2: function f2(number) {- return number.toFixed(2);- },-- notEmpty: function notEmpty(obj) {- if (typeof obj != 'undefined') {- if (obj != '') {- return true;- }- }- }- };-- jsPDF.API.annotationPlugin = annotationPlugin;-- jsPDF.API.events.push(['addPage', function (info) {- this.annotationPlugin.annotations[info.pageNumber] = [];- }]);-- jsPDFAPI.events.push(['putPage', function (info) {- //TODO store annotations in pageContext so reorder/remove will not affect them.- var pageAnnos = this.annotationPlugin.annotations[info.pageNumber];-- var found = false;- for (var a = 0; a < pageAnnos.length && !found; a++) {- var anno = pageAnnos[a];- switch (anno.type) {- case 'link':- if (annotationPlugin.notEmpty(anno.options.url) || annotationPlugin.notEmpty(anno.options.pageNumber)) {- found = true;- break;- }- case 'reference':- case 'text':- case 'freetext':- found = true;- break;- }- }- if (found == false) {- return;- }-- this.internal.write("/Annots [");- var f2 = this.annotationPlugin.f2;- var k = this.internal.scaleFactor;- var pageHeight = this.internal.pageSize.height;- var pageInfo = this.internal.getPageInfo(info.pageNumber);- for (var a = 0; a < pageAnnos.length; a++) {- var anno = pageAnnos[a];-- switch (anno.type) {- case 'reference':- // References to Widget Anotations (for AcroForm Fields)- this.internal.write(' ' + anno.object.objId + ' 0 R ');- break;- case 'text':- // Create a an object for both the text and the popup- var objText = this.internal.newAdditionalObject();- var objPopup = this.internal.newAdditionalObject();-- var title = anno.title || 'Note';- var rect = "/Rect [" + f2(anno.bounds.x * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + " " + f2((anno.bounds.x + anno.bounds.w) * k) + " " + f2((pageHeight - anno.bounds.y) * k) + "] ";- line = '<</Type /Annot /Subtype /' + 'Text' + ' ' + rect + '/Contents (' + anno.contents + ')';- line += ' /Popup ' + objPopup.objId + " 0 R";- line += ' /P ' + pageInfo.objId + " 0 R";- line += ' /T (' + title + ') >>';- objText.content = line;-- var parent = objText.objId + ' 0 R';- var popoff = 30;- var rect = "/Rect [" + f2((anno.bounds.x + popoff) * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + " " + f2((anno.bounds.x + anno.bounds.w + popoff) * k) + " " + f2((pageHeight - anno.bounds.y) * k) + "] ";- //var rect2 = "/Rect [" + f2(anno.bounds.x * k) + " " + f2((pageHeight - anno.bounds.y) * k) + " " + f2(anno.bounds.x + anno.bounds.w * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + "] ";- line = '<</Type /Annot /Subtype /' + 'Popup' + ' ' + rect + ' /Parent ' + parent;- if (anno.open) {- line += ' /Open true';- }- line += ' >>';- objPopup.content = line;-- this.internal.write(objText.objId, '0 R', objPopup.objId, '0 R');-- break;- case 'freetext':- var rect = "/Rect [" + f2(anno.bounds.x * k) + " " + f2((pageHeight - anno.bounds.y) * k) + " " + f2(anno.bounds.x + anno.bounds.w * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + "] ";- var color = anno.color || '#000000';- line = '<</Type /Annot /Subtype /' + 'FreeText' + ' ' + rect + '/Contents (' + anno.contents + ')';- line += ' /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#' + color + ')';- line += ' /Border [0 0 0]';- line += ' >>';- this.internal.write(line);- break;- case 'link':- if (anno.options.name) {- var loc = this.annotations._nameMap[anno.options.name];- anno.options.pageNumber = loc.page;- anno.options.top = loc.y;- } else {- if (!anno.options.top) {- anno.options.top = 0;- }- }-- //var pageHeight = this.internal.pageSize.height * this.internal.scaleFactor;- var rect = "/Rect [" + f2(anno.x * k) + " " + f2((pageHeight - anno.y) * k) + " " + f2(anno.x + anno.w * k) + " " + f2(pageHeight - (anno.y + anno.h) * k) + "] ";-- var line = '';- if (anno.options.url) {- line = '<</Type /Annot /Subtype /Link ' + rect + '/Border [0 0 0] /A <</S /URI /URI (' + anno.options.url + ') >>';- } else if (anno.options.pageNumber) {- // first page is 0- var info = this.internal.getPageInfo(anno.options.pageNumber);- line = '<</Type /Annot /Subtype /Link ' + rect + '/Border [0 0 0] /Dest [' + info.objId + " 0 R";- anno.options.magFactor = anno.options.magFactor || "XYZ";- switch (anno.options.magFactor) {- case 'Fit':- line += ' /Fit]';- break;- case 'FitH':- //anno.options.top = anno.options.top || f2(pageHeight * k);- line += ' /FitH ' + anno.options.top + ']';- break;- case 'FitV':- anno.options.left = anno.options.left || 0;- line += ' /FitV ' + anno.options.left + ']';- break;- case 'XYZ':- default:- var top = f2((pageHeight - anno.options.top) * k); // || f2(pageHeight * k);- anno.options.left = anno.options.left || 0;- // 0 or null zoom will not change zoom factor- if (typeof anno.options.zoom === 'undefined') {- anno.options.zoom = 0;- }- line += ' /XYZ ' + anno.options.left + ' ' + top + ' ' + anno.options.zoom + ']';- break;- }- } else {- // TODO error - should not be here- }- if (line != '') {- line += " >>";- this.internal.write(line);- }- break;- }- }- this.internal.write("]");- }]);-- jsPDFAPI.createAnnotation = function (options) {- switch (options.type) {- case 'link':- this.link(options.bounds.x, options.bounds.y, options.bounds.w, options.bounds.h, options);- break;- case 'text':- case 'freetext':- this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push(options);- break;- }- };-- /**- * valid options- * <li> pageNumber or url [required]- * <p>If pageNumber is specified, top and zoom may also be specified</p>- */- jsPDFAPI.link = function (x, y, w, h, options) {- 'use strict';-- this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({- x: x,- y: y,- w: w,- h: h,- options: options,- type: 'link'- });- };-- /**- * valid options- * <li> pageNumber or url [required]- * <p>If pageNumber is specified, top and zoom may also be specified</p>- */- jsPDFAPI.link = function (x, y, w, h, options) {- 'use strict';-- this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({- x: x,- y: y,- w: w,- h: h,- options: options,- type: 'link'- });- };-- /**- * Currently only supports single line text.- * Returns the width of the text/link- */- jsPDFAPI.textWithLink = function (text, x, y, options) {- 'use strict';-- var width = this.getTextWidth(text);- var height = this.internal.getLineHeight();- this.text(text, x, y);- //TODO We really need the text baseline height to do this correctly.- // Or ability to draw text on top, bottom, center, or baseline.- y += height * .2;- this.link(x, y - height, width, height, options);- return width;- };-- //TODO move into external library- jsPDFAPI.getTextWidth = function (text) {- 'use strict';-- var fontSize = this.internal.getFontSize();- var txtWidth = this.getStringUnitWidth(text) * fontSize / this.internal.scaleFactor;- return txtWidth;- };-- //TODO move into external library- jsPDFAPI.getLineHeight = function () {- return this.internal.getLineHeight();- };-- return this;- })(jsPDF.API);-- /**- * jsPDF Autoprint Plugin- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- (function (jsPDFAPI) {- 'use strict';-- jsPDFAPI.autoPrint = function () {- 'use strict';-- var refAutoPrintTag;-- this.internal.events.subscribe('postPutResources', function () {- refAutoPrintTag = this.internal.newObject();- this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");- });-- this.internal.events.subscribe("putCatalog", function () {- this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");- });- return this;- };- })(jsPDF.API);-- /**- * jsPDF Canvas PlugIn- * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- /**- * This plugin mimics the HTML5 Canvas- *- * The goal is to provide a way for current canvas users to print directly to a PDF.- */-- (function (jsPDFAPI) {- 'use strict';-- jsPDFAPI.events.push(['initialized', function () {- this.canvas.pdf = this;- }]);-- jsPDFAPI.canvas = {- getContext: function getContext(name) {- this.pdf.context2d._canvas = this;- return this.pdf.context2d;- },- style: {}- };-- Object.defineProperty(jsPDFAPI.canvas, 'width', {- get: function get() {- return this._width;- },- set: function set(value) {- this._width = value;- this.getContext('2d').pageWrapX = value + 1;- }- });-- Object.defineProperty(jsPDFAPI.canvas, 'height', {- get: function get() {- return this._height;- },- set: function set(value) {- this._height = value;- this.getContext('2d').pageWrapY = value + 1;- }- });-- return this;- })(jsPDF.API);-- /** ====================================================================- * jsPDF Cell plugin- * Copyright (c) 2013 Youssef Beddad, [email protected]- * 2013 Eduardo Menezes de Morais, [email protected]- * 2013 Lee Driscoll, https://github.com/lsdriscoll- * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria- * 2014 James Hall, [email protected]- * 2014 Diego Casorran, https://github.com/diegocr- *- *- * ====================================================================- */-- (function (jsPDFAPI) {- 'use strict';- /*jslint browser:true */- /*global document: false, jsPDF */-- var fontName,- fontSize,- fontStyle,- padding = 3,- margin = 13,- headerFunction,- lastCellPos = { x: undefined, y: undefined, w: undefined, h: undefined, ln: undefined },- pages = 1,- setLastCellPosition = function setLastCellPosition(x, y, w, h, ln) {- lastCellPos = { 'x': x, 'y': y, 'w': w, 'h': h, 'ln': ln };- },- getLastCellPosition = function getLastCellPosition() {- return lastCellPos;- },- NO_MARGINS = { left: 0, top: 0, bottom: 0 };-- jsPDFAPI.setHeaderFunction = function (func) {- headerFunction = func;- };-- jsPDFAPI.getTextDimensions = function (txt) {- fontName = this.internal.getFont().fontName;- fontSize = this.table_font_size || this.internal.getFontSize();- fontStyle = this.internal.getFont().fontStyle;- // 1 pixel = 0.264583 mm and 1 mm = 72/25.4 point- var px2pt = 0.264583 * 72 / 25.4,- dimensions,- text;-- text = document.createElement('font');- text.id = "jsPDFCell";-- try {- text.style.fontStyle = fontStyle;- } catch (e) {- text.style.fontWeight = fontStyle;- }-- text.style.fontName = fontName;- text.style.fontSize = fontSize + 'pt';- try {- text.textContent = txt;- } catch (e) {- text.innerText = txt;- }-- document.body.appendChild(text);-- dimensions = { w: (text.offsetWidth + 1) * px2pt, h: (text.offsetHeight + 1) * px2pt };-- document.body.removeChild(text);-- return dimensions;- };-- jsPDFAPI.cellAddPage = function () {- var margins = this.margins || NO_MARGINS;-- this.addPage();-- setLastCellPosition(margins.left, margins.top, undefined, undefined);- //setLastCellPosition(undefined, undefined, undefined, undefined, undefined);- pages += 1;- };-- jsPDFAPI.cellInitialize = function () {- lastCellPos = { x: undefined, y: undefined, w: undefined, h: undefined, ln: undefined };- pages = 1;- };-- jsPDFAPI.cell = function (x, y, w, h, txt, ln, align) {- var curCell = getLastCellPosition();- var pgAdded = false;-- // If this is not the first cell, we must change its position- if (curCell.ln !== undefined) {- if (curCell.ln === ln) {- //Same line- x = curCell.x + curCell.w;- y = curCell.y;- } else {- //New line- var margins = this.margins || NO_MARGINS;- if (curCell.y + curCell.h + h + margin >= this.internal.pageSize.height - margins.bottom) {- this.cellAddPage();- pgAdded = true;- if (this.printHeaders && this.tableHeaderRow) {- this.printHeaderRow(ln, true);- }- }- //We ignore the passed y: the lines may have different heights- y = getLastCellPosition().y + getLastCellPosition().h;- if (pgAdded) y = margin + 10;- }- }-- if (txt[0] !== undefined) {- if (this.printingHeaderRow) {- this.rect(x, y, w, h, 'FD');- } else {- this.rect(x, y, w, h);- }- if (align === 'right') {- if (!(txt instanceof Array)) {- txt = [txt];- }- for (var i = 0; i < txt.length; i++) {- var currentLine = txt[i];- var textSize = this.getStringUnitWidth(currentLine) * this.internal.getFontSize();- this.text(currentLine, x + w - textSize - padding, y + this.internal.getLineHeight() * (i + 1));- }- } else {- this.text(txt, x + padding, y + this.internal.getLineHeight());- }- }- setLastCellPosition(x, y, w, h, ln);- return this;- };-- /**- * Return the maximum value from an array- * @param array- * @param comparisonFn- * @returns {*}- */- jsPDFAPI.arrayMax = function (array, comparisonFn) {- var max = array[0],- i,- ln,- item;-- for (i = 0, ln = array.length; i < ln; i += 1) {- item = array[i];-- if (comparisonFn) {- if (comparisonFn(max, item) === -1) {- max = item;- }- } else {- if (item > max) {- max = item;- }- }- }-- return max;- };-- /**- * Create a table from a set of data.- * @param {Integer} [x] : left-position for top-left corner of table- * @param {Integer} [y] top-position for top-left corner of table- * @param {Object[]} [data] As array of objects containing key-value pairs corresponding to a row of data.- * @param {String[]} [headers] Omit or null to auto-generate headers at a performance cost- * @param {Object} [config.printHeaders] True to print column headers at the top of every page- * @param {Object} [config.autoSize] True to dynamically set the column widths to match the widest cell value- * @param {Object} [config.margins] margin values for left, top, bottom, and width- * @param {Object} [config.fontSize] Integer fontSize to use (optional)- */-- jsPDFAPI.table = function (x, y, data, headers, config) {- if (!data) {- throw 'No data for PDF table';- }-- var headerNames = [],- headerPrompts = [],- header,- i,- ln,- cln,- columnMatrix = {},- columnWidths = {},- columnData,- column,- columnMinWidths = [],- j,- tableHeaderConfigs = [],- model,- jln,- func,--- //set up defaults. If a value is provided in config, defaults will be overwritten:- autoSize = false,- printHeaders = true,- fontSize = 12,- margins = NO_MARGINS;-- margins.width = this.internal.pageSize.width;-- if (config) {- //override config defaults if the user has specified non-default behavior:- if (config.autoSize === true) {- autoSize = true;- }- if (config.printHeaders === false) {- printHeaders = false;- }- if (config.fontSize) {- fontSize = config.fontSize;- }- if (config.css && typeof config.css['font-size'] !== "undefined") {- fontSize = config.css['font-size'] * 16;- }- if (config.margins) {- margins = config.margins;- }- }-- /**- * @property {Number} lnMod- * Keep track of the current line number modifier used when creating cells- */- this.lnMod = 0;- lastCellPos = { x: undefined, y: undefined, w: undefined, h: undefined, ln: undefined }, pages = 1;-- this.printHeaders = printHeaders;- this.margins = margins;- this.setFontSize(fontSize);- this.table_font_size = fontSize;-- // Set header values- if (headers === undefined || headers === null) {- // No headers defined so we derive from data- headerNames = Object.keys(data[0]);- } else if (headers[0] && typeof headers[0] !== 'string') {- var px2pt = 0.264583 * 72 / 25.4;-- // Split header configs into names and prompts- for (i = 0, ln = headers.length; i < ln; i += 1) {- header = headers[i];- headerNames.push(header.name);- headerPrompts.push(header.prompt);- columnWidths[header.name] = header.width * px2pt;- }- } else {- headerNames = headers;- }-- if (autoSize) {- // Create a matrix of columns e.g., {column_title: [row1_Record, row2_Record]}- func = function func(rec) {- return rec[header];- };-- for (i = 0, ln = headerNames.length; i < ln; i += 1) {- header = headerNames[i];-- columnMatrix[header] = data.map(func);-- // get header width- columnMinWidths.push(this.getTextDimensions(headerPrompts[i] || header).w);- column = columnMatrix[header];-- // get cell widths- for (j = 0, cln = column.length; j < cln; j += 1) {- columnData = column[j];- columnMinWidths.push(this.getTextDimensions(columnData).w);- }-- // get final column width- columnWidths[header] = jsPDFAPI.arrayMax(columnMinWidths);-- //have to reset- columnMinWidths = [];- }- }-- // -- Construct the table-- if (printHeaders) {- var lineHeight = this.calculateLineHeight(headerNames, columnWidths, headerPrompts.length ? headerPrompts : headerNames);-- // Construct the header row- for (i = 0, ln = headerNames.length; i < ln; i += 1) {- header = headerNames[i];- tableHeaderConfigs.push([x, y, columnWidths[header], lineHeight, String(headerPrompts.length ? headerPrompts[i] : header)]);- }-- // Store the table header config- this.setTableHeaderRow(tableHeaderConfigs);-- // Print the header for the start of the table- this.printHeaderRow(1, false);- }-- // Construct the data rows- for (i = 0, ln = data.length; i < ln; i += 1) {- var lineHeight;- model = data[i];- lineHeight = this.calculateLineHeight(headerNames, columnWidths, model);-- for (j = 0, jln = headerNames.length; j < jln; j += 1) {- header = headerNames[j];- this.cell(x, y, columnWidths[header], lineHeight, model[header], i + 2, header.align);- }- }- this.lastCellPos = lastCellPos;- this.table_x = x;- this.table_y = y;- return this;- };- /**- * Calculate the height for containing the highest column- * @param {String[]} headerNames is the header, used as keys to the data- * @param {Integer[]} columnWidths is size of each column- * @param {Object[]} model is the line of data we want to calculate the height of- */- jsPDFAPI.calculateLineHeight = function (headerNames, columnWidths, model) {- var header,- lineHeight = 0;- for (var j = 0; j < headerNames.length; j++) {- header = headerNames[j];- model[header] = this.splitTextToSize(String(model[header]), columnWidths[header] - padding);- var h = this.internal.getLineHeight() * model[header].length + padding;- if (h > lineHeight) lineHeight = h;- }- return lineHeight;- };-- /**- * Store the config for outputting a table header- * @param {Object[]} config- * An array of cell configs that would define a header row: Each config matches the config used by jsPDFAPI.cell- * except the ln parameter is excluded- */- jsPDFAPI.setTableHeaderRow = function (config) {- this.tableHeaderRow = config;- };-- /**- * Output the store header row- * @param lineNumber The line number to output the header at- */- jsPDFAPI.printHeaderRow = function (lineNumber, new_page) {- if (!this.tableHeaderRow) {- throw 'Property tableHeaderRow does not exist.';- }-- var tableHeaderCell, tmpArray, i, ln;-- this.printingHeaderRow = true;- if (headerFunction !== undefined) {- var position = headerFunction(this, pages);- setLastCellPosition(position[0], position[1], position[2], position[3], -1);- }- this.setFontStyle('bold');- var tempHeaderConf = [];- for (i = 0, ln = this.tableHeaderRow.length; i < ln; i += 1) {- this.setFillColor(200, 200, 200);-- tableHeaderCell = this.tableHeaderRow[i];- if (new_page) {- this.margins.top = margin;- tableHeaderCell[1] = this.margins && this.margins.top || 0;- tempHeaderConf.push(tableHeaderCell);- }- tmpArray = [].concat(tableHeaderCell);- this.cell.apply(this, tmpArray.concat(lineNumber));- }- if (tempHeaderConf.length > 0) {- this.setTableHeaderRow(tempHeaderConf);- }- this.setFontStyle('normal');- this.printingHeaderRow = false;- };- })(jsPDF.API);-- /**- * jsPDF Context2D PlugIn Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]- *- * Licensed under the MIT License. http://opensource.org/licenses/mit-license- */-- /**- * This plugin mimics the HTML5 Canvas's context2d.- *- * The goal is to provide a way for current canvas implementations to print directly to a PDF.- */-- /**- * TODO implement stroke opacity (refactor from fill() method )- * TODO transform angle and radii parameters- */-- /**- * require('jspdf.js'); require('lib/css_colors.js');- */-- (function (jsPDFAPI) {- 'use strict';-- jsPDFAPI.events.push(['initialized', function () {- this.context2d.pdf = this;- this.context2d.internal.pdf = this;- this.context2d.ctx = new context();- this.context2d.ctxStack = [];- this.context2d.path = [];- }]);-- jsPDFAPI.context2d = {- pageWrapXEnabled: false,- pageWrapYEnabled: false,- pageWrapX: 9999999,- pageWrapY: 9999999,- ctx: new context(),- f2: function f2(number) {- return number.toFixed(2);- },-- fillRect: function fillRect(x, y, w, h) {- if (this._isFillTransparent()) {- return;- }- x = this._wrapX(x);- y = this._wrapY(y);-- var xRect = this._matrix_map_rect(this.ctx._transform, { x: x, y: y, w: w, h: h });- this.pdf.rect(xRect.x, xRect.y, xRect.w, xRect.h, "f");- },-- strokeRect: function strokeRect(x, y, w, h) {- if (this._isStrokeTransparent()) {- return;- }- x = this._wrapX(x);- y = this._wrapY(y);-- var xRect = this._matrix_map_rect(this.ctx._transform, { x: x, y: y, w: w, h: h });- this.pdf.rect(xRect.x, xRect.y, xRect.w, xRect.h, "s");- },-- /**- * We cannot clear PDF commands that were already written to PDF, so we use white instead. <br />- * As a special case, read a special flag (ignoreClearRect) and do nothing if it is set.- * This results in all calls to clearRect() to do nothing, and keep the canvas transparent.- * This flag is stored in the save/restore context and is managed the same way as other drawing states.- * @param x- * @param y- * @param w- * @param h- */- clearRect: function clearRect(x, y, w, h) {- if (this.ctx.ignoreClearRect) {- return;- }-- x = this._wrapX(x);- y = this._wrapY(y);-- var xRect = this._matrix_map_rect(this.ctx._transform, { x: x, y: y, w: w, h: h });- this.save();- this.setFillStyle('#ffffff');- //TODO This is hack to fill with white.- this.pdf.rect(xRect.x, xRect.y, xRect.w, xRect.h, "f");- this.restore();- },-- save: function save() {- this.ctx._fontSize = this.pdf.internal.getFontSize();- var ctx = new context();- ctx.copy(this.ctx);- this.ctxStack.push(this.ctx);- this.ctx = ctx;- },-- restore: function restore() {- this.ctx = this.ctxStack.pop();- this.setFillStyle(this.ctx.fillStyle);- this.setStrokeStyle(this.ctx.strokeStyle);- this.setFont(this.ctx.font);- this.pdf.setFontSize(this.ctx._fontSize);- this.setLineCap(this.ctx.lineCap);- this.setLineWidth(this.ctx.lineWidth);- this.setLineJoin(this.ctx.lineJoin);- },-- rect: function rect(x, y, w, h) {- this.moveTo(x, y);- this.lineTo(x + w, y);- this.lineTo(x + w, y + h);- this.lineTo(x, y + h);- this.lineTo(x, y); //TODO not needed- this.closePath();- },-- beginPath: function beginPath() {- this.path = [];- },-- closePath: function closePath() {- this.path.push({- type: 'close'- });- },-- _getRgba: function _getRgba(style) {- // get the decimal values of r, g, and b;- var rgba = {};-- if (this.internal.rxTransparent.test(style)) {- rgba.r = 0;- rgba.g = 0;- rgba.b = 0;- rgba.a = 0;- } else {- var m = this.internal.rxRgb.exec(style);- if (m != null) {- rgba.r = parseInt(m[1]);- rgba.g = parseInt(m[2]);- rgba.b = parseInt(m[3]);- rgba.a = 1;- } else {- m = this.internal.rxRgba.exec(style);- if (m != null) {- rgba.r = parseInt(m[1]);- rgba.g = parseInt(m[2]);- rgba.b = parseInt(m[3]);- rgba.a = parseFloat(m[4]);- } else {- rgba.a = 1;- if (style.charAt(0) != '#') {- style = CssColors.colorNameToHex(style);- if (!style) {- style = '#000000';- }- } else {}-- if (style.length === 4) {- rgba.r = style.substring(1, 2);- rgba.r += r;- rgba.g = style.substring(2, 3);- rgba.g += g;- rgba.b = style.substring(3, 4);- rgba.b += b;- } else {- rgba.r = style.substring(1, 3);- rgba.g = style.substring(3, 5);- rgba.b = style.substring(5, 7);- }- rgba.r = parseInt(rgba.r, 16);- rgba.g = parseInt(rgba.g, 16);- rgba.b = parseInt(rgba.b, 16);- }- }- }- rgba.style = style;- return rgba;- },-- setFillStyle: function setFillStyle(style) {- // get the decimal values of r, g, and b;- var r, g, b, a;-- if (this.internal.rxTransparent.test(style)) {- r = 0;- g = 0;- b = 0;- a = 0;- } else {- var m = this.internal.rxRgb.exec(style);- if (m != null) {- r = parseInt(m[1]);- g = parseInt(m[2]);- b = parseInt(m[3]);- a = 1;- } else {- m = this.internal.rxRgba.exec(style);- if (m != null) {- r = parseInt(m[1]);- g = parseInt(m[2]);- b = parseInt(m[3]);- a = parseFloat(m[4]);- } else {- a = 1;- if (style.charAt(0) != '#') {- style = CssColors.colorNameToHex(style);- if (!style) {- style = '#000000';- }- } else {}-- if (style.length === 4) {- r = style.substring(1, 2);- r += r;- g = style.substring(2, 3);- g += g;- b = style.substring(3, 4);- b += b;- } else {- r = style.substring(1, 3);- g = style.substring(3, 5);- b = style.substring(5, 7);- }- r = parseInt(r, 16);- g = parseInt(g, 16);- b = parseInt(b, 16);- }- }- }-- this.ctx.fillStyle = style;- this.ctx._isFillTransparent = a == 0;- this.ctx._fillOpacity = a;-- this.pdf.setFillColor(r, g, b, {- a: a- });- this.pdf.setTextColor(r, g, b, {- a: a- });- },-- setStrokeStyle: function setStrokeStyle(style) {- var rgba = this._getRgba(style);-- this.ctx.strokeStyle = rgba.style;- this.ctx._isStrokeTransparent = rgba.a == 0;- this.ctx._strokeOpacity = rgba.a;-- //TODO jsPDF to handle rgba- if (rgba.a === 0) {- this.pdf.setDrawColor(255, 255, 255);- } else if (rgba.a === 1) {- this.pdf.setDrawColor(rgba.r, rgba.g, rgba.b);- } else {- //this.pdf.setDrawColor(rgba.r, rgba.g, rgba.b, {a: rgba.a});- this.pdf.setDrawColor(rgba.r, rgba.g, rgba.b);- }- },-- fillText: function fillText(text, x, y, maxWidth) {- if (this._isFillTransparent()) {- return;- }- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];- var rads = this._matrix_rotation(this.ctx._transform);- var degs = rads * 57.2958;-- //TODO only push the clip if it has not been applied to the current PDF context- if (this.ctx._clip_path.length > 0) {- var lines;- if (window.outIntercept) {- lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;- } else {- lines = this.pdf.internal.pages[1];- }- lines.push("q");- var origPath = this.path;- this.path = this.ctx._clip_path;- this.ctx._clip_path = [];- this._fill(null, true);- this.ctx._clip_path = this.path;- this.path = origPath;- }-- this.pdf.text(text, x, this._getBaseline(y), null, degs);-- if (this.ctx._clip_path.length > 0) {- lines.push('Q');- }- },-- strokeText: function strokeText(text, x, y, maxWidth) {- if (this._isStrokeTransparent()) {- return;- }- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];- var rads = this._matrix_rotation(this.ctx._transform);- var degs = rads * 57.2958;-- //TODO only push the clip if it has not been applied to the current PDF context- if (this.ctx._clip_path.length > 0) {- var lines;- if (window.outIntercept) {- lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;- } else {- lines = this.pdf.internal.pages[1];- }- lines.push("q");- var origPath = this.path;- this.path = this.ctx._clip_path;- this.ctx._clip_path = [];- this._fill(null, true);- this.ctx._clip_path = this.path;- this.path = origPath;- }-- this.pdf.text(text, x, this._getBaseline(y), {- stroke: true- }, degs);-- if (this.ctx._clip_path.length > 0) {- lines.push('Q');- }- },-- setFont: function setFont(font) {- this.ctx.font = font;-- //var rx = /\s*(\w+)\s+(\w+)\s+(\w+)\s+([\d\.]+)(px|pt|em)\s+["']?(\w+)['"]?/;- var rx = /\s*(\w+)\s+(\w+)\s+(\w+)\s+([\d\.]+)(px|pt|em)\s+(.*)?/;- m = rx.exec(font);- if (m != null) {- var fontStyle = m[1];- var fontVariant = m[2];- var fontWeight = m[3];- var fontSize = m[4];- var fontSizeUnit = m[5];- var fontFamily = m[6];-- if ('px' === fontSizeUnit) {- fontSize = Math.floor(parseFloat(fontSize));- // fontSize = fontSize * 1.25;- } else if ('em' === fontSizeUnit) {- fontSize = Math.floor(parseFloat(fontSize) * this.pdf.getFontSize());- } else {- fontSize = Math.floor(parseFloat(fontSize));- }-- this.pdf.setFontSize(fontSize);-- if (fontWeight === 'bold' || fontWeight === '700') {- this.pdf.setFontStyle('bold');- } else {- if (fontStyle === 'italic') {- this.pdf.setFontStyle('italic');- } else {- this.pdf.setFontStyle('normal');- }- }-- var name = fontFamily;- var parts = name.toLowerCase().split(/\s*,\s*/);- var jsPdfFontName;-- if (parts.indexOf('arial') != -1) {- jsPdfFontName = 'Arial';- } else if (parts.indexOf('verdana') != -1) {- jsPdfFontName = 'Verdana';- } else if (parts.indexOf('helvetica') != -1) {- jsPdfFontName = 'Helvetica';- } else if (parts.indexOf('sans-serif') != -1) {- jsPdfFontName = 'sans-serif';- } else if (parts.indexOf('fixed') != -1) {- jsPdfFontName = 'Fixed';- } else if (parts.indexOf('monospace') != -1) {- jsPdfFontName = 'Monospace';- } else if (parts.indexOf('terminal') != -1) {- jsPdfFontName = 'Terminal';- } else if (parts.indexOf('courier') != -1) {- jsPdfFontName = 'Courier';- } else if (parts.indexOf('times') != -1) {- jsPdfFontName = 'Times';- } else if (parts.indexOf('cursive') != -1) {- jsPdfFontName = 'Cursive';- } else if (parts.indexOf('fantasy') != -1) {- jsPdfFontName = 'Fantasy';- } else if (parts.indexOf('serif') != -1) {- jsPdfFontName = 'Serif';- } else {- jsPdfFontName = 'Serif';- }-- //TODO check more cases- var style;- if ('bold' === fontWeight) {- style = 'bold';- } else {- style = 'normal';- }-- this.pdf.setFont(jsPdfFontName, style);- } else {- var rx = /(\d+)(pt|px|em)\s+(\w+)\s*(\w+)?/;- var m = rx.exec(font);- if (m != null) {- var size = m[1];- var unit = m[2];- var name = m[3];- var style = m[4];- if (!style) {- style = 'normal';- }- if ('em' === fontSizeUnit) {- size = Math.floor(parseFloat(fontSize) * this.pdf.getFontSize());- } else {- size = Math.floor(parseFloat(size));- }- this.pdf.setFontSize(size);- this.pdf.setFont(name, style);- }- }- },-- setTextBaseline: function setTextBaseline(baseline) {- this.ctx.textBaseline = baseline;- },-- getTextBaseline: function getTextBaseline() {- return this.ctx.textBaseline;- },-- //TODO implement textAlign- setTextAlign: function setTextAlign(align) {- this.ctx.textAlign = align;- },-- getTextAlign: function getTextAlign() {- return this.ctx.textAlign;- },-- setLineWidth: function setLineWidth(width) {- this.ctx.lineWidth = width;- this.pdf.setLineWidth(width);- },-- setLineCap: function setLineCap(style) {- this.ctx.lineCap = style;- this.pdf.setLineCap(style);- },-- setLineJoin: function setLineJoin(style) {- this.ctx.lineJoin = style;- this.pdf.setLineJoin(style);- },-- moveTo: function moveTo(x, y) {- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];-- var obj = {- type: 'mt',- x: x,- y: y- };- this.path.push(obj);- },-- _wrapX: function _wrapX(x) {- if (this.pageWrapXEnabled) {- return x % this.pageWrapX;- } else {- return x;- }- },-- _wrapY: function _wrapY(y) {- if (this.pageWrapYEnabled) {- this._gotoPage(this._page(y));- return (y - this.lastBreak) % this.pageWrapY;- } else {- return y;- }- },-- transform: function transform(a, b, c, d, e, f) {- //TODO apply to current transformation instead of replacing- this.ctx._transform = [a, b, c, d, e, f];- },-- setTransform: function setTransform(a, b, c, d, e, f) {- this.ctx._transform = [a, b, c, d, e, f];- },-- _getTransform: function _getTransform() {- return this.ctx._transform;- },-- lastBreak: 0,- // Y Position of page breaks.- pageBreaks: [],- // returns: One-based Page Number- // Should only be used if pageWrapYEnabled is true- _page: function _page(y) {- if (this.pageWrapYEnabled) {- this.lastBreak = 0;- var manualBreaks = 0;- var autoBreaks = 0;- for (var i = 0; i < this.pageBreaks.length; i++) {- if (y >= this.pageBreaks[i]) {- manualBreaks++;- if (this.lastBreak === 0) {- autoBreaks++;- }- var spaceBetweenLastBreak = this.pageBreaks[i] - this.lastBreak;- this.lastBreak = this.pageBreaks[i];- var pagesSinceLastBreak = Math.floor(spaceBetweenLastBreak / this.pageWrapY);- autoBreaks += pagesSinceLastBreak;- }- }- if (this.lastBreak === 0) {- var pagesSinceLastBreak = Math.floor(y / this.pageWrapY) + 1;- autoBreaks += pagesSinceLastBreak;- }- return autoBreaks + manualBreaks;- } else {- return this.pdf.internal.getCurrentPageInfo().pageNumber;- }- },-- _gotoPage: function _gotoPage(pageOneBased) {- // This is a stub to be overriden if needed- },-- lineTo: function lineTo(x, y) {- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];-- var obj = {- type: 'lt',- x: x,- y: y- };- this.path.push(obj);- },-- bezierCurveTo: function bezierCurveTo(x1, y1, x2, y2, x, y) {- x1 = this._wrapX(x1);- y1 = this._wrapY(y1);- x2 = this._wrapX(x2);- y2 = this._wrapY(y2);- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt;- xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];- xpt = this._matrix_map_point(this.ctx._transform, [x1, y1]);- x1 = xpt[0];- y1 = xpt[1];- xpt = this._matrix_map_point(this.ctx._transform, [x2, y2]);- x2 = xpt[0];- y2 = xpt[1];-- var obj = {- type: 'bct',- x1: x1,- y1: y1,- x2: x2,- y2: y2,- x: x,- y: y- };- this.path.push(obj);- },-- quadraticCurveTo: function quadraticCurveTo(x1, y1, x, y) {- x1 = this._wrapX(x1);- y1 = this._wrapY(y1);- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt;- xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];- xpt = this._matrix_map_point(this.ctx._transform, [x1, y1]);- x1 = xpt[0];- y1 = xpt[1];-- var obj = {- type: 'qct',- x1: x1,- y1: y1,- x: x,- y: y- };- this.path.push(obj);- },-- arc: function arc(x, y, radius, startAngle, endAngle, anticlockwise) {- x = this._wrapX(x);- y = this._wrapY(y);-- var xpt = this._matrix_map_point(this.ctx._transform, [x, y]);- x = xpt[0];- y = xpt[1];-- var obj = {- type: 'arc',- x: x,- y: y,- radius: radius,- startAngle: startAngle,- endAngle: endAngle,- anticlockwise: anticlockwise- };- this.path.push(obj);- },-- drawImage: function drawImage(img, x, y, w, h, x2, y2, w2, h2) {- if (x2 !== undefined) {- x = x2;- y = y2;- w = w2;- h = h2;- }- x = this._wrapX(x);- y = this._wrapY(y);-- var xRect = this._matrix_map_rect(this.ctx._transform, { x: x, y: y, w: w, h: h });- var xRect2 = this._matrix_map_rect(this.ctx._transform, { x: x2, y: y2, w: w2, h: h2 });-- // TODO implement source clipping and image scaling- var format;- var rx = /data:image\/(\w+).*/i;- var m = rx.exec(img);- if (m != null) {- format = m[1];- } else {- // format = "jpeg";- format = "png";- }-- this.pdf.addImage(img, format, xRect.x, xRect.y, xRect.w, xRect.h);- },-- /**- * Multiply the first matrix by the second- * @param m1- * @param m2- * @returns {*[]}- * @private- */- _matrix_multiply: function _matrix_multiply(m2, m1) {- var sx = m1[0];- var shy = m1[1];- var shx = m1[2];- var sy = m1[3];- var tx = m1[4];- var ty = m1[5];-- var t0 = sx * m2[0] + shy * m2[2];- var t2 = shx * m2[0] + sy * m2[2];- var t4 = tx * m2[0] + ty * m2[2] + m2[4];- shy = sx * m2[1] + shy * m2[3];- sy = shx * m2[1] + sy * m2[3];- ty = tx * m2[1] + ty * m2[3] + m2[5];- sx = t0;- shx = t2;- tx = t4;-- return [sx, shy, shx, sy, tx, ty];- },-- _matrix_rotation: function _matrix_rotation(m) {- return Math.atan2(m[2], m[0]);- },-- _matrix_decompose: function _matrix_decompose(matrix) {-- var a = matrix[0];- var b = matrix[1];- var c = matrix[2];- var d = matrix[3];-- var scaleX = Math.sqrt(a * a + b * b);- a /= scaleX;- b /= scaleX;-- var shear = a * c + b * d;- c -= a * shear;- d -= b * shear;-- var scaleY = Math.sqrt(c * c + d * d);- c /= scaleY;- d /= scaleY;- shear /= scaleY;-- if (a * d < b * c) {- a = -a;- b = -b;- shear = -shear;- scaleX = -scaleX;- }-- return {- scale: [scaleX, 0, 0, scaleY, 0, 0],- translate: [1, 0, 0, 1, matrix[4], matrix[5]],- rotate: [a, b, -b, a, 0, 0],- skew: [1, 0, shear, 1, 0, 0]- };- },-- _matrix_map_point: function _matrix_map_point(m1, pt) {- var sx = m1[0];- var shy = m1[1];- var shx = m1[2];- var sy = m1[3];- var tx = m1[4];- var ty = m1[5];-- var px = pt[0];- var py = pt[1];-- var x = px * sx + py * shx + tx;- var y = px * shy + py * sy + ty;- return [x, y];- },-- _matrix_map_point_obj: function _matrix_map_point_obj(m1, pt) {- var xpt = this._matrix_map_point(m1, [pt.x, pt.y]);- return { x: xpt[0], y: xpt[1] };- },-- _matrix_map_rect: function _matrix_map_rect(m1, rect) {- var p1 = this._matrix_map_point(m1, [rect.x, rect.y]);- var p2 = this._matrix_map_point(m1, [rect.x + rect.w, rect.y + rect.h]);- return { x: p1[0], y: p1[1], w: p2[0] - p1[0], h: p2[1] - p1[1] };- },-- _matrix_is_identity: function _matrix_is_identity(m1) {- if (m1[0] != 1) {- return false;- }- if (m1[1] != 0) {- return false;- }- if (m1[2] != 0) {- return false;- }- if (m1[3] != 1) {- return false;- }- if (m1[4] != 0) {- return false;- }- if (m1[5] != 0) {- return false;- }- return true;- },-- rotate: function rotate(angle) {- var matrix = [Math.cos(angle), Math.sin(angle), -Math.sin(angle), Math.cos(angle), 0.0, 0.0];- this.ctx._transform = this._matrix_multiply(this.ctx._transform, matrix);- },-- scale: function scale(sx, sy) {- var matrix = [sx, 0.0, 0.0, sy, 0.0, 0.0];- this.ctx._transform = this._matrix_multiply(this.ctx._transform, matrix);- },-- translate: function translate(x, y) {- var matrix = [1.0, 0.0, 0.0, 1.0, x, y];- this.ctx._transform = this._matrix_multiply(this.ctx._transform, matrix);- },-- stroke: function stroke() {- if (this.ctx._clip_path.length > 0) {-- var lines;- if (window.outIntercept) {- lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;- } else {- lines = this.pdf.internal.pages[1];- }- lines.push("q");-- var origPath = this.path;- this.path = this.ctx._clip_path;- this.ctx._clip_path = [];- this._stroke(true);-- this.ctx._clip_path = this.path;- this.path = origPath;- this._stroke(false);-- lines.push("Q");- } else {- this._stroke(false);- }- },-- _stroke: function _stroke(isClip) {- if (!isClip && this._isStrokeTransparent()) {- return;- }-- //TODO opacity-- var moves = [];- var closed = false;-- var xPath = this.path;-- for (var i = 0; i < xPath.length; i++) {- var pt = xPath[i];- switch (pt.type) {- case 'mt':- moves.push({ start: pt, deltas: [], abs: [] });- break;- case 'lt':- var delta = [pt.x - xPath[i - 1].x, pt.y - xPath[i - 1].y];- moves[moves.length - 1].deltas.push(delta);- moves[moves.length - 1].abs.push(pt);- break;- case 'bct':- var delta = [pt.x1 - xPath[i - 1].x, pt.y1 - xPath[i - 1].y, pt.x2 - xPath[i - 1].x, pt.y2 - xPath[i - 1].y, pt.x - xPath[i - 1].x, pt.y - xPath[i - 1].y];- moves[moves.length - 1].deltas.push(delta);- break;- case 'qct':- // convert to bezier- var x1 = xPath[i - 1].x + 2.0 / 3.0 * (pt.x1 - xPath[i - 1].x);- var y1 = xPath[i - 1].y + 2.0 / 3.0 * (pt.y1 - xPath[i - 1].y);- var x2 = pt.x + 2.0 / 3.0 * (pt.x1 - pt.x);- var y2 = pt.y + 2.0 / 3.0 * (pt.y1 - pt.y);- var x3 = pt.x;- var y3 = pt.y;- var delta = [x1 - xPath[i - 1].x, y1 - xPath[i - 1].y, x2 - xPath[i - 1].x, y2 - xPath[i - 1].y, x3 - xPath[i - 1].x, y3 - xPath[i - 1].y];- moves[moves.length - 1].deltas.push(delta);- break;- case 'arc':- moves[moves.length - 1].arc = true;- moves[moves.length - 1].abs.push(pt);- break;- case 'close':- closed = true;- break;- }- }-- for (var i = 0; i < moves.length; i++) {- var style;- if (i == moves.length - 1) {- style = 's';- } else {- style = null;- }- if (moves[i].arc) {- var arcs = moves[i].abs;- for (var ii = 0; ii < arcs.length; ii++) {- var arc = arcs[ii];- var start = arc.startAngle * 360 / (2 * Math.PI);- var end = arc.endAngle * 360 / (2 * Math.PI);- var x = arc.x;- var y = arc.y;- this.internal.arc2(this, x, y, arc.radius, start, end, arc.anticlockwise, style, isClip);- }- } else {- var x = moves[i].start.x;- var y = moves[i].start.y;- if (!isClip) {- this.pdf.lines(moves[i].deltas, x, y, null, style);- } else {- this.pdf.lines(moves[i].deltas, x, y, null, null);- this.pdf.clip_fixed();- }- }- }- },-- _isFillTransparent: function _isFillTransparent() {- return this.ctx._isFillTransparent || this.globalAlpha == 0;- },-- _isStrokeTransparent: function _isStrokeTransparent() {- return this.ctx._isStrokeTransparent || this.globalAlpha == 0;- },-- fill: function fill(fillRule) {- //evenodd or nonzero (default)- if (this.ctx._clip_path.length > 0) {-- var lines;- if (window.outIntercept) {- lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;- } else {- lines = this.pdf.internal.pages[1];- }- lines.push("q");-- var origPath = this.path;- this.path = this.ctx._clip_path;- this.ctx._clip_path = [];- this._fill(fillRule, true);-- this.ctx._clip_path = this.path;- this.path = origPath;- this._fill(fillRule, false);-- lines.push('Q');- } else {- this._fill(fillRule, false);- }- },-- _fill: function _fill(fillRule, isClip) {- if (this._isFillTransparent()) {- return;- }- var v2Support = typeof this.pdf.internal.newObject2 === 'function';-- var lines;- if (window.outIntercept) {- lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;- } else {- lines = this.pdf.internal.pages[1];- }-- // if (this.ctx._clip_path.length > 0) {- // lines.push('q');- // var oldPath = this.path;- // this.path = this.ctx._clip_path;- // this.ctx._clip_path = [];- // this._fill(fillRule, true);- // this.ctx._clip_path = this.path;- // this.path = oldPath;- // }-- var moves = [];- var outInterceptOld = window.outIntercept;-- if (v2Support) {- // Blend and Mask- switch (this.ctx.globalCompositeOperation) {- case 'normal':- case 'source-over':- break;- case 'destination-in':- case 'destination-out':- //TODO this need to be added to the current group or page- // define a mask stream- var obj = this.pdf.internal.newStreamObject();-- // define a mask state- var obj2 = this.pdf.internal.newObject2();- obj2.push('<</Type /ExtGState');- obj2.push('/SMask <</S /Alpha /G ' + obj.objId + ' 0 R>>'); // /S /Luminosity will need to define color space- obj2.push('>>');-- // add mask to page resources- var gsName = 'MASK' + obj2.objId;- this.pdf.internal.addGraphicsState(gsName, obj2.objId);-- var instruction = '/' + gsName + ' gs';- // add mask to page, group, or stream- lines.splice(0, 0, 'q');- lines.splice(1, 0, instruction);- lines.push('Q');-- window.outIntercept = obj;- break;- default:- var dictionaryEntry = '/' + this.pdf.internal.blendModeMap[this.ctx.globalCompositeOperation.toUpperCase()];- if (dictionaryEntry) {- this.pdf.internal.out(dictionaryEntry + ' gs');- }- break;- }- }-- var alpha = this.ctx.globalAlpha;- if (this.ctx._fillOpacity < 1) {- // TODO combine this with global opacity- alpha = this.ctx._fillOpacity;- }-- //TODO check for an opacity graphics state that was already created- //TODO do not set opacity if current value is already active- if (v2Support) {- var objOpac = this.pdf.internal.newObject2();- objOpac.push('<</Type /ExtGState');- //objOpac.push(this.ctx.globalAlpha + " CA"); // Stroke- //objOpac.push(this.ctx.globalAlpha + " ca"); // Not Stroke- objOpac.push('/CA ' + alpha); // Stroke- objOpac.push('/ca ' + alpha); // Not Stroke- objOpac.push('>>');- var gsName = 'GS_O_' + objOpac.objId;- this.pdf.internal.addGraphicsState(gsName, objOpac.objId);- this.pdf.internal.out('/' + gsName + ' gs');- }-- var xPath = this.path;-- for (var i = 0; i < xPath.length; i++) {- var pt = xPath[i];- switch (pt.type) {- case 'mt':- moves.push({ start: pt, deltas: [], abs: [] });- break;- case 'lt':- var delta = [pt.x - xPath[i - 1].x, pt.y - xPath[i - 1].y];- moves[moves.length - 1].deltas.push(delta);- moves[moves.length - 1].abs.push(pt);- break;- case 'bct':- var delta = [pt.x1 - xPath[i - 1].x, pt.y1 - xPath[i - 1].y, pt.x2 - xPath[i - 1].x, pt.y2 - xPath[i - 1].y, pt.x - xPath[i - 1].x, pt.y - xPath[i - 1].y];- moves[moves.length - 1].deltas.push(delta);- break;- case 'qct':- // convert to bezier- var x1 = xPath[i - 1].x + 2.0 / 3.0 * (pt.x1 - xPath[i - 1].x);- var y1 = xPath[i - 1].y + 2.0 / 3.0 * (pt.y1 - xPath[i - 1].y);- var x2 = pt.x + 2.0 / 3.0 * (pt.x1 - pt.x);- var y2 = pt.y + 2.0 / 3.0 * (pt.y1 - pt.y);- var x3 = pt.x;- var y3 = pt.y;- var delta = [x1 - xPath[i - 1].x, y1 - xPath[i - 1].y, x2 - xPath[i - 1].x, y2 - xPath[i - 1].y, x3 - xPath[i - 1].x, y3 - xPath[i - 1].y];- moves[moves.length - 1].deltas.push(delta);- break;- case 'arc':- //TODO this was hack to avoid out of bounds issue- if (moves.length == 0) {- moves.push({ start: { x: 0, y: 0 }, deltas: [], abs: [] });- }- moves[moves.length - 1].arc = true;- moves[moves.length - 1].abs.push(pt);- break;- case 'close':- //moves[moves.length - 1].deltas.push('close');- break;- }- }-- for (var i = 0; i < moves.length; i++) {- var style;- if (i == moves.length - 1) {- style = 'f';- if (fillRule === 'evenodd') {- style += '*';- }- } else {- style = null;- }-- if (moves[i].arc) {- var arcs = moves[i].abs;- for (var ii = 0; ii < arcs.length; ii++) {- var arc = arcs[ii];- //TODO lines deltas were getting in here- if (typeof arc.startAngle !== 'undefined') {- var start = arc.startAngle * 360 / (2 * Math.PI);- var end = arc.endAngle * 360 / (2 * Math.PI);- // Add the current position (last move to)- //var x = moves[i].start.x + arc.x;- //var y = moves[i].start.y + arc.y;- var x = arc.x;- var y = arc.y;- if (ii == 0) {- this.internal.move2(this, x, y);- }- this.internal.arc2(this, x, y, arc.radius, start, end, arc.anticlockwise, null, isClip);- } else {- this.internal.line2(c2d, arc.x, arc.y);- }- }-- // extra move bug causing close to resolve to wrong point- var x = moves[i].start.x;- var y = moves[i].start.y;- this.internal.line2(c2d, x, y);-- this.pdf.internal.out('h');- this.pdf.internal.out('f');- } else {- var x = moves[i].start.x;- var y = moves[i].start.y;- if (!isClip) {- this.pdf.lines(moves[i].deltas, x, y, null, style);- } else {- this.pdf.lines(moves[i].deltas, x, y, null, null);- this.pdf.clip_fixed();- }- }- }-- window.outIntercept = outInterceptOld;-- // if (this.ctx._clip_path.length > 0) {- // lines.push('Q');- // }- },-- pushMask: function pushMask() {- var v2Support = typeof this.pdf.internal.newObject2 === 'function';-- if (!v2Support) {- console.log('jsPDF v2 not enabled');- return;- }-- // define a mask stream- var obj = this.pdf.internal.newStreamObject();-- // define a mask state- var obj2 = this.pdf.internal.newObject2();- obj2.push('<</Type /ExtGState');- obj2.push('/SMask <</S /Alpha /G ' + obj.objId + ' 0 R>>'); // /S /Luminosity will need to define color space- obj2.push('>>');-- // add mask to page resources- var gsName = 'MASK' + obj2.objId;- this.pdf.internal.addGraphicsState(gsName, obj2.objId);-- var instruction = '/' + gsName + ' gs';- this.pdf.internal.out(instruction);- },-- clip: function clip() {- //TODO do we reset the path, or just copy it?- if (this.ctx._clip_path.length > 0) {- for (var i = 0; i < this.path.length; i++) {- this.ctx._clip_path.push(this.path[i]);- }- } else {- this.ctx._clip_path = this.path;- }- this.path = [];- },-- measureText: function measureText(text) {- var pdf = this.pdf;- return {- getWidth: function getWidth() {- var fontSize = pdf.internal.getFontSize();- var txtWidth = pdf.getStringUnitWidth(text) * fontSize / pdf.internal.scaleFactor;- return txtWidth;- },-- get width() {- return this.getWidth(text);- }- };- },- _getBaseline: function _getBaseline(y) {- var height = parseInt(this.pdf.internal.getFontSize());- // TODO Get descent from font descriptor- var descent = height * .25;- switch (this.ctx.textBaseline) {- case 'bottom':- return y - descent;- case 'top':- return y + height;- case 'hanging':- return y + height - descent;- case 'middle':- return y + height / 2 - descent;- case 'ideographic':- // TODO not implemented- return y;- case 'alphabetic':- default:- return y;- }- }- };-- var c2d = jsPDFAPI.context2d;-- // accessor methods- Object.defineProperty(c2d, 'fillStyle', {- set: function set(value) {- this.setFillStyle(value);- },- get: function get() {- return this.ctx.fillStyle;- }- });- Object.defineProperty(c2d, 'strokeStyle', {- set: function set(value) {- this.setStrokeStyle(value);- },- get: function get() {- return this.ctx.strokeStyle;- }- });- Object.defineProperty(c2d, 'lineWidth', {- set: function set(value) {- this.setLineWidth(value);- },- get: function get() {- return this.ctx.lineWidth;- }- });- Object.defineProperty(c2d, 'lineCap', {- set: function set(val) {- this.setLineCap(val);- },- get: function get() {- return this.ctx.lineCap;- }- });- Object.defineProperty(c2d, 'lineJoin', {- set: function set(val) {- this.setLineJoin(val);- },- get: function get() {- return this.ctx.lineJoin;- }- });- Object.defineProperty(c2d, 'miterLimit', {- set: function set(val) {- this.ctx.miterLimit = val;- },- get: function get() {- return this.ctx.miterLimit;- }- });- Object.defineProperty(c2d, 'textBaseline', {- set: function set(value) {- this.setTextBaseline(value);- },- get: function get() {- return this.getTextBaseline();- }- });- Object.defineProperty(c2d, 'textAlign', {- set: function set(value) {- this.setTextAlign(value);- },- get: function get() {- return this.getTextAlign();- }- });- Object.defineProperty(c2d, 'font', {- set: function set(value) {- this.setFont(value);- },- get: function get() {- return this.ctx.font;- }- });- Object.defineProperty(c2d, 'globalCompositeOperation', {- set: function set(value) {- this.ctx.globalCompositeOperation = value;- },- get: function get() {- return this.ctx.globalCompositeOperation;- }- });- Object.defineProperty(c2d, 'globalAlpha', {- set: function set(value) {- this.ctx.globalAlpha = value;- },- get: function get() {- return this.ctx.globalAlpha;- }- });- // Not HTML API- Object.defineProperty(c2d, 'ignoreClearRect', {- set: function set(value) {- this.ctx.ignoreClearRect = value;- },- get: function get() {- return this.ctx.ignoreClearRect;- }- });- // End Not HTML API-- c2d.internal = {};-- c2d.internal.rxRgb = /rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;- c2d.internal.rxRgba = /rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/;- c2d.internal.rxTransparent = /transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/;-- // http://hansmuller-flex.blogspot.com/2011/10/more-about-approximating-circular-arcs.html- c2d.internal.arc = function (c2d, xc, yc, r, a1, a2, anticlockwise, style) {- var includeMove = true;-- var k = this.pdf.internal.scaleFactor;- var pageHeight = this.pdf.internal.pageSize.height;- var f2 = this.pdf.internal.f2;-- var a1r = a1 * (Math.PI / 180);- var a2r = a2 * (Math.PI / 180);- var curves = this.createArc(r, a1r, a2r, anticlockwise);- var pathData = null;-- for (var i = 0; i < curves.length; i++) {- var curve = curves[i];- if (includeMove && i == 0) {- this.pdf.internal.out([f2((curve.x1 + xc) * k), f2((pageHeight - (curve.y1 + yc)) * k), 'm', f2((curve.x2 + xc) * k), f2((pageHeight - (curve.y2 + yc)) * k), f2((curve.x3 + xc) * k), f2((pageHeight - (curve.y3 + yc)) * k), f2((curve.x4 + xc) * k), f2((pageHeight - (curve.y4 + yc)) * k), 'c'].join(' '));- } else {- this.pdf.internal.out([f2((curve.x2 + xc) * k), f2((pageHeight - (curve.y2 + yc)) * k), f2((curve.x3 + xc) * k), f2((pageHeight - (curve.y3 + yc)) * k), f2((curve.x4 + xc) * k), f2((pageHeight - (curve.y4 + yc)) * k), 'c'].join(' '));- }-- //c2d._lastPoint = {x: curve.x1 + xc, y: curve.y1 + yc};- c2d._lastPoint = { x: xc, y: yc };- // f2((curve.x1 + xc) * k), f2((pageHeight - (curve.y1 + yc)) * k), 'm', f2((curve.x2 + xc) * k), f2((pageHeight - (curve.y2 + yc)) * k), f2((curve.x3 + xc) * k), f2((pageHeight - (curve.y3 + yc)) * k), f2((curve.x4 + xc) * k), f2((pageHeight - (curve.y4 + yc)) * k), 'c'- }-- if (style !== null) {- this.pdf.internal.out(this.pdf.internal.getStyle(style));- }- };-- /**- *- * @param x Edge point X- * @param y Edge point Y- * @param r Radius- * @param a1 start angle- * @param a2 end angle- * @param anticlockwise- * @param style- * @param isClip- */- c2d.internal.arc2 = function (c2d, x, y, r, a1, a2, anticlockwise, style, isClip) {- // we need to convert from cartesian to polar here methinks.- var centerX = x; // + r;- var centerY = y;-- if (false) {}-- if (!isClip) {- this.arc(c2d, centerX, centerY, r, a1, a2, anticlockwise, style);- } else {- this.arc(c2d, centerX, centerY, r, a1, a2, anticlockwise, null);- this.pdf.clip_fixed();- }- };-- c2d.internal.move2 = function (c2d, x, y) {- var k = this.pdf.internal.scaleFactor;- var pageHeight = this.pdf.internal.pageSize.height;- var f2 = this.pdf.internal.f2;-- this.pdf.internal.out([f2(x * k), f2((pageHeight - y) * k), 'm'].join(' '));- c2d._lastPoint = { x: x, y: y };- };-- c2d.internal.line2 = function (c2d, dx, dy) {- var k = this.pdf.internal.scaleFactor;- var pageHeight = this.pdf.internal.pageSize.height;- var f2 = this.pdf.internal.f2;-- //var pt = {x: c2d._lastPoint.x + dx, y: c2d._lastPoint.y + dy};- var pt = { x: dx, y: dy };-- this.pdf.internal.out([f2(pt.x * k), f2((pageHeight - pt.y) * k), 'l'].join(' '));- //this.pdf.internal.out('f');- c2d._lastPoint = pt;- };-- /**- * Return a array of objects that represent bezier curves which approximate the circular arc centered at the origin, from startAngle to endAngle (radians) with the specified radius.- *- * Each bezier curve is an object with four points, where x1,y1 and x4,y4 are the arc's end points and x2,y2 and x3,y3 are the cubic bezier's control points.- */-- c2d.internal.createArc = function (radius, startAngle, endAngle, anticlockwise) {-- var EPSILON = 0.00001; // Roughly 1/1000th of a degree, see below-- // normalize startAngle, endAngle to [-2PI, 2PI]- var twoPI = Math.PI * 2;- var startAngleN = startAngle;- if (startAngleN < twoPI || startAngleN > twoPI) {- startAngleN = startAngleN % twoPI;- }- var endAngleN = endAngle;- if (endAngleN < twoPI || endAngleN > twoPI) {- endAngleN = endAngleN % twoPI;- }-- // Compute the sequence of arc curves, up to PI/2 at a time.- // Total arc angle is less than 2PI.- var curves = [];- var piOverTwo = Math.PI / 2.0;- // var sgn = (startAngle < endAngle) ? +1 : -1; // clockwise or counterclockwise- var sgn = anticlockwise ? -1 : +1;-- var a1 = startAngle;- for (var totalAngle = Math.min(twoPI, Math.abs(endAngleN - startAngleN)); totalAngle > EPSILON;) {- var a2 = a1 + sgn * Math.min(totalAngle, piOverTwo);- curves.push(this.createSmallArc(radius, a1, a2));- totalAngle -= Math.abs(a2 - a1);- a1 = a2;- }-- return curves;- };-- /**- * Cubic bezier approximation of a circular arc centered at the origin, from (radians) a1 to a2, where a2-a1 < pi/2. The arc's radius is r.- *- * Returns an object with four points, where x1,y1 and x4,y4 are the arc's end points and x2,y2 and x3,y3 are the cubic bezier's control points.- *- * This algorithm is based on the approach described in: A. Riškus, "Approximation of a Cubic Bezier Curve by Circular Arcs and Vice Versa," Information Technology and Control, 35(4), 2006 pp. 371-378.- */-- c2d.internal.createSmallArc = function (r, a1, a2) {- // Compute all four points for an arc that subtends the same total angle- // but is centered on the X-axis-- var a = (a2 - a1) / 2.0;-- var x4 = r * Math.cos(a);- var y4 = r * Math.sin(a);- var x1 = x4;- var y1 = -y4;-- var q1 = x1 * x1 + y1 * y1;- var q2 = q1 + x1 * x4 + y1 * y4;- var k2 = 4 / 3 * (Math.sqrt(2 * q1 * q2) - q2) / (x1 * y4 - y1 * x4);-- var x2 = x1 - k2 * y1;- var y2 = y1 + k2 * x1;- var x3 = x2;- var y3 = -y2;-- // Find the arc points' actual locations by computing x1,y1 and x4,y4- // and rotating the control points by a + a1-- var ar = a + a1;- var cos_ar = Math.cos(ar);- var sin_ar = Math.sin(ar);-- return {- x1: r * Math.cos(a1),- y1: r * Math.sin(a1),- x2: x2 * cos_ar - y2 * sin_ar,- y2: x2 * sin_ar + y2 * cos_ar,- x3: x3 * cos_ar - y3 * sin_ar,- y3: x3 * sin_ar + y3 * cos_ar,- x4: r * Math.cos(a2),- y4: r * Math.sin(a2)- };- };-- function context() {- this._isStrokeTransparent = false;- this._strokeOpacity = 1;- this.strokeStyle = '#000000';- this.fillStyle = '#000000';- this._isFillTransparent = false;- this._fillOpacity = 1;- this.font = "12pt times";- this.textBaseline = 'alphabetic'; // top,bottom,middle,ideographic,alphabetic,hanging- this.textAlign = 'start';- this.lineWidth = 1;- this.lineJoin = 'miter'; // round, bevel, miter- this.lineCap = 'butt'; // butt, round, square- this._transform = [1, 0, 0, 1, 0, 0]; // sx, shy, shx, sy, tx, ty- this.globalCompositeOperation = 'normal';- this.globalAlpha = 1.0;- this._clip_path = [];- // TODO miter limit //default 10-- // Not HTML API- this.ignoreClearRect = false;-- this.copy = function (ctx) {- this._isStrokeTransparent = ctx._isStrokeTransparent;- this._strokeOpacity = ctx._strokeOpacity;- this.strokeStyle = ctx.strokeStyle;- this._isFillTransparent = ctx._isFillTransparent;- this._fillOpacity = ctx._fillOpacity;- this.fillStyle = ctx.fillStyle;- this.font = ctx.font;- this.lineWidth = ctx.lineWidth;- this.lineJoin = ctx.lineJoin;- this.lineCap = ctx.lineCap;- this.textBaseline = ctx.textBaseline;- this.textAlign = ctx.textAlign;- this._fontSize = ctx._fontSize;- this._transform = ctx._transform.slice(0);- this.globalCompositeOperation = ctx.globalCompositeOperation;- this.globalAlpha = ctx.globalAlpha;- this._clip_path = ctx._clip_path.slice(0); //TODO deep copy?-- // Not HTML API- this.ignoreClearRect = ctx.ignoreClearRect;- };- }-- return this;- })(jsPDF.API);-- /** @preserve- * jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser- * Copyright (c) 2012 Willow Systems Corporation, willow-systems.com- * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria- * 2014 Diego Casorran, https://github.com/diegocr- * 2014 Daniel Husar, https://github.com/danielhusar- * 2014 Wolfgang Gassler, https://github.com/woolfg- * 2014 Steven Spungin, https://github.com/flamenco- *- *- * ====================================================================- */-- (function (jsPDFAPI) {- var clone, _DrillForContent, FontNameDB, FontStyleMap, TextAlignMap, FontWeightMap, FloatMap, ClearMap, GetCSS, PurgeWhiteSpace, Renderer, ResolveFont, ResolveUnitedNumber, UnitedNumberMap, elementHandledElsewhere, images, loadImgs, checkForFooter, process, tableToJson;- clone = function () {- return function (obj) {- Clone.prototype = obj;- return new Clone();- };- function Clone() {}- }();- PurgeWhiteSpace = function PurgeWhiteSpace(array) {- var fragment, i, l, lTrimmed, r, rTrimmed, trailingSpace;- i = 0;- l = array.length;- fragment = void 0;- lTrimmed = false;- rTrimmed = false;- while (!lTrimmed && i !== l) {- fragment = array[i] = array[i].trimLeft();- if (fragment) {- lTrimmed = true;- }- i++;- }- i = l - 1;- while (l && !rTrimmed && i !== -1) {- fragment = array[i] = array[i].trimRight();- if (fragment) {- rTrimmed = true;- }- i--;- }- r = /\s+$/g;- trailingSpace = true;- i = 0;- while (i !== l) {- // Leave the line breaks intact- if (array[i] != "\u2028") {- fragment = array[i].replace(/\s+/g, " ");- if (trailingSpace) {- fragment = fragment.trimLeft();- }- if (fragment) {- trailingSpace = r.test(fragment);- }- array[i] = fragment;- }- i++;- }- return array;- };- Renderer = function Renderer(pdf, x, y, settings) {- this.pdf = pdf;- this.x = x;- this.y = y;- this.settings = settings;- //list of functions which are called after each element-rendering process- this.watchFunctions = [];- this.init();- return this;- };- ResolveFont = function ResolveFont(css_font_family_string) {- var name, part, parts;- name = void 0;- parts = css_font_family_string.split(",");- part = parts.shift();- while (!name && part) {- name = FontNameDB[part.trim().toLowerCase()];- part = parts.shift();- }- return name;- };- ResolveUnitedNumber = function ResolveUnitedNumber(css_line_height_string) {-- //IE8 issues- css_line_height_string = css_line_height_string === "auto" ? "0px" : css_line_height_string;- if (css_line_height_string.indexOf("em") > -1 && !isNaN(Number(css_line_height_string.replace("em", "")))) {- css_line_height_string = Number(css_line_height_string.replace("em", "")) * 18.719 + "px";- }- if (css_line_height_string.indexOf("pt") > -1 && !isNaN(Number(css_line_height_string.replace("pt", "")))) {- css_line_height_string = Number(css_line_height_string.replace("pt", "")) * 1.333 + "px";- }-- var normal, undef, value;- undef = void 0;- normal = 16.00;- value = UnitedNumberMap[css_line_height_string];- if (value) {- return value;- }- value = {- "xx-small": 9,- "x-small": 11,- small: 13,- medium: 16,- large: 19,- "x-large": 23,- "xx-large": 28,- auto: 0- }[{ css_line_height_string: css_line_height_string }];-- if (value !== undef) {- return UnitedNumberMap[css_line_height_string] = value / normal;- }- if (value = parseFloat(css_line_height_string)) {- return UnitedNumberMap[css_line_height_string] = value / normal;- }- value = css_line_height_string.match(/([\d\.]+)(px)/);- if (value.length === 3) {- return UnitedNumberMap[css_line_height_string] = parseFloat(value[1]) / normal;- }- return UnitedNumberMap[css_line_height_string] = 1;- };- GetCSS = function GetCSS(element) {- var css, tmp, computedCSSElement;- computedCSSElement = function (el) {- var compCSS;- compCSS = function (el) {- if (document.defaultView && document.defaultView.getComputedStyle) {- return document.defaultView.getComputedStyle(el, null);- } else if (el.currentStyle) {- return el.currentStyle;- } else {- return el.style;- }- }(el);- return function (prop) {- prop = prop.replace(/-\D/g, function (match) {- return match.charAt(1).toUpperCase();- });- return compCSS[prop];- };- }(element);- css = {};- tmp = void 0;- css["font-family"] = ResolveFont(computedCSSElement("font-family")) || "times";- css["font-style"] = FontStyleMap[computedCSSElement("font-style")] || "normal";- css["text-align"] = TextAlignMap[computedCSSElement("text-align")] || "left";- tmp = FontWeightMap[computedCSSElement("font-weight")] || "normal";- if (tmp === "bold") {- if (css["font-style"] === "normal") {- css["font-style"] = tmp;- } else {- css["font-style"] = tmp + css["font-style"];- }- }- css["font-size"] = ResolveUnitedNumber(computedCSSElement("font-size")) || 1;- css["line-height"] = ResolveUnitedNumber(computedCSSElement("line-height")) || 1;- css["display"] = computedCSSElement("display") === "inline" ? "inline" : "block";-- tmp = css["display"] === "block";- css["margin-top"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-top")) || 0;- css["margin-bottom"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-bottom")) || 0;- css["padding-top"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-top")) || 0;- css["padding-bottom"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-bottom")) || 0;- css["margin-left"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-left")) || 0;- css["margin-right"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-right")) || 0;- css["padding-left"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-left")) || 0;- css["padding-right"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-right")) || 0;-- css["page-break-before"] = computedCSSElement("page-break-before") || "auto";-- //float and clearing of floats- css["float"] = FloatMap[computedCSSElement("cssFloat")] || "none";- css["clear"] = ClearMap[computedCSSElement("clear")] || "none";-- css["color"] = computedCSSElement("color");-- return css;- };- elementHandledElsewhere = function elementHandledElsewhere(element, renderer, elementHandlers) {- var handlers, i, isHandledElsewhere, l, t;- isHandledElsewhere = false;- i = void 0;- l = void 0;- t = void 0;- handlers = elementHandlers["#" + element.id];- if (handlers) {- if (typeof handlers === "function") {- isHandledElsewhere = handlers(element, renderer);- } else {- i = 0;- l = handlers.length;- while (!isHandledElsewhere && i !== l) {- isHandledElsewhere = handlers[i](element, renderer);- i++;- }- }- }- handlers = elementHandlers[element.nodeName];- if (!isHandledElsewhere && handlers) {- if (typeof handlers === "function") {- isHandledElsewhere = handlers(element, renderer);- } else {- i = 0;- l = handlers.length;- while (!isHandledElsewhere && i !== l) {- isHandledElsewhere = handlers[i](element, renderer);- i++;- }- }- }- return isHandledElsewhere;- };- tableToJson = function tableToJson(table, renderer) {- var data, headers, i, j, rowData, tableRow, table_obj, table_with, cell, l;- data = [];- headers = [];- i = 0;- l = table.rows[0].cells.length;- table_with = table.clientWidth;- while (i < l) {- cell = table.rows[0].cells[i];- headers[i] = {- name: cell.textContent.toLowerCase().replace(/\s+/g, ''),- prompt: cell.textContent.replace(/\r?\n/g, ''),- width: cell.clientWidth / table_with * renderer.pdf.internal.pageSize.width- };- i++;- }- i = 1;- while (i < table.rows.length) {- tableRow = table.rows[i];- rowData = {};- j = 0;- while (j < tableRow.cells.length) {- rowData[headers[j].name] = tableRow.cells[j].textContent.replace(/\r?\n/g, '');- j++;- }- data.push(rowData);- i++;- }- return table_obj = {- rows: data,- headers: headers- };- };- var SkipNode = {- SCRIPT: 1,- STYLE: 1,- NOSCRIPT: 1,- OBJECT: 1,- EMBED: 1,- SELECT: 1- };- var listCount = 1;- _DrillForContent = function DrillForContent(element, renderer, elementHandlers) {- var cn, cns, fragmentCSS, i, isBlock, l, px2pt, table2json, cb;- cns = element.childNodes;- cn = void 0;- fragmentCSS = GetCSS(element);- isBlock = fragmentCSS.display === "block";- if (isBlock) {- renderer.setBlockBoundary();- renderer.setBlockStyle(fragmentCSS);- }- px2pt = 0.264583 * 72 / 25.4;- i = 0;- l = cns.length;- while (i < l) {- cn = cns[i];- if ((typeof cn === "undefined" ? "undefined" : _typeof(cn)) === "object") {-- //execute all watcher functions to e.g. reset floating- renderer.executeWatchFunctions(cn);-- /*** HEADER rendering **/- if (cn.nodeType === 1 && cn.nodeName === 'HEADER') {- var header = cn;- //store old top margin- var oldMarginTop = renderer.pdf.margins_doc.top;- //subscribe for new page event and render header first on every page- renderer.pdf.internal.events.subscribe('addPage', function (pageInfo) {- //set current y position to old margin- renderer.y = oldMarginTop;- //render all child nodes of the header element- _DrillForContent(header, renderer, elementHandlers);- //set margin to old margin + rendered header + 10 space to prevent overlapping- //important for other plugins (e.g. table) to start rendering at correct position after header- renderer.pdf.margins_doc.top = renderer.y + 10;- renderer.y += 10;- }, false);- }-- if (cn.nodeType === 8 && cn.nodeName === "#comment") {- if (~cn.textContent.indexOf("ADD_PAGE")) {- renderer.pdf.addPage();- renderer.y = renderer.pdf.margins_doc.top;- }- } else if (cn.nodeType === 1 && !SkipNode[cn.nodeName]) {- /*** IMAGE RENDERING ***/- var cached_image;- if (cn.nodeName === "IMG") {- var url = cn.getAttribute("src");- cached_image = images[renderer.pdf.sHashCode(url) || url];- }- if (cached_image) {- if (renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom < renderer.y + cn.height && renderer.y > renderer.pdf.margins_doc.top) {- renderer.pdf.addPage();- renderer.y = renderer.pdf.margins_doc.top;- //check if we have to set back some values due to e.g. header rendering for new page- renderer.executeWatchFunctions(cn);- }-- var imagesCSS = GetCSS(cn);- var imageX = renderer.x;- var fontToUnitRatio = 12 / renderer.pdf.internal.scaleFactor;-- //define additional paddings, margins which have to be taken into account for margin calculations- var additionalSpaceLeft = (imagesCSS["margin-left"] + imagesCSS["padding-left"]) * fontToUnitRatio;- var additionalSpaceRight = (imagesCSS["margin-right"] + imagesCSS["padding-right"]) * fontToUnitRatio;- var additionalSpaceTop = (imagesCSS["margin-top"] + imagesCSS["padding-top"]) * fontToUnitRatio;- var additionalSpaceBottom = (imagesCSS["margin-bottom"] + imagesCSS["padding-bottom"]) * fontToUnitRatio;-- //if float is set to right, move the image to the right border- //add space if margin is set- if (imagesCSS['float'] !== undefined && imagesCSS['float'] === 'right') {- imageX += renderer.settings.width - cn.width - additionalSpaceRight;- } else {- imageX += additionalSpaceLeft;- }-- renderer.pdf.addImage(cached_image, imageX, renderer.y + additionalSpaceTop, cn.width, cn.height);- cached_image = undefined;- //if the float prop is specified we have to float the text around the image- if (imagesCSS['float'] === 'right' || imagesCSS['float'] === 'left') {- //add functiont to set back coordinates after image rendering- renderer.watchFunctions.push(function (diffX, thresholdY, diffWidth, el) {- //undo drawing box adaptions which were set by floating- if (renderer.y >= thresholdY) {- renderer.x += diffX;- renderer.settings.width += diffWidth;- return true;- } else if (el && el.nodeType === 1 && !SkipNode[el.nodeName] && renderer.x + el.width > renderer.pdf.margins_doc.left + renderer.pdf.margins_doc.width) {- renderer.x += diffX;- renderer.y = thresholdY;- renderer.settings.width += diffWidth;- return true;- } else {- return false;- }- }.bind(this, imagesCSS['float'] === 'left' ? -cn.width - additionalSpaceLeft - additionalSpaceRight : 0, renderer.y + cn.height + additionalSpaceTop + additionalSpaceBottom, cn.width));- //reset floating by clear:both divs- //just set cursorY after the floating element- renderer.watchFunctions.push(function (yPositionAfterFloating, pages, el) {- if (renderer.y < yPositionAfterFloating && pages === renderer.pdf.internal.getNumberOfPages()) {- if (el.nodeType === 1 && GetCSS(el).clear === 'both') {- renderer.y = yPositionAfterFloating;- return true;- } else {- return false;- }- } else {- return true;- }- }.bind(this, renderer.y + cn.height, renderer.pdf.internal.getNumberOfPages()));-- //if floating is set we decrease the available width by the image width- renderer.settings.width -= cn.width + additionalSpaceLeft + additionalSpaceRight;- //if left just add the image width to the X coordinate- if (imagesCSS['float'] === 'left') {- renderer.x += cn.width + additionalSpaceLeft + additionalSpaceRight;- }- } else {- //if no floating is set, move the rendering cursor after the image height- renderer.y += cn.height + additionalSpaceTop + additionalSpaceBottom;- }-- /*** TABLE RENDERING ***/- } else if (cn.nodeName === "TABLE") {- table2json = tableToJson(cn, renderer);- renderer.y += 10;- renderer.pdf.table(renderer.x, renderer.y, table2json.rows, table2json.headers, {- autoSize: false,- printHeaders: elementHandlers.printHeaders,- margins: renderer.pdf.margins_doc,- css: GetCSS(cn)- });- renderer.y = renderer.pdf.lastCellPos.y + renderer.pdf.lastCellPos.h + 20;- } else if (cn.nodeName === "OL" || cn.nodeName === "UL") {- listCount = 1;- if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {- _DrillForContent(cn, renderer, elementHandlers);- }- renderer.y += 10;- } else if (cn.nodeName === "LI") {- var temp = renderer.x;- renderer.x += 20 / renderer.pdf.internal.scaleFactor;- renderer.y += 3;- if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {- _DrillForContent(cn, renderer, elementHandlers);- }- renderer.x = temp;- } else if (cn.nodeName === "BR") {- renderer.y += fragmentCSS["font-size"] * renderer.pdf.internal.scaleFactor;- renderer.addText("\u2028", clone(fragmentCSS));- } else {- if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {- _DrillForContent(cn, renderer, elementHandlers);- }- }- } else if (cn.nodeType === 3) {- var value = cn.nodeValue;- if (cn.nodeValue && cn.parentNode.nodeName === "LI") {- if (cn.parentNode.parentNode.nodeName === "OL") {- value = listCount++ + '. ' + value;- } else {- var fontSize = fragmentCSS["font-size"];- var offsetX = (3 - fontSize * 0.75) * renderer.pdf.internal.scaleFactor;- var offsetY = fontSize * 0.75 * renderer.pdf.internal.scaleFactor;- var radius = fontSize * 1.74 / renderer.pdf.internal.scaleFactor;- cb = function cb(x, y) {- this.pdf.circle(x + offsetX, y + offsetY, radius, 'FD');- };- }- }- // Only add the text if the text node is in the body element- // Add compatibility with IE11- if (!!(cn.ownerDocument.body.compareDocumentPosition(cn) & 16)) {- renderer.addText(value, fragmentCSS);- }- } else if (typeof cn === "string") {- renderer.addText(cn, fragmentCSS);- }- }- i++;- }- elementHandlers.outY = renderer.y;-- if (isBlock) {- return renderer.setBlockBoundary(cb);- }- };- images = {};- loadImgs = function loadImgs(element, renderer, elementHandlers, cb) {- var imgs = element.getElementsByTagName('img'),- l = imgs.length,- found_images,- x = 0;- function done() {- renderer.pdf.internal.events.publish('imagesLoaded');- cb(found_images);- }- function loadImage(url, width, height) {- if (!url) return;- var img = new Image();- found_images = ++x;- img.crossOrigin = '';- img.onerror = img.onload = function () {- if (img.complete) {- //to support data urls in images, set width and height- //as those values are not recognized automatically- if (img.src.indexOf('data:image/') === 0) {- img.width = width || img.width || 0;- img.height = height || img.height || 0;- }- //if valid image add to known images array- if (img.width + img.height) {- var hash = renderer.pdf.sHashCode(url) || url;- images[hash] = images[hash] || img;- }- }- if (! --x) {- done();- }- };- img.src = url;- }- while (l--) {- loadImage(imgs[l].getAttribute("src"), imgs[l].width, imgs[l].height);- }return x || done();- };- checkForFooter = function checkForFooter(elem, renderer, elementHandlers) {- //check if we can found a <footer> element- var footer = elem.getElementsByTagName("footer");- if (footer.length > 0) {-- footer = footer[0];-- //bad hack to get height of footer- //creat dummy out and check new y after fake rendering- var oldOut = renderer.pdf.internal.write;- var oldY = renderer.y;- renderer.pdf.internal.write = function () {};- _DrillForContent(footer, renderer, elementHandlers);- var footerHeight = Math.ceil(renderer.y - oldY) + 5;- renderer.y = oldY;- renderer.pdf.internal.write = oldOut;-- //add 20% to prevent overlapping- renderer.pdf.margins_doc.bottom += footerHeight;-- //Create function render header on every page- var renderFooter = function renderFooter(pageInfo) {- var pageNumber = pageInfo !== undefined ? pageInfo.pageNumber : 1;- //set current y position to old margin- var oldPosition = renderer.y;- //render all child nodes of the header element- renderer.y = renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom;- renderer.pdf.margins_doc.bottom -= footerHeight;-- //check if we have to add page numbers- var spans = footer.getElementsByTagName('span');- for (var i = 0; i < spans.length; ++i) {- //if we find some span element with class pageCounter, set the page- if ((" " + spans[i].className + " ").replace(/[\n\t]/g, " ").indexOf(" pageCounter ") > -1) {- spans[i].innerHTML = pageNumber;- }- //if we find some span element with class totalPages, set a variable which is replaced after rendering of all pages- if ((" " + spans[i].className + " ").replace(/[\n\t]/g, " ").indexOf(" totalPages ") > -1) {- spans[i].innerHTML = '###jsPDFVarTotalPages###';- }- }-- //render footer content- _DrillForContent(footer, renderer, elementHandlers);- //set bottom margin to previous height including the footer height- renderer.pdf.margins_doc.bottom += footerHeight;- //important for other plugins (e.g. table) to start rendering at correct position after header- renderer.y = oldPosition;- };-- //check if footer contains totalPages which should be replace at the disoposal of the document- var spans = footer.getElementsByTagName('span');- for (var i = 0; i < spans.length; ++i) {- if ((" " + spans[i].className + " ").replace(/[\n\t]/g, " ").indexOf(" totalPages ") > -1) {- renderer.pdf.internal.events.subscribe('htmlRenderingFinished', renderer.pdf.putTotalPages.bind(renderer.pdf, '###jsPDFVarTotalPages###'), true);- }- }-- //register event to render footer on every new page- renderer.pdf.internal.events.subscribe('addPage', renderFooter, false);- //render footer on first page- renderFooter();-- //prevent footer rendering- SkipNode['FOOTER'] = 1;- }- };- process = function process(pdf, element, x, y, settings, callback) {- if (!element) return false;- if (typeof element !== "string" && !element.parentNode) element = '' + element.innerHTML;- if (typeof element === "string") {- element = function (element) {- var $frame, $hiddendiv, framename, visuallyhidden;- framename = "jsPDFhtmlText" + Date.now().toString() + (Math.random() * 1000).toFixed(0);- visuallyhidden = "position: absolute !important;" + "clip: rect(1px 1px 1px 1px); /* IE6, IE7 */" + "clip: rect(1px, 1px, 1px, 1px);" + "padding:0 !important;" + "border:0 !important;" + "height: 1px !important;" + "width: 1px !important; " + "top:auto;" + "left:-100px;" + "overflow: hidden;";- $hiddendiv = document.createElement('div');- $hiddendiv.style.cssText = visuallyhidden;- $hiddendiv.innerHTML = "<iframe style=\"height:1px;width:1px\" name=\"" + framename + "\" />";- document.body.appendChild($hiddendiv);- $frame = window.frames[framename];- $frame.document.open();- $frame.document.writeln(element);- $frame.document.close();- return $frame.document.body;- }(element.replace(/<\/?script[^>]*?>/gi, ''));- }- var r = new Renderer(pdf, x, y, settings),- out;-- // 1. load images- // 2. prepare optional footer elements- // 3. render content- loadImgs.call(this, element, r, settings.elementHandlers, function (found_images) {- checkForFooter(element, r, settings.elementHandlers);- _DrillForContent(element, r, settings.elementHandlers);- //send event dispose for final taks (e.g. footer totalpage replacement)- r.pdf.internal.events.publish('htmlRenderingFinished');- out = r.dispose();- if (typeof callback === 'function') callback(out);else if (found_images) console.error('jsPDF Warning: rendering issues? provide a callback to fromHTML!');- });- return out || { x: r.x, y: r.y };- };- Renderer.prototype.init = function () {- this.paragraph = {- text: [],- style: []- };- return this.pdf.internal.write("q");- };- Renderer.prototype.dispose = function () {- this.pdf.internal.write("Q");- return {- x: this.x,- y: this.y,- ready: true- };- };-- //Checks if we have to execute some watcher functions- //e.g. to end text floating around an image- Renderer.prototype.executeWatchFunctions = function (el) {- var ret = false;- var narray = [];- if (this.watchFunctions.length > 0) {- for (var i = 0; i < this.watchFunctions.length; ++i) {- if (this.watchFunctions[i](el) === true) {- ret = true;- } else {- narray.push(this.watchFunctions[i]);- }- }- this.watchFunctions = narray;- }- return ret;- };-- Renderer.prototype.splitFragmentsIntoLines = function (fragments, styles) {- var currentLineLength, defaultFontSize, ff, fontMetrics, fontMetricsCache, fragment, fragmentChopped, fragmentLength, fragmentSpecificMetrics, fs, k, line, lines, maxLineLength, style;- defaultFontSize = 12;- k = this.pdf.internal.scaleFactor;- fontMetricsCache = {};- ff = void 0;- fs = void 0;- fontMetrics = void 0;- fragment = void 0;- style = void 0;- fragmentSpecificMetrics = void 0;- fragmentLength = void 0;- fragmentChopped = void 0;- line = [];- lines = [line];- currentLineLength = 0;- maxLineLength = this.settings.width;- while (fragments.length) {- fragment = fragments.shift();- style = styles.shift();- if (fragment) {- ff = style["font-family"];- fs = style["font-style"];- fontMetrics = fontMetricsCache[ff + fs];- if (!fontMetrics) {- fontMetrics = this.pdf.internal.getFont(ff, fs).metadata.Unicode;- fontMetricsCache[ff + fs] = fontMetrics;- }- fragmentSpecificMetrics = {- widths: fontMetrics.widths,- kerning: fontMetrics.kerning,- fontSize: style["font-size"] * defaultFontSize,- textIndent: currentLineLength- };- fragmentLength = this.pdf.getStringUnitWidth(fragment, fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;- if (fragment == "\u2028") {- line = [];- lines.push(line);- } else if (currentLineLength + fragmentLength > maxLineLength) {- fragmentChopped = this.pdf.splitTextToSize(fragment, maxLineLength, fragmentSpecificMetrics);- line.push([fragmentChopped.shift(), style]);- while (fragmentChopped.length) {- line = [[fragmentChopped.shift(), style]];- lines.push(line);- }- currentLineLength = this.pdf.getStringUnitWidth(line[0][0], fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;- } else {- line.push([fragment, style]);- currentLineLength += fragmentLength;- }- }- }-- //if text alignment was set, set margin/indent of each line- if (style['text-align'] !== undefined && (style['text-align'] === 'center' || style['text-align'] === 'right' || style['text-align'] === 'justify')) {- for (var i = 0; i < lines.length; ++i) {- var length = this.pdf.getStringUnitWidth(lines[i][0][0], fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;- //if there is more than on line we have to clone the style object as all lines hold a reference on this object- if (i > 0) {- lines[i][0][1] = clone(lines[i][0][1]);- }- var space = maxLineLength - length;-- if (style['text-align'] === 'right') {- lines[i][0][1]['margin-left'] = space;- //if alignment is not right, it has to be center so split the space to the left and the right- } else if (style['text-align'] === 'center') {- lines[i][0][1]['margin-left'] = space / 2;- //if justify was set, calculate the word spacing and define in by using the css property- } else if (style['text-align'] === 'justify') {- var countSpaces = lines[i][0][0].split(' ').length - 1;- lines[i][0][1]['word-spacing'] = space / countSpaces;- //ignore the last line in justify mode- if (i === lines.length - 1) {- lines[i][0][1]['word-spacing'] = 0;- }- }- }- }-- return lines;- };- Renderer.prototype.RenderTextFragment = function (text, style) {- var defaultFontSize, font, maxLineHeight;-- maxLineHeight = 0;- defaultFontSize = 12;-- if (this.pdf.internal.pageSize.height - this.pdf.margins_doc.bottom < this.y + this.pdf.internal.getFontSize()) {- this.pdf.internal.write("ET", "Q");- this.pdf.addPage();- this.y = this.pdf.margins_doc.top;- this.pdf.internal.write("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), style.color, "Td");- //move cursor by one line on new page- maxLineHeight = Math.max(maxLineHeight, style["line-height"], style["font-size"]);- this.pdf.internal.write(0, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td");- }-- font = this.pdf.internal.getFont(style["font-family"], style["font-style"]);-- // text color- var pdfTextColor = this.getPdfColor(style["color"]);- if (pdfTextColor !== this.lastTextColor) {- this.pdf.internal.write(pdfTextColor);- this.lastTextColor = pdfTextColor;- }-- //set the word spacing for e.g. justify style- if (style['word-spacing'] !== undefined && style['word-spacing'] > 0) {- this.pdf.internal.write(style['word-spacing'].toFixed(2), "Tw");- }-- this.pdf.internal.write("/" + font.id, (defaultFontSize * style["font-size"]).toFixed(2), "Tf", "(" + this.pdf.internal.pdfEscape(text) + ") Tj");-- //set the word spacing back to neutral => 0- if (style['word-spacing'] !== undefined) {- this.pdf.internal.write(0, "Tw");- }- };-- // Accepts #FFFFFF, rgb(int,int,int), or CSS Color Name- Renderer.prototype.getPdfColor = function (style) {- var textColor;- var r, g, b;-- var rx = /rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/;- var m = rx.exec(style);- if (m != null) {- r = parseInt(m[1]);- g = parseInt(m[2]);- b = parseInt(m[3]);- } else {- if (style.charAt(0) != '#') {- style = CssColors.colorNameToHex(style);- if (!style) {- style = '#000000';- }- }- r = style.substring(1, 3);- r = parseInt(r, 16);- g = style.substring(3, 5);- g = parseInt(g, 16);- b = style.substring(5, 7);- b = parseInt(b, 16);- }-- if (typeof r === 'string' && /^#[0-9A-Fa-f]{6}$/.test(r)) {- var hex = parseInt(r.substr(1), 16);- r = hex >> 16 & 255;- g = hex >> 8 & 255;- b = hex & 255;- }-- var f3 = this.f3;- if (r === 0 && g === 0 && b === 0 || typeof g === 'undefined') {- textColor = f3(r / 255) + ' g';- } else {- textColor = [f3(r / 255), f3(g / 255), f3(b / 255), 'rg'].join(' ');- }- return textColor;- };-- Renderer.prototype.f3 = function (number) {- return number.toFixed(3); // Ie, %.3f- }, Renderer.prototype.renderParagraph = function (cb) {- var blockstyle, defaultFontSize, fontToUnitRatio, fragments, i, l, line, lines, maxLineHeight, out, paragraphspacing_after, paragraphspacing_before, priorblockstyle, styles, fontSize;- fragments = PurgeWhiteSpace(this.paragraph.text);- styles = this.paragraph.style;- blockstyle = this.paragraph.blockstyle;- priorblockstyle = this.paragraph.priorblockstyle || {};- this.paragraph = {- text: [],- style: [],- blockstyle: {},- priorblockstyle: blockstyle- };- if (!fragments.join("").trim()) {- return;- }- lines = this.splitFragmentsIntoLines(fragments, styles);- line = void 0;- maxLineHeight = void 0;- defaultFontSize = 12;- fontToUnitRatio = defaultFontSize / this.pdf.internal.scaleFactor;- this.priorMarginBottom = this.priorMarginBottom || 0;- paragraphspacing_before = (Math.max((blockstyle["margin-top"] || 0) - this.priorMarginBottom, 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio;- paragraphspacing_after = ((blockstyle["margin-bottom"] || 0) + (blockstyle["padding-bottom"] || 0)) * fontToUnitRatio;- this.priorMarginBottom = blockstyle["margin-bottom"] || 0;-- if (blockstyle['page-break-before'] === 'always') {- this.pdf.addPage();- this.y = 0;- paragraphspacing_before = ((blockstyle["margin-top"] || 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio;- }-- out = this.pdf.internal.write;- i = void 0;- l = void 0;- this.y += paragraphspacing_before;- out("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), "Td");-- //stores the current indent of cursor position- var currentIndent = 0;-- while (lines.length) {- line = lines.shift();- maxLineHeight = 0;- i = 0;- l = line.length;- while (i !== l) {- if (line[i][0].trim()) {- maxLineHeight = Math.max(maxLineHeight, line[i][1]["line-height"], line[i][1]["font-size"]);- fontSize = line[i][1]["font-size"] * 7;- }- i++;- }- //if we have to move the cursor to adapt the indent- var indentMove = 0;- var wantedIndent = 0;- //if a margin was added (by e.g. a text-alignment), move the cursor- if (line[0][1]["margin-left"] !== undefined && line[0][1]["margin-left"] > 0) {- wantedIndent = this.pdf.internal.getCoordinateString(line[0][1]["margin-left"]);- indentMove = wantedIndent - currentIndent;- currentIndent = wantedIndent;- }- var indentMore = Math.max(blockstyle["margin-left"] || 0, 0) * fontToUnitRatio;- //move the cursor- out(indentMove + indentMore, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td");- i = 0;- l = line.length;- while (i !== l) {- if (line[i][0]) {- this.RenderTextFragment(line[i][0], line[i][1]);- }- i++;- }- this.y += maxLineHeight * fontToUnitRatio;-- //if some watcher function was executed successful, so e.g. margin and widths were changed,- //reset line drawing and calculate position and lines again- //e.g. to stop text floating around an image- if (this.executeWatchFunctions(line[0][1]) && lines.length > 0) {- var localFragments = [];- var localStyles = [];- //create fragment array of- lines.forEach(function (localLine) {- var i = 0;- var l = localLine.length;- while (i !== l) {- if (localLine[i][0]) {- localFragments.push(localLine[i][0] + ' ');- localStyles.push(localLine[i][1]);- }- ++i;- }- });- //split lines again due to possible coordinate changes- lines = this.splitFragmentsIntoLines(PurgeWhiteSpace(localFragments), localStyles);- //reposition the current cursor- out("ET", "Q");- out("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), "Td");- }- }- if (cb && typeof cb === "function") {- cb.call(this, this.x - 9, this.y - fontSize / 2);- }- out("ET", "Q");- return this.y += paragraphspacing_after;- };- Renderer.prototype.setBlockBoundary = function (cb) {- return this.renderParagraph(cb);- };- Renderer.prototype.setBlockStyle = function (css) {- return this.paragraph.blockstyle = css;- };- Renderer.prototype.addText = function (text, css) {- this.paragraph.text.push(text);- return this.paragraph.style.push(css);- };- FontNameDB = {- helvetica: "helvetica",- "sans-serif": "helvetica",- "times new roman": "times",- serif: "times",- times: "times",- monospace: "courier",- courier: "courier"- };- FontWeightMap = {- 100: "normal",- 200: "normal",- 300: "normal",- 400: "normal",- 500: "bold",- 600: "bold",- 700: "bold",- 800: "bold",- 900: "bold",- normal: "normal",- bold: "bold",- bolder: "bold",- lighter: "normal"- };- FontStyleMap = {- normal: "normal",- italic: "italic",- oblique: "italic"- };- TextAlignMap = {- left: "left",- right: "right",- center: "center",- justify: "justify"- };- FloatMap = {- none: 'none',- right: 'right',- left: 'left'- };- ClearMap = {- none: 'none',- both: 'both'- };- UnitedNumberMap = {- normal: 1- };- /**- * Converts HTML-formatted text into formatted PDF text.- *- * Notes:- * 2012-07-18- * Plugin relies on having browser, DOM around. The HTML is pushed into dom and traversed.- * Plugin relies on jQuery for CSS extraction.- * Targeting HTML output from Markdown templating, which is a very simple- * markup - div, span, em, strong, p. No br-based paragraph separation supported explicitly (but still may work.)- * Images, tables are NOT supported.- *- * @public- * @function- * @param HTML {String or DOM Element} HTML-formatted text, or pointer to DOM element that is to be rendered into PDF.- * @param x {Number} starting X coordinate in jsPDF instance's declared units.- * @param y {Number} starting Y coordinate in jsPDF instance's declared units.- * @param settings {Object} Additional / optional variables controlling parsing, rendering.- * @returns {Object} jsPDF instance- */- jsPDFAPI.fromHTML = function (HTML, x, y, settings, callback, margins) {- "use strict";-- this.margins_doc = margins || {- top: 0,- bottom: 0- };- if (!settings) settings = {};- if (!settings.elementHandlers) settings.elementHandlers = {};-- return process(this, HTML, isNaN(x) ? 4 : x, isNaN(y) ? 4 : y, settings, callback);- };- })(jsPDF.API);-- /** ====================================================================- * jsPDF JavaScript plugin- * Copyright (c) 2013 Youssef Beddad, [email protected]- *- *- * ====================================================================- */-- /*global jsPDF */-- (function (jsPDFAPI) {- 'use strict';-- var jsNamesObj, jsJsObj, text;- jsPDFAPI.addJS = function (txt) {- text = txt;- this.internal.events.subscribe('postPutResources', function (txt) {- jsNamesObj = this.internal.newObject();- this.internal.write('<< /Names [(EmbeddedJS) ' + (jsNamesObj + 1) + ' 0 R] >>', 'endobj');- jsJsObj = this.internal.newObject();- this.internal.write('<< /S /JavaScript /JS (', text, ') >>', 'endobj');- });- this.internal.events.subscribe('putCatalog', function () {- if (jsNamesObj !== undefined && jsJsObj !== undefined) {- this.internal.write('/Names <</JavaScript ' + jsNamesObj + ' 0 R>>');- }- });- return this;- };- })(jsPDF.API);-- /**- * jsPDF Outline PlugIn- * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- /**- * Generates a PDF Outline- */- ;- (function (jsPDFAPI) {- 'use strict';-- jsPDFAPI.events.push(['postPutResources', function () {- var pdf = this;- var rx = /^(\d+) 0 obj$/;-- // Write action goto objects for each page- // this.outline.destsGoto = [];- // for (var i = 0; i < totalPages; i++) {- // var id = pdf.internal.newObject();- // this.outline.destsGoto.push(id);- // pdf.internal.write("<</D[" + (i * 2 + 3) + " 0 R /XYZ null- // null null]/S/GoTo>> endobj");- // }- //- // for (var i = 0; i < dests.length; i++) {- // pdf.internal.write("(page_" + (i + 1) + ")" + dests[i] + " 0- // R");- // }- //- if (this.outline.root.children.length > 0) {- var lines = pdf.outline.render().split(/\r\n/);- for (var i = 0; i < lines.length; i++) {- var line = lines[i];- var m = rx.exec(line);- if (m != null) {- var oid = m[1];- pdf.internal.newObjectDeferredBegin(oid);- }- pdf.internal.write(line);- }- }-- // This code will write named destination for each page reference- // (page_1, etc)- if (this.outline.createNamedDestinations) {- var totalPages = this.internal.pages.length;- // WARNING: this assumes jsPDF starts on page 3 and pageIDs- // follow 5, 7, 9, etc- // Write destination objects for each page- var dests = [];- for (var i = 0; i < totalPages; i++) {- var id = pdf.internal.newObject();- dests.push(id);- var info = pdf.internal.getPageInfo(i + 1);- pdf.internal.write("<< /D[" + info.objId + " 0 R /XYZ null null null]>> endobj");- }-- // assign a name for each destination- var names2Oid = pdf.internal.newObject();- pdf.internal.write('<< /Names [ ');- for (var i = 0; i < dests.length; i++) {- pdf.internal.write("(page_" + (i + 1) + ")" + dests[i] + " 0 R");- }- pdf.internal.write(' ] >>', 'endobj');-- // var kids = pdf.internal.newObject();- // pdf.internal.write('<< /Kids [ ' + names2Oid + ' 0 R');- // pdf.internal.write(' ] >>', 'endobj');-- var namesOid = pdf.internal.newObject();- pdf.internal.write('<< /Dests ' + names2Oid + " 0 R");- pdf.internal.write('>>', 'endobj');- }- }]);-- jsPDFAPI.events.push(['putCatalog', function () {- var pdf = this;- if (pdf.outline.root.children.length > 0) {- pdf.internal.write("/Outlines", this.outline.makeRef(this.outline.root));- if (this.outline.createNamedDestinations) {- pdf.internal.write("/Names " + namesOid + " 0 R");- }- // Open with Bookmarks showing- // pdf.internal.write("/PageMode /UseOutlines");- }- }]);-- jsPDFAPI.events.push(['initialized', function () {- var pdf = this;-- pdf.outline = {- createNamedDestinations: false,- root: {- children: []- }- };-- var namesOid;- var destsGoto = [];-- /**- * Options: pageNumber- */- pdf.outline.add = function (parent, title, options) {- var item = {- title: title,- options: options,- children: []- };- if (parent == null) {- parent = this.root;- }- parent.children.push(item);- return item;- };-- pdf.outline.render = function () {- this.ctx = {};- this.ctx.val = '';- this.ctx.pdf = pdf;-- this.genIds_r(this.root);- this.renderRoot(this.root);- this.renderItems(this.root);-- return this.ctx.val;- };-- pdf.outline.genIds_r = function (node) {- node.id = pdf.internal.newObjectDeferred();- for (var i = 0; i < node.children.length; i++) {- this.genIds_r(node.children[i]);- }- };-- pdf.outline.renderRoot = function (node) {- this.objStart(node);- this.line('/Type /Outlines');- if (node.children.length > 0) {- this.line('/First ' + this.makeRef(node.children[0]));- this.line('/Last ' + this.makeRef(node.children[node.children.length - 1]));- }- this.line('/Count ' + this.count_r({- count: 0- }, node));- this.objEnd();- };-- pdf.outline.renderItems = function (node) {- for (var i = 0; i < node.children.length; i++) {- var item = node.children[i];- this.objStart(item);-- this.line('/Title ' + this.makeString(item.title));-- this.line('/Parent ' + this.makeRef(node));- if (i > 0) {- this.line('/Prev ' + this.makeRef(node.children[i - 1]));- }- if (i < node.children.length - 1) {- this.line('/Next ' + this.makeRef(node.children[i + 1]));- }- if (item.children.length > 0) {- this.line('/First ' + this.makeRef(item.children[0]));- this.line('/Last ' + this.makeRef(item.children[item.children.length - 1]));- }-- var count = this.count = this.count_r({- count: 0- }, item);- if (count > 0) {- this.line('/Count ' + count);- }-- if (item.options) {- if (item.options.pageNumber) {- // Explicit Destination- //WARNING this assumes page ids are 3,5,7, etc.- var info = pdf.internal.getPageInfo(item.options.pageNumber);- this.line('/Dest ' + '[' + info.objId + ' 0 R /XYZ 0 ' + this.ctx.pdf.internal.pageSize.height + ' 0]');- // this line does not work on all clients (pageNumber instead of page ref)- //this.line('/Dest ' + '[' + (item.options.pageNumber - 1) + ' /XYZ 0 ' + this.ctx.pdf.internal.pageSize.height + ' 0]');-- // Named Destination- // this.line('/Dest (page_' + (item.options.pageNumber) + ')');-- // Action Destination- // var id = pdf.internal.newObject();- // pdf.internal.write('<</D[' + (item.options.pageNumber - 1) + ' /XYZ null null null]/S/GoTo>> endobj');- // this.line('/A ' + id + ' 0 R' );- }- }- this.objEnd();- }- for (var i = 0; i < node.children.length; i++) {- var item = node.children[i];- this.renderItems(item);- }- };-- pdf.outline.line = function (text) {- this.ctx.val += text + '\r\n';- };-- pdf.outline.makeRef = function (node) {- return node.id + ' 0 R';- };-- pdf.outline.makeString = function (val) {- return '(' + pdf.internal.pdfEscape(val) + ')';- };-- pdf.outline.objStart = function (node) {- this.ctx.val += '\r\n' + node.id + ' 0 obj' + '\r\n<<\r\n';- };-- pdf.outline.objEnd = function (node) {- this.ctx.val += '>> \r\n' + 'endobj' + '\r\n';- };-- pdf.outline.count_r = function (ctx, node) {- for (var i = 0; i < node.children.length; i++) {- ctx.count++;- this.count_r(ctx, node.children[i]);- }- return ctx.count;- };- }]);-- return this;- })(jsPDF.API);-- /**@preserve- * ====================================================================- * jsPDF PNG PlugIn- * Copyright (c) 2014 James Robb, https://github.com/jamesbrobb- *- *- * ====================================================================- */-- (function (jsPDFAPI) {- 'use strict';-- /*- * @see http://www.w3.org/TR/PNG-Chunks.html- *- Color Allowed Interpretation- Type Bit Depths- 0 1,2,4,8,16 Each pixel is a grayscale sample.- 2 8,16 Each pixel is an R,G,B triple.- 3 1,2,4,8 Each pixel is a palette index;- a PLTE chunk must appear.- 4 8,16 Each pixel is a grayscale sample,- followed by an alpha sample.- 6 8,16 Each pixel is an R,G,B triple,- followed by an alpha sample.- */-- /*- * PNG filter method types- *- * @see http://www.w3.org/TR/PNG-Filters.html- * @see http://www.libpng.org/pub/png/book/chapter09.html- *- * This is what the value 'Predictor' in decode params relates to- *- * 15 is "optimal prediction", which means the prediction algorithm can change from line to line.- * In that case, you actually have to read the first byte off each line for the prediction algorthim (which should be 0-4, corresponding to PDF 10-14) and select the appropriate unprediction algorithm based on that byte.- *- 0 None- 1 Sub- 2 Up- 3 Average- 4 Paeth- */-- var doesNotHavePngJS = function doesNotHavePngJS() {- return typeof PNG !== 'function' || typeof FlateStream !== 'function';- },- canCompress = function canCompress(value) {- return value !== jsPDFAPI.image_compression.NONE && hasCompressionJS();- },- hasCompressionJS = function hasCompressionJS() {- var inst = typeof Deflater === 'function';- if (!inst) throw new Error("requires deflate.js for compression");- return inst;- },- compressBytes = function compressBytes(bytes, lineLength, colorsPerPixel, compression) {-- var level = 5,- filter_method = filterUp;-- switch (compression) {-- case jsPDFAPI.image_compression.FAST:-- level = 3;- filter_method = filterSub;- break;-- case jsPDFAPI.image_compression.MEDIUM:-- level = 6;- filter_method = filterAverage;- break;-- case jsPDFAPI.image_compression.SLOW:-- level = 9;- filter_method = filterPaeth; //uses to sum to choose best filter for each line- break;- }-- bytes = applyPngFilterMethod(bytes, lineLength, colorsPerPixel, filter_method);-- var header = new Uint8Array(createZlibHeader(level));- var checksum = adler32(bytes);-- var deflate = new Deflater(level);- var a = deflate.append(bytes);- var cBytes = deflate.flush();-- var len = header.length + a.length + cBytes.length;-- var cmpd = new Uint8Array(len + 4);- cmpd.set(header);- cmpd.set(a, header.length);- cmpd.set(cBytes, header.length + a.length);-- cmpd[len++] = checksum >>> 24 & 0xff;- cmpd[len++] = checksum >>> 16 & 0xff;- cmpd[len++] = checksum >>> 8 & 0xff;- cmpd[len++] = checksum & 0xff;-- return jsPDFAPI.arrayBufferToBinaryString(cmpd);- },- createZlibHeader = function createZlibHeader(bytes, level) {- /*- * @see http://www.ietf.org/rfc/rfc1950.txt for zlib header- */- var cm = 8;- var cinfo = Math.LOG2E * Math.log(0x8000) - 8;- var cmf = cinfo << 4 | cm;-- var hdr = cmf << 8;- var flevel = Math.min(3, (level - 1 & 0xff) >> 1);-- hdr |= flevel << 6;- hdr |= 0; //FDICT- hdr += 31 - hdr % 31;-- return [cmf, hdr & 0xff & 0xff];- },- adler32 = function adler32(array, param) {- var adler = 1;- var s1 = adler & 0xffff,- s2 = adler >>> 16 & 0xffff;- var len = array.length;- var tlen;- var i = 0;-- while (len > 0) {- tlen = len > param ? param : len;- len -= tlen;- do {- s1 += array[i++];- s2 += s1;- } while (--tlen);-- s1 %= 65521;- s2 %= 65521;- }-- return (s2 << 16 | s1) >>> 0;- },- applyPngFilterMethod = function applyPngFilterMethod(bytes, lineLength, colorsPerPixel, filter_method) {- var lines = bytes.length / lineLength,- result = new Uint8Array(bytes.length + lines),- filter_methods = getFilterMethods(),- i = 0,- line,- prevLine,- offset;-- for (; i < lines; i++) {- offset = i * lineLength;- line = bytes.subarray(offset, offset + lineLength);-- if (filter_method) {- result.set(filter_method(line, colorsPerPixel, prevLine), offset + i);- } else {-- var j = 0,- len = filter_methods.length,- results = [];-- for (; j < len; j++) {- results[j] = filter_methods[j](line, colorsPerPixel, prevLine);- }var ind = getIndexOfSmallestSum(results.concat());-- result.set(results[ind], offset + i);- }-- prevLine = line;- }-- return result;- },- filterNone = function filterNone(line, colorsPerPixel, prevLine) {- /*var result = new Uint8Array(line.length + 1);- result[0] = 0;- result.set(line, 1);*/-- var result = Array.apply([], line);- result.unshift(0);-- return result;- },- filterSub = function filterSub(line, colorsPerPixel, prevLine) {- var result = [],- i = 0,- len = line.length,- left;-- result[0] = 1;-- for (; i < len; i++) {- left = line[i - colorsPerPixel] || 0;- result[i + 1] = line[i] - left + 0x0100 & 0xff;- }-- return result;- },- filterUp = function filterUp(line, colorsPerPixel, prevLine) {- var result = [],- i = 0,- len = line.length,- up;-- result[0] = 2;-- for (; i < len; i++) {- up = prevLine && prevLine[i] || 0;- result[i + 1] = line[i] - up + 0x0100 & 0xff;- }-- return result;- },- filterAverage = function filterAverage(line, colorsPerPixel, prevLine) {- var result = [],- i = 0,- len = line.length,- left,- up;-- result[0] = 3;-- for (; i < len; i++) {- left = line[i - colorsPerPixel] || 0;- up = prevLine && prevLine[i] || 0;- result[i + 1] = line[i] + 0x0100 - (left + up >>> 1) & 0xff;- }-- return result;- },- filterPaeth = function filterPaeth(line, colorsPerPixel, prevLine) {- var result = [],- i = 0,- len = line.length,- left,- up,- upLeft,- paeth;-- result[0] = 4;-- for (; i < len; i++) {- left = line[i - colorsPerPixel] || 0;- up = prevLine && prevLine[i] || 0;- upLeft = prevLine && prevLine[i - colorsPerPixel] || 0;- paeth = paethPredictor(left, up, upLeft);- result[i + 1] = line[i] - paeth + 0x0100 & 0xff;- }-- return result;- },- paethPredictor = function paethPredictor(left, up, upLeft) {-- var p = left + up - upLeft,- pLeft = Math.abs(p - left),- pUp = Math.abs(p - up),- pUpLeft = Math.abs(p - upLeft);-- return pLeft <= pUp && pLeft <= pUpLeft ? left : pUp <= pUpLeft ? up : upLeft;- },- getFilterMethods = function getFilterMethods() {- return [filterNone, filterSub, filterUp, filterAverage, filterPaeth];- },- getIndexOfSmallestSum = function getIndexOfSmallestSum(arrays) {- var i = 0,- len = arrays.length,- sum,- min,- ind;-- while (i < len) {- sum = absSum(arrays[i].slice(1));-- if (sum < min || !min) {- min = sum;- ind = i;- }-- i++;- }-- return ind;- },- absSum = function absSum(array) {- var i = 0,- len = array.length,- sum = 0;-- while (i < len) {- sum += Math.abs(array[i++]);- }return sum;- },- getPredictorFromCompression = function getPredictorFromCompression(compression) {- var predictor;- switch (compression) {- case jsPDFAPI.image_compression.FAST:- predictor = 11;- break;-- case jsPDFAPI.image_compression.MEDIUM:- predictor = 13;- break;-- case jsPDFAPI.image_compression.SLOW:- predictor = 14;- break;- }- return predictor;- },- logImg = function logImg(img) {- console.log("width: " + img.width);- console.log("height: " + img.height);- console.log("bits: " + img.bits);- console.log("colorType: " + img.colorType);- console.log("transparency:");- console.log(img.transparency);- console.log("text:");- console.log(img.text);- console.log("compressionMethod: " + img.compressionMethod);- console.log("filterMethod: " + img.filterMethod);- console.log("interlaceMethod: " + img.interlaceMethod);- console.log("imgData:");- console.log(img.imgData);- console.log("palette:");- console.log(img.palette);- console.log("colors: " + img.colors);- console.log("colorSpace: " + img.colorSpace);- console.log("pixelBitlength: " + img.pixelBitlength);- console.log("hasAlphaChannel: " + img.hasAlphaChannel);- };-- jsPDFAPI.processPNG = function (imageData, imageIndex, alias, compression, dataAsBinaryString) {- 'use strict';-- var colorSpace = this.color_spaces.DEVICE_RGB,- decode = this.decode.FLATE_DECODE,- bpc = 8,- img,- dp,- trns,- colors,- pal,- smask;-- /* if(this.isString(imageData)) {- }*/-- if (this.isArrayBuffer(imageData)) imageData = new Uint8Array(imageData);-- if (this.isArrayBufferView(imageData)) {-- if (doesNotHavePngJS()) throw new Error("PNG support requires png.js and zlib.js");-- img = new PNG(imageData);- imageData = img.imgData;- bpc = img.bits;- colorSpace = img.colorSpace;- colors = img.colors;-- //logImg(img);-- /*- * colorType 6 - Each pixel is an R,G,B triple, followed by an alpha sample.- *- * colorType 4 - Each pixel is a grayscale sample, followed by an alpha sample.- *- * Extract alpha to create two separate images, using the alpha as a sMask- */- if ([4, 6].indexOf(img.colorType) !== -1) {-- /*- * processes 8 bit RGBA and grayscale + alpha images- */- if (img.bits === 8) {-- var pixels = img.pixelBitlength == 32 ? new Uint32Array(img.decodePixels().buffer) : img.pixelBitlength == 16 ? new Uint16Array(img.decodePixels().buffer) : new Uint8Array(img.decodePixels().buffer),- len = pixels.length,- imgData = new Uint8Array(len * img.colors),- alphaData = new Uint8Array(len),- pDiff = img.pixelBitlength - img.bits,- i = 0,- n = 0,- pixel,- pbl;-- for (; i < len; i++) {- pixel = pixels[i];- pbl = 0;-- while (pbl < pDiff) {-- imgData[n++] = pixel >>> pbl & 0xff;- pbl = pbl + img.bits;- }-- alphaData[i] = pixel >>> pbl & 0xff;- }- }-- /*- * processes 16 bit RGBA and grayscale + alpha images- */- if (img.bits === 16) {-- var pixels = new Uint32Array(img.decodePixels().buffer),- len = pixels.length,- imgData = new Uint8Array(len * (32 / img.pixelBitlength) * img.colors),- alphaData = new Uint8Array(len * (32 / img.pixelBitlength)),- hasColors = img.colors > 1,- i = 0,- n = 0,- a = 0,- pixel;-- while (i < len) {- pixel = pixels[i++];-- imgData[n++] = pixel >>> 0 & 0xFF;-- if (hasColors) {- imgData[n++] = pixel >>> 16 & 0xFF;-- pixel = pixels[i++];- imgData[n++] = pixel >>> 0 & 0xFF;- }-- alphaData[a++] = pixel >>> 16 & 0xFF;- }-- bpc = 8;- }-- if (canCompress(compression)) {-- imageData = compressBytes(imgData, img.width * img.colors, img.colors, compression);- smask = compressBytes(alphaData, img.width, 1, compression);- } else {-- imageData = imgData;- smask = alphaData;- decode = null;- }- }-- /*- * Indexed png. Each pixel is a palette index.- */- if (img.colorType === 3) {-- colorSpace = this.color_spaces.INDEXED;- pal = img.palette;-- if (img.transparency.indexed) {-- var trans = img.transparency.indexed;-- var total = 0,- i = 0,- len = trans.length;-- for (; i < len; ++i) {- total += trans[i];- }total = total / 255;-- /*- * a single color is specified as 100% transparent (0),- * so we set trns to use a /Mask with that index- */- if (total === len - 1 && trans.indexOf(0) !== -1) {- trns = [trans.indexOf(0)];-- /*- * there's more than one colour within the palette that specifies- * a transparency value less than 255, so we unroll the pixels to create an image sMask- */- } else if (total !== len) {-- var pixels = img.decodePixels(),- alphaData = new Uint8Array(pixels.length),- i = 0,- len = pixels.length;-- for (; i < len; i++) {- alphaData[i] = trans[pixels[i]];- }smask = compressBytes(alphaData, img.width, 1);- }- }- }-- var predictor = getPredictorFromCompression(compression);-- if (decode === this.decode.FLATE_DECODE) dp = '/Predictor ' + predictor + ' /Colors ' + colors + ' /BitsPerComponent ' + bpc + ' /Columns ' + img.width;else- //remove 'Predictor' as it applies to the type of png filter applied to its IDAT - we only apply with compression- dp = '/Colors ' + colors + ' /BitsPerComponent ' + bpc + ' /Columns ' + img.width;-- if (this.isArrayBuffer(imageData) || this.isArrayBufferView(imageData)) imageData = this.arrayBufferToBinaryString(imageData);-- if (smask && this.isArrayBuffer(smask) || this.isArrayBufferView(smask)) smask = this.arrayBufferToBinaryString(smask);-- return this.createImageInfo(imageData, img.width, img.height, colorSpace, bpc, decode, imageIndex, alias, dp, trns, pal, smask, predictor);- }-- throw new Error("Unsupported PNG image data, try using JPEG instead.");- };- })(jsPDF.API);-- /**- * jsPDF Autoprint Plugin- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- (function (jsPDFAPI) {- 'use strict';-- jsPDFAPI.autoPrint = function () {- 'use strict';-- var refAutoPrintTag;-- this.internal.events.subscribe('postPutResources', function () {- refAutoPrintTag = this.internal.newObject();- this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");- });-- this.internal.events.subscribe("putCatalog", function () {- this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");- });- return this;- };- })(jsPDF.API);-- /** @preserve- * jsPDF split_text_to_size plugin - MIT license.- * Copyright (c) 2012 Willow Systems Corporation, willow-systems.com- * 2014 Diego Casorran, https://github.com/diegocr- */- /**- *- * ====================================================================- */-- ;(function (API) {- 'use strict';-- /**- Returns an array of length matching length of the 'word' string, with each- cell ocupied by the width of the char in that position.-- @function- @param word {String}- @param widths {Object}- @param kerning {Object}- @returns {Array}- */-- var getCharWidthsArray = API.getCharWidthsArray = function (text, options) {-- if (!options) {- options = {};- }-- var widths = options.widths ? options.widths : this.internal.getFont().metadata.Unicode.widths,- widthsFractionOf = widths.fof ? widths.fof : 1,- kerning = options.kerning ? options.kerning : this.internal.getFont().metadata.Unicode.kerning,- kerningFractionOf = kerning.fof ? kerning.fof : 1;-- // console.log("widths, kergnings", widths, kerning)-- var i,- l,- char_code,- prior_char_code = 0 // for kerning- ,- default_char_width = widths[0] || widthsFractionOf,- output = [];-- for (i = 0, l = text.length; i < l; i++) {- char_code = text.charCodeAt(i);- output.push((widths[char_code] || default_char_width) / widthsFractionOf + (kerning[char_code] && kerning[char_code][prior_char_code] || 0) / kerningFractionOf);- prior_char_code = char_code;- }-- return output;- };- var getArraySum = function getArraySum(array) {- var i = array.length,- output = 0;- while (i) {- ;i--;- output += array[i];- }- return output;- };- /**- Returns a widths of string in a given font, if the font size is set as 1 point.-- In other words, this is "proportional" value. For 1 unit of font size, the length- of the string will be that much.-- Multiply by font size to get actual width in *points*- Then divide by 72 to get inches or divide by (72/25.6) to get 'mm' etc.-- @public- @function- @param- @returns {Type}- */- var getStringUnitWidth = API.getStringUnitWidth = function (text, options) {- return getArraySum(getCharWidthsArray.call(this, text, options));- };-- /**- returns array of lines- */- var splitLongWord = function splitLongWord(word, widths_array, firstLineMaxLen, maxLen) {- var answer = [];-- // 1st, chop off the piece that can fit on the hanging line.- var i = 0,- l = word.length,- workingLen = 0;- while (i !== l && workingLen + widths_array[i] < firstLineMaxLen) {- workingLen += widths_array[i];i++;- }- // this is first line.- answer.push(word.slice(0, i));-- // 2nd. Split the rest into maxLen pieces.- var startOfLine = i;- workingLen = 0;- while (i !== l) {- if (workingLen + widths_array[i] > maxLen) {- answer.push(word.slice(startOfLine, i));- workingLen = 0;- startOfLine = i;- }- workingLen += widths_array[i];i++;- }- if (startOfLine !== i) {- answer.push(word.slice(startOfLine, i));- }-- return answer;- };-- // Note, all sizing inputs for this function must be in "font measurement units"- // By default, for PDF, it's "point".- var splitParagraphIntoLines = function splitParagraphIntoLines(text, maxlen, options) {- // at this time works only on Western scripts, ones with space char- // separating the words. Feel free to expand.-- if (!options) {- options = {};- }-- var line = [],- lines = [line],- line_length = options.textIndent || 0,- separator_length = 0,- current_word_length = 0,- word,- widths_array,- words = text.split(' '),- spaceCharWidth = getCharWidthsArray(' ', options)[0],- i,- l,- tmp,- lineIndent;-- if (options.lineIndent === -1) {- lineIndent = words[0].length + 2;- } else {- lineIndent = options.lineIndent || 0;- }- if (lineIndent) {- var pad = Array(lineIndent).join(" "),- wrds = [];- words.map(function (wrd) {- wrd = wrd.split(/\s*\n/);- if (wrd.length > 1) {- wrds = wrds.concat(wrd.map(function (wrd, idx) {- return (idx && wrd.length ? "\n" : "") + wrd;- }));- } else {- wrds.push(wrd[0]);- }- });- words = wrds;- lineIndent = getStringUnitWidth(pad, options);- }-- for (i = 0, l = words.length; i < l; i++) {- var force = 0;-- word = words[i];- if (lineIndent && word[0] == "\n") {- word = word.substr(1);- force = 1;- }- widths_array = getCharWidthsArray(word, options);- current_word_length = getArraySum(widths_array);-- if (line_length + separator_length + current_word_length > maxlen || force) {- if (current_word_length > maxlen) {- // this happens when you have space-less long URLs for example.- // we just chop these to size. We do NOT insert hiphens- tmp = splitLongWord(word, widths_array, maxlen - (line_length + separator_length), maxlen);- // first line we add to existing line object- line.push(tmp.shift()); // it's ok to have extra space indicator there- // last line we make into new line object- line = [tmp.pop()];- // lines in the middle we apped to lines object as whole lines- while (tmp.length) {- lines.push([tmp.shift()]); // single fragment occupies whole line- }- current_word_length = getArraySum(widths_array.slice(word.length - line[0].length));- } else {- // just put it on a new line- line = [word];- }-- // now we attach new line to lines- lines.push(line);- line_length = current_word_length + lineIndent;- separator_length = spaceCharWidth;- } else {- line.push(word);-- line_length += separator_length + current_word_length;- separator_length = spaceCharWidth;- }- }-- if (lineIndent) {- var postProcess = function postProcess(ln, idx) {- return (idx ? pad : '') + ln.join(" ");- };- } else {- var postProcess = function postProcess(ln) {- return ln.join(" ");- };- }-- return lines.map(postProcess);- };-- /**- Splits a given string into an array of strings. Uses 'size' value- (in measurement units declared as default for the jsPDF instance)- and the font's "widths" and "Kerning" tables, where available, to- determine display length of a given string for a given font.-- We use character's 100% of unit size (height) as width when Width- table or other default width is not available.-- @public- @function- @param text {String} Unencoded, regular JavaScript (Unicode, UTF-16 / UCS-2) string.- @param size {Number} Nominal number, measured in units default to this instance of jsPDF.- @param options {Object} Optional flags needed for chopper to do the right thing.- @returns {Array} with strings chopped to size.- */- API.splitTextToSize = function (text, maxlen, options) {- 'use strict';-- if (!options) {- options = {};- }-- var fsize = options.fontSize || this.internal.getFontSize(),- newOptions = function (options) {- var widths = { 0: 1 },- kerning = {};-- if (!options.widths || !options.kerning) {- var f = this.internal.getFont(options.fontName, options.fontStyle),- encoding = 'Unicode';- // NOT UTF8, NOT UTF16BE/LE, NOT UCS2BE/LE- // Actual JavaScript-native String's 16bit char codes used.- // no multi-byte logic here-- if (f.metadata[encoding]) {- return {- widths: f.metadata[encoding].widths || widths,- kerning: f.metadata[encoding].kerning || kerning- };- }- } else {- return {- widths: options.widths,- kerning: options.kerning- };- }-- // then use default values- return {- widths: widths,- kerning: kerning- };- }.call(this, options);-- // first we split on end-of-line chars- var paragraphs;- if (Array.isArray(text)) {- paragraphs = text;- } else {- paragraphs = text.split(/\r?\n/);- }-- // now we convert size (max length of line) into "font size units"- // at present time, the "font size unit" is always 'point'- // 'proportional' means, "in proportion to font size"- var fontUnit_maxLen = 1.0 * this.internal.scaleFactor * maxlen / fsize;- // at this time, fsize is always in "points" regardless of the default measurement unit of the doc.- // this may change in the future?- // until then, proportional_maxlen is likely to be in 'points'-- // If first line is to be indented (shorter or longer) than maxLen- // we indicate that by using CSS-style "text-indent" option.- // here it's in font units too (which is likely 'points')- // it can be negative (which makes the first line longer than maxLen)- newOptions.textIndent = options.textIndent ? options.textIndent * 1.0 * this.internal.scaleFactor / fsize : 0;- newOptions.lineIndent = options.lineIndent;-- var i,- l,- output = [];- for (i = 0, l = paragraphs.length; i < l; i++) {- output = output.concat(splitParagraphIntoLines(paragraphs[i], fontUnit_maxLen, newOptions));- }-- return output;- };- })(jsPDF.API);-- /** @preserve- jsPDF standard_fonts_metrics plugin- Copyright (c) 2012 Willow Systems Corporation, willow-systems.com- MIT license.- */- /**- *- * ====================================================================- */-- ;(function (API) {- 'use strict';-- /*- # reference (Python) versions of 'compress' and 'uncompress'- # only 'uncompress' function is featured lower as JavaScript- # if you want to unit test "roundtrip", just transcribe the reference- # 'compress' function from Python into JavaScript-- def compress(data):-- keys = '0123456789abcdef'- values = 'klmnopqrstuvwxyz'- mapping = dict(zip(keys, values))- vals = []- for key in data.keys():- value = data[key]- try:- keystring = hex(key)[2:]- keystring = keystring[:-1] + mapping[keystring[-1:]]- except:- keystring = key.join(["'","'"])- #print('Keystring is %s' % keystring)-- try:- if value < 0:- valuestring = hex(value)[3:]- numberprefix = '-'- else:- valuestring = hex(value)[2:]- numberprefix = ''- valuestring = numberprefix + valuestring[:-1] + mapping[valuestring[-1:]]- except:- if type(value) == dict:- valuestring = compress(value)- else:- raise Exception("Don't know what to do with value type %s" % type(value))-- vals.append(keystring+valuestring)-- return '{' + ''.join(vals) + '}'-- def uncompress(data):-- decoded = '0123456789abcdef'- encoded = 'klmnopqrstuvwxyz'- mapping = dict(zip(encoded, decoded))-- sign = +1- stringmode = False- stringparts = []-- output = {}-- activeobject = output- parentchain = []-- keyparts = ''- valueparts = ''-- key = None-- ending = set(encoded)-- i = 1- l = len(data) - 1 # stripping starting, ending {}- while i != l: # stripping {}- # -, {, }, ' are special.-- ch = data[i]- i += 1-- if ch == "'":- if stringmode:- # end of string mode- stringmode = False- key = ''.join(stringparts)- else:- # start of string mode- stringmode = True- stringparts = []- elif stringmode == True:- #print("Adding %s to stringpart" % ch)- stringparts.append(ch)-- elif ch == '{':- # start of object- parentchain.append( [activeobject, key] )- activeobject = {}- key = None- #DEBUG = True- elif ch == '}':- # end of object- parent, key = parentchain.pop()- parent[key] = activeobject- key = None- activeobject = parent- #DEBUG = False-- elif ch == '-':- sign = -1- else:- # must be number- if key == None:- #debug("In Key. It is '%s', ch is '%s'" % (keyparts, ch))- if ch in ending:- #debug("End of key")- keyparts += mapping[ch]- key = int(keyparts, 16) * sign- sign = +1- keyparts = ''- else:- keyparts += ch- else:- #debug("In value. It is '%s', ch is '%s'" % (valueparts, ch))- if ch in ending:- #debug("End of value")- valueparts += mapping[ch]- activeobject[key] = int(valueparts, 16) * sign- sign = +1- key = None- valueparts = ''- else:- valueparts += ch-- #debug(activeobject)-- return output-- */-- /**- Uncompresses data compressed into custom, base16-like format.- @public- @function- @param- @returns {Type}- */-- var uncompress = function uncompress(data) {-- var decoded = '0123456789abcdef',- encoded = 'klmnopqrstuvwxyz',- mapping = {};-- for (var i = 0; i < encoded.length; i++) {- mapping[encoded[i]] = decoded[i];- }-- var undef,- output = {},- sign = 1,- stringparts // undef. will be [] in string mode-- ,- activeobject = output,- parentchain = [],- parent_key_pair,- keyparts = '',- valueparts = '',- key // undef. will be Truthy when Key is resolved.- ,- datalen = data.length - 1 // stripping ending }- ,- ch;-- i = 1; // stripping starting {-- while (i != datalen) {- // - { } ' are special.-- ch = data[i];- i += 1;-- if (ch == "'") {- if (stringparts) {- // end of string mode- key = stringparts.join('');- stringparts = undef;- } else {- // start of string mode- stringparts = [];- }- } else if (stringparts) {- stringparts.push(ch);- } else if (ch == '{') {- // start of object- parentchain.push([activeobject, key]);- activeobject = {};- key = undef;- } else if (ch == '}') {- // end of object- parent_key_pair = parentchain.pop();- parent_key_pair[0][parent_key_pair[1]] = activeobject;- key = undef;- activeobject = parent_key_pair[0];- } else if (ch == '-') {- sign = -1;- } else {- // must be number- if (key === undef) {- if (mapping.hasOwnProperty(ch)) {- keyparts += mapping[ch];- key = parseInt(keyparts, 16) * sign;- sign = +1;- keyparts = '';- } else {- keyparts += ch;- }- } else {- if (mapping.hasOwnProperty(ch)) {- valueparts += mapping[ch];- activeobject[key] = parseInt(valueparts, 16) * sign;- sign = +1;- key = undef;- valueparts = '';- } else {- valueparts += ch;- }- }- }- } // end while-- return output;- };-- // encoding = 'Unicode'- // NOT UTF8, NOT UTF16BE/LE, NOT UCS2BE/LE. NO clever BOM behavior- // Actual 16bit char codes used.- // no multi-byte logic here-- // Unicode characters to WinAnsiEncoding:- // {402: 131, 8211: 150, 8212: 151, 8216: 145, 8217: 146, 8218: 130, 8220: 147, 8221: 148, 8222: 132, 8224: 134, 8225: 135, 8226: 149, 8230: 133, 8364: 128, 8240:137, 8249: 139, 8250: 155, 710: 136, 8482: 153, 338: 140, 339: 156, 732: 152, 352: 138, 353: 154, 376: 159, 381: 142, 382: 158}- // as you can see, all Unicode chars are outside of 0-255 range. No char code conflicts.- // this means that you can give Win cp1252 encoded strings to jsPDF for rendering directly- // as well as give strings with some (supported by these fonts) Unicode characters and- // these will be mapped to win cp1252- // for example, you can send char code (cp1252) 0x80 or (unicode) 0x20AC, getting "Euro" glyph displayed in both cases.-- var encodingBlock = {- 'codePages': ['WinAnsiEncoding'],- 'WinAnsiEncoding': uncompress("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")- },- encodings = { 'Unicode': {- 'Courier': encodingBlock,- 'Courier-Bold': encodingBlock,- 'Courier-BoldOblique': encodingBlock,- 'Courier-Oblique': encodingBlock,- 'Helvetica': encodingBlock,- 'Helvetica-Bold': encodingBlock,- 'Helvetica-BoldOblique': encodingBlock,- 'Helvetica-Oblique': encodingBlock,- 'Times-Roman': encodingBlock,- 'Times-Bold': encodingBlock,- 'Times-BoldItalic': encodingBlock,- 'Times-Italic': encodingBlock- // , 'Symbol'- // , 'ZapfDingbats'- } }- /**- Resources:- Font metrics data is reprocessed derivative of contents of- "Font Metrics for PDF Core 14 Fonts" package, which exhibits the following copyright and license:-- Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.-- This file and the 14 PostScript(R) AFM files it accompanies may be used,- copied, and distributed for any purpose and without charge, with or without- modification, provided that all copyright notices are retained; that the AFM- files are not distributed without this file; that all modifications to this- file or any of the AFM files are prominently noted in the modified file(s);- and that this paragraph is not modified. Adobe Systems has no responsibility- or obligation to support the use of the AFM files.-- */- ,- fontMetrics = { 'Unicode': {- // all sizing numbers are n/fontMetricsFractionOf = one font size unit- // this means that if fontMetricsFractionOf = 1000, and letter A's width is 476, it's- // width is 476/1000 or 47.6% of its height (regardless of font size)- // At this time this value applies to "widths" and "kerning" numbers.-- // char code 0 represents "default" (average) width - use it for chars missing in this table.- // key 'fof' represents the "fontMetricsFractionOf" value-- 'Courier-Oblique': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),- 'Times-BoldItalic': uncompress("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),- 'Helvetica-Bold': uncompress("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),- 'Courier': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),- 'Courier-BoldOblique': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),- 'Times-Bold': uncompress("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}")- //, 'Symbol': uncompress("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}")- , 'Helvetica': uncompress("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),- 'Helvetica-BoldOblique': uncompress("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}")- //, 'ZapfDingbats': uncompress("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}")- , 'Courier-Bold': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),- 'Times-Italic': uncompress("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),- 'Times-Roman': uncompress("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),- 'Helvetica-Oblique': uncompress("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")- } };-- /*- This event handler is fired when a new jsPDF object is initialized- This event handler appends metrics data to standard fonts within- that jsPDF instance. The metrics are mapped over Unicode character- codes, NOT CIDs or other codes matching the StandardEncoding table of the- standard PDF fonts.- Future:- Also included is the encoding maping table, converting Unicode (UCS-2, UTF-16)- char codes to StandardEncoding character codes. The encoding table is to be used- somewhere around "pdfEscape" call.- */-- API.events.push(['addFont', function (font) {- var metrics,- unicode_section,- encoding = 'Unicode',- encodingBlock;-- metrics = fontMetrics[encoding][font.PostScriptName];- if (metrics) {- if (font.metadata[encoding]) {- unicode_section = font.metadata[encoding];- } else {- unicode_section = font.metadata[encoding] = {};- }-- unicode_section.widths = metrics.widths;- unicode_section.kerning = metrics.kerning;- }-- encodingBlock = encodings[encoding][font.PostScriptName];- if (encodingBlock) {- if (font.metadata[encoding]) {- unicode_section = font.metadata[encoding];- } else {- unicode_section = font.metadata[encoding] = {};- }-- unicode_section.encoding = encodingBlock;- if (encodingBlock.codePages && encodingBlock.codePages.length) {- font.encoding = encodingBlock.codePages[0];- }- }- }]); // end of adding event handler- })(jsPDF.API);-- /** @preserve- jsPDF SVG plugin- Copyright (c) 2012 Willow Systems Corporation, willow-systems.com- */- /**- *- * ====================================================================- */-- ;(function (jsPDFAPI) {- 'use strict';-- /**- Parses SVG XML and converts only some of the SVG elements into- PDF elements.-- Supports:- paths-- @public- @function- @param- @returns {Type}- */-- jsPDFAPI.addSVG = function (svgtext, x, y, w, h) {- // 'this' is _jsPDF object returned when jsPDF is inited (new jsPDF())-- var undef;-- if (x === undef || y === undef) {- throw new Error("addSVG needs values for 'x' and 'y'");- }-- function InjectCSS(cssbody, document) {- var styletag = document.createElement('style');- styletag.type = 'text/css';- if (styletag.styleSheet) {- // ie- styletag.styleSheet.cssText = cssbody;- } else {- // others- styletag.appendChild(document.createTextNode(cssbody));- }- document.getElementsByTagName("head")[0].appendChild(styletag);- }-- function createWorkerNode(document) {-- var frameID = 'childframe' // Date.now().toString() + '_' + (Math.random() * 100).toString()- ,- frame = document.createElement('iframe');-- InjectCSS('.jsPDF_sillysvg_iframe {display:none;position:absolute;}', document);-- frame.name = frameID;- frame.setAttribute("width", 0);- frame.setAttribute("height", 0);- frame.setAttribute("frameborder", "0");- frame.setAttribute("scrolling", "no");- frame.setAttribute("seamless", "seamless");- frame.setAttribute("class", "jsPDF_sillysvg_iframe");-- document.body.appendChild(frame);-- return frame;- }-- function attachSVGToWorkerNode(svgtext, frame) {- var framedoc = (frame.contentWindow || frame.contentDocument).document;- framedoc.write(svgtext);- framedoc.close();- return framedoc.getElementsByTagName('svg')[0];- }-- function convertPathToPDFLinesArgs(path) {- 'use strict';- // we will use 'lines' method call. it needs:- // - starting coordinate pair- // - array of arrays of vector shifts (2-len for line, 6 len for bezier)- // - scale array [horizontal, vertical] ratios- // - style (stroke, fill, both)-- var x = parseFloat(path[1]),- y = parseFloat(path[2]),- vectors = [],- position = 3,- len = path.length;-- while (position < len) {- if (path[position] === 'c') {- vectors.push([parseFloat(path[position + 1]), parseFloat(path[position + 2]), parseFloat(path[position + 3]), parseFloat(path[position + 4]), parseFloat(path[position + 5]), parseFloat(path[position + 6])]);- position += 7;- } else if (path[position] === 'l') {- vectors.push([parseFloat(path[position + 1]), parseFloat(path[position + 2])]);- position += 3;- } else {- position += 1;- }- }- return [x, y, vectors];- }-- var workernode = createWorkerNode(document),- svgnode = attachSVGToWorkerNode(svgtext, workernode),- scale = [1, 1],- svgw = parseFloat(svgnode.getAttribute('width')),- svgh = parseFloat(svgnode.getAttribute('height'));-- if (svgw && svgh) {- // setting both w and h makes image stretch to size.- // this may distort the image, but fits your demanded size- if (w && h) {- scale = [w / svgw, h / svgh];- }- // if only one is set, that value is set as max and SVG- // is scaled proportionately.- else if (w) {- scale = [w / svgw, w / svgw];- } else if (h) {- scale = [h / svgh, h / svgh];- }- }-- var i,- l,- tmp,- linesargs,- items = svgnode.childNodes;- for (i = 0, l = items.length; i < l; i++) {- tmp = items[i];- if (tmp.tagName && tmp.tagName.toUpperCase() === 'PATH') {- linesargs = convertPathToPDFLinesArgs(tmp.getAttribute("d").split(' '));- // path start x coordinate- linesargs[0] = linesargs[0] * scale[0] + x; // where x is upper left X of image- // path start y coordinate- linesargs[1] = linesargs[1] * scale[1] + y; // where y is upper left Y of image- // the rest of lines are vectors. these will adjust with scale value auto.- this.lines.call(this, linesargs[2] // lines- , linesargs[0] // starting x- , linesargs[1] // starting y- , scale);- }- }-- // clean up- // workernode.parentNode.removeChild(workernode)-- return this;- };- })(jsPDF.API);-- /** ====================================================================- * jsPDF total_pages plugin- * Copyright (c) 2013 Eduardo Menezes de Morais, [email protected]- *- *- * ====================================================================- */-- (function (jsPDFAPI) {- 'use strict';-- jsPDFAPI.putTotalPages = function (pageExpression) {- 'use strict';-- var replaceExpression = new RegExp(pageExpression, 'g');- for (var n = 1; n <= this.internal.getNumberOfPages(); n++) {- for (var i = 0; i < this.internal.pages[n].length; i++) {- this.internal.pages[n][i] = this.internal.pages[n][i].replace(replaceExpression, this.internal.getNumberOfPages());- }- }- return this;- };- })(jsPDF.API);-- /** ====================================================================- * jsPDF XMP metadata plugin- * Copyright (c) 2016 Jussi Utunen, [email protected]- *- *- * ====================================================================- */-- /*global jsPDF */-- /**- * Adds XMP formatted metadata to PDF- *- * @param {String} metadata The actual metadata to be added. The metadata shall be stored as XMP simple value. Note that if the metadata string contains XML markup characters "<", ">" or "&", those characters should be written using XML entities.- * @param {String} namespaceuri Sets the namespace URI for the metadata. Last character should be slash or hash.- * @function- * @returns {jsPDF}- * @methodOf jsPDF#- * @name addMetadata- */-- (function (jsPDFAPI) {- 'use strict';-- var xmpmetadata = "";- var xmpnamespaceuri = "";- var metadata_object_number = "";-- jsPDFAPI.addMetadata = function (metadata, namespaceuri) {- xmpnamespaceuri = namespaceuri || "http://jspdf.default.namespaceuri/"; //The namespace URI for an XMP name shall not be empty- xmpmetadata = metadata;- this.internal.events.subscribe('postPutResources', function () {- if (!xmpmetadata) {- metadata_object_number = "";- } else {- var xmpmeta_beginning = '<x:xmpmeta xmlns:x="adobe:ns:meta/">';- var rdf_beginning = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="' + xmpnamespaceuri + '"><jspdf:metadata>';- var rdf_ending = '</jspdf:metadata></rdf:Description></rdf:RDF>';- var xmpmeta_ending = '</x:xmpmeta>';- var utf8_xmpmeta_beginning = unescape(encodeURIComponent(xmpmeta_beginning));- var utf8_rdf_beginning = unescape(encodeURIComponent(rdf_beginning));- var utf8_metadata = unescape(encodeURIComponent(xmpmetadata));- var utf8_rdf_ending = unescape(encodeURIComponent(rdf_ending));- var utf8_xmpmeta_ending = unescape(encodeURIComponent(xmpmeta_ending));-- var total_len = utf8_rdf_beginning.length + utf8_metadata.length + utf8_rdf_ending.length + utf8_xmpmeta_beginning.length + utf8_xmpmeta_ending.length;-- metadata_object_number = this.internal.newObject();- this.internal.write('<< /Type /Metadata /Subtype /XML /Length ' + total_len + ' >>');- this.internal.write('stream');- this.internal.write(utf8_xmpmeta_beginning + utf8_rdf_beginning + utf8_metadata + utf8_rdf_ending + utf8_xmpmeta_ending);- this.internal.write('endstream');- this.internal.write('endobj');- }- });- this.internal.events.subscribe('putCatalog', function () {- if (metadata_object_number) {- this.internal.write('/Metadata ' + metadata_object_number + ' 0 R');- }- });- return this;- };- })(jsPDF.API);-- /* Blob.js- * A Blob implementation.- * 2014-07-24- *- * By Eli Grey, http://eligrey.com- * By Devin Samarin, https://github.com/dsamarin- * License: X11/MIT- * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md- */-- /*global self, unescape */- /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,- plusplus: true */-- /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */-- (function (view) {- "use strict";-- view.URL = view.URL || view.webkitURL;-- if (view.Blob && view.URL) {- try {- new Blob;- return;- } catch (e) {}- }-- // Internally we use a BlobBuilder implementation to base Blob off of- // in order to support older browsers that only have BlobBuilder- var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {- var- get_class = function(object) {- return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];- }- , FakeBlobBuilder = function BlobBuilder() {- this.data = [];- }- , FakeBlob = function Blob(data, type, encoding) {- this.data = data;- this.size = data.length;- this.type = type;- this.encoding = encoding;- }- , FBB_proto = FakeBlobBuilder.prototype- , FB_proto = FakeBlob.prototype- , FileReaderSync = view.FileReaderSync- , FileException = function(type) {- this.code = this[this.name = type];- }- , file_ex_codes = (- "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "- + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"- ).split(" ")- , file_ex_code = file_ex_codes.length- , real_URL = view.URL || view.webkitURL || view- , real_create_object_URL = real_URL.createObjectURL- , real_revoke_object_URL = real_URL.revokeObjectURL- , URL = real_URL- , btoa = view.btoa- , atob = view.atob-- , ArrayBuffer = view.ArrayBuffer- , Uint8Array = view.Uint8Array-- , origin = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/- ;- FakeBlob.fake = FB_proto.fake = true;- while (file_ex_code--) {- FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;- }- // Polyfill URL- if (!real_URL.createObjectURL) {- URL = view.URL = function(uri) {- var- uri_info = document.createElementNS("http://www.w3.org/1999/xhtml", "a")- , uri_origin- ;- uri_info.href = uri;- if (!("origin" in uri_info)) {- if (uri_info.protocol.toLowerCase() === "data:") {- uri_info.origin = null;- } else {- uri_origin = uri.match(origin);- uri_info.origin = uri_origin && uri_origin[1];- }- }- return uri_info;- };- }- URL.createObjectURL = function(blob) {- var- type = blob.type- , data_URI_header- ;- if (type === null) {- type = "application/octet-stream";- }- if (blob instanceof FakeBlob) {- data_URI_header = "data:" + type;- if (blob.encoding === "base64") {- return data_URI_header + ";base64," + blob.data;- } else if (blob.encoding === "URI") {- return data_URI_header + "," + decodeURIComponent(blob.data);- } if (btoa) {- return data_URI_header + ";base64," + btoa(blob.data);- } else {- return data_URI_header + "," + encodeURIComponent(blob.data);- }- } else if (real_create_object_URL) {- return real_create_object_URL.call(real_URL, blob);- }- };- URL.revokeObjectURL = function(object_URL) {- if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {- real_revoke_object_URL.call(real_URL, object_URL);- }- };- FBB_proto.append = function(data/*, endings*/) {- var bb = this.data;- // decode data to a binary string- if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {- var- str = ""- , buf = new Uint8Array(data)- , i = 0- , buf_len = buf.length- ;- for (; i < buf_len; i++) {- str += String.fromCharCode(buf[i]);- }- bb.push(str);- } else if (get_class(data) === "Blob" || get_class(data) === "File") {- if (FileReaderSync) {- var fr = new FileReaderSync;- bb.push(fr.readAsBinaryString(data));- } else {- // async FileReader won't work as BlobBuilder is sync- throw new FileException("NOT_READABLE_ERR");- }- } else if (data instanceof FakeBlob) {- if (data.encoding === "base64" && atob) {- bb.push(atob(data.data));- } else if (data.encoding === "URI") {- bb.push(decodeURIComponent(data.data));- } else if (data.encoding === "raw") {- bb.push(data.data);- }- } else {- if (typeof data !== "string") {- data += ""; // convert unsupported types to strings- }- // decode UTF-16 to binary string- bb.push(unescape(encodeURIComponent(data)));- }- };- FBB_proto.getBlob = function(type) {- if (!arguments.length) {- type = null;- }- return new FakeBlob(this.data.join(""), type, "raw");- };- FBB_proto.toString = function() {- return "[object BlobBuilder]";- };- FB_proto.slice = function(start, end, type) {- var args = arguments.length;- if (args < 3) {- type = null;- }- return new FakeBlob(- this.data.slice(start, args > 1 ? end : this.data.length)- , type- , this.encoding- );- };- FB_proto.toString = function() {- return "[object Blob]";- };- FB_proto.close = function() {- this.size = 0;- delete this.data;- };- return FakeBlobBuilder;- }(view));-- view.Blob = function(blobParts, options) {- var type = options ? (options.type || "") : "";- var builder = new BlobBuilder();- if (blobParts) {- for (var i = 0, len = blobParts.length; i < len; i++) {- if (Uint8Array && blobParts[i] instanceof Uint8Array) {- builder.append(blobParts[i].buffer);- }- else {- builder.append(blobParts[i]);- }- }- }- var blob = builder.getBlob(type);- if (!blob.slice && blob.webkitSlice) {- blob.slice = blob.webkitSlice;- }- return blob;- };-- var getPrototypeOf = Object.getPrototypeOf || function(object) {- return object.__proto__;- };- view.Blob.prototype = getPrototypeOf(new view.Blob());- }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || undefined.content || undefined));-- /* FileSaver.js- * A saveAs() FileSaver implementation.- * 1.1.20151003- *- * By Eli Grey, http://eligrey.com- * License: MIT- * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md- */-- /*global self */- /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */-- /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */-- var saveAs = saveAs || (function(view) {- "use strict";- // IE <10 is explicitly unsupported- if (typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {- return;- }- var- doc = view.document- // only get URL when necessary in case Blob.js hasn't overridden it yet- , get_URL = function() {- return view.URL || view.webkitURL || view;- }- , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")- , can_use_save_link = "download" in save_link- , click = function(node) {- var event = new MouseEvent("click");- node.dispatchEvent(event);- }- , is_safari = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent)- , webkit_req_fs = view.webkitRequestFileSystem- , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem- , throw_outside = function(ex) {- (view.setImmediate || view.setTimeout)(function() {- throw ex;- }, 0);- }- , force_saveable_type = "application/octet-stream"- , fs_min_size = 0- // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 and- // https://github.com/eligrey/FileSaver.js/commit/485930a#commitcomment-8768047- // for the reasoning behind the timeout and revocation flow- , arbitrary_revoke_timeout = 500 // in ms- , revoke = function(file) {- var revoker = function() {- if (typeof file === "string") { // file is an object URL- get_URL().revokeObjectURL(file);- } else { // file is a File- file.remove();- }- };- if (view.chrome) {- revoker();- } else {- setTimeout(revoker, arbitrary_revoke_timeout);- }- }- , dispatch = function(filesaver, event_types, event) {- event_types = [].concat(event_types);- var i = event_types.length;- while (i--) {- var listener = filesaver["on" + event_types[i]];- if (typeof listener === "function") {- try {- listener.call(filesaver, event || filesaver);- } catch (ex) {- throw_outside(ex);- }- }- }- }- , auto_bom = function(blob) {- // prepend BOM for UTF-8 XML and text/* types (including HTML)- if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {- return new Blob(["\ufeff", blob], {type: blob.type});- }- return blob;- }- , FileSaver = function(blob, name, no_auto_bom) {- if (!no_auto_bom) {- blob = auto_bom(blob);- }- // First try a.download, then web filesystem, then object URLs- var- filesaver = this- , type = blob.type- , blob_changed = false- , object_url- , target_view- , dispatch_all = function() {- dispatch(filesaver, "writestart progress write writeend".split(" "));- }- // on any filesys errors revert to saving with object URLs- , fs_error = function() {- if (target_view && is_safari && typeof FileReader !== "undefined") {- // Safari doesn't allow downloading of blob urls- var reader = new FileReader();- reader.onloadend = function() {- var base64Data = reader.result;- target_view.location.href = "data:attachment/file" + base64Data.slice(base64Data.search(/[,;]/));- filesaver.readyState = filesaver.DONE;- dispatch_all();- };- reader.readAsDataURL(blob);- filesaver.readyState = filesaver.INIT;- return;- }- // don't create more object URLs than needed- if (blob_changed || !object_url) {- object_url = get_URL().createObjectURL(blob);- }- if (target_view) {- target_view.location.href = object_url;- } else {- var new_tab = view.open(object_url, "_blank");- if (new_tab == undefined && is_safari) {- //Apple do not allow window.open, see http://bit.ly/1kZffRI- view.location.href = object_url- }- }- filesaver.readyState = filesaver.DONE;- dispatch_all();- revoke(object_url);- }- , abortable = function(func) {- return function() {- if (filesaver.readyState !== filesaver.DONE) {- return func.apply(this, arguments);- }- };- }- , create_if_not_found = {create: true, exclusive: false}- , slice- ;- filesaver.readyState = filesaver.INIT;- if (!name) {- name = "download";- }- if (can_use_save_link) {- object_url = get_URL().createObjectURL(blob);- setTimeout(function() {- save_link.href = object_url;- save_link.download = name;- click(save_link);- dispatch_all();- revoke(object_url);- filesaver.readyState = filesaver.DONE;- });- return;- }- // Object and web filesystem URLs have a problem saving in Google Chrome when- // viewed in a tab, so I force save with application/octet-stream- // http://code.google.com/p/chromium/issues/detail?id=91158- // Update: Google errantly closed 91158, I submitted it again:- // https://code.google.com/p/chromium/issues/detail?id=389642- if (view.chrome && type && type !== force_saveable_type) {- slice = blob.slice || blob.webkitSlice;- blob = slice.call(blob, 0, blob.size, force_saveable_type);- blob_changed = true;- }- // Since I can't be sure that the guessed media type will trigger a download- // in WebKit, I append .download to the filename.- // https://bugs.webkit.org/show_bug.cgi?id=65440- if (webkit_req_fs && name !== "download") {- name += ".download";- }- if (type === force_saveable_type || webkit_req_fs) {- target_view = view;- }- if (!req_fs) {- fs_error();- return;- }- fs_min_size += blob.size;- req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {- fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {- var save = function() {- dir.getFile(name, create_if_not_found, abortable(function(file) {- file.createWriter(abortable(function(writer) {- writer.onwriteend = function(event) {- target_view.location.href = file.toURL();- filesaver.readyState = filesaver.DONE;- dispatch(filesaver, "writeend", event);- revoke(file);- };- writer.onerror = function() {- var error = writer.error;- if (error.code !== error.ABORT_ERR) {- fs_error();- }- };- "writestart progress write abort".split(" ").forEach(function(event) {- writer["on" + event] = filesaver["on" + event];- });- writer.write(blob);- filesaver.abort = function() {- writer.abort();- filesaver.readyState = filesaver.DONE;- };- filesaver.readyState = filesaver.WRITING;- }), fs_error);- }), fs_error);- };- dir.getFile(name, {create: false}, abortable(function(file) {- // delete file if it already exists- file.remove();- save();- }), abortable(function(ex) {- if (ex.code === ex.NOT_FOUND_ERR) {- save();- } else {- fs_error();- }- }));- }), fs_error);- }), fs_error);- }- , FS_proto = FileSaver.prototype- , saveAs = function(blob, name, no_auto_bom) {- return new FileSaver(blob, name, no_auto_bom);- }- ;- // IE 10+ (native saveAs)- if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {- return function(blob, name, no_auto_bom) {- if (!no_auto_bom) {- blob = auto_bom(blob);- }- return navigator.msSaveOrOpenBlob(blob, name || "download");- };- }-- FS_proto.abort = function() {- var filesaver = this;- filesaver.readyState = filesaver.DONE;- dispatch(filesaver, "abort");- };- FS_proto.readyState = FS_proto.INIT = 0;- FS_proto.WRITING = 1;- FS_proto.DONE = 2;-- FS_proto.error =- FS_proto.onwritestart =- FS_proto.onprogress =- FS_proto.onwrite =- FS_proto.onabort =- FS_proto.onerror =- FS_proto.onwriteend =- null;-- return saveAs;- }(- typeof self !== "undefined" && self- || typeof window !== "undefined" && window- || undefined.content- ));- // `self` is undefined in Firefox for Android content script context- // while `this` is nsIContentFrameMessageManager- // with an attribute `content` that corresponds to the window-- if (typeof module !== "undefined" && module.exports) {- module.exports.saveAs = saveAs;- } else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {- define([], function() {- return saveAs;- });- }-- /*- * Copyright (c) 2012 chick307 <[email protected]>- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- void function(global, callback) {- if (typeof module === 'object') {- module.exports = callback();- } else if (typeof define === 'function') {- define(callback);- } else {- global.adler32cs = callback();- }- }(jsPDF, function() {- var _hasArrayBuffer = typeof ArrayBuffer === 'function' &&- typeof Uint8Array === 'function';-- var _Buffer = null, _isBuffer = (function() {- if (!_hasArrayBuffer)- return function _isBuffer() { return false };-- try {- var buffer = {};- if (typeof buffer.Buffer === 'function')- _Buffer = buffer.Buffer;- } catch (error) {}-- return function _isBuffer(value) {- return value instanceof ArrayBuffer ||- _Buffer !== null && value instanceof _Buffer;- };- }());-- var _utf8ToBinary = (function() {- if (_Buffer !== null) {- return function _utf8ToBinary(utf8String) {- return new _Buffer(utf8String, 'utf8').toString('binary');- };- } else {- return function _utf8ToBinary(utf8String) {- return unescape(encodeURIComponent(utf8String));- };- }- }());-- var MOD = 65521;-- var _update = function _update(checksum, binaryString) {- var a = checksum & 0xFFFF, b = checksum >>> 16;- for (var i = 0, length = binaryString.length; i < length; i++) {- a = (a + (binaryString.charCodeAt(i) & 0xFF)) % MOD;- b = (b + a) % MOD;- }- return (b << 16 | a) >>> 0;- };-- var _updateUint8Array = function _updateUint8Array(checksum, uint8Array) {- var a = checksum & 0xFFFF, b = checksum >>> 16;- for (var i = 0, length = uint8Array.length, x; i < length; i++) {- a = (a + uint8Array[i]) % MOD;- b = (b + a) % MOD;- }- return (b << 16 | a) >>> 0- };-- var exports = {};-- var Adler32 = exports.Adler32 = (function() {- var ctor = function Adler32(checksum) {- if (!(this instanceof ctor)) {- throw new TypeError(- 'Constructor cannot called be as a function.');- }- if (!isFinite(checksum = checksum == null ? 1 : +checksum)) {- throw new Error(- 'First arguments needs to be a finite number.');- }- this.checksum = checksum >>> 0;- };-- var proto = ctor.prototype = {};- proto.constructor = ctor;-- ctor.from = function(from) {- from.prototype = proto;- return from;- }(function from(binaryString) {- if (!(this instanceof ctor)) {- throw new TypeError(- 'Constructor cannot called be as a function.');- }- if (binaryString == null)- throw new Error('First argument needs to be a string.');- this.checksum = _update(1, binaryString.toString());- });-- ctor.fromUtf8 = function(fromUtf8) {- fromUtf8.prototype = proto;- return fromUtf8;- }(function fromUtf8(utf8String) {- if (!(this instanceof ctor)) {- throw new TypeError(- 'Constructor cannot called be as a function.');- }- if (utf8String == null)- throw new Error('First argument needs to be a string.');- var binaryString = _utf8ToBinary(utf8String.toString());- this.checksum = _update(1, binaryString);- });-- if (_hasArrayBuffer) {- ctor.fromBuffer = function(fromBuffer) {- fromBuffer.prototype = proto;- return fromBuffer;- }(function fromBuffer(buffer) {- if (!(this instanceof ctor)) {- throw new TypeError(- 'Constructor cannot called be as a function.');- }- if (!_isBuffer(buffer))- throw new Error('First argument needs to be ArrayBuffer.');- var array = new Uint8Array(buffer);- return this.checksum = _updateUint8Array(1, array);- });- }-- proto.update = function update(binaryString) {- if (binaryString == null)- throw new Error('First argument needs to be a string.');- binaryString = binaryString.toString();- return this.checksum = _update(this.checksum, binaryString);- };-- proto.updateUtf8 = function updateUtf8(utf8String) {- if (utf8String == null)- throw new Error('First argument needs to be a string.');- var binaryString = _utf8ToBinary(utf8String.toString());- return this.checksum = _update(this.checksum, binaryString);- };-- if (_hasArrayBuffer) {- proto.updateBuffer = function updateBuffer(buffer) {- if (!_isBuffer(buffer))- throw new Error('First argument needs to be ArrayBuffer.');- var array = new Uint8Array(buffer);- return this.checksum = _updateUint8Array(this.checksum, array);- };- }-- proto.clone = function clone() {- return new Adler32(this.checksum);- };-- return ctor;- }());-- exports.from = function from(binaryString) {- if (binaryString == null)- throw new Error('First argument needs to be a string.');- return _update(1, binaryString.toString());- };-- exports.fromUtf8 = function fromUtf8(utf8String) {- if (utf8String == null)- throw new Error('First argument needs to be a string.');- var binaryString = _utf8ToBinary(utf8String.toString());- return _update(1, binaryString);- };-- if (_hasArrayBuffer) {- exports.fromBuffer = function fromBuffer(buffer) {- if (!_isBuffer(buffer))- throw new Error('First argument need to be ArrayBuffer.');- var array = new Uint8Array(buffer);- return _updateUint8Array(1, array);- };- }-- return exports;- });-- /**- * CssColors- * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]- *- * Licensed under the MIT License.- * http://opensource.org/licenses/mit-license- */-- /**- * Usage CssColors('red');- * Returns RGB hex color with '#' prefix- */-- var CssColors = {};- CssColors._colorsTable = {- "aliceblue" : "#f0f8ff",- "antiquewhite" : "#faebd7",- "aqua" : "#00ffff",- "aquamarine" : "#7fffd4",- "azure" : "#f0ffff",- "beige" : "#f5f5dc",- "bisque" : "#ffe4c4",- "black" : "#000000",- "blanchedalmond" : "#ffebcd",- "blue" : "#0000ff",- "blueviolet" : "#8a2be2",- "brown" : "#a52a2a",- "burlywood" : "#deb887",- "cadetblue" : "#5f9ea0",- "chartreuse" : "#7fff00",- "chocolate" : "#d2691e",- "coral" : "#ff7f50",- "cornflowerblue" : "#6495ed",- "cornsilk" : "#fff8dc",- "crimson" : "#dc143c",- "cyan" : "#00ffff",- "darkblue" : "#00008b",- "darkcyan" : "#008b8b",- "darkgoldenrod" : "#b8860b",- "darkgray" : "#a9a9a9",- "darkgreen" : "#006400",- "darkkhaki" : "#bdb76b",- "darkmagenta" : "#8b008b",- "darkolivegreen" : "#556b2f",- "darkorange" : "#ff8c00",- "darkorchid" : "#9932cc",- "darkred" : "#8b0000",- "darksalmon" : "#e9967a",- "darkseagreen" : "#8fbc8f",- "darkslateblue" : "#483d8b",- "darkslategray" : "#2f4f4f",- "darkturquoise" : "#00ced1",- "darkviolet" : "#9400d3",- "deeppink" : "#ff1493",- "deepskyblue" : "#00bfff",- "dimgray" : "#696969",- "dodgerblue" : "#1e90ff",- "firebrick" : "#b22222",- "floralwhite" : "#fffaf0",- "forestgreen" : "#228b22",- "fuchsia" : "#ff00ff",- "gainsboro" : "#dcdcdc",- "ghostwhite" : "#f8f8ff",- "gold" : "#ffd700",- "goldenrod" : "#daa520",- "gray" : "#808080",- "green" : "#008000",- "greenyellow" : "#adff2f",- "honeydew" : "#f0fff0",- "hotpink" : "#ff69b4",- "indianred " : "#cd5c5c",- "indigo" : "#4b0082",- "ivory" : "#fffff0",- "khaki" : "#f0e68c",- "lavender" : "#e6e6fa",- "lavenderblush" : "#fff0f5",- "lawngreen" : "#7cfc00",- "lemonchiffon" : "#fffacd",- "lightblue" : "#add8e6",- "lightcoral" : "#f08080",- "lightcyan" : "#e0ffff",- "lightgoldenrodyellow" : "#fafad2",- "lightgrey" : "#d3d3d3",- "lightgreen" : "#90ee90",- "lightpink" : "#ffb6c1",- "lightsalmon" : "#ffa07a",- "lightseagreen" : "#20b2aa",- "lightskyblue" : "#87cefa",- "lightslategray" : "#778899",- "lightsteelblue" : "#b0c4de",- "lightyellow" : "#ffffe0",- "lime" : "#00ff00",- "limegreen" : "#32cd32",- "linen" : "#faf0e6",- "magenta" : "#ff00ff",- "maroon" : "#800000",- "mediumaquamarine" : "#66cdaa",- "mediumblue" : "#0000cd",- "mediumorchid" : "#ba55d3",- "mediumpurple" : "#9370d8",- "mediumseagreen" : "#3cb371",- "mediumslateblue" : "#7b68ee",- "mediumspringgreen" : "#00fa9a",- "mediumturquoise" : "#48d1cc",- "mediumvioletred" : "#c71585",- "midnightblue" : "#191970",- "mintcream" : "#f5fffa",- "mistyrose" : "#ffe4e1",- "moccasin" : "#ffe4b5",- "navajowhite" : "#ffdead",- "navy" : "#000080",- "oldlace" : "#fdf5e6",- "olive" : "#808000",- "olivedrab" : "#6b8e23",- "orange" : "#ffa500",- "orangered" : "#ff4500",- "orchid" : "#da70d6",- "palegoldenrod" : "#eee8aa",- "palegreen" : "#98fb98",- "paleturquoise" : "#afeeee",- "palevioletred" : "#d87093",- "papayawhip" : "#ffefd5",- "peachpuff" : "#ffdab9",- "peru" : "#cd853f",- "pink" : "#ffc0cb",- "plum" : "#dda0dd",- "powderblue" : "#b0e0e6",- "purple" : "#800080",- "red" : "#ff0000",- "rosybrown" : "#bc8f8f",- "royalblue" : "#4169e1",- "saddlebrown" : "#8b4513",- "salmon" : "#fa8072",- "sandybrown" : "#f4a460",- "seagreen" : "#2e8b57",- "seashell" : "#fff5ee",- "sienna" : "#a0522d",- "silver" : "#c0c0c0",- "skyblue" : "#87ceeb",- "slateblue" : "#6a5acd",- "slategray" : "#708090",- "snow" : "#fffafa",- "springgreen" : "#00ff7f",- "steelblue" : "#4682b4",- "tan" : "#d2b48c",- "teal" : "#008080",- "thistle" : "#d8bfd8",- "tomato" : "#ff6347",- "turquoise" : "#40e0d0",- "violet" : "#ee82ee",- "wheat" : "#f5deb3",- "white" : "#ffffff",- "whitesmoke" : "#f5f5f5",- "yellow" : "#ffff00",- "yellowgreen" : "#9acd32"- };-- CssColors.colorNameToHex = function(color) {- color = color.toLowerCase();- if (typeof this._colorsTable[color] != 'undefined')- return this._colorsTable[color];-- return false;- };-- /*- Deflate.js - https://github.com/gildas-lormeau/zip.js- Copyright (c) 2013 Gildas Lormeau. All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- 1. Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- 2. Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in- the documentation and/or other materials provided with the distribution.-- 3. The names of the authors may not be used to endorse or promote products- derived from this software without specific prior written permission.-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,- INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */-- /*- * This program is based on JZlib 1.0.2 ymnk, JCraft,Inc.- * JZlib is based on zlib-1.1.3, so all credit should go authors- * Jean-loup Gailly([email protected]) and Mark Adler([email protected])- * and contributors of zlib.- */-- var Deflater = (function(obj) {-- // Global-- var MAX_BITS = 15;- var D_CODES = 30;- var BL_CODES = 19;-- var LENGTH_CODES = 29;- var LITERALS = 256;- var L_CODES = (LITERALS + 1 + LENGTH_CODES);- var HEAP_SIZE = (2 * L_CODES + 1);-- var END_BLOCK = 256;-- // Bit length codes must not exceed MAX_BL_BITS bits- var MAX_BL_BITS = 7;-- // repeat previous bit length 3-6 times (2 bits of repeat count)- var REP_3_6 = 16;-- // repeat a zero length 3-10 times (3 bits of repeat count)- var REPZ_3_10 = 17;-- // repeat a zero length 11-138 times (7 bits of repeat count)- var REPZ_11_138 = 18;-- // The lengths of the bit length codes are sent in order of decreasing- // probability, to avoid transmitting the lengths for unused bit- // length codes.-- var Buf_size = 8 * 2;-- // JZlib version : "1.0.2"- var Z_DEFAULT_COMPRESSION = -1;-- // compression strategy- var Z_FILTERED = 1;- var Z_HUFFMAN_ONLY = 2;- var Z_DEFAULT_STRATEGY = 0;-- var Z_NO_FLUSH = 0;- var Z_PARTIAL_FLUSH = 1;- var Z_FULL_FLUSH = 3;- var Z_FINISH = 4;-- var Z_OK = 0;- var Z_STREAM_END = 1;- var Z_NEED_DICT = 2;- var Z_STREAM_ERROR = -2;- var Z_DATA_ERROR = -3;- var Z_BUF_ERROR = -5;-- // Tree-- // see definition of array dist_code below- var _dist_code = [ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,- 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,- 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19,- 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,- 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,- 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,- 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29,- 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,- 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 ];-- function Tree() {- var that = this;-- // dyn_tree; // the dynamic tree- // max_code; // largest code with non zero frequency- // stat_desc; // the corresponding static tree-- // Compute the optimal bit lengths for a tree and update the total bit- // length- // for the current block.- // IN assertion: the fields freq and dad are set, heap[heap_max] and- // above are the tree nodes sorted by increasing frequency.- // OUT assertions: the field len is set to the optimal bit length, the- // array bl_count contains the frequencies for each bit length.- // The length opt_len is updated; static_len is also updated if stree is- // not null.- function gen_bitlen(s) {- var tree = that.dyn_tree;- var stree = that.stat_desc.static_tree;- var extra = that.stat_desc.extra_bits;- var base = that.stat_desc.extra_base;- var max_length = that.stat_desc.max_length;- var h; // heap index- var n, m; // iterate over the tree elements- var bits; // bit length- var xbits; // extra bits- var f; // frequency- var overflow = 0; // number of elements with bit length too large-- for (bits = 0; bits <= MAX_BITS; bits++)- s.bl_count[bits] = 0;-- // In a first pass, compute the optimal bit lengths (which may- // overflow in the case of the bit length tree).- tree[s.heap[s.heap_max] * 2 + 1] = 0; // root of the heap-- for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {- n = s.heap[h];- bits = tree[tree[n * 2 + 1] * 2 + 1] + 1;- if (bits > max_length) {- bits = max_length;- overflow++;- }- tree[n * 2 + 1] = bits;- // We overwrite tree[n*2+1] which is no longer needed-- if (n > that.max_code)- continue; // not a leaf node-- s.bl_count[bits]++;- xbits = 0;- if (n >= base)- xbits = extra[n - base];- f = tree[n * 2];- s.opt_len += f * (bits + xbits);- if (stree)- s.static_len += f * (stree[n * 2 + 1] + xbits);- }- if (overflow === 0)- return;-- // This happens for example on obj2 and pic of the Calgary corpus- // Find the first bit length which could increase:- do {- bits = max_length - 1;- while (s.bl_count[bits] === 0)- bits--;- s.bl_count[bits]--; // move one leaf down the tree- s.bl_count[bits + 1] += 2; // move one overflow item as its brother- s.bl_count[max_length]--;- // The brother of the overflow item also moves one step up,- // but this does not affect bl_count[max_length]- overflow -= 2;- } while (overflow > 0);-- for (bits = max_length; bits !== 0; bits--) {- n = s.bl_count[bits];- while (n !== 0) {- m = s.heap[--h];- if (m > that.max_code)- continue;- if (tree[m * 2 + 1] != bits) {- s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2];- tree[m * 2 + 1] = bits;- }- n--;- }- }- }-- // Reverse the first len bits of a code, using straightforward code (a- // faster- // method would use a table)- // IN assertion: 1 <= len <= 15- function bi_reverse(code, // the value to invert- len // its bit length- ) {- var res = 0;- do {- res |= code & 1;- code >>>= 1;- res <<= 1;- } while (--len > 0);- return res >>> 1;- }-- // Generate the codes for a given tree and bit counts (which need not be- // optimal).- // IN assertion: the array bl_count contains the bit length statistics for- // the given tree and the field len is set for all tree elements.- // OUT assertion: the field code is set for all tree elements of non- // zero code length.- function gen_codes(tree, // the tree to decorate- max_code, // largest code with non zero frequency- bl_count // number of codes at each bit length- ) {- var next_code = []; // next code value for each- // bit length- var code = 0; // running code value- var bits; // bit index- var n; // code index- var len;-- // The distribution counts are first used to generate the code values- // without bit reversal.- for (bits = 1; bits <= MAX_BITS; bits++) {- next_code[bits] = code = ((code + bl_count[bits - 1]) << 1);- }-- // Check that the bit counts in bl_count are consistent. The last code- // must be all ones.- // Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,- // "inconsistent bit counts");- // Tracev((stderr,"\ngen_codes: max_code %d ", max_code));-- for (n = 0; n <= max_code; n++) {- len = tree[n * 2 + 1];- if (len === 0)- continue;- // Now reverse the bits- tree[n * 2] = bi_reverse(next_code[len]++, len);- }- }-- // Construct one Huffman tree and assigns the code bit strings and lengths.- // Update the total bit length for the current block.- // IN assertion: the field freq is set for all tree elements.- // OUT assertions: the fields len and code are set to the optimal bit length- // and corresponding code. The length opt_len is updated; static_len is- // also updated if stree is not null. The field max_code is set.- that.build_tree = function(s) {- var tree = that.dyn_tree;- var stree = that.stat_desc.static_tree;- var elems = that.stat_desc.elems;- var n, m; // iterate over heap elements- var max_code = -1; // largest code with non zero frequency- var node; // new node being created-- // Construct the initial heap, with least frequent element in- // heap[1]. The sons of heap[n] are heap[2*n] and heap[2*n+1].- // heap[0] is not used.- s.heap_len = 0;- s.heap_max = HEAP_SIZE;-- for (n = 0; n < elems; n++) {- if (tree[n * 2] !== 0) {- s.heap[++s.heap_len] = max_code = n;- s.depth[n] = 0;- } else {- tree[n * 2 + 1] = 0;- }- }-- // The pkzip format requires that at least one distance code exists,- // and that at least one bit should be sent even if there is only one- // possible code. So to avoid special checks later on we force at least- // two codes of non zero frequency.- while (s.heap_len < 2) {- node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;- tree[node * 2] = 1;- s.depth[node] = 0;- s.opt_len--;- if (stree)- s.static_len -= stree[node * 2 + 1];- // node is 0 or 1 so it does not have extra bits- }- that.max_code = max_code;-- // The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,- // establish sub-heaps of increasing lengths:-- for (n = Math.floor(s.heap_len / 2); n >= 1; n--)- s.pqdownheap(tree, n);-- // Construct the Huffman tree by repeatedly combining the least two- // frequent nodes.-- node = elems; // next internal node of the tree- do {- // n = node of least frequency- n = s.heap[1];- s.heap[1] = s.heap[s.heap_len--];- s.pqdownheap(tree, 1);- m = s.heap[1]; // m = node of next least frequency-- s.heap[--s.heap_max] = n; // keep the nodes sorted by frequency- s.heap[--s.heap_max] = m;-- // Create a new node father of n and m- tree[node * 2] = (tree[n * 2] + tree[m * 2]);- s.depth[node] = Math.max(s.depth[n], s.depth[m]) + 1;- tree[n * 2 + 1] = tree[m * 2 + 1] = node;-- // and insert the new node in the heap- s.heap[1] = node++;- s.pqdownheap(tree, 1);- } while (s.heap_len >= 2);-- s.heap[--s.heap_max] = s.heap[1];-- // At this point, the fields freq and dad are set. We can now- // generate the bit lengths.-- gen_bitlen(s);-- // The field len is now set, we can generate the bit codes- gen_codes(tree, that.max_code, s.bl_count);- };-- }-- Tree._length_code = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16,- 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20,- 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,- 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,- 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,- 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 ];-- Tree.base_length = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 ];-- Tree.base_dist = [ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384,- 24576 ];-- // Mapping from a distance to a distance code. dist is the distance - 1 and- // must not have side effects. _dist_code[256] and _dist_code[257] are never- // used.- Tree.d_code = function(dist) {- return ((dist) < 256 ? _dist_code[dist] : _dist_code[256 + ((dist) >>> 7)]);- };-- // extra bits for each length code- Tree.extra_lbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 ];-- // extra bits for each distance code- Tree.extra_dbits = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 ];-- // extra bits for each bit length code- Tree.extra_blbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 ];-- Tree.bl_order = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];-- // StaticTree-- function StaticTree(static_tree, extra_bits, extra_base, elems, max_length) {- var that = this;- that.static_tree = static_tree;- that.extra_bits = extra_bits;- that.extra_base = extra_base;- that.elems = elems;- that.max_length = max_length;- }-- StaticTree.static_ltree = [ 12, 8, 140, 8, 76, 8, 204, 8, 44, 8, 172, 8, 108, 8, 236, 8, 28, 8, 156, 8, 92, 8, 220, 8, 60, 8, 188, 8, 124, 8, 252, 8, 2, 8,- 130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8, 18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8, 10, 8, 138, 8, 74, 8, 202, 8, 42,- 8, 170, 8, 106, 8, 234, 8, 26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8, 6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8,- 22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8, 14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8, 30, 8, 158, 8, 94, 8,- 222, 8, 62, 8, 190, 8, 126, 8, 254, 8, 1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8, 17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113,- 8, 241, 8, 9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8, 25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8, 5, 8, 133, 8,- 69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8, 21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8, 13, 8, 141, 8, 77, 8, 205, 8, 45, 8,- 173, 8, 109, 8, 237, 8, 29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8, 19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9,- 51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9, 11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9, 43, 9, 299, 9, 171, 9,- 427, 9, 107, 9, 363, 9, 235, 9, 491, 9, 27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9, 59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379,- 9, 251, 9, 507, 9, 7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9, 39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9, 23,- 9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9, 55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9, 15, 9, 271, 9, 143, 9,- 399, 9, 79, 9, 335, 9, 207, 9, 463, 9, 47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9, 31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9,- 223, 9, 479, 9, 63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9, 0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7, 8, 7, 72, 7,- 40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7, 4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7, 3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8,- 99, 8, 227, 8 ];-- StaticTree.static_dtree = [ 0, 5, 16, 5, 8, 5, 24, 5, 4, 5, 20, 5, 12, 5, 28, 5, 2, 5, 18, 5, 10, 5, 26, 5, 6, 5, 22, 5, 14, 5, 30, 5, 1, 5, 17, 5, 9, 5,- 25, 5, 5, 5, 21, 5, 13, 5, 29, 5, 3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5 ];-- StaticTree.static_l_desc = new StaticTree(StaticTree.static_ltree, Tree.extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);-- StaticTree.static_d_desc = new StaticTree(StaticTree.static_dtree, Tree.extra_dbits, 0, D_CODES, MAX_BITS);-- StaticTree.static_bl_desc = new StaticTree(null, Tree.extra_blbits, 0, BL_CODES, MAX_BL_BITS);-- // Deflate-- var MAX_MEM_LEVEL = 9;- var DEF_MEM_LEVEL = 8;-- function Config(good_length, max_lazy, nice_length, max_chain, func) {- var that = this;- that.good_length = good_length;- that.max_lazy = max_lazy;- that.nice_length = nice_length;- that.max_chain = max_chain;- that.func = func;- }-- var STORED = 0;- var FAST = 1;- var SLOW = 2;- var config_table = [ new Config(0, 0, 0, 0, STORED), new Config(4, 4, 8, 4, FAST), new Config(4, 5, 16, 8, FAST), new Config(4, 6, 32, 32, FAST),- new Config(4, 4, 16, 16, SLOW), new Config(8, 16, 32, 32, SLOW), new Config(8, 16, 128, 128, SLOW), new Config(8, 32, 128, 256, SLOW),- new Config(32, 128, 258, 1024, SLOW), new Config(32, 258, 258, 4096, SLOW) ];-- var z_errmsg = [ "need dictionary", // Z_NEED_DICT- // 2- "stream end", // Z_STREAM_END 1- "", // Z_OK 0- "", // Z_ERRNO (-1)- "stream error", // Z_STREAM_ERROR (-2)- "data error", // Z_DATA_ERROR (-3)- "", // Z_MEM_ERROR (-4)- "buffer error", // Z_BUF_ERROR (-5)- "",// Z_VERSION_ERROR (-6)- "" ];-- // block not completed, need more input or more output- var NeedMore = 0;-- // block flush performed- var BlockDone = 1;-- // finish started, need only more output at next deflate- var FinishStarted = 2;-- // finish done, accept no more input or output- var FinishDone = 3;-- // preset dictionary flag in zlib header- var PRESET_DICT = 0x20;-- var INIT_STATE = 42;- var BUSY_STATE = 113;- var FINISH_STATE = 666;-- // The deflate compression method- var Z_DEFLATED = 8;-- var STORED_BLOCK = 0;- var STATIC_TREES = 1;- var DYN_TREES = 2;-- var MIN_MATCH = 3;- var MAX_MATCH = 258;- var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);-- function smaller(tree, n, m, depth) {- var tn2 = tree[n * 2];- var tm2 = tree[m * 2];- return (tn2 < tm2 || (tn2 == tm2 && depth[n] <= depth[m]));- }-- function Deflate() {-- var that = this;- var strm; // pointer back to this zlib stream- var status; // as the name implies- // pending_buf; // output still pending- var pending_buf_size; // size of pending_buf- // pending_out; // next pending byte to output to the stream- // pending; // nb of bytes in the pending buffer- var method; // STORED (for zip only) or DEFLATED- var last_flush; // value of flush param for previous deflate call-- var w_size; // LZ77 window size (32K by default)- var w_bits; // log2(w_size) (8..16)- var w_mask; // w_size - 1-- var window;- // Sliding window. Input bytes are read into the second half of the window,- // and move to the first half later to keep a dictionary of at least wSize- // bytes. With this organization, matches are limited to a distance of- // wSize-MAX_MATCH bytes, but this ensures that IO is always- // performed with a length multiple of the block size. Also, it limits- // the window size to 64K, which is quite useful on MSDOS.- // To do: use the user input buffer as sliding window.-- var window_size;- // Actual size of window: 2*wSize, except when the user input buffer- // is directly used as sliding window.-- var prev;- // Link to older string with same hash index. To limit the size of this- // array to 64K, this link is maintained only for the last 32K strings.- // An index in this array is thus a window index modulo 32K.-- var head; // Heads of the hash chains or NIL.-- var ins_h; // hash index of string to be inserted- var hash_size; // number of elements in hash table- var hash_bits; // log2(hash_size)- var hash_mask; // hash_size-1-- // Number of bits by which ins_h must be shifted at each input- // step. It must be such that after MIN_MATCH steps, the oldest- // byte no longer takes part in the hash key, that is:- // hash_shift * MIN_MATCH >= hash_bits- var hash_shift;-- // Window position at the beginning of the current output block. Gets- // negative when the window is moved backwards.-- var block_start;-- var match_length; // length of best match- var prev_match; // previous match- var match_available; // set if previous match exists- var strstart; // start of string to insert- var match_start; // start of matching string- var lookahead; // number of valid bytes ahead in window-- // Length of the best match at previous step. Matches not greater than this- // are discarded. This is used in the lazy match evaluation.- var prev_length;-- // To speed up deflation, hash chains are never searched beyond this- // length. A higher limit improves compression ratio but degrades the speed.- var max_chain_length;-- // Attempt to find a better match only when the current match is strictly- // smaller than this value. This mechanism is used only for compression- // levels >= 4.- var max_lazy_match;-- // Insert new strings in the hash table only if the match length is not- // greater than this length. This saves time but degrades compression.- // max_insert_length is used only for compression levels <= 3.-- var level; // compression level (1..9)- var strategy; // favor or force Huffman coding-- // Use a faster search when the previous match is longer than this- var good_match;-- // Stop searching when current match exceeds this- var nice_match;-- var dyn_ltree; // literal and length tree- var dyn_dtree; // distance tree- var bl_tree; // Huffman tree for bit lengths-- var l_desc = new Tree(); // desc for literal tree- var d_desc = new Tree(); // desc for distance tree- var bl_desc = new Tree(); // desc for bit length tree-- // that.heap_len; // number of elements in the heap- // that.heap_max; // element of largest frequency- // The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.- // The same heap array is used to build all trees.-- // Depth of each subtree used as tie breaker for trees of equal frequency- that.depth = [];-- var l_buf; // index for literals or lengths */-- // Size of match buffer for literals/lengths. There are 4 reasons for- // limiting lit_bufsize to 64K:- // - frequencies can be kept in 16 bit counters- // - if compression is not successful for the first block, all input- // data is still in the window so we can still emit a stored block even- // when input comes from standard input. (This can also be done for- // all blocks if lit_bufsize is not greater than 32K.)- // - if compression is not successful for a file smaller than 64K, we can- // even emit a stored file instead of a stored block (saving 5 bytes).- // This is applicable only for zip (not gzip or zlib).- // - creating new Huffman trees less frequently may not provide fast- // adaptation to changes in the input data statistics. (Take for- // example a binary file with poorly compressible code followed by- // a highly compressible string table.) Smaller buffer sizes give- // fast adaptation but have of course the overhead of transmitting- // trees more frequently.- // - I can't count above 4- var lit_bufsize;-- var last_lit; // running index in l_buf-- // Buffer for distances. To simplify the code, d_buf and l_buf have- // the same number of elements. To use different lengths, an extra flag- // array would be necessary.-- var d_buf; // index of pendig_buf-- // that.opt_len; // bit length of current block with optimal trees- // that.static_len; // bit length of current block with static trees- var matches; // number of string matches in current block- var last_eob_len; // bit length of EOB code for last block-- // Output buffer. bits are inserted starting at the bottom (least- // significant bits).- var bi_buf;-- // Number of valid bits in bi_buf. All bits above the last valid bit- // are always zero.- var bi_valid;-- // number of codes at each bit length for an optimal tree- that.bl_count = [];-- // heap used to build the Huffman trees- that.heap = [];-- dyn_ltree = [];- dyn_dtree = [];- bl_tree = [];-- function lm_init() {- var i;- window_size = 2 * w_size;-- head[hash_size - 1] = 0;- for (i = 0; i < hash_size - 1; i++) {- head[i] = 0;- }-- // Set the default configuration parameters:- max_lazy_match = config_table[level].max_lazy;- good_match = config_table[level].good_length;- nice_match = config_table[level].nice_length;- max_chain_length = config_table[level].max_chain;-- strstart = 0;- block_start = 0;- lookahead = 0;- match_length = prev_length = MIN_MATCH - 1;- match_available = 0;- ins_h = 0;- }-- function init_block() {- var i;- // Initialize the trees.- for (i = 0; i < L_CODES; i++)- dyn_ltree[i * 2] = 0;- for (i = 0; i < D_CODES; i++)- dyn_dtree[i * 2] = 0;- for (i = 0; i < BL_CODES; i++)- bl_tree[i * 2] = 0;-- dyn_ltree[END_BLOCK * 2] = 1;- that.opt_len = that.static_len = 0;- last_lit = matches = 0;- }-- // Initialize the tree data structures for a new zlib stream.- function tr_init() {-- l_desc.dyn_tree = dyn_ltree;- l_desc.stat_desc = StaticTree.static_l_desc;-- d_desc.dyn_tree = dyn_dtree;- d_desc.stat_desc = StaticTree.static_d_desc;-- bl_desc.dyn_tree = bl_tree;- bl_desc.stat_desc = StaticTree.static_bl_desc;-- bi_buf = 0;- bi_valid = 0;- last_eob_len = 8; // enough lookahead for inflate-- // Initialize the first block of the first file:- init_block();- }-- // Restore the heap property by moving down the tree starting at node k,- // exchanging a node with the smallest of its two sons if necessary,- // stopping- // when the heap property is re-established (each father smaller than its- // two sons).- that.pqdownheap = function(tree, // the tree to restore- k // node to move down- ) {- var heap = that.heap;- var v = heap[k];- var j = k << 1; // left son of k- while (j <= that.heap_len) {- // Set j to the smallest of the two sons:- if (j < that.heap_len && smaller(tree, heap[j + 1], heap[j], that.depth)) {- j++;- }- // Exit if v is smaller than both sons- if (smaller(tree, v, heap[j], that.depth))- break;-- // Exchange v with the smallest son- heap[k] = heap[j];- k = j;- // And continue down the tree, setting j to the left son of k- j <<= 1;- }- heap[k] = v;- };-- // Scan a literal or distance tree to determine the frequencies of the codes- // in the bit length tree.- function scan_tree(tree,// the tree to be scanned- max_code // and its largest code of non zero frequency- ) {- var n; // iterates over all tree elements- var prevlen = -1; // last emitted length- var curlen; // length of current code- var nextlen = tree[0 * 2 + 1]; // length of next code- var count = 0; // repeat count of the current code- var max_count = 7; // max repeat count- var min_count = 4; // min repeat count-- if (nextlen === 0) {- max_count = 138;- min_count = 3;- }- tree[(max_code + 1) * 2 + 1] = 0xffff; // guard-- for (n = 0; n <= max_code; n++) {- curlen = nextlen;- nextlen = tree[(n + 1) * 2 + 1];- if (++count < max_count && curlen == nextlen) {- continue;- } else if (count < min_count) {- bl_tree[curlen * 2] += count;- } else if (curlen !== 0) {- if (curlen != prevlen)- bl_tree[curlen * 2]++;- bl_tree[REP_3_6 * 2]++;- } else if (count <= 10) {- bl_tree[REPZ_3_10 * 2]++;- } else {- bl_tree[REPZ_11_138 * 2]++;- }- count = 0;- prevlen = curlen;- if (nextlen === 0) {- max_count = 138;- min_count = 3;- } else if (curlen == nextlen) {- max_count = 6;- min_count = 3;- } else {- max_count = 7;- min_count = 4;- }- }- }-- // Construct the Huffman tree for the bit lengths and return the index in- // bl_order of the last bit length code to send.- function build_bl_tree() {- var max_blindex; // index of last bit length code of non zero freq-- // Determine the bit length frequencies for literal and distance trees- scan_tree(dyn_ltree, l_desc.max_code);- scan_tree(dyn_dtree, d_desc.max_code);-- // Build the bit length tree:- bl_desc.build_tree(that);- // opt_len now includes the length of the tree representations, except- // the lengths of the bit lengths codes and the 5+5+4 bits for the- // counts.-- // Determine the number of bit length codes to send. The pkzip format- // requires that at least 4 bit length codes be sent. (appnote.txt says- // 3 but the actual value used is 4.)- for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {- if (bl_tree[Tree.bl_order[max_blindex] * 2 + 1] !== 0)- break;- }- // Update opt_len to include the bit length tree and counts- that.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;-- return max_blindex;- }-- // Output a byte on the stream.- // IN assertion: there is enough room in pending_buf.- function put_byte(p) {- that.pending_buf[that.pending++] = p;- }-- function put_short(w) {- put_byte(w & 0xff);- put_byte((w >>> 8) & 0xff);- }-- function putShortMSB(b) {- put_byte((b >> 8) & 0xff);- put_byte((b & 0xff) & 0xff);- }-- function send_bits(value, length) {- var val, len = length;- if (bi_valid > Buf_size - len) {- val = value;- // bi_buf |= (val << bi_valid);- bi_buf |= ((val << bi_valid) & 0xffff);- put_short(bi_buf);- bi_buf = val >>> (Buf_size - bi_valid);- bi_valid += len - Buf_size;- } else {- // bi_buf |= (value) << bi_valid;- bi_buf |= (((value) << bi_valid) & 0xffff);- bi_valid += len;- }- }-- function send_code(c, tree) {- var c2 = c * 2;- send_bits(tree[c2] & 0xffff, tree[c2 + 1] & 0xffff);- }-- // Send a literal or distance tree in compressed form, using the codes in- // bl_tree.- function send_tree(tree,// the tree to be sent- max_code // and its largest code of non zero frequency- ) {- var n; // iterates over all tree elements- var prevlen = -1; // last emitted length- var curlen; // length of current code- var nextlen = tree[0 * 2 + 1]; // length of next code- var count = 0; // repeat count of the current code- var max_count = 7; // max repeat count- var min_count = 4; // min repeat count-- if (nextlen === 0) {- max_count = 138;- min_count = 3;- }-- for (n = 0; n <= max_code; n++) {- curlen = nextlen;- nextlen = tree[(n + 1) * 2 + 1];- if (++count < max_count && curlen == nextlen) {- continue;- } else if (count < min_count) {- do {- send_code(curlen, bl_tree);- } while (--count !== 0);- } else if (curlen !== 0) {- if (curlen != prevlen) {- send_code(curlen, bl_tree);- count--;- }- send_code(REP_3_6, bl_tree);- send_bits(count - 3, 2);- } else if (count <= 10) {- send_code(REPZ_3_10, bl_tree);- send_bits(count - 3, 3);- } else {- send_code(REPZ_11_138, bl_tree);- send_bits(count - 11, 7);- }- count = 0;- prevlen = curlen;- if (nextlen === 0) {- max_count = 138;- min_count = 3;- } else if (curlen == nextlen) {- max_count = 6;- min_count = 3;- } else {- max_count = 7;- min_count = 4;- }- }- }-- // Send the header for a block using dynamic Huffman trees: the counts, the- // lengths of the bit length codes, the literal tree and the distance tree.- // IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.- function send_all_trees(lcodes, dcodes, blcodes) {- var rank; // index in bl_order-- send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt- send_bits(dcodes - 1, 5);- send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt- for (rank = 0; rank < blcodes; rank++) {- send_bits(bl_tree[Tree.bl_order[rank] * 2 + 1], 3);- }- send_tree(dyn_ltree, lcodes - 1); // literal tree- send_tree(dyn_dtree, dcodes - 1); // distance tree- }-- // Flush the bit buffer, keeping at most 7 bits in it.- function bi_flush() {- if (bi_valid == 16) {- put_short(bi_buf);- bi_buf = 0;- bi_valid = 0;- } else if (bi_valid >= 8) {- put_byte(bi_buf & 0xff);- bi_buf >>>= 8;- bi_valid -= 8;- }- }-- // Send one empty static block to give enough lookahead for inflate.- // This takes 10 bits, of which 7 may remain in the bit buffer.- // The current inflate code requires 9 bits of lookahead. If the- // last two codes for the previous block (real code plus EOB) were coded- // on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode- // the last real code. In this case we send two empty static blocks instead- // of one. (There are no problems if the previous block is stored or fixed.)- // To simplify the code, we assume the worst case of last real code encoded- // on one bit only.- function _tr_align() {- send_bits(STATIC_TREES << 1, 3);- send_code(END_BLOCK, StaticTree.static_ltree);-- bi_flush();-- // Of the 10 bits for the empty block, we have already sent- // (10 - bi_valid) bits. The lookahead for the last real code (before- // the EOB of the previous block) was thus at least one plus the length- // of the EOB plus what we have just sent of the empty static block.- if (1 + last_eob_len + 10 - bi_valid < 9) {- send_bits(STATIC_TREES << 1, 3);- send_code(END_BLOCK, StaticTree.static_ltree);- bi_flush();- }- last_eob_len = 7;- }-- // Save the match info and tally the frequency counts. Return true if- // the current block must be flushed.- function _tr_tally(dist, // distance of matched string- lc // match length-MIN_MATCH or unmatched char (if dist==0)- ) {- var out_length, in_length, dcode;- that.pending_buf[d_buf + last_lit * 2] = (dist >>> 8) & 0xff;- that.pending_buf[d_buf + last_lit * 2 + 1] = dist & 0xff;-- that.pending_buf[l_buf + last_lit] = lc & 0xff;- last_lit++;-- if (dist === 0) {- // lc is the unmatched char- dyn_ltree[lc * 2]++;- } else {- matches++;- // Here, lc is the match length - MIN_MATCH- dist--; // dist = match distance - 1- dyn_ltree[(Tree._length_code[lc] + LITERALS + 1) * 2]++;- dyn_dtree[Tree.d_code(dist) * 2]++;- }-- if ((last_lit & 0x1fff) === 0 && level > 2) {- // Compute an upper bound for the compressed length- out_length = last_lit * 8;- in_length = strstart - block_start;- for (dcode = 0; dcode < D_CODES; dcode++) {- out_length += dyn_dtree[dcode * 2] * (5 + Tree.extra_dbits[dcode]);- }- out_length >>>= 3;- if ((matches < Math.floor(last_lit / 2)) && out_length < Math.floor(in_length / 2))- return true;- }-- return (last_lit == lit_bufsize - 1);- // We avoid equality with lit_bufsize because of wraparound at 64K- // on 16 bit machines and because stored blocks are restricted to- // 64K-1 bytes.- }-- // Send the block data compressed using the given Huffman trees- function compress_block(ltree, dtree) {- var dist; // distance of matched string- var lc; // match length or unmatched char (if dist === 0)- var lx = 0; // running index in l_buf- var code; // the code to send- var extra; // number of extra bits to send-- if (last_lit !== 0) {- do {- dist = ((that.pending_buf[d_buf + lx * 2] << 8) & 0xff00) | (that.pending_buf[d_buf + lx * 2 + 1] & 0xff);- lc = (that.pending_buf[l_buf + lx]) & 0xff;- lx++;-- if (dist === 0) {- send_code(lc, ltree); // send a literal byte- } else {- // Here, lc is the match length - MIN_MATCH- code = Tree._length_code[lc];-- send_code(code + LITERALS + 1, ltree); // send the length- // code- extra = Tree.extra_lbits[code];- if (extra !== 0) {- lc -= Tree.base_length[code];- send_bits(lc, extra); // send the extra length bits- }- dist--; // dist is now the match distance - 1- code = Tree.d_code(dist);-- send_code(code, dtree); // send the distance code- extra = Tree.extra_dbits[code];- if (extra !== 0) {- dist -= Tree.base_dist[code];- send_bits(dist, extra); // send the extra distance bits- }- } // literal or match pair ?-- // Check that the overlay between pending_buf and d_buf+l_buf is- // ok:- } while (lx < last_lit);- }-- send_code(END_BLOCK, ltree);- last_eob_len = ltree[END_BLOCK * 2 + 1];- }-- // Flush the bit buffer and align the output on a byte boundary- function bi_windup() {- if (bi_valid > 8) {- put_short(bi_buf);- } else if (bi_valid > 0) {- put_byte(bi_buf & 0xff);- }- bi_buf = 0;- bi_valid = 0;- }-- // Copy a stored block, storing first the length and its- // one's complement if requested.- function copy_block(buf, // the input data- len, // its length- header // true if block header must be written- ) {- bi_windup(); // align on byte boundary- last_eob_len = 8; // enough lookahead for inflate-- if (header) {- put_short(len);- put_short(~len);- }-- that.pending_buf.set(window.subarray(buf, buf + len), that.pending);- that.pending += len;- }-- // Send a stored block- function _tr_stored_block(buf, // input block- stored_len, // length of input block- eof // true if this is the last block for a file- ) {- send_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3); // send block type- copy_block(buf, stored_len, true); // with header- }-- // Determine the best encoding for the current block: dynamic trees, static- // trees or store, and output the encoded block to the zip file.- function _tr_flush_block(buf, // input block, or NULL if too old- stored_len, // length of input block- eof // true if this is the last block for a file- ) {- var opt_lenb, static_lenb;// opt_len and static_len in bytes- var max_blindex = 0; // index of last bit length code of non zero freq-- // Build the Huffman trees unless a stored block is forced- if (level > 0) {- // Construct the literal and distance trees- l_desc.build_tree(that);-- d_desc.build_tree(that);-- // At this point, opt_len and static_len are the total bit lengths- // of- // the compressed block data, excluding the tree representations.-- // Build the bit length tree for the above two trees, and get the- // index- // in bl_order of the last bit length code to send.- max_blindex = build_bl_tree();-- // Determine the best encoding. Compute first the block length in- // bytes- opt_lenb = (that.opt_len + 3 + 7) >>> 3;- static_lenb = (that.static_len + 3 + 7) >>> 3;-- if (static_lenb <= opt_lenb)- opt_lenb = static_lenb;- } else {- opt_lenb = static_lenb = stored_len + 5; // force a stored block- }-- if ((stored_len + 4 <= opt_lenb) && buf != -1) {- // 4: two words for the lengths- // The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.- // Otherwise we can't have processed more than WSIZE input bytes- // since- // the last block flush, because compression would have been- // successful. If LIT_BUFSIZE <= WSIZE, it is never too late to- // transform a block into a stored block.- _tr_stored_block(buf, stored_len, eof);- } else if (static_lenb == opt_lenb) {- send_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3);- compress_block(StaticTree.static_ltree, StaticTree.static_dtree);- } else {- send_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3);- send_all_trees(l_desc.max_code + 1, d_desc.max_code + 1, max_blindex + 1);- compress_block(dyn_ltree, dyn_dtree);- }-- // The above check is made mod 2^32, for files larger than 512 MB- // and uLong implemented on 32 bits.-- init_block();-- if (eof) {- bi_windup();- }- }-- function flush_block_only(eof) {- _tr_flush_block(block_start >= 0 ? block_start : -1, strstart - block_start, eof);- block_start = strstart;- strm.flush_pending();- }-- // Fill the window when the lookahead becomes insufficient.- // Updates strstart and lookahead.- //- // IN assertion: lookahead < MIN_LOOKAHEAD- // OUT assertions: strstart <= window_size-MIN_LOOKAHEAD- // At least one byte has been read, or avail_in === 0; reads are- // performed for at least two bytes (required for the zip translate_eol- // option -- not supported here).- function fill_window() {- var n, m;- var p;- var more; // Amount of free space at the end of the window.-- do {- more = (window_size - lookahead - strstart);-- // Deal with !@#$% 64K limit:- if (more === 0 && strstart === 0 && lookahead === 0) {- more = w_size;- } else if (more == -1) {- // Very unlikely, but possible on 16 bit machine if strstart ==- // 0- // and lookahead == 1 (input done one byte at time)- more--;-- // If the window is almost full and there is insufficient- // lookahead,- // move the upper half to the lower one to make room in the- // upper half.- } else if (strstart >= w_size + w_size - MIN_LOOKAHEAD) {- window.set(window.subarray(w_size, w_size + w_size), 0);-- match_start -= w_size;- strstart -= w_size; // we now have strstart >= MAX_DIST- block_start -= w_size;-- // Slide the hash table (could be avoided with 32 bit values- // at the expense of memory usage). We slide even when level ==- // 0- // to keep the hash table consistent if we switch back to level- // > 0- // later. (Using level 0 permanently is not an optimal usage of- // zlib, so we don't care about this pathological case.)-- n = hash_size;- p = n;- do {- m = (head[--p] & 0xffff);- head[p] = (m >= w_size ? m - w_size : 0);- } while (--n !== 0);-- n = w_size;- p = n;- do {- m = (prev[--p] & 0xffff);- prev[p] = (m >= w_size ? m - w_size : 0);- // If n is not on any hash chain, prev[n] is garbage but- // its value will never be used.- } while (--n !== 0);- more += w_size;- }-- if (strm.avail_in === 0)- return;-- // If there was no sliding:- // strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&- // more == window_size - lookahead - strstart- // => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)- // => more >= window_size - 2*WSIZE + 2- // In the BIG_MEM or MMAP case (not yet supported),- // window_size == input_size + MIN_LOOKAHEAD &&- // strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.- // Otherwise, window_size == 2*WSIZE so more >= 2.- // If there was sliding, more >= WSIZE. So in all cases, more >= 2.-- n = strm.read_buf(window, strstart + lookahead, more);- lookahead += n;-- // Initialize the hash value now that we have some input:- if (lookahead >= MIN_MATCH) {- ins_h = window[strstart] & 0xff;- ins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;- }- // If the whole input has less than MIN_MATCH bytes, ins_h is- // garbage,- // but this is not important since only literal bytes will be- // emitted.- } while (lookahead < MIN_LOOKAHEAD && strm.avail_in !== 0);- }-- // Copy without compression as much as possible from the input stream,- // return- // the current block state.- // This function does not insert new strings in the dictionary since- // uncompressible data is probably not useful. This function is used- // only for the level=0 compression option.- // NOTE: this function should be optimized to avoid extra copying from- // window to pending_buf.- function deflate_stored(flush) {- // Stored blocks are limited to 0xffff bytes, pending_buf is limited- // to pending_buf_size, and each stored block has a 5 byte header:-- var max_block_size = 0xffff;- var max_start;-- if (max_block_size > pending_buf_size - 5) {- max_block_size = pending_buf_size - 5;- }-- // Copy as much as possible from input to output:- while (true) {- // Fill the window as much as possible:- if (lookahead <= 1) {- fill_window();- if (lookahead === 0 && flush == Z_NO_FLUSH)- return NeedMore;- if (lookahead === 0)- break; // flush the current block- }-- strstart += lookahead;- lookahead = 0;-- // Emit a stored block if pending_buf will be full:- max_start = block_start + max_block_size;- if (strstart === 0 || strstart >= max_start) {- // strstart === 0 is possible when wraparound on 16-bit machine- lookahead = (strstart - max_start);- strstart = max_start;-- flush_block_only(false);- if (strm.avail_out === 0)- return NeedMore;-- }-- // Flush if we may have to slide, otherwise block_start may become- // negative and the data will be gone:- if (strstart - block_start >= w_size - MIN_LOOKAHEAD) {- flush_block_only(false);- if (strm.avail_out === 0)- return NeedMore;- }- }-- flush_block_only(flush == Z_FINISH);- if (strm.avail_out === 0)- return (flush == Z_FINISH) ? FinishStarted : NeedMore;-- return flush == Z_FINISH ? FinishDone : BlockDone;- }-- function longest_match(cur_match) {- var chain_length = max_chain_length; // max hash chain length- var scan = strstart; // current string- var match; // matched string- var len; // length of current match- var best_len = prev_length; // best match length so far- var limit = strstart > (w_size - MIN_LOOKAHEAD) ? strstart - (w_size - MIN_LOOKAHEAD) : 0;- var _nice_match = nice_match;-- // Stop when cur_match becomes <= limit. To simplify the code,- // we prevent matches with the string of window index 0.-- var wmask = w_mask;-- var strend = strstart + MAX_MATCH;- var scan_end1 = window[scan + best_len - 1];- var scan_end = window[scan + best_len];-- // The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of- // 16.- // It is easy to get rid of this optimization if necessary.-- // Do not waste too much time if we already have a good match:- if (prev_length >= good_match) {- chain_length >>= 2;- }-- // Do not look for matches beyond the end of the input. This is- // necessary- // to make deflate deterministic.- if (_nice_match > lookahead)- _nice_match = lookahead;-- do {- match = cur_match;-- // Skip to next match if the match length cannot increase- // or if the match length is less than 2:- if (window[match + best_len] != scan_end || window[match + best_len - 1] != scan_end1 || window[match] != window[scan]- || window[++match] != window[scan + 1])- continue;-- // The check at best_len-1 can be removed because it will be made- // again later. (This heuristic is not always a win.)- // It is not necessary to compare scan[2] and match[2] since they- // are always equal when the other bytes match, given that- // the hash keys are equal and that HASH_BITS >= 8.- scan += 2;- match++;-- // We check for insufficient lookahead only every 8th comparison;- // the 256th check will be made at strstart+258.- do {- } while (window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match]- && window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match]- && window[++scan] == window[++match] && window[++scan] == window[++match] && scan < strend);-- len = MAX_MATCH - (strend - scan);- scan = strend - MAX_MATCH;-- if (len > best_len) {- match_start = cur_match;- best_len = len;- if (len >= _nice_match)- break;- scan_end1 = window[scan + best_len - 1];- scan_end = window[scan + best_len];- }-- } while ((cur_match = (prev[cur_match & wmask] & 0xffff)) > limit && --chain_length !== 0);-- if (best_len <= lookahead)- return best_len;- return lookahead;- }-- // Compress as much as possible from the input stream, return the current- // block state.- // This function does not perform lazy evaluation of matches and inserts- // new strings in the dictionary only for unmatched strings or for short- // matches. It is used only for the fast compression options.- function deflate_fast(flush) {- // short hash_head = 0; // head of the hash chain- var hash_head = 0; // head of the hash chain- var bflush; // set if current block must be flushed-- while (true) {- // Make sure that we always have enough lookahead, except- // at the end of the input file. We need MAX_MATCH bytes- // for the next match, plus MIN_MATCH bytes to insert the- // string following the next match.- if (lookahead < MIN_LOOKAHEAD) {- fill_window();- if (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {- return NeedMore;- }- if (lookahead === 0)- break; // flush the current block- }-- // Insert the string window[strstart .. strstart+2] in the- // dictionary, and set hash_head to the head of the hash chain:- if (lookahead >= MIN_MATCH) {- ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;-- // prev[strstart&w_mask]=hash_head=head[ins_h];- hash_head = (head[ins_h] & 0xffff);- prev[strstart & w_mask] = head[ins_h];- head[ins_h] = strstart;- }-- // Find the longest match, discarding those <= prev_length.- // At this point we have always match_length < MIN_MATCH-- if (hash_head !== 0 && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) {- // To simplify the code, we prevent matches with the string- // of window index 0 (in particular we have to avoid a match- // of the string with itself at the start of the input file).- if (strategy != Z_HUFFMAN_ONLY) {- match_length = longest_match(hash_head);- }- // longest_match() sets match_start- }- if (match_length >= MIN_MATCH) {- // check_match(strstart, match_start, match_length);-- bflush = _tr_tally(strstart - match_start, match_length - MIN_MATCH);-- lookahead -= match_length;-- // Insert new strings in the hash table only if the match length- // is not too large. This saves time but degrades compression.- if (match_length <= max_lazy_match && lookahead >= MIN_MATCH) {- match_length--; // string at strstart already in hash table- do {- strstart++;-- ins_h = ((ins_h << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;- // prev[strstart&w_mask]=hash_head=head[ins_h];- hash_head = (head[ins_h] & 0xffff);- prev[strstart & w_mask] = head[ins_h];- head[ins_h] = strstart;-- // strstart never exceeds WSIZE-MAX_MATCH, so there are- // always MIN_MATCH bytes ahead.- } while (--match_length !== 0);- strstart++;- } else {- strstart += match_length;- match_length = 0;- ins_h = window[strstart] & 0xff;-- ins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;- // If lookahead < MIN_MATCH, ins_h is garbage, but it does- // not- // matter since it will be recomputed at next deflate call.- }- } else {- // No match, output a literal byte-- bflush = _tr_tally(0, window[strstart] & 0xff);- lookahead--;- strstart++;- }- if (bflush) {-- flush_block_only(false);- if (strm.avail_out === 0)- return NeedMore;- }- }-- flush_block_only(flush == Z_FINISH);- if (strm.avail_out === 0) {- if (flush == Z_FINISH)- return FinishStarted;- else- return NeedMore;- }- return flush == Z_FINISH ? FinishDone : BlockDone;- }-- // Same as above, but achieves better compression. We use a lazy- // evaluation for matches: a match is finally adopted only if there is- // no better match at the next window position.- function deflate_slow(flush) {- // short hash_head = 0; // head of hash chain- var hash_head = 0; // head of hash chain- var bflush; // set if current block must be flushed- var max_insert;-- // Process the input block.- while (true) {- // Make sure that we always have enough lookahead, except- // at the end of the input file. We need MAX_MATCH bytes- // for the next match, plus MIN_MATCH bytes to insert the- // string following the next match.-- if (lookahead < MIN_LOOKAHEAD) {- fill_window();- if (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {- return NeedMore;- }- if (lookahead === 0)- break; // flush the current block- }-- // Insert the string window[strstart .. strstart+2] in the- // dictionary, and set hash_head to the head of the hash chain:-- if (lookahead >= MIN_MATCH) {- ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;- // prev[strstart&w_mask]=hash_head=head[ins_h];- hash_head = (head[ins_h] & 0xffff);- prev[strstart & w_mask] = head[ins_h];- head[ins_h] = strstart;- }-- // Find the longest match, discarding those <= prev_length.- prev_length = match_length;- prev_match = match_start;- match_length = MIN_MATCH - 1;-- if (hash_head !== 0 && prev_length < max_lazy_match && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) {- // To simplify the code, we prevent matches with the string- // of window index 0 (in particular we have to avoid a match- // of the string with itself at the start of the input file).-- if (strategy != Z_HUFFMAN_ONLY) {- match_length = longest_match(hash_head);- }- // longest_match() sets match_start-- if (match_length <= 5 && (strategy == Z_FILTERED || (match_length == MIN_MATCH && strstart - match_start > 4096))) {-- // If prev_match is also MIN_MATCH, match_start is garbage- // but we will ignore the current match anyway.- match_length = MIN_MATCH - 1;- }- }-- // If there was a match at the previous step and the current- // match is not better, output the previous match:- if (prev_length >= MIN_MATCH && match_length <= prev_length) {- max_insert = strstart + lookahead - MIN_MATCH;- // Do not insert strings in hash table beyond this.-- // check_match(strstart-1, prev_match, prev_length);-- bflush = _tr_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH);-- // Insert in hash table all strings up to the end of the match.- // strstart-1 and strstart are already inserted. If there is not- // enough lookahead, the last two strings are not inserted in- // the hash table.- lookahead -= prev_length - 1;- prev_length -= 2;- do {- if (++strstart <= max_insert) {- ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;- // prev[strstart&w_mask]=hash_head=head[ins_h];- hash_head = (head[ins_h] & 0xffff);- prev[strstart & w_mask] = head[ins_h];- head[ins_h] = strstart;- }- } while (--prev_length !== 0);- match_available = 0;- match_length = MIN_MATCH - 1;- strstart++;-- if (bflush) {- flush_block_only(false);- if (strm.avail_out === 0)- return NeedMore;- }- } else if (match_available !== 0) {-- // If there was no match at the previous position, output a- // single literal. If there was a match but the current match- // is longer, truncate the previous match to a single literal.-- bflush = _tr_tally(0, window[strstart - 1] & 0xff);-- if (bflush) {- flush_block_only(false);- }- strstart++;- lookahead--;- if (strm.avail_out === 0)- return NeedMore;- } else {- // There is no previous match to compare with, wait for- // the next step to decide.-- match_available = 1;- strstart++;- lookahead--;- }- }-- if (match_available !== 0) {- bflush = _tr_tally(0, window[strstart - 1] & 0xff);- match_available = 0;- }- flush_block_only(flush == Z_FINISH);-- if (strm.avail_out === 0) {- if (flush == Z_FINISH)- return FinishStarted;- else- return NeedMore;- }-- return flush == Z_FINISH ? FinishDone : BlockDone;- }-- function deflateReset(strm) {- strm.total_in = strm.total_out = 0;- strm.msg = null; //-- that.pending = 0;- that.pending_out = 0;-- status = BUSY_STATE;-- last_flush = Z_NO_FLUSH;-- tr_init();- lm_init();- return Z_OK;- }-- that.deflateInit = function(strm, _level, bits, _method, memLevel, _strategy) {- if (!_method)- _method = Z_DEFLATED;- if (!memLevel)- memLevel = DEF_MEM_LEVEL;- if (!_strategy)- _strategy = Z_DEFAULT_STRATEGY;-- // byte[] my_version=ZLIB_VERSION;-- //- // if (!version || version[0] != my_version[0]- // || stream_size != sizeof(z_stream)) {- // return Z_VERSION_ERROR;- // }-- strm.msg = null;-- if (_level == Z_DEFAULT_COMPRESSION)- _level = 6;-- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || _method != Z_DEFLATED || bits < 9 || bits > 15 || _level < 0 || _level > 9 || _strategy < 0- || _strategy > Z_HUFFMAN_ONLY) {- return Z_STREAM_ERROR;- }-- strm.dstate = that;-- w_bits = bits;- w_size = 1 << w_bits;- w_mask = w_size - 1;-- hash_bits = memLevel + 7;- hash_size = 1 << hash_bits;- hash_mask = hash_size - 1;- hash_shift = Math.floor((hash_bits + MIN_MATCH - 1) / MIN_MATCH);-- window = new Uint8Array(w_size * 2);- prev = [];- head = [];-- lit_bufsize = 1 << (memLevel + 6); // 16K elements by default-- // We overlay pending_buf and d_buf+l_buf. This works since the average- // output size for (length,distance) codes is <= 24 bits.- that.pending_buf = new Uint8Array(lit_bufsize * 4);- pending_buf_size = lit_bufsize * 4;-- d_buf = Math.floor(lit_bufsize / 2);- l_buf = (1 + 2) * lit_bufsize;-- level = _level;-- strategy = _strategy;- method = _method & 0xff;-- return deflateReset(strm);- };-- that.deflateEnd = function() {- if (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE) {- return Z_STREAM_ERROR;- }- // Deallocate in reverse order of allocations:- that.pending_buf = null;- head = null;- prev = null;- window = null;- // free- that.dstate = null;- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;- };-- that.deflateParams = function(strm, _level, _strategy) {- var err = Z_OK;-- if (_level == Z_DEFAULT_COMPRESSION) {- _level = 6;- }- if (_level < 0 || _level > 9 || _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {- return Z_STREAM_ERROR;- }-- if (config_table[level].func != config_table[_level].func && strm.total_in !== 0) {- // Flush the last buffer:- err = strm.deflate(Z_PARTIAL_FLUSH);- }-- if (level != _level) {- level = _level;- max_lazy_match = config_table[level].max_lazy;- good_match = config_table[level].good_length;- nice_match = config_table[level].nice_length;- max_chain_length = config_table[level].max_chain;- }- strategy = _strategy;- return err;- };-- that.deflateSetDictionary = function(strm, dictionary, dictLength) {- var length = dictLength;- var n, index = 0;-- if (!dictionary || status != INIT_STATE)- return Z_STREAM_ERROR;-- if (length < MIN_MATCH)- return Z_OK;- if (length > w_size - MIN_LOOKAHEAD) {- length = w_size - MIN_LOOKAHEAD;- index = dictLength - length; // use the tail of the dictionary- }- window.set(dictionary.subarray(index, index + length), 0);-- strstart = length;- block_start = length;-- // Insert all strings in the hash table (except for the last two bytes).- // s->lookahead stays null, so s->ins_h will be recomputed at the next- // call of fill_window.-- ins_h = window[0] & 0xff;- ins_h = (((ins_h) << hash_shift) ^ (window[1] & 0xff)) & hash_mask;-- for (n = 0; n <= length - MIN_MATCH; n++) {- ins_h = (((ins_h) << hash_shift) ^ (window[(n) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;- prev[n & w_mask] = head[ins_h];- head[ins_h] = n;- }- return Z_OK;- };-- that.deflate = function(_strm, flush) {- var i, header, level_flags, old_flush, bstate;-- if (flush > Z_FINISH || flush < 0) {- return Z_STREAM_ERROR;- }-- if (!_strm.next_out || (!_strm.next_in && _strm.avail_in !== 0) || (status == FINISH_STATE && flush != Z_FINISH)) {- _strm.msg = z_errmsg[Z_NEED_DICT - (Z_STREAM_ERROR)];- return Z_STREAM_ERROR;- }- if (_strm.avail_out === 0) {- _strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];- return Z_BUF_ERROR;- }-- strm = _strm; // just in case- old_flush = last_flush;- last_flush = flush;-- // Write the zlib header- if (status == INIT_STATE) {- header = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8;- level_flags = ((level - 1) & 0xff) >> 1;-- if (level_flags > 3)- level_flags = 3;- header |= (level_flags << 6);- if (strstart !== 0)- header |= PRESET_DICT;- header += 31 - (header % 31);-- status = BUSY_STATE;- putShortMSB(header);- }-- // Flush as much pending output as possible- if (that.pending !== 0) {- strm.flush_pending();- if (strm.avail_out === 0) {- // console.log(" avail_out==0");- // Since avail_out is 0, deflate will be called again with- // more output space, but possibly with both pending and- // avail_in equal to zero. There won't be anything to do,- // but this is not an error situation so make sure we- // return OK instead of BUF_ERROR at next call of deflate:- last_flush = -1;- return Z_OK;- }-- // Make sure there is something to do and avoid duplicate- // consecutive- // flushes. For repeated and useless calls with Z_FINISH, we keep- // returning Z_STREAM_END instead of Z_BUFF_ERROR.- } else if (strm.avail_in === 0 && flush <= old_flush && flush != Z_FINISH) {- strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];- return Z_BUF_ERROR;- }-- // User must not provide more input after the first FINISH:- if (status == FINISH_STATE && strm.avail_in !== 0) {- _strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];- return Z_BUF_ERROR;- }-- // Start a new block or continue the current one.- if (strm.avail_in !== 0 || lookahead !== 0 || (flush != Z_NO_FLUSH && status != FINISH_STATE)) {- bstate = -1;- switch (config_table[level].func) {- case STORED:- bstate = deflate_stored(flush);- break;- case FAST:- bstate = deflate_fast(flush);- break;- case SLOW:- bstate = deflate_slow(flush);- break;- default:- }-- if (bstate == FinishStarted || bstate == FinishDone) {- status = FINISH_STATE;- }- if (bstate == NeedMore || bstate == FinishStarted) {- if (strm.avail_out === 0) {- last_flush = -1; // avoid BUF_ERROR next call, see above- }- return Z_OK;- // If flush != Z_NO_FLUSH && avail_out === 0, the next call- // of deflate should use the same flush parameter to make sure- // that the flush is complete. So we don't have to output an- // empty block here, this will be done at next call. This also- // ensures that for a very small output buffer, we emit at most- // one empty block.- }-- if (bstate == BlockDone) {- if (flush == Z_PARTIAL_FLUSH) {- _tr_align();- } else { // FULL_FLUSH or SYNC_FLUSH- _tr_stored_block(0, 0, false);- // For a full flush, this empty block will be recognized- // as a special marker by inflate_sync().- if (flush == Z_FULL_FLUSH) {- // state.head[s.hash_size-1]=0;- for (i = 0; i < hash_size/*-1*/; i++)- // forget history- head[i] = 0;- }- }- strm.flush_pending();- if (strm.avail_out === 0) {- last_flush = -1; // avoid BUF_ERROR at next call, see above- return Z_OK;- }- }- }-- if (flush != Z_FINISH)- return Z_OK;- return Z_STREAM_END;- };- }-- // ZStream-- function ZStream() {- var that = this;- that.next_in_index = 0;- that.next_out_index = 0;- // that.next_in; // next input byte- that.avail_in = 0; // number of bytes available at next_in- that.total_in = 0; // total nb of input bytes read so far- // that.next_out; // next output byte should be put there- that.avail_out = 0; // remaining free space at next_out- that.total_out = 0; // total nb of bytes output so far- // that.msg;- // that.dstate;- }-- ZStream.prototype = {- deflateInit : function(level, bits) {- var that = this;- that.dstate = new Deflate();- if (!bits)- bits = MAX_BITS;- return that.dstate.deflateInit(that, level, bits);- },-- deflate : function(flush) {- var that = this;- if (!that.dstate) {- return Z_STREAM_ERROR;- }- return that.dstate.deflate(that, flush);- },-- deflateEnd : function() {- var that = this;- if (!that.dstate)- return Z_STREAM_ERROR;- var ret = that.dstate.deflateEnd();- that.dstate = null;- return ret;- },-- deflateParams : function(level, strategy) {- var that = this;- if (!that.dstate)- return Z_STREAM_ERROR;- return that.dstate.deflateParams(that, level, strategy);- },-- deflateSetDictionary : function(dictionary, dictLength) {- var that = this;- if (!that.dstate)- return Z_STREAM_ERROR;- return that.dstate.deflateSetDictionary(that, dictionary, dictLength);- },-- // Read a new buffer from the current input stream, update the- // total number of bytes read. All deflate() input goes through- // this function so some applications may wish to modify it to avoid- // allocating a large strm->next_in buffer and copying from it.- // (See also flush_pending()).- read_buf : function(buf, start, size) {- var that = this;- var len = that.avail_in;- if (len > size)- len = size;- if (len === 0)- return 0;- that.avail_in -= len;- buf.set(that.next_in.subarray(that.next_in_index, that.next_in_index + len), start);- that.next_in_index += len;- that.total_in += len;- return len;- },-- // Flush as much pending output as possible. All deflate() output goes- // through this function so some applications may wish to modify it- // to avoid allocating a large strm->next_out buffer and copying into it.- // (See also read_buf()).- flush_pending : function() {- var that = this;- var len = that.dstate.pending;-- if (len > that.avail_out)- len = that.avail_out;- if (len === 0)- return;-- // if (that.dstate.pending_buf.length <= that.dstate.pending_out || that.next_out.length <= that.next_out_index- // || that.dstate.pending_buf.length < (that.dstate.pending_out + len) || that.next_out.length < (that.next_out_index +- // len)) {- // console.log(that.dstate.pending_buf.length + ", " + that.dstate.pending_out + ", " + that.next_out.length + ", " +- // that.next_out_index + ", " + len);- // console.log("avail_out=" + that.avail_out);- // }-- that.next_out.set(that.dstate.pending_buf.subarray(that.dstate.pending_out, that.dstate.pending_out + len), that.next_out_index);-- that.next_out_index += len;- that.dstate.pending_out += len;- that.total_out += len;- that.avail_out -= len;- that.dstate.pending -= len;- if (that.dstate.pending === 0) {- that.dstate.pending_out = 0;- }- }- };-- // Deflater-- return function Deflater(level) {- var that = this;- var z = new ZStream();- var bufsize = 512;- var flush = Z_NO_FLUSH;- var buf = new Uint8Array(bufsize);-- if (typeof level == "undefined")- level = Z_DEFAULT_COMPRESSION;- z.deflateInit(level);- z.next_out = buf;-- that.append = function(data, onprogress) {- var err, buffers = [], lastIndex = 0, bufferIndex = 0, bufferSize = 0, array;- if (!data.length)- return;- z.next_in_index = 0;- z.next_in = data;- z.avail_in = data.length;- do {- z.next_out_index = 0;- z.avail_out = bufsize;- err = z.deflate(flush);- if (err != Z_OK)- throw "deflating: " + z.msg;- if (z.next_out_index)- if (z.next_out_index == bufsize)- buffers.push(new Uint8Array(buf));- else- buffers.push(new Uint8Array(buf.subarray(0, z.next_out_index)));- bufferSize += z.next_out_index;- if (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) {- onprogress(z.next_in_index);- lastIndex = z.next_in_index;- }- } while (z.avail_in > 0 || z.avail_out === 0);- array = new Uint8Array(bufferSize);- buffers.forEach(function(chunk) {- array.set(chunk, bufferIndex);- bufferIndex += chunk.length;- });- return array;- };- that.flush = function() {- var err, buffers = [], bufferIndex = 0, bufferSize = 0, array;- do {- z.next_out_index = 0;- z.avail_out = bufsize;- err = z.deflate(Z_FINISH);- if (err != Z_STREAM_END && err != Z_OK)- throw "deflating: " + z.msg;- if (bufsize - z.avail_out > 0)- buffers.push(new Uint8Array(buf.subarray(0, z.next_out_index)));- bufferSize += z.next_out_index;- } while (z.avail_in > 0 || z.avail_out === 0);- z.deflateEnd();- array = new Uint8Array(bufferSize);- buffers.forEach(function(chunk) {- array.set(chunk, bufferIndex);- bufferIndex += chunk.length;- });- return array;- };- };- })(undefined);--- /*- html2canvas 0.5.0-beta3 <http://html2canvas.hertzen.com>- Copyright (c) 2016 Niklas von Hertzen-- Released under License- */-- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.html2canvas=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){- (function (global){- /*! http://mths.be/punycode v1.2.4 by @mathias */- ;(function(root) {-- /** Detect free variables */- var freeExports = typeof exports == 'object' && exports;- var freeModule = typeof module == 'object' && module &&- module.exports == freeExports && module;- var freeGlobal = typeof global == 'object' && global;- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {- root = freeGlobal;- }-- /**- * The `punycode` object.- * @name punycode- * @type Object- */- var punycode,-- /** Highest positive signed 32-bit float value */- maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1-- /** Bootstring parameters */- base = 36,- tMin = 1,- tMax = 26,- skew = 38,- damp = 700,- initialBias = 72,- initialN = 128, // 0x80- delimiter = '-', // '\x2D'-- /** Regular expressions */- regexPunycode = /^xn--/,- regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars- regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators-- /** Error messages */- errors = {- 'overflow': 'Overflow: input needs wider integers to process',- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',- 'invalid-input': 'Invalid input'- },-- /** Convenience shortcuts */- baseMinusTMin = base - tMin,- floor = Math.floor,- stringFromCharCode = String.fromCharCode,-- /** Temporary variable */- key;-- /*--------------------------------------------------------------------------*/-- /**- * A generic error utility function.- * @private- * @param {String} type The error type.- * @returns {Error} Throws a `RangeError` with the applicable error message.- */- function error(type) {- throw RangeError(errors[type]);- }-- /**- * A generic `Array#map` utility function.- * @private- * @param {Array} array The array to iterate over.- * @param {Function} callback The function that gets called for every array- * item.- * @returns {Array} A new array of values returned by the callback function.- */- function map(array, fn) {- var length = array.length;- while (length--) {- array[length] = fn(array[length]);- }- return array;- }-- /**- * A simple `Array#map`-like wrapper to work with domain name strings.- * @private- * @param {String} domain The domain name.- * @param {Function} callback The function that gets called for every- * character.- * @returns {Array} A new string of characters returned by the callback- * function.- */- function mapDomain(string, fn) {- return map(string.split(regexSeparators), fn).join('.');- }-- /**- * Creates an array containing the numeric code points of each Unicode- * character in the string. While JavaScript uses UCS-2 internally,- * this function will convert a pair of surrogate halves (each of which- * UCS-2 exposes as separate characters) into a single code point,- * matching UTF-16.- * @see `punycode.ucs2.encode`- * @see <http://mathiasbynens.be/notes/javascript-encoding>- * @memberOf punycode.ucs2- * @name decode- * @param {String} string The Unicode input string (UCS-2).- * @returns {Array} The new array of code points.- */- function ucs2decode(string) {- var output = [],- counter = 0,- length = string.length,- value,- extra;- while (counter < length) {- value = string.charCodeAt(counter++);- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {- // high surrogate, and there is a next character- extra = string.charCodeAt(counter++);- if ((extra & 0xFC00) == 0xDC00) { // low surrogate- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);- } else {- // unmatched surrogate; only append this code unit, in case the next- // code unit is the high surrogate of a surrogate pair- output.push(value);- counter--;- }- } else {- output.push(value);- }- }- return output;- }-- /**- * Creates a string based on an array of numeric code points.- * @see `punycode.ucs2.decode`- * @memberOf punycode.ucs2- * @name encode- * @param {Array} codePoints The array of numeric code points.- * @returns {String} The new Unicode string (UCS-2).- */- function ucs2encode(array) {- return map(array, function(value) {- var output = '';- if (value > 0xFFFF) {- value -= 0x10000;- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);- value = 0xDC00 | value & 0x3FF;- }- output += stringFromCharCode(value);- return output;- }).join('');- }-- /**- * Converts a basic code point into a digit/integer.- * @see `digitToBasic()`- * @private- * @param {Number} codePoint The basic numeric code point value.- * @returns {Number} The numeric value of a basic code point (for use in- * representing integers) in the range `0` to `base - 1`, or `base` if- * the code point does not represent a value.- */- function basicToDigit(codePoint) {- if (codePoint - 48 < 10) {- return codePoint - 22;- }- if (codePoint - 65 < 26) {- return codePoint - 65;- }- if (codePoint - 97 < 26) {- return codePoint - 97;- }- return base;- }-- /**- * Converts a digit/integer into a basic code point.- * @see `basicToDigit()`- * @private- * @param {Number} digit The numeric value of a basic code point.- * @returns {Number} The basic code point whose value (when used for- * representing integers) is `digit`, which needs to be in the range- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is- * used; else, the lowercase form is used. The behavior is undefined- * if `flag` is non-zero and `digit` has no uppercase form.- */- function digitToBasic(digit, flag) {- // 0..25 map to ASCII a..z or A..Z- // 26..35 map to ASCII 0..9- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);- }-- /**- * Bias adaptation function as per section 3.4 of RFC 3492.- * http://tools.ietf.org/html/rfc3492#section-3.4- * @private- */- function adapt(delta, numPoints, firstTime) {- var k = 0;- delta = firstTime ? floor(delta / damp) : delta >> 1;- delta += floor(delta / numPoints);- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {- delta = floor(delta / baseMinusTMin);- }- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));- }-- /**- * Converts a Punycode string of ASCII-only symbols to a string of Unicode- * symbols.- * @memberOf punycode- * @param {String} input The Punycode string of ASCII-only symbols.- * @returns {String} The resulting string of Unicode symbols.- */- function decode(input) {- // Don't use UCS-2- var output = [],- inputLength = input.length,- out,- i = 0,- n = initialN,- bias = initialBias,- basic,- j,- index,- oldi,- w,- k,- digit,- t,- /** Cached calculation results */- baseMinusT;-- // Handle the basic code points: let `basic` be the number of input code- // points before the last delimiter, or `0` if there is none, then copy- // the first basic code points to the output.-- basic = input.lastIndexOf(delimiter);- if (basic < 0) {- basic = 0;- }-- for (j = 0; j < basic; ++j) {- // if it's not a basic code point- if (input.charCodeAt(j) >= 0x80) {- error('not-basic');- }- output.push(input.charCodeAt(j));- }-- // Main decoding loop: start just after the last delimiter if any basic code- // points were copied; start at the beginning otherwise.-- for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {-- // `index` is the index of the next character to be consumed.- // Decode a generalized variable-length integer into `delta`,- // which gets added to `i`. The overflow checking is easier- // if we increase `i` as we go, then subtract off its starting- // value at the end to obtain `delta`.- for (oldi = i, w = 1, k = base; /* no condition */; k += base) {-- if (index >= inputLength) {- error('invalid-input');- }-- digit = basicToDigit(input.charCodeAt(index++));-- if (digit >= base || digit > floor((maxInt - i) / w)) {- error('overflow');- }-- i += digit * w;- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);-- if (digit < t) {- break;- }-- baseMinusT = base - t;- if (w > floor(maxInt / baseMinusT)) {- error('overflow');- }-- w *= baseMinusT;-- }-- out = output.length + 1;- bias = adapt(i - oldi, out, oldi == 0);-- // `i` was supposed to wrap around from `out` to `0`,- // incrementing `n` each time, so we'll fix that now:- if (floor(i / out) > maxInt - n) {- error('overflow');- }-- n += floor(i / out);- i %= out;-- // Insert `n` at position `i` of the output- output.splice(i++, 0, n);-- }-- return ucs2encode(output);- }-- /**- * Converts a string of Unicode symbols to a Punycode string of ASCII-only- * symbols.- * @memberOf punycode- * @param {String} input The string of Unicode symbols.- * @returns {String} The resulting Punycode string of ASCII-only symbols.- */- function encode(input) {- var n,- delta,- handledCPCount,- basicLength,- bias,- j,- m,- q,- k,- t,- currentValue,- output = [],- /** `inputLength` will hold the number of code points in `input`. */- inputLength,- /** Cached calculation results */- handledCPCountPlusOne,- baseMinusT,- qMinusT;-- // Convert the input in UCS-2 to Unicode- input = ucs2decode(input);-- // Cache the length- inputLength = input.length;-- // Initialize the state- n = initialN;- delta = 0;- bias = initialBias;-- // Handle the basic code points- for (j = 0; j < inputLength; ++j) {- currentValue = input[j];- if (currentValue < 0x80) {- output.push(stringFromCharCode(currentValue));- }- }-- handledCPCount = basicLength = output.length;-- // `handledCPCount` is the number of code points that have been handled;- // `basicLength` is the number of basic code points.-- // Finish the basic string - if it is not empty - with a delimiter- if (basicLength) {- output.push(delimiter);- }-- // Main encoding loop:- while (handledCPCount < inputLength) {-- // All non-basic code points < n have been handled already. Find the next- // larger one:- for (m = maxInt, j = 0; j < inputLength; ++j) {- currentValue = input[j];- if (currentValue >= n && currentValue < m) {- m = currentValue;- }- }-- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,- // but guard against overflow- handledCPCountPlusOne = handledCPCount + 1;- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {- error('overflow');- }-- delta += (m - n) * handledCPCountPlusOne;- n = m;-- for (j = 0; j < inputLength; ++j) {- currentValue = input[j];-- if (currentValue < n && ++delta > maxInt) {- error('overflow');- }-- if (currentValue == n) {- // Represent delta as a generalized variable-length integer- for (q = delta, k = base; /* no condition */; k += base) {- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);- if (q < t) {- break;- }- qMinusT = q - t;- baseMinusT = base - t;- output.push(- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))- );- q = floor(qMinusT / baseMinusT);- }-- output.push(stringFromCharCode(digitToBasic(q, 0)));- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);- delta = 0;- ++handledCPCount;- }- }-- ++delta;- ++n;-- }- return output.join('');- }-- /**- * Converts a Punycode string representing a domain name to Unicode. Only the- * Punycoded parts of the domain name will be converted, i.e. it doesn't- * matter if you call it on a string that has already been converted to- * Unicode.- * @memberOf punycode- * @param {String} domain The Punycode domain name to convert to Unicode.- * @returns {String} The Unicode representation of the given Punycode- * string.- */- function toUnicode(domain) {- return mapDomain(domain, function(string) {- return regexPunycode.test(string)- ? decode(string.slice(4).toLowerCase())- : string;- });- }-- /**- * Converts a Unicode string representing a domain name to Punycode. Only the- * non-ASCII parts of the domain name will be converted, i.e. it doesn't- * matter if you call it with a domain that's already in ASCII.- * @memberOf punycode- * @param {String} domain The domain name to convert, as a Unicode string.- * @returns {String} The Punycode representation of the given domain name.- */- function toASCII(domain) {- return mapDomain(domain, function(string) {- return regexNonASCII.test(string)- ? 'xn--' + encode(string)- : string;- });- }-- /*--------------------------------------------------------------------------*/-- /** Define the public API */- punycode = {- /**- * A string representing the current Punycode.js version number.- * @memberOf punycode- * @type String- */- 'version': '1.2.4',- /**- * An object of methods to convert from JavaScript's internal character- * representation (UCS-2) to Unicode code points, and back.- * @see <http://mathiasbynens.be/notes/javascript-encoding>- * @memberOf punycode- * @type Object- */- 'ucs2': {- 'decode': ucs2decode,- 'encode': ucs2encode- },- 'decode': decode,- 'encode': encode,- 'toASCII': toASCII,- 'toUnicode': toUnicode- };-- /** Expose `punycode` */- // Some AMD build optimizers, like r.js, check for specific condition patterns- // like the following:- if (- typeof define == 'function' &&- typeof define.amd == 'object' &&- define.amd- ) {- define('punycode', function() {- return punycode;- });- } else if (freeExports && !freeExports.nodeType) {- if (freeModule) { // in Node.js or RingoJS v0.8.0+- freeModule.exports = punycode;- } else { // in Narwhal or RingoJS v0.7.0-- for (key in punycode) {- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);- }- }- } else { // in Rhino or a web browser- root.punycode = punycode;- }-- }(this));-- }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})- },{}],2:[function(_dereq_,module,exports){- var log = _dereq_('./log');-- function restoreOwnerScroll(ownerDocument, x, y) {- if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {- ownerDocument.defaultView.scrollTo(x, y);- }- }-- function cloneCanvasContents(canvas, clonedCanvas) {- try {- if (clonedCanvas) {- clonedCanvas.width = canvas.width;- clonedCanvas.height = canvas.height;- clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0);- }- } catch(e) {- log("Unable to copy canvas content from", canvas, e);- }- }-- function cloneNode(node, javascriptEnabled) {- var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);-- var child = node.firstChild;- while(child) {- if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {- clone.appendChild(cloneNode(child, javascriptEnabled));- }- child = child.nextSibling;- }-- if (node.nodeType === 1) {- clone._scrollTop = node.scrollTop;- clone._scrollLeft = node.scrollLeft;- if (node.nodeName === "CANVAS") {- cloneCanvasContents(node, clone);- } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") {- clone.value = node.value;- }- }-- return clone;- }-- function initNode(node) {- if (node.nodeType === 1) {- node.scrollTop = node._scrollTop;- node.scrollLeft = node._scrollLeft;-- var child = node.firstChild;- while(child) {- initNode(child);- child = child.nextSibling;- }- }- }-- module.exports = function(ownerDocument, containerDocument, width, height, options, x ,y) {- var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled);- var container = containerDocument.createElement("iframe");-- container.className = "html2canvas-container";- container.style.visibility = "hidden";- container.style.position = "fixed";- container.style.left = "-10000px";- container.style.top = "0px";- container.style.border = "0";- container.width = width;- container.height = height;- container.scrolling = "no"; // ios won't scroll without it- containerDocument.body.appendChild(container);-- return new Promise(function(resolve) {- var documentClone = container.contentWindow.document;-- /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle- if window url is about:blank, we can assign the url to current by writing onto the document- */- container.contentWindow.onload = container.onload = function() {- var interval = setInterval(function() {- if (documentClone.body.childNodes.length > 0) {- initNode(documentClone.documentElement);- clearInterval(interval);- if (options.type === "view") {- container.contentWindow.scrollTo(x, y);- if ((/(iPad|iPhone|iPod)/g).test(navigator.userAgent) && (container.contentWindow.scrollY !== y || container.contentWindow.scrollX !== x)) {- documentClone.documentElement.style.top = (-y) + "px";- documentClone.documentElement.style.left = (-x) + "px";- documentClone.documentElement.style.position = 'absolute';- }- }- resolve(container);- }- }, 50);- };-- documentClone.open();- documentClone.write("<!DOCTYPE html><html></html>");- // Chrome scrolls the parent document for some reason after the write to the cloned window???- restoreOwnerScroll(ownerDocument, x, y);- documentClone.replaceChild(documentClone.adoptNode(documentElement), documentClone.documentElement);- documentClone.close();- });- };-- },{"./log":13}],3:[function(_dereq_,module,exports){- // http://dev.w3.org/csswg/css-color/-- function Color(value) {- this.r = 0;- this.g = 0;- this.b = 0;- this.a = null;- var result = this.fromArray(value) ||- this.namedColor(value) ||- this.rgb(value) ||- this.rgba(value) ||- this.hex6(value) ||- this.hex3(value);- }-- Color.prototype.darken = function(amount) {- var a = 1 - amount;- return new Color([- Math.round(this.r * a),- Math.round(this.g * a),- Math.round(this.b * a),- this.a- ]);- };-- Color.prototype.isTransparent = function() {- return this.a === 0;- };-- Color.prototype.isBlack = function() {- return this.r === 0 && this.g === 0 && this.b === 0;- };-- Color.prototype.fromArray = function(array) {- if (Array.isArray(array)) {- this.r = Math.min(array[0], 255);- this.g = Math.min(array[1], 255);- this.b = Math.min(array[2], 255);- if (array.length > 3) {- this.a = array[3];- }- }-- return (Array.isArray(array));- };-- var _hex3 = /^#([a-f0-9]{3})$/i;-- Color.prototype.hex3 = function(value) {- var match = null;- if ((match = value.match(_hex3)) !== null) {- this.r = parseInt(match[1][0] + match[1][0], 16);- this.g = parseInt(match[1][1] + match[1][1], 16);- this.b = parseInt(match[1][2] + match[1][2], 16);- }- return match !== null;- };-- var _hex6 = /^#([a-f0-9]{6})$/i;-- Color.prototype.hex6 = function(value) {- var match = null;- if ((match = value.match(_hex6)) !== null) {- this.r = parseInt(match[1].substring(0, 2), 16);- this.g = parseInt(match[1].substring(2, 4), 16);- this.b = parseInt(match[1].substring(4, 6), 16);- }- return match !== null;- };--- var _rgb = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;-- Color.prototype.rgb = function(value) {- var match = null;- if ((match = value.match(_rgb)) !== null) {- this.r = Number(match[1]);- this.g = Number(match[2]);- this.b = Number(match[3]);- }- return match !== null;- };-- var _rgba = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;-- Color.prototype.rgba = function(value) {- var match = null;- if ((match = value.match(_rgba)) !== null) {- this.r = Number(match[1]);- this.g = Number(match[2]);- this.b = Number(match[3]);- this.a = Number(match[4]);- }- return match !== null;- };-- Color.prototype.toString = function() {- return this.a !== null && this.a !== 1 ?- "rgba(" + [this.r, this.g, this.b, this.a].join(",") + ")" :- "rgb(" + [this.r, this.g, this.b].join(",") + ")";- };-- Color.prototype.namedColor = function(value) {- value = value.toLowerCase();- var color = colors[value];- if (color) {- this.r = color[0];- this.g = color[1];- this.b = color[2];- } else if (value === "transparent") {- this.r = this.g = this.b = this.a = 0;- return true;- }-- return !!color;- };-- Color.prototype.isColor = true;-- // JSON.stringify([].slice.call($$('.named-color-table tr'), 1).map(function(row) { return [row.childNodes[3].textContent, row.childNodes[5].textContent.trim().split(",").map(Number)] }).reduce(function(data, row) {data[row[0]] = row[1]; return data}, {}))- var colors = {- "aliceblue": [240, 248, 255],- "antiquewhite": [250, 235, 215],- "aqua": [0, 255, 255],- "aquamarine": [127, 255, 212],- "azure": [240, 255, 255],- "beige": [245, 245, 220],- "bisque": [255, 228, 196],- "black": [0, 0, 0],- "blanchedalmond": [255, 235, 205],- "blue": [0, 0, 255],- "blueviolet": [138, 43, 226],- "brown": [165, 42, 42],- "burlywood": [222, 184, 135],- "cadetblue": [95, 158, 160],- "chartreuse": [127, 255, 0],- "chocolate": [210, 105, 30],- "coral": [255, 127, 80],- "cornflowerblue": [100, 149, 237],- "cornsilk": [255, 248, 220],- "crimson": [220, 20, 60],- "cyan": [0, 255, 255],- "darkblue": [0, 0, 139],- "darkcyan": [0, 139, 139],- "darkgoldenrod": [184, 134, 11],- "darkgray": [169, 169, 169],- "darkgreen": [0, 100, 0],- "darkgrey": [169, 169, 169],- "darkkhaki": [189, 183, 107],- "darkmagenta": [139, 0, 139],- "darkolivegreen": [85, 107, 47],- "darkorange": [255, 140, 0],- "darkorchid": [153, 50, 204],- "darkred": [139, 0, 0],- "darksalmon": [233, 150, 122],- "darkseagreen": [143, 188, 143],- "darkslateblue": [72, 61, 139],- "darkslategray": [47, 79, 79],- "darkslategrey": [47, 79, 79],- "darkturquoise": [0, 206, 209],- "darkviolet": [148, 0, 211],- "deeppink": [255, 20, 147],- "deepskyblue": [0, 191, 255],- "dimgray": [105, 105, 105],- "dimgrey": [105, 105, 105],- "dodgerblue": [30, 144, 255],- "firebrick": [178, 34, 34],- "floralwhite": [255, 250, 240],- "forestgreen": [34, 139, 34],- "fuchsia": [255, 0, 255],- "gainsboro": [220, 220, 220],- "ghostwhite": [248, 248, 255],- "gold": [255, 215, 0],- "goldenrod": [218, 165, 32],- "gray": [128, 128, 128],- "green": [0, 128, 0],- "greenyellow": [173, 255, 47],- "grey": [128, 128, 128],- "honeydew": [240, 255, 240],- "hotpink": [255, 105, 180],- "indianred": [205, 92, 92],- "indigo": [75, 0, 130],- "ivory": [255, 255, 240],- "khaki": [240, 230, 140],- "lavender": [230, 230, 250],- "lavenderblush": [255, 240, 245],- "lawngreen": [124, 252, 0],- "lemonchiffon": [255, 250, 205],- "lightblue": [173, 216, 230],- "lightcoral": [240, 128, 128],- "lightcyan": [224, 255, 255],- "lightgoldenrodyellow": [250, 250, 210],- "lightgray": [211, 211, 211],- "lightgreen": [144, 238, 144],- "lightgrey": [211, 211, 211],- "lightpink": [255, 182, 193],- "lightsalmon": [255, 160, 122],- "lightseagreen": [32, 178, 170],- "lightskyblue": [135, 206, 250],- "lightslategray": [119, 136, 153],- "lightslategrey": [119, 136, 153],- "lightsteelblue": [176, 196, 222],- "lightyellow": [255, 255, 224],- "lime": [0, 255, 0],- "limegreen": [50, 205, 50],- "linen": [250, 240, 230],- "magenta": [255, 0, 255],- "maroon": [128, 0, 0],- "mediumaquamarine": [102, 205, 170],- "mediumblue": [0, 0, 205],- "mediumorchid": [186, 85, 211],- "mediumpurple": [147, 112, 219],- "mediumseagreen": [60, 179, 113],- "mediumslateblue": [123, 104, 238],- "mediumspringgreen": [0, 250, 154],- "mediumturquoise": [72, 209, 204],- "mediumvioletred": [199, 21, 133],- "midnightblue": [25, 25, 112],- "mintcream": [245, 255, 250],- "mistyrose": [255, 228, 225],- "moccasin": [255, 228, 181],- "navajowhite": [255, 222, 173],- "navy": [0, 0, 128],- "oldlace": [253, 245, 230],- "olive": [128, 128, 0],- "olivedrab": [107, 142, 35],- "orange": [255, 165, 0],- "orangered": [255, 69, 0],- "orchid": [218, 112, 214],- "palegoldenrod": [238, 232, 170],- "palegreen": [152, 251, 152],- "paleturquoise": [175, 238, 238],- "palevioletred": [219, 112, 147],- "papayawhip": [255, 239, 213],- "peachpuff": [255, 218, 185],- "peru": [205, 133, 63],- "pink": [255, 192, 203],- "plum": [221, 160, 221],- "powderblue": [176, 224, 230],- "purple": [128, 0, 128],- "rebeccapurple": [102, 51, 153],- "red": [255, 0, 0],- "rosybrown": [188, 143, 143],- "royalblue": [65, 105, 225],- "saddlebrown": [139, 69, 19],- "salmon": [250, 128, 114],- "sandybrown": [244, 164, 96],- "seagreen": [46, 139, 87],- "seashell": [255, 245, 238],- "sienna": [160, 82, 45],- "silver": [192, 192, 192],- "skyblue": [135, 206, 235],- "slateblue": [106, 90, 205],- "slategray": [112, 128, 144],- "slategrey": [112, 128, 144],- "snow": [255, 250, 250],- "springgreen": [0, 255, 127],- "steelblue": [70, 130, 180],- "tan": [210, 180, 140],- "teal": [0, 128, 128],- "thistle": [216, 191, 216],- "tomato": [255, 99, 71],- "turquoise": [64, 224, 208],- "violet": [238, 130, 238],- "wheat": [245, 222, 179],- "white": [255, 255, 255],- "whitesmoke": [245, 245, 245],- "yellow": [255, 255, 0],- "yellowgreen": [154, 205, 50]- };-- module.exports = Color;-- },{}],4:[function(_dereq_,module,exports){- var Support = _dereq_('./support');- var CanvasRenderer = _dereq_('./renderers/canvas');- var ImageLoader = _dereq_('./imageloader');- var NodeParser = _dereq_('./nodeparser');- var NodeContainer = _dereq_('./nodecontainer');- var log = _dereq_('./log');- var utils = _dereq_('./utils');- var createWindowClone = _dereq_('./clone');- var loadUrlDocument = _dereq_('./proxy').loadUrlDocument;- var getBounds = utils.getBounds;-- var html2canvasNodeAttribute = "data-html2canvas-node";- var html2canvasCloneIndex = 0;-- function html2canvas(nodeList, options) {- var index = html2canvasCloneIndex++;- options = options || {};- if (options.logging) {- log.options.logging = true;- log.options.start = Date.now();- }-- options.async = typeof(options.async) === "undefined" ? true : options.async;- options.allowTaint = typeof(options.allowTaint) === "undefined" ? false : options.allowTaint;- options.removeContainer = typeof(options.removeContainer) === "undefined" ? true : options.removeContainer;- options.javascriptEnabled = typeof(options.javascriptEnabled) === "undefined" ? false : options.javascriptEnabled;- options.imageTimeout = typeof(options.imageTimeout) === "undefined" ? 10000 : options.imageTimeout;- options.renderer = typeof(options.renderer) === "function" ? options.renderer : CanvasRenderer;- options.strict = !!options.strict;-- if (typeof(nodeList) === "string") {- if (typeof(options.proxy) !== "string") {- return Promise.reject("Proxy must be used when rendering url");- }- var width = options.width != null ? options.width : window.innerWidth;- var height = options.height != null ? options.height : window.innerHeight;- return loadUrlDocument(absoluteUrl(nodeList), options.proxy, document, width, height, options).then(function(container) {- return renderWindow(container.contentWindow.document.documentElement, container, options, width, height);- });- }-- var node = ((nodeList === undefined) ? [document.documentElement] : ((nodeList.length) ? nodeList : [nodeList]))[0];- node.setAttribute(html2canvasNodeAttribute + index, index);- return renderDocument(node.ownerDocument, options, node.ownerDocument.defaultView.innerWidth, node.ownerDocument.defaultView.innerHeight, index).then(function(canvas) {- if (typeof(options.onrendered) === "function") {- log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas");- options.onrendered(canvas);- }- return canvas;- });- }-- html2canvas.CanvasRenderer = CanvasRenderer;- html2canvas.NodeContainer = NodeContainer;- html2canvas.log = log;- html2canvas.utils = utils;-- var html2canvasExport = (typeof(document) === "undefined" || typeof(Object.create) !== "function" || typeof(document.createElement("canvas").getContext) !== "function") ? function() {- return Promise.reject("No canvas support");- } : html2canvas;-- module.exports = html2canvasExport;-- if (typeof(define) === 'function' && define.amd) {- define('html2canvas', [], function() {- return html2canvasExport;- });- }-- function renderDocument(document, options, windowWidth, windowHeight, html2canvasIndex) {- return createWindowClone(document, document, windowWidth, windowHeight, options, document.defaultView.pageXOffset, document.defaultView.pageYOffset).then(function(container) {- log("Document cloned");- var attributeName = html2canvasNodeAttribute + html2canvasIndex;- var selector = "[" + attributeName + "='" + html2canvasIndex + "']";- document.querySelector(selector).removeAttribute(attributeName);- var clonedWindow = container.contentWindow;- var node = clonedWindow.document.querySelector(selector);- var oncloneHandler = (typeof(options.onclone) === "function") ? Promise.resolve(options.onclone(clonedWindow.document)) : Promise.resolve(true);- return oncloneHandler.then(function() {- return renderWindow(node, container, options, windowWidth, windowHeight);- });- });- }-- function renderWindow(node, container, options, windowWidth, windowHeight) {- var clonedWindow = container.contentWindow;- var support = new Support(clonedWindow.document);- var imageLoader = new ImageLoader(options, support);- var bounds = getBounds(node);- var width = options.type === "view" ? windowWidth : documentWidth(clonedWindow.document);- var height = options.type === "view" ? windowHeight : documentHeight(clonedWindow.document);- var renderer = new options.renderer(width, height, imageLoader, options, document);- var parser = new NodeParser(node, renderer, support, imageLoader, options);- return parser.ready.then(function() {- log("Finished rendering");- var canvas;-- if (options.type === "view") {- canvas = crop(renderer.canvas, {width: renderer.canvas.width, height: renderer.canvas.height, top: 0, left: 0, x: 0, y: 0});- } else if (node === clonedWindow.document.body || node === clonedWindow.document.documentElement || options.canvas != null) {- canvas = renderer.canvas;- } else {- canvas = crop(renderer.canvas, {width: options.width != null ? options.width : bounds.width, height: options.height != null ? options.height : bounds.height, top: bounds.top, left: bounds.left, x: 0, y: 0});- }-- cleanupContainer(container, options);- return canvas;- });- }-- function cleanupContainer(container, options) {- if (options.removeContainer) {- container.parentNode.removeChild(container);- log("Cleaned up container");- }- }-- function crop(canvas, bounds) {- var croppedCanvas = document.createElement("canvas");- var x1 = Math.min(canvas.width - 1, Math.max(0, bounds.left));- var x2 = Math.min(canvas.width, Math.max(1, bounds.left + bounds.width));- var y1 = Math.min(canvas.height - 1, Math.max(0, bounds.top));- var y2 = Math.min(canvas.height, Math.max(1, bounds.top + bounds.height));- croppedCanvas.width = bounds.width;- croppedCanvas.height = bounds.height;- var width = x2-x1;- var height = y2-y1;- log("Cropping canvas at:", "left:", bounds.left, "top:", bounds.top, "width:", width, "height:", height);- log("Resulting crop with width", bounds.width, "and height", bounds.height, "with x", x1, "and y", y1);- croppedCanvas.getContext("2d").drawImage(canvas, x1, y1, width, height, bounds.x, bounds.y, width, height);- return croppedCanvas;- }-- function documentWidth (doc) {- return Math.max(- Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth),- Math.max(doc.body.offsetWidth, doc.documentElement.offsetWidth),- Math.max(doc.body.clientWidth, doc.documentElement.clientWidth)- );- }-- function documentHeight (doc) {- return Math.max(- Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight),- Math.max(doc.body.offsetHeight, doc.documentElement.offsetHeight),- Math.max(doc.body.clientHeight, doc.documentElement.clientHeight)- );- }-- function absoluteUrl(url) {- var link = document.createElement("a");- link.href = url;- link.href = link.href;- return link;- }-- },{"./clone":2,"./imageloader":11,"./log":13,"./nodecontainer":14,"./nodeparser":15,"./proxy":16,"./renderers/canvas":20,"./support":22,"./utils":26}],5:[function(_dereq_,module,exports){- var log = _dereq_('./log');- var smallImage = _dereq_('./utils').smallImage;-- function DummyImageContainer(src) {- this.src = src;- log("DummyImageContainer for", src);- if (!this.promise || !this.image) {- log("Initiating DummyImageContainer");- DummyImageContainer.prototype.image = new Image();- var image = this.image;- DummyImageContainer.prototype.promise = new Promise(function(resolve, reject) {- image.onload = resolve;- image.onerror = reject;- image.src = smallImage();- if (image.complete === true) {- resolve(image);- }- });- }- }-- module.exports = DummyImageContainer;-- },{"./log":13,"./utils":26}],6:[function(_dereq_,module,exports){- var smallImage = _dereq_('./utils').smallImage;-- function Font(family, size) {- var container = document.createElement('div'),- img = document.createElement('img'),- span = document.createElement('span'),- sampleText = 'Hidden Text',- baseline,- middle;-- container.style.visibility = "hidden";- container.style.fontFamily = family;- container.style.fontSize = size;- container.style.margin = 0;- container.style.padding = 0;-- document.body.appendChild(container);-- img.src = smallImage();- img.width = 1;- img.height = 1;-- img.style.margin = 0;- img.style.padding = 0;- img.style.verticalAlign = "baseline";-- span.style.fontFamily = family;- span.style.fontSize = size;- span.style.margin = 0;- span.style.padding = 0;-- span.appendChild(document.createTextNode(sampleText));- container.appendChild(span);- container.appendChild(img);- baseline = (img.offsetTop - span.offsetTop) + 1;-- container.removeChild(span);- container.appendChild(document.createTextNode(sampleText));-- container.style.lineHeight = "normal";- img.style.verticalAlign = "super";-- middle = (img.offsetTop-container.offsetTop) + 1;-- document.body.removeChild(container);-- this.baseline = baseline;- this.lineWidth = 1;- this.middle = middle;- }-- module.exports = Font;-- },{"./utils":26}],7:[function(_dereq_,module,exports){- var Font = _dereq_('./font');-- function FontMetrics() {- this.data = {};- }-- FontMetrics.prototype.getMetrics = function(family, size) {- if (this.data[family + "-" + size] === undefined) {- this.data[family + "-" + size] = new Font(family, size);- }- return this.data[family + "-" + size];- };-- module.exports = FontMetrics;-- },{"./font":6}],8:[function(_dereq_,module,exports){- var utils = _dereq_('./utils');- var getBounds = utils.getBounds;- var loadUrlDocument = _dereq_('./proxy').loadUrlDocument;-- function FrameContainer(container, sameOrigin, options) {- this.image = null;- this.src = container;- var self = this;- var bounds = getBounds(container);- this.promise = (!sameOrigin ? this.proxyLoad(options.proxy, bounds, options) : new Promise(function(resolve) {- if (container.contentWindow.document.URL === "about:blank" || container.contentWindow.document.documentElement == null) {- container.contentWindow.onload = container.onload = function() {- resolve(container);- };- } else {- resolve(container);- }- })).then(function(container) {- var html2canvas = _dereq_('./core');- return html2canvas(container.contentWindow.document.documentElement, {type: 'view', width: container.width, height: container.height, proxy: options.proxy, javascriptEnabled: options.javascriptEnabled, removeContainer: options.removeContainer, allowTaint: options.allowTaint, imageTimeout: options.imageTimeout / 2});- }).then(function(canvas) {- return self.image = canvas;- });- }-- FrameContainer.prototype.proxyLoad = function(proxy, bounds, options) {- var container = this.src;- return loadUrlDocument(container.src, proxy, container.ownerDocument, bounds.width, bounds.height, options);- };-- module.exports = FrameContainer;-- },{"./core":4,"./proxy":16,"./utils":26}],9:[function(_dereq_,module,exports){- function GradientContainer(imageData) {- this.src = imageData.value;- this.colorStops = [];- this.type = null;- this.x0 = 0.5;- this.y0 = 0.5;- this.x1 = 0.5;- this.y1 = 0.5;- this.promise = Promise.resolve(true);- }-- GradientContainer.TYPES = {- LINEAR: 1,- RADIAL: 2- };-- // TODO: support hsl[a], negative %/length values- // TODO: support <angle> (e.g. -?\d{1,3}(?:\.\d+)deg, etc. : https://developer.mozilla.org/docs/Web/CSS/angle )- GradientContainer.REGEXP_COLORSTOP = /^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i;-- module.exports = GradientContainer;-- },{}],10:[function(_dereq_,module,exports){- function ImageContainer(src, cors) {- this.src = src;- this.image = new Image();- var self = this;- this.tainted = null;- this.promise = new Promise(function(resolve, reject) {- self.image.onload = resolve;- self.image.onerror = reject;- if (cors) {- self.image.crossOrigin = "anonymous";- }- self.image.src = src;- if (self.image.complete === true) {- resolve(self.image);- }- });- }-- module.exports = ImageContainer;-- },{}],11:[function(_dereq_,module,exports){- var log = _dereq_('./log');- var ImageContainer = _dereq_('./imagecontainer');- var DummyImageContainer = _dereq_('./dummyimagecontainer');- var ProxyImageContainer = _dereq_('./proxyimagecontainer');- var FrameContainer = _dereq_('./framecontainer');- var SVGContainer = _dereq_('./svgcontainer');- var SVGNodeContainer = _dereq_('./svgnodecontainer');- var LinearGradientContainer = _dereq_('./lineargradientcontainer');- var WebkitGradientContainer = _dereq_('./webkitgradientcontainer');- var bind = _dereq_('./utils').bind;-- function ImageLoader(options, support) {- this.link = null;- this.options = options;- this.support = support;- this.origin = this.getOrigin(window.location.href);- }-- ImageLoader.prototype.findImages = function(nodes) {- var images = [];- nodes.reduce(function(imageNodes, container) {- switch(container.node.nodeName) {- case "IMG":- return imageNodes.concat([{- args: [container.node.src],- method: "url"- }]);- case "svg":- case "IFRAME":- return imageNodes.concat([{- args: [container.node],- method: container.node.nodeName- }]);- }- return imageNodes;- }, []).forEach(this.addImage(images, this.loadImage), this);- return images;- };-- ImageLoader.prototype.findBackgroundImage = function(images, container) {- container.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(images, this.loadImage), this);- return images;- };-- ImageLoader.prototype.addImage = function(images, callback) {- return function(newImage) {- newImage.args.forEach(function(image) {- if (!this.imageExists(images, image)) {- images.splice(0, 0, callback.call(this, newImage));- log('Added image #' + (images.length), typeof(image) === "string" ? image.substring(0, 100) : image);- }- }, this);- };- };-- ImageLoader.prototype.hasImageBackground = function(imageData) {- return imageData.method !== "none";- };-- ImageLoader.prototype.loadImage = function(imageData) {- if (imageData.method === "url") {- var src = imageData.args[0];- if (this.isSVG(src) && !this.support.svg && !this.options.allowTaint) {- return new SVGContainer(src);- } else if (src.match(/data:image\/.*;base64,/i)) {- return new ImageContainer(src.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ''), false);- } else if (this.isSameOrigin(src) || this.options.allowTaint === true || this.isSVG(src)) {- return new ImageContainer(src, false);- } else if (this.support.cors && !this.options.allowTaint && this.options.useCORS) {- return new ImageContainer(src, true);- } else if (this.options.proxy) {- return new ProxyImageContainer(src, this.options.proxy);- } else {- return new DummyImageContainer(src);- }- } else if (imageData.method === "linear-gradient") {- return new LinearGradientContainer(imageData);- } else if (imageData.method === "gradient") {- return new WebkitGradientContainer(imageData);- } else if (imageData.method === "svg") {- return new SVGNodeContainer(imageData.args[0], this.support.svg);- } else if (imageData.method === "IFRAME") {- return new FrameContainer(imageData.args[0], this.isSameOrigin(imageData.args[0].src), this.options);- } else {- return new DummyImageContainer(imageData);- }- };-- ImageLoader.prototype.isSVG = function(src) {- return src.substring(src.length - 3).toLowerCase() === "svg" || SVGContainer.prototype.isInline(src);- };-- ImageLoader.prototype.imageExists = function(images, src) {- return images.some(function(image) {- return image.src === src;- });- };-- ImageLoader.prototype.isSameOrigin = function(url) {- return (this.getOrigin(url) === this.origin);- };-- ImageLoader.prototype.getOrigin = function(url) {- var link = this.link || (this.link = document.createElement("a"));- link.href = url;- link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/- return link.protocol + link.hostname + link.port;- };-- ImageLoader.prototype.getPromise = function(container) {- return this.timeout(container, this.options.imageTimeout)['catch'](function() {- var dummy = new DummyImageContainer(container.src);- return dummy.promise.then(function(image) {- container.image = image;- });- });- };-- ImageLoader.prototype.get = function(src) {- var found = null;- return this.images.some(function(img) {- return (found = img).src === src;- }) ? found : null;- };-- ImageLoader.prototype.fetch = function(nodes) {- this.images = nodes.reduce(bind(this.findBackgroundImage, this), this.findImages(nodes));- this.images.forEach(function(image, index) {- image.promise.then(function() {- log("Succesfully loaded image #"+ (index+1), image);- }, function(e) {- log("Failed loading image #"+ (index+1), image, e);- });- });- this.ready = Promise.all(this.images.map(this.getPromise, this));- log("Finished searching images");- return this;- };-- ImageLoader.prototype.timeout = function(container, timeout) {- var timer;- var promise = Promise.race([container.promise, new Promise(function(res, reject) {- timer = setTimeout(function() {- log("Timed out loading image", container);- reject(container);- }, timeout);- })]).then(function(container) {- clearTimeout(timer);- return container;- });- promise['catch'](function() {- clearTimeout(timer);- });- return promise;- };-- module.exports = ImageLoader;-- },{"./dummyimagecontainer":5,"./framecontainer":8,"./imagecontainer":10,"./lineargradientcontainer":12,"./log":13,"./proxyimagecontainer":17,"./svgcontainer":23,"./svgnodecontainer":24,"./utils":26,"./webkitgradientcontainer":27}],12:[function(_dereq_,module,exports){- var GradientContainer = _dereq_('./gradientcontainer');- var Color = _dereq_('./color');-- function LinearGradientContainer(imageData) {- GradientContainer.apply(this, arguments);- this.type = GradientContainer.TYPES.LINEAR;-- var hasDirection = LinearGradientContainer.REGEXP_DIRECTION.test( imageData.args[0] ) ||- !GradientContainer.REGEXP_COLORSTOP.test( imageData.args[0] );-- if (hasDirection) {- imageData.args[0].split(/\s+/).reverse().forEach(function(position, index) {- switch(position) {- case "left":- this.x0 = 0;- this.x1 = 1;- break;- case "top":- this.y0 = 0;- this.y1 = 1;- break;- case "right":- this.x0 = 1;- this.x1 = 0;- break;- case "bottom":- this.y0 = 1;- this.y1 = 0;- break;- case "to":- var y0 = this.y0;- var x0 = this.x0;- this.y0 = this.y1;- this.x0 = this.x1;- this.x1 = x0;- this.y1 = y0;- break;- case "center":- break; // centered by default- // Firefox internally converts position keywords to percentages:- // http://www.w3.org/TR/2010/WD-CSS2-20101207/colors.html#propdef-background-position- default: // percentage or absolute length- // TODO: support absolute start point positions (e.g., use bounds to convert px to a ratio)- var ratio = parseFloat(position, 10) * 1e-2;- if (isNaN(ratio)) { // invalid or unhandled value- break;- }- if (index === 0) {- this.y0 = ratio;- this.y1 = 1 - this.y0;- } else {- this.x0 = ratio;- this.x1 = 1 - this.x0;- }- break;- }- }, this);- } else {- this.y0 = 0;- this.y1 = 1;- }-- this.colorStops = imageData.args.slice(hasDirection ? 1 : 0).map(function(colorStop) {- var colorStopMatch = colorStop.match(GradientContainer.REGEXP_COLORSTOP);- var value = +colorStopMatch[2];- var unit = value === 0 ? "%" : colorStopMatch[3]; // treat "0" as "0%"- return {- color: new Color(colorStopMatch[1]),- // TODO: support absolute stop positions (e.g., compute gradient line length & convert px to ratio)- stop: unit === "%" ? value / 100 : null- };- });-- if (this.colorStops[0].stop === null) {- this.colorStops[0].stop = 0;- }-- if (this.colorStops[this.colorStops.length - 1].stop === null) {- this.colorStops[this.colorStops.length - 1].stop = 1;- }-- // calculates and fills-in explicit stop positions when omitted from rule- this.colorStops.forEach(function(colorStop, index) {- if (colorStop.stop === null) {- this.colorStops.slice(index).some(function(find, count) {- if (find.stop !== null) {- colorStop.stop = ((find.stop - this.colorStops[index - 1].stop) / (count + 1)) + this.colorStops[index - 1].stop;- return true;- } else {- return false;- }- }, this);- }- }, this);- }-- LinearGradientContainer.prototype = Object.create(GradientContainer.prototype);-- // TODO: support <angle> (e.g. -?\d{1,3}(?:\.\d+)deg, etc. : https://developer.mozilla.org/docs/Web/CSS/angle )- LinearGradientContainer.REGEXP_DIRECTION = /^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i;-- module.exports = LinearGradientContainer;-- },{"./color":3,"./gradientcontainer":9}],13:[function(_dereq_,module,exports){- var logger = function() {- if (logger.options.logging && window.console && window.console.log) {- Function.prototype.bind.call(window.console.log, (window.console)).apply(window.console, [(Date.now() - logger.options.start) + "ms", "html2canvas:"].concat([].slice.call(arguments, 0)));- }- };-- logger.options = {logging: false};- module.exports = logger;-- },{}],14:[function(_dereq_,module,exports){- var Color = _dereq_('./color');- var utils = _dereq_('./utils');- var getBounds = utils.getBounds;- var parseBackgrounds = utils.parseBackgrounds;- var offsetBounds = utils.offsetBounds;-- function NodeContainer(node, parent) {- this.node = node;- this.parent = parent;- this.stack = null;- this.bounds = null;- this.borders = null;- this.clip = [];- this.backgroundClip = [];- this.offsetBounds = null;- this.visible = null;- this.computedStyles = null;- this.colors = {};- this.styles = {};- this.backgroundImages = null;- this.transformData = null;- this.transformMatrix = null;- this.isPseudoElement = false;- this.opacity = null;- }-- NodeContainer.prototype.cloneTo = function(stack) {- stack.visible = this.visible;- stack.borders = this.borders;- stack.bounds = this.bounds;- stack.clip = this.clip;- stack.backgroundClip = this.backgroundClip;- stack.computedStyles = this.computedStyles;- stack.styles = this.styles;- stack.backgroundImages = this.backgroundImages;- stack.opacity = this.opacity;- };-- NodeContainer.prototype.getOpacity = function() {- return this.opacity === null ? (this.opacity = this.cssFloat('opacity')) : this.opacity;- };-- NodeContainer.prototype.assignStack = function(stack) {- this.stack = stack;- stack.children.push(this);- };-- NodeContainer.prototype.isElementVisible = function() {- return this.node.nodeType === Node.TEXT_NODE ? this.parent.visible : (- this.css('display') !== "none" &&- this.css('visibility') !== "hidden" &&- !this.node.hasAttribute("data-html2canvas-ignore") &&- (this.node.nodeName !== "INPUT" || this.node.getAttribute("type") !== "hidden")- );- };-- NodeContainer.prototype.css = function(attribute) {- if (!this.computedStyles) {- this.computedStyles = this.isPseudoElement ? this.parent.computedStyle(this.before ? ":before" : ":after") : this.computedStyle(null);- }-- return this.styles[attribute] || (this.styles[attribute] = this.computedStyles[attribute]);- };-- NodeContainer.prototype.prefixedCss = function(attribute) {- var prefixes = ["webkit", "moz", "ms", "o"];- var value = this.css(attribute);- if (value === undefined) {- prefixes.some(function(prefix) {- value = this.css(prefix + attribute.substr(0, 1).toUpperCase() + attribute.substr(1));- return value !== undefined;- }, this);- }- return value === undefined ? null : value;- };-- NodeContainer.prototype.computedStyle = function(type) {- return this.node.ownerDocument.defaultView.getComputedStyle(this.node, type);- };-- NodeContainer.prototype.cssInt = function(attribute) {- var value = parseInt(this.css(attribute), 10);- return (isNaN(value)) ? 0 : value; // borders in old IE are throwing 'medium' for demo.html- };-- NodeContainer.prototype.color = function(attribute) {- return this.colors[attribute] || (this.colors[attribute] = new Color(this.css(attribute)));- };-- NodeContainer.prototype.cssFloat = function(attribute) {- var value = parseFloat(this.css(attribute));- return (isNaN(value)) ? 0 : value;- };-- NodeContainer.prototype.fontWeight = function() {- var weight = this.css("fontWeight");- switch(parseInt(weight, 10)){- case 401:- weight = "bold";- break;- case 400:- weight = "normal";- break;- }- return weight;- };-- NodeContainer.prototype.parseClip = function() {- var matches = this.css('clip').match(this.CLIP);- if (matches) {- return {- top: parseInt(matches[1], 10),- right: parseInt(matches[2], 10),- bottom: parseInt(matches[3], 10),- left: parseInt(matches[4], 10)- };- }- return null;- };-- NodeContainer.prototype.parseBackgroundImages = function() {- return this.backgroundImages || (this.backgroundImages = parseBackgrounds(this.css("backgroundImage")));- };-- NodeContainer.prototype.cssList = function(property, index) {- var value = (this.css(property) || '').split(',');- value = value[index || 0] || value[0] || 'auto';- value = value.trim().split(' ');- if (value.length === 1) {- value = [value[0], isPercentage(value[0]) ? 'auto' : value[0]];- }- return value;- };-- NodeContainer.prototype.parseBackgroundSize = function(bounds, image, index) {- var size = this.cssList("backgroundSize", index);- var width, height;-- if (isPercentage(size[0])) {- width = bounds.width * parseFloat(size[0]) / 100;- } else if (/contain|cover/.test(size[0])) {- var targetRatio = bounds.width / bounds.height, currentRatio = image.width / image.height;- return (targetRatio < currentRatio ^ size[0] === 'contain') ? {width: bounds.height * currentRatio, height: bounds.height} : {width: bounds.width, height: bounds.width / currentRatio};- } else {- width = parseInt(size[0], 10);- }-- if (size[0] === 'auto' && size[1] === 'auto') {- height = image.height;- } else if (size[1] === 'auto') {- height = width / image.width * image.height;- } else if (isPercentage(size[1])) {- height = bounds.height * parseFloat(size[1]) / 100;- } else {- height = parseInt(size[1], 10);- }-- if (size[0] === 'auto') {- width = height / image.height * image.width;- }-- return {width: width, height: height};- };-- NodeContainer.prototype.parseBackgroundPosition = function(bounds, image, index, backgroundSize) {- var position = this.cssList('backgroundPosition', index);- var left, top;-- if (isPercentage(position[0])){- left = (bounds.width - (backgroundSize || image).width) * (parseFloat(position[0]) / 100);- } else {- left = parseInt(position[0], 10);- }-- if (position[1] === 'auto') {- top = left / image.width * image.height;- } else if (isPercentage(position[1])){- top = (bounds.height - (backgroundSize || image).height) * parseFloat(position[1]) / 100;- } else {- top = parseInt(position[1], 10);- }-- if (position[0] === 'auto') {- left = top / image.height * image.width;- }-- return {left: left, top: top};- };-- NodeContainer.prototype.parseBackgroundRepeat = function(index) {- return this.cssList("backgroundRepeat", index)[0];- };-- NodeContainer.prototype.parseTextShadows = function() {- var textShadow = this.css("textShadow");- var results = [];-- if (textShadow && textShadow !== 'none') {- var shadows = textShadow.match(this.TEXT_SHADOW_PROPERTY);- for (var i = 0; shadows && (i < shadows.length); i++) {- var s = shadows[i].match(this.TEXT_SHADOW_VALUES);- results.push({- color: new Color(s[0]),- offsetX: s[1] ? parseFloat(s[1].replace('px', '')) : 0,- offsetY: s[2] ? parseFloat(s[2].replace('px', '')) : 0,- blur: s[3] ? s[3].replace('px', '') : 0- });- }- }- return results;- };-- NodeContainer.prototype.parseTransform = function() {- if (!this.transformData) {- if (this.hasTransform()) {- var offset = this.parseBounds();- var origin = this.prefixedCss("transformOrigin").split(" ").map(removePx).map(asFloat);- origin[0] += offset.left;- origin[1] += offset.top;- this.transformData = {- origin: origin,- matrix: this.parseTransformMatrix()- };- } else {- this.transformData = {- origin: [0, 0],- matrix: [1, 0, 0, 1, 0, 0]- };- }- }- return this.transformData;- };-- NodeContainer.prototype.parseTransformMatrix = function() {- if (!this.transformMatrix) {- var transform = this.prefixedCss("transform");- var matrix = transform ? parseMatrix(transform.match(this.MATRIX_PROPERTY)) : null;- this.transformMatrix = matrix ? matrix : [1, 0, 0, 1, 0, 0];- }- return this.transformMatrix;- };-- NodeContainer.prototype.parseBounds = function() {- return this.bounds || (this.bounds = this.hasTransform() ? offsetBounds(this.node) : getBounds(this.node));- };-- NodeContainer.prototype.hasTransform = function() {- return this.parseTransformMatrix().join(",") !== "1,0,0,1,0,0" || (this.parent && this.parent.hasTransform());- };-- NodeContainer.prototype.getValue = function() {- var value = this.node.value || "";- if (this.node.tagName === "SELECT") {- value = selectionValue(this.node);- } else if (this.node.type === "password") {- value = Array(value.length + 1).join('\u2022'); // jshint ignore:line- }- return value.length === 0 ? (this.node.placeholder || "") : value;- };-- NodeContainer.prototype.MATRIX_PROPERTY = /(matrix|matrix3d)\((.+)\)/;- NodeContainer.prototype.TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;- NodeContainer.prototype.TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;- NodeContainer.prototype.CLIP = /^rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)$/;-- function selectionValue(node) {- var option = node.options[node.selectedIndex || 0];- return option ? (option.text || "") : "";- }-- function parseMatrix(match) {- if (match && match[1] === "matrix") {- return match[2].split(",").map(function(s) {- return parseFloat(s.trim());- });- } else if (match && match[1] === "matrix3d") {- var matrix3d = match[2].split(",").map(function(s) {- return parseFloat(s.trim());- });- return [matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13]];- }- }-- function isPercentage(value) {- return value.toString().indexOf("%") !== -1;- }-- function removePx(str) {- return str.replace("px", "");- }-- function asFloat(str) {- return parseFloat(str);- }-- module.exports = NodeContainer;-- },{"./color":3,"./utils":26}],15:[function(_dereq_,module,exports){- var log = _dereq_('./log');- var punycode = _dereq_('punycode');- var NodeContainer = _dereq_('./nodecontainer');- var TextContainer = _dereq_('./textcontainer');- var PseudoElementContainer = _dereq_('./pseudoelementcontainer');- var FontMetrics = _dereq_('./fontmetrics');- var Color = _dereq_('./color');- var StackingContext = _dereq_('./stackingcontext');- var utils = _dereq_('./utils');- var bind = utils.bind;- var getBounds = utils.getBounds;- var parseBackgrounds = utils.parseBackgrounds;- var offsetBounds = utils.offsetBounds;-- function NodeParser(element, renderer, support, imageLoader, options) {- log("Starting NodeParser");- this.renderer = renderer;- this.options = options;- this.range = null;- this.support = support;- this.renderQueue = [];- this.stack = new StackingContext(true, 1, element.ownerDocument, null);- var parent = new NodeContainer(element, null);- if (options.background) {- renderer.rectangle(0, 0, renderer.width, renderer.height, new Color(options.background));- }- if (element === element.ownerDocument.documentElement) {- // http://www.w3.org/TR/css3-background/#special-backgrounds- var canvasBackground = new NodeContainer(parent.color('backgroundColor').isTransparent() ? element.ownerDocument.body : element.ownerDocument.documentElement, null);- renderer.rectangle(0, 0, renderer.width, renderer.height, canvasBackground.color('backgroundColor'));- }- parent.visibile = parent.isElementVisible();- this.createPseudoHideStyles(element.ownerDocument);- this.disableAnimations(element.ownerDocument);- this.nodes = flatten([parent].concat(this.getChildren(parent)).filter(function(container) {- return container.visible = container.isElementVisible();- }).map(this.getPseudoElements, this));- this.fontMetrics = new FontMetrics();- log("Fetched nodes, total:", this.nodes.length);- log("Calculate overflow clips");- this.calculateOverflowClips();- log("Start fetching images");- this.images = imageLoader.fetch(this.nodes.filter(isElement));- this.ready = this.images.ready.then(bind(function() {- log("Images loaded, starting parsing");- log("Creating stacking contexts");- this.createStackingContexts();- log("Sorting stacking contexts");- this.sortStackingContexts(this.stack);- this.parse(this.stack);- log("Render queue created with " + this.renderQueue.length + " items");- return new Promise(bind(function(resolve) {- if (!options.async) {- this.renderQueue.forEach(this.paint, this);- resolve();- } else if (typeof(options.async) === "function") {- options.async.call(this, this.renderQueue, resolve);- } else if (this.renderQueue.length > 0){- this.renderIndex = 0;- this.asyncRenderer(this.renderQueue, resolve);- } else {- resolve();- }- }, this));- }, this));- }-- NodeParser.prototype.calculateOverflowClips = function() {- this.nodes.forEach(function(container) {- if (isElement(container)) {- if (isPseudoElement(container)) {- container.appendToDOM();- }- container.borders = this.parseBorders(container);- var clip = (container.css('overflow') === "hidden") ? [container.borders.clip] : [];- var cssClip = container.parseClip();- if (cssClip && ["absolute", "fixed"].indexOf(container.css('position')) !== -1) {- clip.push([["rect",- container.bounds.left + cssClip.left,- container.bounds.top + cssClip.top,- cssClip.right - cssClip.left,- cssClip.bottom - cssClip.top- ]]);- }- container.clip = hasParentClip(container) ? container.parent.clip.concat(clip) : clip;- container.backgroundClip = (container.css('overflow') !== "hidden") ? container.clip.concat([container.borders.clip]) : container.clip;- if (isPseudoElement(container)) {- container.cleanDOM();- }- } else if (isTextNode(container)) {- container.clip = hasParentClip(container) ? container.parent.clip : [];- }- if (!isPseudoElement(container)) {- container.bounds = null;- }- }, this);- };-- function hasParentClip(container) {- return container.parent && container.parent.clip.length;- }-- NodeParser.prototype.asyncRenderer = function(queue, resolve, asyncTimer) {- asyncTimer = asyncTimer || Date.now();- this.paint(queue[this.renderIndex++]);- if (queue.length === this.renderIndex) {- resolve();- } else if (asyncTimer + 20 > Date.now()) {- this.asyncRenderer(queue, resolve, asyncTimer);- } else {- setTimeout(bind(function() {- this.asyncRenderer(queue, resolve);- }, this), 0);- }- };-- NodeParser.prototype.createPseudoHideStyles = function(document) {- this.createStyles(document, '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +- '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }');- };-- NodeParser.prototype.disableAnimations = function(document) {- this.createStyles(document, '* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; ' +- '-webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}');- };-- NodeParser.prototype.createStyles = function(document, styles) {- var hidePseudoElements = document.createElement('style');- hidePseudoElements.innerHTML = styles;- document.body.appendChild(hidePseudoElements);- };-- NodeParser.prototype.getPseudoElements = function(container) {- var nodes = [[container]];- if (container.node.nodeType === Node.ELEMENT_NODE) {- var before = this.getPseudoElement(container, ":before");- var after = this.getPseudoElement(container, ":after");-- if (before) {- nodes.push(before);- }-- if (after) {- nodes.push(after);- }- }- return flatten(nodes);- };-- function toCamelCase(str) {- return str.replace(/(\-[a-z])/g, function(match){- return match.toUpperCase().replace('-','');- });- }-- NodeParser.prototype.getPseudoElement = function(container, type) {- var style = container.computedStyle(type);- if(!style || !style.content || style.content === "none" || style.content === "-moz-alt-content" || style.display === "none") {- return null;- }-- var content = stripQuotes(style.content);- var isImage = content.substr(0, 3) === 'url';- var pseudoNode = document.createElement(isImage ? 'img' : 'html2canvaspseudoelement');- var pseudoContainer = new PseudoElementContainer(pseudoNode, container, type);-- for (var i = style.length-1; i >= 0; i--) {- var property = toCamelCase(style.item(i));- pseudoNode.style[property] = style[property];- }-- pseudoNode.className = PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER;-- if (isImage) {- pseudoNode.src = parseBackgrounds(content)[0].args[0];- return [pseudoContainer];- } else {- var text = document.createTextNode(content);- pseudoNode.appendChild(text);- return [pseudoContainer, new TextContainer(text, pseudoContainer)];- }- };--- NodeParser.prototype.getChildren = function(parentContainer) {- return flatten([].filter.call(parentContainer.node.childNodes, renderableNode).map(function(node) {- var container = [node.nodeType === Node.TEXT_NODE ? new TextContainer(node, parentContainer) : new NodeContainer(node, parentContainer)].filter(nonIgnoredElement);- return node.nodeType === Node.ELEMENT_NODE && container.length && node.tagName !== "TEXTAREA" ? (container[0].isElementVisible() ? container.concat(this.getChildren(container[0])) : []) : container;- }, this));- };-- NodeParser.prototype.newStackingContext = function(container, hasOwnStacking) {- var stack = new StackingContext(hasOwnStacking, container.getOpacity(), container.node, container.parent);- container.cloneTo(stack);- var parentStack = hasOwnStacking ? stack.getParentStack(this) : stack.parent.stack;- parentStack.contexts.push(stack);- container.stack = stack;- };-- NodeParser.prototype.createStackingContexts = function() {- this.nodes.forEach(function(container) {- if (isElement(container) && (this.isRootElement(container) || hasOpacity(container) || isPositionedForStacking(container) || this.isBodyWithTransparentRoot(container) || container.hasTransform())) {- this.newStackingContext(container, true);- } else if (isElement(container) && ((isPositioned(container) && zIndex0(container)) || isInlineBlock(container) || isFloating(container))) {- this.newStackingContext(container, false);- } else {- container.assignStack(container.parent.stack);- }- }, this);- };-- NodeParser.prototype.isBodyWithTransparentRoot = function(container) {- return container.node.nodeName === "BODY" && container.parent.color('backgroundColor').isTransparent();- };-- NodeParser.prototype.isRootElement = function(container) {- return container.parent === null;- };-- NodeParser.prototype.sortStackingContexts = function(stack) {- stack.contexts.sort(zIndexSort(stack.contexts.slice(0)));- stack.contexts.forEach(this.sortStackingContexts, this);- };-- NodeParser.prototype.parseTextBounds = function(container) {- return function(text, index, textList) {- if (container.parent.css("textDecoration").substr(0, 4) !== "none" || text.trim().length !== 0) {- if (this.support.rangeBounds && !container.parent.hasTransform()) {- var offset = textList.slice(0, index).join("").length;- return this.getRangeBounds(container.node, offset, text.length);- } else if (container.node && typeof(container.node.data) === "string") {- var replacementNode = container.node.splitText(text.length);- var bounds = this.getWrapperBounds(container.node, container.parent.hasTransform());- container.node = replacementNode;- return bounds;- }- } else if(!this.support.rangeBounds || container.parent.hasTransform()){- container.node = container.node.splitText(text.length);- }- return {};- };- };-- NodeParser.prototype.getWrapperBounds = function(node, transform) {- var wrapper = node.ownerDocument.createElement('html2canvaswrapper');- var parent = node.parentNode,- backupText = node.cloneNode(true);-- wrapper.appendChild(node.cloneNode(true));- parent.replaceChild(wrapper, node);- var bounds = transform ? offsetBounds(wrapper) : getBounds(wrapper);- parent.replaceChild(backupText, wrapper);- return bounds;- };-- NodeParser.prototype.getRangeBounds = function(node, offset, length) {- var range = this.range || (this.range = node.ownerDocument.createRange());- range.setStart(node, offset);- range.setEnd(node, offset + length);- return range.getBoundingClientRect();- };-- function ClearTransform() {}-- NodeParser.prototype.parse = function(stack) {- // http://www.w3.org/TR/CSS21/visuren.html#z-index- var negativeZindex = stack.contexts.filter(negativeZIndex); // 2. the child stacking contexts with negative stack levels (most negative first).- var descendantElements = stack.children.filter(isElement);- var descendantNonFloats = descendantElements.filter(not(isFloating));- var nonInlineNonPositionedDescendants = descendantNonFloats.filter(not(isPositioned)).filter(not(inlineLevel)); // 3 the in-flow, non-inline-level, non-positioned descendants.- var nonPositionedFloats = descendantElements.filter(not(isPositioned)).filter(isFloating); // 4. the non-positioned floats.- var inFlow = descendantNonFloats.filter(not(isPositioned)).filter(inlineLevel); // 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.- var stackLevel0 = stack.contexts.concat(descendantNonFloats.filter(isPositioned)).filter(zIndex0); // 6. the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.- var text = stack.children.filter(isTextNode).filter(hasText);- var positiveZindex = stack.contexts.filter(positiveZIndex); // 7. the child stacking contexts with positive stack levels (least positive first).- negativeZindex.concat(nonInlineNonPositionedDescendants).concat(nonPositionedFloats)- .concat(inFlow).concat(stackLevel0).concat(text).concat(positiveZindex).forEach(function(container) {- this.renderQueue.push(container);- if (isStackingContext(container)) {- this.parse(container);- this.renderQueue.push(new ClearTransform());- }- }, this);- };-- NodeParser.prototype.paint = function(container) {- try {- if (container instanceof ClearTransform) {- this.renderer.ctx.restore();- } else if (isTextNode(container)) {- if (isPseudoElement(container.parent)) {- container.parent.appendToDOM();- }- this.paintText(container);- if (isPseudoElement(container.parent)) {- container.parent.cleanDOM();- }- } else {- this.paintNode(container);- }- } catch(e) {- log(e);- if (this.options.strict) {- throw e;- }- }- };-- NodeParser.prototype.paintNode = function(container) {- if (isStackingContext(container)) {- this.renderer.setOpacity(container.opacity);- this.renderer.ctx.save();- if (container.hasTransform()) {- this.renderer.setTransform(container.parseTransform());- }- }-- if (container.node.nodeName === "INPUT" && container.node.type === "checkbox") {- this.paintCheckbox(container);- } else if (container.node.nodeName === "INPUT" && container.node.type === "radio") {- this.paintRadio(container);- } else {- this.paintElement(container);- }- };-- NodeParser.prototype.paintElement = function(container) {- var bounds = container.parseBounds();- this.renderer.clip(container.backgroundClip, function() {- this.renderer.renderBackground(container, bounds, container.borders.borders.map(getWidth));- }, this);-- this.renderer.clip(container.clip, function() {- this.renderer.renderBorders(container.borders.borders);- }, this);-- this.renderer.clip(container.backgroundClip, function() {- switch (container.node.nodeName) {- case "svg":- case "IFRAME":- var imgContainer = this.images.get(container.node);- if (imgContainer) {- this.renderer.renderImage(container, bounds, container.borders, imgContainer);- } else {- log("Error loading <" + container.node.nodeName + ">", container.node);- }- break;- case "IMG":- var imageContainer = this.images.get(container.node.src);- if (imageContainer) {- this.renderer.renderImage(container, bounds, container.borders, imageContainer);- } else {- log("Error loading <img>", container.node.src);- }- break;- case "CANVAS":- this.renderer.renderImage(container, bounds, container.borders, {image: container.node});- break;- case "SELECT":- case "INPUT":- case "TEXTAREA":- this.paintFormValue(container);- break;- }- }, this);- };-- NodeParser.prototype.paintCheckbox = function(container) {- var b = container.parseBounds();-- var size = Math.min(b.width, b.height);- var bounds = {width: size - 1, height: size - 1, top: b.top, left: b.left};- var r = [3, 3];- var radius = [r, r, r, r];- var borders = [1,1,1,1].map(function(w) {- return {color: new Color('#A5A5A5'), width: w};- });-- var borderPoints = calculateCurvePoints(bounds, radius, borders);-- this.renderer.clip(container.backgroundClip, function() {- this.renderer.rectangle(bounds.left + 1, bounds.top + 1, bounds.width - 2, bounds.height - 2, new Color("#DEDEDE"));- this.renderer.renderBorders(calculateBorders(borders, bounds, borderPoints, radius));- if (container.node.checked) {- this.renderer.font(new Color('#424242'), 'normal', 'normal', 'bold', (size - 3) + "px", 'arial');- this.renderer.text("\u2714", bounds.left + size / 6, bounds.top + size - 1);- }- }, this);- };-- NodeParser.prototype.paintRadio = function(container) {- var bounds = container.parseBounds();-- var size = Math.min(bounds.width, bounds.height) - 2;-- this.renderer.clip(container.backgroundClip, function() {- this.renderer.circleStroke(bounds.left + 1, bounds.top + 1, size, new Color('#DEDEDE'), 1, new Color('#A5A5A5'));- if (container.node.checked) {- this.renderer.circle(Math.ceil(bounds.left + size / 4) + 1, Math.ceil(bounds.top + size / 4) + 1, Math.floor(size / 2), new Color('#424242'));- }- }, this);- };-- NodeParser.prototype.paintFormValue = function(container) {- var value = container.getValue();- if (value.length > 0) {- var document = container.node.ownerDocument;- var wrapper = document.createElement('html2canvaswrapper');- var properties = ['lineHeight', 'textAlign', 'fontFamily', 'fontWeight', 'fontSize', 'color',- 'paddingLeft', 'paddingTop', 'paddingRight', 'paddingBottom',- 'width', 'height', 'borderLeftStyle', 'borderTopStyle', 'borderLeftWidth', 'borderTopWidth',- 'boxSizing', 'whiteSpace', 'wordWrap'];-- properties.forEach(function(property) {- try {- wrapper.style[property] = container.css(property);- } catch(e) {- // Older IE has issues with "border"- log("html2canvas: Parse: Exception caught in renderFormValue: " + e.message);- }- });- var bounds = container.parseBounds();- wrapper.style.position = "fixed";- wrapper.style.left = bounds.left + "px";- wrapper.style.top = bounds.top + "px";- wrapper.textContent = value;- document.body.appendChild(wrapper);- this.paintText(new TextContainer(wrapper.firstChild, container));- document.body.removeChild(wrapper);- }- };-- NodeParser.prototype.paintText = function(container) {- container.applyTextTransform();- var characters = punycode.ucs2.decode(container.node.data);- var textList = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function(character) {- return punycode.ucs2.encode([character]);- });-- var weight = container.parent.fontWeight();- var size = container.parent.css('fontSize');- var family = container.parent.css('fontFamily');- var shadows = container.parent.parseTextShadows();-- this.renderer.font(container.parent.color('color'), container.parent.css('fontStyle'), container.parent.css('fontVariant'), weight, size, family);- if (shadows.length) {- // TODO: support multiple text shadows- this.renderer.fontShadow(shadows[0].color, shadows[0].offsetX, shadows[0].offsetY, shadows[0].blur);- } else {- this.renderer.clearShadow();- }-- this.renderer.clip(container.parent.clip, function() {- textList.map(this.parseTextBounds(container), this).forEach(function(bounds, index) {- if (bounds) {- this.renderer.text(textList[index], bounds.left, bounds.bottom);- this.renderTextDecoration(container.parent, bounds, this.fontMetrics.getMetrics(family, size));- }- }, this);- }, this);- };-- NodeParser.prototype.renderTextDecoration = function(container, bounds, metrics) {- switch(container.css("textDecoration").split(" ")[0]) {- case "underline":- // Draws a line at the baseline of the font- // TODO As some browsers display the line as more than 1px if the font-size is big, need to take that into account both in position and size- this.renderer.rectangle(bounds.left, Math.round(bounds.top + metrics.baseline + metrics.lineWidth), bounds.width, 1, container.color("color"));- break;- case "overline":- this.renderer.rectangle(bounds.left, Math.round(bounds.top), bounds.width, 1, container.color("color"));- break;- case "line-through":- // TODO try and find exact position for line-through- this.renderer.rectangle(bounds.left, Math.ceil(bounds.top + metrics.middle + metrics.lineWidth), bounds.width, 1, container.color("color"));- break;- }- };-- var borderColorTransforms = {- inset: [- ["darken", 0.60],- ["darken", 0.10],- ["darken", 0.10],- ["darken", 0.60]- ]- };-- NodeParser.prototype.parseBorders = function(container) {- var nodeBounds = container.parseBounds();- var radius = getBorderRadiusData(container);- var borders = ["Top", "Right", "Bottom", "Left"].map(function(side, index) {- var style = container.css('border' + side + 'Style');- var color = container.color('border' + side + 'Color');- if (style === "inset" && color.isBlack()) {- color = new Color([255, 255, 255, color.a]); // this is wrong, but- }- var colorTransform = borderColorTransforms[style] ? borderColorTransforms[style][index] : null;- return {- width: container.cssInt('border' + side + 'Width'),- color: colorTransform ? color[colorTransform[0]](colorTransform[1]) : color,- args: null- };- });- var borderPoints = calculateCurvePoints(nodeBounds, radius, borders);-- return {- clip: this.parseBackgroundClip(container, borderPoints, borders, radius, nodeBounds),- borders: calculateBorders(borders, nodeBounds, borderPoints, radius)- };- };-- function calculateBorders(borders, nodeBounds, borderPoints, radius) {- return borders.map(function(border, borderSide) {- if (border.width > 0) {- var bx = nodeBounds.left;- var by = nodeBounds.top;- var bw = nodeBounds.width;- var bh = nodeBounds.height - (borders[2].width);-- switch(borderSide) {- case 0:- // top border- bh = borders[0].width;- border.args = drawSide({- c1: [bx, by],- c2: [bx + bw, by],- c3: [bx + bw - borders[1].width, by + bh],- c4: [bx + borders[3].width, by + bh]- }, radius[0], radius[1],- borderPoints.topLeftOuter, borderPoints.topLeftInner, borderPoints.topRightOuter, borderPoints.topRightInner);- break;- case 1:- // right border- bx = nodeBounds.left + nodeBounds.width - (borders[1].width);- bw = borders[1].width;-- border.args = drawSide({- c1: [bx + bw, by],- c2: [bx + bw, by + bh + borders[2].width],- c3: [bx, by + bh],- c4: [bx, by + borders[0].width]- }, radius[1], radius[2],- borderPoints.topRightOuter, borderPoints.topRightInner, borderPoints.bottomRightOuter, borderPoints.bottomRightInner);- break;- case 2:- // bottom border- by = (by + nodeBounds.height) - (borders[2].width);- bh = borders[2].width;- border.args = drawSide({- c1: [bx + bw, by + bh],- c2: [bx, by + bh],- c3: [bx + borders[3].width, by],- c4: [bx + bw - borders[3].width, by]- }, radius[2], radius[3],- borderPoints.bottomRightOuter, borderPoints.bottomRightInner, borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner);- break;- case 3:- // left border- bw = borders[3].width;- border.args = drawSide({- c1: [bx, by + bh + borders[2].width],- c2: [bx, by],- c3: [bx + bw, by + borders[0].width],- c4: [bx + bw, by + bh]- }, radius[3], radius[0],- borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner, borderPoints.topLeftOuter, borderPoints.topLeftInner);- break;- }- }- return border;- });- }-- NodeParser.prototype.parseBackgroundClip = function(container, borderPoints, borders, radius, bounds) {- var backgroundClip = container.css('backgroundClip'),- borderArgs = [];-- switch(backgroundClip) {- case "content-box":- case "padding-box":- parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width);- parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top + borders[0].width);- parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width - borders[1].width, bounds.top + bounds.height - borders[2].width);- parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width, bounds.top + bounds.height - borders[2].width);- break;-- default:- parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftOuter, borderPoints.topRightOuter, bounds.left, bounds.top);- parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightOuter, borderPoints.bottomRightOuter, bounds.left + bounds.width, bounds.top);- parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightOuter, borderPoints.bottomLeftOuter, bounds.left + bounds.width, bounds.top + bounds.height);- parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftOuter, borderPoints.topLeftOuter, bounds.left, bounds.top + bounds.height);- break;- }-- return borderArgs;- };-- function getCurvePoints(x, y, r1, r2) {- var kappa = 4 * ((Math.sqrt(2) - 1) / 3);- var ox = (r1) * kappa, // control point offset horizontal- oy = (r2) * kappa, // control point offset vertical- xm = x + r1, // x-middle- ym = y + r2; // y-middle- return {- topLeft: bezierCurve({x: x, y: ym}, {x: x, y: ym - oy}, {x: xm - ox, y: y}, {x: xm, y: y}),- topRight: bezierCurve({x: x, y: y}, {x: x + ox,y: y}, {x: xm, y: ym - oy}, {x: xm, y: ym}),- bottomRight: bezierCurve({x: xm, y: y}, {x: xm, y: y + oy}, {x: x + ox, y: ym}, {x: x, y: ym}),- bottomLeft: bezierCurve({x: xm, y: ym}, {x: xm - ox, y: ym}, {x: x, y: y + oy}, {x: x, y:y})- };- }-- function calculateCurvePoints(bounds, borderRadius, borders) {- var x = bounds.left,- y = bounds.top,- width = bounds.width,- height = bounds.height,-- tlh = borderRadius[0][0] < width / 2 ? borderRadius[0][0] : width / 2,- tlv = borderRadius[0][1] < height / 2 ? borderRadius[0][1] : height / 2,- trh = borderRadius[1][0] < width / 2 ? borderRadius[1][0] : width / 2,- trv = borderRadius[1][1] < height / 2 ? borderRadius[1][1] : height / 2,- brh = borderRadius[2][0] < width / 2 ? borderRadius[2][0] : width / 2,- brv = borderRadius[2][1] < height / 2 ? borderRadius[2][1] : height / 2,- blh = borderRadius[3][0] < width / 2 ? borderRadius[3][0] : width / 2,- blv = borderRadius[3][1] < height / 2 ? borderRadius[3][1] : height / 2;-- var topWidth = width - trh,- rightHeight = height - brv,- bottomWidth = width - brh,- leftHeight = height - blv;-- return {- topLeftOuter: getCurvePoints(x, y, tlh, tlv).topLeft.subdivide(0.5),- topLeftInner: getCurvePoints(x + borders[3].width, y + borders[0].width, Math.max(0, tlh - borders[3].width), Math.max(0, tlv - borders[0].width)).topLeft.subdivide(0.5),- topRightOuter: getCurvePoints(x + topWidth, y, trh, trv).topRight.subdivide(0.5),- topRightInner: getCurvePoints(x + Math.min(topWidth, width + borders[3].width), y + borders[0].width, (topWidth > width + borders[3].width) ? 0 :trh - borders[3].width, trv - borders[0].width).topRight.subdivide(0.5),- bottomRightOuter: getCurvePoints(x + bottomWidth, y + rightHeight, brh, brv).bottomRight.subdivide(0.5),- bottomRightInner: getCurvePoints(x + Math.min(bottomWidth, width - borders[3].width), y + Math.min(rightHeight, height + borders[0].width), Math.max(0, brh - borders[1].width), brv - borders[2].width).bottomRight.subdivide(0.5),- bottomLeftOuter: getCurvePoints(x, y + leftHeight, blh, blv).bottomLeft.subdivide(0.5),- bottomLeftInner: getCurvePoints(x + borders[3].width, y + leftHeight, Math.max(0, blh - borders[3].width), blv - borders[2].width).bottomLeft.subdivide(0.5)- };- }-- function bezierCurve(start, startControl, endControl, end) {- var lerp = function (a, b, t) {- return {- x: a.x + (b.x - a.x) * t,- y: a.y + (b.y - a.y) * t- };- };-- return {- start: start,- startControl: startControl,- endControl: endControl,- end: end,- subdivide: function(t) {- var ab = lerp(start, startControl, t),- bc = lerp(startControl, endControl, t),- cd = lerp(endControl, end, t),- abbc = lerp(ab, bc, t),- bccd = lerp(bc, cd, t),- dest = lerp(abbc, bccd, t);- return [bezierCurve(start, ab, abbc, dest), bezierCurve(dest, bccd, cd, end)];- },- curveTo: function(borderArgs) {- borderArgs.push(["bezierCurve", startControl.x, startControl.y, endControl.x, endControl.y, end.x, end.y]);- },- curveToReversed: function(borderArgs) {- borderArgs.push(["bezierCurve", endControl.x, endControl.y, startControl.x, startControl.y, start.x, start.y]);- }- };- }-- function drawSide(borderData, radius1, radius2, outer1, inner1, outer2, inner2) {- var borderArgs = [];-- if (radius1[0] > 0 || radius1[1] > 0) {- borderArgs.push(["line", outer1[1].start.x, outer1[1].start.y]);- outer1[1].curveTo(borderArgs);- } else {- borderArgs.push([ "line", borderData.c1[0], borderData.c1[1]]);- }-- if (radius2[0] > 0 || radius2[1] > 0) {- borderArgs.push(["line", outer2[0].start.x, outer2[0].start.y]);- outer2[0].curveTo(borderArgs);- borderArgs.push(["line", inner2[0].end.x, inner2[0].end.y]);- inner2[0].curveToReversed(borderArgs);- } else {- borderArgs.push(["line", borderData.c2[0], borderData.c2[1]]);- borderArgs.push(["line", borderData.c3[0], borderData.c3[1]]);- }-- if (radius1[0] > 0 || radius1[1] > 0) {- borderArgs.push(["line", inner1[1].end.x, inner1[1].end.y]);- inner1[1].curveToReversed(borderArgs);- } else {- borderArgs.push(["line", borderData.c4[0], borderData.c4[1]]);- }-- return borderArgs;- }-- function parseCorner(borderArgs, radius1, radius2, corner1, corner2, x, y) {- if (radius1[0] > 0 || radius1[1] > 0) {- borderArgs.push(["line", corner1[0].start.x, corner1[0].start.y]);- corner1[0].curveTo(borderArgs);- corner1[1].curveTo(borderArgs);- } else {- borderArgs.push(["line", x, y]);- }-- if (radius2[0] > 0 || radius2[1] > 0) {- borderArgs.push(["line", corner2[0].start.x, corner2[0].start.y]);- }- }-- function negativeZIndex(container) {- return container.cssInt("zIndex") < 0;- }-- function positiveZIndex(container) {- return container.cssInt("zIndex") > 0;- }-- function zIndex0(container) {- return container.cssInt("zIndex") === 0;- }-- function inlineLevel(container) {- return ["inline", "inline-block", "inline-table"].indexOf(container.css("display")) !== -1;- }-- function isStackingContext(container) {- return (container instanceof StackingContext);- }-- function hasText(container) {- return container.node.data.trim().length > 0;- }-- function noLetterSpacing(container) {- return (/^(normal|none|0px)$/.test(container.parent.css("letterSpacing")));- }-- function getBorderRadiusData(container) {- return ["TopLeft", "TopRight", "BottomRight", "BottomLeft"].map(function(side) {- var value = container.css('border' + side + 'Radius');- var arr = value.split(" ");- if (arr.length <= 1) {- arr[1] = arr[0];- }- return arr.map(asInt);- });- }-- function renderableNode(node) {- return (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE);- }-- function isPositionedForStacking(container) {- var position = container.css("position");- var zIndex = (["absolute", "relative", "fixed"].indexOf(position) !== -1) ? container.css("zIndex") : "auto";- return zIndex !== "auto";- }-- function isPositioned(container) {- return container.css("position") !== "static";- }-- function isFloating(container) {- return container.css("float") !== "none";- }-- function isInlineBlock(container) {- return ["inline-block", "inline-table"].indexOf(container.css("display")) !== -1;- }-- function not(callback) {- var context = this;- return function() {- return !callback.apply(context, arguments);- };- }-- function isElement(container) {- return container.node.nodeType === Node.ELEMENT_NODE;- }-- function isPseudoElement(container) {- return container.isPseudoElement === true;- }-- function isTextNode(container) {- return container.node.nodeType === Node.TEXT_NODE;- }-- function zIndexSort(contexts) {- return function(a, b) {- return (a.cssInt("zIndex") + (contexts.indexOf(a) / contexts.length)) - (b.cssInt("zIndex") + (contexts.indexOf(b) / contexts.length));- };- }-- function hasOpacity(container) {- return container.getOpacity() < 1;- }-- function asInt(value) {- return parseInt(value, 10);- }-- function getWidth(border) {- return border.width;- }-- function nonIgnoredElement(nodeContainer) {- return (nodeContainer.node.nodeType !== Node.ELEMENT_NODE || ["SCRIPT", "HEAD", "TITLE", "OBJECT", "BR", "OPTION"].indexOf(nodeContainer.node.nodeName) === -1);- }-- function flatten(arrays) {- return [].concat.apply([], arrays);- }-- function stripQuotes(content) {- var first = content.substr(0, 1);- return (first === content.substr(content.length - 1) && first.match(/'|"/)) ? content.substr(1, content.length - 2) : content;- }-- function getWords(characters) {- var words = [], i = 0, onWordBoundary = false, word;- while(characters.length) {- if (isWordBoundary(characters[i]) === onWordBoundary) {- word = characters.splice(0, i);- if (word.length) {- words.push(punycode.ucs2.encode(word));- }- onWordBoundary =! onWordBoundary;- i = 0;- } else {- i++;- }-- if (i >= characters.length) {- word = characters.splice(0, i);- if (word.length) {- words.push(punycode.ucs2.encode(word));- }- }- }- return words;- }-- function isWordBoundary(characterCode) {- return [- 32, // <space>- 13, // \r- 10, // \n- 9, // \t- 45 // -- ].indexOf(characterCode) !== -1;- }-- function hasUnicode(string) {- return (/[^\u0000-\u00ff]/).test(string);- }-- module.exports = NodeParser;-- },{"./color":3,"./fontmetrics":7,"./log":13,"./nodecontainer":14,"./pseudoelementcontainer":18,"./stackingcontext":21,"./textcontainer":25,"./utils":26,"punycode":1}],16:[function(_dereq_,module,exports){- var XHR = _dereq_('./xhr');- var utils = _dereq_('./utils');- var log = _dereq_('./log');- var createWindowClone = _dereq_('./clone');- var decode64 = utils.decode64;-- function Proxy(src, proxyUrl, document) {- var supportsCORS = ('withCredentials' in new XMLHttpRequest());- if (!proxyUrl) {- return Promise.reject("No proxy configured");- }- var callback = createCallback(supportsCORS);- var url = createProxyUrl(proxyUrl, src, callback);-- return supportsCORS ? XHR(url) : (jsonp(document, url, callback).then(function(response) {- return decode64(response.content);- }));- }- var proxyCount = 0;-- function ProxyURL(src, proxyUrl, document) {- var supportsCORSImage = ('crossOrigin' in new Image());- var callback = createCallback(supportsCORSImage);- var url = createProxyUrl(proxyUrl, src, callback);- return (supportsCORSImage ? Promise.resolve(url) : jsonp(document, url, callback).then(function(response) {- return "data:" + response.type + ";base64," + response.content;- }));- }-- function jsonp(document, url, callback) {- return new Promise(function(resolve, reject) {- var s = document.createElement("script");- var cleanup = function() {- delete window.html2canvas.proxy[callback];- document.body.removeChild(s);- };- window.html2canvas.proxy[callback] = function(response) {- cleanup();- resolve(response);- };- s.src = url;- s.onerror = function(e) {- cleanup();- reject(e);- };- document.body.appendChild(s);- });- }-- function createCallback(useCORS) {- return !useCORS ? "html2canvas_" + Date.now() + "_" + (++proxyCount) + "_" + Math.round(Math.random() * 100000) : "";- }-- function createProxyUrl(proxyUrl, src, callback) {- return proxyUrl + "?url=" + encodeURIComponent(src) + (callback.length ? "&callback=html2canvas.proxy." + callback : "");- }-- function documentFromHTML(src) {- return function(html) {- var parser = new DOMParser(), doc;- try {- doc = parser.parseFromString(html, "text/html");- } catch(e) {- log("DOMParser not supported, falling back to createHTMLDocument");- doc = document.implementation.createHTMLDocument("");- try {- doc.open();- doc.write(html);- doc.close();- } catch(ee) {- log("createHTMLDocument write not supported, falling back to document.body.innerHTML");- doc.body.innerHTML = html; // ie9 doesnt support writing to documentElement- }- }-- var b = doc.querySelector("base");- if (!b || !b.href.host) {- var base = doc.createElement("base");- base.href = src;- doc.head.insertBefore(base, doc.head.firstChild);- }-- return doc;- };- }-- function loadUrlDocument(src, proxy, document, width, height, options) {- return new Proxy(src, proxy, window.document).then(documentFromHTML(src)).then(function(doc) {- return createWindowClone(doc, document, width, height, options, 0, 0);- });- }-- exports.Proxy = Proxy;- exports.ProxyURL = ProxyURL;- exports.loadUrlDocument = loadUrlDocument;-- },{"./clone":2,"./log":13,"./utils":26,"./xhr":28}],17:[function(_dereq_,module,exports){- var ProxyURL = _dereq_('./proxy').ProxyURL;-- function ProxyImageContainer(src, proxy) {- var link = document.createElement("a");- link.href = src;- src = link.href;- this.src = src;- this.image = new Image();- var self = this;- this.promise = new Promise(function(resolve, reject) {- self.image.crossOrigin = "Anonymous";- self.image.onload = resolve;- self.image.onerror = reject;-- new ProxyURL(src, proxy, document).then(function(url) {- self.image.src = url;- })['catch'](reject);- });- }-- module.exports = ProxyImageContainer;-- },{"./proxy":16}],18:[function(_dereq_,module,exports){- var NodeContainer = _dereq_('./nodecontainer');-- function PseudoElementContainer(node, parent, type) {- NodeContainer.call(this, node, parent);- this.isPseudoElement = true;- this.before = type === ":before";- }-- PseudoElementContainer.prototype.cloneTo = function(stack) {- PseudoElementContainer.prototype.cloneTo.call(this, stack);- stack.isPseudoElement = true;- stack.before = this.before;- };-- PseudoElementContainer.prototype = Object.create(NodeContainer.prototype);-- PseudoElementContainer.prototype.appendToDOM = function() {- if (this.before) {- this.parent.node.insertBefore(this.node, this.parent.node.firstChild);- } else {- this.parent.node.appendChild(this.node);- }- this.parent.node.className += " " + this.getHideClass();- };-- PseudoElementContainer.prototype.cleanDOM = function() {- this.node.parentNode.removeChild(this.node);- this.parent.node.className = this.parent.node.className.replace(this.getHideClass(), "");- };-- PseudoElementContainer.prototype.getHideClass = function() {- return this["PSEUDO_HIDE_ELEMENT_CLASS_" + (this.before ? "BEFORE" : "AFTER")];- };-- PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = "___html2canvas___pseudoelement_before";- PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER = "___html2canvas___pseudoelement_after";-- module.exports = PseudoElementContainer;-- },{"./nodecontainer":14}],19:[function(_dereq_,module,exports){- var log = _dereq_('./log');-- function Renderer(width, height, images, options, document) {- this.width = width;- this.height = height;- this.images = images;- this.options = options;- this.document = document;- }-- Renderer.prototype.renderImage = function(container, bounds, borderData, imageContainer) {- var paddingLeft = container.cssInt('paddingLeft'),- paddingTop = container.cssInt('paddingTop'),- paddingRight = container.cssInt('paddingRight'),- paddingBottom = container.cssInt('paddingBottom'),- borders = borderData.borders;-- var width = bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight);- var height = bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom);- this.drawImage(- imageContainer,- 0,- 0,- imageContainer.image.width || width,- imageContainer.image.height || height,- bounds.left + paddingLeft + borders[3].width,- bounds.top + paddingTop + borders[0].width,- width,- height- );- };-- Renderer.prototype.renderBackground = function(container, bounds, borderData) {- if (bounds.height > 0 && bounds.width > 0) {- this.renderBackgroundColor(container, bounds);- this.renderBackgroundImage(container, bounds, borderData);- }- };-- Renderer.prototype.renderBackgroundColor = function(container, bounds) {- var color = container.color("backgroundColor");- if (!color.isTransparent()) {- this.rectangle(bounds.left, bounds.top, bounds.width, bounds.height, color);- }- };-- Renderer.prototype.renderBorders = function(borders) {- borders.forEach(this.renderBorder, this);- };-- Renderer.prototype.renderBorder = function(data) {- if (!data.color.isTransparent() && data.args !== null) {- this.drawShape(data.args, data.color);- }- };-- Renderer.prototype.renderBackgroundImage = function(container, bounds, borderData) {- var backgroundImages = container.parseBackgroundImages();- backgroundImages.reverse().forEach(function(backgroundImage, index, arr) {- switch(backgroundImage.method) {- case "url":- var image = this.images.get(backgroundImage.args[0]);- if (image) {- this.renderBackgroundRepeating(container, bounds, image, arr.length - (index+1), borderData);- } else {- log("Error loading background-image", backgroundImage.args[0]);- }- break;- case "linear-gradient":- case "gradient":- var gradientImage = this.images.get(backgroundImage.value);- if (gradientImage) {- this.renderBackgroundGradient(gradientImage, bounds, borderData);- } else {- log("Error loading background-image", backgroundImage.args[0]);- }- break;- case "none":- break;- default:- log("Unknown background-image type", backgroundImage.args[0]);- }- }, this);- };-- Renderer.prototype.renderBackgroundRepeating = function(container, bounds, imageContainer, index, borderData) {- var size = container.parseBackgroundSize(bounds, imageContainer.image, index);- var position = container.parseBackgroundPosition(bounds, imageContainer.image, index, size);- var repeat = container.parseBackgroundRepeat(index);- switch (repeat) {- case "repeat-x":- case "repeat no-repeat":- this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + borderData[3], bounds.top + position.top + borderData[0], 99999, size.height, borderData);- break;- case "repeat-y":- case "no-repeat repeat":- this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + borderData[0], size.width, 99999, borderData);- break;- case "no-repeat":- this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], size.width, size.height, borderData);- break;- default:- this.renderBackgroundRepeat(imageContainer, position, size, {top: bounds.top, left: bounds.left}, borderData[3], borderData[0]);- break;- }- };-- module.exports = Renderer;-- },{"./log":13}],20:[function(_dereq_,module,exports){- var Renderer = _dereq_('../renderer');- var LinearGradientContainer = _dereq_('../lineargradientcontainer');- var log = _dereq_('../log');-- function CanvasRenderer(width, height) {- Renderer.apply(this, arguments);- this.canvas = this.options.canvas || this.document.createElement("canvas");- if (!this.options.canvas) {- this.canvas.width = width;- this.canvas.height = height;- }- this.ctx = this.canvas.getContext("2d");- this.taintCtx = this.document.createElement("canvas").getContext("2d");- this.ctx.textBaseline = "bottom";- this.variables = {};- log("Initialized CanvasRenderer with size", width, "x", height);- }-- CanvasRenderer.prototype = Object.create(Renderer.prototype);-- CanvasRenderer.prototype.setFillStyle = function(fillStyle) {- this.ctx.fillStyle = typeof(fillStyle) === "object" && !!fillStyle.isColor ? fillStyle.toString() : fillStyle;- return this.ctx;- };-- CanvasRenderer.prototype.rectangle = function(left, top, width, height, color) {- this.setFillStyle(color).fillRect(left, top, width, height);- };-- CanvasRenderer.prototype.circle = function(left, top, size, color) {- this.setFillStyle(color);- this.ctx.beginPath();- this.ctx.arc(left + size / 2, top + size / 2, size / 2, 0, Math.PI*2, true);- this.ctx.closePath();- this.ctx.fill();- };-- CanvasRenderer.prototype.circleStroke = function(left, top, size, color, stroke, strokeColor) {- this.circle(left, top, size, color);- this.ctx.strokeStyle = strokeColor.toString();- this.ctx.stroke();- };-- CanvasRenderer.prototype.drawShape = function(shape, color) {- this.shape(shape);- this.setFillStyle(color).fill();- };-- CanvasRenderer.prototype.taints = function(imageContainer) {- if (imageContainer.tainted === null) {- this.taintCtx.drawImage(imageContainer.image, 0, 0);- try {- this.taintCtx.getImageData(0, 0, 1, 1);- imageContainer.tainted = false;- } catch(e) {- this.taintCtx = document.createElement("canvas").getContext("2d");- imageContainer.tainted = true;- }- }-- return imageContainer.tainted;- };-- CanvasRenderer.prototype.drawImage = function(imageContainer, sx, sy, sw, sh, dx, dy, dw, dh) {- if (!this.taints(imageContainer) || this.options.allowTaint) {- this.ctx.drawImage(imageContainer.image, sx, sy, sw, sh, dx, dy, dw, dh);- }- };-- CanvasRenderer.prototype.clip = function(shapes, callback, context) {- this.ctx.save();- shapes.filter(hasEntries).forEach(function(shape) {- this.shape(shape).clip();- }, this);- callback.call(context);- this.ctx.restore();- };-- CanvasRenderer.prototype.shape = function(shape) {- this.ctx.beginPath();- shape.forEach(function(point, index) {- if (point[0] === "rect") {- this.ctx.rect.apply(this.ctx, point.slice(1));- } else {- this.ctx[(index === 0) ? "moveTo" : point[0] + "To" ].apply(this.ctx, point.slice(1));- }- }, this);- this.ctx.closePath();- return this.ctx;- };-- CanvasRenderer.prototype.font = function(color, style, variant, weight, size, family) {- this.setFillStyle(color).font = [style, variant, weight, size, family].join(" ").split(",")[0];- };-- CanvasRenderer.prototype.fontShadow = function(color, offsetX, offsetY, blur) {- this.setVariable("shadowColor", color.toString())- .setVariable("shadowOffsetY", offsetX)- .setVariable("shadowOffsetX", offsetY)- .setVariable("shadowBlur", blur);- };-- CanvasRenderer.prototype.clearShadow = function() {- this.setVariable("shadowColor", "rgba(0,0,0,0)");- };-- CanvasRenderer.prototype.setOpacity = function(opacity) {- this.ctx.globalAlpha = opacity;- };-- CanvasRenderer.prototype.setTransform = function(transform) {- this.ctx.translate(transform.origin[0], transform.origin[1]);- this.ctx.transform.apply(this.ctx, transform.matrix);- this.ctx.translate(-transform.origin[0], -transform.origin[1]);- };-- CanvasRenderer.prototype.setVariable = function(property, value) {- if (this.variables[property] !== value) {- this.variables[property] = this.ctx[property] = value;- }-- return this;- };-- CanvasRenderer.prototype.text = function(text, left, bottom) {- this.ctx.fillText(text, left, bottom);- };-- CanvasRenderer.prototype.backgroundRepeatShape = function(imageContainer, backgroundPosition, size, bounds, left, top, width, height, borderData) {- var shape = [- ["line", Math.round(left), Math.round(top)],- ["line", Math.round(left + width), Math.round(top)],- ["line", Math.round(left + width), Math.round(height + top)],- ["line", Math.round(left), Math.round(height + top)]- ];- this.clip([shape], function() {- this.renderBackgroundRepeat(imageContainer, backgroundPosition, size, bounds, borderData[3], borderData[0]);- }, this);- };-- CanvasRenderer.prototype.renderBackgroundRepeat = function(imageContainer, backgroundPosition, size, bounds, borderLeft, borderTop) {- var offsetX = Math.round(bounds.left + backgroundPosition.left + borderLeft), offsetY = Math.round(bounds.top + backgroundPosition.top + borderTop);- this.setFillStyle(this.ctx.createPattern(this.resizeImage(imageContainer, size), "repeat"));- this.ctx.translate(offsetX, offsetY);- this.ctx.fill();- this.ctx.translate(-offsetX, -offsetY);- };-- CanvasRenderer.prototype.renderBackgroundGradient = function(gradientImage, bounds) {- if (gradientImage instanceof LinearGradientContainer) {- var gradient = this.ctx.createLinearGradient(- bounds.left + bounds.width * gradientImage.x0,- bounds.top + bounds.height * gradientImage.y0,- bounds.left + bounds.width * gradientImage.x1,- bounds.top + bounds.height * gradientImage.y1);- gradientImage.colorStops.forEach(function(colorStop) {- gradient.addColorStop(colorStop.stop, colorStop.color.toString());- });- this.rectangle(bounds.left, bounds.top, bounds.width, bounds.height, gradient);- }- };-- CanvasRenderer.prototype.resizeImage = function(imageContainer, size) {- var image = imageContainer.image;- if(image.width === size.width && image.height === size.height) {- return image;- }-- var ctx, canvas = document.createElement('canvas');- canvas.width = size.width;- canvas.height = size.height;- ctx = canvas.getContext("2d");- ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, size.width, size.height );- return canvas;- };-- function hasEntries(array) {- return array.length > 0;- }-- module.exports = CanvasRenderer;-- },{"../lineargradientcontainer":12,"../log":13,"../renderer":19}],21:[function(_dereq_,module,exports){- var NodeContainer = _dereq_('./nodecontainer');-- function StackingContext(hasOwnStacking, opacity, element, parent) {- NodeContainer.call(this, element, parent);- this.ownStacking = hasOwnStacking;- this.contexts = [];- this.children = [];- this.opacity = (this.parent ? this.parent.stack.opacity : 1) * opacity;- }-- StackingContext.prototype = Object.create(NodeContainer.prototype);-- StackingContext.prototype.getParentStack = function(context) {- var parentStack = (this.parent) ? this.parent.stack : null;- return parentStack ? (parentStack.ownStacking ? parentStack : parentStack.getParentStack(context)) : context.stack;- };-- module.exports = StackingContext;-- },{"./nodecontainer":14}],22:[function(_dereq_,module,exports){- function Support(document) {- this.rangeBounds = this.testRangeBounds(document);- this.cors = this.testCORS();- this.svg = this.testSVG();- }-- Support.prototype.testRangeBounds = function(document) {- var range, testElement, rangeBounds, rangeHeight, support = false;-- if (document.createRange) {- range = document.createRange();- if (range.getBoundingClientRect) {- testElement = document.createElement('boundtest');- testElement.style.height = "123px";- testElement.style.display = "block";- document.body.appendChild(testElement);-- range.selectNode(testElement);- rangeBounds = range.getBoundingClientRect();- rangeHeight = rangeBounds.height;-- if (rangeHeight === 123) {- support = true;- }- document.body.removeChild(testElement);- }- }-- return support;- };-- Support.prototype.testCORS = function() {- return typeof((new Image()).crossOrigin) !== "undefined";- };-- Support.prototype.testSVG = function() {- var img = new Image();- var canvas = document.createElement("canvas");- var ctx = canvas.getContext("2d");- img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";-- try {- ctx.drawImage(img, 0, 0);- canvas.toDataURL();- } catch(e) {- return false;- }- return true;- };-- module.exports = Support;-- },{}],23:[function(_dereq_,module,exports){- var XHR = _dereq_('./xhr');- var decode64 = _dereq_('./utils').decode64;-- function SVGContainer(src) {- this.src = src;- this.image = null;- var self = this;-- this.promise = this.hasFabric().then(function() {- return (self.isInline(src) ? Promise.resolve(self.inlineFormatting(src)) : XHR(src));- }).then(function(svg) {- return new Promise(function(resolve) {- window.html2canvas.svg.fabric.loadSVGFromString(svg, self.createCanvas.call(self, resolve));- });- });- }-- SVGContainer.prototype.hasFabric = function() {- return !window.html2canvas.svg || !window.html2canvas.svg.fabric ? Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg")) : Promise.resolve();- };-- SVGContainer.prototype.inlineFormatting = function(src) {- return (/^data:image\/svg\+xml;base64,/.test(src)) ? this.decode64(this.removeContentType(src)) : this.removeContentType(src);- };-- SVGContainer.prototype.removeContentType = function(src) {- return src.replace(/^data:image\/svg\+xml(;base64)?,/,'');- };-- SVGContainer.prototype.isInline = function(src) {- return (/^data:image\/svg\+xml/i.test(src));- };-- SVGContainer.prototype.createCanvas = function(resolve) {- var self = this;- return function (objects, options) {- var canvas = new window.html2canvas.svg.fabric.StaticCanvas('c');- self.image = canvas.lowerCanvasEl;- canvas- .setWidth(options.width)- .setHeight(options.height)- .add(window.html2canvas.svg.fabric.util.groupSVGElements(objects, options))- .renderAll();- resolve(canvas.lowerCanvasEl);- };- };-- SVGContainer.prototype.decode64 = function(str) {- return (typeof(window.atob) === "function") ? window.atob(str) : decode64(str);- };-- module.exports = SVGContainer;-- },{"./utils":26,"./xhr":28}],24:[function(_dereq_,module,exports){- var SVGContainer = _dereq_('./svgcontainer');-- function SVGNodeContainer(node, _native) {- this.src = node;- this.image = null;- var self = this;-- this.promise = _native ? new Promise(function(resolve, reject) {- self.image = new Image();- self.image.onload = resolve;- self.image.onerror = reject;- self.image.src = "data:image/svg+xml," + (new XMLSerializer()).serializeToString(node);- if (self.image.complete === true) {- resolve(self.image);- }- }) : this.hasFabric().then(function() {- return new Promise(function(resolve) {- window.html2canvas.svg.fabric.parseSVGDocument(node, self.createCanvas.call(self, resolve));- });- });- }-- SVGNodeContainer.prototype = Object.create(SVGContainer.prototype);-- module.exports = SVGNodeContainer;-- },{"./svgcontainer":23}],25:[function(_dereq_,module,exports){- var NodeContainer = _dereq_('./nodecontainer');-- function TextContainer(node, parent) {- NodeContainer.call(this, node, parent);- }-- TextContainer.prototype = Object.create(NodeContainer.prototype);-- TextContainer.prototype.applyTextTransform = function() {- this.node.data = this.transform(this.parent.css("textTransform"));- };-- TextContainer.prototype.transform = function(transform) {- var text = this.node.data;- switch(transform){- case "lowercase":- return text.toLowerCase();- case "capitalize":- return text.replace(/(^|\s|:|-|\(|\))([a-z])/g, capitalize);- case "uppercase":- return text.toUpperCase();- default:- return text;- }- };-- function capitalize(m, p1, p2) {- if (m.length > 0) {- return p1 + p2.toUpperCase();- }- }-- module.exports = TextContainer;-- },{"./nodecontainer":14}],26:[function(_dereq_,module,exports){- exports.smallImage = function smallImage() {- return "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";- };-- exports.bind = function(callback, context) {- return function() {- return callback.apply(context, arguments);- };- };-- /*- * base64-arraybuffer- * https://github.com/niklasvh/base64-arraybuffer- *- * Copyright (c) 2012 Niklas von Hertzen- * Licensed under the MIT license.- */-- exports.decode64 = function(base64) {- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";- var len = base64.length, i, encoded1, encoded2, encoded3, encoded4, byte1, byte2, byte3;-- var output = "";-- for (i = 0; i < len; i+=4) {- encoded1 = chars.indexOf(base64[i]);- encoded2 = chars.indexOf(base64[i+1]);- encoded3 = chars.indexOf(base64[i+2]);- encoded4 = chars.indexOf(base64[i+3]);-- byte1 = (encoded1 << 2) | (encoded2 >> 4);- byte2 = ((encoded2 & 15) << 4) | (encoded3 >> 2);- byte3 = ((encoded3 & 3) << 6) | encoded4;- if (encoded3 === 64) {- output += String.fromCharCode(byte1);- } else if (encoded4 === 64 || encoded4 === -1) {- output += String.fromCharCode(byte1, byte2);- } else{- output += String.fromCharCode(byte1, byte2, byte3);- }- }-- return output;- };-- exports.getBounds = function(node) {- if (node.getBoundingClientRect) {- var clientRect = node.getBoundingClientRect();- var width = node.offsetWidth == null ? clientRect.width : node.offsetWidth;- return {- top: clientRect.top,- bottom: clientRect.bottom || (clientRect.top + clientRect.height),- right: clientRect.left + width,- left: clientRect.left,- width: width,- height: node.offsetHeight == null ? clientRect.height : node.offsetHeight- };- }- return {};- };-- exports.offsetBounds = function(node) {- var parent = node.offsetParent ? exports.offsetBounds(node.offsetParent) : {top: 0, left: 0};-- return {- top: node.offsetTop + parent.top,- bottom: node.offsetTop + node.offsetHeight + parent.top,- right: node.offsetLeft + parent.left + node.offsetWidth,- left: node.offsetLeft + parent.left,- width: node.offsetWidth,- height: node.offsetHeight- };- };-- exports.parseBackgrounds = function(backgroundImage) {- var whitespace = ' \r\n\t',- method, definition, prefix, prefix_i, block, results = [],- mode = 0, numParen = 0, quote, args;- var appendResult = function() {- if(method) {- if (definition.substr(0, 1) === '"') {- definition = definition.substr(1, definition.length - 2);- }- if (definition) {- args.push(definition);- }- if (method.substr(0, 1) === '-' && (prefix_i = method.indexOf('-', 1 ) + 1) > 0) {- prefix = method.substr(0, prefix_i);- method = method.substr(prefix_i);- }- results.push({- prefix: prefix,- method: method.toLowerCase(),- value: block,- args: args,- image: null- });- }- args = [];- method = prefix = definition = block = '';- };- args = [];- method = prefix = definition = block = '';- backgroundImage.split("").forEach(function(c) {- if (mode === 0 && whitespace.indexOf(c) > -1) {- return;- }- switch(c) {- case '"':- if(!quote) {- quote = c;- } else if(quote === c) {- quote = null;- }- break;- case '(':- if(quote) {- break;- } else if(mode === 0) {- mode = 1;- block += c;- return;- } else {- numParen++;- }- break;- case ')':- if (quote) {- break;- } else if(mode === 1) {- if(numParen === 0) {- mode = 0;- block += c;- appendResult();- return;- } else {- numParen--;- }- }- break;-- case ',':- if (quote) {- break;- } else if(mode === 0) {- appendResult();- return;- } else if (mode === 1) {- if (numParen === 0 && !method.match(/^url$/i)) {- args.push(definition);- definition = '';- block += c;- return;- }- }- break;- }-- block += c;- if (mode === 0) {- method += c;- } else {- definition += c;- }- });-- appendResult();- return results;- };-- },{}],27:[function(_dereq_,module,exports){- var GradientContainer = _dereq_('./gradientcontainer');-- function WebkitGradientContainer(imageData) {- GradientContainer.apply(this, arguments);- this.type = imageData.args[0] === "linear" ? GradientContainer.TYPES.LINEAR : GradientContainer.TYPES.RADIAL;- }-- WebkitGradientContainer.prototype = Object.create(GradientContainer.prototype);-- module.exports = WebkitGradientContainer;-- },{"./gradientcontainer":9}],28:[function(_dereq_,module,exports){- function XHR(url) {- return new Promise(function(resolve, reject) {- var xhr = new XMLHttpRequest();- xhr.open('GET', url);-- xhr.onload = function() {- if (xhr.status === 200) {- resolve(xhr.responseText);- } else {- reject(new Error(xhr.statusText));- }- };-- xhr.onerror = function() {- reject(new Error("Network Error"));- };-- xhr.send();- });- }-- module.exports = XHR;-- },{}]},{},[4])(4)- });-- // Generated by CoffeeScript 1.4.0-- /*- # PNG.js- # Copyright (c) 2011 Devon Govett- # MIT LICENSE- #- #- */--- (function(global) {- var PNG;-- PNG = (function() {- var APNG_BLEND_OP_OVER, APNG_BLEND_OP_SOURCE, APNG_DISPOSE_OP_BACKGROUND, APNG_DISPOSE_OP_NONE, APNG_DISPOSE_OP_PREVIOUS, makeImage, scratchCanvas, scratchCtx;-- PNG.load = function(url, canvas, callback) {- var xhr,- _this = this;- if (typeof canvas === 'function') {- callback = canvas;- }- xhr = new XMLHttpRequest;- xhr.open("GET", url, true);- xhr.responseType = "arraybuffer";- xhr.onload = function() {- var data, png;- data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);- png = new PNG(data);- if (typeof (canvas != null ? canvas.getContext : void 0) === 'function') {- png.render(canvas);- }- return typeof callback === "function" ? callback(png) : void 0;- };- return xhr.send(null);- };-- APNG_DISPOSE_OP_NONE = 0;-- APNG_DISPOSE_OP_BACKGROUND = 1;-- APNG_DISPOSE_OP_PREVIOUS = 2;-- APNG_BLEND_OP_SOURCE = 0;-- APNG_BLEND_OP_OVER = 1;-- function PNG(data) {- var chunkSize, colors, palLen, delayDen, delayNum, frame, i, index, key, section, palShort, text, _i, _j, _ref;- this.data = data;- this.pos = 8;- this.palette = [];- this.imgData = [];- this.transparency = {};- this.animation = null;- this.text = {};- frame = null;- while (true) {- chunkSize = this.readUInt32();- section = ((function() {- var _i, _results;- _results = [];- for (i = _i = 0; _i < 4; i = ++_i) {- _results.push(String.fromCharCode(this.data[this.pos++]));- }- return _results;- }).call(this)).join('');- switch (section) {- case 'IHDR':- this.width = this.readUInt32();- this.height = this.readUInt32();- this.bits = this.data[this.pos++];- this.colorType = this.data[this.pos++];- this.compressionMethod = this.data[this.pos++];- this.filterMethod = this.data[this.pos++];- this.interlaceMethod = this.data[this.pos++];- break;- case 'acTL':- this.animation = {- numFrames: this.readUInt32(),- numPlays: this.readUInt32() || Infinity,- frames: []- };- break;- case 'PLTE':- this.palette = this.read(chunkSize);- break;- case 'fcTL':- if (frame) {- this.animation.frames.push(frame);- }- this.pos += 4;- frame = {- width: this.readUInt32(),- height: this.readUInt32(),- xOffset: this.readUInt32(),- yOffset: this.readUInt32()- };- delayNum = this.readUInt16();- delayDen = this.readUInt16() || 100;- frame.delay = 1000 * delayNum / delayDen;- frame.disposeOp = this.data[this.pos++];- frame.blendOp = this.data[this.pos++];- frame.data = [];- break;- case 'IDAT':- case 'fdAT':- if (section === 'fdAT') {- this.pos += 4;- chunkSize -= 4;- }- data = (frame != null ? frame.data : void 0) || this.imgData;- for (i = _i = 0; 0 <= chunkSize ? _i < chunkSize : _i > chunkSize; i = 0 <= chunkSize ? ++_i : --_i) {- data.push(this.data[this.pos++]);- }- break;- case 'tRNS':- this.transparency = {};- switch (this.colorType) {- case 3:- palLen = this.palette.length/3;- this.transparency.indexed = this.read(chunkSize);- if(this.transparency.indexed.length > palLen)- throw new Error('More transparent colors than palette size');- /*- * According to the PNG spec trns should be increased to the same size as palette if shorter- */- //palShort = 255 - this.transparency.indexed.length;- palShort = palLen - this.transparency.indexed.length;- if (palShort > 0) {- for (i = _j = 0; 0 <= palShort ? _j < palShort : _j > palShort; i = 0 <= palShort ? ++_j : --_j) {- this.transparency.indexed.push(255);- }- }- break;- case 0:- this.transparency.grayscale = this.read(chunkSize)[0];- break;- case 2:- this.transparency.rgb = this.read(chunkSize);- }- break;- case 'tEXt':- text = this.read(chunkSize);- index = text.indexOf(0);- key = String.fromCharCode.apply(String, text.slice(0, index));- this.text[key] = String.fromCharCode.apply(String, text.slice(index + 1));- break;- case 'IEND':- if (frame) {- this.animation.frames.push(frame);- }- this.colors = (function() {- switch (this.colorType) {- case 0:- case 3:- case 4:- return 1;- case 2:- case 6:- return 3;- }- }).call(this);- this.hasAlphaChannel = (_ref = this.colorType) === 4 || _ref === 6;- colors = this.colors + (this.hasAlphaChannel ? 1 : 0);- this.pixelBitlength = this.bits * colors;- this.colorSpace = (function() {- switch (this.colors) {- case 1:- return 'DeviceGray';- case 3:- return 'DeviceRGB';- }- }).call(this);- this.imgData = new Uint8Array(this.imgData);- return;- default:- this.pos += chunkSize;- }- this.pos += 4;- if (this.pos > this.data.length) {- throw new Error("Incomplete or corrupt PNG file");- }- }- return;- }-- PNG.prototype.read = function(bytes) {- var i, _i, _results;- _results = [];- for (i = _i = 0; 0 <= bytes ? _i < bytes : _i > bytes; i = 0 <= bytes ? ++_i : --_i) {- _results.push(this.data[this.pos++]);- }- return _results;- };-- PNG.prototype.readUInt32 = function() {- var b1, b2, b3, b4;- b1 = this.data[this.pos++] << 24;- b2 = this.data[this.pos++] << 16;- b3 = this.data[this.pos++] << 8;- b4 = this.data[this.pos++];- return b1 | b2 | b3 | b4;- };-- PNG.prototype.readUInt16 = function() {- var b1, b2;- b1 = this.data[this.pos++] << 8;- b2 = this.data[this.pos++];- return b1 | b2;- };-- PNG.prototype.decodePixels = function(data) {- var abyte, c, col, i, left, length, p, pa, paeth, pb, pc, pixelBytes, pixels, pos, row, scanlineLength, upper, upperLeft, _i, _j, _k, _l, _m;- if (data == null) {- data = this.imgData;- }- if (data.length === 0) {- return new Uint8Array(0);- }- data = new FlateStream(data);- data = data.getBytes();- pixelBytes = this.pixelBitlength / 8;- scanlineLength = pixelBytes * this.width;- pixels = new Uint8Array(scanlineLength * this.height);- length = data.length;- row = 0;- pos = 0;- c = 0;- while (pos < length) {- switch (data[pos++]) {- case 0:- for (i = _i = 0; _i < scanlineLength; i = _i += 1) {- pixels[c++] = data[pos++];- }- break;- case 1:- for (i = _j = 0; _j < scanlineLength; i = _j += 1) {- abyte = data[pos++];- left = i < pixelBytes ? 0 : pixels[c - pixelBytes];- pixels[c++] = (abyte + left) % 256;- }- break;- case 2:- for (i = _k = 0; _k < scanlineLength; i = _k += 1) {- abyte = data[pos++];- col = (i - (i % pixelBytes)) / pixelBytes;- upper = row && pixels[(row - 1) * scanlineLength + col * pixelBytes + (i % pixelBytes)];- pixels[c++] = (upper + abyte) % 256;- }- break;- case 3:- for (i = _l = 0; _l < scanlineLength; i = _l += 1) {- abyte = data[pos++];- col = (i - (i % pixelBytes)) / pixelBytes;- left = i < pixelBytes ? 0 : pixels[c - pixelBytes];- upper = row && pixels[(row - 1) * scanlineLength + col * pixelBytes + (i % pixelBytes)];- pixels[c++] = (abyte + Math.floor((left + upper) / 2)) % 256;- }- break;- case 4:- for (i = _m = 0; _m < scanlineLength; i = _m += 1) {- abyte = data[pos++];- col = (i - (i % pixelBytes)) / pixelBytes;- left = i < pixelBytes ? 0 : pixels[c - pixelBytes];- if (row === 0) {- upper = upperLeft = 0;- } else {- upper = pixels[(row - 1) * scanlineLength + col * pixelBytes + (i % pixelBytes)];- upperLeft = col && pixels[(row - 1) * scanlineLength + (col - 1) * pixelBytes + (i % pixelBytes)];- }- p = left + upper - upperLeft;- pa = Math.abs(p - left);- pb = Math.abs(p - upper);- pc = Math.abs(p - upperLeft);- if (pa <= pb && pa <= pc) {- paeth = left;- } else if (pb <= pc) {- paeth = upper;- } else {- paeth = upperLeft;- }- pixels[c++] = (abyte + paeth) % 256;- }- break;- default:- throw new Error("Invalid filter algorithm: " + data[pos - 1]);- }- row++;- }- return pixels;- };-- PNG.prototype.decodePalette = function() {- var c, i, length, palette, pos, ret, transparency, _i, _ref, _ref1;- palette = this.palette;- transparency = this.transparency.indexed || [];- ret = new Uint8Array((transparency.length || 0) + palette.length);- pos = 0;- length = palette.length;- c = 0;- for (i = _i = 0, _ref = palette.length; _i < _ref; i = _i += 3) {- ret[pos++] = palette[i];- ret[pos++] = palette[i + 1];- ret[pos++] = palette[i + 2];- ret[pos++] = (_ref1 = transparency[c++]) != null ? _ref1 : 255;- }- return ret;- };-- PNG.prototype.copyToImageData = function(imageData, pixels) {- var alpha, colors, data, i, input, j, k, length, palette, v, _ref;- colors = this.colors;- palette = null;- alpha = this.hasAlphaChannel;- if (this.palette.length) {- palette = (_ref = this._decodedPalette) != null ? _ref : this._decodedPalette = this.decodePalette();- colors = 4;- alpha = true;- }- data = imageData.data || imageData;- length = data.length;- input = palette || pixels;- i = j = 0;- if (colors === 1) {- while (i < length) {- k = palette ? pixels[i / 4] * 4 : j;- v = input[k++];- data[i++] = v;- data[i++] = v;- data[i++] = v;- data[i++] = alpha ? input[k++] : 255;- j = k;- }- } else {- while (i < length) {- k = palette ? pixels[i / 4] * 4 : j;- data[i++] = input[k++];- data[i++] = input[k++];- data[i++] = input[k++];- data[i++] = alpha ? input[k++] : 255;- j = k;- }- }- };-- PNG.prototype.decode = function() {- var ret;- ret = new Uint8Array(this.width * this.height * 4);- this.copyToImageData(ret, this.decodePixels());- return ret;- };-- try {- scratchCanvas = global.document.createElement('canvas');- scratchCtx = scratchCanvas.getContext('2d');- } catch(e) {- return -1;- }-- makeImage = function(imageData) {- var img;- scratchCtx.width = imageData.width;- scratchCtx.height = imageData.height;- scratchCtx.clearRect(0, 0, imageData.width, imageData.height);- scratchCtx.putImageData(imageData, 0, 0);- img = new Image;- img.src = scratchCanvas.toDataURL();- return img;- };-- PNG.prototype.decodeFrames = function(ctx) {- var frame, i, imageData, pixels, _i, _len, _ref, _results;- if (!this.animation) {- return;- }- _ref = this.animation.frames;- _results = [];- for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {- frame = _ref[i];- imageData = ctx.createImageData(frame.width, frame.height);- pixels = this.decodePixels(new Uint8Array(frame.data));- this.copyToImageData(imageData, pixels);- frame.imageData = imageData;- _results.push(frame.image = makeImage(imageData));- }- return _results;- };-- PNG.prototype.renderFrame = function(ctx, number) {- var frame, frames, prev;- frames = this.animation.frames;- frame = frames[number];- prev = frames[number - 1];- if (number === 0) {- ctx.clearRect(0, 0, this.width, this.height);- }- if ((prev != null ? prev.disposeOp : void 0) === APNG_DISPOSE_OP_BACKGROUND) {- ctx.clearRect(prev.xOffset, prev.yOffset, prev.width, prev.height);- } else if ((prev != null ? prev.disposeOp : void 0) === APNG_DISPOSE_OP_PREVIOUS) {- ctx.putImageData(prev.imageData, prev.xOffset, prev.yOffset);- }- if (frame.blendOp === APNG_BLEND_OP_SOURCE) {- ctx.clearRect(frame.xOffset, frame.yOffset, frame.width, frame.height);- }- return ctx.drawImage(frame.image, frame.xOffset, frame.yOffset);- };-- PNG.prototype.animate = function(ctx) {- var doFrame, frameNumber, frames, numFrames, numPlays, _ref,- _this = this;- frameNumber = 0;- _ref = this.animation, numFrames = _ref.numFrames, frames = _ref.frames, numPlays = _ref.numPlays;- return (doFrame = function() {- var f, frame;- f = frameNumber++ % numFrames;- frame = frames[f];- _this.renderFrame(ctx, f);- if (numFrames > 1 && frameNumber / numFrames < numPlays) {- return _this.animation._timeout = setTimeout(doFrame, frame.delay);- }- })();- };-- PNG.prototype.stopAnimation = function() {- var _ref;- return clearTimeout((_ref = this.animation) != null ? _ref._timeout : void 0);- };-- PNG.prototype.render = function(canvas) {- var ctx, data;- if (canvas._png) {- canvas._png.stopAnimation();- }- canvas._png = this;- canvas.width = this.width;- canvas.height = this.height;- ctx = canvas.getContext("2d");- if (this.animation) {- this.decodeFrames(ctx);- return this.animate(ctx);- } else {- data = ctx.createImageData(this.width, this.height);- this.copyToImageData(data, this.decodePixels());- return ctx.putImageData(data, 0, 0);- }- };-- return PNG;-- })();-- global.PNG = PNG;-- })(typeof window !== "undefined" && window || undefined);-- /*- * Extracted from pdf.js- * https://github.com/andreasgal/pdf.js- *- * Copyright (c) 2011 Mozilla Foundation- *- * Contributors: Andreas Gal <[email protected]>- * Chris G Jones <[email protected]>- * Shaon Barman <[email protected]>- * Vivien Nicolas <[email protected]>- * Justin D'Arcangelo <[email protected]>- * Yury Delendik- *- *- */-- var DecodeStream = (function() {- function constructor() {- this.pos = 0;- this.bufferLength = 0;- this.eof = false;- this.buffer = null;- }-- constructor.prototype = {- ensureBuffer: function decodestream_ensureBuffer(requested) {- var buffer = this.buffer;- var current = buffer ? buffer.byteLength : 0;- if (requested < current)- return buffer;- var size = 512;- while (size < requested)- size <<= 1;- var buffer2 = new Uint8Array(size);- for (var i = 0; i < current; ++i)- buffer2[i] = buffer[i];- return this.buffer = buffer2;- },- getByte: function decodestream_getByte() {- var pos = this.pos;- while (this.bufferLength <= pos) {- if (this.eof)- return null;- this.readBlock();- }- return this.buffer[this.pos++];- },- getBytes: function decodestream_getBytes(length) {- var pos = this.pos;-- if (length) {- this.ensureBuffer(pos + length);- var end = pos + length;-- while (!this.eof && this.bufferLength < end)- this.readBlock();-- var bufEnd = this.bufferLength;- if (end > bufEnd)- end = bufEnd;- } else {- while (!this.eof)- this.readBlock();-- var end = this.bufferLength;- }-- this.pos = end;- return this.buffer.subarray(pos, end);- },- lookChar: function decodestream_lookChar() {- var pos = this.pos;- while (this.bufferLength <= pos) {- if (this.eof)- return null;- this.readBlock();- }- return String.fromCharCode(this.buffer[this.pos]);- },- getChar: function decodestream_getChar() {- var pos = this.pos;- while (this.bufferLength <= pos) {- if (this.eof)- return null;- this.readBlock();- }- return String.fromCharCode(this.buffer[this.pos++]);- },- makeSubStream: function decodestream_makeSubstream(start, length, dict) {- var end = start + length;- while (this.bufferLength <= end && !this.eof)- this.readBlock();- return new Stream(this.buffer, start, length, dict);- },- skip: function decodestream_skip(n) {- if (!n)- n = 1;- this.pos += n;- },- reset: function decodestream_reset() {- this.pos = 0;- }- };-- return constructor;- })();-- var FlateStream = (function() {- if (typeof Uint32Array === 'undefined') {- return undefined;- }- var codeLenCodeMap = new Uint32Array([- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15- ]);-- var lengthDecode = new Uint32Array([- 0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a,- 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f,- 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073,- 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102- ]);-- var distDecode = new Uint32Array([- 0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d,- 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1,- 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01,- 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001- ]);-- var fixedLitCodeTab = [new Uint32Array([- 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,- 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,- 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0,- 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0,- 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8,- 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8,- 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,- 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8,- 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4,- 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4,- 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4,- 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4,- 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc,- 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,- 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc,- 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc,- 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2,- 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2,- 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2,- 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2,- 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,- 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea,- 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da,- 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa,- 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6,- 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6,- 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6,- 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,- 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce,- 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee,- 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de,- 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe,- 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1,- 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1,- 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,- 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1,- 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9,- 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9,- 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9,- 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9,- 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5,- 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,- 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5,- 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5,- 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd,- 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed,- 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd,- 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd,- 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,- 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3,- 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3,- 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3,- 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb,- 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb,- 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db,- 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,- 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7,- 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7,- 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7,- 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7,- 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf,- 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef,- 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,- 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff- ]), 9];-- var fixedDistCodeTab = [new Uint32Array([- 0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,- 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,- 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d,- 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000- ]), 5];-- function error(e) {- throw new Error(e)- }-- function constructor(bytes) {- //var bytes = stream.getBytes();- var bytesPos = 0;-- var cmf = bytes[bytesPos++];- var flg = bytes[bytesPos++];- if (cmf == -1 || flg == -1)- error('Invalid header in flate stream');- if ((cmf & 0x0f) != 0x08)- error('Unknown compression method in flate stream');- if ((((cmf << 8) + flg) % 31) != 0)- error('Bad FCHECK in flate stream');- if (flg & 0x20)- error('FDICT bit set in flate stream');-- this.bytes = bytes;- this.bytesPos = bytesPos;-- this.codeSize = 0;- this.codeBuf = 0;-- DecodeStream.call(this);- }-- constructor.prototype = Object.create(DecodeStream.prototype);-- constructor.prototype.getBits = function(bits) {- var codeSize = this.codeSize;- var codeBuf = this.codeBuf;- var bytes = this.bytes;- var bytesPos = this.bytesPos;-- var b;- while (codeSize < bits) {- if (typeof (b = bytes[bytesPos++]) == 'undefined')- error('Bad encoding in flate stream');- codeBuf |= b << codeSize;- codeSize += 8;- }- b = codeBuf & ((1 << bits) - 1);- this.codeBuf = codeBuf >> bits;- this.codeSize = codeSize -= bits;- this.bytesPos = bytesPos;- return b;- };-- constructor.prototype.getCode = function(table) {- var codes = table[0];- var maxLen = table[1];- var codeSize = this.codeSize;- var codeBuf = this.codeBuf;- var bytes = this.bytes;- var bytesPos = this.bytesPos;-- while (codeSize < maxLen) {- var b;- if (typeof (b = bytes[bytesPos++]) == 'undefined')- error('Bad encoding in flate stream');- codeBuf |= (b << codeSize);- codeSize += 8;- }- var code = codes[codeBuf & ((1 << maxLen) - 1)];- var codeLen = code >> 16;- var codeVal = code & 0xffff;- if (codeSize == 0 || codeSize < codeLen || codeLen == 0)- error('Bad encoding in flate stream');- this.codeBuf = (codeBuf >> codeLen);- this.codeSize = (codeSize - codeLen);- this.bytesPos = bytesPos;- return codeVal;- };-- constructor.prototype.generateHuffmanTable = function(lengths) {- var n = lengths.length;-- // find max code length- var maxLen = 0;- for (var i = 0; i < n; ++i) {- if (lengths[i] > maxLen)- maxLen = lengths[i];- }-- // build the table- var size = 1 << maxLen;- var codes = new Uint32Array(size);- for (var len = 1, code = 0, skip = 2;- len <= maxLen;- ++len, code <<= 1, skip <<= 1) {- for (var val = 0; val < n; ++val) {- if (lengths[val] == len) {- // bit-reverse the code- var code2 = 0;- var t = code;- for (var i = 0; i < len; ++i) {- code2 = (code2 << 1) | (t & 1);- t >>= 1;- }-- // fill the table entries- for (var i = code2; i < size; i += skip)- codes[i] = (len << 16) | val;-- ++code;- }- }- }-- return [codes, maxLen];- };-- constructor.prototype.readBlock = function() {- function repeat(stream, array, len, offset, what) {- var repeat = stream.getBits(len) + offset;- while (repeat-- > 0)- array[i++] = what;- }-- // read block header- var hdr = this.getBits(3);- if (hdr & 1)- this.eof = true;- hdr >>= 1;-- if (hdr == 0) { // uncompressed block- var bytes = this.bytes;- var bytesPos = this.bytesPos;- var b;-- if (typeof (b = bytes[bytesPos++]) == 'undefined')- error('Bad block header in flate stream');- var blockLen = b;- if (typeof (b = bytes[bytesPos++]) == 'undefined')- error('Bad block header in flate stream');- blockLen |= (b << 8);- if (typeof (b = bytes[bytesPos++]) == 'undefined')- error('Bad block header in flate stream');- var check = b;- if (typeof (b = bytes[bytesPos++]) == 'undefined')- error('Bad block header in flate stream');- check |= (b << 8);- if (check != (~blockLen & 0xffff))- error('Bad uncompressed block length in flate stream');-- this.codeBuf = 0;- this.codeSize = 0;-- var bufferLength = this.bufferLength;- var buffer = this.ensureBuffer(bufferLength + blockLen);- var end = bufferLength + blockLen;- this.bufferLength = end;- for (var n = bufferLength; n < end; ++n) {- if (typeof (b = bytes[bytesPos++]) == 'undefined') {- this.eof = true;- break;- }- buffer[n] = b;- }- this.bytesPos = bytesPos;- return;- }-- var litCodeTable;- var distCodeTable;- if (hdr == 1) { // compressed block, fixed codes- litCodeTable = fixedLitCodeTab;- distCodeTable = fixedDistCodeTab;- } else if (hdr == 2) { // compressed block, dynamic codes- var numLitCodes = this.getBits(5) + 257;- var numDistCodes = this.getBits(5) + 1;- var numCodeLenCodes = this.getBits(4) + 4;-- // build the code lengths code table- var codeLenCodeLengths = Array(codeLenCodeMap.length);- var i = 0;- while (i < numCodeLenCodes)- codeLenCodeLengths[codeLenCodeMap[i++]] = this.getBits(3);- var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);-- // build the literal and distance code tables- var len = 0;- var i = 0;- var codes = numLitCodes + numDistCodes;- var codeLengths = new Array(codes);- while (i < codes) {- var code = this.getCode(codeLenCodeTab);- if (code == 16) {- repeat(this, codeLengths, 2, 3, len);- } else if (code == 17) {- repeat(this, codeLengths, 3, 3, len = 0);- } else if (code == 18) {- repeat(this, codeLengths, 7, 11, len = 0);- } else {- codeLengths[i++] = len = code;- }- }-- litCodeTable =- this.generateHuffmanTable(codeLengths.slice(0, numLitCodes));- distCodeTable =- this.generateHuffmanTable(codeLengths.slice(numLitCodes, codes));- } else {- error('Unknown block type in flate stream');- }-- var buffer = this.buffer;- var limit = buffer ? buffer.length : 0;- var pos = this.bufferLength;- while (true) {- var code1 = this.getCode(litCodeTable);- if (code1 < 256) {- if (pos + 1 >= limit) {- buffer = this.ensureBuffer(pos + 1);- limit = buffer.length;- }- buffer[pos++] = code1;- continue;- }- if (code1 == 256) {- this.bufferLength = pos;- return;- }- code1 -= 257;- code1 = lengthDecode[code1];- var code2 = code1 >> 16;- if (code2 > 0)- code2 = this.getBits(code2);- var len = (code1 & 0xffff) + code2;- code1 = this.getCode(distCodeTable);- code1 = distDecode[code1];- code2 = code1 >> 16;- if (code2 > 0)- code2 = this.getBits(code2);- var dist = (code1 & 0xffff) + code2;- if (pos + len >= limit) {- buffer = this.ensureBuffer(pos + len);- limit = buffer.length;- }- for (var k = 0; k < len; ++k, ++pos)- buffer[pos] = buffer[pos - dist];- }- };-- return constructor;- })();-- /**- * JavaScript Polyfill functions for jsPDF- * Collected from public resources by- * https://github.com/diegocr- */-- (function (global) {- var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';-- if (typeof global.btoa === 'undefined') {- global.btoa = function(data) {- // discuss at: http://phpjs.org/functions/base64_encode/- // original by: Tyler Akins (http://rumkin.com)- // improved by: Bayron Guevara- // improved by: Thunder.m- // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)- // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)- // improved by: Rafal Kukawski (http://kukawski.pl)- // bugfixed by: Pellentesque Malesuada- // example 1: base64_encode('Kevin van Zonneveld');- // returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='-- var o1,o2,o3,h1,h2,h3,h4,bits,i = 0,ac = 0,enc = '',tmp_arr = [];-- if (!data) {- return data;- }-- do { // pack three octets into four hexets- o1 = data.charCodeAt(i++);- o2 = data.charCodeAt(i++);- o3 = data.charCodeAt(i++);-- bits = o1 << 16 | o2 << 8 | o3;-- h1 = bits >> 18 & 0x3f;- h2 = bits >> 12 & 0x3f;- h3 = bits >> 6 & 0x3f;- h4 = bits & 0x3f;-- // use hexets to index into b64, and append result to encoded string- tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);- } while (i < data.length);-- enc = tmp_arr.join('');-- var r = data.length % 3;-- return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);- };- }-- if (typeof global.atob === 'undefined') {- global.atob = function(data) {- // discuss at: http://phpjs.org/functions/base64_decode/- // original by: Tyler Akins (http://rumkin.com)- // improved by: Thunder.m- // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)- // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)- // input by: Aman Gupta- // input by: Brett Zamir (http://brett-zamir.me)- // bugfixed by: Onno Marsman- // bugfixed by: Pellentesque Malesuada- // bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)- // example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');- // returns 1: 'Kevin van Zonneveld'-- var o1,o2,o3,h1,h2,h3,h4,bits,i = 0,ac = 0,dec = '',tmp_arr = [];-- if (!data) {- return data;- }-- data += '';-- do { // unpack four hexets into three octets using index points in b64- h1 = b64.indexOf(data.charAt(i++));- h2 = b64.indexOf(data.charAt(i++));- h3 = b64.indexOf(data.charAt(i++));- h4 = b64.indexOf(data.charAt(i++));-- bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;-- o1 = bits >> 16 & 0xff;- o2 = bits >> 8 & 0xff;- o3 = bits & 0xff;-- if (h3 == 64) {- tmp_arr[ac++] = String.fromCharCode(o1);- } else if (h4 == 64) {- tmp_arr[ac++] = String.fromCharCode(o1, o2);- } else {- tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);- }- } while (i < data.length);-- dec = tmp_arr.join('');-- return dec;- };- }-- if (!Array.prototype.map) {- Array.prototype.map = function(fun /*, thisArg */) {- if (this === void 0 || this === null || typeof fun !== "function")- throw new TypeError();-- var t = Object(this), len = t.length >>> 0, res = new Array(len);- var thisArg = arguments.length > 1 ? arguments[1] : void 0;- for (var i = 0; i < len; i++) {- // NOTE: Absolute correctness would demand Object.defineProperty- // be used. But this method is fairly new, and failure is- // possible only if Object.prototype or Array.prototype- // has a property |i| (very unlikely), so use a less-correct- // but more portable alternative.- if (i in t)- res[i] = fun.call(thisArg, t[i], i, t);- }-- return res;- };- }--- if(!Array.isArray) {- Array.isArray = function(arg) {- return Object.prototype.toString.call(arg) === '[object Array]';- };- }-- if (!Array.prototype.forEach) {- Array.prototype.forEach = function(fun, thisArg) {- "use strict";-- if (this === void 0 || this === null || typeof fun !== "function")- throw new TypeError();-- var t = Object(this), len = t.length >>> 0;- for (var i = 0; i < len; i++) {- if (i in t)- fun.call(thisArg, t[i], i, t);- }- };- }-- if (!Object.keys) {- Object.keys = (function () {- 'use strict';-- var hasOwnProperty = Object.prototype.hasOwnProperty,- hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),- dontEnums = ['toString','toLocaleString','valueOf','hasOwnProperty',- 'isPrototypeOf','propertyIsEnumerable','constructor'],- dontEnumsLength = dontEnums.length;-- return function (obj) {- if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {- throw new TypeError();- }- var result = [], prop, i;-- for (prop in obj) {- if (hasOwnProperty.call(obj, prop)) {- result.push(prop);- }- }-- if (hasDontEnumBug) {- for (i = 0; i < dontEnumsLength; i++) {- if (hasOwnProperty.call(obj, dontEnums[i])) {- result.push(dontEnums[i]);- }- }- }- return result;- };- }());- }-- if (!String.prototype.trim) {- String.prototype.trim = function () {- return this.replace(/^\s+|\s+$/g, '');- };- }- if (!String.prototype.trimLeft) {- String.prototype.trimLeft = function() {- return this.replace(/^\s+/g, "");- };- }- if (!String.prototype.trimRight) {- String.prototype.trimRight = function() {- return this.replace(/\s+$/g, "");- };- }-- })(typeof self !== "undefined" && self || typeof window !== "undefined" && window || undefined);-- var jsPDF = jsPDF;-- return jsPDF;--}));+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.jspdf=e()}(this,function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},e=function(e){function n(t){var n={};this.subscribe=function(t,e,r){if("function"!=typeof e)return!1;n.hasOwnProperty(t)||(n[t]={});var i=Math.random().toString(35);return n[t][i]=[e,!!r],i},this.unsubscribe=function(t){for(var e in n)if(n[e][t])return delete n[e][t],!0;return!1},this.publish=function(r){if(n.hasOwnProperty(r)){var i=Array.prototype.slice.call(arguments,1),o=[];for(var a in n[r]){var s=n[r][a];try{s[0].apply(t,i)}catch(t){e.console&&console.error("jsPDF PubSub Error",t.message,t)}s[1]&&o.push(a)}o.length&&o.forEach(this.unsubscribe)}}}function r(c,l,u,h){var f={};"object"===("undefined"==typeof c?"undefined":t(c))&&(f=c,c=f.orientation,l=f.unit||l,u=f.format||u,h=f.compress||f.compressPdf||h),l=l||"mm",u=u||"a4",c=(""+(c||"P")).toLowerCase();var d,p,g,m,w,y,v,b,x,k=((""+u).toLowerCase(),!!h&&"function"==typeof Uint8Array),_=f.textColor||"0 g",C=f.drawColor||"0 G",A=f.fontSize||16,S=f.lineHeight||1.15,q=f.lineWidth||.200025,T=2,I=!1,P=[],E={},O={},F=0,R=[],B=[],D=[],j=[],N=[],z=0,L=0,M=0,U={title:"",subject:"",author:"",keywords:"",creator:""},H={},W=new n(H),X=function(t){return t.toFixed(2)},V=function(t){return t.toFixed(3)},Y=function(t){return("0"+parseInt(t)).slice(-2)},G=function(t){I?R[m].push(t):(M+=t.length+1,j.push(t))},J=function(){return T++,P[T]=M,G(T+" 0 obj"),T},Q=function(){var t=2*R.length+1;t+=N.length;var e={objId:t,content:""};return N.push(e),e},K=function(){return T++,P[T]=function(){return M},T},$=function(t){P[t]=M},Z=function(t){G("stream"),G(t),G("endstream")},tt=function(){var t,n,i,o,s,c,l,u,h,f=[];for(l=e.adler32cs||r.adler32cs,k&&"undefined"==typeof l&&(k=!1),t=1;t<=F;t++){if(f.push(J()),u=(w=D[t].width)*p,h=(y=D[t].height)*p,G("<</Type /Page"),G("/Parent 1 0 R"),G("/Resources 2 0 R"),G("/MediaBox [0 0 "+X(u)+" "+X(h)+"]"),W.publish("putPage",{pageNumber:t,page:R[t]}),G("/Contents "+(T+1)+" 0 R"),G(">>"),G("endobj"),n=R[t].join("\n"),J(),k){for(i=[],o=n.length;o--;)i[o]=n.charCodeAt(o);c=l.from(n),s=new a(6),s.append(new Uint8Array(i)),n=s.flush(),i=new Uint8Array(n.length+6),i.set(new Uint8Array([120,156])),i.set(n,2),i.set(new Uint8Array([255&c,c>>8&255,c>>16&255,c>>24&255]),n.length+2),n=String.fromCharCode.apply(null,i),G("<</Length "+n.length+" /Filter [/FlateDecode]>>")}else G("<</Length "+n.length+">>");Z(n),G("endobj")}P[1]=M,G("1 0 obj"),G("<</Type /Pages");var d="/Kids [";for(o=0;o<F;o++)d+=f[o]+" 0 R ";G(d+"]"),G("/Count "+F),G(">>"),G("endobj"),W.publish("postPutPages")},et=function(t){t.objectNumber=J(),G("<</BaseFont/"+t.PostScriptName+"/Type/Font"),"string"==typeof t.encoding&&G("/Encoding/"+t.encoding),G("/Subtype/Type1>>"),G("endobj")},nt=function(){for(var t in E)E.hasOwnProperty(t)&&et(E[t])},rt=function(){W.publish("putXobjectDict")},it=function(){G("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),G("/Font <<");for(var t in E)E.hasOwnProperty(t)&&G("/"+t+" "+E[t].objectNumber+" 0 R");G(">>"),G("/XObject <<"),rt(),G(">>")},ot=function(){nt(),W.publish("putResources"),P[2]=M,G("2 0 obj"),G("<<"),it(),G(">>"),G("endobj"),W.publish("postPutResources")},at=function(){W.publish("putAdditionalObjects");for(var t=0;t<N.length;t++){var e=N[t];P[e.objId]=M,G(e.objId+" 0 obj"),G(e.content),G("endobj")}T+=N.length,W.publish("postPutAdditionalObjects")},st=function(t,e,n){O.hasOwnProperty(e)||(O[e]={}),O[e][n]=t},ct=function(t,e,n,r){var i="F"+(Object.keys(E).length+1).toString(10),o=E[i]={id:i,PostScriptName:t,fontName:e,fontStyle:n,encoding:r,metadata:{}};return st(i,e,n),W.publish("addFont",o),i},lt=function(){for(var t="helvetica",e="times",n="courier",r="normal",i="bold",o="italic",a="bolditalic",s="StandardEncoding",c="zapfdingbats",l=[["Helvetica",t,r],["Helvetica-Bold",t,i],["Helvetica-Oblique",t,o],["Helvetica-BoldOblique",t,a],["Courier",n,r],["Courier-Bold",n,i],["Courier-Oblique",n,o],["Courier-BoldOblique",n,a],["Times-Roman",e,r],["Times-Bold",e,i],["Times-Italic",e,o],["Times-BoldItalic",e,a],["ZapfDingbats",c]],u=0,h=l.length;u<h;u++){var f=ct(l[u][0],l[u][1],l[u][2],s),d=l[u][0].split("-");st(f,d[0],d[1]||"")}W.publish("addFonts",{fonts:E,dictionary:O})},ut=function(t){return t.foo=function(){try{return t.apply(this,arguments)}catch(t){var n=t.stack||"";~n.indexOf(" at ")&&(n=n.split(" at ")[1]);var r="Error in function "+n.split("\n")[0].split("<")[0]+": "+t.message;if(!e.console)throw new Error(r);e.console.error(r,t),e.alert&&alert(r)}},t.foo.bar=t,t.foo},ht=function(t,e){var n,r,i,o,a,s,c,l,u;if(e=e||{},i=e.sourceEncoding||"Unicode",a=e.outputEncoding,(e.autoencode||a)&&E[d].metadata&&E[d].metadata[i]&&E[d].metadata[i].encoding&&(o=E[d].metadata[i].encoding,!a&&E[d].encoding&&(a=E[d].encoding),!a&&o.codePages&&(a=o.codePages[0]),"string"==typeof a&&(a=o[a]),a)){for(c=!1,s=[],n=0,r=t.length;n<r;n++)l=a[t.charCodeAt(n)],l?s.push(String.fromCharCode(l)):s.push(t[n]),s[n].charCodeAt(0)>>8&&(c=!0);t=s.join("")}for(n=t.length;void 0===c&&0!==n;)t.charCodeAt(n-1)>>8&&(c=!0),n--;if(!c)return t;for(s=e.noBOM?[]:[254,255],n=0,r=t.length;n<r;n++){if(l=t.charCodeAt(n),u=l>>8,u>>8)throw new Error("Character at position "+n+" of string '"+t+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");s.push(u),s.push(l-(u<<8))}return String.fromCharCode.apply(void 0,s)},ft=function(t,e){return ht(t,e).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},dt=function(){G("/Producer (jsPDF "+r.version+")");for(var t in U)U.hasOwnProperty(t)&&U[t]&&G("/"+t.substr(0,1).toUpperCase()+t.substr(1)+" ("+ft(U[t])+")");var e=new Date,n=e.getTimezoneOffset(),i=n<0?"+":"-",o=Math.floor(Math.abs(n/60)),a=Math.abs(n%60),s=[i,Y(o),"'",Y(a),"'"].join("");G(["/CreationDate (D:",e.getFullYear(),Y(e.getMonth()+1),Y(e.getDate()),Y(e.getHours()),Y(e.getMinutes()),Y(e.getSeconds()),s,")"].join(""))},pt=function(){switch(G("/Type /Catalog"),G("/Pages 1 0 R"),b||(b="fullwidth"),b){case"fullwidth":G("/OpenAction [3 0 R /FitH null]");break;case"fullheight":G("/OpenAction [3 0 R /FitV null]");break;case"fullpage":G("/OpenAction [3 0 R /Fit]");break;case"original":G("/OpenAction [3 0 R /XYZ null null 1]");break;default:var t=""+b;"%"===t.substr(t.length-1)&&(b=parseInt(b)/100),"number"==typeof b&&G("/OpenAction [3 0 R /XYZ null null "+X(b)+"]")}switch(x||(x="continuous"),x){case"continuous":G("/PageLayout /OneColumn");break;case"single":G("/PageLayout /SinglePage");break;case"two":case"twoleft":G("/PageLayout /TwoColumnLeft");break;case"tworight":G("/PageLayout /TwoColumnRight")}v&&G("/PageMode /"+v),W.publish("putCatalog")},gt=function(){G("/Size "+(T+1)),G("/Root "+T+" 0 R"),G("/Info "+(T-1)+" 0 R")},mt=function(t,e){var n="string"==typeof e&&e.toLowerCase();if("string"==typeof t){var r=t.toLowerCase();s.hasOwnProperty(r)&&(t=s[r][0]/p,e=s[r][1]/p)}if(Array.isArray(t)&&(e=t[1],t=t[0]),n){switch(n.substr(0,1)){case"l":e>t&&(n="s");break;case"p":t>e&&(n="s")}"s"===n&&(g=t,t=e,e=g)}I=!0,R[++F]=[],D[F]={width:Number(t)||w,height:Number(e)||y},B[F]={},vt(F)},wt=function(){mt.apply(this,arguments),G(X(q*p)+" w"),G(C),0!==z&&G(z+" J"),0!==L&&G(L+" j"),W.publish("addPage",{pageNumber:F})},yt=function(t){t>0&&t<=F&&(R.splice(t,1),D.splice(t,1),F--,m>F&&(m=F),this.setPage(m))},vt=function(t){t>0&&t<=F&&(m=t,w=D[t].width,y=D[t].height)},bt=function(t,e){var n;switch(t=void 0!==t?t:E[d].fontName,e=void 0!==e?e:E[d].fontStyle,void 0!==t&&(t=t.toLowerCase()),t){case"sans-serif":case"verdana":case"arial":case"helvetica":t="helvetica";break;case"fixed":case"monospace":case"terminal":case"courier":t="courier";break;case"serif":case"cursive":case"fantasy":default:t="times"}try{n=O[t][e]}catch(t){}return n||(n=O.times[e],null==n&&(n=O.times.normal)),n},xt=function(){I=!1,T=2,M=0,j=[],P=[],N=[],W.publish("buildDocument"),G("%PDF-"+o),tt(),at(),ot(),J(),G("<<"),dt(),G(">>"),G("endobj"),J(),G("<<"),pt(),G(">>"),G("endobj");var t,e=M,n="0000000000";for(G("xref"),G("0 "+(T+1)),G(n+" 65535 f "),t=1;t<=T;t++){var r=P[t];G("function"==typeof r?(n+P[t]()).slice(-10)+" 00000 n ":(n+P[t]).slice(-10)+" 00000 n ")}return G("trailer"),G("<<"),gt(),G(">>"),G("startxref"),G(""+e),G("%%EOF"),I=!0,j.join("\n")},kt=function(t){var e="S";return"F"===t?e="f":"FD"===t||"DF"===t?e="B":"f"!==t&&"f*"!==t&&"B"!==t&&"B*"!==t||(e=t),e},_t=function(){for(var t=xt(),e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n);e--;)r[e]=t.charCodeAt(e);return n},Ct=function(){return new Blob([_t()],{type:"application/pdf"})},At=ut(function(t,n){var r="dataur"===(""+t).substr(0,6)?"data:application/pdf;base64,"+btoa(xt()):0;switch(t){case void 0:return xt();case"save":if(navigator.getUserMedia&&(void 0===e.URL||void 0===e.URL.createObjectURL))return H.output("dataurlnewwindow");i(Ct(),n),"function"==typeof i.unload&&e.setTimeout&&setTimeout(i.unload,911);break;case"arraybuffer":return _t();case"blob":return Ct();case"bloburi":case"bloburl":return e.URL&&e.URL.createObjectURL(Ct())||void 0;case"datauristring":case"dataurlstring":return r;case"dataurlnewwindow":var o=e.open(r);if(o||"undefined"==typeof safari)return o;case"datauri":case"dataurl":return e.document.location.href=r;default:throw new Error('Output type "'+t+'" is not supported.')}});switch(l){case"pt":p=1;break;case"mm":p=72/25.4000508;break;case"cm":p=72/2.54000508;break;case"in":p=72;break;case"px":p=96/72;break;case"pc":p=12;break;case"em":p=12;break;case"ex":p=6;break;default:throw"Invalid unit: "+l}H.internal={pdfEscape:ft,getStyle:kt,getFont:function(){return E[bt.apply(H,arguments)]},getFontSize:function(){return A},getLineHeight:function(){return A*S},write:function(t){G(1===arguments.length?t:Array.prototype.join.call(arguments," "))},getCoordinateString:function(t){return X(t*p)},getVerticalCoordinateString:function(t){return X((y-t)*p)},collections:{},newObject:J,newAdditionalObject:Q,newObjectDeferred:K,newObjectDeferredBegin:$,putStream:Z,events:W,scaleFactor:p,pageSize:{get width(){return w},get height(){return y}},output:function(t,e){return At(t,e)},getNumberOfPages:function(){return R.length-1},pages:R,out:G,f2:X,getPageInfo:function(t){var e=2*(t-1)+3;return{objId:e,pageNumber:t,pageContext:B[t]}},getCurrentPageInfo:function(){var t=2*(m-1)+3;return{objId:t,pageNumber:m,pageContext:B[m]}},getPDFVersion:function(){return o}},H.addPage=function(){return wt.apply(this,arguments),this},H.setPage=function(){return vt.apply(this,arguments),this},H.insertPage=function(t){return this.addPage(),this.movePage(m,t),this},H.movePage=function(t,e){if(t>e){for(var n=R[t],r=D[t],i=B[t],o=t;o>e;o--)R[o]=R[o-1],D[o]=D[o-1],B[o]=B[o-1];R[e]=n,D[e]=r,B[e]=i,this.setPage(e)}else if(t<e){for(var n=R[t],r=D[t],i=B[t],o=t;o<e;o++)R[o]=R[o+1],D[o]=D[o+1],B[o]=B[o+1];R[e]=n,D[e]=r,B[e]=i,this.setPage(e)}return this},H.deletePage=function(){return yt.apply(this,arguments),this},H.setDisplayMode=function(t,e,n){return b=t,x=e,v=n,this},H.text=function(t,e,n,r,i,o){function a(t){return t=t.split("\t").join(Array(f.TabLen||9).join(" ")),ft(t,r)}"number"==typeof t&&(g=n,n=e,e=t,t=g),"string"==typeof t&&(t=t.match(/[\n\r]/)?t.split(/\r\n|\r|\n/g):[t]),"string"==typeof i&&(o=i,i=null),"string"==typeof r&&(o=r,r=null),"number"==typeof r&&(i=r,r=null);var s,c="",l="Td";if(i){i*=Math.PI/180;var u=Math.cos(i),h=Math.sin(i);c=[X(u),X(h),X(h*-1),X(u),""].join(" "),l="Tm"}r=r||{},"noBOM"in r||(r.noBOM=!0),"autoencode"in r||(r.autoencode=!0);var m="",w=this.internal.getCurrentPageInfo().pageContext;if(!0===r.stroke?w.lastTextWasStroke!==!0&&(m="1 Tr\n",w.lastTextWasStroke=!0):(w.lastTextWasStroke&&(m="0 Tr\n"),w.lastTextWasStroke=!1),"undefined"==typeof this._runningPageHeight&&(this._runningPageHeight=0),"string"==typeof t)t=a(t);else{if("[object Array]"!==Object.prototype.toString.call(t))throw new Error('Type of text must be string or Array. "'+t+'" is not recognized.');for(var v=t.concat(),b=[],x=v.length;x--;)b.push(a(v.shift()));var k=Math.ceil((y-n-this._runningPageHeight)*p/(A*S));if(0<=k&&k<b.length+1,o){var C,q,T,I=A*S,P=t.map(function(t){return this.getStringUnitWidth(t)*A/p},this);if(T=Math.max.apply(Math,P),"center"===o)C=e-T/2,e-=P[0]/2;else{if("right"!==o)throw new Error('Unrecognized alignment option, use "center" or "right".');C=e-T,e-=P[0]}q=e,t=b[0];for(var E=1,x=b.length;E<x;E++){var O=T-P[E];"center"===o&&(O/=2),t+=") Tj\n"+(C-q+O)+" -"+I+" Td ("+b[E],q=C+O}}else t=b.join(") Tj\nT* (")}var F;return s||(F=X((y-n)*p)),G("BT\n/"+d+" "+A+" Tf\n"+A*S+" TL\n"+m+_+"\n"+c+X(e*p)+" "+F+" "+l+"\n("+t+") Tj\nET"),s&&this.text(s,e,n),this},H.lstext=function(t,e,n,r){for(var i=0,o=t.length;i<o;i++,e+=r)this.text(t[i],e,n)},H.line=function(t,e,n,r){return this.lines([[n-t,r-e]],t,e)},H.clip=function(){G("W"),G("S")},H.clip_fixed=function(t){G("evenodd"===t?"W*":"W"),G("n")},H.lines=function(t,e,n,r,i,o){var a,s,c,l,u,h,f,d,m,w,v;for("number"==typeof t&&(g=n,n=e,e=t,t=g),r=r||[1,1],G(V(e*p)+" "+V((y-n)*p)+" m "),a=r[0],s=r[1],l=t.length,w=e,v=n,c=0;c<l;c++)u=t[c],2===u.length?(w=u[0]*a+w,v=u[1]*s+v,G(V(w*p)+" "+V((y-v)*p)+" l")):(h=u[0]*a+w,f=u[1]*s+v,d=u[2]*a+w,m=u[3]*s+v,w=u[4]*a+w,v=u[5]*s+v,G(V(h*p)+" "+V((y-f)*p)+" "+V(d*p)+" "+V((y-m)*p)+" "+V(w*p)+" "+V((y-v)*p)+" c"));return o&&G(" h"),null!==i&&G(kt(i)),this},H.rect=function(t,e,n,r,i){kt(i);return G([X(t*p),X((y-e)*p),X(n*p),X(-r*p),"re"].join(" ")),null!==i&&G(kt(i)),this},H.triangle=function(t,e,n,r,i,o,a){return this.lines([[n-t,r-e],[i-n,o-r],[t-i,e-o]],t,e,[1,1],a,!0),this},H.roundedRect=function(t,e,n,r,i,o,a){var s=4/3*(Math.SQRT2-1);return this.lines([[n-2*i,0],[i*s,0,i,o-o*s,i,o],[0,r-2*o],[0,o*s,-(i*s),o,-i,o],[-n+2*i,0],[-(i*s),0,-i,-(o*s),-i,-o],[0,-r+2*o],[0,-(o*s),i*s,-o,i,-o]],t+i,e,[1,1],a),this},H.ellipse=function(t,e,n,r,i){var o=4/3*(Math.SQRT2-1)*n,a=4/3*(Math.SQRT2-1)*r;return G([X((t+n)*p),X((y-e)*p),"m",X((t+n)*p),X((y-(e-a))*p),X((t+o)*p),X((y-(e-r))*p),X(t*p),X((y-(e-r))*p),"c"].join(" ")),G([X((t-o)*p),X((y-(e-r))*p),X((t-n)*p),X((y-(e-a))*p),X((t-n)*p),X((y-e)*p),"c"].join(" ")),G([X((t-n)*p),X((y-(e+a))*p),X((t-o)*p),X((y-(e+r))*p),X(t*p),X((y-(e+r))*p),"c"].join(" ")),G([X((t+o)*p),X((y-(e+r))*p),X((t+n)*p),X((y-(e+a))*p),X((t+n)*p),X((y-e)*p),"c"].join(" ")),null!==i&&G(kt(i)),this},H.circle=function(t,e,n,r){return this.ellipse(t,e,n,n,r)},H.setProperties=function(t){for(var e in U)U.hasOwnProperty(e)&&t[e]&&(U[e]=t[e]);return this},H.setFontSize=function(t){return A=t,this},H.setFont=function(t,e){return d=bt(t,e),this},H.setFontStyle=H.setFontType=function(t){return d=bt(void 0,t),this},H.getFontList=function(){var t,e,n,r={};for(t in O)if(O.hasOwnProperty(t)){r[t]=n=[];for(e in O[t])O[t].hasOwnProperty(e)&&n.push(e)}return r},H.addFont=function(t,e,n){ct(t,e,n,"StandardEncoding")},H.setLineWidth=function(t){return G((t*p).toFixed(2)+" w"),this},H.setDrawColor=function(t,e,n,r){var i;return i=void 0===e||void 0===r&&t===e===n?"string"==typeof t?t+" G":X(t/255)+" G":void 0===r?"string"==typeof t?[t,e,n,"RG"].join(" "):[X(t/255),X(e/255),X(n/255),"RG"].join(" "):"string"==typeof t?[t,e,n,r,"K"].join(" "):[X(t),X(e),X(n),X(r),"K"].join(" "),G(i),this},H.setFillColor=function(e,n,r,i){var o;return void 0===n||void 0===i&&e===n===r?o="string"==typeof e?e+" g":X(e/255)+" g":void 0===i||"object"===("undefined"==typeof i?"undefined":t(i))?(o="string"==typeof e?[e,n,r,"rg"].join(" "):[X(e/255),X(n/255),X(r/255),"rg"].join(" "),i&&0===i.a&&(o=["255","255","255","rg"].join(" "))):o="string"==typeof e?[e,n,r,i,"k"].join(" "):[X(e),X(n),X(r),X(i),"k"].join(" "),G(o),this},H.setTextColor=function(t,e,n){if("string"==typeof t&&/^#[0-9A-Fa-f]{6}$/.test(t)){var r=parseInt(t.substr(1),16);t=r>>16&255,e=r>>8&255,n=255&r}return _=0===t&&0===e&&0===n||"undefined"==typeof e?V(t/255)+" g":[V(t/255),V(e/255),V(n/255),"rg"].join(" "),this},H.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},H.setLineCap=function(t){var e=this.CapJoinStyles[t];if(void 0===e)throw new Error("Line cap style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return z=e,G(e+" J"),this},H.setLineJoin=function(t){var e=this.CapJoinStyles[t];if(void 0===e)throw new Error("Line join style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return L=e,G(e+" j"),this},H.output=At,H.save=function(t){H.output("save",t)};for(var St in r.API)r.API.hasOwnProperty(St)&&("events"===St&&r.API.events.length?!function(t,e){var n,r,i;for(i=e.length-1;i!==-1;i--)n=e[i][0],r=e[i][1],t.subscribe.apply(t,[n].concat("function"==typeof r?[r]:r))}(W,r.API.events):H[St]=r.API[St]);return lt(),d="F1",wt(u,c),W.publish("initialized"),H}var o="1.3",s={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};return r.API={events:[]},r.version="1.3.2 2016-09-30T20:33:18.867Z:jameshall","function"==typeof define&&define.amd?define("jsPDF",function(){return r}):"undefined"!=typeof module&&module.exports?module.exports=r:e.jsPDF=r,r}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||void 0);window.tmp=e,/**+ * jsPDF AcroForm Plugin+ * Copyright (c) 2016 Alexander Weidt, https://github.com/BiggA94+ *+ * Licensed under the MIT License.+ * http://opensource.org/licenses/mit-license+ */+ (window.AcroForm=function(t){var n=window.AcroForm;n.scale=function(t){return t*(r.internal.scaleFactor/1)},n.antiScale=function(t){return 1/r.internal.scaleFactor*t};var r={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null};e.API.acroformPlugin=r;var i=function(){for(var t in this.acroformPlugin.acroFormDictionaryRoot.Fields){var e=this.acroformPlugin.acroFormDictionaryRoot.Fields[t];e.hasAnnotation&&a.call(this,e)}},o=function(){if(this.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");this.acroformPlugin.acroFormDictionaryRoot=new n.AcroFormDictionary,this.acroformPlugin.internal=this.internal,this.acroformPlugin.acroFormDictionaryRoot._eventID=this.internal.events.subscribe("postPutResources",l),this.internal.events.subscribe("buildDocument",i),this.internal.events.subscribe("putCatalog",c),this.internal.events.subscribe("postPutPages",u)},a=function(t){var n={type:"reference",object:t};e.API.annotationPlugin.annotations[this.internal.getPageInfo(t.page).pageNumber].push(n)},s=function(t){this.acroformPlugin.printedOut&&(this.acroformPlugin.printedOut=!1,this.acroformPlugin.acroFormDictionaryRoot=null),this.acroformPlugin.acroFormDictionaryRoot||o.call(this),this.acroformPlugin.acroFormDictionaryRoot.Fields.push(t)},c=function(){"undefined"!=typeof this.acroformPlugin.acroFormDictionaryRoot?this.internal.write("/AcroForm "+this.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R"):console.log("Root missing...")},l=function(){this.internal.events.unsubscribe(this.acroformPlugin.acroFormDictionaryRoot._eventID),delete this.acroformPlugin.acroFormDictionaryRoot._eventID,this.acroformPlugin.printedOut=!0},u=function(t){var e=!t;t||(this.internal.newObjectDeferredBegin(this.acroformPlugin.acroFormDictionaryRoot.objId),this.internal.out(this.acroformPlugin.acroFormDictionaryRoot.getString()));var t=t||this.acroformPlugin.acroFormDictionaryRoot.Kids;for(var r in t){var i=t[r],o=i.Rect;i.Rect&&(i.Rect=n.internal.calculateCoordinates.call(this,i.Rect)),this.internal.newObjectDeferredBegin(i.objId);var a="";if(a+=i.objId+" 0 obj\n",a+="<<\n"+i.getContent(),i.Rect=o,i.hasAppearanceStream&&!i.appearanceStreamContent){var s=n.internal.calculateAppearanceStream.call(this,i);a+="/AP << /N "+s+" >>\n",this.acroformPlugin.xForms.push(s)}if(i.appearanceStreamContent){a+="/AP << ";for(var c in i.appearanceStreamContent){var l=i.appearanceStreamContent[c];if(a+="/"+c+" ",a+="<< ",Object.keys(l).length>=1||Array.isArray(l))for(var r in l){var u=l[r];"function"==typeof u&&(u=u.call(this,i)),a+="/"+r+" "+u+" ",this.acroformPlugin.xForms.indexOf(u)>=0||this.acroformPlugin.xForms.push(u)}else{var u=l;"function"==typeof u&&(u=u.call(this,i)),a+="/"+r+" "+u+" \n",this.acroformPlugin.xForms.indexOf(u)>=0||this.acroformPlugin.xForms.push(u)}a+=" >>\n"}a+=">>\n"}a+=">>\nendobj\n",this.internal.out(a)}e&&h.call(this,this.acroformPlugin.xForms)},h=function(t){for(var e in t){var n=e,r=t[e];this.internal.newObjectDeferredBegin(r&&r.objId);var i="";i+=r?r.getString():"",this.internal.out(i),delete t[n]}};t.addField=function(t){return t instanceof n.TextField?d.call(this,t):t instanceof n.ChoiceField?p.call(this,t):t instanceof n.Button?f.call(this,t):t instanceof n.ChildClass?s.call(this,t):t&&s.call(this,t),t.page=this.acroformPlugin.internal.getCurrentPageInfo().pageNumber,this};var f=function(t){var t=t||new n.Field;t.FT="/Btn";var e=t.Ff||0;t.pushbutton&&(e=n.internal.setBitPosition(e,17),delete t.pushbutton),t.radio&&(e=n.internal.setBitPosition(e,16),delete t.radio),t.noToggleToOff&&(e=n.internal.setBitPosition(e,15)),t.Ff=e,s.call(this,t)},d=function(t){var t=t||new n.Field;t.FT="/Tx";var e=t.Ff||0;t.multiline&&(e=4096|e),t.password&&(e=8192|e),t.fileSelect&&(e|=1<<20),t.doNotSpellCheck&&(e|=1<<22),t.doNotScroll&&(e|=1<<23),t.Ff=t.Ff||e,s.call(this,t)},p=function(t){var e=t||new n.Field;e.FT="/Ch";var r=e.Ff||0;e.combo&&(r=n.internal.setBitPosition(r,18),delete e.combo),e.edit&&(r=n.internal.setBitPosition(r,19),delete e.edit),e.sort&&(r=n.internal.setBitPosition(r,20),delete e.sort),e.multiSelect&&this.internal.getPDFVersion()>=1.4&&(r=n.internal.setBitPosition(r,22),delete e.multiSelect),e.doNotSpellCheck&&this.internal.getPDFVersion()>=1.4&&(r=n.internal.setBitPosition(r,23),delete e.doNotSpellCheck),e.Ff=r,s.call(this,e)}})(e.API);var n=window.AcroForm;n.internal={},n.createFormXObject=function(t){var e=new n.FormXObject,r=n.Appearance.internal.getHeight(t)||0,i=n.Appearance.internal.getWidth(t)||0;return e.BBox=[0,0,i,r],e},n.Appearance={CheckBox:{createAppearanceStream:function(){var t={N:{On:n.Appearance.CheckBox.YesNormal},D:{On:n.Appearance.CheckBox.YesPushDown,Off:n.Appearance.CheckBox.OffPushDown}};return t},createMK:function(){return"<< /CA (3)>>"},YesPushDown:function(t){var e=n.createFormXObject(t),r="";t.Q=1;var i=n.internal.calculateX(t,"3","ZapfDingbats",50);return r+="0.749023 g\n 0 0 "+n.Appearance.internal.getWidth(t)+" "+n.Appearance.internal.getHeight(t)+" re\n f\n BMC\n q\n 0 0 1 rg\n /F13 "+i.fontSize+" Tf 0 g\n BT\n",r+=i.text,r+="ET\n Q\n EMC\n",e.stream=r,e},YesNormal:function(t){var e=n.createFormXObject(t),r="";t.Q=1;var i=n.internal.calculateX(t,"3","ZapfDingbats",.9*n.Appearance.internal.getHeight(t));return r+="1 g\n0 0 "+n.Appearance.internal.getWidth(t)+" "+n.Appearance.internal.getHeight(t)+" re\nf\nq\n0 0 1 rg\n0 0 "+(n.Appearance.internal.getWidth(t)-1)+" "+(n.Appearance.internal.getHeight(t)-1)+" re\nW\nn\n0 g\nBT\n/F13 "+i.fontSize+" Tf 0 g\n",r+=i.text,r+="ET\n Q\n",e.stream=r,e},OffPushDown:function(t){var e=n.createFormXObject(t),r="";return r+="0.749023 g\n 0 0 "+n.Appearance.internal.getWidth(t)+" "+n.Appearance.internal.getHeight(t)+" re\n f\n",e.stream=r,e}},RadioButton:{Circle:{createAppearanceStream:function(t){var e={D:{Off:n.Appearance.RadioButton.Circle.OffPushDown},N:{}};return e.N[t]=n.Appearance.RadioButton.Circle.YesNormal,e.D[t]=n.Appearance.RadioButton.Circle.YesPushDown,e},createMK:function(){return"<< /CA (l)>>"},YesNormal:function(t){var e=n.createFormXObject(t),r="",i=n.Appearance.internal.getWidth(t)<=n.Appearance.internal.getHeight(t)?n.Appearance.internal.getWidth(t)/4:n.Appearance.internal.getHeight(t)/4;i*=.9;var o=n.Appearance.internal.Bezier_C;return r+="q\n1 0 0 1 "+n.Appearance.internal.getWidth(t)/2+" "+n.Appearance.internal.getHeight(t)/2+" cm\n"+i+" 0 m\n"+i+" "+i*o+" "+i*o+" "+i+" 0 "+i+" c\n-"+i*o+" "+i+" -"+i+" "+i*o+" -"+i+" 0 c\n-"+i+" -"+i*o+" -"+i*o+" -"+i+" 0 -"+i+" c\n"+i*o+" -"+i+" "+i+" -"+i*o+" "+i+" 0 c\nf\nQ\n",e.stream=r,e},YesPushDown:function(t){var e=n.createFormXObject(t),r="",i=n.Appearance.internal.getWidth(t)<=n.Appearance.internal.getHeight(t)?n.Appearance.internal.getWidth(t)/4:n.Appearance.internal.getHeight(t)/4;i*=.9;var o=2*i,a=o*n.Appearance.internal.Bezier_C,s=i*n.Appearance.internal.Bezier_C;return r+="0.749023 g\n q\n 1 0 0 1 "+n.Appearance.internal.getWidth(t)/2+" "+n.Appearance.internal.getHeight(t)/2+" cm\n"+o+" 0 m\n"+o+" "+a+" "+a+" "+o+" 0 "+o+" c\n-"+a+" "+o+" -"+o+" "+a+" -"+o+" 0 c\n-"+o+" -"+a+" -"+a+" -"+o+" 0 -"+o+" c\n"+a+" -"+o+" "+o+" -"+a+" "+o+" 0 c\n f\n Q\n 0 g\n q\n 1 0 0 1 "+n.Appearance.internal.getWidth(t)/2+" "+n.Appearance.internal.getHeight(t)/2+" cm\n"+i+" 0 m\n"+i+" "+s+" "+s+" "+i+" 0 "+i+" c\n-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c\n-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c\n"+s+" -"+i+" "+i+" -"+s+" "+i+" 0 c\n f\n Q\n",e.stream=r,e},OffPushDown:function(t){var e=n.createFormXObject(t),r="",i=n.Appearance.internal.getWidth(t)<=n.Appearance.internal.getHeight(t)?n.Appearance.internal.getWidth(t)/4:n.Appearance.internal.getHeight(t)/4;i*=.9;var o=2*i,a=o*n.Appearance.internal.Bezier_C;return r+="0.749023 g\n q\n 1 0 0 1 "+n.Appearance.internal.getWidth(t)/2+" "+n.Appearance.internal.getHeight(t)/2+" cm\n"+o+" 0 m\n"+o+" "+a+" "+a+" "+o+" 0 "+o+" c\n-"+a+" "+o+" -"+o+" "+a+" -"+o+" 0 c\n-"+o+" -"+a+" -"+a+" -"+o+" 0 -"+o+" c\n"+a+" -"+o+" "+o+" -"+a+" "+o+" 0 c\n f\n Q\n",e.stream=r,e}},Cross:{createAppearanceStream:function(t){var e={D:{Off:n.Appearance.RadioButton.Cross.OffPushDown},N:{}};return e.N[t]=n.Appearance.RadioButton.Cross.YesNormal,e.D[t]=n.Appearance.RadioButton.Cross.YesPushDown,e},createMK:function(){return"<< /CA (8)>>"},YesNormal:function(t){var e=n.createFormXObject(t),r="",i=n.Appearance.internal.calculateCross(t);return r+="q\n 1 1 "+(n.Appearance.internal.getWidth(t)-2)+" "+(n.Appearance.internal.getHeight(t)-2)+" re\n W\n n\n "+i.x1.x+" "+i.x1.y+" m\n "+i.x2.x+" "+i.x2.y+" l\n "+i.x4.x+" "+i.x4.y+" m\n "+i.x3.x+" "+i.x3.y+" l\n s\n Q\n",e.stream=r,e},YesPushDown:function(t){var e=n.createFormXObject(t),r=n.Appearance.internal.calculateCross(t),i="";return i+="0.749023 g\n 0 0 "+n.Appearance.internal.getWidth(t)+" "+n.Appearance.internal.getHeight(t)+" re\n f\n q\n 1 1 "+(n.Appearance.internal.getWidth(t)-2)+" "+(n.Appearance.internal.getHeight(t)-2)+" re\n W\n n\n "+r.x1.x+" "+r.x1.y+" m\n "+r.x2.x+" "+r.x2.y+" l\n "+r.x4.x+" "+r.x4.y+" m\n "+r.x3.x+" "+r.x3.y+" l\n s\n Q\n",e.stream=i,e},OffPushDown:function(t){var e=n.createFormXObject(t),r="";return r+="0.749023 g\n 0 0 "+n.Appearance.internal.getWidth(t)+" "+n.Appearance.internal.getHeight(t)+" re\n f\n",e.stream=r,e}}},createDefaultAppearanceStream:function(t){var e="";return e+="/Helv 0 Tf 0 g"}},n.Appearance.internal={Bezier_C:.551915024494,calculateCross:function(t){var e=function(t,e){return t>e?e:t},r=n.Appearance.internal.getWidth(t),i=n.Appearance.internal.getHeight(t),o=e(r,i),a={x1:{x:(r-o)/2,y:(i-o)/2+o},x2:{x:(r-o)/2+o,y:(i-o)/2},x3:{x:(r-o)/2,y:(i-o)/2},x4:{x:(r-o)/2+o,y:(i-o)/2+o}};return a}},n.Appearance.internal.getWidth=function(t){return t.Rect[2]},n.Appearance.internal.getHeight=function(t){return t.Rect[3]},n.internal.inherit=function(t,e){Object.create||function(t){var e=function(){};return e.prototype=t,new e};t.prototype=Object.create(e.prototype),t.prototype.constructor=t},n.internal.arrayToPdfArray=function(t){if(Array.isArray(t)){var e=" [";for(var n in t){var r=t[n].toString();e+=r,e+=n<t.length-1?" ":""}return e+="]"}},n.internal.toPdfString=function(t){return t=t||"",0!==t.indexOf("(")&&(t="("+t),")"!=t.substring(t.length-1)&&(t+="("),t},n.PDFObject=function(){var t;Object.defineProperty(this,"objId",{get:function(){return t||(this.internal?t=this.internal.newObjectDeferred():e.API.acroformPlugin.internal&&(t=e.API.acroformPlugin.internal.newObjectDeferred())),t||console.log("Couldn't create Object ID"),t},configurable:!1})},n.PDFObject.prototype.toString=function(){return this.objId+" 0 R"},n.PDFObject.prototype.getString=function(){var t=this.objId+" 0 obj\n<<",e=this.getContent();return t+=e+">>\n",this.stream&&(t+="stream\n",t+=this.stream,t+="endstream\n"),t+="endobj\n"},n.PDFObject.prototype.getContent=function(){var t=function(t){var e="",r=Object.keys(t).filter(function(t){return"content"!=t&&"appearanceStreamContent"!=t&&"_"!=t.substring(0,1)});for(var i in r){var o=r[i],a=t[o];a&&(e+=Array.isArray(a)?"/"+o+" "+n.internal.arrayToPdfArray(a)+"\n":a instanceof n.PDFObject?"/"+o+" "+a.objId+" 0 R\n":"/"+o+" "+a+"\n")}return e},e="";return e+=t(this)},n.FormXObject=function(){n.PDFObject.call(this),this.Type="/XObject",this.Subtype="/Form",this.FormType=1,this.BBox,this.Matrix,this.Resources="2 0 R",this.PieceInfo;var t;Object.defineProperty(this,"Length",{enumerable:!0,get:function(){return void 0!==t?t.length:0}}),Object.defineProperty(this,"stream",{enumerable:!1,set:function(e){t=e},get:function(){return t?t:null}})},n.internal.inherit(n.FormXObject,n.PDFObject),n.AcroFormDictionary=function(){n.PDFObject.call(this);var t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!0,configurable:!0,get:function(){return t}}),this.DA},n.internal.inherit(n.AcroFormDictionary,n.PDFObject),n.Field=function(){n.PDFObject.call(this);var t;Object.defineProperty(this,"Rect",{enumerable:!0,configurable:!1,get:function(){if(t){var e=t;return e}},set:function(e){t=e}});var e="";Object.defineProperty(this,"FT",{enumerable:!0,set:function(t){e=t},get:function(){return e}});var r;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,set:function(t){r=t},get:function(){if(!r||r.length<1){if(this instanceof n.ChildClass)return;return"(FieldObject"+n.Field.FieldNum++ +")"}return"("==r.substring(0,1)&&r.substring(r.length-1)?r:"("+r+")"}});var i;Object.defineProperty(this,"DA",{enumerable:!0,get:function(){if(i)return"("+i+")"},set:function(t){i=t}});var o;Object.defineProperty(this,"DV",{enumerable:!0,configurable:!0,get:function(){if(o)return o},set:function(t){o=t}}),Object.defineProperty(this,"Type",{enumerable:!0,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,get:function(){return this.hasAnnotation?"/Widget":null}}),this.BG,Object.defineProperty(this,"hasAnnotation",{enumerable:!1,get:function(){return!!(this.Rect||this.BC||this.BG)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(this,"page",{enumerable:!1,configurable:!0,writable:!0})},n.Field.FieldNum=0,n.internal.inherit(n.Field,n.PDFObject),n.ChoiceField=function(){n.Field.call(this),this.FT="/Ch",this.Opt=[],this.V="()",this.TI=0,this.combo=!1,Object.defineProperty(this,"edit",{enumerable:!0,set:function(t){1==t?(this._edit=!0,this.combo=!0):this._edit=!1},get:function(){return!!this._edit&&this._edit},configurable:!1}),this.hasAppearanceStream=!0,Object.defineProperty(this,"V",{get:function(){n.internal.toPdfString()}})},n.internal.inherit(n.ChoiceField,n.Field),window.ChoiceField=n.ChoiceField,n.ListBox=function(){n.ChoiceField.call(this)},n.internal.inherit(n.ListBox,n.ChoiceField),window.ListBox=n.ListBox,n.ComboBox=function(){n.ListBox.call(this),this.combo=!0},n.internal.inherit(n.ComboBox,n.ListBox),window.ComboBox=n.ComboBox,n.EditBox=function(){n.ComboBox.call(this),this.edit=!0},n.internal.inherit(n.EditBox,n.ComboBox),window.EditBox=n.EditBox,n.Button=function(){n.Field.call(this),this.FT="/Btn"},n.internal.inherit(n.Button,n.Field),window.Button=n.Button,n.PushButton=function(){n.Button.call(this),this.pushbutton=!0},n.internal.inherit(n.PushButton,n.Button),window.PushButton=n.PushButton,n.RadioButton=function(){n.Button.call(this),this.radio=!0;var t=[];Object.defineProperty(this,"Kids",{enumerable:!0,get:function(){if(t.length>0)return t}}),Object.defineProperty(this,"__Kids",{get:function(){return t}});var e;Object.defineProperty(this,"noToggleToOff",{enumerable:!1,get:function(){return e},set:function(t){e=t}})},n.internal.inherit(n.RadioButton,n.Button),window.RadioButton=n.RadioButton,n.ChildClass=function(t,e){n.Field.call(this),this.Parent=t,this._AppearanceType=n.Appearance.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(e),this.F=n.internal.setBitPosition(this.F,3,1),this.MK=this._AppearanceType.createMK(),this.AS="/Off",this._Name=e},n.internal.inherit(n.ChildClass,n.Field),n.RadioButton.prototype.setAppearance=function(t){if(!("createAppearanceStream"in t&&"createMK"in t))return void console.log("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var e in this.__Kids){var n=this.__Kids[e];n.appearanceStreamContent=t.createAppearanceStream(n._Name),n.MK=t.createMK()}},n.RadioButton.prototype.createOption=function(t){var r=this,i=(this.__Kids.length,new n.ChildClass(r,t));return this.__Kids.push(i),e.API.addField(i),i},n.CheckBox=function(){Button.call(this),this.appearanceStreamContent=n.Appearance.CheckBox.createAppearanceStream(),this.MK=n.Appearance.CheckBox.createMK(),this.AS="/On",this.V="/On"},n.internal.inherit(n.CheckBox,n.Button),window.CheckBox=n.CheckBox,n.TextField=function(){n.Field.call(this),this.DA=n.Appearance.createDefaultAppearanceStream(),this.F=4;var t;Object.defineProperty(this,"V",{get:function(){return t?"("+t+")":t},enumerable:!0,set:function(e){t=e}});var e;Object.defineProperty(this,"DV",{get:function(){return e?"("+e+")":e},enumerable:!0,set:function(t){e=t}});var r=!1;Object.defineProperty(this,"multiline",{enumerable:!1,get:function(){return r},set:function(t){r=t}});var i=!1;Object.defineProperty(this,"MaxLen",{enumerable:!0,get:function(){return i},set:function(t){i=t}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!1,get:function(){return this.V||this.DV}})},n.internal.inherit(n.TextField,n.Field),window.TextField=n.TextField,n.PasswordField=function(){TextField.call(this),Object.defineProperty(this,"password",{value:!0,enumerable:!1,configurable:!1,writable:!1})},n.internal.inherit(n.PasswordField,n.TextField),window.PasswordField=n.PasswordField,n.internal.calculateFontSpace=function(t,e,r){var r=r||"helvetica",i=n.internal.calculateFontSpace.canvas||(n.internal.calculateFontSpace.canvas=document.createElement("canvas")),o=i.getContext("2d");o.save();var a=e+" "+r;o.font=a;var s=o.measureText(t);o.fontcolor="black";var o=i.getContext("2d");s.height=1.5*o.measureText("3").width,o.restore();s.width;return s},n.internal.calculateX=function(t,e,r,i){var i=i||12,r=r||"helvetica",o={text:"",fontSize:""};e="("==e.substr(0,1)?e.substr(1):e,e=")"==e.substr(e.length-1)?e.substr(0,e.length-1):e;var a=e.split(" "),s=i,c=2,l=2,u=n.Appearance.internal.getHeight(t)||0;u=u<0?-u:u;var h=n.Appearance.internal.getWidth(t)||0;h=h<0?-h:h;var f=function(t,e,i){if(t+1<a.length){var o=e+" "+a[t+1],s=n.internal.calculateFontSpace(o,i+"px",r).width,c=h-2*l;return s<=c}return!1};s++;t:for(;;){var e="";s--;var d=n.internal.calculateFontSpace("3",s+"px",r).height,p=t.multiline?u-s:(u-d)/2;p+=c;var g=-l,m=g,w=p,y=0,v=0,b=0;if(0==s){s=12,e="(...) Tj\n",e+="% Width of Text: "+n.internal.calculateFontSpace(e,"1px").width+", FieldWidth:"+h+"\n";break}b=n.internal.calculateFontSpace(a[0]+" ",s+"px",r).width;var x="",k=0;for(var _ in a){x+=a[_]+" ",x=" "==x.substr(x.length-1)?x.substr(0,x.length-1):x;var C=parseInt(_);b=n.internal.calculateFontSpace(x+" ",s+"px",r).width;var A=f(C,x,s),S=_>=a.length-1;if(!A||S){if(A||S){if(S)v=C;else if(t.multiline&&(d+c)*(k+2)+c>u)continue t}else{if(!t.multiline)continue t;if((d+c)*(k+2)+c>u)continue t;v=C}for(var q="",T=y;T<=v;T++)q+=a[T]+" ";switch(q=" "==q.substr(q.length-1)?q.substr(0,q.length-1):q,b=n.internal.calculateFontSpace(q,s+"px",r).width,t.Q){case 2:g=h-b-l;break;case 1:g=(h-b)/2;break;case 0:default:g=l}e+=g+" "+w+" Td\n",e+="("+q+") Tj\n",e+=-g+" 0 Td\n",w=-(s+c),m=g,b=0,y=v+1,k++,x=""}else x+=" "}break}return o.text=e,o.fontSize=s,o},n.internal.calculateAppearanceStream=function(t){if(t.appearanceStreamContent)return t.appearanceStreamContent;if(t.V||t.DV){var e="",r=t.V||t.DV,i=n.internal.calculateX(t,r);e+="/Tx BMC\nq\n/F1 "+i.fontSize+" Tf\n1 0 0 1 0 0 Tm\n",e+="BT\n",e+=i.text,e+="ET\n",e+="Q\nEMC\n";var o=new n.createFormXObject(t);o.stream=e;return o}},n.internal.calculateCoordinates=function(t,e,r,i){var o={};if(this.internal){var a=function(t){return t*this.internal.scaleFactor};Array.isArray(t)?(t[0]=n.scale(t[0]),t[1]=n.scale(t[1]),t[2]=n.scale(t[2]),t[3]=n.scale(t[3]),o.lowerLeft_X=t[0]||0,o.lowerLeft_Y=a.call(this,this.internal.pageSize.height)-t[3]-t[1]||0,o.upperRight_X=t[0]+t[2]||0,o.upperRight_Y=a.call(this,this.internal.pageSize.height)-t[1]||0):(t=n.scale(t),e=n.scale(e),r=n.scale(r),i=n.scale(i),o.lowerLeft_X=t||0,o.lowerLeft_Y=this.internal.pageSize.height-e||0,o.upperRight_X=t+r||0,o.upperRight_Y=this.internal.pageSize.height-e+i||0)}else Array.isArray(t)?(o.lowerLeft_X=t[0]||0,o.lowerLeft_Y=t[1]||0,o.upperRight_X=t[0]+t[2]||0,o.upperRight_Y=t[1]+t[3]||0):(o.lowerLeft_X=t||0,o.lowerLeft_Y=e||0,o.upperRight_X=t+r||0,o.upperRight_Y=e+i||0);return[o.lowerLeft_X,o.lowerLeft_Y,o.upperRight_X,o.upperRight_Y]},n.internal.calculateColor=function(t,e,n){var r=new Array(3);return r.r=0|t,r.g=0|e,r.b=0|n,r},n.internal.getBitPosition=function(t,e){t=t||0;var n=1;return n<<=e-1,t|n},n.internal.setBitPosition=function(t,e,n){t=t||0,n=n||1;var r=1;if(r<<=e-1,1==n)var t=t|r;else var t=t&~r;return t},/**+ * jsPDF addHTML PlugIn+ * Copyright (c) 2014 Diego Casorran+ *+ * Licensed under the MIT License.+ * http://opensource.org/licenses/mit-license+ */+ function(t){t.addHTML=function(t,e,n,r,i){if("undefined"==typeof html2canvas&&"undefined"==typeof rasterizeHTML)throw new Error("You need either https://github.com/niklasvh/html2canvas or https://github.com/cburgmer/rasterizeHTML.js");"number"!=typeof e&&(r=e,i=n),"function"==typeof r&&(i=r,r=null);var o=this.internal,a=o.scaleFactor,s=o.pageSize.width,c=o.pageSize.height;if(r=r||{},r.onrendered=function(t){e=parseInt(e)||0,n=parseInt(n)||0;var o=r.dim||{},l=o.h||0,u=o.w||Math.min(s,t.width/a)-e,h="JPEG";if(r.format&&(h=r.format),t.height>c&&r.pagesplit){var f=function(){for(var r=0;;){var o=document.createElement("canvas");o.width=Math.min(s*a,t.width),o.height=Math.min(c*a,t.height-r);var l=o.getContext("2d");l.drawImage(t,0,r,t.width,o.height,0,0,o.width,o.height);var f=[o,e,r?0:n,o.width/a,o.height/a,h,null,"SLOW"];if(this.addImage.apply(this,f),r+=o.height,r>=t.height)break;this.addPage()}i(u,r,null,f)}.bind(this);if("CANVAS"===t.nodeName){var d=new Image;d.onload=f,d.src=t.toDataURL("image/png"),t=d}else f()}else{var p=Math.random().toString(35),g=[t,e,n,u,l,h,p,"SLOW"];this.addImage.apply(this,g),i(u,l,p,g)}}.bind(this),"undefined"!=typeof html2canvas&&!r.rstz)return html2canvas(t,r);if("undefined"!=typeof rasterizeHTML){var l="drawDocument";return"string"==typeof t&&(l=/^http/.test(t)?"drawURL":"drawHTML"),r.width=r.width||s*a,rasterizeHTML[l](t,void 0,r).then(function(t){r.onrendered(t.image)},function(t){i(null,t)})}return null}}(e.API),function(e){var n="addImage_",r=["jpeg","jpg","png"],i=function t(e){var n=this.internal.newObject(),r=this.internal.write,i=this.internal.putStream;if(e.n=n,r("<</Type /XObject"),r("/Subtype /Image"),r("/Width "+e.w),r("/Height "+e.h),e.cs===this.color_spaces.INDEXED?r("/ColorSpace [/Indexed /DeviceRGB "+(e.pal.length/3-1)+" "+("smask"in e?n+2:n+1)+" 0 R]"):(r("/ColorSpace /"+e.cs),e.cs===this.color_spaces.DEVICE_CMYK&&r("/Decode [1 0 1 0 1 0 1 0]")),r("/BitsPerComponent "+e.bpc),"f"in e&&r("/Filter /"+e.f),"dp"in e&&r("/DecodeParms <<"+e.dp+">>"),"trns"in e&&e.trns.constructor==Array){for(var o="",a=0,s=e.trns.length;a<s;a++)o+=e.trns[a]+" "+e.trns[a]+" ";r("/Mask ["+o+"]")}if("smask"in e&&r("/SMask "+(n+1)+" 0 R"),r("/Length "+e.data.length+">>"),i(e.data),r("endobj"),"smask"in e){var c="/Predictor "+e.p+" /Colors 1 /BitsPerComponent "+e.bpc+" /Columns "+e.w,l={w:e.w,h:e.h,cs:"DeviceGray",bpc:e.bpc,dp:c,data:e.smask};"f"in e&&(l.f=e.f),t.call(this,l)}e.cs===this.color_spaces.INDEXED&&(this.internal.newObject(),r("<< /Length "+e.pal.length+">>"),i(this.arrayBufferToBinaryString(new Uint8Array(e.pal))),r("endobj"))},o=function(){var t=this.internal.collections[n+"images"];for(var e in t)i.call(this,t[e])},a=function(){var t,e=this.internal.collections[n+"images"],r=this.internal.write;for(var i in e)t=e[i],r("/I"+t.i,t.n,"0","R")},s=function(t){return t&&"string"==typeof t&&(t=t.toUpperCase()),t in e.image_compression?t:e.image_compression.NONE},c=function(){var t=this.internal.collections[n+"images"];return t||(this.internal.collections[n+"images"]=t={},this.internal.events.subscribe("putResources",o),this.internal.events.subscribe("putXobjectDict",a)),t},l=function(t){var e=0;return t&&(e=Object.keys?Object.keys(t).length:function(t){var e=0;for(var n in t)t.hasOwnProperty(n)&&e++;return e}(t)),e},u=function(t){return"undefined"==typeof t||null===t},h=function(t){return"string"==typeof t&&e.sHashCode(t)},f=function(t){return r.indexOf(t)===-1},d=function(t){return"function"!=typeof e["process"+t.toUpperCase()]},p=function(e){return"object"===("undefined"==typeof e?"undefined":t(e))&&1===e.nodeType},g=function(e,n,r){if("IMG"===e.nodeName&&e.hasAttribute("src")){var i=""+e.getAttribute("src");if(!r&&0===i.indexOf("data:image/"))return i;!n&&/\.png(?:[?#].*)?$/i.test(i)&&(n="png")}if("CANVAS"===e.nodeName)var o=e;else{var o=document.createElement("canvas");o.width=e.clientWidth||e.width,o.height=e.clientHeight||e.height;var a=o.getContext("2d");if(!a)throw"addImage requires canvas to be supported by browser.";if(r){var s,c,l,u,h,f,d,p,g=Math.PI/180;"object"===("undefined"==typeof r?"undefined":t(r))&&(s=r.x,c=r.y,l=r.bg,r=r.angle),p=r*g,u=Math.abs(Math.cos(p)),h=Math.abs(Math.sin(p)),f=o.width,d=o.height,o.width=d*h+f*u,o.height=d*u+f*h,isNaN(s)&&(s=o.width/2),isNaN(c)&&(c=o.height/2),a.clearRect(0,0,o.width,o.height),a.fillStyle=l||"white",a.fillRect(0,0,o.width,o.height),a.save(),a.translate(s,c),a.rotate(p),a.drawImage(e,-(f/2),-(d/2)),a.rotate(-p),a.translate(-s,-c),a.restore()}else a.drawImage(e,0,0,o.width,o.height)}return o.toDataURL("png"==(""+n).toLowerCase()?"image/png":"image/jpeg")},m=function(t,e){var n;if(e)for(var r in e)if(t===e[r].alias){n=e[r];break}return n},w=function(t,e,n){return t||e||(t=-96,e=-96),t<0&&(t=-1*n.w*72/t/this.internal.scaleFactor),e<0&&(e=-1*n.h*72/e/this.internal.scaleFactor),0===t&&(t=e*n.w/n.h),0===e&&(e=t*n.h/n.w),[t,e]},y=function(t,e,n,r,i,o,a){var s=w.call(this,n,r,i),c=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString;n=s[0],r=s[1],a[o]=i,this.internal.write("q",c(n),"0 0",c(r),c(t),l(e+r),"cm /I"+i.i,"Do Q")};e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"},e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"},e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},e.sHashCode=function(t){return Array.prototype.reduce&&t.split("").reduce(function(t,e){return t=(t<<5)-t+e.charCodeAt(0),t&t},0)},e.isString=function(t){return"string"==typeof t},e.extractInfoFromBase64DataURI=function(t){return/^data:([\w]+?\/([\w]+?));base64,(.+?)$/g.exec(t)},e.supportsArrayBuffer=function(){return"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array},e.isArrayBuffer=function(t){return!!this.supportsArrayBuffer()&&t instanceof ArrayBuffer},e.isArrayBufferView=function(t){return!!this.supportsArrayBuffer()&&("undefined"!=typeof Uint32Array&&(t instanceof Int8Array||t instanceof Uint8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array))},e.binaryStringToUint8Array=function(t){for(var e=t.length,n=new Uint8Array(e),r=0;r<e;r++)n[r]=t.charCodeAt(r);return n},e.arrayBufferToBinaryString=function(t){this.isArrayBuffer(t)&&(t=new Uint8Array(t));for(var e="",n=t.byteLength,r=0;r<n;r++)e+=String.fromCharCode(t[r]);return e},e.arrayBufferToBase64=function(t){for(var e,n,r,i,o,a="",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=new Uint8Array(t),l=c.byteLength,u=l%3,h=l-u,f=0;f<h;f+=3)o=c[f]<<16|c[f+1]<<8|c[f+2],e=(16515072&o)>>18,n=(258048&o)>>12,r=(4032&o)>>6,i=63&o,a+=s[e]+s[n]+s[r]+s[i];return 1==u?(o=c[h],e=(252&o)>>2,n=(3&o)<<4,a+=s[e]+s[n]+"=="):2==u&&(o=c[h]<<8|c[h+1],e=(64512&o)>>10,n=(1008&o)>>4,r=(15&o)<<2,a+=s[e]+s[n]+s[r]+"="),a},e.createImageInfo=function(t,e,n,r,i,o,a,s,c,l,u,h,f){var d={alias:s,w:e,h:n,cs:r,bpc:i,i:a,data:t};return o&&(d.f=o),c&&(d.dp=c),l&&(d.trns=l),u&&(d.pal=u),h&&(d.smask=h),f&&(d.p=f),d},e.addImage=function(e,n,i,o,a,w,v,b,x){if("string"!=typeof n){var k=w;w=a,a=o,o=i,i=n,n=k}if("object"===("undefined"==typeof e?"undefined":t(e))&&!p(e)&&"imageData"in e){var _=e;e=_.imageData,n=_.format||n,i=_.x||i||0,o=_.y||o||0,a=_.w||a,w=_.h||w,v=_.alias||v,b=_.compression||b,x=_.rotation||_.angle||x}if(isNaN(i)||isNaN(o))throw console.error("jsPDF.addImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addImage");var C,A=c.call(this);if(!(C=m(e,A))){var S;if(p(e)&&(e=g(e,n,x)),u(v)&&(v=h(e)),!(C=m(v,A))){if(this.isString(e)){var q=this.extractInfoFromBase64DataURI(e);q?(n=q[2],e=atob(q[3])):137===e.charCodeAt(0)&&80===e.charCodeAt(1)&&78===e.charCodeAt(2)&&71===e.charCodeAt(3)&&(n="png")}if(n=(n||"JPEG").toLowerCase(),f(n))throw new Error("addImage currently only supports formats "+r+", not '"+n+"'");if(d(n))throw new Error("please ensure that the plugin for '"+n+"' support is added");if(this.supportsArrayBuffer()&&(e instanceof Uint8Array||(S=e,e=this.binaryStringToUint8Array(e))),C=this["process"+n.toUpperCase()](e,l(A),v,s(b),S),!C)throw new Error("An unkwown error occurred whilst processing the image")}}return y.call(this,i,o,a,w,C,C.i,A),this};var v=function(t){var e,n,r;if(255===!t.charCodeAt(0)||216===!t.charCodeAt(1)||255===!t.charCodeAt(2)||224===!t.charCodeAt(3)||!t.charCodeAt(6)==="J".charCodeAt(0)||!t.charCodeAt(7)==="F".charCodeAt(0)||!t.charCodeAt(8)==="I".charCodeAt(0)||!t.charCodeAt(9)==="F".charCodeAt(0)||0===!t.charCodeAt(10))throw new Error("getJpegSize requires a binary string jpeg file");for(var i=256*t.charCodeAt(4)+t.charCodeAt(5),o=4,a=t.length;o<a;){if(o+=i,255!==t.charCodeAt(o))throw new Error("getJpegSize could not find the size of the image");if(192===t.charCodeAt(o+1)||193===t.charCodeAt(o+1)||194===t.charCodeAt(o+1)||195===t.charCodeAt(o+1)||196===t.charCodeAt(o+1)||197===t.charCodeAt(o+1)||198===t.charCodeAt(o+1)||199===t.charCodeAt(o+1))return n=256*t.charCodeAt(o+5)+t.charCodeAt(o+6),e=256*t.charCodeAt(o+7)+t.charCodeAt(o+8),r=t.charCodeAt(o+9),[e,n,r];o+=2,i=256*t.charCodeAt(o)+t.charCodeAt(o+1)}},b=function(t){var e=t[0]<<8|t[1];if(65496!==e)throw new Error("Supplied data is not a JPEG");for(var n,r,i,o,a=t.length,s=(t[4]<<8)+t[5],c=4;c<a;){if(c+=s,n=x(t,c),s=(n[2]<<8)+n[3],(192===n[1]||194===n[1])&&255===n[0]&&s>7)return n=x(t,c+5),r=(n[2]<<8)+n[3],i=(n[0]<<8)+n[1],o=n[4],{width:r,height:i,numcomponents:o};c+=2}throw new Error("getJpegSizeFromBytes could not find the size of the image")},x=function(t,e){return t.subarray(e,e+5)};e.processJPEG=function(t,e,n,r,i){var o,a=this.color_spaces.DEVICE_RGB,s=this.decode.DCT_DECODE,c=8;return this.isString(t)?(o=v(t),this.createImageInfo(t,o[0],o[1],1==o[3]?this.color_spaces.DEVICE_GRAY:a,c,s,e,n)):(this.isArrayBuffer(t)&&(t=new Uint8Array(t)),this.isArrayBufferView(t)?(o=b(t),t=i||this.arrayBufferToBinaryString(t),this.createImageInfo(t,o.width,o.height,1==o.numcomponents?this.color_spaces.DEVICE_GRAY:a,c,s,e,n)):null)},e.processJPG=function(){return this.processJPEG.apply(this,arguments)}}(e.API),/**+ * jsPDF Annotations PlugIn+ * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]+ *+ * Licensed under the MIT License.+ * http://opensource.org/licenses/mit-license+ */+ function(t){var n={annotations:[],f2:function(t){return t.toFixed(2)},notEmpty:function(t){if("undefined"!=typeof t&&""!=t)return!0}};return e.API.annotationPlugin=n,e.API.events.push(["addPage",function(t){this.annotationPlugin.annotations[t.pageNumber]=[]}]),t.events.push(["putPage",function(t){for(var e=this.annotationPlugin.annotations[t.pageNumber],r=!1,i=0;i<e.length&&!r;i++){var o=e[i];switch(o.type){case"link":if(n.notEmpty(o.options.url)||n.notEmpty(o.options.pageNumber)){r=!0;break}case"reference":case"text":case"freetext":r=!0}}if(0!=r){this.internal.write("/Annots [");for(var a=this.annotationPlugin.f2,s=this.internal.scaleFactor,c=this.internal.pageSize.height,l=this.internal.getPageInfo(t.pageNumber),i=0;i<e.length;i++){var o=e[i];switch(o.type){case"reference":this.internal.write(" "+o.object.objId+" 0 R ");break;case"text":var u=this.internal.newAdditionalObject(),h=this.internal.newAdditionalObject(),f=o.title||"Note",d="/Rect ["+a(o.bounds.x*s)+" "+a(c-(o.bounds.y+o.bounds.h)*s)+" "+a((o.bounds.x+o.bounds.w)*s)+" "+a((c-o.bounds.y)*s)+"] ";y="<</Type /Annot /Subtype /Text "+d+"/Contents ("+o.contents+")",y+=" /Popup "+h.objId+" 0 R",y+=" /P "+l.objId+" 0 R",y+=" /T ("+f+") >>",u.content=y;var p=u.objId+" 0 R",g=30,d="/Rect ["+a((o.bounds.x+g)*s)+" "+a(c-(o.bounds.y+o.bounds.h)*s)+" "+a((o.bounds.x+o.bounds.w+g)*s)+" "+a((c-o.bounds.y)*s)+"] ";y="<</Type /Annot /Subtype /Popup "+d+" /Parent "+p,o.open&&(y+=" /Open true"),y+=" >>",h.content=y,this.internal.write(u.objId,"0 R",h.objId,"0 R");break;case"freetext":var d="/Rect ["+a(o.bounds.x*s)+" "+a((c-o.bounds.y)*s)+" "+a(o.bounds.x+o.bounds.w*s)+" "+a(c-(o.bounds.y+o.bounds.h)*s)+"] ",m=o.color||"#000000";y="<</Type /Annot /Subtype /FreeText "+d+"/Contents ("+o.contents+")",y+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+m+")",y+=" /Border [0 0 0]",y+=" >>",this.internal.write(y);break;case"link":if(o.options.name){var w=this.annotations._nameMap[o.options.name];o.options.pageNumber=w.page,o.options.top=w.y}else o.options.top||(o.options.top=0);var d="/Rect ["+a(o.x*s)+" "+a((c-o.y)*s)+" "+a(o.x+o.w*s)+" "+a(c-(o.y+o.h)*s)+"] ",y="";if(o.options.url)y="<</Type /Annot /Subtype /Link "+d+"/Border [0 0 0] /A <</S /URI /URI ("+o.options.url+") >>";else if(o.options.pageNumber){var t=this.internal.getPageInfo(o.options.pageNumber);switch(y="<</Type /Annot /Subtype /Link "+d+"/Border [0 0 0] /Dest ["+t.objId+" 0 R",o.options.magFactor=o.options.magFactor||"XYZ",o.options.magFactor){case"Fit":y+=" /Fit]";break;case"FitH":y+=" /FitH "+o.options.top+"]";break;case"FitV":o.options.left=o.options.left||0,y+=" /FitV "+o.options.left+"]";break;case"XYZ":default:var v=a((c-o.options.top)*s);o.options.left=o.options.left||0,"undefined"==typeof o.options.zoom&&(o.options.zoom=0),y+=" /XYZ "+o.options.left+" "+v+" "+o.options.zoom+"]"}}""!=y&&(y+=" >>",this.internal.write(y))}}this.internal.write("]")}}]),t.createAnnotation=function(t){switch(t.type){case"link":this.link(t.bounds.x,t.bounds.y,t.bounds.w,t.bounds.h,t);break;case"text":case"freetext":this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push(t)}},t.link=function(t,e,n,r,i){this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({x:t,y:e,w:n,h:r,options:i,type:"link"})},t.link=function(t,e,n,r,i){this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({x:t,y:e,w:n,h:r,options:i,type:"link"})},t.textWithLink=function(t,e,n,r){var i=this.getTextWidth(t),o=this.internal.getLineHeight();return this.text(t,e,n),n+=.2*o,this.link(e,n-o,i,o,r),i},t.getTextWidth=function(t){var e=this.internal.getFontSize(),n=this.getStringUnitWidth(t)*e/this.internal.scaleFactor;return n},t.getLineHeight=function(){return this.internal.getLineHeight()},this}(e.API),function(t){t.autoPrint=function(){var t;return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.write("<< /S/Named /Type/Action /N/Print >>","endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.write("/OpenAction "+t+" 0 R")}),this}}(e.API),/**+ * jsPDF Canvas PlugIn+ * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]+ *+ * Licensed under the MIT License.+ * http://opensource.org/licenses/mit-license+ */+ function(t){return t.events.push(["initialized",function(){this.canvas.pdf=this}]),t.canvas={getContext:function(t){return this.pdf.context2d._canvas=this,this.pdf.context2d},style:{}},Object.defineProperty(t.canvas,"width",{get:function(){return this._width},set:function(t){this._width=t,this.getContext("2d").pageWrapX=t+1}}),Object.defineProperty(t.canvas,"height",{get:function(){return this._height},set:function(t){this._height=t,this.getContext("2d").pageWrapY=t+1}}),this}(e.API),/** ====================================================================+ * jsPDF Cell plugin+ * Copyright (c) 2013 Youssef Beddad, [email protected]+ * 2013 Eduardo Menezes de Morais, [email protected]+ * 2013 Lee Driscoll, https://github.com/lsdriscoll+ * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria+ * 2014 James Hall, [email protected]+ * 2014 Diego Casorran, https://github.com/diegocr+ *+ *+ * ====================================================================+ */+ function(t){var e,n,r,i,o=3,a=13,s={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},c=1,l=function(t,e,n,r,i){s={x:t,y:e,w:n,h:r,ln:i}},u=function(){return s},h={left:0,top:0,bottom:0};t.setHeaderFunction=function(t){i=t},t.getTextDimensions=function(t){e=this.internal.getFont().fontName,n=this.table_font_size||this.internal.getFontSize(),r=this.internal.getFont().fontStyle;var i,o,a=19.049976/25.4;o=document.createElement("font"),o.id="jsPDFCell";try{o.style.fontStyle=r}catch(t){o.style.fontWeight=r}o.style.fontName=e,o.style.fontSize=n+"pt";try{o.textContent=t}catch(e){o.innerText=t}return document.body.appendChild(o),i={w:(o.offsetWidth+1)*a,h:(o.offsetHeight+1)*a},document.body.removeChild(o),i},t.cellAddPage=function(){var t=this.margins||h;this.addPage(),l(t.left,t.top,void 0,void 0),c+=1},t.cellInitialize=function(){s={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},c=1},t.cell=function(t,e,n,r,i,s,c){var f=u(),d=!1;if(void 0!==f.ln)if(f.ln===s)t=f.x+f.w,e=f.y;else{var p=this.margins||h;f.y+f.h+r+a>=this.internal.pageSize.height-p.bottom&&(this.cellAddPage(),d=!0,this.printHeaders&&this.tableHeaderRow&&this.printHeaderRow(s,!0)),e=u().y+u().h,d&&(e=a+10)}if(void 0!==i[0])if(this.printingHeaderRow?this.rect(t,e,n,r,"FD"):this.rect(t,e,n,r),"right"===c){i instanceof Array||(i=[i]);for(var g=0;g<i.length;g++){var m=i[g],w=this.getStringUnitWidth(m)*this.internal.getFontSize();this.text(m,t+n-w-o,e+this.internal.getLineHeight()*(g+1))}}else this.text(i,t+o,e+this.internal.getLineHeight());return l(t,e,n,r,s),this},t.arrayMax=function(t,e){var n,r,i,o=t[0];for(n=0,r=t.length;n<r;n+=1)i=t[n],e?e(o,i)===-1&&(o=i):i>o&&(o=i);return o},t.table=function(e,n,r,i,o){if(!r)throw"No data for PDF table";var a,l,u,f,d,p,g,m,w,y,v=[],b=[],x={},k={},_=[],C=[],A=!1,S=!0,q=12,T=h;if(T.width=this.internal.pageSize.width,o&&(o.autoSize===!0&&(A=!0),o.printHeaders===!1&&(S=!1),o.fontSize&&(q=o.fontSize),o.css&&"undefined"!=typeof o.css["font-size"]&&(q=16*o.css["font-size"]),o.margins&&(T=o.margins)),this.lnMod=0,s={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},c=1,this.printHeaders=S,this.margins=T,this.setFontSize(q),this.table_font_size=q,void 0===i||null===i)v=Object.keys(r[0]);else if(i[0]&&"string"!=typeof i[0]){var I=19.049976/25.4;for(l=0,u=i.length;l<u;l+=1)a=i[l],v.push(a.name),b.push(a.prompt),k[a.name]=a.width*I}else v=i;if(A)for(y=function(t){return t[a]},l=0,u=v.length;l<u;l+=1){for(a=v[l],x[a]=r.map(y),_.push(this.getTextDimensions(b[l]||a).w),p=x[a],g=0,f=p.length;g<f;g+=1)d=p[g],_.push(this.getTextDimensions(d).w);k[a]=t.arrayMax(_),_=[]}if(S){var P=this.calculateLineHeight(v,k,b.length?b:v);for(l=0,u=v.length;l<u;l+=1)a=v[l],C.push([e,n,k[a],P,String(b.length?b[l]:a)]);this.setTableHeaderRow(C),this.printHeaderRow(1,!1)}for(l=0,u=r.length;l<u;l+=1){var P;for(m=r[l],P=this.calculateLineHeight(v,k,m),g=0,w=v.length;g<w;g+=1)a=v[g],this.cell(e,n,k[a],P,m[a],l+2,a.align)}return this.lastCellPos=s,this.table_x=e,this.table_y=n,this},t.calculateLineHeight=function(t,e,n){for(var r,i=0,a=0;a<t.length;a++){r=t[a],n[r]=this.splitTextToSize(String(n[r]),e[r]-o);var s=this.internal.getLineHeight()*n[r].length+o;s>i&&(i=s)}return i},t.setTableHeaderRow=function(t){this.tableHeaderRow=t},t.printHeaderRow=function(t,e){if(!this.tableHeaderRow)throw"Property tableHeaderRow does not exist.";var n,r,o,s;if(this.printingHeaderRow=!0,void 0!==i){var u=i(this,c);l(u[0],u[1],u[2],u[3],-1)}this.setFontStyle("bold");var h=[];for(o=0,s=this.tableHeaderRow.length;o<s;o+=1)this.setFillColor(200,200,200),n=this.tableHeaderRow[o],e&&(this.margins.top=a,n[1]=this.margins&&this.margins.top||0,h.push(n)),r=[].concat(n),this.cell.apply(this,r.concat(t));h.length>0&&this.setTableHeaderRow(h),this.setFontStyle("normal"),this.printingHeaderRow=!1}}(e.API),/**+ * jsPDF Context2D PlugIn Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]+ *+ * Licensed under the MIT License. http://opensource.org/licenses/mit-license+ */+ function(t){function e(){this._isStrokeTransparent=!1,this._strokeOpacity=1,this.strokeStyle="#000000",this.fillStyle="#000000",this._isFillTransparent=!1,this._fillOpacity=1,this.font="12pt times",this.textBaseline="alphabetic",this.textAlign="start",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this._transform=[1,0,0,1,0,0],this.globalCompositeOperation="normal",this.globalAlpha=1,this._clip_path=[],this.ignoreClearRect=!1,this.copy=function(t){this._isStrokeTransparent=t._isStrokeTransparent,this._strokeOpacity=t._strokeOpacity,this.strokeStyle=t.strokeStyle,this._isFillTransparent=t._isFillTransparent,this._fillOpacity=t._fillOpacity,this.fillStyle=t.fillStyle,this.font=t.font,this.lineWidth=t.lineWidth,this.lineJoin=t.lineJoin,this.lineCap=t.lineCap,this.textBaseline=t.textBaseline,this.textAlign=t.textAlign,this._fontSize=t._fontSize,this._transform=t._transform.slice(0),this.globalCompositeOperation=t.globalCompositeOperation,this.globalAlpha=t.globalAlpha,this._clip_path=t._clip_path.slice(0),this.ignoreClearRect=t.ignoreClearRect}}t.events.push(["initialized",function(){this.context2d.pdf=this,this.context2d.internal.pdf=this,this.context2d.ctx=new e,this.context2d.ctxStack=[],this.context2d.path=[]}]),t.context2d={pageWrapXEnabled:!1,pageWrapYEnabled:!1,pageWrapX:9999999,pageWrapY:9999999,ctx:new e,f2:function(t){return t.toFixed(2)},fillRect:function(t,e,n,r){if(!this._isFillTransparent()){t=this._wrapX(t),e=this._wrapY(e);var i=this._matrix_map_rect(this.ctx._transform,{x:t,y:e,w:n,h:r});this.pdf.rect(i.x,i.y,i.w,i.h,"f")}},strokeRect:function(t,e,n,r){if(!this._isStrokeTransparent()){t=this._wrapX(t),e=this._wrapY(e);var i=this._matrix_map_rect(this.ctx._transform,{x:t,y:e,w:n,h:r});this.pdf.rect(i.x,i.y,i.w,i.h,"s")}},clearRect:function(t,e,n,r){if(!this.ctx.ignoreClearRect){t=this._wrapX(t),e=this._wrapY(e);var i=this._matrix_map_rect(this.ctx._transform,{x:t,y:e,w:n,h:r});this.save(),this.setFillStyle("#ffffff"),this.pdf.rect(i.x,i.y,i.w,i.h,"f"),this.restore()}},save:function(){this.ctx._fontSize=this.pdf.internal.getFontSize();var t=new e;t.copy(this.ctx),this.ctxStack.push(this.ctx),this.ctx=t},restore:function(){this.ctx=this.ctxStack.pop(),this.setFillStyle(this.ctx.fillStyle),this.setStrokeStyle(this.ctx.strokeStyle),this.setFont(this.ctx.font),this.pdf.setFontSize(this.ctx._fontSize),this.setLineCap(this.ctx.lineCap),this.setLineWidth(this.ctx.lineWidth),this.setLineJoin(this.ctx.lineJoin)},rect:function(t,e,n,r){this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()},beginPath:function(){this.path=[]},closePath:function(){this.path.push({type:"close"})},_getRgba:function(t){var e={};if(this.internal.rxTransparent.test(t))e.r=0,e.g=0,e.b=0,e.a=0;else{var n=this.internal.rxRgb.exec(t);null!=n?(e.r=parseInt(n[1]),e.g=parseInt(n[2]),e.b=parseInt(n[3]),e.a=1):(n=this.internal.rxRgba.exec(t),null!=n?(e.r=parseInt(n[1]),e.g=parseInt(n[2]),e.b=parseInt(n[3]),e.a=parseFloat(n[4])):(e.a=1,"#"!=t.charAt(0)&&(t=o.colorNameToHex(t),t||(t="#000000")),4===t.length?(e.r=t.substring(1,2),e.r+=r,e.g=t.substring(2,3),e.g+=g,e.b=t.substring(3,4),e.b+=b):(e.r=t.substring(1,3),e.g=t.substring(3,5),e.b=t.substring(5,7)),e.r=parseInt(e.r,16),e.g=parseInt(e.g,16),e.b=parseInt(e.b,16)))}return e.style=t,e},setFillStyle:function(t){var e,n,r,i;if(this.internal.rxTransparent.test(t))e=0,n=0,r=0,i=0;else{var a=this.internal.rxRgb.exec(t);null!=a?(e=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),i=1):(a=this.internal.rxRgba.exec(t),null!=a?(e=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),i=parseFloat(a[4])):(i=1,"#"!=t.charAt(0)&&(t=o.colorNameToHex(t),t||(t="#000000")),4===t.length?(e=t.substring(1,2),e+=e,n=t.substring(2,3),n+=n,r=t.substring(3,4),r+=r):(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7)),e=parseInt(e,16),n=parseInt(n,16),r=parseInt(r,16)))}this.ctx.fillStyle=t,this.ctx._isFillTransparent=0==i,this.ctx._fillOpacity=i,this.pdf.setFillColor(e,n,r,{a:i}),this.pdf.setTextColor(e,n,r,{a:i})},setStrokeStyle:function(t){var e=this._getRgba(t);this.ctx.strokeStyle=e.style,this.ctx._isStrokeTransparent=0==e.a,this.ctx._strokeOpacity=e.a,0===e.a?this.pdf.setDrawColor(255,255,255):1===e.a?this.pdf.setDrawColor(e.r,e.g,e.b):this.pdf.setDrawColor(e.r,e.g,e.b)},fillText:function(t,e,n,r){if(!this._isFillTransparent()){e=this._wrapX(e),n=this._wrapY(n);var i=this._matrix_map_point(this.ctx._transform,[e,n]);e=i[0],n=i[1];var o=this._matrix_rotation(this.ctx._transform),a=57.2958*o;if(this.ctx._clip_path.length>0){var s;s=window.outIntercept?"group"===window.outIntercept.type?window.outIntercept.stream:window.outIntercept:this.pdf.internal.pages[1],s.push("q");var c=this.path;this.path=this.ctx._clip_path,this.ctx._clip_path=[],this._fill(null,!0),this.ctx._clip_path=this.path,this.path=c}this.pdf.text(t,e,this._getBaseline(n),null,a),this.ctx._clip_path.length>0&&s.push("Q")}},strokeText:function(t,e,n,r){if(!this._isStrokeTransparent()){e=this._wrapX(e),n=this._wrapY(n);var i=this._matrix_map_point(this.ctx._transform,[e,n]);e=i[0],n=i[1];var o=this._matrix_rotation(this.ctx._transform),a=57.2958*o;if(this.ctx._clip_path.length>0){var s;s=window.outIntercept?"group"===window.outIntercept.type?window.outIntercept.stream:window.outIntercept:this.pdf.internal.pages[1],s.push("q");var c=this.path;this.path=this.ctx._clip_path,this.ctx._clip_path=[],this._fill(null,!0),this.ctx._clip_path=this.path,this.path=c}this.pdf.text(t,e,this._getBaseline(n),{stroke:!0},a),this.ctx._clip_path.length>0&&s.push("Q")}},setFont:function(t){this.ctx.font=t;var e=/\s*(\w+)\s+(\w+)\s+(\w+)\s+([\d\.]+)(px|pt|em)\s+(.*)?/;if(h=e.exec(t),null!=h){var n=h[1],r=(h[2],h[3]),i=h[4],o=h[5],a=h[6];i="px"===o?Math.floor(parseFloat(i)):"em"===o?Math.floor(parseFloat(i)*this.pdf.getFontSize()):Math.floor(parseFloat(i)),this.pdf.setFontSize(i),"bold"===r||"700"===r?this.pdf.setFontStyle("bold"):"italic"===n?this.pdf.setFontStyle("italic"):this.pdf.setFontStyle("normal");var s,c=a,l=c.toLowerCase().split(/\s*,\s*/);s=l.indexOf("arial")!=-1?"Arial":l.indexOf("verdana")!=-1?"Verdana":l.indexOf("helvetica")!=-1?"Helvetica":l.indexOf("sans-serif")!=-1?"sans-serif":l.indexOf("fixed")!=-1?"Fixed":l.indexOf("monospace")!=-1?"Monospace":l.indexOf("terminal")!=-1?"Terminal":l.indexOf("courier")!=-1?"Courier":l.indexOf("times")!=-1?"Times":l.indexOf("cursive")!=-1?"Cursive":l.indexOf("fantasy")!=-1?"Fantasy":(l.indexOf("serif")!=-1,"Serif");var u;u="bold"===r?"bold":"normal",this.pdf.setFont(s,u)}else{var e=/(\d+)(pt|px|em)\s+(\w+)\s*(\w+)?/,h=e.exec(t);if(null!=h){var f=h[1],c=(h[2],h[3]),u=h[4];u||(u="normal"),f="em"===o?Math.floor(parseFloat(i)*this.pdf.getFontSize()):Math.floor(parseFloat(f)),this.pdf.setFontSize(f),this.pdf.setFont(c,u)}}},setTextBaseline:function(t){this.ctx.textBaseline=t},getTextBaseline:function(){return this.ctx.textBaseline},setTextAlign:function(t){this.ctx.textAlign=t},getTextAlign:function(){return this.ctx.textAlign},setLineWidth:function(t){this.ctx.lineWidth=t,this.pdf.setLineWidth(t)},setLineCap:function(t){this.ctx.lineCap=t,this.pdf.setLineCap(t)},setLineJoin:function(t){this.ctx.lineJoin=t,this.pdf.setLineJoin(t)},moveTo:function(t,e){t=this._wrapX(t),e=this._wrapY(e);var n=this._matrix_map_point(this.ctx._transform,[t,e]);t=n[0],e=n[1];var r={type:"mt",x:t,y:e};this.path.push(r)},_wrapX:function(t){return this.pageWrapXEnabled?t%this.pageWrapX:t},_wrapY:function(t){return this.pageWrapYEnabled?(this._gotoPage(this._page(t)),(t-this.lastBreak)%this.pageWrapY):t},transform:function(t,e,n,r,i,o){this.ctx._transform=[t,e,n,r,i,o]},setTransform:function(t,e,n,r,i,o){this.ctx._transform=[t,e,n,r,i,o]},_getTransform:function(){return this.ctx._transform},lastBreak:0,pageBreaks:[],_page:function(t){if(this.pageWrapYEnabled){this.lastBreak=0;for(var e=0,n=0,r=0;r<this.pageBreaks.length;r++)if(t>=this.pageBreaks[r]){e++,0===this.lastBreak&&n++;var i=this.pageBreaks[r]-this.lastBreak;this.lastBreak=this.pageBreaks[r];var o=Math.floor(i/this.pageWrapY);n+=o}if(0===this.lastBreak){var o=Math.floor(t/this.pageWrapY)+1;n+=o}return n+e}return this.pdf.internal.getCurrentPageInfo().pageNumber},_gotoPage:function(t){},lineTo:function(t,e){t=this._wrapX(t),e=this._wrapY(e);var n=this._matrix_map_point(this.ctx._transform,[t,e]);t=n[0],e=n[1];var r={type:"lt",x:t,y:e};this.path.push(r)},bezierCurveTo:function(t,e,n,r,i,o){t=this._wrapX(t),e=this._wrapY(e),n=this._wrapX(n),r=this._wrapY(r),i=this._wrapX(i),o=this._wrapY(o);var a;a=this._matrix_map_point(this.ctx._transform,[i,o]),i=a[0],o=a[1],a=this._matrix_map_point(this.ctx._transform,[t,e]),t=a[0],e=a[1],a=this._matrix_map_point(this.ctx._transform,[n,r]),n=a[0],r=a[1];var s={type:"bct",x1:t,y1:e,x2:n,y2:r,x:i,y:o};this.path.push(s)},quadraticCurveTo:function(t,e,n,r){t=this._wrapX(t),e=this._wrapY(e),n=this._wrapX(n),r=this._wrapY(r);var i;i=this._matrix_map_point(this.ctx._transform,[n,r]),n=i[0],r=i[1],i=this._matrix_map_point(this.ctx._transform,[t,e]),t=i[0],e=i[1];var o={type:"qct",x1:t,y1:e,x:n,y:r};this.path.push(o)},arc:function(t,e,n,r,i,o){t=this._wrapX(t),e=this._wrapY(e);var a=this._matrix_map_point(this.ctx._transform,[t,e]);t=a[0],e=a[1];var s={type:"arc",x:t,y:e,radius:n,startAngle:r,endAngle:i,anticlockwise:o};this.path.push(s)},drawImage:function(t,e,n,r,i,o,a,s,c){void 0!==o&&(e=o,n=a,r=s,i=c),e=this._wrapX(e),n=this._wrapY(n);var l,u=this._matrix_map_rect(this.ctx._transform,{x:e,y:n,w:r,h:i}),h=(this._matrix_map_rect(this.ctx._transform,{x:o,y:a,w:s,h:c}),/data:image\/(\w+).*/i),f=h.exec(t);l=null!=f?f[1]:"png",this.pdf.addImage(t,l,u.x,u.y,u.w,u.h)},_matrix_multiply:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=n*t[0]+r*t[2],l=i*t[0]+o*t[2],u=a*t[0]+s*t[2]+t[4];return r=n*t[1]+r*t[3],o=i*t[1]+o*t[3],s=a*t[1]+s*t[3]+t[5],n=c,i=l,a=u,[n,r,i,o,a,s]},_matrix_rotation:function(t){return Math.atan2(t[2],t[0])},_matrix_decompose:function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=Math.sqrt(e*e+n*n);e/=o,n/=o;var a=e*r+n*i;r-=e*a,i-=n*a;var s=Math.sqrt(r*r+i*i);return r/=s,i/=s,a/=s,e*i<n*r&&(e=-e,n=-n,a=-a,o=-o),{scale:[o,0,0,s,0,0],translate:[1,0,0,1,t[4],t[5]],rotate:[e,n,-n,e,0,0],skew:[1,0,a,1,0,0]}},_matrix_map_point:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],c=e[0],l=e[1],u=c*n+l*i+a,h=c*r+l*o+s;return[u,h]},_matrix_map_point_obj:function(t,e){var n=this._matrix_map_point(t,[e.x,e.y]);return{x:n[0],y:n[1]}},_matrix_map_rect:function(t,e){var n=this._matrix_map_point(t,[e.x,e.y]),r=this._matrix_map_point(t,[e.x+e.w,e.y+e.h]);return{x:n[0],y:n[1],w:r[0]-n[0],h:r[1]-n[1]}},_matrix_is_identity:function(t){return 1==t[0]&&(0==t[1]&&(0==t[2]&&(1==t[3]&&(0==t[4]&&0==t[5]))))},rotate:function(t){var e=[Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0];this.ctx._transform=this._matrix_multiply(this.ctx._transform,e)},scale:function(t,e){var n=[t,0,0,e,0,0];this.ctx._transform=this._matrix_multiply(this.ctx._transform,n)},translate:function(t,e){var n=[1,0,0,1,t,e];this.ctx._transform=this._matrix_multiply(this.ctx._transform,n)},stroke:function(){if(this.ctx._clip_path.length>0){var t;t=window.outIntercept?"group"===window.outIntercept.type?window.outIntercept.stream:window.outIntercept:this.pdf.internal.pages[1],t.push("q");var e=this.path;this.path=this.ctx._clip_path,this.ctx._clip_path=[],this._stroke(!0),this.ctx._clip_path=this.path,this.path=e,this._stroke(!1),t.push("Q")}else this._stroke(!1)},_stroke:function(t){if(t||!this._isStrokeTransparent()){for(var e=[],n=!1,r=this.path,i=0;i<r.length;i++){var o=r[i];switch(o.type){case"mt":e.push({start:o,deltas:[],abs:[]});break;case"lt":var a=[o.x-r[i-1].x,o.y-r[i-1].y];e[e.length-1].deltas.push(a),e[e.length-1].abs.push(o);break;case"bct":var a=[o.x1-r[i-1].x,o.y1-r[i-1].y,o.x2-r[i-1].x,o.y2-r[i-1].y,o.x-r[i-1].x,o.y-r[i-1].y];e[e.length-1].deltas.push(a);break;case"qct":var s=r[i-1].x+2/3*(o.x1-r[i-1].x),c=r[i-1].y+2/3*(o.y1-r[i-1].y),l=o.x+2/3*(o.x1-o.x),u=o.y+2/3*(o.y1-o.y),h=o.x,f=o.y,a=[s-r[i-1].x,c-r[i-1].y,l-r[i-1].x,u-r[i-1].y,h-r[i-1].x,f-r[i-1].y];e[e.length-1].deltas.push(a);break;case"arc":e[e.length-1].arc=!0,e[e.length-1].abs.push(o);break;case"close":n=!0}}for(var i=0;i<e.length;i++){var d;if(d=i==e.length-1?"s":null,e[i].arc)for(var p=e[i].abs,g=0;g<p.length;g++){var m=p[g],w=360*m.startAngle/(2*Math.PI),y=360*m.endAngle/(2*Math.PI),v=m.x,b=m.y;this.internal.arc2(this,v,b,m.radius,w,y,m.anticlockwise,d,t)}else{var v=e[i].start.x,b=e[i].start.y;t?(this.pdf.lines(e[i].deltas,v,b,null,null),this.pdf.clip_fixed()):this.pdf.lines(e[i].deltas,v,b,null,d)}}}},_isFillTransparent:function(){return this.ctx._isFillTransparent||0==this.globalAlpha},_isStrokeTransparent:function(){return this.ctx._isStrokeTransparent||0==this.globalAlpha},fill:function(t){if(this.ctx._clip_path.length>0){var e;e=window.outIntercept?"group"===window.outIntercept.type?window.outIntercept.stream:window.outIntercept:this.pdf.internal.pages[1],e.push("q");var n=this.path;this.path=this.ctx._clip_path,this.ctx._clip_path=[],this._fill(t,!0),this.ctx._clip_path=this.path,this.path=n,this._fill(t,!1),e.push("Q")}else this._fill(t,!1)},_fill:function(t,e){if(!this._isFillTransparent()){var r,i="function"==typeof this.pdf.internal.newObject2;r=window.outIntercept?"group"===window.outIntercept.type?window.outIntercept.stream:window.outIntercept:this.pdf.internal.pages[1];var o=[],a=window.outIntercept;if(i)switch(this.ctx.globalCompositeOperation){case"normal":case"source-over":break;case"destination-in":case"destination-out":var s=this.pdf.internal.newStreamObject(),c=this.pdf.internal.newObject2();c.push("<</Type /ExtGState"),c.push("/SMask <</S /Alpha /G "+s.objId+" 0 R>>"),c.push(">>");var l="MASK"+c.objId;this.pdf.internal.addGraphicsState(l,c.objId);var u="/"+l+" gs";r.splice(0,0,"q"),r.splice(1,0,u),r.push("Q"),window.outIntercept=s;break;default:var h="/"+this.pdf.internal.blendModeMap[this.ctx.globalCompositeOperation.toUpperCase()];h&&this.pdf.internal.out(h+" gs")}var f=this.ctx.globalAlpha;if(this.ctx._fillOpacity<1&&(f=this.ctx._fillOpacity),i){var d=this.pdf.internal.newObject2();d.push("<</Type /ExtGState"),d.push("/CA "+f),d.push("/ca "+f),d.push(">>");var l="GS_O_"+d.objId;this.pdf.internal.addGraphicsState(l,d.objId),this.pdf.internal.out("/"+l+" gs")}for(var p=this.path,g=0;g<p.length;g++){var m=p[g];switch(m.type){case"mt":o.push({start:m,deltas:[],abs:[]});break;case"lt":var w=[m.x-p[g-1].x,m.y-p[g-1].y];o[o.length-1].deltas.push(w),o[o.length-1].abs.push(m);break;case"bct":var w=[m.x1-p[g-1].x,m.y1-p[g-1].y,m.x2-p[g-1].x,m.y2-p[g-1].y,m.x-p[g-1].x,m.y-p[g-1].y];o[o.length-1].deltas.push(w);break;case"qct":var y=p[g-1].x+2/3*(m.x1-p[g-1].x),v=p[g-1].y+2/3*(m.y1-p[g-1].y),b=m.x+2/3*(m.x1-m.x),x=m.y+2/3*(m.y1-m.y),k=m.x,_=m.y,w=[y-p[g-1].x,v-p[g-1].y,b-p[g-1].x,x-p[g-1].y,k-p[g-1].x,_-p[g-1].y];o[o.length-1].deltas.push(w);break;case"arc":0==o.length&&o.push({start:{x:0,y:0},deltas:[],abs:[]}),o[o.length-1].arc=!0,o[o.length-1].abs.push(m);break;case"close":}}for(var g=0;g<o.length;g++){var C;if(g==o.length-1?(C="f","evenodd"===t&&(C+="*")):C=null,o[g].arc){for(var A=o[g].abs,S=0;S<A.length;S++){var q=A[S];if("undefined"!=typeof q.startAngle){var T=360*q.startAngle/(2*Math.PI),I=360*q.endAngle/(2*Math.PI),P=q.x,E=q.y;0==S&&this.internal.move2(this,P,E),this.internal.arc2(this,P,E,q.radius,T,I,q.anticlockwise,null,e)}else this.internal.line2(n,q.x,q.y)}var P=o[g].start.x,E=o[g].start.y;this.internal.line2(n,P,E),this.pdf.internal.out("h"),this.pdf.internal.out("f")}else{var P=o[g].start.x,E=o[g].start.y;e?(this.pdf.lines(o[g].deltas,P,E,null,null),this.pdf.clip_fixed()):this.pdf.lines(o[g].deltas,P,E,null,C)}}window.outIntercept=a}},pushMask:function(){var t="function"==typeof this.pdf.internal.newObject2;if(!t)return void console.log("jsPDF v2 not enabled");var e=this.pdf.internal.newStreamObject(),n=this.pdf.internal.newObject2();n.push("<</Type /ExtGState"),n.push("/SMask <</S /Alpha /G "+e.objId+" 0 R>>"),n.push(">>");var r="MASK"+n.objId;this.pdf.internal.addGraphicsState(r,n.objId);var i="/"+r+" gs";this.pdf.internal.out(i)},clip:function(){if(this.ctx._clip_path.length>0)for(var t=0;t<this.path.length;t++)this.ctx._clip_path.push(this.path[t]);else this.ctx._clip_path=this.path;this.path=[]},measureText:function(t){var e=this.pdf;return{getWidth:function(){var n=e.internal.getFontSize(),r=e.getStringUnitWidth(t)*n/e.internal.scaleFactor;return r},get width(){return this.getWidth(t)}}},_getBaseline:function(t){var e=parseInt(this.pdf.internal.getFontSize()),n=.25*e;switch(this.ctx.textBaseline){case"bottom":return t-n;case"top":return t+e;case"hanging":return t+e-n;case"middle":return t+e/2-n;case"ideographic":return t;case"alphabetic":default:return t}}};var n=t.context2d;return Object.defineProperty(n,"fillStyle",{set:function(t){this.setFillStyle(t)},get:function(){return this.ctx.fillStyle}}),Object.defineProperty(n,"strokeStyle",{set:function(t){this.setStrokeStyle(t)},get:function(){return this.ctx.strokeStyle}}),Object.defineProperty(n,"lineWidth",{set:function(t){this.setLineWidth(t)},get:function(){return this.ctx.lineWidth}}),Object.defineProperty(n,"lineCap",{set:function(t){this.setLineCap(t)},get:function(){return this.ctx.lineCap}}),Object.defineProperty(n,"lineJoin",{set:function(t){this.setLineJoin(t)},get:function(){return this.ctx.lineJoin}}),Object.defineProperty(n,"miterLimit",{set:function(t){this.ctx.miterLimit=t},get:function(){return this.ctx.miterLimit}}),Object.defineProperty(n,"textBaseline",{set:function(t){this.setTextBaseline(t)},get:function(){return this.getTextBaseline()}}),Object.defineProperty(n,"textAlign",{set:function(t){this.setTextAlign(t)},get:function(){return this.getTextAlign()}}),Object.defineProperty(n,"font",{set:function(t){this.setFont(t)},get:function(){return this.ctx.font}}),Object.defineProperty(n,"globalCompositeOperation",{set:function(t){this.ctx.globalCompositeOperation=t},get:function(){return this.ctx.globalCompositeOperation}}),Object.defineProperty(n,"globalAlpha",{set:function(t){this.ctx.globalAlpha=t},get:function(){return this.ctx.globalAlpha}}),Object.defineProperty(n,"ignoreClearRect",{set:function(t){this.ctx.ignoreClearRect=t},get:function(){return this.ctx.ignoreClearRect}}),n.internal={},n.internal.rxRgb=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,n.internal.rxRgba=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/,n.internal.rxTransparent=/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/,n.internal.arc=function(t,e,n,r,i,o,a,s){for(var c=!0,l=this.pdf.internal.scaleFactor,u=this.pdf.internal.pageSize.height,h=this.pdf.internal.f2,f=i*(Math.PI/180),d=o*(Math.PI/180),p=this.createArc(r,f,d,a),g=0;g<p.length;g++){var m=p[g];c&&0==g?this.pdf.internal.out([h((m.x1+e)*l),h((u-(m.y1+n))*l),"m",h((m.x2+e)*l),h((u-(m.y2+n))*l),h((m.x3+e)*l),h((u-(m.y3+n))*l),h((m.x4+e)*l),h((u-(m.y4+n))*l),"c"].join(" ")):this.pdf.internal.out([h((m.x2+e)*l),h((u-(m.y2+n))*l),h((m.x3+e)*l),h((u-(m.y3+n))*l),h((m.x4+e)*l),h((u-(m.y4+n))*l),"c"].join(" ")),t._lastPoint={x:e,y:n}}null!==s&&this.pdf.internal.out(this.pdf.internal.getStyle(s))},n.internal.arc2=function(t,e,n,r,i,o,a,s,c){var l=e,u=n;c?(this.arc(t,l,u,r,i,o,a,null),this.pdf.clip_fixed()):this.arc(t,l,u,r,i,o,a,s)},n.internal.move2=function(t,e,n){var r=this.pdf.internal.scaleFactor,i=this.pdf.internal.pageSize.height,o=this.pdf.internal.f2;this.pdf.internal.out([o(e*r),o((i-n)*r),"m"].join(" ")),t._lastPoint={x:e,y:n}},n.internal.line2=function(t,e,n){var r=this.pdf.internal.scaleFactor,i=this.pdf.internal.pageSize.height,o=this.pdf.internal.f2,a={x:e,y:n};this.pdf.internal.out([o(a.x*r),o((i-a.y)*r),"l"].join(" ")),t._lastPoint=a},n.internal.createArc=function(t,e,n,r){var i=1e-5,o=2*Math.PI,a=e;(a<o||a>o)&&(a%=o);var s=n;(s<o||s>o)&&(s%=o);for(var c=[],l=Math.PI/2,u=r?-1:1,h=e,f=Math.min(o,Math.abs(s-a));f>i;){var d=h+u*Math.min(f,l);c.push(this.createSmallArc(t,h,d)),f-=Math.abs(d-h),h=d}return c},n.internal.createSmallArc=function(t,e,n){var r=(n-e)/2,i=t*Math.cos(r),o=t*Math.sin(r),a=i,s=-o,c=a*a+s*s,l=c+a*i+s*o,u=4/3*(Math.sqrt(2*c*l)-l)/(a*o-s*i),h=a-u*s,f=s+u*a,d=h,p=-f,g=r+e,m=Math.cos(g),w=Math.sin(g);return{x1:t*Math.cos(e),y1:t*Math.sin(e),x2:h*m-f*w,y2:h*w+f*m,x3:d*m-p*w,y3:d*w+p*m,x4:t*Math.cos(n),y4:t*Math.sin(n)}},this}(e.API),/** @preserve+ * jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser+ * Copyright (c) 2012 Willow Systems Corporation, willow-systems.com+ * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria+ * 2014 Diego Casorran, https://github.com/diegocr+ * 2014 Daniel Husar, https://github.com/danielhusar+ * 2014 Wolfgang Gassler, https://github.com/woolfg+ * 2014 Steven Spungin, https://github.com/flamenco+ *+ *+ * ====================================================================+ */+ function(e){var n,r,i,a,s,c,l,u,h,f,d,p,g,m,w,y,v,b,x,k;n=function(){function t(){}return function(e){return t.prototype=e,new t}}(),f=function(t){var e,n,r,i,o,a,s;for(n=0,r=t.length,e=void 0,i=!1,a=!1;!i&&n!==r;)e=t[n]=t[n].trimLeft(),e&&(i=!0),n++;for(n=r-1;r&&!a&&n!==-1;)e=t[n]=t[n].trimRight(),e&&(a=!0),n--;for(o=/\s+$/g,s=!0,n=0;n!==r;)"\u2028"!=t[n]&&(e=t[n].replace(/\s+/g," "),s&&(e=e.trimLeft()),e&&(s=o.test(e)),t[n]=e),n++;return t},d=function(t,e,n,r){return this.pdf=t,this.x=e,this.y=n,this.settings=r,this.watchFunctions=[],this.init(),this},p=function(t){var e,n,r;for(e=void 0,r=t.split(","),n=r.shift();!e&&n;)e=i[n.trim().toLowerCase()],n=r.shift();return e},g=function(t){t="auto"===t?"0px":t,t.indexOf("em")>-1&&!isNaN(Number(t.replace("em","")))&&(t=18.719*Number(t.replace("em",""))+"px"),t.indexOf("pt")>-1&&!isNaN(Number(t.replace("pt","")))&&(t=1.333*Number(t.replace("pt",""))+"px");var e,n,r;return n=void 0,e=16,(r=m[t])?r:(r={"xx-small":9,"x-small":11,small:13,medium:16,large:19,"x-large":23,"xx-large":28,auto:0}[{css_line_height_string:t}],r!==n?m[t]=r/e:(r=parseFloat(t))?m[t]=r/e:(r=t.match(/([\d\.]+)(px)/),3===r.length?m[t]=parseFloat(r[1])/e:m[t]=1))},h=function(t){var e,n,r;return r=function(t){var e;return e=function(t){return document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(t,null):t.currentStyle?t.currentStyle:t.style}(t),function(t){return t=t.replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()}),e[t]}}(t),e={},n=void 0,e["font-family"]=p(r("font-family"))||"times",e["font-style"]=a[r("font-style")]||"normal",e["text-align"]=s[r("text-align")]||"left",n=c[r("font-weight")]||"normal","bold"===n&&("normal"===e["font-style"]?e["font-style"]=n:e["font-style"]=n+e["font-style"]),e["font-size"]=g(r("font-size"))||1,e["line-height"]=g(r("line-height"))||1,e.display="inline"===r("display")?"inline":"block",n="block"===e.display,e["margin-top"]=n&&g(r("margin-top"))||0,e["margin-bottom"]=n&&g(r("margin-bottom"))||0,e["padding-top"]=n&&g(r("padding-top"))||0,e["padding-bottom"]=n&&g(r("padding-bottom"))||0,e["margin-left"]=n&&g(r("margin-left"))||0,e["margin-right"]=n&&g(r("margin-right"))||0,e["padding-left"]=n&&g(r("padding-left"))||0,e["padding-right"]=n&&g(r("padding-right"))||0,e["page-break-before"]=r("page-break-before")||"auto",e.float=l[r("cssFloat")]||"none",e.clear=u[r("clear")]||"none",e.color=r("color"),e},w=function(t,e,n){var r,i,o,a,s;if(o=!1,i=void 0,a=void 0,s=void 0,r=n["#"+t.id])if("function"==typeof r)o=r(t,e);else for(i=0,a=r.length;!o&&i!==a;)o=r[i](t,e),i++;if(r=n[t.nodeName],!o&&r)if("function"==typeof r)o=r(t,e);else for(i=0,a=r.length;!o&&i!==a;)o=r[i](t,e),i++;return o},k=function(t,e){var n,r,i,o,a,s,c,l,u,h;for(n=[],r=[],i=0,h=t.rows[0].cells.length,l=t.clientWidth;i<h;)u=t.rows[0].cells[i],r[i]={name:u.textContent.toLowerCase().replace(/\s+/g,""),prompt:u.textContent.replace(/\r?\n/g,""),width:u.clientWidth/l*e.pdf.internal.pageSize.width},i++;for(i=1;i<t.rows.length;){for(s=t.rows[i],a={},o=0;o<s.cells.length;)a[r[o].name]=s.cells[o].textContent.replace(/\r?\n/g,""),o++;n.push(a),i++}return c={rows:n,headers:r}};var _={SCRIPT:1,STYLE:1,NOSCRIPT:1,OBJECT:1,EMBED:1,SELECT:1},C=1;r=function(e,i,o){var a,s,c,l,u,f,d,p,g;for(s=e.childNodes,a=void 0,c=h(e),u="block"===c.display,u&&(i.setBlockBoundary(),i.setBlockStyle(c)),d=19.049976/25.4,l=0,f=s.length;l<f;){if(a=s[l],"object"===("undefined"==typeof a?"undefined":t(a))){if(i.executeWatchFunctions(a),1===a.nodeType&&"HEADER"===a.nodeName){var m=a,v=i.pdf.margins_doc.top;i.pdf.internal.events.subscribe("addPage",function(t){i.y=v,r(m,i,o),i.pdf.margins_doc.top=i.y+10,i.y+=10},!1)}if(8===a.nodeType&&"#comment"===a.nodeName)~a.textContent.indexOf("ADD_PAGE")&&(i.pdf.addPage(),i.y=i.pdf.margins_doc.top);else if(1!==a.nodeType||_[a.nodeName])if(3===a.nodeType){var b=a.nodeValue;if(a.nodeValue&&"LI"===a.parentNode.nodeName)if("OL"===a.parentNode.parentNode.nodeName)b=C++ +". "+b;else{var x=c["font-size"],A=(3-.75*x)*i.pdf.internal.scaleFactor,S=.75*x*i.pdf.internal.scaleFactor,q=1.74*x/i.pdf.internal.scaleFactor;g=function(t,e){this.pdf.circle(t+A,e+S,q,"FD")}}16&a.ownerDocument.body.compareDocumentPosition(a)&&i.addText(b,c)}else"string"==typeof a&&i.addText(a,c);else{var T;if("IMG"===a.nodeName){var I=a.getAttribute("src");T=y[i.pdf.sHashCode(I)||I]}if(T){i.pdf.internal.pageSize.height-i.pdf.margins_doc.bottom<i.y+a.height&&i.y>i.pdf.margins_doc.top&&(i.pdf.addPage(),i.y=i.pdf.margins_doc.top,i.executeWatchFunctions(a));var P=h(a),E=i.x,O=12/i.pdf.internal.scaleFactor,F=(P["margin-left"]+P["padding-left"])*O,R=(P["margin-right"]+P["padding-right"])*O,B=(P["margin-top"]+P["padding-top"])*O,D=(P["margin-bottom"]+P["padding-bottom"])*O;E+=void 0!==P.float&&"right"===P.float?i.settings.width-a.width-R:F,i.pdf.addImage(T,E,i.y+B,a.width,a.height),T=void 0,"right"===P.float||"left"===P.float?(i.watchFunctions.push(function(t,e,n,r){return i.y>=e?(i.x+=t,i.settings.width+=n,!0):!!(r&&1===r.nodeType&&!_[r.nodeName]&&i.x+r.width>i.pdf.margins_doc.left+i.pdf.margins_doc.width)&&(i.x+=t,i.y=e,i.settings.width+=n,!0)}.bind(this,"left"===P.float?-a.width-F-R:0,i.y+a.height+B+D,a.width)),i.watchFunctions.push(function(t,e,n){return!(i.y<t&&e===i.pdf.internal.getNumberOfPages())||1===n.nodeType&&"both"===h(n).clear&&(i.y=t,!0)}.bind(this,i.y+a.height,i.pdf.internal.getNumberOfPages())),i.settings.width-=a.width+F+R,"left"===P.float&&(i.x+=a.width+F+R)):i.y+=a.height+B+D}else if("TABLE"===a.nodeName)p=k(a,i),i.y+=10,i.pdf.table(i.x,i.y,p.rows,p.headers,{autoSize:!1,printHeaders:o.printHeaders,margins:i.pdf.margins_doc,css:h(a)}),i.y=i.pdf.lastCellPos.y+i.pdf.lastCellPos.h+20;else if("OL"===a.nodeName||"UL"===a.nodeName)C=1,w(a,i,o)||r(a,i,o),i.y+=10;else if("LI"===a.nodeName){var j=i.x;i.x+=20/i.pdf.internal.scaleFactor,i.y+=3,w(a,i,o)||r(a,i,o),i.x=j}else"BR"===a.nodeName?(i.y+=c["font-size"]*i.pdf.internal.scaleFactor,i.addText("\u2028",n(c))):w(a,i,o)||r(a,i,o)}}l++}if(o.outY=i.y,u)return i.setBlockBoundary(g)},y={},v=function(t,e,n,r){function i(){e.pdf.internal.events.publish("imagesLoaded"),r(a)}function o(t,n,r){if(t){var o=new Image;a=++l,o.crossOrigin="",o.onerror=o.onload=function(){if(o.complete&&(0===o.src.indexOf("data:image/")&&(o.width=n||o.width||0,o.height=r||o.height||0),o.width+o.height)){var a=e.pdf.sHashCode(t)||t;y[a]=y[a]||o}--l||i()},o.src=t}}for(var a,s=t.getElementsByTagName("img"),c=s.length,l=0;c--;)o(s[c].getAttribute("src"),s[c].width,s[c].height);return l||i()},b=function(t,e,n){var i=t.getElementsByTagName("footer");if(i.length>0){i=i[0];var o=e.pdf.internal.write,a=e.y;e.pdf.internal.write=function(){},r(i,e,n);var s=Math.ceil(e.y-a)+5;e.y=a,e.pdf.internal.write=o,e.pdf.margins_doc.bottom+=s;for(var c=function(t){var o=void 0!==t?t.pageNumber:1,a=e.y;e.y=e.pdf.internal.pageSize.height-e.pdf.margins_doc.bottom,e.pdf.margins_doc.bottom-=s;for(var c=i.getElementsByTagName("span"),l=0;l<c.length;++l)(" "+c[l].className+" ").replace(/[\n\t]/g," ").indexOf(" pageCounter ")>-1&&(c[l].innerHTML=o),(" "+c[l].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&(c[l].innerHTML="###jsPDFVarTotalPages###");r(i,e,n),e.pdf.margins_doc.bottom+=s,e.y=a},l=i.getElementsByTagName("span"),u=0;u<l.length;++u)(" "+l[u].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&e.pdf.internal.events.subscribe("htmlRenderingFinished",e.pdf.putTotalPages.bind(e.pdf,"###jsPDFVarTotalPages###"),!0);e.pdf.internal.events.subscribe("addPage",c,!1),c(),_.FOOTER=1}},x=function(t,e,n,i,o,a){if(!e)return!1;"string"==typeof e||e.parentNode||(e=""+e.innerHTML),"string"==typeof e&&(e=function(t){var e,n,r,i;return r="jsPDFhtmlText"+Date.now().toString()+(1e3*Math.random()).toFixed(0),i="position: absolute !important;clip: rect(1px 1px 1px 1px); /* IE6, IE7 */clip: rect(1px, 1px, 1px, 1px);padding:0 !important;border:0 !important;height: 1px !important;width: 1px !important; top:auto;left:-100px;overflow: hidden;",n=document.createElement("div"),n.style.cssText=i,n.innerHTML='<iframe style="height:1px;width:1px" name="'+r+'" />',document.body.appendChild(n),e=window.frames[r],e.document.open(),e.document.writeln(t),e.document.close(),e.document.body}(e.replace(/<\/?script[^>]*?>/gi,"")));var s,c=new d(t,n,i,o);return v.call(this,e,c,o.elementHandlers,function(t){b(e,c,o.elementHandlers),r(e,c,o.elementHandlers),c.pdf.internal.events.publish("htmlRenderingFinished"),s=c.dispose(),"function"==typeof a?a(s):t&&console.error("jsPDF Warning: rendering issues? provide a callback to fromHTML!")}),s||{x:c.x,y:c.y}},d.prototype.init=function(){return this.paragraph={text:[],style:[]},this.pdf.internal.write("q")},d.prototype.dispose=function(){return this.pdf.internal.write("Q"),{x:this.x,y:this.y,ready:!0}},d.prototype.executeWatchFunctions=function(t){var e=!1,n=[];if(this.watchFunctions.length>0){for(var r=0;r<this.watchFunctions.length;++r)this.watchFunctions[r](t)===!0?e=!0:n.push(this.watchFunctions[r]);this.watchFunctions=n}return e},d.prototype.splitFragmentsIntoLines=function(t,e){var r,i,o,a,s,c,l,u,h,f,d,p,g,m,w;for(i=12,d=this.pdf.internal.scaleFactor,s={},o=void 0,f=void 0,a=void 0,c=void 0,w=void 0,h=void 0,u=void 0,l=void 0,p=[],g=[p],r=0,m=this.settings.width;t.length;)if(c=t.shift(),w=e.shift(),c)if(o=w["font-family"],f=w["font-style"],a=s[o+f],a||(a=this.pdf.internal.getFont(o,f).metadata.Unicode,s[o+f]=a),h={widths:a.widths,kerning:a.kerning,fontSize:w["font-size"]*i,textIndent:r},u=this.pdf.getStringUnitWidth(c,h)*h.fontSize/d,"\u2028"==c)p=[],g.push(p);else if(r+u>m){for(l=this.pdf.splitTextToSize(c,m,h),p.push([l.shift(),w]);l.length;)p=[[l.shift(),w]],g.push(p);r=this.pdf.getStringUnitWidth(p[0][0],h)*h.fontSize/d}else p.push([c,w]),r+=u;if(void 0!==w["text-align"]&&("center"===w["text-align"]||"right"===w["text-align"]||"justify"===w["text-align"]))for(var y=0;y<g.length;++y){var v=this.pdf.getStringUnitWidth(g[y][0][0],h)*h.fontSize/d;y>0&&(g[y][0][1]=n(g[y][0][1]));var b=m-v;if("right"===w["text-align"])g[y][0][1]["margin-left"]=b;else if("center"===w["text-align"])g[y][0][1]["margin-left"]=b/2;else if("justify"===w["text-align"]){var x=g[y][0][0].split(" ").length-1;g[y][0][1]["word-spacing"]=b/x,y===g.length-1&&(g[y][0][1]["word-spacing"]=0)}}return g},d.prototype.RenderTextFragment=function(t,e){var n,r,i;i=0,n=12,this.pdf.internal.pageSize.height-this.pdf.margins_doc.bottom<this.y+this.pdf.internal.getFontSize()&&(this.pdf.internal.write("ET","Q"),this.pdf.addPage(),this.y=this.pdf.margins_doc.top,this.pdf.internal.write("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),e.color,"Td"),i=Math.max(i,e["line-height"],e["font-size"]),this.pdf.internal.write(0,(-1*n*i).toFixed(2),"Td")),r=this.pdf.internal.getFont(e["font-family"],e["font-style"]);var o=this.getPdfColor(e.color);o!==this.lastTextColor&&(this.pdf.internal.write(o),this.lastTextColor=o),void 0!==e["word-spacing"]&&e["word-spacing"]>0&&this.pdf.internal.write(e["word-spacing"].toFixed(2),"Tw"),this.pdf.internal.write("/"+r.id,(n*e["font-size"]).toFixed(2),"Tf","("+this.pdf.internal.pdfEscape(t)+") Tj"),void 0!==e["word-spacing"]&&this.pdf.internal.write(0,"Tw")},d.prototype.getPdfColor=function(t){var e,n,r,i,a=/rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/,s=a.exec(t);if(null!=s?(n=parseInt(s[1]),r=parseInt(s[2]),i=parseInt(s[3])):("#"!=t.charAt(0)&&(t=o.colorNameToHex(t),t||(t="#000000")),n=t.substring(1,3),n=parseInt(n,16),r=t.substring(3,5),r=parseInt(r,16),i=t.substring(5,7),i=parseInt(i,16)),"string"==typeof n&&/^#[0-9A-Fa-f]{6}$/.test(n)){var c=parseInt(n.substr(1),16);n=c>>16&255,r=c>>8&255,i=255&c}var l=this.f3;return e=0===n&&0===r&&0===i||"undefined"==typeof r?l(n/255)+" g":[l(n/255),l(r/255),l(i/255),"rg"].join(" ")},d.prototype.f3=function(t){return t.toFixed(3)},d.prototype.renderParagraph=function(t){var e,n,r,i,o,a,s,c,l,u,h,d,p,g,m;if(i=f(this.paragraph.text),g=this.paragraph.style,e=this.paragraph.blockstyle,p=this.paragraph.priorblockstyle||{},this.paragraph={text:[],style:[],blockstyle:{},priorblockstyle:e},i.join("").trim()){c=this.splitFragmentsIntoLines(i,g),s=void 0,l=void 0,n=12,r=n/this.pdf.internal.scaleFactor,this.priorMarginBottom=this.priorMarginBottom||0,d=(Math.max((e["margin-top"]||0)-this.priorMarginBottom,0)+(e["padding-top"]||0))*r,h=((e["margin-bottom"]||0)+(e["padding-bottom"]||0))*r,this.priorMarginBottom=e["margin-bottom"]||0,"always"===e["page-break-before"]&&(this.pdf.addPage(),this.y=0,d=((e["margin-top"]||0)+(e["padding-top"]||0))*r),u=this.pdf.internal.write,o=void 0,a=void 0,this.y+=d,u("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td");for(var w=0;c.length;){for(s=c.shift(),l=0,o=0,a=s.length;o!==a;)s[o][0].trim()&&(l=Math.max(l,s[o][1]["line-height"],s[o][1]["font-size"]),m=7*s[o][1]["font-size"]),o++;var y=0,v=0;void 0!==s[0][1]["margin-left"]&&s[0][1]["margin-left"]>0&&(v=this.pdf.internal.getCoordinateString(s[0][1]["margin-left"]),y=v-w,w=v);var b=Math.max(e["margin-left"]||0,0)*r;for(u(y+b,(-1*n*l).toFixed(2),"Td"),o=0,a=s.length;o!==a;)s[o][0]&&this.RenderTextFragment(s[o][0],s[o][1]),o++;if(this.y+=l*r,this.executeWatchFunctions(s[0][1])&&c.length>0){var x=[],k=[];c.forEach(function(t){for(var e=0,n=t.length;e!==n;)t[e][0]&&(x.push(t[e][0]+" "),k.push(t[e][1])),++e}),c=this.splitFragmentsIntoLines(f(x),k),u("ET","Q"),u("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td")}}return t&&"function"==typeof t&&t.call(this,this.x-9,this.y-m/2),u("ET","Q"),this.y+=h}},d.prototype.setBlockBoundary=function(t){return this.renderParagraph(t)},d.prototype.setBlockStyle=function(t){return this.paragraph.blockstyle=t},d.prototype.addText=function(t,e){return this.paragraph.text.push(t),this.paragraph.style.push(e)},i={helvetica:"helvetica","sans-serif":"helvetica","times new roman":"times",serif:"times",times:"times",monospace:"courier",courier:"courier"},c={100:"normal",200:"normal",300:"normal",400:"normal",500:"bold",600:"bold",700:"bold",800:"bold",900:"bold",normal:"normal",bold:"bold",bolder:"bold",lighter:"normal"},a={normal:"normal",italic:"italic",oblique:"italic"},s={left:"left",right:"right",center:"center",justify:"justify"},l={none:"none",right:"right",left:"left"},u={none:"none",both:"both"},m={normal:1},e.fromHTML=function(t,e,n,r,i,o){return this.margins_doc=o||{top:0,bottom:0},r||(r={}),r.elementHandlers||(r.elementHandlers={}),x(this,t,isNaN(e)?4:e,isNaN(n)?4:n,r,i)}}(e.API),/** ====================================================================+ * jsPDF JavaScript plugin+ * Copyright (c) 2013 Youssef Beddad, [email protected]+ *+ *+ * ====================================================================+ */+ function(t){var e,n,r;t.addJS=function(t){return r=t,this.internal.events.subscribe("postPutResources",function(t){e=this.internal.newObject(),this.internal.write("<< /Names [(EmbeddedJS) "+(e+1)+" 0 R] >>","endobj"),n=this.internal.newObject(),this.internal.write("<< /S /JavaScript /JS (",r,") >>","endobj")}),this.internal.events.subscribe("putCatalog",function(){void 0!==e&&void 0!==n&&this.internal.write("/Names <</JavaScript "+e+" 0 R>>")}),this}}(e.API),function(t){return t.events.push(["postPutResources",function(){var t=this,e=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var n=t.outline.render().split(/\r\n/),r=0;r<n.length;r++){var i=n[r],o=e.exec(i);if(null!=o){var a=o[1];t.internal.newObjectDeferredBegin(a)}t.internal.write(i)}if(this.outline.createNamedDestinations){for(var s=this.internal.pages.length,c=[],r=0;r<s;r++){var l=t.internal.newObject();c.push(l);var u=t.internal.getPageInfo(r+1);t.internal.write("<< /D["+u.objId+" 0 R /XYZ null null null]>> endobj")}var h=t.internal.newObject();t.internal.write("<< /Names [ ");for(var r=0;r<c.length;r++)t.internal.write("(page_"+(r+1)+")"+c[r]+" 0 R");t.internal.write(" ] >>","endobj");t.internal.newObject();t.internal.write("<< /Dests "+h+" 0 R"),t.internal.write(">>","endobj")}}]),t.events.push(["putCatalog",function(){var t=this;t.outline.root.children.length>0&&(t.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&t.internal.write("/Names "+namesOid+" 0 R"))}]),t.events.push(["initialized",function(){var t=this;t.outline={createNamedDestinations:!1,root:{children:[]}};t.outline.add=function(t,e,n){var r={title:e,options:n,children:[]};return null==t&&(t=this.root),t.children.push(r),r},t.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=t,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},t.outline.genIds_r=function(e){e.id=t.internal.newObjectDeferred();for(var n=0;n<e.children.length;n++)this.genIds_r(e.children[n])},t.outline.renderRoot=function(t){this.objStart(t),this.line("/Type /Outlines"),t.children.length>0&&(this.line("/First "+this.makeRef(t.children[0])),this.line("/Last "+this.makeRef(t.children[t.children.length-1]))),this.line("/Count "+this.count_r({count:0},t)),this.objEnd()},t.outline.renderItems=function(e){for(var n=0;n<e.children.length;n++){var r=e.children[n];this.objStart(r),this.line("/Title "+this.makeString(r.title)),this.line("/Parent "+this.makeRef(e)),n>0&&this.line("/Prev "+this.makeRef(e.children[n-1])),n<e.children.length-1&&this.line("/Next "+this.makeRef(e.children[n+1])),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1])));var i=this.count=this.count_r({count:0},r);if(i>0&&this.line("/Count "+i),r.options&&r.options.pageNumber){var o=t.internal.getPageInfo(r.options.pageNumber);this.line("/Dest ["+o.objId+" 0 R /XYZ 0 "+this.ctx.pdf.internal.pageSize.height+" 0]")}this.objEnd()}for(var n=0;n<e.children.length;n++){var r=e.children[n];this.renderItems(r)}},t.outline.line=function(t){this.ctx.val+=t+"\r\n"},t.outline.makeRef=function(t){return t.id+" 0 R"},t.outline.makeString=function(e){return"("+t.internal.pdfEscape(e)+")"},t.outline.objStart=function(t){this.ctx.val+="\r\n"+t.id+" 0 obj\r\n<<\r\n"},t.outline.objEnd=function(t){this.ctx.val+=">> \r\nendobj\r\n"},t.outline.count_r=function(t,e){for(var n=0;n<e.children.length;n++)t.count++,this.count_r(t,e.children[n]);return t.count}}]),this}(e.API),/**@preserve+ * ====================================================================+ * jsPDF PNG PlugIn+ * Copyright (c) 2014 James Robb, https://github.com/jamesbrobb+ *+ *+ * ====================================================================+ */+ function(t){var e=function(){return"function"!=typeof PNG||"function"!=typeof c},n=function(e){return e!==t.image_compression.NONE&&r()},r=function(){var t="function"==typeof a;if(!t)throw new Error("requires deflate.js for compression");return t},i=function(e,n,r,i){var c=5,u=f;switch(i){case t.image_compression.FAST:c=3,u=h;break;case t.image_compression.MEDIUM:c=6,u=d;break;case t.image_compression.SLOW:c=9,u=p}e=l(e,n,r,u);var g=new Uint8Array(o(c)),m=s(e),w=new a(c),y=w.append(e),v=w.flush(),b=g.length+y.length+v.length,x=new Uint8Array(b+4);return x.set(g),x.set(y,g.length),x.set(v,g.length+y.length),x[b++]=m>>>24&255,x[b++]=m>>>16&255,x[b++]=m>>>8&255,x[b++]=255&m,t.arrayBufferToBinaryString(x)},o=function(t,e){var n=8,r=Math.LOG2E*Math.log(32768)-8,i=r<<4|n,o=i<<8,a=Math.min(3,(e-1&255)>>1);return o|=a<<6,o|=0,o+=31-o%31,[i,255&o&255]},s=function(t,e){for(var n,r=1,i=65535&r,o=r>>>16&65535,a=t.length,s=0;a>0;){n=a>e?e:a,a-=n;do i+=t[s++],o+=i;while(--n);i%=65521,o%=65521}return(o<<16|i)>>>0},l=function(t,e,n,r){for(var i,o,a,s=t.length/e,c=new Uint8Array(t.length+s),l=m(),u=0;u<s;u++){if(a=u*e,i=t.subarray(a,a+e),r)c.set(r(i,n,o),a+u);else{for(var h=0,f=l.length,d=[];h<f;h++)d[h]=l[h](i,n,o);var p=w(d.concat());c.set(d[p],a+u)}o=i}return c},u=function(t,e,n){var r=Array.apply([],t);return r.unshift(0),r},h=function(t,e,n){var r,i=[],o=0,a=t.length;for(i[0]=1;o<a;o++)r=t[o-e]||0,i[o+1]=t[o]-r+256&255;return i},f=function(t,e,n){var r,i=[],o=0,a=t.length;for(i[0]=2;o<a;o++)r=n&&n[o]||0,i[o+1]=t[o]-r+256&255;return i},d=function(t,e,n){var r,i,o=[],a=0,s=t.length;for(o[0]=3;a<s;a++)r=t[a-e]||0,i=n&&n[a]||0,o[a+1]=t[a]+256-(r+i>>>1)&255;return o},p=function(t,e,n){var r,i,o,a,s=[],c=0,l=t.length;for(s[0]=4;c<l;c++)r=t[c-e]||0,i=n&&n[c]||0,o=n&&n[c-e]||0,a=g(r,i,o),s[c+1]=t[c]-a+256&255;return s},g=function(t,e,n){var r=t+e-n,i=Math.abs(r-t),o=Math.abs(r-e),a=Math.abs(r-n);return i<=o&&i<=a?t:o<=a?e:n},m=function(){return[u,h,f,d,p]},w=function(t){for(var e,n,r,i=0,o=t.length;i<o;)e=y(t[i].slice(1)),(e<n||!n)&&(n=e,r=i),i++;return r},y=function(t){for(var e=0,n=t.length,r=0;e<n;)r+=Math.abs(t[e++]);return r},v=function(e){var n;switch(e){case t.image_compression.FAST:n=11;break;case t.image_compression.MEDIUM:n=13;break;case t.image_compression.SLOW:n=14}return n};t.processPNG=function(t,r,o,a,s){var c,l,u,h,f,d,p=this.color_spaces.DEVICE_RGB,g=this.decode.FLATE_DECODE,m=8;if(this.isArrayBuffer(t)&&(t=new Uint8Array(t)),this.isArrayBufferView(t)){if(e())throw new Error("PNG support requires png.js and zlib.js");if(c=new PNG(t),t=c.imgData,m=c.bits,p=c.colorSpace,h=c.colors,[4,6].indexOf(c.colorType)!==-1){if(8===c.bits)for(var w,y,b=32==c.pixelBitlength?new Uint32Array(c.decodePixels().buffer):16==c.pixelBitlength?new Uint16Array(c.decodePixels().buffer):new Uint8Array(c.decodePixels().buffer),x=b.length,k=new Uint8Array(x*c.colors),_=new Uint8Array(x),C=c.pixelBitlength-c.bits,A=0,S=0;A<x;A++){for(w=b[A],y=0;y<C;)k[S++]=w>>>y&255,y+=c.bits;_[A]=w>>>y&255}if(16===c.bits){for(var w,b=new Uint32Array(c.decodePixels().buffer),x=b.length,k=new Uint8Array(x*(32/c.pixelBitlength)*c.colors),_=new Uint8Array(x*(32/c.pixelBitlength)),q=c.colors>1,A=0,S=0,T=0;A<x;)w=b[A++],k[S++]=w>>>0&255,q&&(k[S++]=w>>>16&255,w=b[A++],k[S++]=w>>>0&255),_[T++]=w>>>16&255;m=8}n(a)?(t=i(k,c.width*c.colors,c.colors,a),d=i(_,c.width,1,a)):(t=k,d=_,g=null)}if(3===c.colorType&&(p=this.color_spaces.INDEXED,f=c.palette,c.transparency.indexed)){for(var I=c.transparency.indexed,P=0,A=0,x=I.length;A<x;++A)P+=I[A];if(P/=255,P===x-1&&I.indexOf(0)!==-1)u=[I.indexOf(0)];else if(P!==x){for(var b=c.decodePixels(),_=new Uint8Array(b.length),A=0,x=b.length;A<x;A++)_[A]=I[b[A]];d=i(_,c.width,1)}}var E=v(a);return l=g===this.decode.FLATE_DECODE?"/Predictor "+E+" /Colors "+h+" /BitsPerComponent "+m+" /Columns "+c.width:"/Colors "+h+" /BitsPerComponent "+m+" /Columns "+c.width,(this.isArrayBuffer(t)||this.isArrayBufferView(t))&&(t=this.arrayBufferToBinaryString(t)),(d&&this.isArrayBuffer(d)||this.isArrayBufferView(d))&&(d=this.arrayBufferToBinaryString(d)),this.createImageInfo(t,c.width,c.height,p,m,g,r,o,l,u,f,d,E)}throw new Error("Unsupported PNG image data, try using JPEG instead.")}}(e.API),function(t){t.autoPrint=function(){var t;return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.write("<< /S/Named /Type/Action /N/Print >>","endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.write("/OpenAction "+t+" 0 R")}),this}}(e.API),function(t){var e=t.getCharWidthsArray=function(t,e){e||(e={});var n,r,i,o=e.widths?e.widths:this.internal.getFont().metadata.Unicode.widths,a=o.fof?o.fof:1,s=e.kerning?e.kerning:this.internal.getFont().metadata.Unicode.kerning,c=s.fof?s.fof:1,l=0,u=o[0]||a,h=[];for(n=0,r=t.length;n<r;n++)i=t.charCodeAt(n),h.push((o[i]||u)/a+(s[i]&&s[i][l]||0)/c),l=i;return h},n=function(t){for(var e=t.length,n=0;e;)e--,n+=t[e];return n},r=t.getStringUnitWidth=function(t,r){return n(e.call(this,t,r))},i=function(t,e,n,r){for(var i=[],o=0,a=t.length,s=0;o!==a&&s+e[o]<n;)s+=e[o],o++;i.push(t.slice(0,o));var c=o;for(s=0;o!==a;)s+e[o]>r&&(i.push(t.slice(c,o)),s=0,c=o),s+=e[o],o++;return c!==o&&i.push(t.slice(c,o)),i},o=function(t,o,a){a||(a={});var s,c,l,u,h,f,d=[],p=[d],g=a.textIndent||0,m=0,w=0,y=t.split(" "),v=e(" ",a)[0];if(f=a.lineIndent===-1?y[0].length+2:a.lineIndent||0){var b=Array(f).join(" "),x=[];y.map(function(t){t=t.split(/\s*\n/),t.length>1?x=x.concat(t.map(function(t,e){return(e&&t.length?"\n":"")+t})):x.push(t[0])}),y=x,f=r(b,a)}for(l=0,u=y.length;l<u;l++){var k=0;if(s=y[l],f&&"\n"==s[0]&&(s=s.substr(1),k=1),c=e(s,a),w=n(c),g+m+w>o||k){if(w>o){for(h=i(s,c,o-(g+m),o),d.push(h.shift()),d=[h.pop()];h.length;)p.push([h.shift()]);w=n(c.slice(s.length-d[0].length))}else d=[s];p.push(d),g=w+f,m=v}else d.push(s),g+=m+w,m=v}if(f)var _=function(t,e){return(e?b:"")+t.join(" ")};else var _=function(t){return t.join(" ")};return p.map(_)};t.splitTextToSize=function(t,e,n){n||(n={});var r,i=n.fontSize||this.internal.getFontSize(),a=function(t){var e={0:1},n={};if(t.widths&&t.kerning)return{widths:t.widths,kerning:t.kerning};var r=this.internal.getFont(t.fontName,t.fontStyle),i="Unicode";return r.metadata[i]?{widths:r.metadata[i].widths||e,kerning:r.metadata[i].kerning||n}:{widths:e,kerning:n}}.call(this,n);r=Array.isArray(t)?t:t.split(/\r?\n/);var s=1*this.internal.scaleFactor*e/i;a.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=n.lineIndent;var c,l,u=[];for(c=0,l=r.length;c<l;c++)u=u.concat(o(r[c],s,a));return u}}(e.API),function(t){var e=function(t){for(var e="0123456789abcdef",n="klmnopqrstuvwxyz",r={},i=0;i<n.length;i++)r[n[i]]=e[i];var o,a,s,c,l,u={},h=1,f=u,d=[],p="",g="",m=t.length-1;for(i=1;i!=m;)l=t[i],i+=1,"'"==l?a?(c=a.join(""),a=o):a=[]:a?a.push(l):"{"==l?(d.push([f,c]),f={},c=o):"}"==l?(s=d.pop(),s[0][s[1]]=f,c=o,f=s[0]):"-"==l?h=-1:c===o?r.hasOwnProperty(l)?(p+=r[l],c=parseInt(p,16)*h,h=1,p=""):p+=l:r.hasOwnProperty(l)?(g+=r[l],f[c]=parseInt(g,16)*h,h=1,c=o,g=""):g+=l;return u},n={codePages:["WinAnsiEncoding"],WinAnsiEncoding:e("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},r={Unicode:{Courier:n,"Courier-Bold":n,"Courier-BoldOblique":n,"Courier-Oblique":n,Helvetica:n,"Helvetica-Bold":n,"Helvetica-BoldOblique":n,"Helvetica-Oblique":n,"Times-Roman":n,"Times-Bold":n,"Times-BoldItalic":n,"Times-Italic":n}},i={Unicode:{"Courier-Oblique":e("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":e("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":e("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:e("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":e("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":e("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Helvetica:e("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":e("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),"Courier-Bold":e("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":e("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":e("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":e("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};t.events.push(["addFont",function(t){var e,n,o,a="Unicode";e=i[a][t.PostScriptName],e&&(n=t.metadata[a]?t.metadata[a]:t.metadata[a]={},n.widths=e.widths,n.kerning=e.kerning),o=r[a][t.PostScriptName],o&&(n=t.metadata[a]?t.metadata[a]:t.metadata[a]={},n.encoding=o,o.codePages&&o.codePages.length&&(t.encoding=o.codePages[0]))}])}(e.API),function(t){t.addSVG=function(t,e,n,r,i){function o(t,e){var n=e.createElement("style");n.type="text/css",n.styleSheet?n.styleSheet.cssText=t:n.appendChild(e.createTextNode(t)),e.getElementsByTagName("head")[0].appendChild(n)}function a(t){var e="childframe",n=t.createElement("iframe");return o(".jsPDF_sillysvg_iframe {display:none;position:absolute;}",t),n.name=e,n.setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("frameborder","0"),n.setAttribute("scrolling","no"),n.setAttribute("seamless","seamless"),n.setAttribute("class","jsPDF_sillysvg_iframe"),t.body.appendChild(n),n}function s(t,e){var n=(e.contentWindow||e.contentDocument).document;return n.write(t),n.close(),n.getElementsByTagName("svg")[0]}function c(t){for(var e=parseFloat(t[1]),n=parseFloat(t[2]),r=[],i=3,o=t.length;i<o;)"c"===t[i]?(r.push([parseFloat(t[i+1]),parseFloat(t[i+2]),parseFloat(t[i+3]),parseFloat(t[i+4]),parseFloat(t[i+5]),parseFloat(t[i+6])]),i+=7):"l"===t[i]?(r.push([parseFloat(t[i+1]),parseFloat(t[i+2])]),i+=3):i+=1;return[e,n,r]}var l;if(e===l||n===l)throw new Error("addSVG needs values for 'x' and 'y'");var u=a(document),h=s(t,u),f=[1,1],d=parseFloat(h.getAttribute("width")),p=parseFloat(h.getAttribute("height"));d&&p&&(r&&i?f=[r/d,i/p]:r?f=[r/d,r/d]:i&&(f=[i/p,i/p]));var g,m,w,y,v=h.childNodes;for(g=0,m=v.length;g<m;g++)w=v[g],w.tagName&&"PATH"===w.tagName.toUpperCase()&&(y=c(w.getAttribute("d").split(" ")),y[0]=y[0]*f[0]+e,y[1]=y[1]*f[1]+n,this.lines.call(this,y[2],y[0],y[1],f));return this}}(e.API),/** ====================================================================+ * jsPDF total_pages plugin+ * Copyright (c) 2013 Eduardo Menezes de Morais, [email protected]+ *+ *+ * ====================================================================+ */+ function(t){t.putTotalPages=function(t){for(var e=new RegExp(t,"g"),n=1;n<=this.internal.getNumberOfPages();n++)for(var r=0;r<this.internal.pages[n].length;r++)this.internal.pages[n][r]=this.internal.pages[n][r].replace(e,this.internal.getNumberOfPages());return this}}(e.API),/** ====================================================================+ * jsPDF XMP metadata plugin+ * Copyright (c) 2016 Jussi Utunen, [email protected]+ *+ *+ * ====================================================================+ */+ function(t){var e="",n="",r="";t.addMetadata=function(t,i){return n=i||"http://jspdf.default.namespaceuri/",e=t,this.internal.events.subscribe("postPutResources",function(){if(e){var t='<x:xmpmeta xmlns:x="adobe:ns:meta/">',i='<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+n+'"><jspdf:metadata>',o="</jspdf:metadata></rdf:Description></rdf:RDF>",a="</x:xmpmeta>",s=unescape(encodeURIComponent(t)),c=unescape(encodeURIComponent(i)),l=unescape(encodeURIComponent(e)),u=unescape(encodeURIComponent(o)),h=unescape(encodeURIComponent(a)),f=c.length+l.length+u.length+s.length+h.length;r=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+f+" >>"),this.internal.write("stream"),this.internal.write(s+c+l+u+h),this.internal.write("endstream"),this.internal.write("endobj")}else r=""}),this.internal.events.subscribe("putCatalog",function(){r&&this.internal.write("/Metadata "+r+" 0 R")}),this}}(e.API),function(t){if(t.URL=t.URL||t.webkitURL,t.Blob&&t.URL)try{return void new Blob}catch(t){}var e=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||function(t){var e=function(t){return Object.prototype.toString.call(t).match(/^\[object\s(.*)\]$/)[1]},n=function(){this.data=[]},r=function(t,e,n){this.data=t,this.size=t.length,this.type=e,this.encoding=n},i=n.prototype,o=r.prototype,a=t.FileReaderSync,s=function(t){this.code=this[this.name=t]},c="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),l=c.length,u=t.URL||t.webkitURL||t,h=u.createObjectURL,f=u.revokeObjectURL,d=u,p=t.btoa,g=t.atob,m=t.ArrayBuffer,w=t.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(r.fake=o.fake=!0;l--;)s.prototype[c[l]]=l+1;return u.createObjectURL||(d=t.URL=function(t){var e,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=t,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(e=t.match(y),n.origin=e&&e[1])),n}),d.createObjectURL=function(t){var e,n=t.type;return null===n&&(n="application/octet-stream"),t instanceof r?(e="data:"+n,"base64"===t.encoding?e+";base64,"+t.data:"URI"===t.encoding?e+","+decodeURIComponent(t.data):p?e+";base64,"+p(t.data):e+","+encodeURIComponent(t.data)):h?h.call(u,t):void 0},d.revokeObjectURL=function(t){"data:"!==t.substring(0,5)&&f&&f.call(u,t)},i.append=function(t){var n=this.data;if(w&&(t instanceof m||t instanceof w)){for(var i="",o=new w(t),c=0,l=o.length;c<l;c++)i+=String.fromCharCode(o[c]);n.push(i)}else if("Blob"===e(t)||"File"===e(t)){if(!a)throw new s("NOT_READABLE_ERR");var u=new a;n.push(u.readAsBinaryString(t))}else t instanceof r?"base64"===t.encoding&&g?n.push(g(t.data)):"URI"===t.encoding?n.push(decodeURIComponent(t.data)):"raw"===t.encoding&&n.push(t.data):("string"!=typeof t&&(t+=""),n.push(unescape(encodeURIComponent(t))))},i.getBlob=function(t){return arguments.length||(t=null),new r(this.data.join(""),t,"raw")},i.toString=function(){return"[object BlobBuilder]"},o.slice=function(t,e,n){var i=arguments.length;return i<3&&(n=null),new r(this.data.slice(t,i>1?e:this.data.length),n,this.encoding)},o.toString=function(){return"[object Blob]"},o.close=function(){this.size=0,delete this.data},n}(t);t.Blob=function(t,n){var r=n?n.type||"":"",i=new e;if(t)for(var o=0,a=t.length;o<a;o++)Uint8Array&&t[o]instanceof Uint8Array?i.append(t[o].buffer):i.append(t[o]);var s=i.getBlob(r);return!s.slice&&s.webkitSlice&&(s.slice=s.webkitSlice),s};var n=Object.getPrototypeOf||function(t){return t.__proto__};t.Blob.prototype=n(new t.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content||void 0);var i=i||function(t){if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=t.document,n=function(){return t.URL||t.webkitURL||t},r=e.createElementNS("http://www.w3.org/1999/xhtml","a"),i="download"in r,o=function(t){var e=new MouseEvent("click");t.dispatchEvent(e)},a=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),s=t.webkitRequestFileSystem,c=t.requestFileSystem||s||t.mozRequestFileSystem,l=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},u="application/octet-stream",h=0,f=500,d=function(e){var r=function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()};t.chrome?r():setTimeout(r,f)},p=function(t,e,n){e=[].concat(e);for(var r=e.length;r--;){var i=t["on"+e[r]];if("function"==typeof i)try{i.call(t,n||t)}catch(t){l(t)}}},g=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},m=function(e,l,f){f||(e=g(e));var m,w,y,v=this,b=e.type,x=!1,k=function(){p(v,"writestart progress write writeend".split(" "))},_=function(){if(w&&a&&"undefined"!=typeof FileReader){var r=new FileReader;return r.onloadend=function(){var t=r.result;w.location.href="data:attachment/file"+t.slice(t.search(/[,;]/)),v.readyState=v.DONE,k()},r.readAsDataURL(e),void(v.readyState=v.INIT)}if(!x&&m||(m=n().createObjectURL(e)),w)w.location.href=m;else{var i=t.open(m,"_blank");void 0==i&&a&&(t.location.href=m)}v.readyState=v.DONE,k(),d(m)},C=function(t){return function(){if(v.readyState!==v.DONE)return t.apply(this,arguments)}},A={create:!0,exclusive:!1};return v.readyState=v.INIT,l||(l="download"),i?(m=n().createObjectURL(e),void setTimeout(function(){r.href=m,r.download=l,o(r),k(),d(m),v.readyState=v.DONE})):(t.chrome&&b&&b!==u&&(y=e.slice||e.webkitSlice,e=y.call(e,0,e.size,u),x=!0),s&&"download"!==l&&(l+=".download"),(b===u||s)&&(w=t),c?(h+=e.size,void c(t.TEMPORARY,h,C(function(t){t.root.getDirectory("saved",A,C(function(t){var n=function(){t.getFile(l,A,C(function(t){t.createWriter(C(function(n){n.onwriteend=function(e){w.location.href=t.toURL(),v.readyState=v.DONE,p(v,"writeend",e),d(t)},n.onerror=function(){var t=n.error;t.code!==t.ABORT_ERR&&_()},"writestart progress write abort".split(" ").forEach(function(t){n["on"+t]=v["on"+t]}),n.write(e),v.abort=function(){n.abort(),v.readyState=v.DONE},v.readyState=v.WRITING}),_)}),_)};t.getFile(l,{create:!1},C(function(t){t.remove(),n()}),C(function(t){t.code===t.NOT_FOUND_ERR?n():_()}))}),_)}),_)):void _())},w=m.prototype,y=function(t,e,n){return new m(t,e,n)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return n||(t=g(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(w.abort=function(){var t=this;t.readyState=t.DONE,p(t,"abort")},w.readyState=w.INIT=0,w.WRITING=1,w.DONE=2,w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null,y)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content);"undefined"!=typeof module&&module.exports?module.exports.saveAs=i:"undefined"!=typeof define&&null!==define&&null!=define.amd&&define([],function(){return i}),/*+ * Copyright (c) 2012 chick307 <[email protected]>+ *+ * Licensed under the MIT License.+ * http://opensource.org/licenses/mit-license+ */+ void function(t,e){"object"==typeof module?module.exports=e():"function"==typeof define?define(e):t.adler32cs=e()}(e,function(){var t="function"==typeof ArrayBuffer&&"function"==typeof Uint8Array,e=null,n=function(){if(!t)return function(){return!1};try{var n={};"function"==typeof n.Buffer&&(e=n.Buffer)}catch(t){}return function(t){return t instanceof ArrayBuffer||null!==e&&t instanceof e}}(),r=function(){return null!==e?function(t){return new e(t,"utf8").toString("binary")}:function(t){return unescape(encodeURIComponent(t))}}(),i=65521,o=function(t,e){for(var n=65535&t,r=t>>>16,o=0,a=e.length;o<a;o++)n=(n+(255&e.charCodeAt(o)))%i,r=(r+n)%i;return(r<<16|n)>>>0},a=function(t,e){for(var n=65535&t,r=t>>>16,o=0,a=e.length;o<a;o++)n=(n+e[o])%i,r=(r+n)%i;return(r<<16|n)>>>0},s={},c=s.Adler32=function(){var e=function(t){if(!(this instanceof e))throw new TypeError("Constructor cannot called be as a function.");if(!isFinite(t=null==t?1:+t))throw new Error("First arguments needs to be a finite number.");this.checksum=t>>>0},i=e.prototype={};return i.constructor=e,e.from=function(t){return t.prototype=i,t}(function(t){if(!(this instanceof e))throw new TypeError("Constructor cannot called be as a function.");if(null==t)throw new Error("First argument needs to be a string.");this.checksum=o(1,t.toString())}),e.fromUtf8=function(t){return t.prototype=i,t}(function(t){if(!(this instanceof e))throw new TypeError("Constructor cannot called be as a function.");if(null==t)throw new Error("First argument needs to be a string.");var n=r(t.toString());this.checksum=o(1,n)}),t&&(e.fromBuffer=function(t){return t.prototype=i,t}(function(t){if(!(this instanceof e))throw new TypeError("Constructor cannot called be as a function.");if(!n(t))throw new Error("First argument needs to be ArrayBuffer.");var r=new Uint8Array(t);return this.checksum=a(1,r)})),i.update=function(t){if(null==t)throw new Error("First argument needs to be a string.");return t=t.toString(),this.checksum=o(this.checksum,t)},i.updateUtf8=function(t){if(null==t)throw new Error("First argument needs to be a string.");var e=r(t.toString());return this.checksum=o(this.checksum,e)},t&&(i.updateBuffer=function(t){if(!n(t))throw new Error("First argument needs to be ArrayBuffer.");var e=new Uint8Array(t);return this.checksum=a(this.checksum,e)}),i.clone=function(){return new c(this.checksum)},e}();return s.from=function(t){if(null==t)throw new Error("First argument needs to be a string.");return o(1,t.toString())},s.fromUtf8=function(t){if(null==t)throw new Error("First argument needs to be a string.");var e=r(t.toString());return o(1,e)},t&&(s.fromBuffer=function(t){if(!n(t))throw new Error("First argument need to be ArrayBuffer.");var e=new Uint8Array(t);return a(1,e)}),s});/**+ * CssColors+ * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected]+ *+ * Licensed under the MIT License.+ * http://opensource.org/licenses/mit-license+ */+var o={};o._colorsTable={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},o.colorNameToHex=function(t){return t=t.toLowerCase(),"undefined"!=typeof this._colorsTable[t]&&this._colorsTable[t]};/*+ Deflate.js - https://github.com/gildas-lormeau/zip.js+ Copyright (c) 2013 Gildas Lormeau. All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ 1. Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in+ the documentation and/or other materials provided with the distribution.++ 3. The names of the authors may not be used to endorse or promote products+ derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,+ INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+ */+ var a=function(t){function e(){function t(t){var e,n,i,o,a,c,l=r.dyn_tree,u=r.stat_desc.static_tree,h=r.stat_desc.extra_bits,f=r.stat_desc.extra_base,p=r.stat_desc.max_length,g=0;for(o=0;o<=s;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,e=t.heap_max+1;e<d;e++)n=t.heap[e],o=l[2*l[2*n+1]+1]+1,o>p&&(o=p,g++),l[2*n+1]=o,n>r.max_code||(t.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),c=l[2*n],t.opt_len+=c*(o+a),u&&(t.static_len+=c*(u[2*n+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(n=t.bl_count[o];0!==n;)i=t.heap[--e],i>r.max_code||(l[2*i+1]!=o&&(t.opt_len+=(o-l[2*i+1])*l[2*i],l[2*i+1]=o),n--)}}function e(t,e){var n=0;do n|=1&t,t>>>=1,n<<=1;while(--e>0);return n>>>1}function n(t,n,r){var i,o,a,c=[],l=0;for(i=1;i<=s;i++)c[i]=l=l+r[i-1]<<1;for(o=0;o<=n;o++)a=t[2*o+1],0!==a&&(t[2*o]=e(c[a]++,a))}var r=this;r.build_tree=function(e){var i,o,a,s=r.dyn_tree,c=r.stat_desc.static_tree,l=r.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=d,i=0;i<l;i++)0!==s[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):s[2*i+1]=0;for(;e.heap_len<2;)a=e.heap[++e.heap_len]=u<2?++u:0,s[2*a]=1,e.depth[a]=0,e.opt_len--,c&&(e.static_len-=c[2*a+1]);for(r.max_code=u,i=Math.floor(e.heap_len/2);i>=1;i--)e.pqdownheap(s,i);a=l;do i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],e.pqdownheap(s,1),o=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=o,s[2*a]=s[2*i]+s[2*o],e.depth[a]=Math.max(e.depth[i],e.depth[o])+1,s[2*i+1]=s[2*o+1]=a,e.heap[1]=a++,e.pqdownheap(s,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],t(e),n(s,r.max_code,e.bl_count)}}function n(t,e,n,r,i){var o=this;o.static_tree=t,o.extra_bits=e,o.extra_base=n,o.elems=r,o.max_length=i}function r(t,e,n,r,i){var o=this;o.good_length=t,o.max_lazy=e,o.nice_length=n,o.max_chain=r,o.func=i}function i(t,e,n,r){var i=t[2*e],o=t[2*n];return i<o||i==o&&r[e]<=r[n]}function o(){function t(){var t;for(Pt=2*St,Ot[Rt-1]=0,t=0;t<Rt-1;t++)Ot[t]=0;Yt=L[Gt].max_lazy,Qt=L[Gt].good_length,Kt=L[Gt].nice_length,Vt=L[Gt].max_chain,Ut=0,Nt=0,Wt=0,zt=Xt=tt-1,Mt=0,Ft=0}function r(){var t;for(t=0;t<f;t++)$t[2*t]=0;for(t=0;t<c;t++)Zt[2*t]=0;for(t=0;t<l;t++)te[2*t]=0;$t[2*p]=1,ee.opt_len=ee.static_len=0,se=le=0}function o(){ne.dyn_tree=$t,ne.stat_desc=n.static_l_desc,re.dyn_tree=Zt,re.stat_desc=n.static_d_desc,ie.dyn_tree=te,ie.stat_desc=n.static_bl_desc,he=0,fe=0,ue=8,r()}function a(t,e){var n,r,i=-1,o=t[1],a=0,s=7,c=4;for(0===o&&(s=138,c=3),t[2*(e+1)+1]=65535,n=0;n<=e;n++)r=o,o=t[2*(n+1)+1],++a<s&&r==o||(a<c?te[2*r]+=a:0!==r?(r!=i&&te[2*r]++,te[2*m]++):a<=10?te[2*w]++:te[2*y]++,a=0,i=r,0===o?(s=138,c=3):r==o?(s=6,c=3):(s=7,c=4))}function s(){var t;for(a($t,ne.max_code),a(Zt,re.max_code),ie.build_tree(ee),t=l-1;t>=3&&0===te[2*e.bl_order[t]+1];t--);return ee.opt_len+=3*(t+1)+5+5+4,t}function u(t){ee.pending_buf[ee.pending++]=t}function d(t){u(255&t),u(t>>>8&255)}function g(t){u(t>>8&255),u(255&t&255)}function R(t,e){var n,r=e;fe>v-r?(n=t,he|=n<<fe&65535,d(he),he=n>>>v-fe,fe+=r-v):(he|=t<<fe&65535,fe+=r)}function rt(t,e){var n=2*t;R(65535&e[n],65535&e[n+1])}function it(t,e){var n,r,i=-1,o=t[1],a=0,s=7,c=4;for(0===o&&(s=138,c=3),n=0;n<=e;n++)if(r=o,o=t[2*(n+1)+1],!(++a<s&&r==o)){if(a<c){do rt(r,te);while(0!==--a)}else 0!==r?(r!=i&&(rt(r,te),a--),rt(m,te),R(a-3,2)):a<=10?(rt(w,te),R(a-3,3)):(rt(y,te),R(a-11,7));a=0,i=r,0===o?(s=138,c=3):r==o?(s=6,c=3):(s=7,c=4)}}function ot(t,n,r){var i;for(R(t-257,5),R(n-1,5),R(r-4,4),i=0;i<r;i++)R(te[2*e.bl_order[i]+1],3);it($t,t-1),it(Zt,n-1)}function at(){16==fe?(d(he),he=0,fe=0):fe>=8&&(u(255&he),he>>>=8,fe-=8)}function st(){R($<<1,3),rt(p,n.static_ltree),at(),1+ue+10-fe<9&&(R($<<1,3),rt(p,n.static_ltree),at()),ue=7}function ct(t,n){var r,i,o;if(ee.pending_buf[ce+2*se]=t>>>8&255,ee.pending_buf[ce+2*se+1]=255&t,ee.pending_buf[oe+se]=255&n,se++,0===t?$t[2*n]++:(le++,t--,$t[2*(e._length_code[n]+h+1)]++,Zt[2*e.d_code(t)]++),0===(8191&se)&&Gt>2){for(r=8*se,i=Ut-Nt,o=0;o<c;o++)r+=Zt[2*o]*(5+e.extra_dbits[o]);if(r>>>=3,le<Math.floor(se/2)&&r<Math.floor(i/2))return!0}return se==ae-1}function lt(t,n){var r,i,o,a,s=0;if(0!==se)do r=ee.pending_buf[ce+2*s]<<8&65280|255&ee.pending_buf[ce+2*s+1],i=255&ee.pending_buf[oe+s],s++,0===r?rt(i,t):(o=e._length_code[i],rt(o+h+1,t),a=e.extra_lbits[o],0!==a&&(i-=e.base_length[o],R(i,a)),r--,o=e.d_code(r),rt(o,n),a=e.extra_dbits[o],0!==a&&(r-=e.base_dist[o],R(r,a)));while(s<se);rt(p,t),ue=t[2*p+1]}function ut(){fe>8?d(he):fe>0&&u(255&he),he=0,fe=0}function ht(t,e,n){ut(),ue=8,n&&(d(e),d(~e)),ee.pending_buf.set(It.subarray(t,t+e),ee.pending),ee.pending+=e}function ft(t,e,n){R((K<<1)+(n?1:0),3),ht(t,e,!0)}function dt(t,e,i){var o,a,c=0;Gt>0?(ne.build_tree(ee),re.build_tree(ee),c=s(),o=ee.opt_len+3+7>>>3,a=ee.static_len+3+7>>>3,a<=o&&(o=a)):o=a=e+5,e+4<=o&&t!=-1?ft(t,e,i):a==o?(R(($<<1)+(i?1:0),3),lt(n.static_ltree,n.static_dtree)):(R((Z<<1)+(i?1:0),3),ot(ne.max_code+1,re.max_code+1,c+1),lt($t,Zt)),r(),i&&ut()}function pt(t){dt(Nt>=0?Nt:-1,Ut-Nt,t),Nt=Ut,xt.flush_pending()}function gt(){var t,e,n,r;do{if(r=Pt-Wt-Ut,0===r&&0===Ut&&0===Wt)r=St;else if(r==-1)r--;else if(Ut>=St+St-nt){It.set(It.subarray(St,St+St),0),Ht-=St,Ut-=St,Nt-=St,t=Rt,n=t;do e=65535&Ot[--n],Ot[n]=e>=St?e-St:0;while(0!==--t);t=St,n=t;do e=65535&Et[--n],Et[n]=e>=St?e-St:0;while(0!==--t);r+=St}if(0===xt.avail_in)return;t=xt.read_buf(It,Ut+Wt,r),Wt+=t,Wt>=tt&&(Ft=255&It[Ut],Ft=(Ft<<jt^255&It[Ut+1])&Dt)}while(Wt<nt&&0!==xt.avail_in)}function mt(t){var e,n=65535;for(n>_t-5&&(n=_t-5);;){if(Wt<=1){if(gt(),0===Wt&&t==C)return U;if(0===Wt)break}if(Ut+=Wt,Wt=0,e=Nt+n,(0===Ut||Ut>=e)&&(Wt=Ut-e,Ut=e,pt(!1),0===xt.avail_out))return U;if(Ut-Nt>=St-nt&&(pt(!1),0===xt.avail_out))return U}return pt(t==q),0===xt.avail_out?t==q?W:U:t==q?X:H}function wt(t){var e,n,r=Vt,i=Ut,o=Xt,a=Ut>St-nt?Ut-(St-nt):0,s=Kt,c=Tt,l=Ut+et,u=It[i+o-1],h=It[i+o];Xt>=Qt&&(r>>=2),s>Wt&&(s=Wt);do if(e=t,It[e+o]==h&&It[e+o-1]==u&&It[e]==It[i]&&It[++e]==It[i+1]){i+=2,e++;do;while(It[++i]==It[++e]&&It[++i]==It[++e]&&It[++i]==It[++e]&&It[++i]==It[++e]&&It[++i]==It[++e]&&It[++i]==It[++e]&&It[++i]==It[++e]&&It[++i]==It[++e]&&i<l);if(n=et-(l-i),i=l-et,n>o){if(Ht=t,o=n,n>=s)break;u=It[i+o-1],h=It[i+o]}}while((t=65535&Et[t&c])>a&&0!==--r);return o<=Wt?o:Wt}function yt(t){for(var e,n=0;;){if(Wt<nt){if(gt(),Wt<nt&&t==C)return U;if(0===Wt)break}if(Wt>=tt&&(Ft=(Ft<<jt^255&It[Ut+(tt-1)])&Dt,n=65535&Ot[Ft],Et[Ut&Tt]=Ot[Ft],Ot[Ft]=Ut),0!==n&&(Ut-n&65535)<=St-nt&&Jt!=k&&(zt=wt(n)),zt>=tt)if(e=ct(Ut-Ht,zt-tt),Wt-=zt,zt<=Yt&&Wt>=tt){zt--;do Ut++,Ft=(Ft<<jt^255&It[Ut+(tt-1)])&Dt,n=65535&Ot[Ft],Et[Ut&Tt]=Ot[Ft],Ot[Ft]=Ut;while(0!==--zt);Ut++}else Ut+=zt,zt=0,Ft=255&It[Ut],Ft=(Ft<<jt^255&It[Ut+1])&Dt;else e=ct(0,255&It[Ut]),Wt--,Ut++;if(e&&(pt(!1),0===xt.avail_out))return U}return pt(t==q),0===xt.avail_out?t==q?W:U:t==q?X:H}function vt(t){for(var e,n,r=0;;){if(Wt<nt){if(gt(),Wt<nt&&t==C)return U;if(0===Wt)break}if(Wt>=tt&&(Ft=(Ft<<jt^255&It[Ut+(tt-1)])&Dt,r=65535&Ot[Ft],Et[Ut&Tt]=Ot[Ft],Ot[Ft]=Ut),Xt=zt,Lt=Ht,zt=tt-1,0!==r&&Xt<Yt&&(Ut-r&65535)<=St-nt&&(Jt!=k&&(zt=wt(r)),zt<=5&&(Jt==x||zt==tt&&Ut-Ht>4096)&&(zt=tt-1)),Xt>=tt&&zt<=Xt){n=Ut+Wt-tt,e=ct(Ut-1-Lt,Xt-tt),Wt-=Xt-1,Xt-=2;do++Ut<=n&&(Ft=(Ft<<jt^255&It[Ut+(tt-1)])&Dt,r=65535&Ot[Ft],Et[Ut&Tt]=Ot[Ft],Ot[Ft]=Ut);while(0!==--Xt);if(Mt=0,zt=tt-1,Ut++,e&&(pt(!1),0===xt.avail_out))return U}else if(0!==Mt){if(e=ct(0,255&It[Ut-1]),e&&pt(!1),Ut++,Wt--,0===xt.avail_out)return U}else Mt=1,Ut++,Wt--}return 0!==Mt&&(e=ct(0,255&It[Ut-1]),Mt=0),pt(t==q),0===xt.avail_out?t==q?W:U:t==q?X:H}function bt(e){return e.total_in=e.total_out=0,e.msg=null,ee.pending=0,ee.pending_out=0,kt=G,At=C,o(),t(),T}var xt,kt,_t,Ct,At,St,qt,Tt,It,Pt,Et,Ot,Ft,Rt,Bt,Dt,jt,Nt,zt,Lt,Mt,Ut,Ht,Wt,Xt,Vt,Yt,Gt,Jt,Qt,Kt,$t,Zt,te,ee=this,ne=new e,re=new e,ie=new e;ee.depth=[];var oe,ae,se,ce,le,ue,he,fe;ee.bl_count=[],ee.heap=[],$t=[],Zt=[],te=[],ee.pqdownheap=function(t,e){for(var n=ee.heap,r=n[e],o=e<<1;o<=ee.heap_len&&(o<ee.heap_len&&i(t,n[o+1],n[o],ee.depth)&&o++,!i(t,r,n[o],ee.depth));)n[e]=n[o],e=o,o<<=1;n[e]=r},ee.deflateInit=function(t,e,n,r,i,o){return r||(r=Q),i||(i=D),o||(o=_),t.msg=null,e==b&&(e=6),i<1||i>B||r!=Q||n<9||n>15||e<0||e>9||o<0||o>k?E:(t.dstate=ee,qt=n,St=1<<qt,Tt=St-1,Bt=i+7,Rt=1<<Bt,Dt=Rt-1,jt=Math.floor((Bt+tt-1)/tt),It=new Uint8Array(2*St),Et=[],Ot=[],ae=1<<i+6,ee.pending_buf=new Uint8Array(4*ae),_t=4*ae,ce=Math.floor(ae/2),oe=3*ae,Gt=e,Jt=o,Ct=255&r,bt(t))},ee.deflateEnd=function(){return kt!=Y&&kt!=G&&kt!=J?E:(ee.pending_buf=null,Ot=null,Et=null,It=null,ee.dstate=null,kt==G?O:T)},ee.deflateParams=function(t,e,n){var r=T;return e==b&&(e=6),e<0||e>9||n<0||n>k?E:(L[Gt].func!=L[e].func&&0!==t.total_in&&(r=t.deflate(A)),Gt!=e&&(Gt=e,Yt=L[Gt].max_lazy,Qt=L[Gt].good_length,Kt=L[Gt].nice_length,Vt=L[Gt].max_chain),Jt=n,r)},ee.deflateSetDictionary=function(t,e,n){var r,i=n,o=0;if(!e||kt!=Y)return E;if(i<tt)return T;for(i>St-nt&&(i=St-nt,o=n-i),It.set(e.subarray(o,o+i),0),Ut=i,Nt=i,Ft=255&It[0],Ft=(Ft<<jt^255&It[1])&Dt,r=0;r<=i-tt;r++)Ft=(Ft<<jt^255&It[r+(tt-1)])&Dt,Et[r&Tt]=Ot[Ft],Ot[Ft]=r;return T},ee.deflate=function(t,e){var n,r,i,o,a;if(e>q||e<0)return E;if(!t.next_out||!t.next_in&&0!==t.avail_in||kt==J&&e!=q)return t.msg=M[P-E],E;if(0===t.avail_out)return t.msg=M[P-F],F;if(xt=t,o=At,At=e,kt==Y&&(r=Q+(qt-8<<4)<<8,i=(Gt-1&255)>>1,i>3&&(i=3),r|=i<<6,0!==Ut&&(r|=V),r+=31-r%31,kt=G,g(r)),0!==ee.pending){if(xt.flush_pending(),0===xt.avail_out)return At=-1,T}else if(0===xt.avail_in&&e<=o&&e!=q)return xt.msg=M[P-F],F;if(kt==J&&0!==xt.avail_in)return t.msg=M[P-F],F;if(0!==xt.avail_in||0!==Wt||e!=C&&kt!=J){switch(a=-1,L[Gt].func){case j:a=mt(e);break;case N:a=yt(e);break;case z:a=vt(e)}if(a!=W&&a!=X||(kt=J),a==U||a==W)return 0===xt.avail_out&&(At=-1),T;if(a==H){if(e==A)st();else if(ft(0,0,!1),e==S)for(n=0;n<Rt;n++)Ot[n]=0;if(xt.flush_pending(),0===xt.avail_out)return At=-1,T}}return e!=q?T:I}}function a(){var t=this;t.next_in_index=0,t.next_out_index=0,t.avail_in=0,t.total_in=0,t.avail_out=0,t.total_out=0}var s=15,c=30,l=19,u=29,h=256,f=h+1+u,d=2*f+1,p=256,g=7,m=16,w=17,y=18,v=16,b=-1,x=1,k=2,_=0,C=0,A=1,S=3,q=4,T=0,I=1,P=2,E=-2,O=-3,F=-5,R=[0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,16,17,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29];e._length_code=[0,1,2,3,4,5,6,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28],e.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],e.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],e.d_code=function(t){return t<256?R[t]:R[256+(t>>>7)]},e.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],e.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],e.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],n.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],n.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],n.static_l_desc=new n(n.static_ltree,e.extra_lbits,h+1,f,s),n.static_d_desc=new n(n.static_dtree,e.extra_dbits,0,c,s),n.static_bl_desc=new n(null,e.extra_blbits,0,l,g);var B=9,D=8,j=0,N=1,z=2,L=[new r(0,0,0,0,j),new r(4,4,8,4,N),new r(4,5,16,8,N),new r(4,6,32,32,N),new r(4,4,16,16,z),new r(8,16,32,32,z),new r(8,16,128,128,z),new r(8,32,128,256,z),new r(32,128,258,1024,z),new r(32,258,258,4096,z)],M=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],U=0,H=1,W=2,X=3,V=32,Y=42,G=113,J=666,Q=8,K=0,$=1,Z=2,tt=3,et=258,nt=et+tt+1;return a.prototype={deflateInit:function(t,e){var n=this;return n.dstate=new o,e||(e=s),n.dstate.deflateInit(n,t,e)},deflate:function(t){var e=this;return e.dstate?e.dstate.deflate(e,t):E},deflateEnd:function(){var t=this;if(!t.dstate)return E;var e=t.dstate.deflateEnd();return t.dstate=null,e},deflateParams:function(t,e){var n=this;return n.dstate?n.dstate.deflateParams(n,t,e):E},deflateSetDictionary:function(t,e){var n=this;return n.dstate?n.dstate.deflateSetDictionary(n,t,e):E},read_buf:function(t,e,n){var r=this,i=r.avail_in;return i>n&&(i=n),0===i?0:(r.avail_in-=i,t.set(r.next_in.subarray(r.next_in_index,r.next_in_index+i),e),r.next_in_index+=i,r.total_in+=i,i)},flush_pending:function(){var t=this,e=t.dstate.pending;e>t.avail_out&&(e=t.avail_out),0!==e&&(t.next_out.set(t.dstate.pending_buf.subarray(t.dstate.pending_out,t.dstate.pending_out+e),t.next_out_index),t.next_out_index+=e,t.dstate.pending_out+=e,t.total_out+=e,t.avail_out-=e,t.dstate.pending-=e,0===t.dstate.pending&&(t.dstate.pending_out=0))}},function(t){var e=this,n=new a,r=512,i=C,o=new Uint8Array(r);"undefined"==typeof t&&(t=b),n.deflateInit(t),n.next_out=o,e.append=function(t,e){var a,s,c=[],l=0,u=0,h=0;if(t.length){n.next_in_index=0,n.next_in=t,n.avail_in=t.length;do{if(n.next_out_index=0,n.avail_out=r,a=n.deflate(i),a!=T)throw"deflating: "+n.msg;n.next_out_index&&(n.next_out_index==r?c.push(new Uint8Array(o)):c.push(new Uint8Array(o.subarray(0,n.next_out_index)))),h+=n.next_out_index,e&&n.next_in_index>0&&n.next_in_index!=l&&(e(n.next_in_index),l=n.next_in_index)}while(n.avail_in>0||0===n.avail_out);return s=new Uint8Array(h),c.forEach(function(t){s.set(t,u),u+=t.length}),s}},e.flush=function(){var t,e,i=[],a=0,s=0;do{if(n.next_out_index=0,n.avail_out=r,t=n.deflate(q),t!=I&&t!=T)throw"deflating: "+n.msg;r-n.avail_out>0&&i.push(new Uint8Array(o.subarray(0,n.next_out_index))),s+=n.next_out_index}while(n.avail_in>0||0===n.avail_out);return n.deflateEnd(),e=new Uint8Array(s),i.forEach(function(t){e.set(t,a),a+=t.length}),e}}}(void 0);/*+ html2canvas 0.5.0-beta3 <http://html2canvas.hertzen.com>+ Copyright (c) 2016 Niklas von Hertzen++ Released under License+ */+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.html2canvas=t()}}(function(){var t;return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n?n:t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,n,r){(function(e){!function(i){function o(t){throw RangeError(R[t])}function a(t,e){for(var n=t.length;n--;)t[n]=e(t[n]);return t}function s(t,e){return a(t.split(F),e).join(".")}function c(t){for(var e,n,r=[],i=0,o=t.length;i<o;)e=t.charCodeAt(i++),e>=55296&&e<=56319&&i<o?(n=t.charCodeAt(i++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--)):r.push(e);return r}function l(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=j(t>>>10&1023|55296),t=56320|1023&t),e+=j(t)}).join("")}function u(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:_}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,n){var r=0;for(t=n?D(t/q):t>>1,t+=D(t/e);t>B*A>>1;r+=_)t=D(t/B);return D(r+(B+1)*t/(t+S))}function d(t){var e,n,r,i,a,s,c,h,d,p,g=[],m=t.length,w=0,y=I,v=T;for(n=t.lastIndexOf(P),n<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&o("not-basic"),g.push(t.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(a=w,s=1,c=_;i>=m&&o("invalid-input"),h=u(t.charCodeAt(i++)),(h>=_||h>D((k-w)/s))&&o("overflow"),w+=h*s,d=c<=v?C:c>=v+A?A:c-v,!(h<d);c+=_)p=_-d,s>D(k/p)&&o("overflow"),s*=p;e=g.length+1,v=f(w-a,e,0==a),D(w/e)>k-y&&o("overflow"),y+=D(w/e),w%=e,g.splice(w++,0,y)}return l(g)}function p(t){var e,n,r,i,a,s,l,u,d,p,g,m,w,y,v,b=[];for(t=c(t),m=t.length,e=I,n=0,a=T,s=0;s<m;++s)g=t[s],g<128&&b.push(j(g));for(r=i=b.length,i&&b.push(P);r<m;){for(l=k,s=0;s<m;++s)g=t[s],g>=e&&g<l&&(l=g);for(w=r+1,l-e>D((k-n)/w)&&o("overflow"),n+=(l-e)*w,e=l,s=0;s<m;++s)if(g=t[s],g<e&&++n>k&&o("overflow"),g==e){for(u=n,d=_;p=d<=a?C:d>=a+A?A:d-a,!(u<p);d+=_)v=u-p,y=_-p,b.push(j(h(p+v%y,0))),u=D(v/y);b.push(j(h(u,0))),a=f(n,w,r==i),n=0,++r}++n,++e}return b.join("")}function g(t){return s(t,function(t){return E.test(t)?d(t.slice(4).toLowerCase()):t})}function m(t){return s(t,function(t){return O.test(t)?"xn--"+p(t):t})}var w="object"==typeof r&&r,y="object"==typeof n&&n&&n.exports==w&&n,v="object"==typeof e&&e;v.global!==v&&v.window!==v||(i=v);var b,x,k=2147483647,_=36,C=1,A=26,S=38,q=700,T=72,I=128,P="-",E=/^xn--/,O=/[^ -~]/,F=/\x2E|\u3002|\uFF0E|\uFF61/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},B=_-C,D=Math.floor,j=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:c,encode:l},decode:d,encode:p,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(w&&!w.nodeType)if(y)y.exports=b;else for(x in b)b.hasOwnProperty(x)&&(w[x]=b[x]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){function r(t,e,n){!t.defaultView||e===t.defaultView.pageXOffset&&n===t.defaultView.pageYOffset||t.defaultView.scrollTo(e,n)}function i(t,e){try{e&&(e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t.getContext("2d").getImageData(0,0,t.width,t.height),0,0))}catch(e){s("Unable to copy canvas content from",t,e)}}function o(t,e){for(var n=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),r=t.firstChild;r;)e!==!0&&1===r.nodeType&&"SCRIPT"===r.nodeName||n.appendChild(o(r,e)),r=r.nextSibling;return 1===t.nodeType&&(n._scrollTop=t.scrollTop,n._scrollLeft=t.scrollLeft,"CANVAS"===t.nodeName?i(t,n):"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||(n.value=t.value)),n}function a(t){if(1===t.nodeType){t.scrollTop=t._scrollTop,t.scrollLeft=t._scrollLeft;for(var e=t.firstChild;e;)a(e),e=e.nextSibling}}var s=t("./log");e.exports=function(t,e,n,i,s,c,l){var u=o(t.documentElement,s.javascriptEnabled),h=e.createElement("iframe");return h.className="html2canvas-container",h.style.visibility="hidden",h.style.position="fixed",h.style.left="-10000px",h.style.top="0px",h.style.border="0",h.width=n,h.height=i,h.scrolling="no",e.body.appendChild(h),new Promise(function(e){var n=h.contentWindow.document;h.contentWindow.onload=h.onload=function(){var t=setInterval(function(){n.body.childNodes.length>0&&(a(n.documentElement),clearInterval(t),"view"===s.type&&(h.contentWindow.scrollTo(c,l),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||h.contentWindow.scrollY===l&&h.contentWindow.scrollX===c||(n.documentElement.style.top=-l+"px",n.documentElement.style.left=-c+"px",n.documentElement.style.position="absolute")),e(h))},50)},n.open(),n.write("<!DOCTYPE html><html></html>"),r(t,c,l),n.replaceChild(n.adoptNode(u),n.documentElement),n.close()})}},{"./log":13}],3:[function(t,e,n){function r(t){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(t)||this.namedColor(t)||this.rgb(t)||this.rgba(t)||this.hex6(t)||this.hex3(t)}r.prototype.darken=function(t){var e=1-t;return new r([Math.round(this.r*e),Math.round(this.g*e),Math.round(this.b*e),this.a])},r.prototype.isTransparent=function(){return 0===this.a},r.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},r.prototype.fromArray=function(t){return Array.isArray(t)&&(this.r=Math.min(t[0],255),this.g=Math.min(t[1],255),this.b=Math.min(t[2],255),t.length>3&&(this.a=t[3])),Array.isArray(t)};var i=/^#([a-f0-9]{3})$/i;r.prototype.hex3=function(t){var e=null;return null!==(e=t.match(i))&&(this.r=parseInt(e[1][0]+e[1][0],16),this.g=parseInt(e[1][1]+e[1][1],16),this.b=parseInt(e[1][2]+e[1][2],16)),null!==e};var o=/^#([a-f0-9]{6})$/i;r.prototype.hex6=function(t){var e=null;return null!==(e=t.match(o))&&(this.r=parseInt(e[1].substring(0,2),16),this.g=parseInt(e[1].substring(2,4),16),this.b=parseInt(e[1].substring(4,6),16)),null!==e};var a=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;r.prototype.rgb=function(t){var e=null;return null!==(e=t.match(a))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3])),null!==e};var s=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;r.prototype.rgba=function(t){var e=null;return null!==(e=t.match(s))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3]),this.a=Number(e[4])),null!==e},r.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},r.prototype.namedColor=function(t){t=t.toLowerCase();var e=c[t];if(e)this.r=e[0],this.g=e[1],this.b=e[2];else if("transparent"===t)return this.r=this.g=this.b=this.a=0,!0;return!!e},r.prototype.isColor=!0;var c={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};e.exports=r},{}],4:[function(e,n,r){function i(t,e){var n=_++;if(e=e||{},e.logging&&(w.options.logging=!0,w.options.start=Date.now()),e.async="undefined"==typeof e.async||e.async,e.allowTaint="undefined"!=typeof e.allowTaint&&e.allowTaint,e.removeContainer="undefined"==typeof e.removeContainer||e.removeContainer,e.javascriptEnabled="undefined"!=typeof e.javascriptEnabled&&e.javascriptEnabled,e.imageTimeout="undefined"==typeof e.imageTimeout?1e4:e.imageTimeout,e.renderer="function"==typeof e.renderer?e.renderer:d,e.strict=!!e.strict,"string"==typeof t){if("string"!=typeof e.proxy)return Promise.reject("Proxy must be used when rendering url");var r=null!=e.width?e.width:window.innerWidth,i=null!=e.height?e.height:window.innerHeight;return b(h(t),e.proxy,document,r,i,e).then(function(t){return a(t.contentWindow.document.documentElement,t,e,r,i)})}var s=(void 0===t?[document.documentElement]:t.length?t:[t])[0];return s.setAttribute(k+n,n),o(s.ownerDocument,e,s.ownerDocument.defaultView.innerWidth,s.ownerDocument.defaultView.innerHeight,n).then(function(t){return"function"==typeof e.onrendered&&(w("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),e.onrendered(t)),t})}function o(t,e,n,r,i){return v(t,t,n,r,e,t.defaultView.pageXOffset,t.defaultView.pageYOffset).then(function(o){w("Document cloned");var s=k+i,c="["+s+"='"+i+"']";t.querySelector(c).removeAttribute(s);var l=o.contentWindow,u=l.document.querySelector(c),h="function"==typeof e.onclone?Promise.resolve(e.onclone(l.document)):Promise.resolve(!0);return h.then(function(){return a(u,o,e,n,r)})})}function a(t,e,n,r,i){var o=e.contentWindow,a=new f(o.document),h=new p(n,a),d=x(t),m="view"===n.type?r:l(o.document),y="view"===n.type?i:u(o.document),v=new n.renderer(m,y,h,n,document),b=new g(t,v,a,h,n);return b.ready.then(function(){w("Finished rendering");var r;return r="view"===n.type?c(v.canvas,{width:v.canvas.width,height:v.canvas.height,top:0,left:0,x:0,y:0}):t===o.document.body||t===o.document.documentElement||null!=n.canvas?v.canvas:c(v.canvas,{width:null!=n.width?n.width:d.width,height:null!=n.height?n.height:d.height,top:d.top,left:d.left,x:0,y:0}),s(e,n),r})}function s(t,e){e.removeContainer&&(t.parentNode.removeChild(t),w("Cleaned up container"))}function c(t,e){var n=document.createElement("canvas"),r=Math.min(t.width-1,Math.max(0,e.left)),i=Math.min(t.width,Math.max(1,e.left+e.width)),o=Math.min(t.height-1,Math.max(0,e.top)),a=Math.min(t.height,Math.max(1,e.top+e.height));n.width=e.width,n.height=e.height;var s=i-r,c=a-o;return w("Cropping canvas at:","left:",e.left,"top:",e.top,"width:",s,"height:",c),w("Resulting crop with width",e.width,"and height",e.height,"with x",r,"and y",o),n.getContext("2d").drawImage(t,r,o,s,c,e.x,e.y,s,c),n}function l(t){return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function u(t){return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function h(t){var e=document.createElement("a");return e.href=t,e.href=e.href,e}var f=e("./support"),d=e("./renderers/canvas"),p=e("./imageloader"),g=e("./nodeparser"),m=e("./nodecontainer"),w=e("./log"),y=e("./utils"),v=e("./clone"),b=e("./proxy").loadUrlDocument,x=y.getBounds,k="data-html2canvas-node",_=0;i.CanvasRenderer=d,i.NodeContainer=m,i.log=w,i.utils=y;var C="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return Promise.reject("No canvas support")}:i;n.exports=C,"function"==typeof t&&t.amd&&t("html2canvas",[],function(){return C})},{"./clone":2,"./imageloader":11,"./log":13,"./nodecontainer":14,"./nodeparser":15,"./proxy":16,"./renderers/canvas":20,"./support":22,"./utils":26}],5:[function(t,e,n){function r(t){if(this.src=t,i("DummyImageContainer for",t),!this.promise||!this.image){i("Initiating DummyImageContainer"),r.prototype.image=new Image;var e=this.image;r.prototype.promise=new Promise(function(t,n){e.onload=t,e.onerror=n,e.src=o(),e.complete===!0&&t(e)})}}var i=t("./log"),o=t("./utils").smallImage;e.exports=r},{"./log":13,"./utils":26}],6:[function(t,e,n){function r(t,e){var n,r,o=document.createElement("div"),a=document.createElement("img"),s=document.createElement("span"),c="Hidden Text";o.style.visibility="hidden",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin=0,o.style.padding=0,document.body.appendChild(o),a.src=i(),a.width=1,a.height=1,a.style.margin=0,a.style.padding=0,a.style.verticalAlign="baseline",s.style.fontFamily=t,s.style.fontSize=e,s.style.margin=0,s.style.padding=0,s.appendChild(document.createTextNode(c)),o.appendChild(s),o.appendChild(a),n=a.offsetTop-s.offsetTop+1,o.removeChild(s),o.appendChild(document.createTextNode(c)),o.style.lineHeight="normal",a.style.verticalAlign="super",r=a.offsetTop-o.offsetTop+1,document.body.removeChild(o),this.baseline=n,this.lineWidth=1,this.middle=r}var i=t("./utils").smallImage;e.exports=r},{"./utils":26}],7:[function(t,e,n){function r(){this.data={}}var i=t("./font");r.prototype.getMetrics=function(t,e){return void 0===this.data[t+"-"+e]&&(this.data[t+"-"+e]=new i(t,e)),this.data[t+"-"+e]},e.exports=r},{"./font":6}],8:[function(t,e,n){function r(e,n,r){this.image=null,this.src=e;var i=this,a=o(e);this.promise=(n?new Promise(function(t){"about:blank"===e.contentWindow.document.URL||null==e.contentWindow.document.documentElement?e.contentWindow.onload=e.onload=function(){t(e)}:t(e)}):this.proxyLoad(r.proxy,a,r)).then(function(e){var n=t("./core");return n(e.contentWindow.document.documentElement,{type:"view",width:e.width,height:e.height,proxy:r.proxy,javascriptEnabled:r.javascriptEnabled,removeContainer:r.removeContainer,allowTaint:r.allowTaint,imageTimeout:r.imageTimeout/2})}).then(function(t){return i.image=t})}var i=t("./utils"),o=i.getBounds,a=t("./proxy").loadUrlDocument;r.prototype.proxyLoad=function(t,e,n){var r=this.src;return a(r.src,t,r.ownerDocument,e.width,e.height,n)},e.exports=r},{"./core":4,"./proxy":16,"./utils":26}],9:[function(t,e,n){function r(t){this.src=t.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=Promise.resolve(!0)}r.TYPES={LINEAR:1,RADIAL:2},r.REGEXP_COLORSTOP=/^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i,e.exports=r},{}],10:[function(t,e,n){function r(t,e){this.src=t,this.image=new Image;var n=this;this.tainted=null,this.promise=new Promise(function(r,i){n.image.onload=r,n.image.onerror=i,e&&(n.image.crossOrigin="anonymous"),n.image.src=t,n.image.complete===!0&&r(n.image)})}e.exports=r},{}],11:[function(t,e,n){function r(t,e){this.link=null,this.options=t,this.support=e,this.origin=this.getOrigin(window.location.href)}var i=t("./log"),o=t("./imagecontainer"),a=t("./dummyimagecontainer"),s=t("./proxyimagecontainer"),c=t("./framecontainer"),l=t("./svgcontainer"),u=t("./svgnodecontainer"),h=t("./lineargradientcontainer"),f=t("./webkitgradientcontainer"),d=t("./utils").bind;r.prototype.findImages=function(t){var e=[];return t.reduce(function(t,e){switch(e.node.nodeName){case"IMG":return t.concat([{args:[e.node.src],method:"url"}]);case"svg":case"IFRAME":return t.concat([{args:[e.node],method:e.node.nodeName}])}return t},[]).forEach(this.addImage(e,this.loadImage),this),e},r.prototype.findBackgroundImage=function(t,e){return e.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(t,this.loadImage),this),t},r.prototype.addImage=function(t,e){return function(n){n.args.forEach(function(r){this.imageExists(t,r)||(t.splice(0,0,e.call(this,n)),i("Added image #"+t.length,"string"==typeof r?r.substring(0,100):r))},this)}},r.prototype.hasImageBackground=function(t){return"none"!==t.method},r.prototype.loadImage=function(t){if("url"===t.method){var e=t.args[0];return!this.isSVG(e)||this.support.svg||this.options.allowTaint?e.match(/data:image\/.*;base64,/i)?new o(e.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(e)||this.options.allowTaint===!0||this.isSVG(e)?new o(e,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new o(e,!0):this.options.proxy?new s(e,this.options.proxy):new a(e):new l(e)}return"linear-gradient"===t.method?new h(t):"gradient"===t.method?new f(t):"svg"===t.method?new u(t.args[0],this.support.svg):"IFRAME"===t.method?new c(t.args[0],this.isSameOrigin(t.args[0].src),this.options):new a(t)},r.prototype.isSVG=function(t){return"svg"===t.substring(t.length-3).toLowerCase()||l.prototype.isInline(t)},r.prototype.imageExists=function(t,e){return t.some(function(t){return t.src===e})},r.prototype.isSameOrigin=function(t){return this.getOrigin(t)===this.origin},r.prototype.getOrigin=function(t){var e=this.link||(this.link=document.createElement("a"));return e.href=t,e.href=e.href,e.protocol+e.hostname+e.port},r.prototype.getPromise=function(t){return this.timeout(t,this.options.imageTimeout).catch(function(){var e=new a(t.src);return e.promise.then(function(e){t.image=e})})},r.prototype.get=function(t){var e=null;return this.images.some(function(n){return(e=n).src===t})?e:null},r.prototype.fetch=function(t){return this.images=t.reduce(d(this.findBackgroundImage,this),this.findImages(t)),this.images.forEach(function(t,e){t.promise.then(function(){i("Succesfully loaded image #"+(e+1),t)},function(n){i("Failed loading image #"+(e+1),t,n)})}),this.ready=Promise.all(this.images.map(this.getPromise,this)),i("Finished searching images"),this},r.prototype.timeout=function(t,e){var n,r=Promise.race([t.promise,new Promise(function(r,o){n=setTimeout(function(){i("Timed out loading image",t),o(t)},e)})]).then(function(t){return clearTimeout(n),t});return r.catch(function(){clearTimeout(n)}),r},e.exports=r},{"./dummyimagecontainer":5,"./framecontainer":8,"./imagecontainer":10,"./lineargradientcontainer":12,"./log":13,"./proxyimagecontainer":17,"./svgcontainer":23,"./svgnodecontainer":24,"./utils":26,"./webkitgradientcontainer":27}],12:[function(t,e,n){function r(t){i.apply(this,arguments),this.type=i.TYPES.LINEAR;var e=r.REGEXP_DIRECTION.test(t.args[0])||!i.REGEXP_COLORSTOP.test(t.args[0]);e?t.args[0].split(/\s+/).reverse().forEach(function(t,e){switch(t){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var n=this.y0,r=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=r,this.y1=n;break;case"center":break;default:var i=.01*parseFloat(t,10);if(isNaN(i))break;0===e?(this.y0=i,this.y1=1-this.y0):(this.x0=i,this.x1=1-this.x0)}},this):(this.y0=0,this.y1=1),this.colorStops=t.args.slice(e?1:0).map(function(t){var e=t.match(i.REGEXP_COLORSTOP),n=+e[2],r=0===n?"%":e[3];return{color:new o(e[1]),stop:"%"===r?n/100:null}}),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(t,e){null===t.stop&&this.colorStops.slice(e).some(function(n,r){return null!==n.stop&&(t.stop=(n.stop-this.colorStops[e-1].stop)/(r+1)+this.colorStops[e-1].stop,!0)},this)},this)}var i=t("./gradientcontainer"),o=t("./color");r.prototype=Object.create(i.prototype),r.REGEXP_DIRECTION=/^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i,e.exports=r},{"./color":3,"./gradientcontainer":9}],13:[function(t,e,n){var r=function(){r.options.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-r.options.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))};r.options={logging:!1},e.exports=r},{}],14:[function(t,e,n){function r(t,e){this.node=t,this.parent=e,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function i(t){var e=t.options[t.selectedIndex||0];return e?e.text||"":""}function o(t){if(t&&"matrix"===t[1])return t[2].split(",").map(function(t){return parseFloat(t.trim())});if(t&&"matrix3d"===t[1]){var e=t[2].split(",").map(function(t){return parseFloat(t.trim())});return[e[0],e[1],e[4],e[5],e[12],e[13]]}}function a(t){return t.toString().indexOf("%")!==-1}function s(t){return t.replace("px","")}function c(t){return parseFloat(t)}var l=t("./color"),u=t("./utils"),h=u.getBounds,f=u.parseBackgrounds,d=u.offsetBounds;r.prototype.cloneTo=function(t){t.visible=this.visible,t.borders=this.borders,t.bounds=this.bounds,t.clip=this.clip,t.backgroundClip=this.backgroundClip,t.computedStyles=this.computedStyles,t.styles=this.styles,t.backgroundImages=this.backgroundImages,t.opacity=this.opacity},r.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},r.prototype.assignStack=function(t){this.stack=t,t.children.push(this)},r.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},r.prototype.css=function(t){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[t]||(this.styles[t]=this.computedStyles[t])},r.prototype.prefixedCss=function(t){var e=["webkit","moz","ms","o"],n=this.css(t);return void 0===n&&e.some(function(e){return n=this.css(e+t.substr(0,1).toUpperCase()+t.substr(1)),void 0!==n},this),void 0===n?null:n},r.prototype.computedStyle=function(t){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,t)},r.prototype.cssInt=function(t){var e=parseInt(this.css(t),10);return isNaN(e)?0:e},r.prototype.color=function(t){return this.colors[t]||(this.colors[t]=new l(this.css(t)))},r.prototype.cssFloat=function(t){var e=parseFloat(this.css(t));return isNaN(e)?0:e},r.prototype.fontWeight=function(){var t=this.css("fontWeight");switch(parseInt(t,10)){case 401:t="bold";break;case 400:t="normal"}return t},r.prototype.parseClip=function(){var t=this.css("clip").match(this.CLIP);return t?{top:parseInt(t[1],10),right:parseInt(t[2],10),bottom:parseInt(t[3],10),left:parseInt(t[4],10)}:null},r.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=f(this.css("backgroundImage")))},r.prototype.cssList=function(t,e){var n=(this.css(t)||"").split(",");return n=n[e||0]||n[0]||"auto",n=n.trim().split(" "),1===n.length&&(n=[n[0],a(n[0])?"auto":n[0]]),n},r.prototype.parseBackgroundSize=function(t,e,n){var r,i,o=this.cssList("backgroundSize",n);if(a(o[0]))r=t.width*parseFloat(o[0])/100;else{if(/contain|cover/.test(o[0])){var s=t.width/t.height,c=e.width/e.height;return s<c^"contain"===o[0]?{width:t.height*c,height:t.height}:{width:t.width,height:t.width/c}}r=parseInt(o[0],10)}return i="auto"===o[0]&&"auto"===o[1]?e.height:"auto"===o[1]?r/e.width*e.height:a(o[1])?t.height*parseFloat(o[1])/100:parseInt(o[1],10),"auto"===o[0]&&(r=i/e.height*e.width),{width:r,height:i}},r.prototype.parseBackgroundPosition=function(t,e,n,r){var i,o,s=this.cssList("backgroundPosition",n);return i=a(s[0])?(t.width-(r||e).width)*(parseFloat(s[0])/100):parseInt(s[0],10),o="auto"===s[1]?i/e.width*e.height:a(s[1])?(t.height-(r||e).height)*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(i=o/e.height*e.width),{left:i,top:o}},r.prototype.parseBackgroundRepeat=function(t){return this.cssList("backgroundRepeat",t)[0]},r.prototype.parseTextShadows=function(){var t=this.css("textShadow"),e=[];if(t&&"none"!==t)for(var n=t.match(this.TEXT_SHADOW_PROPERTY),r=0;n&&r<n.length;r++){var i=n[r].match(this.TEXT_SHADOW_VALUES);e.push({color:new l(i[0]),offsetX:i[1]?parseFloat(i[1].replace("px","")):0,offsetY:i[2]?parseFloat(i[2].replace("px","")):0,blur:i[3]?i[3].replace("px",""):0})}return e},r.prototype.parseTransform=function(){if(!this.transformData)if(this.hasTransform()){var t=this.parseBounds(),e=this.prefixedCss("transformOrigin").split(" ").map(s).map(c);e[0]+=t.left,e[1]+=t.top,this.transformData={origin:e,matrix:this.parseTransformMatrix()}}else this.transformData={origin:[0,0],matrix:[1,0,0,1,0,0]};return this.transformData},r.prototype.parseTransformMatrix=function(){if(!this.transformMatrix){var t=this.prefixedCss("transform"),e=t?o(t.match(this.MATRIX_PROPERTY)):null;this.transformMatrix=e?e:[1,0,0,1,0,0]}return this.transformMatrix},r.prototype.parseBounds=function(){return this.bounds||(this.bounds=this.hasTransform()?d(this.node):h(this.node))},r.prototype.hasTransform=function(){return"1,0,0,1,0,0"!==this.parseTransformMatrix().join(",")||this.parent&&this.parent.hasTransform()},r.prototype.getValue=function(){var t=this.node.value||"";return"SELECT"===this.node.tagName?t=i(this.node):"password"===this.node.type&&(t=Array(t.length+1).join("•")),0===t.length?this.node.placeholder||"":t},r.prototype.MATRIX_PROPERTY=/(matrix|matrix3d)\((.+)\)/,r.prototype.TEXT_SHADOW_PROPERTY=/((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g,r.prototype.TEXT_SHADOW_VALUES=/(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g,r.prototype.CLIP=/^rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)$/,e.exports=r},{"./color":3,"./utils":26}],15:[function(t,e,n){function r(t,e,n,r,i){L("Starting NodeParser"),this.renderer=e,this.options=i,this.range=null,this.support=n,this.renderQueue=[],this.stack=new Y(!0,1,t.ownerDocument,null);var o=new U(t,null);if(i.background&&e.rectangle(0,0,e.width,e.height,new V(i.background)),t===t.ownerDocument.documentElement){var a=new U(o.color("backgroundColor").isTransparent()?t.ownerDocument.body:t.ownerDocument.documentElement,null);e.rectangle(0,0,e.width,e.height,a.color("backgroundColor"))}o.visibile=o.isElementVisible(),this.createPseudoHideStyles(t.ownerDocument),this.disableAnimations(t.ownerDocument),this.nodes=B([o].concat(this.getChildren(o)).filter(function(t){return t.visible=t.isElementVisible()}).map(this.getPseudoElements,this)),this.fontMetrics=new X,L("Fetched nodes, total:",this.nodes.length),L("Calculate overflow clips"),this.calculateOverflowClips(),L("Start fetching images"),this.images=r.fetch(this.nodes.filter(q)),this.ready=this.images.ready.then(J(function(){return L("Images loaded, starting parsing"),L("Creating stacking contexts"),this.createStackingContexts(),L("Sorting stacking contexts"),this.sortStackingContexts(this.stack),this.parse(this.stack),L("Render queue created with "+this.renderQueue.length+" items"),new Promise(J(function(t){i.async?"function"==typeof i.async?i.async.call(this,this.renderQueue,t):this.renderQueue.length>0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,t)):t():(this.renderQueue.forEach(this.paint,this),t())},this))},this))}function i(t){return t.parent&&t.parent.clip.length}function o(t){return t.replace(/(\-[a-z])/g,function(t){return t.toUpperCase().replace("-","")})}function a(){}function s(t,e,n,r){return t.map(function(i,o){if(i.width>0){var a=e.left,s=e.top,c=e.width,l=e.height-t[2].width;switch(o){case 0:l=t[0].width,i.args=h({c1:[a,s],c2:[a+c,s],c3:[a+c-t[1].width,s+l],c4:[a+t[3].width,s+l]},r[0],r[1],n.topLeftOuter,n.topLeftInner,n.topRightOuter,n.topRightInner);break;case 1:a=e.left+e.width-t[1].width,c=t[1].width,i.args=h({c1:[a+c,s],c2:[a+c,s+l+t[2].width],c3:[a,s+l],c4:[a,s+t[0].width]},r[1],r[2],n.topRightOuter,n.topRightInner,n.bottomRightOuter,n.bottomRightInner);break;case 2:s=s+e.height-t[2].width,l=t[2].width,i.args=h({c1:[a+c,s+l],c2:[a,s+l],c3:[a+t[3].width,s],c4:[a+c-t[3].width,s]},r[2],r[3],n.bottomRightOuter,n.bottomRightInner,n.bottomLeftOuter,n.bottomLeftInner);break;case 3:c=t[3].width,i.args=h({c1:[a,s+l+t[2].width],c2:[a,s],c3:[a+c,s+t[0].width],c4:[a+c,s+l]},r[3],r[0],n.bottomLeftOuter,n.bottomLeftInner,n.topLeftOuter,n.topLeftInner)}}return i})}function c(t,e,n,r){var i=4*((Math.sqrt(2)-1)/3),o=n*i,a=r*i,s=t+n,c=e+r;return{topLeft:u({x:t,y:c},{x:t,y:c-a},{x:s-o,y:e},{x:s,y:e}),topRight:u({x:t,y:e},{x:t+o,y:e},{x:s,y:c-a},{x:s,y:c}),bottomRight:u({x:s,y:e},{x:s,y:e+a},{x:t+o,y:c},{x:t,y:c}),bottomLeft:u({x:s,y:c},{x:s-o,y:c},{x:t,y:e+a},{x:t,y:e})}}function l(t,e,n){var r=t.left,i=t.top,o=t.width,a=t.height,s=e[0][0]<o/2?e[0][0]:o/2,l=e[0][1]<a/2?e[0][1]:a/2,u=e[1][0]<o/2?e[1][0]:o/2,h=e[1][1]<a/2?e[1][1]:a/2,f=e[2][0]<o/2?e[2][0]:o/2,d=e[2][1]<a/2?e[2][1]:a/2,p=e[3][0]<o/2?e[3][0]:o/2,g=e[3][1]<a/2?e[3][1]:a/2,m=o-u,w=a-d,y=o-f,v=a-g;return{topLeftOuter:c(r,i,s,l).topLeft.subdivide(.5),topLeftInner:c(r+n[3].width,i+n[0].width,Math.max(0,s-n[3].width),Math.max(0,l-n[0].width)).topLeft.subdivide(.5),topRightOuter:c(r+m,i,u,h).topRight.subdivide(.5),topRightInner:c(r+Math.min(m,o+n[3].width),i+n[0].width,m>o+n[3].width?0:u-n[3].width,h-n[0].width).topRight.subdivide(.5),bottomRightOuter:c(r+y,i+w,f,d).bottomRight.subdivide(.5),bottomRightInner:c(r+Math.min(y,o-n[3].width),i+Math.min(w,a+n[0].width),Math.max(0,f-n[1].width),d-n[2].width).bottomRight.subdivide(.5),bottomLeftOuter:c(r,i+v,p,g).bottomLeft.subdivide(.5),+ bottomLeftInner:c(r+n[3].width,i+v,Math.max(0,p-n[3].width),g-n[2].width).bottomLeft.subdivide(.5)}}function u(t,e,n,r){var i=function(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}};return{start:t,startControl:e,endControl:n,end:r,subdivide:function(o){var a=i(t,e,o),s=i(e,n,o),c=i(n,r,o),l=i(a,s,o),h=i(s,c,o),f=i(l,h,o);return[u(t,a,l,f),u(f,h,c,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,n.x,n.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",n.x,n.y,e.x,e.y,t.x,t.y])}}}function h(t,e,n,r,i,o,a){var s=[];return e[0]>0||e[1]>0?(s.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(s)):s.push(["line",t.c1[0],t.c1[1]]),n[0]>0||n[1]>0?(s.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(s),s.push(["line",a[0].end.x,a[0].end.y]),a[0].curveToReversed(s)):(s.push(["line",t.c2[0],t.c2[1]]),s.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(s.push(["line",i[1].end.x,i[1].end.y]),i[1].curveToReversed(s)):s.push(["line",t.c4[0],t.c4[1]]),s}function f(t,e,n,r,i,o,a){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,a]),(n[0]>0||n[1]>0)&&t.push(["line",i[0].start.x,i[0].start.y])}function d(t){return t.cssInt("zIndex")<0}function p(t){return t.cssInt("zIndex")>0}function g(t){return 0===t.cssInt("zIndex")}function m(t){return["inline","inline-block","inline-table"].indexOf(t.css("display"))!==-1}function w(t){return t instanceof Y}function y(t){return t.node.data.trim().length>0}function v(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function b(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var n=t.css("border"+e+"Radius"),r=n.split(" ");return r.length<=1&&(r[1]=r[0]),r.map(O)})}function x(t){return t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE}function k(t){var e=t.css("position"),n=["absolute","relative","fixed"].indexOf(e)!==-1?t.css("zIndex"):"auto";return"auto"!==n}function _(t){return"static"!==t.css("position")}function C(t){return"none"!==t.css("float")}function A(t){return["inline-block","inline-table"].indexOf(t.css("display"))!==-1}function S(t){var e=this;return function(){return!t.apply(e,arguments)}}function q(t){return t.node.nodeType===Node.ELEMENT_NODE}function T(t){return t.isPseudoElement===!0}function I(t){return t.node.nodeType===Node.TEXT_NODE}function P(t){return function(e,n){return e.cssInt("zIndex")+t.indexOf(e)/t.length-(n.cssInt("zIndex")+t.indexOf(n)/t.length)}}function E(t){return t.getOpacity()<1}function O(t){return parseInt(t,10)}function F(t){return t.width}function R(t){return t.node.nodeType!==Node.ELEMENT_NODE||["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(t.node.nodeName)===-1}function B(t){return[].concat.apply([],t)}function D(t){var e=t.substr(0,1);return e===t.substr(t.length-1)&&e.match(/'|"/)?t.substr(1,t.length-2):t}function j(t){for(var e,n=[],r=0,i=!1;t.length;)N(t[r])===i?(e=t.splice(0,r),e.length&&n.push(M.ucs2.encode(e)),i=!i,r=0):r++,r>=t.length&&(e=t.splice(0,r),e.length&&n.push(M.ucs2.encode(e)));return n}function N(t){return[32,13,10,9,45].indexOf(t)!==-1}function z(t){return/[^\u0000-\u00ff]/.test(t)}var L=t("./log"),M=t("punycode"),U=t("./nodecontainer"),H=t("./textcontainer"),W=t("./pseudoelementcontainer"),X=t("./fontmetrics"),V=t("./color"),Y=t("./stackingcontext"),G=t("./utils"),J=G.bind,Q=G.getBounds,K=G.parseBackgrounds,$=G.offsetBounds;r.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(t){if(q(t)){T(t)&&t.appendToDOM(),t.borders=this.parseBorders(t);var e="hidden"===t.css("overflow")?[t.borders.clip]:[],n=t.parseClip();n&&["absolute","fixed"].indexOf(t.css("position"))!==-1&&e.push([["rect",t.bounds.left+n.left,t.bounds.top+n.top,n.right-n.left,n.bottom-n.top]]),t.clip=i(t)?t.parent.clip.concat(e):e,t.backgroundClip="hidden"!==t.css("overflow")?t.clip.concat([t.borders.clip]):t.clip,T(t)&&t.cleanDOM()}else I(t)&&(t.clip=i(t)?t.parent.clip:[]);T(t)||(t.bounds=null)},this)},r.prototype.asyncRenderer=function(t,e,n){n=n||Date.now(),this.paint(t[this.renderIndex++]),t.length===this.renderIndex?e():n+20>Date.now()?this.asyncRenderer(t,e,n):setTimeout(J(function(){this.asyncRenderer(t,e)},this),0)},r.prototype.createPseudoHideStyles=function(t){this.createStyles(t,"."+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},r.prototype.disableAnimations=function(t){this.createStyles(t,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},r.prototype.createStyles=function(t,e){var n=t.createElement("style");n.innerHTML=e,t.body.appendChild(n)},r.prototype.getPseudoElements=function(t){var e=[[t]];if(t.node.nodeType===Node.ELEMENT_NODE){var n=this.getPseudoElement(t,":before"),r=this.getPseudoElement(t,":after");n&&e.push(n),r&&e.push(r)}return B(e)},r.prototype.getPseudoElement=function(t,e){var n=t.computedStyle(e);if(!n||!n.content||"none"===n.content||"-moz-alt-content"===n.content||"none"===n.display)return null;for(var r=D(n.content),i="url"===r.substr(0,3),a=document.createElement(i?"img":"html2canvaspseudoelement"),s=new W(a,t,e),c=n.length-1;c>=0;c--){var l=o(n.item(c));a.style[l]=n[l]}if(a.className=W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,i)return a.src=K(r)[0].args[0],[s];var u=document.createTextNode(r);return a.appendChild(u),[s,new H(u,s)]},r.prototype.getChildren=function(t){return B([].filter.call(t.node.childNodes,x).map(function(e){var n=[e.nodeType===Node.TEXT_NODE?new H(e,t):new U(e,t)].filter(R);return e.nodeType===Node.ELEMENT_NODE&&n.length&&"TEXTAREA"!==e.tagName?n[0].isElementVisible()?n.concat(this.getChildren(n[0])):[]:n},this))},r.prototype.newStackingContext=function(t,e){var n=new Y(e,t.getOpacity(),t.node,t.parent);t.cloneTo(n);var r=e?n.getParentStack(this):n.parent.stack;r.contexts.push(n),t.stack=n},r.prototype.createStackingContexts=function(){this.nodes.forEach(function(t){q(t)&&(this.isRootElement(t)||E(t)||k(t)||this.isBodyWithTransparentRoot(t)||t.hasTransform())?this.newStackingContext(t,!0):q(t)&&(_(t)&&g(t)||A(t)||C(t))?this.newStackingContext(t,!1):t.assignStack(t.parent.stack)},this)},r.prototype.isBodyWithTransparentRoot=function(t){return"BODY"===t.node.nodeName&&t.parent.color("backgroundColor").isTransparent()},r.prototype.isRootElement=function(t){return null===t.parent},r.prototype.sortStackingContexts=function(t){t.contexts.sort(P(t.contexts.slice(0))),t.contexts.forEach(this.sortStackingContexts,this)},r.prototype.parseTextBounds=function(t){return function(e,n,r){if("none"!==t.parent.css("textDecoration").substr(0,4)||0!==e.trim().length){if(this.support.rangeBounds&&!t.parent.hasTransform()){var i=r.slice(0,n).join("").length;return this.getRangeBounds(t.node,i,e.length)}if(t.node&&"string"==typeof t.node.data){var o=t.node.splitText(e.length),a=this.getWrapperBounds(t.node,t.parent.hasTransform());return t.node=o,a}}else this.support.rangeBounds&&!t.parent.hasTransform()||(t.node=t.node.splitText(e.length));return{}}},r.prototype.getWrapperBounds=function(t,e){var n=t.ownerDocument.createElement("html2canvaswrapper"),r=t.parentNode,i=t.cloneNode(!0);n.appendChild(t.cloneNode(!0)),r.replaceChild(n,t);var o=e?$(n):Q(n);return r.replaceChild(i,n),o},r.prototype.getRangeBounds=function(t,e,n){var r=this.range||(this.range=t.ownerDocument.createRange());return r.setStart(t,e),r.setEnd(t,e+n),r.getBoundingClientRect()},r.prototype.parse=function(t){var e=t.contexts.filter(d),n=t.children.filter(q),r=n.filter(S(C)),i=r.filter(S(_)).filter(S(m)),o=n.filter(S(_)).filter(C),s=r.filter(S(_)).filter(m),c=t.contexts.concat(r.filter(_)).filter(g),l=t.children.filter(I).filter(y),u=t.contexts.filter(p);e.concat(i).concat(o).concat(s).concat(c).concat(l).concat(u).forEach(function(t){this.renderQueue.push(t),w(t)&&(this.parse(t),this.renderQueue.push(new a))},this)},r.prototype.paint=function(t){try{t instanceof a?this.renderer.ctx.restore():I(t)?(T(t.parent)&&t.parent.appendToDOM(),this.paintText(t),T(t.parent)&&t.parent.cleanDOM()):this.paintNode(t)}catch(t){if(L(t),this.options.strict)throw t}},r.prototype.paintNode=function(t){w(t)&&(this.renderer.setOpacity(t.opacity),this.renderer.ctx.save(),t.hasTransform()&&this.renderer.setTransform(t.parseTransform())),"INPUT"===t.node.nodeName&&"checkbox"===t.node.type?this.paintCheckbox(t):"INPUT"===t.node.nodeName&&"radio"===t.node.type?this.paintRadio(t):this.paintElement(t)},r.prototype.paintElement=function(t){var e=t.parseBounds();this.renderer.clip(t.backgroundClip,function(){this.renderer.renderBackground(t,e,t.borders.borders.map(F))},this),this.renderer.clip(t.clip,function(){this.renderer.renderBorders(t.borders.borders)},this),this.renderer.clip(t.backgroundClip,function(){switch(t.node.nodeName){case"svg":case"IFRAME":var n=this.images.get(t.node);n?this.renderer.renderImage(t,e,t.borders,n):L("Error loading <"+t.node.nodeName+">",t.node);break;case"IMG":var r=this.images.get(t.node.src);r?this.renderer.renderImage(t,e,t.borders,r):L("Error loading <img>",t.node.src);break;case"CANVAS":this.renderer.renderImage(t,e,t.borders,{image:t.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(t)}},this)},r.prototype.paintCheckbox=function(t){var e=t.parseBounds(),n=Math.min(e.width,e.height),r={width:n-1,height:n-1,top:e.top,left:e.left},i=[3,3],o=[i,i,i,i],a=[1,1,1,1].map(function(t){return{color:new V("#A5A5A5"),width:t}}),c=l(r,o,a);this.renderer.clip(t.backgroundClip,function(){this.renderer.rectangle(r.left+1,r.top+1,r.width-2,r.height-2,new V("#DEDEDE")),this.renderer.renderBorders(s(a,r,c,o)),t.node.checked&&(this.renderer.font(new V("#424242"),"normal","normal","bold",n-3+"px","arial"),this.renderer.text("✔",r.left+n/6,r.top+n-1))},this)},r.prototype.paintRadio=function(t){var e=t.parseBounds(),n=Math.min(e.width,e.height)-2;this.renderer.clip(t.backgroundClip,function(){this.renderer.circleStroke(e.left+1,e.top+1,n,new V("#DEDEDE"),1,new V("#A5A5A5")),t.node.checked&&this.renderer.circle(Math.ceil(e.left+n/4)+1,Math.ceil(e.top+n/4)+1,Math.floor(n/2),new V("#424242"))},this)},r.prototype.paintFormValue=function(t){var e=t.getValue();if(e.length>0){var n=t.node.ownerDocument,r=n.createElement("html2canvaswrapper"),i=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];i.forEach(function(e){try{r.style[e]=t.css(e)}catch(t){L("html2canvas: Parse: Exception caught in renderFormValue: "+t.message)}});var o=t.parseBounds();r.style.position="fixed",r.style.left=o.left+"px",r.style.top=o.top+"px",r.textContent=e,n.body.appendChild(r),this.paintText(new H(r.firstChild,t)),n.body.removeChild(r)}},r.prototype.paintText=function(t){t.applyTextTransform();var e=M.ucs2.decode(t.node.data),n=this.options.letterRendering&&!v(t)||z(t.node.data)?e.map(function(t){return M.ucs2.encode([t])}):j(e),r=t.parent.fontWeight(),i=t.parent.css("fontSize"),o=t.parent.css("fontFamily"),a=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),r,i,o),a.length?this.renderer.fontShadow(a[0].color,a[0].offsetX,a[0].offsetY,a[0].blur):this.renderer.clearShadow(),this.renderer.clip(t.parent.clip,function(){n.map(this.parseTextBounds(t),this).forEach(function(e,r){e&&(this.renderer.text(n[r],e.left,e.bottom),this.renderTextDecoration(t.parent,e,this.fontMetrics.getMetrics(o,i)))},this)},this)},r.prototype.renderTextDecoration=function(t,e,n){switch(t.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(e.left,Math.round(e.top+n.baseline+n.lineWidth),e.width,1,t.color("color"));break;case"overline":this.renderer.rectangle(e.left,Math.round(e.top),e.width,1,t.color("color"));break;case"line-through":this.renderer.rectangle(e.left,Math.ceil(e.top+n.middle+n.lineWidth),e.width,1,t.color("color"))}};var Z={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};r.prototype.parseBorders=function(t){var e=t.parseBounds(),n=b(t),r=["Top","Right","Bottom","Left"].map(function(e,n){var r=t.css("border"+e+"Style"),i=t.color("border"+e+"Color");"inset"===r&&i.isBlack()&&(i=new V([255,255,255,i.a]));var o=Z[r]?Z[r][n]:null;return{width:t.cssInt("border"+e+"Width"),color:o?i[o[0]](o[1]):i,args:null}}),i=l(e,n,r);return{clip:this.parseBackgroundClip(t,i,r,n,e),borders:s(r,e,i,n)}},r.prototype.parseBackgroundClip=function(t,e,n,r,i){var o=t.css("backgroundClip"),a=[];switch(o){case"content-box":case"padding-box":f(a,r[0],r[1],e.topLeftInner,e.topRightInner,i.left+n[3].width,i.top+n[0].width),f(a,r[1],r[2],e.topRightInner,e.bottomRightInner,i.left+i.width-n[1].width,i.top+n[0].width),f(a,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,i.left+i.width-n[1].width,i.top+i.height-n[2].width),f(a,r[3],r[0],e.bottomLeftInner,e.topLeftInner,i.left+n[3].width,i.top+i.height-n[2].width);break;default:f(a,r[0],r[1],e.topLeftOuter,e.topRightOuter,i.left,i.top),f(a,r[1],r[2],e.topRightOuter,e.bottomRightOuter,i.left+i.width,i.top),f(a,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,i.left+i.width,i.top+i.height),f(a,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,i.left,i.top+i.height)}return a},e.exports=r},{"./color":3,"./fontmetrics":7,"./log":13,"./nodecontainer":14,"./pseudoelementcontainer":18,"./stackingcontext":21,"./textcontainer":25,"./utils":26,punycode:1}],16:[function(t,e,n){function r(t,e,n){var r="withCredentials"in new XMLHttpRequest;if(!e)return Promise.reject("No proxy configured");var i=a(r),c=s(e,t,i);return r?u(c):o(n,c,i).then(function(t){return p(t.content)})}function i(t,e,n){var r="crossOrigin"in new Image,i=a(r),c=s(e,t,i);return r?Promise.resolve(c):o(n,c,i).then(function(t){return"data:"+t.type+";base64,"+t.content})}function o(t,e,n){return new Promise(function(r,i){var o=t.createElement("script"),a=function(){delete window.html2canvas.proxy[n],t.body.removeChild(o)};window.html2canvas.proxy[n]=function(t){a(),r(t)},o.src=e,o.onerror=function(t){a(),i(t)},t.body.appendChild(o)})}function a(t){return t?"":"html2canvas_"+Date.now()+"_"+ ++g+"_"+Math.round(1e5*Math.random())}function s(t,e,n){return t+"?url="+encodeURIComponent(e)+(n.length?"&callback=html2canvas.proxy."+n:"")}function c(t){return function(e){var n,r=new DOMParser;try{n=r.parseFromString(e,"text/html")}catch(t){f("DOMParser not supported, falling back to createHTMLDocument"),n=document.implementation.createHTMLDocument("");try{n.open(),n.write(e),n.close()}catch(t){f("createHTMLDocument write not supported, falling back to document.body.innerHTML"),n.body.innerHTML=e}}var i=n.querySelector("base");if(!i||!i.href.host){var o=n.createElement("base");o.href=t,n.head.insertBefore(o,n.head.firstChild)}return n}}function l(t,e,n,i,o,a){return new r(t,e,window.document).then(c(t)).then(function(t){return d(t,n,i,o,a,0,0)})}var u=t("./xhr"),h=t("./utils"),f=t("./log"),d=t("./clone"),p=h.decode64,g=0;n.Proxy=r,n.ProxyURL=i,n.loadUrlDocument=l},{"./clone":2,"./log":13,"./utils":26,"./xhr":28}],17:[function(t,e,n){function r(t,e){var n=document.createElement("a");n.href=t,t=n.href,this.src=t,this.image=new Image;var r=this;this.promise=new Promise(function(n,o){r.image.crossOrigin="Anonymous",r.image.onload=n,r.image.onerror=o,new i(t,e,document).then(function(t){r.image.src=t}).catch(o)})}var i=t("./proxy").ProxyURL;e.exports=r},{"./proxy":16}],18:[function(t,e,n){function r(t,e,n){i.call(this,t,e),this.isPseudoElement=!0,this.before=":before"===n}var i=t("./nodecontainer");r.prototype.cloneTo=function(t){r.prototype.cloneTo.call(this,t),t.isPseudoElement=!0,t.before=this.before},r.prototype=Object.create(i.prototype),r.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},r.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},r.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},r.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",r.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",e.exports=r},{"./nodecontainer":14}],19:[function(t,e,n){function r(t,e,n,r,i){this.width=t,this.height=e,this.images=n,this.options=r,this.document=i}var i=t("./log");r.prototype.renderImage=function(t,e,n,r){var i=t.cssInt("paddingLeft"),o=t.cssInt("paddingTop"),a=t.cssInt("paddingRight"),s=t.cssInt("paddingBottom"),c=n.borders,l=e.width-(c[1].width+c[3].width+i+a),u=e.height-(c[0].width+c[2].width+o+s);this.drawImage(r,0,0,r.image.width||l,r.image.height||u,e.left+i+c[3].width,e.top+o+c[0].width,l,u)},r.prototype.renderBackground=function(t,e,n){e.height>0&&e.width>0&&(this.renderBackgroundColor(t,e),this.renderBackgroundImage(t,e,n))},r.prototype.renderBackgroundColor=function(t,e){var n=t.color("backgroundColor");n.isTransparent()||this.rectangle(e.left,e.top,e.width,e.height,n)},r.prototype.renderBorders=function(t){t.forEach(this.renderBorder,this)},r.prototype.renderBorder=function(t){t.color.isTransparent()||null===t.args||this.drawShape(t.args,t.color)},r.prototype.renderBackgroundImage=function(t,e,n){var r=t.parseBackgroundImages();r.reverse().forEach(function(r,o,a){switch(r.method){case"url":var s=this.images.get(r.args[0]);s?this.renderBackgroundRepeating(t,e,s,a.length-(o+1),n):i("Error loading background-image",r.args[0]);break;case"linear-gradient":case"gradient":var c=this.images.get(r.value);c?this.renderBackgroundGradient(c,e,n):i("Error loading background-image",r.args[0]);break;case"none":break;default:i("Unknown background-image type",r.args[0])}},this)},r.prototype.renderBackgroundRepeating=function(t,e,n,r,i){var o=t.parseBackgroundSize(e,n.image,r),a=t.parseBackgroundPosition(e,n.image,r,o),s=t.parseBackgroundRepeat(r);switch(s){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(n,a,o,e,e.left+i[3],e.top+a.top+i[0],99999,o.height,i);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(n,a,o,e,e.left+a.left+i[3],e.top+i[0],o.width,99999,i);break;case"no-repeat":this.backgroundRepeatShape(n,a,o,e,e.left+a.left+i[3],e.top+a.top+i[0],o.width,o.height,i);break;default:this.renderBackgroundRepeat(n,a,o,{top:e.top,left:e.left},i[3],i[0])}},e.exports=r},{"./log":13}],20:[function(t,e,n){function r(t,e){o.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=t,this.canvas.height=e),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},s("Initialized CanvasRenderer with size",t,"x",e)}function i(t){return t.length>0}var o=t("../renderer"),a=t("../lineargradientcontainer"),s=t("../log");r.prototype=Object.create(o.prototype),r.prototype.setFillStyle=function(t){return this.ctx.fillStyle="object"==typeof t&&t.isColor?t.toString():t,this.ctx},r.prototype.rectangle=function(t,e,n,r,i){this.setFillStyle(i).fillRect(t,e,n,r)},r.prototype.circle=function(t,e,n,r){this.setFillStyle(r),this.ctx.beginPath(),this.ctx.arc(t+n/2,e+n/2,n/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},r.prototype.circleStroke=function(t,e,n,r,i,o){this.circle(t,e,n,r),this.ctx.strokeStyle=o.toString(),this.ctx.stroke()},r.prototype.drawShape=function(t,e){this.shape(t),this.setFillStyle(e).fill()},r.prototype.taints=function(t){if(null===t.tainted){this.taintCtx.drawImage(t.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),t.tainted=!1}catch(e){this.taintCtx=document.createElement("canvas").getContext("2d"),t.tainted=!0}}return t.tainted},r.prototype.drawImage=function(t,e,n,r,i,o,a,s,c){this.taints(t)&&!this.options.allowTaint||this.ctx.drawImage(t.image,e,n,r,i,o,a,s,c)},r.prototype.clip=function(t,e,n){this.ctx.save(),t.filter(i).forEach(function(t){this.shape(t).clip()},this),e.call(n),this.ctx.restore()},r.prototype.shape=function(t){return this.ctx.beginPath(),t.forEach(function(t,e){"rect"===t[0]?this.ctx.rect.apply(this.ctx,t.slice(1)):this.ctx[0===e?"moveTo":t[0]+"To"].apply(this.ctx,t.slice(1))},this),this.ctx.closePath(),this.ctx},r.prototype.font=function(t,e,n,r,i,o){this.setFillStyle(t).font=[e,n,r,i,o].join(" ").split(",")[0]},r.prototype.fontShadow=function(t,e,n,r){this.setVariable("shadowColor",t.toString()).setVariable("shadowOffsetY",e).setVariable("shadowOffsetX",n).setVariable("shadowBlur",r)},r.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},r.prototype.setOpacity=function(t){this.ctx.globalAlpha=t},r.prototype.setTransform=function(t){this.ctx.translate(t.origin[0],t.origin[1]),this.ctx.transform.apply(this.ctx,t.matrix),this.ctx.translate(-t.origin[0],-t.origin[1])},r.prototype.setVariable=function(t,e){return this.variables[t]!==e&&(this.variables[t]=this.ctx[t]=e),this},r.prototype.text=function(t,e,n){this.ctx.fillText(t,e,n)},r.prototype.backgroundRepeatShape=function(t,e,n,r,i,o,a,s,c){var l=[["line",Math.round(i),Math.round(o)],["line",Math.round(i+a),Math.round(o)],["line",Math.round(i+a),Math.round(s+o)],["line",Math.round(i),Math.round(s+o)]];this.clip([l],function(){this.renderBackgroundRepeat(t,e,n,r,c[3],c[0])},this)},r.prototype.renderBackgroundRepeat=function(t,e,n,r,i,o){var a=Math.round(r.left+e.left+i),s=Math.round(r.top+e.top+o);this.setFillStyle(this.ctx.createPattern(this.resizeImage(t,n),"repeat")),this.ctx.translate(a,s),this.ctx.fill(),this.ctx.translate(-a,-s)},r.prototype.renderBackgroundGradient=function(t,e){if(t instanceof a){var n=this.ctx.createLinearGradient(e.left+e.width*t.x0,e.top+e.height*t.y0,e.left+e.width*t.x1,e.top+e.height*t.y1);t.colorStops.forEach(function(t){n.addColorStop(t.stop,t.color.toString())}),this.rectangle(e.left,e.top,e.width,e.height,n)}},r.prototype.resizeImage=function(t,e){var n=t.image;if(n.width===e.width&&n.height===e.height)return n;var r,i=document.createElement("canvas");return i.width=e.width,i.height=e.height,r=i.getContext("2d"),r.drawImage(n,0,0,n.width,n.height,0,0,e.width,e.height),i},e.exports=r},{"../lineargradientcontainer":12,"../log":13,"../renderer":19}],21:[function(t,e,n){function r(t,e,n,r){i.call(this,n,r),this.ownStacking=t,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*e}var i=t("./nodecontainer");r.prototype=Object.create(i.prototype),r.prototype.getParentStack=function(t){var e=this.parent?this.parent.stack:null;return e?e.ownStacking?e:e.getParentStack(t):t.stack},e.exports=r},{"./nodecontainer":14}],22:[function(t,e,n){function r(t){this.rangeBounds=this.testRangeBounds(t),this.cors=this.testCORS(),this.svg=this.testSVG()}r.prototype.testRangeBounds=function(t){var e,n,r,i,o=!1;return t.createRange&&(e=t.createRange(),e.getBoundingClientRect&&(n=t.createElement("boundtest"),n.style.height="123px",n.style.display="block",t.body.appendChild(n),e.selectNode(n),r=e.getBoundingClientRect(),i=r.height,123===i&&(o=!0),t.body.removeChild(n))),o},r.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},r.prototype.testSVG=function(){var t=new Image,e=document.createElement("canvas"),n=e.getContext("2d");t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(t,0,0),e.toDataURL()}catch(t){return!1}return!0},e.exports=r},{}],23:[function(t,e,n){function r(t){this.src=t,this.image=null;var e=this;this.promise=this.hasFabric().then(function(){return e.isInline(t)?Promise.resolve(e.inlineFormatting(t)):i(t)}).then(function(t){return new Promise(function(n){window.html2canvas.svg.fabric.loadSVGFromString(t,e.createCanvas.call(e,n))})})}var i=t("./xhr"),o=t("./utils").decode64;r.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?Promise.resolve():Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},r.prototype.inlineFormatting=function(t){return/^data:image\/svg\+xml;base64,/.test(t)?this.decode64(this.removeContentType(t)):this.removeContentType(t)},r.prototype.removeContentType=function(t){return t.replace(/^data:image\/svg\+xml(;base64)?,/,"")},r.prototype.isInline=function(t){return/^data:image\/svg\+xml/i.test(t)},r.prototype.createCanvas=function(t){var e=this;return function(n,r){var i=new window.html2canvas.svg.fabric.StaticCanvas("c");e.image=i.lowerCanvasEl,i.setWidth(r.width).setHeight(r.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(n,r)).renderAll(),t(i.lowerCanvasEl)}},r.prototype.decode64=function(t){return"function"==typeof window.atob?window.atob(t):o(t)},e.exports=r},{"./utils":26,"./xhr":28}],24:[function(t,e,n){function r(t,e){this.src=t,this.image=null;var n=this;this.promise=e?new Promise(function(e,r){n.image=new Image,n.image.onload=e,n.image.onerror=r,n.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(t),n.image.complete===!0&&e(n.image)}):this.hasFabric().then(function(){return new Promise(function(e){window.html2canvas.svg.fabric.parseSVGDocument(t,n.createCanvas.call(n,e))})})}var i=t("./svgcontainer");r.prototype=Object.create(i.prototype),e.exports=r},{"./svgcontainer":23}],25:[function(t,e,n){function r(t,e){o.call(this,t,e)}function i(t,e,n){if(t.length>0)return e+n.toUpperCase()}var o=t("./nodecontainer");r.prototype=Object.create(o.prototype),r.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},r.prototype.transform=function(t){var e=this.node.data;switch(t){case"lowercase":return e.toLowerCase();case"capitalize":return e.replace(/(^|\s|:|-|\(|\))([a-z])/g,i);case"uppercase":return e.toUpperCase();default:return e}},e.exports=r},{"./nodecontainer":14}],26:[function(t,e,n){n.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},n.bind=function(t,e){return function(){return t.apply(e,arguments)}},/*+ * base64-arraybuffer+ * https://github.com/niklasvh/base64-arraybuffer+ *+ * Copyright (c) 2012 Niklas von Hertzen+ * Licensed under the MIT license.+ */+ n.decode64=function(t){var e,n,r,i,o,a,s,c,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=t.length,h="";for(e=0;e<u;e+=4)n=l.indexOf(t[e]),r=l.indexOf(t[e+1]),i=l.indexOf(t[e+2]),o=l.indexOf(t[e+3]),a=n<<2|r>>4,s=(15&r)<<4|i>>2,c=(3&i)<<6|o,h+=64===i?String.fromCharCode(a):64===o||o===-1?String.fromCharCode(a,s):String.fromCharCode(a,s,c);return h},n.getBounds=function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),n=null==t.offsetWidth?e.width:t.offsetWidth;return{top:e.top,bottom:e.bottom||e.top+e.height,right:e.left+n,left:e.left,width:n,height:null==t.offsetHeight?e.height:t.offsetHeight}}return{}},n.offsetBounds=function(t){var e=t.offsetParent?n.offsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,right:t.offsetLeft+e.left+t.offsetWidth,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},n.parseBackgrounds=function(t){var e,n,r,i,o,a,s,c=" \r\n\t",l=[],u=0,h=0,f=function(){e&&('"'===n.substr(0,1)&&(n=n.substr(1,n.length-2)),n&&s.push(n),"-"===e.substr(0,1)&&(i=e.indexOf("-",1)+1)>0&&(r=e.substr(0,i),e=e.substr(i)),l.push({prefix:r,method:e.toLowerCase(),value:o,args:s,image:null})),s=[],e=r=n=o=""};return s=[],e=r=n=o="",t.split("").forEach(function(t){if(!(0===u&&c.indexOf(t)>-1)){switch(t){case'"':a?a===t&&(a=null):a=t;break;case"(":if(a)break;if(0===u)return u=1,void(o+=t);h++;break;case")":if(a)break;if(1===u){if(0===h)return u=0,o+=t,void f();h--}break;case",":if(a)break;if(0===u)return void f();if(1===u&&0===h&&!e.match(/^url$/i))return s.push(n),n="",void(o+=t)}o+=t,0===u?e+=t:n+=t}}),f(),l}},{}],27:[function(t,e,n){function r(t){i.apply(this,arguments),this.type="linear"===t.args[0]?i.TYPES.LINEAR:i.TYPES.RADIAL}var i=t("./gradientcontainer");r.prototype=Object.create(i.prototype),e.exports=r},{"./gradientcontainer":9}],28:[function(t,e,n){function r(t){return new Promise(function(e,n){var r=new XMLHttpRequest;r.open("GET",t),r.onload=function(){200===r.status?e(r.responseText):n(new Error(r.statusText))},r.onerror=function(){n(new Error("Network Error"))},r.send()})}e.exports=r},{}]},{},[4])(4)}),/*+ # PNG.js+ # Copyright (c) 2011 Devon Govett+ # MIT LICENSE+ #+ #+ */+ function(t){var e;e=function(){function e(t){var e,n,r,i,o,a,s,c,l,u,h,f,d,p,g;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},a=null;;){switch(e=this.readUInt32(),u=function(){var t,e;for(e=[],s=t=0;t<4;s=++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join("")){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":a&&this.animation.frames.push(a),this.pos+=4,a={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},o=this.readUInt16(),i=this.readUInt16()||100,a.delay=1e3*o/i,a.disposeOp=this.data[this.pos++],a.blendOp=this.data[this.pos++],a.data=[];break;case"IDAT":case"fdAT":for("fdAT"===u&&(this.pos+=4,e-=4),t=(null!=a?a.data:void 0)||this.imgData,s=d=0;0<=e?d<e:d>e;s=0<=e?++d:--d)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(r=this.palette.length/3,this.transparency.indexed=this.read(e),this.transparency.indexed.length>r)throw new Error("More transparent colors than palette size");if(h=r-this.transparency.indexed.length,h>0)for(s=p=0;0<=h?p<h:p>h;s=0<=h?++p:--p)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":f=this.read(e),c=f.indexOf(0),l=String.fromCharCode.apply(String,f.slice(0,c)),this.text[l]=String.fromCharCode.apply(String,f.slice(c+1));break;case"IEND":return a&&this.animation.frames.push(a),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(g=this.colorType)||6===g,n=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*n,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}var n,r,i,o,a,s,l,u;e.load=function(t,n,r){var i;return"function"==typeof n&&(r=n),i=new XMLHttpRequest,i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t,o;return t=new Uint8Array(i.response||i.mozResponseArrayBuffer),o=new e(t),"function"==typeof(null!=n?n.getContext:void 0)&&o.render(n),"function"==typeof r?r(o):void 0},i.send(null)},o=0,i=1,a=2,r=0,n=1,e.prototype.read=function(t){var e,n,r;for(r=[],e=n=0;0<=t?n<t:n>t;e=0<=t?++n:--n)r.push(this.data[this.pos++]);return r},e.prototype.readUInt32=function(){var t,e,n,r;return t=this.data[this.pos++]<<24,e=this.data[this.pos++]<<16,n=this.data[this.pos++]<<8,r=this.data[this.pos++],t|e|n|r},e.prototype.readUInt16=function(){var t,e;return t=this.data[this.pos++]<<8,e=this.data[this.pos++],t|e},e.prototype.decodePixels=function(t){var e,n,r,i,o,a,s,l,u,h,f,d,p,g,m,w,y,v,b,x,k,_,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=new c(t),t=t.getBytes(),d=this.pixelBitlength/8,w=d*this.width,p=new Uint8Array(w*this.height),a=t.length,m=0,g=0,n=0;g<a;){switch(t[g++]){case 0:for(i=b=0;b<w;i=b+=1)p[n++]=t[g++];break;case 1:for(i=x=0;x<w;i=x+=1)e=t[g++],o=i<d?0:p[n-d],p[n++]=(e+o)%256;break;case 2:for(i=k=0;k<w;i=k+=1)e=t[g++],r=(i-i%d)/d,y=m&&p[(m-1)*w+r*d+i%d],p[n++]=(y+e)%256;break;case 3:for(i=_=0;_<w;i=_+=1)e=t[g++],r=(i-i%d)/d,o=i<d?0:p[n-d],y=m&&p[(m-1)*w+r*d+i%d],p[n++]=(e+Math.floor((o+y)/2))%256;break;case 4:for(i=C=0;C<w;i=C+=1)e=t[g++],r=(i-i%d)/d,o=i<d?0:p[n-d],0===m?y=v=0:(y=p[(m-1)*w+r*d+i%d],v=r&&p[(m-1)*w+(r-1)*d+i%d]),s=o+y-v,l=Math.abs(s-o),h=Math.abs(s-y),f=Math.abs(s-v),u=l<=h&&l<=f?o:h<=f?y:v,p[n++]=(e+u)%256;break;default:throw new Error("Invalid filter algorithm: "+t[g-1])}m++}return p},e.prototype.decodePalette=function(){var t,e,n,r,i,o,a,s,c,l;for(r=this.palette,a=this.transparency.indexed||[],o=new Uint8Array((a.length||0)+r.length),i=0,n=r.length,t=0,e=s=0,c=r.length;s<c;e=s+=3)o[i++]=r[e],o[i++]=r[e+1],o[i++]=r[e+2],o[i++]=null!=(l=a[t++])?l:255;return o},e.prototype.copyToImageData=function(t,e){var n,r,i,o,a,s,c,l,u,h,f;if(r=this.colors,u=null,n=this.hasAlphaChannel,this.palette.length&&(u=null!=(f=this._decodedPalette)?f:this._decodedPalette=this.decodePalette(),r=4,n=!0),i=t.data||t,l=i.length,a=u||e,o=s=0,1===r)for(;o<l;)c=u?4*e[o/4]:s,h=a[c++],i[o++]=h,i[o++]=h,i[o++]=h,i[o++]=n?a[c++]:255,s=c;else for(;o<l;)c=u?4*e[o/4]:s,i[o++]=a[c++],i[o++]=a[c++],i[o++]=a[c++],i[o++]=n?a[c++]:255,s=c},e.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t};try{l=t.document.createElement("canvas"),u=l.getContext("2d")}catch(t){return-1}return s=function(t){var e;return u.width=t.width,u.height=t.height,u.clearRect(0,0,t.width,t.height),u.putImageData(t,0,0),e=new Image,e.src=l.toDataURL(),e},e.prototype.decodeFrames=function(t){var e,n,r,i,o,a,c,l;if(this.animation){for(c=this.animation.frames,l=[],n=o=0,a=c.length;o<a;n=++o)e=c[n],r=t.createImageData(e.width,e.height),i=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(r,i),e.imageData=r,l.push(e.image=s(r));return l}},e.prototype.renderFrame=function(t,e){var n,o,s;return o=this.animation.frames,n=o[e],s=o[e-1],0===e&&t.clearRect(0,0,this.width,this.height),(null!=s?s.disposeOp:void 0)===i?t.clearRect(s.xOffset,s.yOffset,s.width,s.height):(null!=s?s.disposeOp:void 0)===a&&t.putImageData(s.imageData,s.xOffset,s.yOffset),n.blendOp===r&&t.clearRect(n.xOffset,n.yOffset,n.width,n.height),t.drawImage(n.image,n.xOffset,n.yOffset)},e.prototype.animate=function(t){var e,n,r,i,o,a,s=this;return n=0,a=this.animation,i=a.numFrames,r=a.frames,o=a.numPlays,(e=function(){var a,c;if(a=n++%i,c=r[a],s.renderFrame(t,a),i>1&&n/i<o)return s.animation._timeout=setTimeout(e,c.delay)})()},e.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},e.prototype.render=function(t){var e,n;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(n=e.createImageData(this.width,this.height),this.copyToImageData(n,this.decodePixels()),e.putImageData(n,0,0))},e}(),t.PNG=e}("undefined"!=typeof window&&window||void 0);/*+ * Extracted from pdf.js+ * https://github.com/andreasgal/pdf.js+ *+ * Copyright (c) 2011 Mozilla Foundation+ *+ * Contributors: Andreas Gal <[email protected]>+ * Chris G Jones <[email protected]>+ * Shaon Barman <[email protected]>+ * Vivien Nicolas <[email protected]>+ * Justin D'Arcangelo <[email protected]>+ * Yury Delendik+ *+ *+ */+ var s=function(){function t(){this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=null}return t.prototype={ensureBuffer:function(t){var e=this.buffer,n=e?e.byteLength:0;if(t<n)return e;for(var r=512;r<t;)r<<=1;for(var i=new Uint8Array(r),o=0;o<n;++o)i[o]=e[o];return this.buffer=i},getByte:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return this.buffer[this.pos++]},getBytes:function(t){var e=this.pos;if(t){this.ensureBuffer(e+t);for(var n=e+t;!this.eof&&this.bufferLength<n;)this.readBlock();var r=this.bufferLength;n>r&&(n=r)}else{for(;!this.eof;)this.readBlock();var n=this.bufferLength}return this.pos=n,this.buffer.subarray(e,n)},lookChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(t,e,n){for(var r=t+e;this.bufferLength<=r&&!this.eof;)this.readBlock();return new Stream(this.buffer,t,e,n)},skip:function(t){t||(t=1),this.pos+=t},reset:function(){this.pos=0}},t}(),c=function(){function t(t){throw new Error(t)}function e(e){var n=0,r=e[n++],i=e[n++];r!=-1&&i!=-1||t("Invalid header in flate stream"),8!=(15&r)&&t("Unknown compression method in flate stream"),((r<<8)+i)%31!=0&&t("Bad FCHECK in flate stream"),32&i&&t("FDICT bit set in flate stream"),this.bytes=e,this.bytesPos=n,this.codeSize=0,this.codeBuf=0,s.call(this)}if("undefined"!=typeof Uint32Array){var n=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),r=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),i=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),o=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],a=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];return e.prototype=Object.create(s.prototype),e.prototype.getBits=function(e){for(var n,r=this.codeSize,i=this.codeBuf,o=this.bytes,a=this.bytesPos;r<e;)"undefined"==typeof(n=o[a++])&&t("Bad encoding in flate stream"),i|=n<<r,r+=8;return n=i&(1<<e)-1,this.codeBuf=i>>e,this.codeSize=r-=e,this.bytesPos=a,n},e.prototype.getCode=function(e){for(var n=e[0],r=e[1],i=this.codeSize,o=this.codeBuf,a=this.bytes,s=this.bytesPos;i<r;){var c;"undefined"==typeof(c=a[s++])&&t("Bad encoding in flate stream"),o|=c<<i,i+=8}var l=n[o&(1<<r)-1],u=l>>16,h=65535&l;return(0==i||i<u||0==u)&&t("Bad encoding in flate stream"),this.codeBuf=o>>u,this.codeSize=i-u,this.bytesPos=s,h},e.prototype.generateHuffmanTable=function(t){for(var e=t.length,n=0,r=0;r<e;++r)t[r]>n&&(n=t[r]);for(var i=1<<n,o=new Uint32Array(i),a=1,s=0,c=2;a<=n;++a,s<<=1,c<<=1)for(var l=0;l<e;++l)if(t[l]==a){for(var u=0,h=s,r=0;r<a;++r)u=u<<1|1&h,h>>=1;for(var r=u;r<i;r+=c)o[r]=a<<16|l;++s}return[o,n]},e.prototype.readBlock=function(){function e(t,e,n,r,i){for(var o=t.getBits(n)+r;o-- >0;)e[_++]=i}var s=this.getBits(3);if(1&s&&(this.eof=!0),s>>=1,0==s){var c,l=this.bytes,u=this.bytesPos;"undefined"==typeof(c=l[u++])&&t("Bad block header in flate stream");var h=c;"undefined"==typeof(c=l[u++])&&t("Bad block header in flate stream"),h|=c<<8,"undefined"==typeof(c=l[u++])&&t("Bad block header in flate stream");var f=c;"undefined"==typeof(c=l[u++])&&t("Bad block header in flate stream"),f|=c<<8,f!=(65535&~h)&&t("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var d=this.bufferLength,p=this.ensureBuffer(d+h),g=d+h;this.bufferLength=g;for(var m=d;m<g;++m){if("undefined"==typeof(c=l[u++])){this.eof=!0;break}p[m]=c}return void(this.bytesPos=u)}var w,y;if(1==s)w=o,y=a;else if(2==s){for(var v=this.getBits(5)+257,b=this.getBits(5)+1,x=this.getBits(4)+4,k=Array(n.length),_=0;_<x;)k[n[_++]]=this.getBits(3);for(var C=this.generateHuffmanTable(k),A=0,_=0,S=v+b,q=new Array(S);_<S;){var T=this.getCode(C);16==T?e(this,q,2,3,A):17==T?e(this,q,3,3,A=0):18==T?e(this,q,7,11,A=0):q[_++]=A=T}w=this.generateHuffmanTable(q.slice(0,v)),y=this.generateHuffmanTable(q.slice(v,S))}else t("Unknown block type in flate stream");for(var p=this.buffer,I=p?p.length:0,P=this.bufferLength;;){var E=this.getCode(w);if(E<256)P+1>=I&&(p=this.ensureBuffer(P+1),I=p.length),p[P++]=E;else{if(256==E)return void(this.bufferLength=P);E-=257,E=r[E];var O=E>>16;O>0&&(O=this.getBits(O));var A=(65535&E)+O;E=this.getCode(y),E=i[E],O=E>>16,O>0&&(O=this.getBits(O));var F=(65535&E)+O;P+A>=I&&(p=this.ensureBuffer(P+A),I=p.length);for(var R=0;R<A;++R,++P)p[P]=p[P-F]}}},e}}();!function(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";"undefined"==typeof t.btoa&&(t.btoa=function(t){var n,r,i,o,a,s,c,l,u=0,h=0,f="",d=[];if(!t)return t;do n=t.charCodeAt(u++),r=t.charCodeAt(u++),i=t.charCodeAt(u++),l=n<<16|r<<8|i,o=l>>18&63,a=l>>12&63,s=l>>6&63,c=63&l,d[h++]=e.charAt(o)+e.charAt(a)+e.charAt(s)+e.charAt(c);while(u<t.length);f=d.join("");var p=t.length%3;return(p?f.slice(0,p-3):f)+"===".slice(p||3)}),"undefined"==typeof t.atob&&(t.atob=function(t){var n,r,i,o,a,s,c,l,u=0,h=0,f="",d=[];if(!t)return t;t+="";do o=e.indexOf(t.charAt(u++)),a=e.indexOf(t.charAt(u++)),s=e.indexOf(t.charAt(u++)),c=e.indexOf(t.charAt(u++)),l=o<<18|a<<12|s<<6|c,n=l>>16&255,r=l>>8&255,i=255&l,64==s?d[h++]=String.fromCharCode(n):64==c?d[h++]=String.fromCharCode(n,r):d[h++]=String.fromCharCode(n,r,i);while(u<t.length);return f=d.join("")}),Array.prototype.map||(Array.prototype.map=function(t){if(void 0===this||null===this||"function"!=typeof t)throw new TypeError;for(var e=Object(this),n=e.length>>>0,r=new Array(n),i=arguments.length>1?arguments[1]:void 0,o=0;o<n;o++)o in e&&(r[o]=t.call(i,e[o],o,e));return r}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){if(void 0===this||null===this||"function"!=typeof t)throw new TypeError;for(var n=Object(this),r=n.length>>>0,i=0;i<r;i++)i in n&&t.call(e,n[i],i,n)}),Object.keys||(Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=n.length;return function(i){if("object"!=typeof i&&("function"!=typeof i||null===i))throw new TypeError;var o,a,s=[];for(o in i)t.call(i,o)&&s.push(o);if(e)for(a=0;a<r;a++)t.call(i,n[a])&&s.push(n[a]);return s}}()),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,"")}),String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")})}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||void 0);var e=e;return e});diff --git a/public/js/jspdf.plugin.autotable.js b/public/js/jspdf.plugin.autotable.jsindex c71922e1ef..efbd41c8b7 100644--- a/public/js/jspdf.plugin.autotable.js+++ b/public/js/jspdf.plugin.autotable.js@@ -1,5 +1,5 @@/**- * jsPDF AutoTable plugin v2.0.17+ * jsPDF AutoTable plugin v2.0.14* Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable** Licensed under the MIT License.@@ -7,4 +7,4 @@** @preserve*/-"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}(function(API){"use strict";var FONT_ROW_RATIO=1.15;var doc,cursor,settings,pageCount,table;var defaultStyles={cellPadding:5,fontSize:10,font:"helvetica",lineColor:200,lineWidth:.1,fontStyle:"normal",overflow:"ellipsize",fillColor:255,textColor:20,halign:"left",valign:"top",fillStyle:"F",rowHeight:20,columnWidth:"auto"};var themes={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal",fillStyle:"F"},header:{textColor:255,fillColor:[41,128,185],rowHeight:23,fontStyle:"bold"},body:{},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1,fillStyle:"DF"},header:{textColor:255,fillColor:[26,188,156],rowHeight:23,fillStyle:"F",fontStyle:"bold"},body:{},alternateRow:{}},plain:{header:{fontStyle:"bold"}}};var defaultOptions=function defaultOptions(){return{theme:"striped",styles:{},headerStyles:{},bodyStyles:{},alternateRowStyles:{},columnStyles:{},startY:false,margin:40,pageBreak:"auto",tableWidth:"auto",createdHeaderCell:function createdHeaderCell(cell,data){},createdCell:function createdCell(cell,data){},drawHeaderRow:function drawHeaderRow(row,data){},drawRow:function drawRow(row,data){},drawHeaderCell:function drawHeaderCell(cell,data){},drawCell:function drawCell(cell,data){},beforePageContent:function beforePageContent(data){},afterPageContent:function afterPageContent(data){}}};API.autoTable=function(headers,data,options){validateInput(headers,data,options);doc=this;settings=initOptions(options||{});pageCount=1;cursor={y:settings.startY===false?settings.margin.top:settings.startY};var userStyles={textColor:30,fontSize:doc.internal.getFontSize(),fontStyle:doc.internal.getFont().fontStyle};createModels(headers,data);calculateWidths();var firstRowHeight=table.rows[0]&&settings.pageBreak==="auto"?table.rows[0].height:0;var minTableBottomPos=settings.startY+settings.margin.bottom+table.headerRow.height+firstRowHeight;if(settings.pageBreak==="avoid"){minTableBottomPos+=table.height}if(settings.pageBreak==="always"&&settings.startY!==false||settings.startY!==false&&minTableBottomPos>doc.internal.pageSize.height){doc.addPage();cursor.y=settings.margin.top}applyStyles(userStyles);settings.beforePageContent(hooksData());if(settings.drawHeaderRow(table.headerRow,hooksData({row:table.headerRow}))!==false){printRow(table.headerRow,settings.drawHeaderCell)}applyStyles(userStyles);printRows();settings.afterPageContent(hooksData());applyStyles(userStyles);return this};API.autoTableEndPosY=function(){if(typeof cursor==="undefined"||typeof cursor.y==="undefined"){return 0}return cursor.y};API.autoTableHtmlToJson=function(tableElem,includeHiddenRows){includeHiddenRows=includeHiddenRows||false;var header=tableElem.rows[0];var result={columns:[],rows:[]};for(var k=0;k<header.cells.length;k++){var cell=header.cells[k];result.columns.push(typeof cell!=="undefined"?cell.textContent:"")}for(var i=1;i<tableElem.rows.length;i++){var tableRow=tableElem.rows[i];var style=window.getComputedStyle(tableRow);if(includeHiddenRows||style.display!=="none"){var rowData=[];for(var j=0;j<header.cells.length;j++){rowData.push(typeof tableRow.cells[j]!=="undefined"?tableRow.cells[j].textContent:"")}result.rows.push(rowData)}}result.data=result.rows;return result};API.autoTableText=function(text,x,y,styles){if(typeof x!=="number"||typeof y!=="number"){console.error("The x and y parameters are required. Missing for the text: ",text)}var fontSize=doc.internal.getFontSize()/doc.internal.scaleFactor;var lineHeightProportion=FONT_ROW_RATIO;var splitRegex=/\r\n|\r|\n/g;var splittedText=null;var lineCount=1;if(styles.valign==="middle"||styles.valign==="bottom"||styles.halign==="center"||styles.halign==="right"){splittedText=typeof text==="string"?text.split(splitRegex):text;lineCount=splittedText.length||1}y+=fontSize*(2-lineHeightProportion);if(styles.valign==="middle")y-=lineCount/2*fontSize;else if(styles.valign==="bottom")y-=lineCount*fontSize;if(styles.halign==="center"||styles.halign==="right"){var alignSize=fontSize;if(styles.halign==="center")alignSize*=.5;if(lineCount>=1){for(var iLine=0;iLine<splittedText.length;iLine++){doc.text(splittedText[iLine],x-doc.getStringUnitWidth(splittedText[iLine])*alignSize,y);y+=fontSize}return doc}x-=doc.getStringUnitWidth(text)*alignSize}doc.text(text,x,y);return doc};function validateInput(headers,data,options){if(!headers||typeof headers!=="object"){console.error("The headers should be an object or array, is: "+typeof headers)}if(!data||typeof data!=="object"){console.error("The data should be an object or array, is: "+typeof data)}if(!!options&&typeof options!=="object"){console.error("The data should be an object or array, is: "+typeof data)}if(!Array.prototype.forEach){console.error("The current browser does not support Array.prototype.forEach which is required for "+"jsPDF-AutoTable. You can try polyfilling it by including this script "+"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill")}}function initOptions(userOptions){var settings=extend(defaultOptions(),userOptions);if(typeof settings.extendWidth!=="undefined"){settings.tableWidth=settings.extendWidth?"auto":"wrap";console.error("Use of deprecated option: extendWidth, use tableWidth instead.")}if(typeof settings.margins!=="undefined"){if(typeof settings.margin==="undefined")settings.margin=settings.margins;console.error("Use of deprecated option: margins, use margin instead.")}[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(o){var deprecatedOption=typeof o==="string"?o:o[0];var style=typeof o==="string"?o:o[1];if(typeof settings[deprecatedOption]!=="undefined"){if(typeof settings.styles[style]==="undefined"){settings.styles[style]=settings[deprecatedOption]}console.error("Use of deprecated option: "+deprecatedOption+", use the style "+style+" instead.")}});var marginSetting=settings.margin;settings.margin={};if(typeof marginSetting.horizontal==="number"){marginSetting.right=marginSetting.horizontal;marginSetting.left=marginSetting.horizontal}if(typeof marginSetting.vertical==="number"){marginSetting.top=marginSetting.vertical;marginSetting.bottom=marginSetting.vertical}["top","right","bottom","left"].forEach(function(side,i){if(typeof marginSetting==="number"){settings.margin[side]=marginSetting}else{var key=Array.isArray(marginSetting)?i:side;settings.margin[side]=typeof marginSetting[key]==="number"?marginSetting[key]:40}});return settings}function createModels(inputHeaders,inputData){table=new Table;table.x=settings.margin.left;var splitRegex=/\r\n|\r|\n/g;var headerRow=new Row(inputHeaders);headerRow.index=-1;var themeStyles=extend(defaultStyles,themes[settings.theme].table,themes[settings.theme].header);headerRow.styles=extend(themeStyles,settings.styles,settings.headerStyles);inputHeaders.forEach(function(rawColumn,dataKey){if(typeof rawColumn==="object"){dataKey=typeof rawColumn.dataKey!=="undefined"?rawColumn.dataKey:rawColumn.key}if(typeof rawColumn.width!=="undefined"){console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.")}var col=new Column(dataKey);col.styles=settings.columnStyles[col.dataKey]||{};table.columns.push(col);var cell=new Cell;cell.raw=typeof rawColumn==="object"?rawColumn.title:rawColumn;cell.styles=extend(headerRow.styles);cell.text=""+cell.raw;cell.contentWidth=cell.styles.cellPadding*2+getStringWidth(cell.text,cell.styles);cell.text=cell.text.split(splitRegex);headerRow.cells[dataKey]=cell;settings.createdHeaderCell(cell,{column:col,row:headerRow,settings:settings})});table.headerRow=headerRow;inputData.forEach(function(rawRow,i){var row=new Row(rawRow);var isAlternate=i%2===0;var themeStyles=extend(defaultStyles,themes[settings.theme].table,isAlternate?themes[settings.theme].alternateRow:{});var userStyles=extend(settings.styles,settings.bodyStyles,isAlternate?settings.alternateRowStyles:{});row.styles=extend(themeStyles,userStyles);row.index=i;table.columns.forEach(function(column){var cell=new Cell;cell.raw=rawRow[column.dataKey];cell.styles=extend(row.styles,column.styles);cell.text=typeof cell.raw!=="undefined"?""+cell.raw:"";row.cells[column.dataKey]=cell;settings.createdCell(cell,hooksData({column:column,row:row}));cell.contentWidth=cell.styles.cellPadding*2+getStringWidth(cell.text,cell.styles);cell.text=cell.text.split(splitRegex)});table.rows.push(row)})}function calculateWidths(){var tableContentWidth=0;table.columns.forEach(function(column){column.contentWidth=table.headerRow.cells[column.dataKey].contentWidth;table.rows.forEach(function(row){var cellWidth=row.cells[column.dataKey].contentWidth;if(cellWidth>column.contentWidth){column.contentWidth=cellWidth}});column.width=column.contentWidth;tableContentWidth+=column.contentWidth});table.contentWidth=tableContentWidth;var maxTableWidth=doc.internal.pageSize.width-settings.margin.left-settings.margin.right;var preferredTableWidth=maxTableWidth;if(typeof settings.tableWidth==="number"){preferredTableWidth=settings.tableWidth}else if(settings.tableWidth==="wrap"){preferredTableWidth=table.contentWidth}table.width=preferredTableWidth<maxTableWidth?preferredTableWidth:maxTableWidth;var dynamicColumns=[];var dynamicColumnsContentWidth=0;var fairWidth=table.width/table.columns.length;var staticWidth=0;table.columns.forEach(function(column){var colStyles=extend(defaultStyles,themes[settings.theme].table,settings.styles,column.styles);if(colStyles.columnWidth==="wrap"){column.width=column.contentWidth}else if(typeof colStyles.columnWidth==="number"){column.width=colStyles.columnWidth}else if(colStyles.columnWidth==="auto"||true){if(column.contentWidth<=fairWidth&&table.contentWidth>table.width){column.width=column.contentWidth}else{dynamicColumns.push(column);dynamicColumnsContentWidth+=column.contentWidth;column.width=0}}staticWidth+=column.width});distributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth);table.height=0;var all=table.rows.concat(table.headerRow);all.forEach(function(row,i){var lineBreakCount=0;var cursorX=table.x;table.columns.forEach(function(col){var cell=row.cells[col.dataKey];col.x=cursorX;applyStyles(cell.styles);var textSpace=col.width-cell.styles.cellPadding*2;if(cell.styles.overflow==="linebreak"){cell.text=doc.splitTextToSize(cell.text,textSpace+1,{fontSize:cell.styles.fontSize})}else if(cell.styles.overflow==="ellipsize"){cell.text=ellipsize(cell.text,textSpace,cell.styles)}else if(cell.styles.overflow==="visible"){}else if(cell.styles.overflow==="hidden"){cell.text=ellipsize(cell.text,textSpace,cell.styles,"")}else if(typeof cell.styles.overflow==="function"){cell.text=cell.styles.overflow(cell.text,textSpace)}else{console.error("Unrecognized overflow type: "+cell.styles.overflow)}var count=Array.isArray(cell.text)?cell.text.length-1:0;if(count>lineBreakCount){lineBreakCount=count}cursorX+=col.width});row.heightStyle=row.styles.rowHeight;row.height=row.heightStyle+lineBreakCount*row.styles.fontSize*FONT_ROW_RATIO;table.height+=row.height})}function distributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth){var extraWidth=table.width-staticWidth-dynamicColumnsContentWidth;for(var i=0;i<dynamicColumns.length;i++){var col=dynamicColumns[i];var ratio=col.contentWidth/dynamicColumnsContentWidth;var isNoneDynamic=col.contentWidth+extraWidth*ratio<fairWidth;if(extraWidth<0&&isNoneDynamic){dynamicColumns.splice(i,1);dynamicColumnsContentWidth-=col.contentWidth;col.width=fairWidth;staticWidth+=col.width;distributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth);break}else{col.width=col.contentWidth+extraWidth*ratio}}}function printRows(){table.rows.forEach(function(row,i){if(isNewPage(row.height)){var samePageThreshold=3;addPage()}row.y=cursor.y;if(settings.drawRow(row,hooksData({row:row}))!==false){printRow(row,settings.drawCell)}})}function addPage(){settings.afterPageContent(hooksData());doc.addPage();pageCount++;cursor={x:settings.margin.left,y:settings.margin.top};settings.beforePageContent(hooksData());if(settings.drawHeaderRow(table.headerRow,hooksData({row:table.headerRow}))!==false){printRow(table.headerRow,settings.drawHeaderCell)}}function isNewPage(rowHeight){var afterRowPos=cursor.y+rowHeight+settings.margin.bottom;return afterRowPos>=doc.internal.pageSize.height}function printRow(row,hookHandler){for(var i=0;i<table.columns.length;i++){var column=table.columns[i];var cell=row.cells[column.dataKey];if(!cell){continue}applyStyles(cell.styles);cell.x=column.x;cell.y=cursor.y;cell.height=row.height;cell.width=column.width;if(cell.styles.valign==="top"){cell.textPos.y=cursor.y+cell.styles.cellPadding}else if(cell.styles.valign==="bottom"){cell.textPos.y=cursor.y+row.height-cell.styles.cellPadding}else{cell.textPos.y=cursor.y+row.height/2}if(cell.styles.halign==="right"){cell.textPos.x=cell.x+cell.width-cell.styles.cellPadding}else if(cell.styles.halign==="center"){cell.textPos.x=cell.x+cell.width/2}else{cell.textPos.x=cell.x+cell.styles.cellPadding}var data=hooksData({column:column,row:row});if(hookHandler(cell,data)!==false){doc.rect(cell.x,cell.y,cell.width,cell.height,cell.styles.fillStyle);doc.autoTableText(cell.text,cell.textPos.x,cell.textPos.y,{halign:cell.styles.halign,valign:cell.styles.valign})}}cursor.y+=row.height}function applyStyles(styles){var arr=[{func:doc.setFillColor,value:styles.fillColor},{func:doc.setTextColor,value:styles.textColor},{func:doc.setFontStyle,value:styles.fontStyle},{func:doc.setDrawColor,value:styles.lineColor},{func:doc.setLineWidth,value:styles.lineWidth},{func:doc.setFont,value:styles.font},{func:doc.setFontSize,value:styles.fontSize}];arr.forEach(function(obj){if(typeof obj.value!=="undefined"){if(obj.value.constructor===Array){obj.func.apply(this,obj.value)}else{obj.func(obj.value)}}})}function hooksData(additionalData){additionalData=additionalData||{};var data={pageCount:pageCount,settings:settings,table:table,cursor:cursor};for(var prop in additionalData){if(additionalData.hasOwnProperty(prop)){data[prop]=additionalData[prop]}}return data}function ellipsize(text,width,styles,ellipsizeStr){ellipsizeStr=typeof ellipsizeStr!=="undefined"?ellipsizeStr:"...";if(Array.isArray(text)){text.forEach(function(str,i){text[i]=ellipsize(str,width,styles,ellipsizeStr)});return text}if(width>=getStringWidth(text,styles)){return text}while(width<getStringWidth(text+ellipsizeStr,styles)){if(text.length<2){break}text=text.substring(0,text.length-1)}return text.trim()+ellipsizeStr}function getStringWidth(text,styles){applyStyles(styles);var w=doc.getStringUnitWidth(text);return w*styles.fontSize}function extend(defaults){var extended={};var prop;for(prop in defaults){if(defaults.hasOwnProperty(prop)){extended[prop]=defaults[prop]}}for(var i=1;i<arguments.length;i++){var options=arguments[i];for(prop in options){if(options.hasOwnProperty(prop)){if(typeof options[prop]==="object"&&!Array.isArray(options[prop])){extended[prop]=options[prop]}else{extended[prop]=options[prop]}}}}return extended}})(jsPDF.API);var Table=function Table(){_classCallCheck(this,Table);this.height=0;this.width=0;this.x=0;this.y=0;this.contentWidth=0;this.rows=[];this.columns=[];this.headerRow=null;this.settings={}};var Row=function Row(raw){_classCallCheck(this,Row);this.raw=raw||{};this.index=0;this.styles={};this.cells={};this.height=0;this.y=0};var Cell=function Cell(raw){_classCallCheck(this,Cell);this.raw=raw;this.styles={};this.text="";this.contentWidth=0;this.textPos={};this.height=0;this.width=0;this.x=0;this.y=0};var Column=function Column(dataKey){_classCallCheck(this,Column);this.dataKey=dataKey;this.options={};this.styles={};this.contentWidth=0;this.width=0;this.x=0};\ No newline at end of file+"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}(function(API){"use strict";var FONT_ROW_RATIO=1.15;var doc,cursor,settings,pageCount,table;var defaultStyles={cellPadding:5,fontSize:10,font:"helvetica",lineColor:200,lineWidth:.1,fontStyle:"normal",overflow:"ellipsize",fillColor:255,textColor:20,halign:"left",valign:"top",fillStyle:"F",rowHeight:20,columnWidth:"auto"};var themes={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal",fillStyle:"F"},header:{textColor:255,fillColor:[41,128,185],rowHeight:23,fontStyle:"bold"},body:{},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1,fillStyle:"DF"},header:{textColor:255,fillColor:[26,188,156],rowHeight:23,fillStyle:"F",fontStyle:"bold"},body:{},alternateRow:{}},plain:{header:{fontStyle:"bold"}}};var defaultOptions=function defaultOptions(){return{theme:"striped",styles:{},headerStyles:{},bodyStyles:{},alternateRowStyles:{},columnStyles:{},startY:false,margin:40,pageBreak:"auto",tableWidth:"auto",createdHeaderCell:function createdHeaderCell(cell,data){},createdCell:function createdCell(cell,data){},drawHeaderRow:function drawHeaderRow(row,data){},drawRow:function drawRow(row,data){},drawHeaderCell:function drawHeaderCell(cell,data){},drawCell:function drawCell(cell,data){},beforePageContent:function beforePageContent(data){},afterPageContent:function afterPageContent(data){}}};API.autoTable=function(headers,data,options){doc=this;settings=initOptions(options||{});pageCount=1;cursor={y:settings.startY===false?settings.margin.top:settings.startY};var userStyles={textColor:30,fontSize:doc.internal.getFontSize(),fontStyle:doc.internal.getFont().fontStyle};createModels(headers,data);calculateWidths();var firstRowHeight=table.rows[0]&&settings.pageBreak==="auto"?table.rows[0].height:0;var minTableBottomPos=settings.startY+settings.margin.bottom+table.headerRow.height+firstRowHeight;if(settings.pageBreak==="avoid"){minTableBottomPos+=table.height}if(settings.pageBreak==="always"&&settings.startY!==false||settings.startY!==false&&minTableBottomPos>doc.internal.pageSize.height){doc.addPage();cursor.y=settings.margin.top}applyStyles(userStyles);settings.beforePageContent(hooksData());if(settings.drawHeaderRow(table.headerRow,hooksData({row:table.headerRow}))!==false){printRow(table.headerRow,settings.drawHeaderCell)}applyStyles(userStyles);printRows();settings.afterPageContent(hooksData());applyStyles(userStyles);return this};API.autoTableEndPosY=function(){if(typeof cursor==="undefined"||typeof cursor.y==="undefined"){return 0}return cursor.y};API.autoTableHtmlToJson=function(table){var data=[],headers=[],header=table.rows[0],tableRow,rowData,i,j;for(i=0;i<header.cells.length;i++){headers.push(typeof header.cells[i]!=="undefined"?header.cells[i].textContent:"")}for(i=1;i<table.rows.length;i++){tableRow=table.rows[i];rowData=[];for(j=0;j<header.cells.length;j++){rowData.push(typeof tableRow.cells[j]!=="undefined"?tableRow.cells[j].textContent:"")}data.push(rowData)}return{columns:headers,data:data,rows:data}};API.autoTableText=function(text,x,y,styles){if(typeof x!=="number"||typeof y!=="number"){console.error("The x and y parameters are required. Missing for the text: ",text)}var fontSize=doc.internal.getFontSize()/doc.internal.scaleFactor;var lineHeightProportion=FONT_ROW_RATIO;var splitRegex=/\r\n|\r|\n/g;var splittedText=null;var lineCount=1;if(styles.valign==="middle"||styles.valign==="bottom"||styles.halign==="center"||styles.halign==="right"){splittedText=typeof text==="string"?text.split(splitRegex):text;lineCount=splittedText.length||1}y+=fontSize*(2-lineHeightProportion);if(styles.valign==="middle")y-=lineCount/2*fontSize;else if(styles.valign==="bottom")y-=lineCount*fontSize;if(styles.halign==="center"||styles.halign==="right"){var alignSize=fontSize;if(styles.halign==="center")alignSize*=.5;if(lineCount>=1){for(var iLine=0;iLine<splittedText.length;iLine++){doc.text(splittedText[iLine],x-doc.getStringUnitWidth(splittedText[iLine])*alignSize,y);y+=fontSize}return doc}x-=doc.getStringUnitWidth(text)*alignSize}doc.text(text,x,y);return doc};function initOptions(userOptions){var settings=extend(defaultOptions(),userOptions);if(typeof settings.extendWidth!=="undefined"){settings.tableWidth=settings.extendWidth?"auto":"wrap";console.error("Use of deprecated option: extendWidth, use tableWidth instead.")}if(typeof settings.margins!=="undefined"){if(typeof settings.margin==="undefined")settings.margin=settings.margins;console.error("Use of deprecated option: margins, use margin instead.")}[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(o){var deprecatedOption=typeof o==="string"?o:o[0];var style=typeof o==="string"?o:o[1];if(typeof settings[deprecatedOption]!=="undefined"){if(typeof settings.styles[style]==="undefined"){settings.styles[style]=settings[deprecatedOption]}console.error("Use of deprecated option: "+deprecatedOption+", use the style "+style+" instead.")}});var marginSetting=settings.margin;settings.margin={};if(typeof marginSetting.horizontal==="number"){marginSetting.right=marginSetting.horizontal;marginSetting.left=marginSetting.horizontal}if(typeof marginSetting.vertical==="number"){marginSetting.top=marginSetting.vertical;marginSetting.bottom=marginSetting.vertical}["top","right","bottom","left"].forEach(function(side,i){if(typeof marginSetting==="number"){settings.margin[side]=marginSetting}else{var key=Array.isArray(marginSetting)?i:side;settings.margin[side]=typeof marginSetting[key]==="number"?marginSetting[key]:40}});return settings}function createModels(inputHeaders,inputData){table=new Table;table.x=settings.margin.left;var splitRegex=/\r\n|\r|\n/g;var headerRow=new Row(inputHeaders);headerRow.index=-1;var themeStyles=extend(defaultStyles,themes[settings.theme].table,themes[settings.theme].header);headerRow.styles=extend(themeStyles,settings.styles,settings.headerStyles);inputHeaders.forEach(function(rawColumn,dataKey){if(typeof rawColumn==="object"){dataKey=typeof rawColumn.dataKey!=="undefined"?rawColumn.dataKey:rawColumn.key}if(typeof rawColumn.width!=="undefined"){console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.")}var col=new Column(dataKey);col.styles=settings.columnStyles[col.dataKey]||{};table.columns.push(col);var cell=new Cell;cell.raw=typeof rawColumn==="object"?rawColumn.title:rawColumn;cell.styles=headerRow.styles;cell.text=""+cell.raw;cell.contentWidth=cell.styles.cellPadding*2+getStringWidth(cell.text,cell.styles);cell.text=cell.text.split(splitRegex);headerRow.cells[dataKey]=cell;settings.createdHeaderCell(cell,{column:col,row:headerRow,settings:settings})});table.headerRow=headerRow;inputData.forEach(function(rawRow,i){var row=new Row(rawRow);var isAlternate=i%2===0;var themeStyles=extend(defaultStyles,themes[settings.theme].table,isAlternate?themes[settings.theme].alternateRow:{});var userStyles=extend(settings.styles,settings.bodyStyles,isAlternate?settings.alternateRowStyles:{});row.styles=extend(themeStyles,userStyles);row.index=i;table.columns.forEach(function(column){var cell=new Cell;cell.raw=rawRow[column.dataKey];cell.styles=extend(row.styles,column.styles);cell.text=typeof cell.raw!=="undefined"?""+cell.raw:"";row.cells[column.dataKey]=cell;settings.createdCell(cell,hooksData({column:column,row:row}));cell.contentWidth=cell.styles.cellPadding*2+getStringWidth(cell.text,cell.styles);cell.text=cell.text.split(splitRegex)});table.rows.push(row)})}function calculateWidths(){var tableContentWidth=0;table.columns.forEach(function(column){column.contentWidth=table.headerRow.cells[column.dataKey].contentWidth;table.rows.forEach(function(row){var cellWidth=row.cells[column.dataKey].contentWidth;if(cellWidth>column.contentWidth){column.contentWidth=cellWidth}});column.width=column.contentWidth;tableContentWidth+=column.contentWidth});table.contentWidth=tableContentWidth;var maxTableWidth=doc.internal.pageSize.width-settings.margin.left-settings.margin.right;var preferredTableWidth=maxTableWidth;if(typeof settings.tableWidth==="number"){preferredTableWidth=settings.tableWidth}else if(settings.tableWidth==="wrap"){preferredTableWidth=table.contentWidth}table.width=preferredTableWidth<maxTableWidth?preferredTableWidth:maxTableWidth;var dynamicColumns=[];var dynamicColumnsContentWidth=0;var fairWidth=table.width/table.columns.length;var staticWidth=0;table.columns.forEach(function(column){var colStyles=extend(defaultStyles,themes[settings.theme].table,settings.styles,column.styles);if(colStyles.columnWidth==="wrap"){column.width=column.contentWidth}else if(typeof colStyles.columnWidth==="number"){column.width=colStyles.columnWidth}else if(colStyles.columnWidth==="auto"||true){if(column.contentWidth<=fairWidth&&table.contentWidth>table.width){column.width=column.contentWidth}else{dynamicColumns.push(column);dynamicColumnsContentWidth+=column.contentWidth;column.width=0}}staticWidth+=column.width});distributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth);table.height=0;var all=table.rows.concat(table.headerRow);all.forEach(function(row,i){var lineBreakCount=0;var cursorX=table.x;table.columns.forEach(function(col){var cell=row.cells[col.dataKey];col.x=cursorX;applyStyles(cell.styles);var textSpace=col.width-cell.styles.cellPadding*2;if(cell.styles.overflow==="linebreak"){cell.text=doc.splitTextToSize(cell.text,textSpace+1,{fontSize:cell.styles.fontSize})}else if(cell.styles.overflow==="ellipsize"){cell.text=ellipsize(cell.text,textSpace,cell.styles)}else if(cell.styles.overflow==="visible"){}else if(cell.styles.overflow==="hidden"){cell.text=ellipsize(cell.text,textSpace,cell.styles,"")}else if(typeof cell.styles.overflow==="function"){cell.text=cell.styles.overflow(cell.text,textSpace)}else{console.error("Unrecognized overflow type: "+cell.styles.overflow)}var count=Array.isArray(cell.text)?cell.text.length-1:0;if(count>lineBreakCount){lineBreakCount=count}cursorX+=col.width});row.heightStyle=row.styles.rowHeight;row.height=row.heightStyle+lineBreakCount*row.styles.fontSize*FONT_ROW_RATIO;table.height+=row.height})}function distributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth){var extraWidth=table.width-staticWidth-dynamicColumnsContentWidth;for(var i=0;i<dynamicColumns.length;i++){var col=dynamicColumns[i];var ratio=col.contentWidth/dynamicColumnsContentWidth;var isNoneDynamic=col.contentWidth+extraWidth*ratio<fairWidth;if(extraWidth<0&&isNoneDynamic){dynamicColumns.splice(i,1);dynamicColumnsContentWidth-=col.contentWidth;col.width=fairWidth;staticWidth+=col.width;distributeWidth(dynamicColumns,staticWidth,dynamicColumnsContentWidth,fairWidth);break}else{col.width=col.contentWidth+extraWidth*ratio}}}function printRows(){table.rows.forEach(function(row,i){if(isNewPage(row.height)){var samePageThreshold=3;addPage()}row.y=cursor.y;if(settings.drawRow(row,hooksData({row:row}))!==false){printRow(row,settings.drawCell)}})}function addPage(){settings.afterPageContent(hooksData());doc.addPage();pageCount++;cursor={x:settings.margin.left,y:settings.margin.top};settings.beforePageContent(hooksData());if(settings.drawHeaderRow(table.headerRow,hooksData({row:table.headerRow}))!==false){printRow(table.headerRow,settings.drawHeaderCell)}}function isNewPage(rowHeight){var afterRowPos=cursor.y+rowHeight+settings.margin.bottom;return afterRowPos>=doc.internal.pageSize.height}function printRow(row,hookHandler){for(var i=0;i<table.columns.length;i++){var column=table.columns[i];var cell=row.cells[column.dataKey];if(!cell){continue}applyStyles(cell.styles);cell.x=column.x;cell.y=cursor.y;cell.height=row.height;cell.width=column.width;if(cell.styles.valign==="top"){cell.textPos.y=cursor.y+cell.styles.cellPadding}else if(cell.styles.valign==="bottom"){cell.textPos.y=cursor.y+row.height-cell.styles.cellPadding}else{cell.textPos.y=cursor.y+row.height/2}if(cell.styles.halign==="right"){cell.textPos.x=cell.x+cell.width-cell.styles.cellPadding}else if(cell.styles.halign==="center"){cell.textPos.x=cell.x+cell.width/2}else{cell.textPos.x=cell.x+cell.styles.cellPadding}var data=hooksData({column:column,row:row});if(hookHandler(cell,data)!==false){doc.rect(cell.x,cell.y,cell.width,cell.height,cell.styles.fillStyle);doc.autoTableText(cell.text,cell.textPos.x,cell.textPos.y,{halign:cell.styles.halign,valign:cell.styles.valign})}}cursor.y+=row.height}function applyStyles(styles){var arr=[{func:doc.setFillColor,value:styles.fillColor},{func:doc.setTextColor,value:styles.textColor},{func:doc.setFontStyle,value:styles.fontStyle},{func:doc.setDrawColor,value:styles.lineColor},{func:doc.setLineWidth,value:styles.lineWidth},{func:doc.setFont,value:styles.font},{func:doc.setFontSize,value:styles.fontSize}];arr.forEach(function(obj){if(typeof obj.value!=="undefined"){if(obj.value.constructor===Array){obj.func.apply(this,obj.value)}else{obj.func(obj.value)}}})}function hooksData(additionalData){additionalData=additionalData||{};var data={pageCount:pageCount,settings:settings,table:table,cursor:cursor};for(var prop in additionalData){if(additionalData.hasOwnProperty(prop)){data[prop]=additionalData[prop]}}return data}function ellipsize(text,width,styles,ellipsizeStr){ellipsizeStr=typeof ellipsizeStr!=="undefined"?ellipsizeStr:"...";if(Array.isArray(text)){text.forEach(function(str,i){text[i]=ellipsize(str,width,styles,ellipsizeStr)});return text}if(width>=getStringWidth(text,styles)){return text}while(width<getStringWidth(text+ellipsizeStr,styles)){if(text.length<2){break}text=text.substring(0,text.length-1)}return text.trim()+ellipsizeStr}function getStringWidth(text,styles){applyStyles(styles);var w=doc.getStringUnitWidth(text);return w*styles.fontSize}function extend(defaults){var extended={};var prop;for(prop in defaults){if(defaults.hasOwnProperty(prop)){extended[prop]=defaults[prop]}}for(var i=1;i<arguments.length;i++){var options=arguments[i];for(prop in options){if(options.hasOwnProperty(prop)){if(typeof options[prop]==="object"&&!Array.isArray(options[prop])){extended[prop]=options[prop]}else{extended[prop]=options[prop]}}}}return extended}})(jsPDF.API);var Table=function Table(){_classCallCheck(this,Table);this.height=0;this.width=0;this.x=0;this.y=0;this.contentWidth=0;this.rows=[];this.columns=[];this.headerRow=null;this.settings={}};var Row=function Row(raw){_classCallCheck(this,Row);this.raw=raw||{};this.index=0;this.styles={};this.cells={};this.height=0;this.y=0};var Cell=function Cell(raw){_classCallCheck(this,Cell);this.raw=raw;this.styles={};this.text="";this.contentWidth=0;this.textPos={};this.height=0;this.width=0;this.x=0;this.y=0};var Column=function Column(dataKey){_classCallCheck(this,Column);this.dataKey=dataKey;this.options={};this.styles={};this.contentWidth=0;this.width=0;this.x=0};diff --git a/public/js/xlsx.core.min.js b/public/js/xlsx.core.min.jsnew file mode 100644index 0000000000..dbec1de42d--- /dev/null+++ b/public/js/xlsx.core.min.js@@ -0,0 +1,15 @@+/* xlsx.js (C) 2013-2015 SheetJS -- http://sheetjs.com */+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSZip=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";var _keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";exports.encode=function(input,utf8){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+_keyStr.charAt(enc1)+_keyStr.charAt(enc2)+_keyStr.charAt(enc3)+_keyStr.charAt(enc4)}return output};exports.decode=function(input,utf8){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=_keyStr.indexOf(input.charAt(i++));enc2=_keyStr.indexOf(input.charAt(i++));enc3=_keyStr.indexOf(input.charAt(i++));enc4=_keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2)}if(enc4!=64){output=output+String.fromCharCode(chr3)}}return output}},{}],2:[function(_dereq_,module,exports){"use strict";function CompressedObject(){this.compressedSize=0;this.uncompressedSize=0;this.crc32=0;this.compressionMethod=null;this.compressedContent=null}CompressedObject.prototype={getContent:function(){return null},getCompressedContent:function(){return null}};module.exports=CompressedObject},{}],3:[function(_dereq_,module,exports){"use strict";exports.STORE={magic:"\x00\x00",compress:function(content){return content},uncompress:function(content){return content},compressInputType:null,uncompressInputType:null};exports.DEFLATE=_dereq_("./flate")},{"./flate":8}],4:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");var table=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];module.exports=function crc32(input,crc){if(typeof input==="undefined"||!input.length){return 0}var isArray=utils.getTypeOf(input)!=="string";if(typeof crc=="undefined"){crc=0}var x=0;var y=0;var b=0;crc=crc^-1;for(var i=0,iTop=input.length;i<iTop;i++){b=isArray?input[i]:input.charCodeAt(i);y=(crc^b)&255;x=table[y];crc=crc>>>8^x}return crc^-1}},{"./utils":21}],5:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");function DataReader(data){this.data=null;this.length=0;this.index=0}DataReader.prototype={checkOffset:function(offset){this.checkIndex(this.index+offset)},checkIndex:function(newIndex){if(this.length<newIndex||newIndex<0){throw new Error("End of data reached (data length = "+this.length+", asked index = "+newIndex+"). Corrupted zip ?")}},setIndex:function(newIndex){this.checkIndex(newIndex);this.index=newIndex},skip:function(n){this.setIndex(this.index+n)},byteAt:function(i){},readInt:function(size){var result=0,i;this.checkOffset(size);for(i=this.index+size-1;i>=this.index;i--){result=(result<<8)+this.byteAt(i)}this.index+=size;return result},readString:function(size){return utils.transformTo("string",this.readData(size))},readData:function(size){},lastIndexOfSignature:function(sig){},readDate:function(){var dostime=this.readInt(4);return new Date((dostime>>25&127)+1980,(dostime>>21&15)-1,dostime>>16&31,dostime>>11&31,dostime>>5&63,(dostime&31)<<1)}};module.exports=DataReader},{"./utils":21}],6:[function(_dereq_,module,exports){"use strict";exports.base64=false;exports.binary=false;exports.dir=false;exports.createFolders=false;exports.date=null;exports.compression=null;exports.comment=null},{}],7:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");exports.string2binary=function(str){return utils.string2binary(str)};exports.string2Uint8Array=function(str){return utils.transformTo("uint8array",str)};exports.uint8Array2String=function(array){return utils.transformTo("string",array)};exports.string2Blob=function(str){var buffer=utils.transformTo("arraybuffer",str);return utils.arrayBuffer2Blob(buffer)};exports.arrayBuffer2Blob=function(buffer){return utils.arrayBuffer2Blob(buffer)};exports.transformTo=function(outputType,input){return utils.transformTo(outputType,input)};exports.getTypeOf=function(input){return utils.getTypeOf(input)};exports.checkSupport=function(type){return utils.checkSupport(type)};exports.MAX_VALUE_16BITS=utils.MAX_VALUE_16BITS;exports.MAX_VALUE_32BITS=utils.MAX_VALUE_32BITS;exports.pretty=function(str){return utils.pretty(str)};exports.findCompression=function(compressionMethod){return utils.findCompression(compressionMethod)};exports.isRegExp=function(object){return utils.isRegExp(object)}},{"./utils":21}],8:[function(_dereq_,module,exports){"use strict";var USE_TYPEDARRAY=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Uint32Array!=="undefined";var pako=_dereq_("pako");exports.uncompressInputType=USE_TYPEDARRAY?"uint8array":"array";exports.compressInputType=USE_TYPEDARRAY?"uint8array":"array";exports.magic="\b\x00";exports.compress=function(input){return pako.deflateRaw(input)};exports.uncompress=function(input){return pako.inflateRaw(input)}},{pako:24}],9:[function(_dereq_,module,exports){"use strict";var base64=_dereq_("./base64");function JSZip(data,options){if(!(this instanceof JSZip))return new JSZip(data,options);this.files={};this.comment=null;this.root="";if(data){this.load(data,options)}this.clone=function(){var newObj=new JSZip;for(var i in this){if(typeof this[i]!=="function"){newObj[i]=this[i]}}return newObj}}JSZip.prototype=_dereq_("./object");JSZip.prototype.load=_dereq_("./load");JSZip.support=_dereq_("./support");JSZip.defaults=_dereq_("./defaults");JSZip.utils=_dereq_("./deprecatedPublicUtils");JSZip.base64={encode:function(input){return base64.encode(input)},decode:function(input){return base64.decode(input)}};JSZip.compressions=_dereq_("./compressions");module.exports=JSZip},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(_dereq_,module,exports){"use strict";var base64=_dereq_("./base64");var ZipEntries=_dereq_("./zipEntries");module.exports=function(data,options){var files,zipEntries,i,input;options=options||{};if(options.base64){data=base64.decode(data)}zipEntries=new ZipEntries(data,options);files=zipEntries.files;for(i=0;i<files.length;i++){input=files[i];this.file(input.fileName,input.decompressed,{binary:true,optimizedBinaryString:true,date:input.date,dir:input.dir,comment:input.fileComment.length?input.fileComment:null,createFolders:options.createFolders})}if(zipEntries.zipComment.length){this.comment=zipEntries.zipComment}return this}},{"./base64":1,"./zipEntries":22}],11:[function(_dereq_,module,exports){(function(Buffer){"use strict";module.exports=function(data,encoding){return new Buffer(data,encoding)};module.exports.test=function(b){return Buffer.isBuffer(b)}}).call(this,typeof Buffer!=="undefined"?Buffer:undefined)},{}],12:[function(_dereq_,module,exports){"use strict";var Uint8ArrayReader=_dereq_("./uint8ArrayReader");function NodeBufferReader(data){this.data=data;this.length=this.data.length;this.index=0}NodeBufferReader.prototype=new Uint8ArrayReader;NodeBufferReader.prototype.readData=function(size){this.checkOffset(size);var result=this.data.slice(this.index,this.index+size);this.index+=size;return result};module.exports=NodeBufferReader},{"./uint8ArrayReader":18}],13:[function(_dereq_,module,exports){"use strict";var support=_dereq_("./support");var utils=_dereq_("./utils");var crc32=_dereq_("./crc32");var signature=_dereq_("./signature");var defaults=_dereq_("./defaults");var base64=_dereq_("./base64");var compressions=_dereq_("./compressions");var CompressedObject=_dereq_("./compressedObject");var nodeBuffer=_dereq_("./nodeBuffer");var utf8=_dereq_("./utf8");var StringWriter=_dereq_("./stringWriter");var Uint8ArrayWriter=_dereq_("./uint8ArrayWriter");var getRawData=function(file){if(file._data instanceof CompressedObject){file._data=file._data.getContent();file.options.binary=true;file.options.base64=false;if(utils.getTypeOf(file._data)==="uint8array"){var copy=file._data;file._data=new Uint8Array(copy.length);if(copy.length!==0){file._data.set(copy,0)}}}return file._data};var getBinaryData=function(file){var result=getRawData(file),type=utils.getTypeOf(result);if(type==="string"){if(!file.options.binary){if(support.nodebuffer){return nodeBuffer(result,"utf-8")}}return file.asBinary()}return result};var dataToString=function(asUTF8){var result=getRawData(this);if(result===null||typeof result==="undefined"){return""}if(this.options.base64){result=base64.decode(result)}if(asUTF8&&this.options.binary){result=out.utf8decode(result)}else{result=utils.transformTo("string",result)}if(!asUTF8&&!this.options.binary){result=utils.transformTo("string",out.utf8encode(result))}return result};var ZipObject=function(name,data,options){this.name=name;this.dir=options.dir;this.date=options.date;this.comment=options.comment;this._data=data;this.options=options;this._initialMetadata={dir:options.dir,date:options.date}};ZipObject.prototype={asText:function(){return dataToString.call(this,true)},asBinary:function(){return dataToString.call(this,false)},asNodeBuffer:function(){var result=getBinaryData(this);return utils.transformTo("nodebuffer",result)},asUint8Array:function(){var result=getBinaryData(this);return utils.transformTo("uint8array",result)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var decToHex=function(dec,bytes){var hex="",i;for(i=0;i<bytes;i++){hex+=String.fromCharCode(dec&255);dec=dec>>>8}return hex};var extend=function(){var result={},i,attr;for(i=0;i<arguments.length;i++){for(attr in arguments[i]){if(arguments[i].hasOwnProperty(attr)&&typeof result[attr]==="undefined"){result[attr]=arguments[i][attr]}}}return result};var prepareFileAttrs=function(o){o=o||{};if(o.base64===true&&(o.binary===null||o.binary===undefined)){o.binary=true}o=extend(o,defaults);o.date=o.date||new Date;if(o.compression!==null)o.compression=o.compression.toUpperCase();return o};var fileAdd=function(name,data,o){var dataType=utils.getTypeOf(data),parent;o=prepareFileAttrs(o);if(o.createFolders&&(parent=parentFolder(name))){folderAdd.call(this,parent,true)}if(o.dir||data===null||typeof data==="undefined"){o.base64=false;o.binary=false;data=null}else if(dataType==="string"){if(o.binary&&!o.base64){if(o.optimizedBinaryString!==true){data=utils.string2binary(data)}}}else{o.base64=false;o.binary=true;if(!dataType&&!(data instanceof CompressedObject)){throw new Error("The data of '"+name+"' is in an unsupported format !")}if(dataType==="arraybuffer"){data=utils.transformTo("uint8array",data)}}var object=new ZipObject(name,data,o);this.files[name]=object;return object};var parentFolder=function(path){if(path.slice(-1)=="/"){path=path.substring(0,path.length-1)}var lastSlash=path.lastIndexOf("/");return lastSlash>0?path.substring(0,lastSlash):""};var folderAdd=function(name,createFolders){if(name.slice(-1)!="/"){name+="/"}createFolders=typeof createFolders!=="undefined"?createFolders:false;if(!this.files[name]){fileAdd.call(this,name,null,{dir:true,createFolders:createFolders})}return this.files[name]};var generateCompressedObjectFrom=function(file,compression){var result=new CompressedObject,content;if(file._data instanceof CompressedObject){result.uncompressedSize=file._data.uncompressedSize;result.crc32=file._data.crc32;if(result.uncompressedSize===0||file.dir){compression=compressions["STORE"];result.compressedContent="";result.crc32=0}else if(file._data.compressionMethod===compression.magic){result.compressedContent=file._data.getCompressedContent()}else{content=file._data.getContent();result.compressedContent=compression.compress(utils.transformTo(compression.compressInputType,content))}}else{content=getBinaryData(file);if(!content||content.length===0||file.dir){compression=compressions["STORE"];content=""}result.uncompressedSize=content.length;result.crc32=crc32(content);result.compressedContent=compression.compress(utils.transformTo(compression.compressInputType,content))}result.compressedSize=result.compressedContent.length;result.compressionMethod=compression.magic;return result};var generateZipParts=function(name,file,compressedObject,offset){var data=compressedObject.compressedContent,utfEncodedFileName=utils.transformTo("string",utf8.utf8encode(file.name)),comment=file.comment||"",utfEncodedComment=utils.transformTo("string",utf8.utf8encode(comment)),useUTF8ForFileName=utfEncodedFileName.length!==file.name.length,useUTF8ForComment=utfEncodedComment.length!==comment.length,o=file.options,dosTime,dosDate,extraFields="",unicodePathExtraField="",unicodeCommentExtraField="",dir,date;if(file._initialMetadata.dir!==file.dir){dir=file.dir}else{dir=o.dir}if(file._initialMetadata.date!==file.date){date=file.date}else{date=o.date}dosTime=date.getHours();dosTime=dosTime<<6;dosTime=dosTime|date.getMinutes();dosTime=dosTime<<5;dosTime=dosTime|date.getSeconds()/2;dosDate=date.getFullYear()-1980;dosDate=dosDate<<4;dosDate=dosDate|date.getMonth()+1;dosDate=dosDate<<5;dosDate=dosDate|date.getDate();if(useUTF8ForFileName){unicodePathExtraField=decToHex(1,1)+decToHex(crc32(utfEncodedFileName),4)+utfEncodedFileName;extraFields+="up"+decToHex(unicodePathExtraField.length,2)+unicodePathExtraField}if(useUTF8ForComment){unicodeCommentExtraField=decToHex(1,1)+decToHex(this.crc32(utfEncodedComment),4)+utfEncodedComment;extraFields+="uc"+decToHex(unicodeCommentExtraField.length,2)+unicodeCommentExtraField}var header="";header+="\n\x00";header+=useUTF8ForFileName||useUTF8ForComment?"\x00\b":"\x00\x00";header+=compressedObject.compressionMethod;header+=decToHex(dosTime,2);header+=decToHex(dosDate,2);header+=decToHex(compressedObject.crc32,4);header+=decToHex(compressedObject.compressedSize,4);header+=decToHex(compressedObject.uncompressedSize,4);header+=decToHex(utfEncodedFileName.length,2);header+=decToHex(extraFields.length,2);var fileRecord=signature.LOCAL_FILE_HEADER+header+utfEncodedFileName+extraFields;var dirRecord=signature.CENTRAL_FILE_HEADER+"\x00"+header+decToHex(utfEncodedComment.length,2)+"\x00\x00"+"\x00\x00"+(dir===true?"\x00\x00\x00":"\x00\x00\x00\x00")+decToHex(offset,4)+utfEncodedFileName+extraFields+utfEncodedComment;return{fileRecord:fileRecord,dirRecord:dirRecord,compressedObject:compressedObject}};var out={load:function(stream,options){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(search){var result=[],filename,relativePath,file,fileClone;for(filename in this.files){if(!this.files.hasOwnProperty(filename)){continue}file=this.files[filename];fileClone=new ZipObject(file.name,file._data,extend(file.options));relativePath=filename.slice(this.root.length,filename.length);if(filename.slice(0,this.root.length)===this.root&&search(relativePath,fileClone)){result.push(fileClone)}}return result},file:function(name,data,o){if(arguments.length===1){if(utils.isRegExp(name)){var regexp=name;return this.filter(function(relativePath,file){return!file.dir&®exp.test(relativePath)})}else{return this.filter(function(relativePath,file){return!file.dir&&relativePath===name})[0]||null}}else{name=this.root+name;fileAdd.call(this,name,data,o)}return this},folder:function(arg){if(!arg){return this}if(utils.isRegExp(arg)){return this.filter(function(relativePath,file){return file.dir&&arg.test(relativePath)})}var name=this.root+arg;var newFolder=folderAdd.call(this,name);var ret=this.clone();ret.root=newFolder.name;return ret},remove:function(name){name=this.root+name;var file=this.files[name];if(!file){if(name.slice(-1)!="/"){name+="/"}file=this.files[name]}if(file&&!file.dir){delete this.files[name]}else{var kids=this.filter(function(relativePath,file){return file.name.slice(0,name.length)===name});for(var i=0;i<kids.length;i++){delete this.files[kids[i].name]}}return this},generate:function(options){options=extend(options||{},{base64:true,compression:"STORE",type:"base64",comment:null});utils.checkSupport(options.type);var zipData=[],localDirLength=0,centralDirLength=0,writer,i,utfEncodedComment=utils.transformTo("string",this.utf8encode(options.comment||this.comment||""));for(var name in this.files){if(!this.files.hasOwnProperty(name)){continue}var file=this.files[name];var compressionName=file.options.compression||options.compression.toUpperCase();var compression=compressions[compressionName];if(!compression){throw new Error(compressionName+" is not a valid compression method !")}var compressedObject=generateCompressedObjectFrom.call(this,file,compression);var zipPart=generateZipParts.call(this,name,file,compressedObject,localDirLength);localDirLength+=zipPart.fileRecord.length+compressedObject.compressedSize;centralDirLength+=zipPart.dirRecord.length;zipData.push(zipPart)}var dirEnd="";dirEnd=signature.CENTRAL_DIRECTORY_END+"\x00\x00"+"\x00\x00"+decToHex(zipData.length,2)+decToHex(zipData.length,2)+decToHex(centralDirLength,4)+decToHex(localDirLength,4)+decToHex(utfEncodedComment.length,2)+utfEncodedComment;var typeName=options.type.toLowerCase();if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer"){writer=new Uint8ArrayWriter(localDirLength+centralDirLength+dirEnd.length)}else{writer=new StringWriter(localDirLength+centralDirLength+dirEnd.length)}for(i=0;i<zipData.length;i++){writer.append(zipData[i].fileRecord);writer.append(zipData[i].compressedObject.compressedContent)}for(i=0;i<zipData.length;i++){writer.append(zipData[i].dirRecord)}writer.append(dirEnd);var zip=writer.finalize();switch(options.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return utils.transformTo(options.type.toLowerCase(),zip);case"blob":return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer",zip));case"base64":return options.base64?base64.encode(zip):zip;default:return zip}},crc32:function(input,crc){return crc32(input,crc)},utf8encode:function(string){return utils.transformTo("string",utf8.utf8encode(string))},utf8decode:function(input){return utf8.utf8decode(input)}};module.exports=out},{"./base64":1,"./compressedObject":2,"./compressions":3,"./crc32":4,"./defaults":6,"./nodeBuffer":11,"./signature":14,"./stringWriter":16,"./support":17,"./uint8ArrayWriter":19,"./utf8":20,"./utils":21}],14:[function(_dereq_,module,exports){"use strict";exports.LOCAL_FILE_HEADER="PK";exports.CENTRAL_FILE_HEADER="PK";exports.CENTRAL_DIRECTORY_END="PK";exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK";exports.ZIP64_CENTRAL_DIRECTORY_END="PK";exports.DATA_DESCRIPTOR="PK\b"},{}],15:[function(_dereq_,module,exports){"use strict";var DataReader=_dereq_("./dataReader");var utils=_dereq_("./utils");function StringReader(data,optimizedBinaryString){this.data=data;if(!optimizedBinaryString){this.data=utils.string2binary(this.data)}this.length=this.data.length;this.index=0}StringReader.prototype=new DataReader;StringReader.prototype.byteAt=function(i){return this.data.charCodeAt(i)};StringReader.prototype.lastIndexOfSignature=function(sig){return this.data.lastIndexOf(sig)};StringReader.prototype.readData=function(size){this.checkOffset(size);var result=this.data.slice(this.index,this.index+size);this.index+=size;return result};module.exports=StringReader},{"./dataReader":5,"./utils":21}],16:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");var StringWriter=function(){this.data=[]};StringWriter.prototype={append:function(input){input=utils.transformTo("string",input);this.data.push(input)},finalize:function(){return this.data.join("")}};module.exports=StringWriter},{"./utils":21}],17:[function(_dereq_,module,exports){(function(Buffer){"use strict";exports.base64=true;exports.array=true;exports.string=true;exports.arraybuffer=typeof ArrayBuffer!=="undefined"&&typeof Uint8Array!=="undefined";exports.nodebuffer=typeof Buffer!=="undefined";exports.uint8array=typeof Uint8Array!=="undefined";if(typeof ArrayBuffer==="undefined"){exports.blob=false}else{var buffer=new ArrayBuffer(0);try{exports.blob=new Blob([buffer],{type:"application/zip"}).size===0}catch(e){try{var Builder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;var builder=new Builder;builder.append(buffer);exports.blob=builder.getBlob("application/zip").size===0}catch(e){exports.blob=false}}}}).call(this,typeof Buffer!=="undefined"?Buffer:undefined)},{}],18:[function(_dereq_,module,exports){"use strict";var DataReader=_dereq_("./dataReader");function Uint8ArrayReader(data){if(data){this.data=data;this.length=this.data.length;this.index=0}}Uint8ArrayReader.prototype=new DataReader;Uint8ArrayReader.prototype.byteAt=function(i){return this.data[i]};Uint8ArrayReader.prototype.lastIndexOfSignature=function(sig){var sig0=sig.charCodeAt(0),sig1=sig.charCodeAt(1),sig2=sig.charCodeAt(2),sig3=sig.charCodeAt(3);for(var i=this.length-4;i>=0;--i){if(this.data[i]===sig0&&this.data[i+1]===sig1&&this.data[i+2]===sig2&&this.data[i+3]===sig3){return i}}return-1};Uint8ArrayReader.prototype.readData=function(size){this.checkOffset(size);if(size===0){return new Uint8Array(0)}var result=this.data.subarray(this.index,this.index+size);this.index+=size;return result};module.exports=Uint8ArrayReader},{"./dataReader":5}],19:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");var Uint8ArrayWriter=function(length){this.data=new Uint8Array(length);this.index=0};Uint8ArrayWriter.prototype={append:function(input){if(input.length!==0){input=utils.transformTo("uint8array",input);this.data.set(input,this.index);this.index+=input.length}},finalize:function(){return this.data}};module.exports=Uint8ArrayWriter},{"./utils":21}],20:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");var support=_dereq_("./support");var nodeBuffer=_dereq_("./nodeBuffer");var _utf8len=new Array(256);for(var i=0;i<256;i++){_utf8len[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1}_utf8len[254]=_utf8len[254]=1;var string2buf=function(str){var buf,c,c2,m_pos,i,str_len=str.length,buf_len=0;for(m_pos=0;m_pos<str_len;m_pos++){c=str.charCodeAt(m_pos);if((c&64512)===55296&&m_pos+1<str_len){c2=str.charCodeAt(m_pos+1);if((c2&64512)===56320){c=65536+(c-55296<<10)+(c2-56320);m_pos++}}buf_len+=c<128?1:c<2048?2:c<65536?3:4}if(support.uint8array){buf=new Uint8Array(buf_len)}else{buf=new Array(buf_len)}for(i=0,m_pos=0;i<buf_len;m_pos++){c=str.charCodeAt(m_pos);if((c&64512)===55296&&m_pos+1<str_len){c2=str.charCodeAt(m_pos+1);if((c2&64512)===56320){c=65536+(c-55296<<10)+(c2-56320);m_pos++}}if(c<128){buf[i++]=c}else if(c<2048){buf[i++]=192|c>>>6;buf[i++]=128|c&63}else if(c<65536){buf[i++]=224|c>>>12;buf[i++]=128|c>>>6&63;buf[i++]=128|c&63}else{buf[i++]=240|c>>>18;buf[i++]=128|c>>>12&63;buf[i++]=128|c>>>6&63;buf[i++]=128|c&63}}return buf};var utf8border=function(buf,max){var pos;max=max||buf.length;if(max>buf.length){max=buf.length}pos=max-1;while(pos>=0&&(buf[pos]&192)===128){pos--}if(pos<0){return max}if(pos===0){return max}return pos+_utf8len[buf[pos]]>max?pos:max};var buf2string=function(buf){var str,i,out,c,c_len;var len=buf.length;var utf16buf=new Array(len*2);for(out=0,i=0;i<len;){c=buf[i++];if(c<128){utf16buf[out++]=c;continue}c_len=_utf8len[c];if(c_len>4){utf16buf[out++]=65533;i+=c_len-1;continue}c&=c_len===2?31:c_len===3?15:7;while(c_len>1&&i<len){c=c<<6|buf[i++]&63;c_len--}if(c_len>1){utf16buf[out++]=65533;continue}if(c<65536){utf16buf[out++]=c}else{c-=65536;utf16buf[out++]=55296|c>>10&1023;utf16buf[out++]=56320|c&1023}}if(utf16buf.length!==out){if(utf16buf.subarray){utf16buf=utf16buf.subarray(0,out)}else{utf16buf.length=out}}return utils.applyFromCharCode(utf16buf)};exports.utf8encode=function utf8encode(str){if(support.nodebuffer){return nodeBuffer(str,"utf-8")}return string2buf(str)};exports.utf8decode=function utf8decode(buf){if(support.nodebuffer){return utils.transformTo("nodebuffer",buf).toString("utf-8")}buf=utils.transformTo(support.uint8array?"uint8array":"array",buf);var result=[],k=0,len=buf.length,chunk=65536;while(k<len){var nextBoundary=utf8border(buf,Math.min(k+chunk,len));if(support.uint8array){result.push(buf2string(buf.subarray(k,nextBoundary)))}else{result.push(buf2string(buf.slice(k,nextBoundary)))}k=nextBoundary}return result.join("")}},{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(_dereq_,module,exports){"use strict";var support=_dereq_("./support");var compressions=_dereq_("./compressions");var nodeBuffer=_dereq_("./nodeBuffer");exports.string2binary=function(str){var result="";for(var i=0;i<str.length;i++){result+=String.fromCharCode(str.charCodeAt(i)&255)}return result};exports.arrayBuffer2Blob=function(buffer){exports.checkSupport("blob");try{return new Blob([buffer],{type:"application/zip"})}catch(e){try{var Builder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;var builder=new Builder;builder.append(buffer);return builder.getBlob("application/zip")}catch(e){throw new Error("Bug : can't construct the Blob.")}}};function identity(input){return input}function stringToArrayLike(str,array){for(var i=0;i<str.length;++i){array[i]=str.charCodeAt(i)&255}return array}function arrayLikeToString(array){var chunk=65536;var result=[],len=array.length,type=exports.getTypeOf(array),k=0,canUseApply=true;try{switch(type){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,nodeBuffer(0));break}}catch(e){canUseApply=false}if(!canUseApply){var resultStr="";for(var i=0;i<array.length;i++){resultStr+=String.fromCharCode(array[i])}return resultStr}while(k<len&&chunk>1){try{if(type==="array"||type==="nodebuffer"){result.push(String.fromCharCode.apply(null,array.slice(k,Math.min(k+chunk,len))))}else{result.push(String.fromCharCode.apply(null,array.subarray(k,Math.min(k+chunk,len))))}k+=chunk}catch(e){chunk=Math.floor(chunk/2)}}return result.join("")}exports.applyFromCharCode=arrayLikeToString;function arrayLikeToArrayLike(arrayFrom,arrayTo){for(var i=0;i<arrayFrom.length;i++){arrayTo[i]=arrayFrom[i]}return arrayTo}var transform={};transform["string"]={string:identity,array:function(input){return stringToArrayLike(input,new Array(input.length))},arraybuffer:function(input){return transform["string"]["uint8array"](input).buffer},uint8array:function(input){return stringToArrayLike(input,new Uint8Array(input.length))},nodebuffer:function(input){return stringToArrayLike(input,nodeBuffer(input.length))}};transform["array"]={string:arrayLikeToString,array:identity,arraybuffer:function(input){return new Uint8Array(input).buffer},uint8array:function(input){return new Uint8Array(input)},nodebuffer:function(input){return nodeBuffer(input)}};transform["arraybuffer"]={string:function(input){return arrayLikeToString(new Uint8Array(input))},array:function(input){return arrayLikeToArrayLike(new Uint8Array(input),new Array(input.byteLength))},arraybuffer:identity,uint8array:function(input){return new Uint8Array(input)},nodebuffer:function(input){return nodeBuffer(new Uint8Array(input))}};transform["uint8array"]={string:arrayLikeToString,array:function(input){return arrayLikeToArrayLike(input,new Array(input.length))},arraybuffer:function(input){return input.buffer},uint8array:identity,nodebuffer:function(input){return nodeBuffer(input)}};transform["nodebuffer"]={string:arrayLikeToString,array:function(input){return arrayLikeToArrayLike(input,new Array(input.length))},arraybuffer:function(input){return transform["nodebuffer"]["uint8array"](input).buffer},uint8array:function(input){return arrayLikeToArrayLike(input,new Uint8Array(input.length))},nodebuffer:identity};exports.transformTo=function(outputType,input){if(!input){input=""}if(!outputType){return input}exports.checkSupport(outputType);var inputType=exports.getTypeOf(input);var result=transform[inputType][outputType](input);return result};exports.getTypeOf=function(input){if(typeof input==="string"){return"string"}if(Object.prototype.toString.call(input)==="[object Array]"){return"array"}if(support.nodebuffer&&nodeBuffer.test(input)){return"nodebuffer"}if(support.uint8array&&input instanceof Uint8Array){return"uint8array"}if(support.arraybuffer&&input instanceof ArrayBuffer){return"arraybuffer"}};exports.checkSupport=function(type){var supported=support[type.toLowerCase()];if(!supported){throw new Error(type+" is not supported by this browser")}};exports.MAX_VALUE_16BITS=65535;exports.MAX_VALUE_32BITS=-1;exports.pretty=function(str){var res="",code,i;for(i=0;i<(str||"").length;i++){code=str.charCodeAt(i);res+="\\x"+(code<16?"0":"")+code.toString(16).toUpperCase();+ }return res};exports.findCompression=function(compressionMethod){for(var method in compressions){if(!compressions.hasOwnProperty(method)){continue}if(compressions[method].magic===compressionMethod){return compressions[method]}}return null};exports.isRegExp=function(object){return Object.prototype.toString.call(object)==="[object RegExp]"}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(_dereq_,module,exports){"use strict";var StringReader=_dereq_("./stringReader");var NodeBufferReader=_dereq_("./nodeBufferReader");var Uint8ArrayReader=_dereq_("./uint8ArrayReader");var utils=_dereq_("./utils");var sig=_dereq_("./signature");var ZipEntry=_dereq_("./zipEntry");var support=_dereq_("./support");var jszipProto=_dereq_("./object");function ZipEntries(data,loadOptions){this.files=[];this.loadOptions=loadOptions;if(data){this.load(data)}}ZipEntries.prototype={checkSignature:function(expectedSignature){var signature=this.reader.readString(4);if(signature!==expectedSignature){throw new Error("Corrupted zip or bug : unexpected signature "+"("+utils.pretty(signature)+", expected "+utils.pretty(expectedSignature)+")")}},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2);this.diskWithCentralDirStart=this.reader.readInt(2);this.centralDirRecordsOnThisDisk=this.reader.readInt(2);this.centralDirRecords=this.reader.readInt(2);this.centralDirSize=this.reader.readInt(4);this.centralDirOffset=this.reader.readInt(4);this.zipCommentLength=this.reader.readInt(2);this.zipComment=this.reader.readString(this.zipCommentLength);this.zipComment=jszipProto.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8);this.versionMadeBy=this.reader.readString(2);this.versionNeeded=this.reader.readInt(2);this.diskNumber=this.reader.readInt(4);this.diskWithCentralDirStart=this.reader.readInt(4);this.centralDirRecordsOnThisDisk=this.reader.readInt(8);this.centralDirRecords=this.reader.readInt(8);this.centralDirSize=this.reader.readInt(8);this.centralDirOffset=this.reader.readInt(8);this.zip64ExtensibleData={};var extraDataSize=this.zip64EndOfCentralSize-44,index=0,extraFieldId,extraFieldLength,extraFieldValue;while(index<extraDataSize){extraFieldId=this.reader.readInt(2);extraFieldLength=this.reader.readInt(4);extraFieldValue=this.reader.readString(extraFieldLength);this.zip64ExtensibleData[extraFieldId]={id:extraFieldId,length:extraFieldLength,value:extraFieldValue}}},readBlockZip64EndOfCentralLocator:function(){this.diskWithZip64CentralDirStart=this.reader.readInt(4);this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8);this.disksCount=this.reader.readInt(4);if(this.disksCount>1){throw new Error("Multi-volumes zip are not supported")}},readLocalFiles:function(){var i,file;for(i=0;i<this.files.length;i++){file=this.files[i];this.reader.setIndex(file.localHeaderOffset);this.checkSignature(sig.LOCAL_FILE_HEADER);file.readLocalPart(this.reader);file.handleUTF8()}},readCentralDir:function(){var file;this.reader.setIndex(this.centralDirOffset);while(this.reader.readString(4)===sig.CENTRAL_FILE_HEADER){file=new ZipEntry({zip64:this.zip64},this.loadOptions);file.readCentralPart(this.reader);this.files.push(file)}},readEndOfCentral:function(){var offset=this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);if(offset===-1){throw new Error("Corrupted zip : can't find end of central directory")}this.reader.setIndex(offset);this.checkSignature(sig.CENTRAL_DIRECTORY_END);this.readBlockEndOfCentral();if(this.diskNumber===utils.MAX_VALUE_16BITS||this.diskWithCentralDirStart===utils.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===utils.MAX_VALUE_16BITS||this.centralDirRecords===utils.MAX_VALUE_16BITS||this.centralDirSize===utils.MAX_VALUE_32BITS||this.centralDirOffset===utils.MAX_VALUE_32BITS){this.zip64=true;offset=this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);if(offset===-1){throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator")}this.reader.setIndex(offset);this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);this.readBlockZip64EndOfCentralLocator();this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);this.readBlockZip64EndOfCentral()}},prepareReader:function(data){var type=utils.getTypeOf(data);if(type==="string"&&!support.uint8array){this.reader=new StringReader(data,this.loadOptions.optimizedBinaryString)}else if(type==="nodebuffer"){this.reader=new NodeBufferReader(data)}else{this.reader=new Uint8ArrayReader(utils.transformTo("uint8array",data))}},load:function(data){this.prepareReader(data);this.readEndOfCentral();this.readCentralDir();this.readLocalFiles()}};module.exports=ZipEntries},{"./nodeBufferReader":12,"./object":13,"./signature":14,"./stringReader":15,"./support":17,"./uint8ArrayReader":18,"./utils":21,"./zipEntry":23}],23:[function(_dereq_,module,exports){"use strict";var StringReader=_dereq_("./stringReader");var utils=_dereq_("./utils");var CompressedObject=_dereq_("./compressedObject");var jszipProto=_dereq_("./object");function ZipEntry(options,loadOptions){this.options=options;this.loadOptions=loadOptions}ZipEntry.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},prepareCompressedContent:function(reader,from,length){return function(){var previousIndex=reader.index;reader.setIndex(from);var compressedFileData=reader.readData(length);reader.setIndex(previousIndex);return compressedFileData}},prepareContent:function(reader,from,length,compression,uncompressedSize){return function(){var compressedFileData=utils.transformTo(compression.uncompressInputType,this.getCompressedContent());var uncompressedFileData=compression.uncompress(compressedFileData);if(uncompressedFileData.length!==uncompressedSize){throw new Error("Bug : uncompressed data size mismatch")}return uncompressedFileData}},readLocalPart:function(reader){var compression,localExtraFieldsLength;reader.skip(22);this.fileNameLength=reader.readInt(2);localExtraFieldsLength=reader.readInt(2);this.fileName=reader.readString(this.fileNameLength);reader.skip(localExtraFieldsLength);if(this.compressedSize==-1||this.uncompressedSize==-1){throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory "+"(compressedSize == -1 || uncompressedSize == -1)")}compression=utils.findCompression(this.compressionMethod);if(compression===null){throw new Error("Corrupted zip : compression "+utils.pretty(this.compressionMethod)+" unknown (inner file : "+this.fileName+")")}this.decompressed=new CompressedObject;this.decompressed.compressedSize=this.compressedSize;this.decompressed.uncompressedSize=this.uncompressedSize;this.decompressed.crc32=this.crc32;this.decompressed.compressionMethod=this.compressionMethod;this.decompressed.getCompressedContent=this.prepareCompressedContent(reader,reader.index,this.compressedSize,compression);this.decompressed.getContent=this.prepareContent(reader,reader.index,this.compressedSize,compression,this.uncompressedSize);if(this.loadOptions.checkCRC32){this.decompressed=utils.transformTo("string",this.decompressed.getContent());if(jszipProto.crc32(this.decompressed)!==this.crc32){throw new Error("Corrupted zip : CRC32 mismatch")}}},readCentralPart:function(reader){this.versionMadeBy=reader.readString(2);this.versionNeeded=reader.readInt(2);this.bitFlag=reader.readInt(2);this.compressionMethod=reader.readString(2);this.date=reader.readDate();this.crc32=reader.readInt(4);this.compressedSize=reader.readInt(4);this.uncompressedSize=reader.readInt(4);this.fileNameLength=reader.readInt(2);this.extraFieldsLength=reader.readInt(2);this.fileCommentLength=reader.readInt(2);this.diskNumberStart=reader.readInt(2);this.internalFileAttributes=reader.readInt(2);this.externalFileAttributes=reader.readInt(4);this.localHeaderOffset=reader.readInt(4);if(this.isEncrypted()){throw new Error("Encrypted zip are not supported")}this.fileName=reader.readString(this.fileNameLength);this.readExtraFields(reader);this.parseZIP64ExtraField(reader);this.fileComment=reader.readString(this.fileCommentLength);this.dir=this.externalFileAttributes&16?true:false},parseZIP64ExtraField:function(reader){if(!this.extraFields[1]){return}var extraReader=new StringReader(this.extraFields[1].value);if(this.uncompressedSize===utils.MAX_VALUE_32BITS){this.uncompressedSize=extraReader.readInt(8)}if(this.compressedSize===utils.MAX_VALUE_32BITS){this.compressedSize=extraReader.readInt(8)}if(this.localHeaderOffset===utils.MAX_VALUE_32BITS){this.localHeaderOffset=extraReader.readInt(8)}if(this.diskNumberStart===utils.MAX_VALUE_32BITS){this.diskNumberStart=extraReader.readInt(4)}},readExtraFields:function(reader){var start=reader.index,extraFieldId,extraFieldLength,extraFieldValue;this.extraFields=this.extraFields||{};while(reader.index<start+this.extraFieldsLength){extraFieldId=reader.readInt(2);extraFieldLength=reader.readInt(2);extraFieldValue=reader.readString(extraFieldLength);this.extraFields[extraFieldId]={id:extraFieldId,length:extraFieldLength,value:extraFieldValue}}},handleUTF8:function(){if(this.useUTF8()){this.fileName=jszipProto.utf8decode(this.fileName);this.fileComment=jszipProto.utf8decode(this.fileComment)}else{var upath=this.findExtraFieldUnicodePath();if(upath!==null){this.fileName=upath}var ucomment=this.findExtraFieldUnicodeComment();if(ucomment!==null){this.fileComment=ucomment}}},findExtraFieldUnicodePath:function(){var upathField=this.extraFields[28789];if(upathField){var extraReader=new StringReader(upathField.value);if(extraReader.readInt(1)!==1){return null}if(jszipProto.crc32(this.fileName)!==extraReader.readInt(4)){return null}return jszipProto.utf8decode(extraReader.readString(upathField.length-5))}return null},findExtraFieldUnicodeComment:function(){var ucommentField=this.extraFields[25461];if(ucommentField){var extraReader=new StringReader(ucommentField.value);if(extraReader.readInt(1)!==1){return null}if(jszipProto.crc32(this.fileComment)!==extraReader.readInt(4)){return null}return jszipProto.utf8decode(extraReader.readString(ucommentField.length-5))}return null}};module.exports=ZipEntry},{"./compressedObject":2,"./object":13,"./stringReader":15,"./utils":21}],24:[function(_dereq_,module,exports){"use strict";var assign=_dereq_("./lib/utils/common").assign;var deflate=_dereq_("./lib/deflate");var inflate=_dereq_("./lib/inflate");var constants=_dereq_("./lib/zlib/constants");var pako={};assign(pako,deflate,inflate,constants);module.exports=pako},{"./lib/deflate":25,"./lib/inflate":26,"./lib/utils/common":27,"./lib/zlib/constants":30}],25:[function(_dereq_,module,exports){"use strict";var zlib_deflate=_dereq_("./zlib/deflate.js");var utils=_dereq_("./utils/common");var strings=_dereq_("./utils/strings");var msg=_dereq_("./zlib/messages");var zstream=_dereq_("./zlib/zstream");var Z_NO_FLUSH=0;var Z_FINISH=4;var Z_OK=0;var Z_STREAM_END=1;var Z_DEFAULT_COMPRESSION=-1;var Z_DEFAULT_STRATEGY=0;var Z_DEFLATED=8;var Deflate=function(options){this.options=utils.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY,to:""},options||{});var opt=this.options;if(opt.raw&&opt.windowBits>0){opt.windowBits=-opt.windowBits}else if(opt.gzip&&opt.windowBits>0&&opt.windowBits<16){opt.windowBits+=16}this.err=0;this.msg="";this.ended=false;this.chunks=[];this.strm=new zstream;this.strm.avail_out=0;var status=zlib_deflate.deflateInit2(this.strm,opt.level,opt.method,opt.windowBits,opt.memLevel,opt.strategy);if(status!==Z_OK){throw new Error(msg[status])}if(opt.header){zlib_deflate.deflateSetHeader(this.strm,opt.header)}};Deflate.prototype.push=function(data,mode){var strm=this.strm;var chunkSize=this.options.chunkSize;var status,_mode;if(this.ended){return false}_mode=mode===~~mode?mode:mode===true?Z_FINISH:Z_NO_FLUSH;if(typeof data==="string"){strm.input=strings.string2buf(data)}else{strm.input=data}strm.next_in=0;strm.avail_in=strm.input.length;do{if(strm.avail_out===0){strm.output=new utils.Buf8(chunkSize);strm.next_out=0;strm.avail_out=chunkSize}status=zlib_deflate.deflate(strm,_mode);if(status!==Z_STREAM_END&&status!==Z_OK){this.onEnd(status);this.ended=true;return false}if(strm.avail_out===0||strm.avail_in===0&&_mode===Z_FINISH){if(this.options.to==="string"){this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output,strm.next_out)))}else{this.onData(utils.shrinkBuf(strm.output,strm.next_out))}}}while((strm.avail_in>0||strm.avail_out===0)&&status!==Z_STREAM_END);if(_mode===Z_FINISH){status=zlib_deflate.deflateEnd(this.strm);this.onEnd(status);this.ended=true;return status===Z_OK}return true};Deflate.prototype.onData=function(chunk){this.chunks.push(chunk)};Deflate.prototype.onEnd=function(status){if(status===Z_OK){if(this.options.to==="string"){this.result=this.chunks.join("")}else{this.result=utils.flattenChunks(this.chunks)}}this.chunks=[];this.err=status;this.msg=this.strm.msg};function deflate(input,options){var deflator=new Deflate(options);deflator.push(input,true);if(deflator.err){throw deflator.msg}return deflator.result}function deflateRaw(input,options){options=options||{};options.raw=true;return deflate(input,options)}function gzip(input,options){options=options||{};options.gzip=true;return deflate(input,options)}exports.Deflate=Deflate;exports.deflate=deflate;exports.deflateRaw=deflateRaw;exports.gzip=gzip},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(_dereq_,module,exports){"use strict";var zlib_inflate=_dereq_("./zlib/inflate.js");var utils=_dereq_("./utils/common");var strings=_dereq_("./utils/strings");var c=_dereq_("./zlib/constants");var msg=_dereq_("./zlib/messages");var zstream=_dereq_("./zlib/zstream");var gzheader=_dereq_("./zlib/gzheader");var Inflate=function(options){this.options=utils.assign({chunkSize:16384,windowBits:0,to:""},options||{});var opt=this.options;if(opt.raw&&opt.windowBits>=0&&opt.windowBits<16){opt.windowBits=-opt.windowBits;if(opt.windowBits===0){opt.windowBits=-15}}if(opt.windowBits>=0&&opt.windowBits<16&&!(options&&options.windowBits)){opt.windowBits+=32}if(opt.windowBits>15&&opt.windowBits<48){if((opt.windowBits&15)===0){opt.windowBits|=15}}this.err=0;this.msg="";this.ended=false;this.chunks=[];this.strm=new zstream;this.strm.avail_out=0;var status=zlib_inflate.inflateInit2(this.strm,opt.windowBits);if(status!==c.Z_OK){throw new Error(msg[status])}this.header=new gzheader;zlib_inflate.inflateGetHeader(this.strm,this.header)};Inflate.prototype.push=function(data,mode){var strm=this.strm;var chunkSize=this.options.chunkSize;var status,_mode;var next_out_utf8,tail,utf8str;if(this.ended){return false}_mode=mode===~~mode?mode:mode===true?c.Z_FINISH:c.Z_NO_FLUSH;if(typeof data==="string"){strm.input=strings.binstring2buf(data)}else{strm.input=data}strm.next_in=0;strm.avail_in=strm.input.length;do{if(strm.avail_out===0){strm.output=new utils.Buf8(chunkSize);strm.next_out=0;strm.avail_out=chunkSize}status=zlib_inflate.inflate(strm,c.Z_NO_FLUSH);if(status!==c.Z_STREAM_END&&status!==c.Z_OK){this.onEnd(status);this.ended=true;return false}if(strm.next_out){if(strm.avail_out===0||status===c.Z_STREAM_END||strm.avail_in===0&&_mode===c.Z_FINISH){if(this.options.to==="string"){next_out_utf8=strings.utf8border(strm.output,strm.next_out);tail=strm.next_out-next_out_utf8;utf8str=strings.buf2string(strm.output,next_out_utf8);strm.next_out=tail;strm.avail_out=chunkSize-tail;if(tail){utils.arraySet(strm.output,strm.output,next_out_utf8,tail,0)}this.onData(utf8str)}else{this.onData(utils.shrinkBuf(strm.output,strm.next_out))}}}}while(strm.avail_in>0&&status!==c.Z_STREAM_END);if(status===c.Z_STREAM_END){_mode=c.Z_FINISH}if(_mode===c.Z_FINISH){status=zlib_inflate.inflateEnd(this.strm);this.onEnd(status);this.ended=true;return status===c.Z_OK}return true};Inflate.prototype.onData=function(chunk){this.chunks.push(chunk)};Inflate.prototype.onEnd=function(status){if(status===c.Z_OK){if(this.options.to==="string"){this.result=this.chunks.join("")}else{this.result=utils.flattenChunks(this.chunks)}}this.chunks=[];this.err=status;this.msg=this.strm.msg};function inflate(input,options){var inflator=new Inflate(options);inflator.push(input,true);if(inflator.err){throw inflator.msg}return inflator.result}function inflateRaw(input,options){options=options||{};options.raw=true;return inflate(input,options)}exports.Inflate=Inflate;exports.inflate=inflate;exports.inflateRaw=inflateRaw;exports.ungzip=inflate},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(_dereq_,module,exports){"use strict";var TYPED_OK=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";exports.assign=function(obj){var sources=Array.prototype.slice.call(arguments,1);while(sources.length){var source=sources.shift();if(!source){continue}if(typeof source!=="object"){throw new TypeError(source+"must be non-object")}for(var p in source){if(source.hasOwnProperty(p)){obj[p]=source[p]}}}return obj};exports.shrinkBuf=function(buf,size){if(buf.length===size){return buf}if(buf.subarray){return buf.subarray(0,size)}buf.length=size;return buf};var fnTyped={arraySet:function(dest,src,src_offs,len,dest_offs){if(src.subarray&&dest.subarray){dest.set(src.subarray(src_offs,src_offs+len),dest_offs);return}for(var i=0;i<len;i++){dest[dest_offs+i]=src[src_offs+i]}},flattenChunks:function(chunks){var i,l,len,pos,chunk,result;len=0;for(i=0,l=chunks.length;i<l;i++){len+=chunks[i].length}result=new Uint8Array(len);pos=0;for(i=0,l=chunks.length;i<l;i++){chunk=chunks[i];result.set(chunk,pos);pos+=chunk.length}return result}};var fnUntyped={arraySet:function(dest,src,src_offs,len,dest_offs){for(var i=0;i<len;i++){dest[dest_offs+i]=src[src_offs+i]}},flattenChunks:function(chunks){return[].concat.apply([],chunks)}};exports.setTyped=function(on){if(on){exports.Buf8=Uint8Array;exports.Buf16=Uint16Array;exports.Buf32=Int32Array;exports.assign(exports,fnTyped)}else{exports.Buf8=Array;exports.Buf16=Array;exports.Buf32=Array;exports.assign(exports,fnUntyped)}};exports.setTyped(TYPED_OK)},{}],28:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./common");var STR_APPLY_OK=true;var STR_APPLY_UIA_OK=true;try{String.fromCharCode.apply(null,[0])}catch(__){STR_APPLY_OK=false}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(__){STR_APPLY_UIA_OK=false}var _utf8len=new utils.Buf8(256);for(var i=0;i<256;i++){_utf8len[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1}_utf8len[254]=_utf8len[254]=1;exports.string2buf=function(str){var buf,c,c2,m_pos,i,str_len=str.length,buf_len=0;for(m_pos=0;m_pos<str_len;m_pos++){c=str.charCodeAt(m_pos);if((c&64512)===55296&&m_pos+1<str_len){c2=str.charCodeAt(m_pos+1);if((c2&64512)===56320){c=65536+(c-55296<<10)+(c2-56320);m_pos++}}buf_len+=c<128?1:c<2048?2:c<65536?3:4}buf=new utils.Buf8(buf_len);for(i=0,m_pos=0;i<buf_len;m_pos++){c=str.charCodeAt(m_pos);if((c&64512)===55296&&m_pos+1<str_len){c2=str.charCodeAt(m_pos+1);if((c2&64512)===56320){c=65536+(c-55296<<10)+(c2-56320);m_pos++}}if(c<128){buf[i++]=c}else if(c<2048){buf[i++]=192|c>>>6;buf[i++]=128|c&63}else if(c<65536){buf[i++]=224|c>>>12;buf[i++]=128|c>>>6&63;buf[i++]=128|c&63}else{buf[i++]=240|c>>>18;buf[i++]=128|c>>>12&63;buf[i++]=128|c>>>6&63;buf[i++]=128|c&63}}return buf};function buf2binstring(buf,len){if(len<65537){if(buf.subarray&&STR_APPLY_UIA_OK||!buf.subarray&&STR_APPLY_OK){return String.fromCharCode.apply(null,utils.shrinkBuf(buf,len))}}var result="";for(var i=0;i<len;i++){result+=String.fromCharCode(buf[i])}return result}exports.buf2binstring=function(buf){return buf2binstring(buf,buf.length)};exports.binstring2buf=function(str){var buf=new utils.Buf8(str.length);for(var i=0,len=buf.length;i<len;i++){buf[i]=str.charCodeAt(i)}return buf};exports.buf2string=function(buf,max){var i,out,c,c_len;var len=max||buf.length;var utf16buf=new Array(len*2);for(out=0,i=0;i<len;){c=buf[i++];if(c<128){utf16buf[out++]=c;continue}c_len=_utf8len[c];if(c_len>4){utf16buf[out++]=65533;i+=c_len-1;continue}c&=c_len===2?31:c_len===3?15:7;while(c_len>1&&i<len){c=c<<6|buf[i++]&63;c_len--}if(c_len>1){utf16buf[out++]=65533;continue}if(c<65536){utf16buf[out++]=c}else{c-=65536;utf16buf[out++]=55296|c>>10&1023;utf16buf[out++]=56320|c&1023}}return buf2binstring(utf16buf,out)};exports.utf8border=function(buf,max){var pos;max=max||buf.length;if(max>buf.length){max=buf.length}pos=max-1;while(pos>=0&&(buf[pos]&192)===128){pos--}if(pos<0){return max}if(pos===0){return max}return pos+_utf8len[buf[pos]]>max?pos:max}},{"./common":27}],29:[function(_dereq_,module,exports){"use strict";function adler32(adler,buf,len,pos){var s1=adler&65535|0,s2=adler>>>16&65535|0,n=0;while(len!==0){n=len>2e3?2e3:len;len-=n;do{s1=s1+buf[pos++]|0;s2=s2+s1|0}while(--n);s1%=65521;s2%=65521}return s1|s2<<16|0}module.exports=adler32},{}],30:[function(_dereq_,module,exports){module.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],31:[function(_dereq_,module,exports){"use strict";function makeTable(){var c,table=[];for(var n=0;n<256;n++){c=n;for(var k=0;k<8;k++){c=c&1?3988292384^c>>>1:c>>>1}table[n]=c}return table}var crcTable=makeTable();function crc32(crc,buf,len,pos){var t=crcTable,end=pos+len;crc=crc^-1;for(var i=pos;i<end;i++){crc=crc>>>8^t[(crc^buf[i])&255]}return crc^-1}module.exports=crc32},{}],32:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("../utils/common");var trees=_dereq_("./trees");var adler32=_dereq_("./adler32");var crc32=_dereq_("./crc32");var msg=_dereq_("./messages");var Z_NO_FLUSH=0;var Z_PARTIAL_FLUSH=1;var Z_FULL_FLUSH=3;var Z_FINISH=4;var Z_BLOCK=5;var Z_OK=0;var Z_STREAM_END=1;var Z_STREAM_ERROR=-2;var Z_DATA_ERROR=-3;var Z_BUF_ERROR=-5;var Z_DEFAULT_COMPRESSION=-1;var Z_FILTERED=1;var Z_HUFFMAN_ONLY=2;var Z_RLE=3;var Z_FIXED=4;var Z_DEFAULT_STRATEGY=0;var Z_UNKNOWN=2;var Z_DEFLATED=8;var MAX_MEM_LEVEL=9;var MAX_WBITS=15;var DEF_MEM_LEVEL=8;var LENGTH_CODES=29;var LITERALS=256;var L_CODES=LITERALS+1+LENGTH_CODES;var D_CODES=30;var BL_CODES=19;var HEAP_SIZE=2*L_CODES+1;var MAX_BITS=15;var MIN_MATCH=3;var MAX_MATCH=258;var MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1;var PRESET_DICT=32;var INIT_STATE=42;var EXTRA_STATE=69;var NAME_STATE=73;var COMMENT_STATE=91;var HCRC_STATE=103;var BUSY_STATE=113;var FINISH_STATE=666;var BS_NEED_MORE=1;var BS_BLOCK_DONE=2;var BS_FINISH_STARTED=3;var BS_FINISH_DONE=4;var OS_CODE=3;function err(strm,errorCode){strm.msg=msg[errorCode];return errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){var len=buf.length;while(--len>=0){buf[len]=0}}function flush_pending(strm){var s=strm.state;var len=s.pending;if(len>strm.avail_out){len=strm.avail_out}if(len===0){return}utils.arraySet(strm.output,s.pending_buf,s.pending_out,len,strm.next_out);strm.next_out+=len;s.pending_out+=len;strm.total_out+=len;strm.avail_out-=len;s.pending-=len;if(s.pending===0){s.pending_out=0}}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last);s.block_start=s.strstart;flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255;s.pending_buf[s.pending++]=b&255}function read_buf(strm,buf,start,size){var len=strm.avail_in;if(len>size){len=size}if(len===0){return 0}strm.avail_in-=len;utils.arraySet(buf,strm.input,strm.next_in,len,start);if(strm.state.wrap===1){strm.adler=adler32(strm.adler,buf,len,start)}else if(strm.state.wrap===2){strm.adler=crc32(strm.adler,buf,len,start)}strm.next_in+=len;strm.total_in+=len;return len}function longest_match(s,cur_match){var chain_length=s.max_chain_length;var scan=s.strstart;var match;var len;var best_len=s.prev_length;var nice_match=s.nice_match;var limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0;var _win=s.window;var wmask=s.w_mask;var prev=s.prev;var strend=s.strstart+MAX_MATCH;var scan_end1=_win[scan+best_len-1];var scan_end=_win[scan+best_len];if(s.prev_length>=s.good_match){chain_length>>=2}if(nice_match>s.lookahead){nice_match=s.lookahead}do{match=cur_match;if(_win[match+best_len]!==scan_end||_win[match+best_len-1]!==scan_end1||_win[match]!==_win[scan]||_win[++match]!==_win[scan+1]){continue}scan+=2;match++;do{}while(_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&scan<strend);len=MAX_MATCH-(strend-scan);scan=strend-MAX_MATCH;if(len>best_len){s.match_start=cur_match;best_len=len;if(len>=nice_match){break}scan_end1=_win[scan+best_len-1];scan_end=_win[scan+best_len]}}while((cur_match=prev[cur_match&wmask])>limit&&--chain_length!==0);if(best_len<=s.lookahead){return best_len}return s.lookahead}function fill_window(s){var _w_size=s.w_size;var p,n,m,more,str;do{more=s.window_size-s.lookahead-s.strstart;if(s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0);s.match_start-=_w_size;s.strstart-=_w_size;s.block_start-=_w_size;n=s.hash_size;p=n;do{m=s.head[--p];s.head[p]=m>=_w_size?m-_w_size:0}while(--n);n=_w_size;p=n;do{m=s.prev[--p];s.prev[p]=m>=_w_size?m-_w_size:0}while(--n);more+=_w_size}if(s.strm.avail_in===0){break}n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more);s.lookahead+=n;if(s.lookahead+s.insert>=MIN_MATCH){str=s.strstart-s.insert;s.ins_h=s.window[str];s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+1])&s.hash_mask;while(s.insert){s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+MIN_MATCH-1])&s.hash_mask;s.prev[str&s.w_mask]=s.head[s.ins_h];s.head[s.ins_h]=str;str++;s.insert--;if(s.lookahead+s.insert<MIN_MATCH){break}}}}while(s.lookahead<MIN_LOOKAHEAD&&s.strm.avail_in!==0)}function deflate_stored(s,flush){var max_block_size=65535;if(max_block_size>s.pending_buf_size-5){max_block_size=s.pending_buf_size-5}for(;;){if(s.lookahead<=1){fill_window(s);if(s.lookahead===0&&flush===Z_NO_FLUSH){return BS_NEED_MORE}if(s.lookahead===0){break}}s.strstart+=s.lookahead;s.lookahead=0;var max_start=s.block_start+max_block_size;if(s.strstart===0||s.strstart>=max_start){s.lookahead=s.strstart-max_start;s.strstart=max_start;flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}if(s.strstart-s.block_start>=s.w_size-MIN_LOOKAHEAD){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.strstart>s.block_start){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_NEED_MORE}function deflate_fast(s,flush){var hash_head;var bflush;for(;;){if(s.lookahead<MIN_LOOKAHEAD){fill_window(s);if(s.lookahead<MIN_LOOKAHEAD&&flush===Z_NO_FLUSH){return BS_NEED_MORE}if(s.lookahead===0){break}}hash_head=0;if(s.lookahead>=MIN_MATCH){s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask;hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h];s.head[s.ins_h]=s.strstart}if(hash_head!==0&&s.strstart-hash_head<=s.w_size-MIN_LOOKAHEAD){s.match_length=longest_match(s,hash_head)}if(s.match_length>=MIN_MATCH){bflush=trees._tr_tally(s,s.strstart-s.match_start,s.match_length-MIN_MATCH);s.lookahead-=s.match_length;if(s.match_length<=s.max_lazy_match&&s.lookahead>=MIN_MATCH){s.match_length--;do{s.strstart++;s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask;hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h];s.head[s.ins_h]=s.strstart}while(--s.match_length!==0);s.strstart++}else{s.strstart+=s.match_length;s.match_length=0;s.ins_h=s.window[s.strstart];s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+1])&s.hash_mask}}else{bflush=trees._tr_tally(s,0,s.window[s.strstart]);s.lookahead--;s.strstart++}if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=s.strstart<MIN_MATCH-1?s.strstart:MIN_MATCH-1;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}function deflate_slow(s,flush){var hash_head;var bflush;var max_insert;for(;;){if(s.lookahead<MIN_LOOKAHEAD){fill_window(s);if(s.lookahead<MIN_LOOKAHEAD&&flush===Z_NO_FLUSH){return BS_NEED_MORE}if(s.lookahead===0){break}}hash_head=0;if(s.lookahead>=MIN_MATCH){s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask;hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h];s.head[s.ins_h]=s.strstart}s.prev_length=s.match_length;s.prev_match=s.match_start;s.match_length=MIN_MATCH-1;if(hash_head!==0&&s.prev_length<s.max_lazy_match&&s.strstart-hash_head<=s.w_size-MIN_LOOKAHEAD){s.match_length=longest_match(s,hash_head);if(s.match_length<=5&&(s.strategy===Z_FILTERED||s.match_length===MIN_MATCH&&s.strstart-s.match_start>4096)){s.match_length=MIN_MATCH-1}}if(s.prev_length>=MIN_MATCH&&s.match_length<=s.prev_length){max_insert=s.strstart+s.lookahead-MIN_MATCH;bflush=trees._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-MIN_MATCH);s.lookahead-=s.prev_length-1;s.prev_length-=2;do{if(++s.strstart<=max_insert){s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask;hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h];s.head[s.ins_h]=s.strstart}}while(--s.prev_length!==0);s.match_available=0;s.match_length=MIN_MATCH-1;s.strstart++;if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}else if(s.match_available){bflush=trees._tr_tally(s,0,s.window[s.strstart-1]);if(bflush){flush_block_only(s,false)}s.strstart++;s.lookahead--;if(s.strm.avail_out===0){return BS_NEED_MORE}}else{s.match_available=1;s.strstart++;s.lookahead--}}if(s.match_available){bflush=trees._tr_tally(s,0,s.window[s.strstart-1]);s.match_available=0}s.insert=s.strstart<MIN_MATCH-1?s.strstart:MIN_MATCH-1;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}function deflate_rle(s,flush){var bflush;var prev;var scan,strend;var _win=s.window;for(;;){if(s.lookahead<=MAX_MATCH){fill_window(s);if(s.lookahead<=MAX_MATCH&&flush===Z_NO_FLUSH){return BS_NEED_MORE}if(s.lookahead===0){break}}s.match_length=0;if(s.lookahead>=MIN_MATCH&&s.strstart>0){scan=s.strstart-1;prev=_win[scan];if(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]){strend=s.strstart+MAX_MATCH;do{}while(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&scan<strend);s.match_length=MAX_MATCH-(strend-scan);if(s.match_length>s.lookahead){s.match_length=s.lookahead}}}if(s.match_length>=MIN_MATCH){bflush=trees._tr_tally(s,1,s.match_length-MIN_MATCH);s.lookahead-=s.match_length;s.strstart+=s.match_length;s.match_length=0}else{bflush=trees._tr_tally(s,0,s.window[s.strstart]);s.lookahead--;s.strstart++}if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}function deflate_huff(s,flush){+ var bflush;for(;;){if(s.lookahead===0){fill_window(s);if(s.lookahead===0){if(flush===Z_NO_FLUSH){return BS_NEED_MORE}break}}s.match_length=0;bflush=trees._tr_tally(s,0,s.window[s.strstart]);s.lookahead--;s.strstart++;if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}var Config=function(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length;this.max_lazy=max_lazy;this.nice_length=nice_length;this.max_chain=max_chain;this.func=func};var configuration_table;configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function lm_init(s){s.window_size=2*s.w_size;zero(s.head);s.max_lazy_match=configuration_table[s.level].max_lazy;s.good_match=configuration_table[s.level].good_length;s.nice_match=configuration_table[s.level].nice_length;s.max_chain_length=configuration_table[s.level].max_chain;s.strstart=0;s.block_start=0;s.lookahead=0;s.insert=0;s.match_length=s.prev_length=MIN_MATCH-1;s.match_available=0;s.ins_h=0}function DeflateState(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=Z_DEFLATED;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new utils.Buf16(HEAP_SIZE*2);this.dyn_dtree=new utils.Buf16((2*D_CODES+1)*2);this.bl_tree=new utils.Buf16((2*BL_CODES+1)*2);zero(this.dyn_ltree);zero(this.dyn_dtree);zero(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new utils.Buf16(MAX_BITS+1);this.heap=new utils.Buf16(2*L_CODES+1);zero(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new utils.Buf16(2*L_CODES+1);zero(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function deflateResetKeep(strm){var s;if(!strm||!strm.state){return err(strm,Z_STREAM_ERROR)}strm.total_in=strm.total_out=0;strm.data_type=Z_UNKNOWN;s=strm.state;s.pending=0;s.pending_out=0;if(s.wrap<0){s.wrap=-s.wrap}s.status=s.wrap?INIT_STATE:BUSY_STATE;strm.adler=s.wrap===2?0:1;s.last_flush=Z_NO_FLUSH;trees._tr_init(s);return Z_OK}function deflateReset(strm){var ret=deflateResetKeep(strm);if(ret===Z_OK){lm_init(strm.state)}return ret}function deflateSetHeader(strm,head){if(!strm||!strm.state){return Z_STREAM_ERROR}if(strm.state.wrap!==2){return Z_STREAM_ERROR}strm.state.gzhead=head;return Z_OK}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm){return Z_STREAM_ERROR}var wrap=1;if(level===Z_DEFAULT_COMPRESSION){level=6}if(windowBits<0){wrap=0;windowBits=-windowBits}else if(windowBits>15){wrap=2;windowBits-=16}if(memLevel<1||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||windowBits<8||windowBits>15||level<0||level>9||strategy<0||strategy>Z_FIXED){return err(strm,Z_STREAM_ERROR)}if(windowBits===8){windowBits=9}var s=new DeflateState;strm.state=s;s.strm=strm;s.wrap=wrap;s.gzhead=null;s.w_bits=windowBits;s.w_size=1<<s.w_bits;s.w_mask=s.w_size-1;s.hash_bits=memLevel+7;s.hash_size=1<<s.hash_bits;s.hash_mask=s.hash_size-1;s.hash_shift=~~((s.hash_bits+MIN_MATCH-1)/MIN_MATCH);s.window=new utils.Buf8(s.w_size*2);s.head=new utils.Buf16(s.hash_size);s.prev=new utils.Buf16(s.w_size);s.lit_bufsize=1<<memLevel+6;s.pending_buf_size=s.lit_bufsize*4;s.pending_buf=new utils.Buf8(s.pending_buf_size);s.d_buf=s.lit_bufsize>>1;s.l_buf=(1+2)*s.lit_bufsize;s.level=level;s.strategy=strategy;s.method=method;return deflateReset(strm)}function deflateInit(strm,level){return deflateInit2(strm,level,Z_DEFLATED,MAX_WBITS,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY)}function deflate(strm,flush){var old_flush,s;var beg,val;if(!strm||!strm.state||flush>Z_BLOCK||flush<0){return strm?err(strm,Z_STREAM_ERROR):Z_STREAM_ERROR}s=strm.state;if(!strm.output||!strm.input&&strm.avail_in!==0||s.status===FINISH_STATE&&flush!==Z_FINISH){return err(strm,strm.avail_out===0?Z_BUF_ERROR:Z_STREAM_ERROR)}s.strm=strm;old_flush=s.last_flush;s.last_flush=flush;if(s.status===INIT_STATE){if(s.wrap===2){strm.adler=0;put_byte(s,31);put_byte(s,139);put_byte(s,8);if(!s.gzhead){put_byte(s,0);put_byte(s,0);put_byte(s,0);put_byte(s,0);put_byte(s,0);put_byte(s,s.level===9?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0);put_byte(s,OS_CODE);s.status=BUSY_STATE}else{put_byte(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(!s.gzhead.extra?0:4)+(!s.gzhead.name?0:8)+(!s.gzhead.comment?0:16));put_byte(s,s.gzhead.time&255);put_byte(s,s.gzhead.time>>8&255);put_byte(s,s.gzhead.time>>16&255);put_byte(s,s.gzhead.time>>24&255);put_byte(s,s.level===9?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0);put_byte(s,s.gzhead.os&255);if(s.gzhead.extra&&s.gzhead.extra.length){put_byte(s,s.gzhead.extra.length&255);put_byte(s,s.gzhead.extra.length>>8&255)}if(s.gzhead.hcrc){strm.adler=crc32(strm.adler,s.pending_buf,s.pending,0)}s.gzindex=0;s.status=EXTRA_STATE}}else{var header=Z_DEFLATED+(s.w_bits-8<<4)<<8;var level_flags=-1;if(s.strategy>=Z_HUFFMAN_ONLY||s.level<2){level_flags=0}else if(s.level<6){level_flags=1}else if(s.level===6){level_flags=2}else{level_flags=3}header|=level_flags<<6;if(s.strstart!==0){header|=PRESET_DICT}header+=31-header%31;s.status=BUSY_STATE;putShortMSB(s,header);if(s.strstart!==0){putShortMSB(s,strm.adler>>>16);putShortMSB(s,strm.adler&65535)}strm.adler=1}}if(s.status===EXTRA_STATE){if(s.gzhead.extra){beg=s.pending;while(s.gzindex<(s.gzhead.extra.length&65535)){if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}flush_pending(strm);beg=s.pending;if(s.pending===s.pending_buf_size){break}}put_byte(s,s.gzhead.extra[s.gzindex]&255);s.gzindex++}if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}if(s.gzindex===s.gzhead.extra.length){s.gzindex=0;s.status=NAME_STATE}}else{s.status=NAME_STATE}}if(s.status===NAME_STATE){if(s.gzhead.name){beg=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}flush_pending(strm);beg=s.pending;if(s.pending===s.pending_buf_size){val=1;break}}if(s.gzindex<s.gzhead.name.length){val=s.gzhead.name.charCodeAt(s.gzindex++)&255}else{val=0}put_byte(s,val)}while(val!==0);if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}if(val===0){s.gzindex=0;s.status=COMMENT_STATE}}else{s.status=COMMENT_STATE}}if(s.status===COMMENT_STATE){if(s.gzhead.comment){beg=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}flush_pending(strm);beg=s.pending;if(s.pending===s.pending_buf_size){val=1;break}}if(s.gzindex<s.gzhead.comment.length){val=s.gzhead.comment.charCodeAt(s.gzindex++)&255}else{val=0}put_byte(s,val)}while(val!==0);if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}if(val===0){s.status=HCRC_STATE}}else{s.status=HCRC_STATE}}if(s.status===HCRC_STATE){if(s.gzhead.hcrc){if(s.pending+2>s.pending_buf_size){flush_pending(strm)}if(s.pending+2<=s.pending_buf_size){put_byte(s,strm.adler&255);put_byte(s,strm.adler>>8&255);strm.adler=0;s.status=BUSY_STATE}}else{s.status=BUSY_STATE}}if(s.pending!==0){flush_pending(strm);if(strm.avail_out===0){s.last_flush=-1;return Z_OK}}else if(strm.avail_in===0&&rank(flush)<=rank(old_flush)&&flush!==Z_FINISH){return err(strm,Z_BUF_ERROR)}if(s.status===FINISH_STATE&&strm.avail_in!==0){return err(strm,Z_BUF_ERROR)}if(strm.avail_in!==0||s.lookahead!==0||flush!==Z_NO_FLUSH&&s.status!==FINISH_STATE){var bstate=s.strategy===Z_HUFFMAN_ONLY?deflate_huff(s,flush):s.strategy===Z_RLE?deflate_rle(s,flush):configuration_table[s.level].func(s,flush);if(bstate===BS_FINISH_STARTED||bstate===BS_FINISH_DONE){s.status=FINISH_STATE}if(bstate===BS_NEED_MORE||bstate===BS_FINISH_STARTED){if(strm.avail_out===0){s.last_flush=-1}return Z_OK}if(bstate===BS_BLOCK_DONE){if(flush===Z_PARTIAL_FLUSH){trees._tr_align(s)}else if(flush!==Z_BLOCK){trees._tr_stored_block(s,0,0,false);if(flush===Z_FULL_FLUSH){zero(s.head);if(s.lookahead===0){s.strstart=0;s.block_start=0;s.insert=0}}}flush_pending(strm);if(strm.avail_out===0){s.last_flush=-1;return Z_OK}}}if(flush!==Z_FINISH){return Z_OK}if(s.wrap<=0){return Z_STREAM_END}if(s.wrap===2){put_byte(s,strm.adler&255);put_byte(s,strm.adler>>8&255);put_byte(s,strm.adler>>16&255);put_byte(s,strm.adler>>24&255);put_byte(s,strm.total_in&255);put_byte(s,strm.total_in>>8&255);put_byte(s,strm.total_in>>16&255);put_byte(s,strm.total_in>>24&255)}else{putShortMSB(s,strm.adler>>>16);putShortMSB(s,strm.adler&65535)}flush_pending(strm);if(s.wrap>0){s.wrap=-s.wrap}return s.pending!==0?Z_OK:Z_STREAM_END}function deflateEnd(strm){var status;if(!strm||!strm.state){return Z_STREAM_ERROR}status=strm.state.status;if(status!==INIT_STATE&&status!==EXTRA_STATE&&status!==NAME_STATE&&status!==COMMENT_STATE&&status!==HCRC_STATE&&status!==BUSY_STATE&&status!==FINISH_STATE){return err(strm,Z_STREAM_ERROR)}strm.state=null;return status===BUSY_STATE?err(strm,Z_DATA_ERROR):Z_OK}exports.deflateInit=deflateInit;exports.deflateInit2=deflateInit2;exports.deflateReset=deflateReset;exports.deflateResetKeep=deflateResetKeep;exports.deflateSetHeader=deflateSetHeader;exports.deflate=deflate;exports.deflateEnd=deflateEnd;exports.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(_dereq_,module,exports){"use strict";function GZheader(){this.text=0;this.time=0;this.xflags=0;this.os=0;this.extra=null;this.extra_len=0;this.name="";this.comment="";this.hcrc=0;this.done=false}module.exports=GZheader},{}],34:[function(_dereq_,module,exports){"use strict";var BAD=30;var TYPE=12;module.exports=function inflate_fast(strm,start){var state;var _in;var last;var _out;var beg;var end;var dmax;var wsize;var whave;var wnext;var window;var hold;var bits;var lcode;var dcode;var lmask;var dmask;var here;var op;var len;var dist;var from;var from_source;var input,output;state=strm.state;_in=strm.next_in;input=strm.input;last=_in+(strm.avail_in-5);_out=strm.next_out;output=strm.output;beg=_out-(start-strm.avail_out);end=_out+(strm.avail_out-257);dmax=state.dmax;wsize=state.wsize;whave=state.whave;wnext=state.wnext;window=state.window;hold=state.hold;bits=state.bits;lcode=state.lencode;dcode=state.distcode;lmask=(1<<state.lenbits)-1;dmask=(1<<state.distbits)-1;top:do{if(bits<15){hold+=input[_in++]<<bits;bits+=8;hold+=input[_in++]<<bits;bits+=8}here=lcode[hold&lmask];dolen:for(;;){op=here>>>24;hold>>>=op;bits-=op;op=here>>>16&255;if(op===0){output[_out++]=here&65535}else if(op&16){len=here&65535;op&=15;if(op){if(bits<op){hold+=input[_in++]<<bits;bits+=8}len+=hold&(1<<op)-1;hold>>>=op;bits-=op}if(bits<15){hold+=input[_in++]<<bits;bits+=8;hold+=input[_in++]<<bits;bits+=8}here=dcode[hold&dmask];dodist:for(;;){op=here>>>24;hold>>>=op;bits-=op;op=here>>>16&255;if(op&16){dist=here&65535;op&=15;if(bits<op){hold+=input[_in++]<<bits;bits+=8;if(bits<op){hold+=input[_in++]<<bits;bits+=8}}dist+=hold&(1<<op)-1;if(dist>dmax){strm.msg="invalid distance too far back";state.mode=BAD;break top}hold>>>=op;bits-=op;op=_out-beg;if(dist>op){op=dist-op;if(op>whave){if(state.sane){strm.msg="invalid distance too far back";state.mode=BAD;break top}}from=0;from_source=window;if(wnext===0){from+=wsize-op;if(op<len){len-=op;do{output[_out++]=window[from++]}while(--op);from=_out-dist;from_source=output}}else if(wnext<op){from+=wsize+wnext-op;op-=wnext;if(op<len){len-=op;do{output[_out++]=window[from++]}while(--op);from=0;if(wnext<len){op=wnext;len-=op;do{output[_out++]=window[from++]}while(--op);from=_out-dist;from_source=output}}}else{from+=wnext-op;if(op<len){len-=op;do{output[_out++]=window[from++]}while(--op);from=_out-dist;from_source=output}}while(len>2){output[_out++]=from_source[from++];output[_out++]=from_source[from++];output[_out++]=from_source[from++];len-=3}if(len){output[_out++]=from_source[from++];if(len>1){output[_out++]=from_source[from++]}}}else{from=_out-dist;do{output[_out++]=output[from++];output[_out++]=output[from++];output[_out++]=output[from++];len-=3}while(len>2);if(len){output[_out++]=output[from++];if(len>1){output[_out++]=output[from++]}}}}else if((op&64)===0){here=dcode[(here&65535)+(hold&(1<<op)-1)];continue dodist}else{strm.msg="invalid distance code";state.mode=BAD;break top}break}}else if((op&64)===0){here=lcode[(here&65535)+(hold&(1<<op)-1)];continue dolen}else if(op&32){state.mode=TYPE;break top}else{strm.msg="invalid literal/length code";state.mode=BAD;break top}break}}while(_in<last&&_out<end);len=bits>>3;_in-=len;bits-=len<<3;hold&=(1<<bits)-1;strm.next_in=_in;strm.next_out=_out;strm.avail_in=_in<last?5+(last-_in):5-(_in-last);strm.avail_out=_out<end?257+(end-_out):257-(_out-end);state.hold=hold;state.bits=bits;return}},{}],35:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("../utils/common");var adler32=_dereq_("./adler32");var crc32=_dereq_("./crc32");var inflate_fast=_dereq_("./inffast");var inflate_table=_dereq_("./inftrees");var CODES=0;var LENS=1;var DISTS=2;var Z_FINISH=4;var Z_BLOCK=5;var Z_TREES=6;var Z_OK=0;var Z_STREAM_END=1;var Z_NEED_DICT=2;var Z_STREAM_ERROR=-2;var Z_DATA_ERROR=-3;var Z_MEM_ERROR=-4;var Z_BUF_ERROR=-5;var Z_DEFLATED=8;var HEAD=1;var FLAGS=2;var TIME=3;var OS=4;var EXLEN=5;var EXTRA=6;var NAME=7;var COMMENT=8;var HCRC=9;var DICTID=10;var DICT=11;var TYPE=12;var TYPEDO=13;var STORED=14;var COPY_=15;var COPY=16;var TABLE=17;var LENLENS=18;var CODELENS=19;var LEN_=20;var LEN=21;var LENEXT=22;var DIST=23;var DISTEXT=24;var MATCH=25;var LIT=26;var CHECK=27;var LENGTH=28;var DONE=29;var BAD=30;var MEM=31;var SYNC=32;var ENOUGH_LENS=852;var ENOUGH_DISTS=592;var MAX_WBITS=15;var DEF_WBITS=MAX_WBITS;function ZSWAP32(q){return(q>>>24&255)+(q>>>8&65280)+((q&65280)<<8)+((q&255)<<24)}function InflateState(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new utils.Buf16(320);this.work=new utils.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function inflateResetKeep(strm){var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;strm.total_in=strm.total_out=state.total=0;strm.msg="";if(state.wrap){strm.adler=state.wrap&1}state.mode=HEAD;state.last=0;state.havedict=0;state.dmax=32768;state.head=null;state.hold=0;state.bits=0;state.lencode=state.lendyn=new utils.Buf32(ENOUGH_LENS);state.distcode=state.distdyn=new utils.Buf32(ENOUGH_DISTS);state.sane=1;state.back=-1;return Z_OK}function inflateReset(strm){var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;state.wsize=0;state.whave=0;state.wnext=0;return inflateResetKeep(strm)}function inflateReset2(strm,windowBits){var wrap;var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;if(windowBits<0){wrap=0;windowBits=-windowBits}else{wrap=(windowBits>>4)+1;if(windowBits<48){windowBits&=15}}if(windowBits&&(windowBits<8||windowBits>15)){return Z_STREAM_ERROR}if(state.window!==null&&state.wbits!==windowBits){state.window=null}state.wrap=wrap;state.wbits=windowBits;return inflateReset(strm)}function inflateInit2(strm,windowBits){var ret;var state;if(!strm){return Z_STREAM_ERROR}state=new InflateState;strm.state=state;state.window=null;ret=inflateReset2(strm,windowBits);if(ret!==Z_OK){strm.state=null}return ret}function inflateInit(strm){return inflateInit2(strm,DEF_WBITS)}var virgin=true;var lenfix,distfix;function fixedtables(state){if(virgin){var sym;lenfix=new utils.Buf32(512);distfix=new utils.Buf32(32);sym=0;while(sym<144){state.lens[sym++]=8}while(sym<256){state.lens[sym++]=9}while(sym<280){state.lens[sym++]=7}while(sym<288){state.lens[sym++]=8}inflate_table(LENS,state.lens,0,288,lenfix,0,state.work,{bits:9});sym=0;while(sym<32){state.lens[sym++]=5}inflate_table(DISTS,state.lens,0,32,distfix,0,state.work,{bits:5});virgin=false}state.lencode=lenfix;state.lenbits=9;state.distcode=distfix;state.distbits=5}function updatewindow(strm,src,end,copy){var dist;var state=strm.state;if(state.window===null){state.wsize=1<<state.wbits;state.wnext=0;state.whave=0;state.window=new utils.Buf8(state.wsize)}if(copy>=state.wsize){utils.arraySet(state.window,src,end-state.wsize,state.wsize,0);state.wnext=0;state.whave=state.wsize}else{dist=state.wsize-state.wnext;if(dist>copy){dist=copy}utils.arraySet(state.window,src,end-copy,dist,state.wnext);copy-=dist;if(copy){utils.arraySet(state.window,src,end-copy,copy,0);state.wnext=copy;state.whave=state.wsize}else{state.wnext+=dist;if(state.wnext===state.wsize){state.wnext=0}if(state.whave<state.wsize){state.whave+=dist}}}return 0}function inflate(strm,flush){var state;var input,output;var next;var put;var have,left;var hold;var bits;var _in,_out;var copy;var from;var from_source;var here=0;var here_bits,here_op,here_val;var last_bits,last_op,last_val;var len;var ret;var hbuf=new utils.Buf8(4);var opts;var n;var order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!strm||!strm.state||!strm.output||!strm.input&&strm.avail_in!==0){return Z_STREAM_ERROR}state=strm.state;if(state.mode===TYPE){state.mode=TYPEDO}put=strm.next_out;output=strm.output;left=strm.avail_out;next=strm.next_in;input=strm.input;have=strm.avail_in;hold=state.hold;bits=state.bits;_in=have;_out=left;ret=Z_OK;inf_leave:for(;;){switch(state.mode){case HEAD:if(state.wrap===0){state.mode=TYPEDO;break}while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(state.wrap&2&&hold===35615){state.check=0;hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;state.check=crc32(state.check,hbuf,2,0);hold=0;bits=0;state.mode=FLAGS;break}state.flags=0;if(state.head){state.head.done=false}if(!(state.wrap&1)||(((hold&255)<<8)+(hold>>8))%31){strm.msg="incorrect header check";state.mode=BAD;break}if((hold&15)!==Z_DEFLATED){strm.msg="unknown compression method";state.mode=BAD;break}hold>>>=4;bits-=4;len=(hold&15)+8;if(state.wbits===0){state.wbits=len}else if(len>state.wbits){strm.msg="invalid window size";state.mode=BAD;break}state.dmax=1<<len;strm.adler=state.check=1;state.mode=hold&512?DICTID:TYPE;hold=0;bits=0;break;case FLAGS:while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.flags=hold;if((state.flags&255)!==Z_DEFLATED){strm.msg="unknown compression method";state.mode=BAD;break}if(state.flags&57344){strm.msg="unknown header flags set";state.mode=BAD;break}if(state.head){state.head.text=hold>>8&1}if(state.flags&512){hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;state.check=crc32(state.check,hbuf,2,0)}hold=0;bits=0;state.mode=TIME;case TIME:while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(state.head){state.head.time=hold}if(state.flags&512){hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;hbuf[2]=hold>>>16&255;hbuf[3]=hold>>>24&255;state.check=crc32(state.check,hbuf,4,0)}hold=0;bits=0;state.mode=OS;case OS:while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(state.head){state.head.xflags=hold&255;state.head.os=hold>>8}if(state.flags&512){hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;state.check=crc32(state.check,hbuf,2,0)}hold=0;bits=0;state.mode=EXLEN;case EXLEN:if(state.flags&1024){while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.length=hold;if(state.head){state.head.extra_len=hold}if(state.flags&512){hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;state.check=crc32(state.check,hbuf,2,0)}hold=0;bits=0}else if(state.head){state.head.extra=null}state.mode=EXTRA;case EXTRA:if(state.flags&1024){copy=state.length;if(copy>have){copy=have}if(copy){if(state.head){len=state.head.extra_len-state.length;if(!state.head.extra){state.head.extra=new Array(state.head.extra_len)}utils.arraySet(state.head.extra,input,next,copy,len)}if(state.flags&512){state.check=crc32(state.check,input,copy,next)}have-=copy;next+=copy;state.length-=copy}if(state.length){break inf_leave}}state.length=0;state.mode=NAME;case NAME:if(state.flags&2048){if(have===0){break inf_leave}copy=0;do{len=input[next+copy++];if(state.head&&len&&state.length<65536){state.head.name+=String.fromCharCode(len)}}while(len&©<have);if(state.flags&512){state.check=crc32(state.check,input,copy,next)}have-=copy;next+=copy;if(len){break inf_leave}}else if(state.head){state.head.name=null}state.length=0;state.mode=COMMENT;case COMMENT:if(state.flags&4096){if(have===0){break inf_leave}copy=0;do{len=input[next+copy++];if(state.head&&len&&state.length<65536){state.head.comment+=String.fromCharCode(len)}}while(len&©<have);if(state.flags&512){state.check=crc32(state.check,input,copy,next)}have-=copy;next+=copy;if(len){break inf_leave}}else if(state.head){state.head.comment=null}state.mode=HCRC;case HCRC:if(state.flags&512){while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(hold!==(state.check&65535)){strm.msg="header crc mismatch";state.mode=BAD;break}hold=0;bits=0}if(state.head){state.head.hcrc=state.flags>>9&1;state.head.done=true}strm.adler=state.check=0;state.mode=TYPE;break;case DICTID:while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}strm.adler=state.check=ZSWAP32(hold);hold=0;bits=0;state.mode=DICT;case DICT:if(state.havedict===0){strm.next_out=put;strm.avail_out=left;strm.next_in=next;strm.avail_in=have;state.hold=hold;state.bits=bits;return Z_NEED_DICT}strm.adler=state.check=1;state.mode=TYPE;case TYPE:if(flush===Z_BLOCK||flush===Z_TREES){break inf_leave}case TYPEDO:if(state.last){hold>>>=bits&7;bits-=bits&7;state.mode=CHECK;break}while(bits<3){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.last=hold&1;hold>>>=1;bits-=1;switch(hold&3){case 0:state.mode=STORED;break;case 1:fixedtables(state);state.mode=LEN_;if(flush===Z_TREES){hold>>>=2;bits-=2;break inf_leave}break;case 2:state.mode=TABLE;break;case 3:strm.msg="invalid block type";state.mode=BAD}hold>>>=2;bits-=2;break;case STORED:hold>>>=bits&7;bits-=bits&7;while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if((hold&65535)!==(hold>>>16^65535)){strm.msg="invalid stored block lengths";state.mode=BAD;break}state.length=hold&65535;hold=0;bits=0;state.mode=COPY_;if(flush===Z_TREES){break inf_leave}case COPY_:state.mode=COPY;case COPY:copy=state.length;if(copy){if(copy>have){copy=have}if(copy>left){copy=left}if(copy===0){break inf_leave}utils.arraySet(output,input,next,copy,put);have-=copy;next+=copy;left-=copy;put+=copy;state.length-=copy;break}state.mode=TYPE;break;case TABLE:while(bits<14){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.nlen=(hold&31)+257;hold>>>=5;bits-=5;state.ndist=(hold&31)+1;hold>>>=5;bits-=5;state.ncode=(hold&15)+4;hold>>>=4;bits-=4;if(state.nlen>286||state.ndist>30){strm.msg="too many length or distance symbols";state.mode=BAD;break}state.have=0;state.mode=LENLENS;case LENLENS:while(state.have<state.ncode){while(bits<3){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.lens[order[state.have++]]=hold&7;hold>>>=3;bits-=3}while(state.have<19){state.lens[order[state.have++]]=0}state.lencode=state.lendyn;state.lenbits=7;opts={bits:state.lenbits};ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts);state.lenbits=opts.bits;if(ret){strm.msg="invalid code lengths set";state.mode=BAD;break}state.have=0;state.mode=CODELENS;case CODELENS:while(state.have<state.nlen+state.ndist){for(;;){here=state.lencode[hold&(1<<state.lenbits)-1];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(here_val<16){hold>>>=here_bits;bits-=here_bits;state.lens[state.have++]=here_val}else{if(here_val===16){n=here_bits+2;while(bits<n){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}hold>>>=here_bits;bits-=here_bits;if(state.have===0){strm.msg="invalid bit length repeat";state.mode=BAD;break}len=state.lens[state.have-1];copy=3+(hold&3);hold>>>=2;bits-=2}else if(here_val===17){n=here_bits+3;while(bits<n){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}hold>>>=here_bits;bits-=here_bits;len=0;copy=3+(hold&7);hold>>>=3;bits-=3}else{n=here_bits+7;while(bits<n){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}hold>>>=here_bits;bits-=here_bits;len=0;copy=11+(hold&127);hold>>>=7;bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat";state.mode=BAD;break}while(copy--){state.lens[state.have++]=len}}}if(state.mode===BAD){break}if(state.lens[256]===0){strm.msg="invalid code -- missing end-of-block";state.mode=BAD;break}state.lenbits=9;opts={bits:state.lenbits};ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts);state.lenbits=opts.bits;if(ret){strm.msg="invalid literal/lengths set";state.mode=BAD;break}state.distbits=6;state.distcode=state.distdyn;opts={bits:state.distbits};ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts);state.distbits=opts.bits;if(ret){strm.msg="invalid distances set";state.mode=BAD;break}state.mode=LEN_;if(flush===Z_TREES){break inf_leave}case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){strm.next_out=put;strm.avail_out=left;strm.next_in=next;strm.avail_in=have;state.hold=hold;state.bits=bits;inflate_fast(strm,_out);put=strm.next_out;output=strm.output;left=strm.avail_out;next=strm.next_in;input=strm.input;have=strm.avail_in;hold=state.hold;bits=state.bits;if(state.mode===TYPE){state.back=-1}break}state.back=0;for(;;){here=state.lencode[hold&(1<<state.lenbits)-1];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(here_op&&(here_op&240)===0){last_bits=here_bits;last_op=here_op;last_val=here_val;for(;;){here=state.lencode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(last_bits+here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}hold>>>=last_bits;bits-=last_bits;state.back+=last_bits}hold>>>=here_bits;bits-=here_bits;state.back+=here_bits;state.length=here_val;if(here_op===0){state.mode=LIT;break}if(here_op&32){state.back=-1;state.mode=TYPE;break}if(here_op&64){strm.msg="invalid literal/length code";state.mode=BAD;break}state.extra=here_op&15;state.mode=LENEXT;case LENEXT:if(state.extra){n=state.extra;while(bits<n){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.length+=hold&(1<<state.extra)-1;hold>>>=state.extra;bits-=state.extra;state.back+=state.extra}state.was=state.length;state.mode=DIST;case DIST:for(;;){here=state.distcode[hold&(1<<state.distbits)-1];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if((here_op&240)===0){last_bits=here_bits;last_op=here_op;last_val=here_val;for(;;){here=state.distcode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(last_bits+here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}hold>>>=last_bits;bits-=last_bits;state.back+=last_bits}hold>>>=here_bits;bits-=here_bits;state.back+=here_bits;if(here_op&64){strm.msg="invalid distance code";state.mode=BAD;break}state.offset=here_val;state.extra=here_op&15;state.mode=DISTEXT;case DISTEXT:if(state.extra){n=state.extra;while(bits<n){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}state.offset+=hold&(1<<state.extra)-1;hold>>>=state.extra;bits-=state.extra;state.back+=state.extra}if(state.offset>state.dmax){strm.msg="invalid distance too far back";state.mode=BAD;break}state.mode=MATCH;case MATCH:if(left===0){break inf_leave}copy=_out-left;if(state.offset>copy){copy=state.offset-copy;if(copy>state.whave){if(state.sane){strm.msg="invalid distance too far back";state.mode=BAD;break}}if(copy>state.wnext){copy-=state.wnext;from=state.wsize-copy}else{from=state.wnext-copy}if(copy>state.length){copy=state.length}from_source=state.window}else{from_source=output;from=put-state.offset;copy=state.length}if(copy>left){copy=left}left-=copy;state.length-=copy;do{output[put++]=from_source[from++]}while(--copy);if(state.length===0){state.mode=LEN}break;case LIT:if(left===0){break inf_leave}output[put++]=state.length;left--;state.mode=LEN;break;case CHECK:if(state.wrap){while(bits<32){if(have===0){break inf_leave}have--;hold|=input[next++]<<bits;bits+=8}_out-=left;strm.total_out+=_out;state.total+=_out;if(_out){strm.adler=state.check=state.flags?crc32(state.check,output,_out,put-_out):adler32(state.check,output,_out,put-_out)}_out=left;if((state.flags?hold:ZSWAP32(hold))!==state.check){strm.msg="incorrect data check";state.mode=BAD;break}hold=0;bits=0}state.mode=LENGTH;case LENGTH:if(state.wrap&&state.flags){while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<<bits;bits+=8}if(hold!==(state.total&4294967295)){strm.msg="incorrect length check";state.mode=BAD;break}hold=0;bits=0}state.mode=DONE;case DONE:ret=Z_STREAM_END;break inf_leave;case BAD:ret=Z_DATA_ERROR;break inf_leave;case MEM:return Z_MEM_ERROR;case SYNC:default:return Z_STREAM_ERROR}}strm.next_out=put;strm.avail_out=left;strm.next_in=next;strm.avail_in=have;state.hold=hold;state.bits=bits;if(state.wsize||_out!==strm.avail_out&&state.mode<BAD&&(state.mode<CHECK||flush!==Z_FINISH)){if(updatewindow(strm,strm.output,strm.next_out,_out-strm.avail_out)){state.mode=MEM;return Z_MEM_ERROR}}_in-=strm.avail_in;_out-=strm.avail_out;strm.total_in+=_in;strm.total_out+=_out;state.total+=_out;if(state.wrap&&_out){strm.adler=state.check=state.flags?crc32(state.check,output,_out,strm.next_out-_out):adler32(state.check,output,_out,strm.next_out-_out)}strm.data_type=state.bits+(state.last?64:0)+(state.mode===TYPE?128:0)+(state.mode===LEN_||state.mode===COPY_?256:0);if((_in===0&&_out===0||flush===Z_FINISH)&&ret===Z_OK){ret=Z_BUF_ERROR}return ret}function inflateEnd(strm){if(!strm||!strm.state){return Z_STREAM_ERROR}var state=strm.state;if(state.window){state.window=null}strm.state=null;return Z_OK}function inflateGetHeader(strm,head){var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;if((state.wrap&2)===0){return Z_STREAM_ERROR}state.head=head;head.done=false;return Z_OK}exports.inflateReset=inflateReset;exports.inflateReset2=inflateReset2;exports.inflateResetKeep=inflateResetKeep;exports.inflateInit=inflateInit;exports.inflateInit2=inflateInit2;exports.inflate=inflate;exports.inflateEnd=inflateEnd;exports.inflateGetHeader=inflateGetHeader;+ exports.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("../utils/common");var MAXBITS=15;var ENOUGH_LENS=852;var ENOUGH_DISTS=592;var CODES=0;var LENS=1;var DISTS=2;var lbase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var lext=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var dbase=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var dext=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];module.exports=function inflate_table(type,lens,lens_index,codes,table,table_index,work,opts){var bits=opts.bits;var len=0;var sym=0;var min=0,max=0;var root=0;var curr=0;var drop=0;var left=0;var used=0;var huff=0;var incr;var fill;var low;var mask;var next;var base=null;var base_index=0;var end;var count=new utils.Buf16(MAXBITS+1);var offs=new utils.Buf16(MAXBITS+1);var extra=null;var extra_index=0;var here_bits,here_op,here_val;for(len=0;len<=MAXBITS;len++){count[len]=0}for(sym=0;sym<codes;sym++){count[lens[lens_index+sym]]++}root=bits;for(max=MAXBITS;max>=1;max--){if(count[max]!==0){break}}if(root>max){root=max}if(max===0){table[table_index++]=1<<24|64<<16|0;table[table_index++]=1<<24|64<<16|0;opts.bits=1;return 0}for(min=1;min<max;min++){if(count[min]!==0){break}}if(root<min){root=min}left=1;for(len=1;len<=MAXBITS;len++){left<<=1;left-=count[len];if(left<0){return-1}}if(left>0&&(type===CODES||max!==1)){return-1}offs[1]=0;for(len=1;len<MAXBITS;len++){offs[len+1]=offs[len]+count[len]}for(sym=0;sym<codes;sym++){if(lens[lens_index+sym]!==0){work[offs[lens[lens_index+sym]]++]=sym}}if(type===CODES){base=extra=work;end=19}else if(type===LENS){base=lbase;base_index-=257;extra=lext;extra_index-=257;end=256}else{base=dbase;extra=dext;end=-1}huff=0;sym=0;len=min;next=table_index;curr=root;drop=0;low=-1;used=1<<root;mask=used-1;if(type===LENS&&used>ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS){return 1}var i=0;for(;;){i++;here_bits=len-drop;if(work[sym]<end){here_op=0;here_val=work[sym]}else if(work[sym]>end){here_op=extra[extra_index+work[sym]];here_val=base[base_index+work[sym]]}else{here_op=32+64;here_val=0}incr=1<<len-drop;fill=1<<curr;min=fill;do{fill-=incr;table[next+(huff>>drop)+fill]=here_bits<<24|here_op<<16|here_val|0}while(fill!==0);incr=1<<len-1;while(huff&incr){incr>>=1}if(incr!==0){huff&=incr-1;huff+=incr}else{huff=0}sym++;if(--count[len]===0){if(len===max){break}len=lens[lens_index+work[sym]]}if(len>root&&(huff&mask)!==low){if(drop===0){drop=root}next+=min;curr=len-drop;left=1<<curr;while(curr+drop<max){left-=count[curr+drop];if(left<=0){break}curr++;left<<=1}used+=1<<curr;if(type===LENS&&used>ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS){return 1}low=huff&mask;table[low]=root<<24|curr<<16|next-table_index|0}}if(huff!==0){table[next+huff]=len-drop<<24|64<<16|0}opts.bits=root;return 0}},{"../utils/common":27}],37:[function(_dereq_,module,exports){"use strict";module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],38:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("../utils/common");var Z_FIXED=4;var Z_BINARY=0;var Z_TEXT=1;var Z_UNKNOWN=2;function zero(buf){var len=buf.length;while(--len>=0){buf[len]=0}}var STORED_BLOCK=0;var STATIC_TREES=1;var DYN_TREES=2;var MIN_MATCH=3;var MAX_MATCH=258;var LENGTH_CODES=29;var LITERALS=256;var L_CODES=LITERALS+1+LENGTH_CODES;var D_CODES=30;var BL_CODES=19;var HEAP_SIZE=2*L_CODES+1;var MAX_BITS=15;var Buf_size=16;var MAX_BL_BITS=7;var END_BLOCK=256;var REP_3_6=16;var REPZ_3_10=17;var REPZ_11_138=18;var extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var DIST_CODE_LEN=512;var static_ltree=new Array((L_CODES+2)*2);zero(static_ltree);var static_dtree=new Array(D_CODES*2);zero(static_dtree);var _dist_code=new Array(DIST_CODE_LEN);zero(_dist_code);var _length_code=new Array(MAX_MATCH-MIN_MATCH+1);zero(_length_code);var base_length=new Array(LENGTH_CODES);zero(base_length);var base_dist=new Array(D_CODES);zero(base_dist);var StaticTreeDesc=function(static_tree,extra_bits,extra_base,elems,max_length){this.static_tree=static_tree;this.extra_bits=extra_bits;this.extra_base=extra_base;this.elems=elems;this.max_length=max_length;this.has_stree=static_tree&&static_tree.length};var static_l_desc;var static_d_desc;var static_bl_desc;var TreeDesc=function(dyn_tree,stat_desc){this.dyn_tree=dyn_tree;this.max_code=0;this.stat_desc=stat_desc};function d_code(dist){return dist<256?_dist_code[dist]:_dist_code[256+(dist>>>7)]}function put_short(s,w){s.pending_buf[s.pending++]=w&255;s.pending_buf[s.pending++]=w>>>8&255}function send_bits(s,value,length){if(s.bi_valid>Buf_size-length){s.bi_buf|=value<<s.bi_valid&65535;put_short(s,s.bi_buf);s.bi_buf=value>>Buf_size-s.bi_valid;s.bi_valid+=length-Buf_size}else{s.bi_buf|=value<<s.bi_valid&65535;s.bi_valid+=length}}function send_code(s,c,tree){send_bits(s,tree[c*2],tree[c*2+1])}function bi_reverse(code,len){var res=0;do{res|=code&1;code>>>=1;res<<=1}while(--len>0);return res>>>1}function bi_flush(s){if(s.bi_valid===16){put_short(s,s.bi_buf);s.bi_buf=0;s.bi_valid=0}else if(s.bi_valid>=8){s.pending_buf[s.pending++]=s.bi_buf&255;s.bi_buf>>=8;s.bi_valid-=8}}function gen_bitlen(s,desc){var tree=desc.dyn_tree;var max_code=desc.max_code;var stree=desc.stat_desc.static_tree;var has_stree=desc.stat_desc.has_stree;var extra=desc.stat_desc.extra_bits;var base=desc.stat_desc.extra_base;var max_length=desc.stat_desc.max_length;var h;var n,m;var bits;var xbits;var f;var overflow=0;for(bits=0;bits<=MAX_BITS;bits++){s.bl_count[bits]=0}tree[s.heap[s.heap_max]*2+1]=0;for(h=s.heap_max+1;h<HEAP_SIZE;h++){n=s.heap[h];bits=tree[tree[n*2+1]*2+1]+1;if(bits>max_length){bits=max_length;overflow++}tree[n*2+1]=bits;if(n>max_code){continue}s.bl_count[bits]++;xbits=0;if(n>=base){xbits=extra[n-base]}f=tree[n*2];s.opt_len+=f*(bits+xbits);if(has_stree){s.static_len+=f*(stree[n*2+1]+xbits)}}if(overflow===0){return}do{bits=max_length-1;while(s.bl_count[bits]===0){bits--}s.bl_count[bits]--;s.bl_count[bits+1]+=2;s.bl_count[max_length]--;overflow-=2}while(overflow>0);for(bits=max_length;bits!==0;bits--){n=s.bl_count[bits];while(n!==0){m=s.heap[--h];if(m>max_code){continue}if(tree[m*2+1]!==bits){s.opt_len+=(bits-tree[m*2+1])*tree[m*2];tree[m*2+1]=bits}n--}}}function gen_codes(tree,max_code,bl_count){var next_code=new Array(MAX_BITS+1);var code=0;var bits;var n;for(bits=1;bits<=MAX_BITS;bits++){next_code[bits]=code=code+bl_count[bits-1]<<1}for(n=0;n<=max_code;n++){var len=tree[n*2+1];if(len===0){continue}tree[n*2]=bi_reverse(next_code[len]++,len)}}function tr_static_init(){var n;var bits;var length;var code;var dist;var bl_count=new Array(MAX_BITS+1);length=0;for(code=0;code<LENGTH_CODES-1;code++){base_length[code]=length;for(n=0;n<1<<extra_lbits[code];n++){_length_code[length++]=code}}_length_code[length-1]=code;dist=0;for(code=0;code<16;code++){base_dist[code]=dist;for(n=0;n<1<<extra_dbits[code];n++){_dist_code[dist++]=code}}dist>>=7;for(;code<D_CODES;code++){base_dist[code]=dist<<7;for(n=0;n<1<<extra_dbits[code]-7;n++){_dist_code[256+dist++]=code}}for(bits=0;bits<=MAX_BITS;bits++){bl_count[bits]=0}n=0;while(n<=143){static_ltree[n*2+1]=8;n++;bl_count[8]++}while(n<=255){static_ltree[n*2+1]=9;n++;bl_count[9]++}while(n<=279){static_ltree[n*2+1]=7;n++;bl_count[7]++}while(n<=287){static_ltree[n*2+1]=8;n++;bl_count[8]++}gen_codes(static_ltree,L_CODES+1,bl_count);for(n=0;n<D_CODES;n++){static_dtree[n*2+1]=5;static_dtree[n*2]=bi_reverse(n,5)}static_l_desc=new StaticTreeDesc(static_ltree,extra_lbits,LITERALS+1,L_CODES,MAX_BITS);static_d_desc=new StaticTreeDesc(static_dtree,extra_dbits,0,D_CODES,MAX_BITS);static_bl_desc=new StaticTreeDesc(new Array(0),extra_blbits,0,BL_CODES,MAX_BL_BITS)}function init_block(s){var n;for(n=0;n<L_CODES;n++){s.dyn_ltree[n*2]=0}for(n=0;n<D_CODES;n++){s.dyn_dtree[n*2]=0}for(n=0;n<BL_CODES;n++){s.bl_tree[n*2]=0}s.dyn_ltree[END_BLOCK*2]=1;s.opt_len=s.static_len=0;s.last_lit=s.matches=0}function bi_windup(s){if(s.bi_valid>8){put_short(s,s.bi_buf)}else if(s.bi_valid>0){s.pending_buf[s.pending++]=s.bi_buf}s.bi_buf=0;s.bi_valid=0}function copy_block(s,buf,len,header){bi_windup(s);if(header){put_short(s,len);put_short(s,~len)}utils.arraySet(s.pending_buf,s.window,buf,len,s.pending);s.pending+=len}function smaller(tree,n,m,depth){var _n2=n*2;var _m2=m*2;return tree[_n2]<tree[_m2]||tree[_n2]===tree[_m2]&&depth[n]<=depth[m]}function pqdownheap(s,tree,k){var v=s.heap[k];var j=k<<1;while(j<=s.heap_len){if(j<s.heap_len&&smaller(tree,s.heap[j+1],s.heap[j],s.depth)){j++}if(smaller(tree,v,s.heap[j],s.depth)){break}s.heap[k]=s.heap[j];k=j;j<<=1}s.heap[k]=v}function compress_block(s,ltree,dtree){var dist;var lc;var lx=0;var code;var extra;if(s.last_lit!==0){do{dist=s.pending_buf[s.d_buf+lx*2]<<8|s.pending_buf[s.d_buf+lx*2+1];lc=s.pending_buf[s.l_buf+lx];lx++;if(dist===0){send_code(s,lc,ltree)}else{code=_length_code[lc];send_code(s,code+LITERALS+1,ltree);extra=extra_lbits[code];if(extra!==0){lc-=base_length[code];send_bits(s,lc,extra)}dist--;code=d_code(dist);send_code(s,code,dtree);extra=extra_dbits[code];if(extra!==0){dist-=base_dist[code];send_bits(s,dist,extra)}}}while(lx<s.last_lit)}send_code(s,END_BLOCK,ltree)}function build_tree(s,desc){var tree=desc.dyn_tree;var stree=desc.stat_desc.static_tree;var has_stree=desc.stat_desc.has_stree;var elems=desc.stat_desc.elems;var n,m;var max_code=-1;var node;s.heap_len=0;s.heap_max=HEAP_SIZE;for(n=0;n<elems;n++){if(tree[n*2]!==0){s.heap[++s.heap_len]=max_code=n;s.depth[n]=0}else{tree[n*2+1]=0}}while(s.heap_len<2){node=s.heap[++s.heap_len]=max_code<2?++max_code:0;tree[node*2]=1;s.depth[node]=0;s.opt_len--;if(has_stree){s.static_len-=stree[node*2+1]}}desc.max_code=max_code;for(n=s.heap_len>>1;n>=1;n--){pqdownheap(s,tree,n)}node=elems;do{n=s.heap[1];s.heap[1]=s.heap[s.heap_len--];pqdownheap(s,tree,1);m=s.heap[1];s.heap[--s.heap_max]=n;s.heap[--s.heap_max]=m;tree[node*2]=tree[n*2]+tree[m*2];s.depth[node]=(s.depth[n]>=s.depth[m]?s.depth[n]:s.depth[m])+1;tree[n*2+1]=tree[m*2+1]=node;s.heap[1]=node++;pqdownheap(s,tree,1)}while(s.heap_len>=2);s.heap[--s.heap_max]=s.heap[1];gen_bitlen(s,desc);gen_codes(tree,max_code,s.bl_count)}function scan_tree(s,tree,max_code){var n;var prevlen=-1;var curlen;var nextlen=tree[0*2+1];var count=0;var max_count=7;var min_count=4;if(nextlen===0){max_count=138;min_count=3}tree[(max_code+1)*2+1]=65535;for(n=0;n<=max_code;n++){curlen=nextlen;nextlen=tree[(n+1)*2+1];if(++count<max_count&&curlen===nextlen){continue}else if(count<min_count){s.bl_tree[curlen*2]+=count}else if(curlen!==0){if(curlen!==prevlen){s.bl_tree[curlen*2]++}s.bl_tree[REP_3_6*2]++}else if(count<=10){s.bl_tree[REPZ_3_10*2]++}else{s.bl_tree[REPZ_11_138*2]++}count=0;prevlen=curlen;if(nextlen===0){max_count=138;min_count=3}else if(curlen===nextlen){max_count=6;min_count=3}else{max_count=7;min_count=4}}}function send_tree(s,tree,max_code){var n;var prevlen=-1;var curlen;var nextlen=tree[0*2+1];var count=0;var max_count=7;var min_count=4;if(nextlen===0){max_count=138;min_count=3}for(n=0;n<=max_code;n++){curlen=nextlen;nextlen=tree[(n+1)*2+1];if(++count<max_count&&curlen===nextlen){continue}else if(count<min_count){do{send_code(s,curlen,s.bl_tree)}while(--count!==0)}else if(curlen!==0){if(curlen!==prevlen){send_code(s,curlen,s.bl_tree);count--}send_code(s,REP_3_6,s.bl_tree);send_bits(s,count-3,2)}else if(count<=10){send_code(s,REPZ_3_10,s.bl_tree);send_bits(s,count-3,3)}else{send_code(s,REPZ_11_138,s.bl_tree);send_bits(s,count-11,7)}count=0;prevlen=curlen;if(nextlen===0){max_count=138;min_count=3}else if(curlen===nextlen){max_count=6;min_count=3}else{max_count=7;min_count=4}}}function build_bl_tree(s){var max_blindex;scan_tree(s,s.dyn_ltree,s.l_desc.max_code);scan_tree(s,s.dyn_dtree,s.d_desc.max_code);build_tree(s,s.bl_desc);for(max_blindex=BL_CODES-1;max_blindex>=3;max_blindex--){if(s.bl_tree[bl_order[max_blindex]*2+1]!==0){break}}s.opt_len+=3*(max_blindex+1)+5+5+4;return max_blindex}function send_all_trees(s,lcodes,dcodes,blcodes){var rank;send_bits(s,lcodes-257,5);send_bits(s,dcodes-1,5);send_bits(s,blcodes-4,4);for(rank=0;rank<blcodes;rank++){send_bits(s,s.bl_tree[bl_order[rank]*2+1],3)}send_tree(s,s.dyn_ltree,lcodes-1);send_tree(s,s.dyn_dtree,dcodes-1)}function detect_data_type(s){var black_mask=4093624447;var n;for(n=0;n<=31;n++,black_mask>>>=1){if(black_mask&1&&s.dyn_ltree[n*2]!==0){return Z_BINARY}}if(s.dyn_ltree[9*2]!==0||s.dyn_ltree[10*2]!==0||s.dyn_ltree[13*2]!==0){return Z_TEXT}for(n=32;n<LITERALS;n++){if(s.dyn_ltree[n*2]!==0){return Z_TEXT}}return Z_BINARY}var static_init_done=false;function _tr_init(s){if(!static_init_done){tr_static_init();static_init_done=true}s.l_desc=new TreeDesc(s.dyn_ltree,static_l_desc);s.d_desc=new TreeDesc(s.dyn_dtree,static_d_desc);s.bl_desc=new TreeDesc(s.bl_tree,static_bl_desc);s.bi_buf=0;s.bi_valid=0;init_block(s)}function _tr_stored_block(s,buf,stored_len,last){send_bits(s,(STORED_BLOCK<<1)+(last?1:0),3);copy_block(s,buf,stored_len,true)}function _tr_align(s){send_bits(s,STATIC_TREES<<1,3);send_code(s,END_BLOCK,static_ltree);bi_flush(s)}function _tr_flush_block(s,buf,stored_len,last){var opt_lenb,static_lenb;var max_blindex=0;if(s.level>0){if(s.strm.data_type===Z_UNKNOWN){s.strm.data_type=detect_data_type(s)}build_tree(s,s.l_desc);build_tree(s,s.d_desc);max_blindex=build_bl_tree(s);opt_lenb=s.opt_len+3+7>>>3;static_lenb=s.static_len+3+7>>>3;if(static_lenb<=opt_lenb){opt_lenb=static_lenb}}else{opt_lenb=static_lenb=stored_len+5}if(stored_len+4<=opt_lenb&&buf!==-1){_tr_stored_block(s,buf,stored_len,last)}else if(s.strategy===Z_FIXED||static_lenb===opt_lenb){send_bits(s,(STATIC_TREES<<1)+(last?1:0),3);compress_block(s,static_ltree,static_dtree)}else{send_bits(s,(DYN_TREES<<1)+(last?1:0),3);send_all_trees(s,s.l_desc.max_code+1,s.d_desc.max_code+1,max_blindex+1);compress_block(s,s.dyn_ltree,s.dyn_dtree)}init_block(s);if(last){bi_windup(s)}}function _tr_tally(s,dist,lc){s.pending_buf[s.d_buf+s.last_lit*2]=dist>>>8&255;s.pending_buf[s.d_buf+s.last_lit*2+1]=dist&255;s.pending_buf[s.l_buf+s.last_lit]=lc&255;s.last_lit++;if(dist===0){s.dyn_ltree[lc*2]++}else{s.matches++;dist--;s.dyn_ltree[(_length_code[lc]+LITERALS+1)*2]++;s.dyn_dtree[d_code(dist)*2]++}return s.last_lit===s.lit_bufsize-1}exports._tr_init=_tr_init;exports._tr_stored_block=_tr_stored_block;exports._tr_flush_block=_tr_flush_block;exports._tr_tally=_tr_tally;exports._tr_align=_tr_align},{"../utils/common":27}],39:[function(_dereq_,module,exports){"use strict";function ZStream(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}module.exports=ZStream},{}]},{},[9])(9)});var XLSX={};(function make_xlsx(XLSX){XLSX.version="0.8.13";var current_codepage=1200,current_cptable;if(typeof module!=="undefined"&&typeof require!=="undefined"){if(typeof cptable==="undefined")cptable=require("./dist/cpexcel");current_cptable=cptable[current_codepage]}function reset_cp(){set_cp(1200)}var set_cp=function(cp){current_codepage=cp};function char_codes(data){var o=[];for(var i=0,len=data.length;i<len;++i)o[i]=data.charCodeAt(i);return o}var debom_xml=function(data){return data};var _getchar=function _gc1(x){return String.fromCharCode(x)};if(typeof cptable!=="undefined"){set_cp=function(cp){current_codepage=cp;current_cptable=cptable[cp]};debom_xml=function(data){if(data.charCodeAt(0)===255&&data.charCodeAt(1)===254){return cptable.utils.decode(1200,char_codes(data.substr(2)))}return data};_getchar=function _gc2(x){if(current_codepage===1200)return String.fromCharCode(x);return cptable.utils.decode(current_codepage,[x&255,x>>8])[0]}}var Base64=function make_b64(){var map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(input,utf8){var o="";var c1,c2,c3,e1,e2,e3,e4;for(var i=0;i<input.length;){c1=input.charCodeAt(i++);c2=input.charCodeAt(i++);c3=input.charCodeAt(i++);e1=c1>>2;e2=(c1&3)<<4|c2>>4;e3=(c2&15)<<2|c3>>6;e4=c3&63;if(isNaN(c2)){e3=e4=64}else if(isNaN(c3)){e4=64}o+=map.charAt(e1)+map.charAt(e2)+map.charAt(e3)+map.charAt(e4)}return o},decode:function b64_decode(input,utf8){var o="";var c1,c2,c3;var e1,e2,e3,e4;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var i=0;i<input.length;){e1=map.indexOf(input.charAt(i++));e2=map.indexOf(input.charAt(i++));e3=map.indexOf(input.charAt(i++));e4=map.indexOf(input.charAt(i++));c1=e1<<2|e2>>4;c2=(e2&15)<<4|e3>>2;c3=(e3&3)<<6|e4;o+=String.fromCharCode(c1);if(e3!=64){o+=String.fromCharCode(c2)}if(e4!=64){o+=String.fromCharCode(c3)}}return o}}}();var has_buf=typeof Buffer!=="undefined";function new_raw_buf(len){return new(has_buf?Buffer:Array)(len)}function s2a(s){if(has_buf)return new Buffer(s,"binary");return s.split("").map(function(x){return x.charCodeAt(0)&255})}var bconcat=function(bufs){return[].concat.apply([],bufs)};var chr0=/\u0000/g,chr1=/[\u0001-\u0006]/;var SSF={};var make_ssf=function make_ssf(SSF){SSF.version="0.8.1";function _strrev(x){var o="",i=x.length-1;while(i>=0)o+=x.charAt(i--);return o}function fill(c,l){var o="";while(o.length<l)o+=c;return o}function pad0(v,d){var t=""+v;return t.length>=d?t:fill("0",d-t.length)+t}function pad_(v,d){var t=""+v;return t.length>=d?t:fill(" ",d-t.length)+t}function rpad_(v,d){var t=""+v;return t.length>=d?t:t+fill(" ",d-t.length)}function pad0r1(v,d){var t=""+Math.round(v);return t.length>=d?t:fill("0",d-t.length)+t}function pad0r2(v,d){var t=""+v;return t.length>=d?t:fill("0",d-t.length)+t}var p2_32=Math.pow(2,32);function pad0r(v,d){if(v>p2_32||v<-p2_32)return pad0r1(v,d);var i=Math.round(v);return pad0r2(i,d)}function isgeneral(s,i){return s.length>=7+i&&(s.charCodeAt(i)|32)===103&&(s.charCodeAt(i+1)|32)===101&&(s.charCodeAt(i+2)|32)===110&&(s.charCodeAt(i+3)|32)===101&&(s.charCodeAt(i+4)|32)===114&&(s.charCodeAt(i+5)|32)===97&&(s.charCodeAt(i+6)|32)===108}var opts_fmt=[["date1904",0],["output",""],["WTF",false]];function fixopts(o){for(var y=0;y!=opts_fmt.length;++y)if(o[opts_fmt[y][0]]===undefined)o[opts_fmt[y][0]]=opts_fmt[y][1]}SSF.opts=opts_fmt;var table_fmt={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "',65535:"General"};var days=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]];var months=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function frac(x,D,mixed){var sgn=x<0?-1:1;var B=x*sgn;var P_2=0,P_1=1,P=0;var Q_2=1,Q_1=0,Q=0;var A=Math.floor(B);while(Q_1<D){A=Math.floor(B);P=A*P_1+P_2;Q=A*Q_1+Q_2;if(B-A<5e-10)break;B=1/(B-A);P_2=P_1;P_1=P;Q_2=Q_1;Q_1=Q}if(Q>D){Q=Q_1;P=P_1}if(Q>D){Q=Q_2;P=P_2}if(!mixed)return[0,sgn*P,Q];if(Q===0)throw"Unexpected state: "+P+" "+P_1+" "+P_2+" "+Q+" "+Q_1+" "+Q_2;var q=Math.floor(sgn*P/Q);return[q,sgn*P-q*Q,Q]}function general_fmt_int(v,opts){return""+v}SSF._general_int=general_fmt_int;var general_fmt_num=function make_general_fmt_num(){var gnr1=/\.(\d*[1-9])0+$/,gnr2=/\.0*$/,gnr4=/\.(\d*[1-9])0+/,gnr5=/\.0*[Ee]/,gnr6=/(E[+-])(\d)$/;function gfn2(v){var w=v<0?12:11;var o=gfn5(v.toFixed(12));if(o.length<=w)return o;o=v.toPrecision(10);if(o.length<=w)return o;return v.toExponential(5)}function gfn3(v){var o=v.toFixed(11).replace(gnr1,".$1");if(o.length>(v<0?12:11))o=v.toPrecision(6);return o}function gfn4(o){for(var i=0;i!=o.length;++i)if((o.charCodeAt(i)|32)===101)return o.replace(gnr4,".$1").replace(gnr5,"E").replace("e","E").replace(gnr6,"$10$2");return o}function gfn5(o){return o.indexOf(".")>-1?o.replace(gnr2,"").replace(gnr1,".$1"):o}return function general_fmt_num(v,opts){var V=Math.floor(Math.log(Math.abs(v))*Math.LOG10E),o;if(V>=-4&&V<=-1)o=v.toPrecision(10+V);else if(Math.abs(V)<=9)o=gfn2(v);else if(V===10)o=v.toFixed(10).substr(0,12);else o=gfn3(v);return gfn5(gfn4(o))}}();SSF._general_num=general_fmt_num;function general_fmt(v,opts){switch(typeof v){case"string":return v;case"boolean":return v?"TRUE":"FALSE";case"number":return(v|0)===v?general_fmt_int(v,opts):general_fmt_num(v,opts)}throw new Error("unsupported value in General format: "+v)}SSF._general=general_fmt;function fix_hijri(date,o){return 0}function parse_date_code(v,opts,b2){if(v>2958465||v<0)return null;var date=v|0,time=Math.floor(86400*(v-date)),dow=0;var dout=[];var out={D:date,T:time,u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(out.u)<1e-6)out.u=0;fixopts(opts!=null?opts:opts=[]);if(opts.date1904)date+=1462;if(out.u>.999){out.u=0;if(++time==86400){time=0;++date}}if(date===60){dout=b2?[1317,10,29]:[1900,2,29];dow=3}else if(date===0){dout=b2?[1317,8,29]:[1900,1,0];dow=6}else{if(date>60)--date;var d=new Date(1900,0,1);d.setDate(d.getDate()+date-1);dout=[d.getFullYear(),d.getMonth()+1,d.getDate()];dow=d.getDay();if(date<60)dow=(dow+6)%7;if(b2)dow=fix_hijri(d,dout)}out.y=dout[0];out.m=dout[1];out.d=dout[2];out.S=time%60;time=Math.floor(time/60);out.M=time%60;time=Math.floor(time/60);out.H=time;out.q=dow;return out}SSF.parse_date_code=parse_date_code;function write_date(type,fmt,val,ss0){var o="",ss=0,tt=0,y=val.y,out,outl=0;switch(type){case 98:y=val.y+543;case 121:switch(fmt.length){case 1:case 2:out=y%100;outl=2;break;default:out=y%1e4;outl=4;break}break;case 109:switch(fmt.length){case 1:case 2:out=val.m;outl=fmt.length;break;case 3:return months[val.m-1][1];case 5:return months[val.m-1][0];default:return months[val.m-1][2]}break;case 100:switch(fmt.length){case 1:case 2:out=val.d;outl=fmt.length;break;case 3:return days[val.q][0];default:return days[val.q][1]}break;case 104:switch(fmt.length){case 1:case 2:out=1+(val.H+11)%12;outl=fmt.length;break;default:throw"bad hour format: "+fmt}break;case 72:switch(fmt.length){case 1:case 2:out=val.H;outl=fmt.length;break;default:throw"bad hour format: "+fmt}break;case 77:switch(fmt.length){case 1:case 2:out=val.M;outl=fmt.length;break;default:throw"bad minute format: "+fmt}break;case 115:if(val.u===0)switch(fmt){case"s":case"ss":return pad0(val.S,fmt.length);case".0":case".00":case".000":}switch(fmt){case"s":case"ss":case".0":case".00":case".000":if(ss0>=2)tt=ss0===3?1e3:100;else tt=ss0===1?10:1;ss=Math.round(tt*(val.S+val.u));if(ss>=60*tt)ss=0;if(fmt==="s")return ss===0?"0":""+ss/tt;o=pad0(ss,2+ss0);if(fmt==="ss")return o.substr(0,2);return"."+o.substr(2,fmt.length-1);default:throw"bad second format: "+fmt}case 90:switch(fmt){case"[h]":case"[hh]":out=val.D*24+val.H;break;case"[m]":case"[mm]":out=(val.D*24+val.H)*60+val.M;break;case"[s]":case"[ss]":out=((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u);break;default:throw"bad abstime format: "+fmt}outl=fmt.length===3?1:2;break;case 101:out=y;outl=1}if(outl>0)return pad0(out,outl);else return""}function commaify(s){if(s.length<=3)return s;var j=s.length%3,o=s.substr(0,j);for(;j!=s.length;j+=3)o+=(o.length>0?",":"")+s.substr(j,3);return o}var write_num=function make_write_num(){var pct1=/%/g;function write_num_pct(type,fmt,val){var sfmt=fmt.replace(pct1,""),mul=fmt.length-sfmt.length;return write_num(type,sfmt,val*Math.pow(10,2*mul))+fill("%",mul)}function write_num_cm(type,fmt,val){var idx=fmt.length-1;while(fmt.charCodeAt(idx-1)===44)--idx;return write_num(type,fmt.substr(0,idx),val/Math.pow(10,3*(fmt.length-idx)))}function write_num_exp(fmt,val){var o;var idx=fmt.indexOf("E")-fmt.indexOf(".")-1;if(fmt.match(/^#+0.0E\+0$/)){var period=fmt.indexOf(".");if(period===-1)period=fmt.indexOf("E");var ee=Math.floor(Math.log(Math.abs(val))*Math.LOG10E)%period;if(ee<0)ee+=period;o=(val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period);if(o.indexOf("e")===-1){var fakee=Math.floor(Math.log(Math.abs(val))*Math.LOG10E);if(o.indexOf(".")===-1)o=o[0]+"."+o.substr(1)+"E+"+(fakee-o.length+ee);else o+="E+"+(fakee-ee);while(o.substr(0,2)==="0."){o=o[0]+o.substr(2,period)+"."+o.substr(2+period);o=o.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.")}o=o.replace(/\+-/,"-")}o=o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3){return $1+$2+$3.substr(0,(period+ee)%period)+"."+$3.substr(ee)+"E"})}else o=val.toExponential(idx);if(fmt.match(/E\+00$/)&&o.match(/e[+-]\d$/))o=o.substr(0,o.length-1)+"0"+o[o.length-1];if(fmt.match(/E\-/)&&o.match(/e\+/))o=o.replace(/e\+/,"e");return o.replace("e","E")}var frac1=/# (\?+)( ?)\/( ?)(\d+)/;function write_num_f1(r,aval,sign){var den=parseInt(r[4]),rr=Math.round(aval*den),base=Math.floor(rr/den);var myn=rr-base*den,myd=den;return sign+(base===0?"":""+base)+" "+(myn===0?fill(" ",r[1].length+1+r[4].length):pad_(myn,r[1].length)+r[2]+"/"+r[3]+pad0(myd,r[4].length))}function write_num_f2(r,aval,sign){return sign+(aval===0?"":""+aval)+fill(" ",r[1].length+2+r[4].length)}var dec1=/^#*0*\.(0+)/;var closeparen=/\).*[0#]/;var phone=/\(###\) ###\\?-####/;function hashq(str){var o="",cc;for(var i=0;i!=str.length;++i)switch(cc=str.charCodeAt(i)){case 35:break;case 63:o+=" ";break;case 48:o+="0";break;default:o+=String.fromCharCode(cc)}return o}function rnd(val,d){var dd=Math.pow(10,d);return""+Math.round(val*dd)/dd}function dec(val,d){return Math.round((val-Math.floor(val))*Math.pow(10,d))}function flr(val){if(val<2147483647&&val>-2147483648)return""+(val>=0?val|0:val-1|0);return""+Math.floor(val)}function write_num_flt(type,fmt,val){if(type.charCodeAt(0)===40&&!fmt.match(closeparen)){var ffmt=fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");if(val>=0)return write_num_flt("n",ffmt,val);return"("+write_num_flt("n",ffmt,-val)+")"}if(fmt.charCodeAt(fmt.length-1)===44)return write_num_cm(type,fmt,val);if(fmt.indexOf("%")!==-1)return write_num_pct(type,fmt,val);if(fmt.indexOf("E")!==-1)return write_num_exp(fmt,val);if(fmt.charCodeAt(0)===36)return"$"+write_num_flt(type,fmt.substr(fmt[1]==" "?2:1),val);var o,oo;var r,ri,ff,aval=Math.abs(val),sign=val<0?"-":"";if(fmt.match(/^00+$/))return sign+pad0r(aval,fmt.length);if(fmt.match(/^[#?]+$/)){o=pad0r(val,0);if(o==="0")o="";return o.length>fmt.length?o:hashq(fmt.substr(0,fmt.length-o.length))+o}if((r=fmt.match(frac1))!==null)return write_num_f1(r,aval,sign);if(fmt.match(/^#+0+$/)!==null)return sign+pad0r(aval,fmt.length-fmt.indexOf("0"));if((r=fmt.match(dec1))!==null){o=rnd(val,r[1].length).replace(/^([^\.]+)$/,"$1."+r[1]).replace(/\.$/,"."+r[1]).replace(/\.(\d*)$/,function($$,$1){return"."+$1+fill("0",r[1].length-$1.length)});return fmt.indexOf("0.")!==-1?o:o.replace(/^0\./,".")}fmt=fmt.replace(/^#+([0.])/,"$1");if((r=fmt.match(/^(0*)\.(#*)$/))!==null){return sign+rnd(aval,r[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":".")}if((r=fmt.match(/^#,##0(\.?)$/))!==null)return sign+commaify(pad0r(aval,0));if((r=fmt.match(/^#,##0\.([#0]*0)$/))!==null){return val<0?"-"+write_num_flt(type,fmt,-val):commaify(""+Math.floor(val))+"."+pad0(dec(val,r[1].length),r[1].length)}if((r=fmt.match(/^#,#*,#0/))!==null)return write_num_flt(type,fmt.replace(/^#,#*,/,""),val);if((r=fmt.match(/^([0#]+)(\\?-([0#]+))+$/))!==null){o=_strrev(write_num_flt(type,fmt.replace(/[\\-]/g,""),val));ri=0;return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri<o.length?o[ri++]:x==="0"?"0":""}))}if(fmt.match(phone)!==null){o=write_num_flt(type,"##########",val);return"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6)}var oa="";if((r=fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))!==null){ri=Math.min(r[4].length,7);ff=frac(aval,Math.pow(10,ri)-1,false);o=""+sign;oa=write_num("n",r[1],ff[1]);if(oa[oa.length-1]==" ")oa=oa.substr(0,oa.length-1)+"0";o+=oa+r[2]+"/"+r[3];oa=rpad_(ff[2],ri);if(oa.length<r[4].length)oa=hashq(r[4].substr(r[4].length-oa.length))+oa;o+=oa;return o}if((r=fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))!==null){ri=Math.min(Math.max(r[1].length,r[4].length),7);ff=frac(aval,Math.pow(10,ri)-1,true);return sign+(ff[0]||(ff[1]?"":"0"))+" "+(ff[1]?pad_(ff[1],ri)+r[2]+"/"+r[3]+rpad_(ff[2],ri):fill(" ",2*ri+1+r[2].length+r[3].length))}if((r=fmt.match(/^[#0?]+$/))!==null){o=pad0r(val,0);if(fmt.length<=o.length)return o;return hashq(fmt.substr(0,fmt.length-o.length))+o}if((r=fmt.match(/^([#0?]+)\.([#0]+)$/))!==null){o=""+val.toFixed(Math.min(r[2].length,10)).replace(/([^0])0+$/,"$1");ri=o.indexOf(".");var lres=fmt.indexOf(".")-ri,rres=fmt.length-o.length-lres;return hashq(fmt.substr(0,lres)+o+fmt.substr(fmt.length-rres))}if((r=fmt.match(/^00,000\.([#0]*0)$/))!==null){ri=dec(val,r[1].length);return val<0?"-"+write_num_flt(type,fmt,-val):commaify(flr(val)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function($$){return"00,"+($$.length<3?pad0(0,3-$$.length):"")+$$})+"."+pad0(ri,r[1].length)}switch(fmt){case"#,###":var x=commaify(pad0r(aval,0));return x!=="0"?sign+x:"";default:}throw new Error("unsupported format |"+fmt+"|")}function write_num_cm2(type,fmt,val){var idx=fmt.length-1;while(fmt.charCodeAt(idx-1)===44)--idx;return write_num(type,fmt.substr(0,idx),val/Math.pow(10,3*(fmt.length-idx)))}function write_num_pct2(type,fmt,val){var sfmt=fmt.replace(pct1,""),mul=fmt.length-sfmt.length;return write_num(type,sfmt,val*Math.pow(10,2*mul))+fill("%",mul)}function write_num_exp2(fmt,val){var o;var idx=fmt.indexOf("E")-fmt.indexOf(".")-1;if(fmt.match(/^#+0.0E\+0$/)){var period=fmt.indexOf(".");if(period===-1)period=fmt.indexOf("E");var ee=Math.floor(Math.log(Math.abs(val))*Math.LOG10E)%period;if(ee<0)ee+=period;o=(val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period);if(!o.match(/[Ee]/)){var fakee=Math.floor(Math.log(Math.abs(val))*Math.LOG10E);if(o.indexOf(".")===-1)o=o[0]+"."+o.substr(1)+"E+"+(fakee-o.length+ee);else o+="E+"+(fakee-ee);o=o.replace(/\+-/,"-")}o=o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3){return $1+$2+$3.substr(0,(period+ee)%period)+"."+$3.substr(ee)+"E"})}else o=val.toExponential(idx);if(fmt.match(/E\+00$/)&&o.match(/e[+-]\d$/))o=o.substr(0,o.length-1)+"0"+o[o.length-1];if(fmt.match(/E\-/)&&o.match(/e\+/))o=o.replace(/e\+/,"e");return o.replace("e","E")}function write_num_int(type,fmt,val){if(type.charCodeAt(0)===40&&!fmt.match(closeparen)){var ffmt=fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");if(val>=0)return write_num_int("n",ffmt,val);return"("+write_num_int("n",ffmt,-val)+")"}if(fmt.charCodeAt(fmt.length-1)===44)return write_num_cm2(type,fmt,val);if(fmt.indexOf("%")!==-1)return write_num_pct2(type,fmt,val);if(fmt.indexOf("E")!==-1)return write_num_exp2(fmt,val);if(fmt.charCodeAt(0)===36)return"$"+write_num_int(type,fmt.substr(fmt[1]==" "?2:1),val);var o;var r,ri,ff,aval=Math.abs(val),sign=val<0?"-":"";if(fmt.match(/^00+$/))return sign+pad0(aval,fmt.length);if(fmt.match(/^[#?]+$/)){o=""+val;if(val===0)o="";return o.length>fmt.length?o:hashq(fmt.substr(0,fmt.length-o.length))+o}if((r=fmt.match(frac1))!==null)return write_num_f2(r,aval,sign);if(fmt.match(/^#+0+$/)!==null)return sign+pad0(aval,fmt.length-fmt.indexOf("0"));if((r=fmt.match(dec1))!==null){o=(""+val).replace(/^([^\.]+)$/,"$1."+r[1]).replace(/\.$/,"."+r[1]).replace(/\.(\d*)$/,function($$,$1){return"."+$1+fill("0",r[1].length-$1.length)});return fmt.indexOf("0.")!==-1?o:o.replace(/^0\./,".");+}fmt=fmt.replace(/^#+([0.])/,"$1");if((r=fmt.match(/^(0*)\.(#*)$/))!==null){return sign+(""+aval).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":".")}if((r=fmt.match(/^#,##0(\.?)$/))!==null)return sign+commaify(""+aval);if((r=fmt.match(/^#,##0\.([#0]*0)$/))!==null){return val<0?"-"+write_num_int(type,fmt,-val):commaify(""+val)+"."+fill("0",r[1].length)}if((r=fmt.match(/^#,#*,#0/))!==null)return write_num_int(type,fmt.replace(/^#,#*,/,""),val);if((r=fmt.match(/^([0#]+)(\\?-([0#]+))+$/))!==null){o=_strrev(write_num_int(type,fmt.replace(/[\\-]/g,""),val));ri=0;return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri<o.length?o[ri++]:x==="0"?"0":""}))}if(fmt.match(phone)!==null){o=write_num_int(type,"##########",val);return"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6)}var oa="";if((r=fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))!==null){ri=Math.min(r[4].length,7);ff=frac(aval,Math.pow(10,ri)-1,false);o=""+sign;oa=write_num("n",r[1],ff[1]);if(oa[oa.length-1]==" ")oa=oa.substr(0,oa.length-1)+"0";o+=oa+r[2]+"/"+r[3];oa=rpad_(ff[2],ri);if(oa.length<r[4].length)oa=hashq(r[4].substr(r[4].length-oa.length))+oa;o+=oa;return o}if((r=fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))!==null){ri=Math.min(Math.max(r[1].length,r[4].length),7);ff=frac(aval,Math.pow(10,ri)-1,true);return sign+(ff[0]||(ff[1]?"":"0"))+" "+(ff[1]?pad_(ff[1],ri)+r[2]+"/"+r[3]+rpad_(ff[2],ri):fill(" ",2*ri+1+r[2].length+r[3].length))}if((r=fmt.match(/^[#0?]+$/))!==null){o=""+val;if(fmt.length<=o.length)return o;return hashq(fmt.substr(0,fmt.length-o.length))+o}if((r=fmt.match(/^([#0]+)\.([#0]+)$/))!==null){o=""+val.toFixed(Math.min(r[2].length,10)).replace(/([^0])0+$/,"$1");ri=o.indexOf(".");var lres=fmt.indexOf(".")-ri,rres=fmt.length-o.length-lres;return hashq(fmt.substr(0,lres)+o+fmt.substr(fmt.length-rres))}if((r=fmt.match(/^00,000\.([#0]*0)$/))!==null){return val<0?"-"+write_num_int(type,fmt,-val):commaify(""+val).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function($$){return"00,"+($$.length<3?pad0(0,3-$$.length):"")+$$})+"."+pad0(0,r[1].length)}switch(fmt){case"#,###":var x=commaify(""+aval);return x!=="0"?sign+x:"";default:}throw new Error("unsupported format |"+fmt+"|")}return function write_num(type,fmt,val){return(val|0)===val?write_num_int(type,fmt,val):write_num_flt(type,fmt,val)}}();function split_fmt(fmt){var out=[];var in_str=false,cc;for(var i=0,j=0;i<fmt.length;++i)switch(cc=fmt.charCodeAt(i)){case 34:in_str=!in_str;break;case 95:case 42:case 92:++i;break;case 59:out[out.length]=fmt.substr(j,i-j);j=i+1}out[out.length]=fmt.substr(j);if(in_str===true)throw new Error("Format |"+fmt+"| unterminated string ");return out}SSF._split=split_fmt;var abstime=/\[[HhMmSs]*\]/;function eval_fmt(fmt,v,opts,flen){var out=[],o="",i=0,c="",lst="t",q,dt,j,cc;var hr="H";while(i<fmt.length){switch(c=fmt[i]){case"G":if(!isgeneral(fmt,i))throw new Error("unrecognized character "+c+" in "+fmt);out[out.length]={t:"G",v:"General"};i+=7;break;case'"':for(o="";(cc=fmt.charCodeAt(++i))!==34&&i<fmt.length;)o+=String.fromCharCode(cc);out[out.length]={t:"t",v:o};++i;break;case"\\":var w=fmt[++i],t=w==="("||w===")"?w:"t";out[out.length]={t:t,v:w};++i;break;case"_":out[out.length]={t:"t",v:" "};i+=2;break;case"@":out[out.length]={t:"T",v:v};++i;break;case"B":case"b":if(fmt[i+1]==="1"||fmt[i+1]==="2"){if(dt==null){dt=parse_date_code(v,opts,fmt[i+1]==="2");if(dt==null)return""}out[out.length]={t:"X",v:fmt.substr(i,2)};lst=c;i+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":c=c.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(v<0)return"";if(dt==null){dt=parse_date_code(v,opts);if(dt==null)return""}o=c;while(++i<fmt.length&&fmt[i].toLowerCase()===c)o+=c;if(c==="m"&&lst.toLowerCase()==="h")c="M";if(c==="h")c=hr;out[out.length]={t:c,v:o};lst=c;break;case"A":q={t:c,v:"A"};if(dt==null)dt=parse_date_code(v,opts);if(fmt.substr(i,3)==="A/P"){if(dt!=null)q.v=dt.H>=12?"P":"A";q.t="T";hr="h";i+=3}else if(fmt.substr(i,5)==="AM/PM"){if(dt!=null)q.v=dt.H>=12?"PM":"AM";q.t="T";i+=5;hr="h"}else{q.t="t";++i}if(dt==null&&q.t==="T")return"";out[out.length]=q;lst=c;break;case"[":o=c;while(fmt[i++]!=="]"&&i<fmt.length)o+=fmt[i];if(o.substr(-1)!=="]")throw'unterminated "[" block: |'+o+"|";if(o.match(abstime)){if(dt==null){dt=parse_date_code(v,opts);if(dt==null)return""}out[out.length]={t:"Z",v:o.toLowerCase()}}else{o=""}break;case".":if(dt!=null){o=c;while((c=fmt[++i])==="0")o+=c;out[out.length]={t:"s",v:o};break}case"0":case"#":o=c;while("0#?.,E+-%".indexOf(c=fmt[++i])>-1||c=="\\"&&fmt[i+1]=="-"&&"0#".indexOf(fmt[i+2])>-1)o+=c;out[out.length]={t:"n",v:o};break;case"?":o=c;while(fmt[++i]===c)o+=c;q={t:c,v:o};out[out.length]=q;lst=c;break;case"*":++i;if(fmt[i]==" "||fmt[i]=="*")++i;break;case"(":case")":out[out.length]={t:flen===1?"t":c,v:c};++i;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":o=c;while("0123456789".indexOf(fmt[++i])>-1)o+=fmt[i];out[out.length]={t:"D",v:o};break;case" ":out[out.length]={t:c,v:c};++i;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxz".indexOf(c)===-1)throw new Error("unrecognized character "+c+" in "+fmt);out[out.length]={t:"t",v:c};++i;break}}var bt=0,ss0=0,ssm;for(i=out.length-1,lst="t";i>=0;--i){switch(out[i].t){case"h":case"H":out[i].t=hr;lst="h";if(bt<1)bt=1;break;case"s":if(ssm=out[i].v.match(/\.0+$/))ss0=Math.max(ss0,ssm[0].length-1);if(bt<3)bt=3;case"d":case"y":case"M":case"e":lst=out[i].t;break;case"m":if(lst==="s"){out[i].t="M";if(bt<2)bt=2}break;case"X":if(out[i].v==="B2");break;case"Z":if(bt<1&&out[i].v.match(/[Hh]/))bt=1;if(bt<2&&out[i].v.match(/[Mm]/))bt=2;if(bt<3&&out[i].v.match(/[Ss]/))bt=3}}switch(bt){case 0:break;case 1:if(dt.u>=.5){dt.u=0;++dt.S}if(dt.S>=60){dt.S=0;++dt.M}if(dt.M>=60){dt.M=0;++dt.H}break;case 2:if(dt.u>=.5){dt.u=0;++dt.S}if(dt.S>=60){dt.S=0;++dt.M}break}var nstr="",jj;for(i=0;i<out.length;++i){switch(out[i].t){case"t":case"T":case" ":case"D":break;case"X":out[i]=undefined;break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":out[i].v=write_date(out[i].t.charCodeAt(0),out[i].v,dt,ss0);out[i].t="t";break;case"n":case"(":case"?":jj=i+1;while(out[jj]!=null&&((c=out[jj].t)==="?"||c==="D"||(c===" "||c==="t")&&out[jj+1]!=null&&(out[jj+1].t==="?"||out[jj+1].t==="t"&&out[jj+1].v==="/")||out[i].t==="("&&(c===" "||c==="n"||c===")")||c==="t"&&(out[jj].v==="/"||"$€".indexOf(out[jj].v)>-1||out[jj].v===" "&&out[jj+1]!=null&&out[jj+1].t=="?"))){out[i].v+=out[jj].v;out[jj]=undefined;++jj}nstr+=out[i].v;i=jj-1;break;case"G":out[i].t="t";out[i].v=general_fmt(v,opts);break}}var vv="",myv,ostr;if(nstr.length>0){myv=v<0&&nstr.charCodeAt(0)===45?-v:v;ostr=write_num(nstr.charCodeAt(0)===40?"(":"n",nstr,myv);jj=ostr.length-1;var decpt=out.length;for(i=0;i<out.length;++i)if(out[i]!=null&&out[i].v.indexOf(".")>-1){decpt=i;break}var lasti=out.length;if(decpt===out.length&&ostr.indexOf("E")===-1){for(i=out.length-1;i>=0;--i){if(out[i]==null||"n?(".indexOf(out[i].t)===-1)continue;if(jj>=out[i].v.length-1){jj-=out[i].v.length;out[i].v=ostr.substr(jj+1,out[i].v.length)}else if(jj<0)out[i].v="";else{out[i].v=ostr.substr(0,jj+1);jj=-1}out[i].t="t";lasti=i}if(jj>=0&&lasti<out.length)out[lasti].v=ostr.substr(0,jj+1)+out[lasti].v}else if(decpt!==out.length&&ostr.indexOf("E")===-1){jj=ostr.indexOf(".")-1;for(i=decpt;i>=0;--i){if(out[i]==null||"n?(".indexOf(out[i].t)===-1)continue;j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")-1:out[i].v.length-1;vv=out[i].v.substr(j+1);for(;j>=0;--j){if(jj>=0&&(out[i].v[j]==="0"||out[i].v[j]==="#"))vv=ostr[jj--]+vv}out[i].v=vv;out[i].t="t";lasti=i}if(jj>=0&&lasti<out.length)out[lasti].v=ostr.substr(0,jj+1)+out[lasti].v;jj=ostr.indexOf(".")+1;for(i=decpt;i<out.length;++i){if(out[i]==null||"n?(".indexOf(out[i].t)===-1&&i!==decpt)continue;j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")+1:0;vv=out[i].v.substr(0,j);for(;j<out[i].v.length;++j){if(jj<ostr.length)vv+=ostr[jj++]}out[i].v=vv;out[i].t="t";lasti=i}}}for(i=0;i<out.length;++i)if(out[i]!=null&&"n(?".indexOf(out[i].t)>-1){myv=flen>1&&v<0&&i>0&&out[i-1].v==="-"?-v:v;out[i].v=write_num(out[i].t,out[i].v,myv);out[i].t="t"}var retval="";for(i=0;i!==out.length;++i)if(out[i]!=null)retval+=out[i].v;return retval}SSF._eval=eval_fmt;var cfregex=/\[[=<>]/;var cfregex2=/\[([=<>]*)(-?\d+\.?\d*)\]/;function chkcond(v,rr){if(rr==null)return false;var thresh=parseFloat(rr[2]);switch(rr[1]){case"=":if(v==thresh)return true;break;case">":if(v>thresh)return true;break;case"<":if(v<thresh)return true;break;case"<>":if(v!=thresh)return true;break;case">=":if(v>=thresh)return true;break;case"<=":if(v<=thresh)return true;break}return false}function choose_fmt(f,v){var fmt=split_fmt(f);var l=fmt.length,lat=fmt[l-1].indexOf("@");if(l<4&&lat>-1)--l;if(fmt.length>4)throw"cannot find right format for |"+fmt+"|";if(typeof v!=="number")return[4,fmt.length===4||lat>-1?fmt[fmt.length-1]:"@"];switch(fmt.length){case 1:fmt=lat>-1?["General","General","General",fmt[0]]:[fmt[0],fmt[0],fmt[0],"@"];break;case 2:fmt=lat>-1?[fmt[0],fmt[0],fmt[0],fmt[1]]:[fmt[0],fmt[1],fmt[0],"@"];break;case 3:fmt=lat>-1?[fmt[0],fmt[1],fmt[0],fmt[2]]:[fmt[0],fmt[1],fmt[2],"@"];break;case 4:break}var ff=v>0?fmt[0]:v<0?fmt[1]:fmt[2];if(fmt[0].indexOf("[")===-1&&fmt[1].indexOf("[")===-1)return[l,ff];if(fmt[0].match(cfregex)!=null||fmt[1].match(cfregex)!=null){var m1=fmt[0].match(cfregex2);var m2=fmt[1].match(cfregex2);return chkcond(v,m1)?[l,fmt[0]]:chkcond(v,m2)?[l,fmt[1]]:[l,fmt[m1!=null&&m2!=null?2:1]]}return[l,ff]}function format(fmt,v,o){fixopts(o!=null?o:o=[]);var sfmt="";switch(typeof fmt){case"string":sfmt=fmt;break;case"number":sfmt=(o.table!=null?o.table:table_fmt)[fmt];break}if(isgeneral(sfmt,0))return general_fmt(v,o);var f=choose_fmt(sfmt,v);if(isgeneral(f[1]))return general_fmt(v,o);if(v===true)v="TRUE";else if(v===false)v="FALSE";else if(v===""||v==null)return"";return eval_fmt(f[1],v,o,f[0])}SSF._table=table_fmt;SSF.load=function load_entry(fmt,idx){table_fmt[idx]=fmt};SSF.format=format;SSF.get_table=function get_table(){return table_fmt};SSF.load_table=function load_table(tbl){for(var i=0;i!=392;++i)if(tbl[i]!==undefined)SSF.load(tbl[i],i)}};make_ssf(SSF);var XLMLFormatMap={"General Number":"General","General Date":SSF._table[22],"Long Date":"dddd, mmmm dd, yyyy","Medium Date":SSF._table[15],"Short Date":SSF._table[14],"Long Time":SSF._table[19],"Medium Time":SSF._table[18],"Short Time":SSF._table[20],Currency:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',Fixed:SSF._table[2],Standard:SSF._table[4],Percent:SSF._table[10],Scientific:SSF._table[11],"Yes/No":'"Yes";"Yes";"No";@',"True/False":'"True";"True";"False";@',"On/Off":'"Yes";"Yes";"No";@'};var DO_NOT_EXPORT_CFB=true;var CFB=function _CFB(){var exports={};exports.version="0.10.2";function parse(file){var mver=3;var ssz=512;var nmfs=0;var ndfs=0;var dir_start=0;var minifat_start=0;var difat_start=0;var fat_addrs=[];var blob=file.slice(0,512);prep_blob(blob,0);var mv=check_get_mver(blob);mver=mv[0];switch(mver){case 3:ssz=512;break;case 4:ssz=4096;break;default:throw"Major Version: Expected 3 or 4 saw "+mver}if(ssz!==512){blob=file.slice(0,ssz);prep_blob(blob,28)}var header=file.slice(0,ssz);check_shifts(blob,mver);var nds=blob.read_shift(4,"i");if(mver===3&&nds!==0)throw"# Directory Sectors: Expected 0 saw "+nds;blob.l+=4;dir_start=blob.read_shift(4,"i");blob.l+=4;blob.chk("00100000","Mini Stream Cutoff Size: ");minifat_start=blob.read_shift(4,"i");nmfs=blob.read_shift(4,"i");difat_start=blob.read_shift(4,"i");ndfs=blob.read_shift(4,"i");for(var q,j=0;j<109;++j){q=blob.read_shift(4,"i");if(q<0)break;fat_addrs[j]=q}var sectors=sectorify(file,ssz);sleuth_fat(difat_start,ndfs,sectors,ssz,fat_addrs);var sector_list=make_sector_list(sectors,dir_start,fat_addrs,ssz);sector_list[dir_start].name="!Directory";if(nmfs>0&&minifat_start!==ENDOFCHAIN)sector_list[minifat_start].name="!MiniFAT";sector_list[fat_addrs[0]].name="!FAT";sector_list.fat_addrs=fat_addrs;sector_list.ssz=ssz;var files={},Paths=[],FileIndex=[],FullPaths=[],FullPathDir={};read_directory(dir_start,sector_list,sectors,Paths,nmfs,files,FileIndex);build_full_paths(FileIndex,FullPathDir,FullPaths,Paths);var root_name=Paths.shift();Paths.root=root_name;var find_path=make_find_path(FullPaths,Paths,FileIndex,files,root_name);return{raw:{header:header,sectors:sectors},FileIndex:FileIndex,FullPaths:FullPaths,FullPathDir:FullPathDir,find:find_path}}function check_get_mver(blob){blob.chk(HEADER_SIGNATURE,"Header Signature: ");blob.chk(HEADER_CLSID,"CLSID: ");var mver=blob.read_shift(2,"u");return[blob.read_shift(2,"u"),mver]}function check_shifts(blob,mver){var shift=9;blob.chk("feff","Byte Order: ");switch(shift=blob.read_shift(2)){case 9:if(mver!==3)throw"MajorVersion/SectorShift Mismatch";break;case 12:if(mver!==4)throw"MajorVersion/SectorShift Mismatch";break;default:throw"Sector Shift: Expected 9 or 12 saw "+shift}blob.chk("0600","Mini Sector Shift: ");blob.chk("000000000000","Reserved: ")}function sectorify(file,ssz){var nsectors=Math.ceil(file.length/ssz)-1;var sectors=new Array(nsectors);for(var i=1;i<nsectors;++i)sectors[i-1]=file.slice(i*ssz,(i+1)*ssz);sectors[nsectors-1]=file.slice(nsectors*ssz);return sectors}function build_full_paths(FI,FPD,FP,Paths){var i=0,L=0,R=0,C=0,j=0,pl=Paths.length;var dad=new Array(pl),q=new Array(pl);for(;i<pl;++i){dad[i]=q[i]=i;FP[i]=Paths[i]}for(;j<q.length;++j){i=q[j];L=FI[i].L;R=FI[i].R;C=FI[i].C;if(dad[i]===i){if(L!==-1&&dad[L]!==L)dad[i]=dad[L];if(R!==-1&&dad[R]!==R)dad[i]=dad[R]}if(C!==-1)dad[C]=i;if(L!==-1){dad[L]=dad[i];q.push(L)}if(R!==-1){dad[R]=dad[i];q.push(R)}}for(i=1;i!==pl;++i)if(dad[i]===i){if(R!==-1&&dad[R]!==R)dad[i]=dad[R];else if(L!==-1&&dad[L]!==L)dad[i]=dad[L]}for(i=1;i<pl;++i){if(FI[i].type===0)continue;j=dad[i];if(j===0)FP[i]=FP[0]+"/"+FP[i];else while(j!==0){FP[i]=FP[j]+"/"+FP[i];j=dad[j]}dad[i]=0}FP[0]+="/";for(i=1;i<pl;++i){if(FI[i].type!==2)FP[i]+="/";FPD[FP[i]]=FI[i]}}function make_find_path(FullPaths,Paths,FileIndex,files,root_name){var UCFullPaths=new Array(FullPaths.length);var UCPaths=new Array(Paths.length),i;for(i=0;i<FullPaths.length;++i)UCFullPaths[i]=FullPaths[i].toUpperCase().replace(chr0,"").replace(chr1,"!");for(i=0;i<Paths.length;++i)UCPaths[i]=Paths[i].toUpperCase().replace(chr0,"").replace(chr1,"!");return function find_path(path){var k;if(path.charCodeAt(0)===47){k=true;path=root_name+path}else k=path.indexOf("/")!==-1;var UCPath=path.toUpperCase().replace(chr0,"").replace(chr1,"!");var w=k===true?UCFullPaths.indexOf(UCPath):UCPaths.indexOf(UCPath);if(w===-1)return null;return k===true?FileIndex[w]:files[Paths[w]]}}function sleuth_fat(idx,cnt,sectors,ssz,fat_addrs){var q;if(idx===ENDOFCHAIN){if(cnt!==0)throw"DIFAT chain shorter than expected"}else if(idx!==-1){var sector=sectors[idx],m=(ssz>>>2)-1;for(var i=0;i<m;++i){if((q=__readInt32LE(sector,i*4))===ENDOFCHAIN)break;fat_addrs.push(q)}sleuth_fat(__readInt32LE(sector,ssz-4),cnt-1,sectors,ssz,fat_addrs)}}function get_sector_list(sectors,start,fat_addrs,ssz,chkd){var sl=sectors.length;var buf,buf_chain;if(!chkd)chkd=new Array(sl);var modulus=ssz-1,j,jj;buf=[];buf_chain=[];for(j=start;j>=0;){chkd[j]=true;buf[buf.length]=j;buf_chain.push(sectors[j]);var addr=fat_addrs[Math.floor(j*4/ssz)];jj=j*4&modulus;if(ssz<4+jj)throw"FAT boundary crossed: "+j+" 4 "+ssz;j=__readInt32LE(sectors[addr],jj)}return{nodes:buf,data:__toBuffer([buf_chain])}}function make_sector_list(sectors,dir_start,fat_addrs,ssz){var sl=sectors.length,sector_list=new Array(sl);var chkd=new Array(sl),buf,buf_chain;var modulus=ssz-1,i,j,k,jj;for(i=0;i<sl;++i){buf=[];k=i+dir_start;if(k>=sl)k-=sl;if(chkd[k]===true)continue;buf_chain=[];for(j=k;j>=0;){chkd[j]=true;buf[buf.length]=j;buf_chain.push(sectors[j]);var addr=fat_addrs[Math.floor(j*4/ssz)];jj=j*4&modulus;if(ssz<4+jj)throw"FAT boundary crossed: "+j+" 4 "+ssz;j=__readInt32LE(sectors[addr],jj)}sector_list[k]={nodes:buf,data:__toBuffer([buf_chain])}}return sector_list}function read_directory(dir_start,sector_list,sectors,Paths,nmfs,files,FileIndex){var blob;var minifat_store=0,pl=Paths.length?2:0;var sector=sector_list[dir_start].data;var i=0,namelen=0,name,o,ctime,mtime;for(;i<sector.length;i+=128){blob=sector.slice(i,i+128);prep_blob(blob,64);namelen=blob.read_shift(2);if(namelen===0)continue;name=__utf16le(blob,0,namelen-pl);Paths.push(name);o={name:name,type:blob.read_shift(1),color:blob.read_shift(1),L:blob.read_shift(4,"i"),R:blob.read_shift(4,"i"),C:blob.read_shift(4,"i"),clsid:blob.read_shift(16),state:blob.read_shift(4,"i")};ctime=blob.read_shift(2)+blob.read_shift(2)+blob.read_shift(2)+blob.read_shift(2);if(ctime!==0){o.ctime=ctime;o.ct=read_date(blob,blob.l-8)}mtime=blob.read_shift(2)+blob.read_shift(2)+blob.read_shift(2)+blob.read_shift(2);if(mtime!==0){o.mtime=mtime;o.mt=read_date(blob,blob.l-8)}o.start=blob.read_shift(4,"i");o.size=blob.read_shift(4,"i");if(o.type===5){minifat_store=o.start;if(nmfs>0&&minifat_store!==ENDOFCHAIN)sector_list[minifat_store].name="!StreamData"}else if(o.size>=4096){o.storage="fat";if(sector_list[o.start]===undefined)sector_list[o.start]=get_sector_list(sectors,o.start,sector_list.fat_addrs,sector_list.ssz);sector_list[o.start].name=o.name;o.content=sector_list[o.start].data.slice(0,o.size);prep_blob(o.content,0)}else{o.storage="minifat";if(minifat_store!==ENDOFCHAIN&&o.start!==ENDOFCHAIN){o.content=sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size);prep_blob(o.content,0)}}files[name]=o;FileIndex.push(o)}}function read_date(blob,offset){return new Date((__readUInt32LE(blob,offset+4)/1e7*Math.pow(2,32)+__readUInt32LE(blob,offset)/1e7-11644473600)*1e3)}var fs;function readFileSync(filename,options){if(fs===undefined)fs=require("fs");return parse(fs.readFileSync(filename),options)}function readSync(blob,options){switch(options!==undefined&&options.type!==undefined?options.type:"base64"){case"file":return readFileSync(blob,options);case"base64":return parse(s2a(Base64.decode(blob)),options);case"binary":return parse(s2a(blob),options)}return parse(blob)}var MSSZ=64;var ENDOFCHAIN=-2;var HEADER_SIGNATURE="d0cf11e0a1b11ae1";var HEADER_CLSID="00000000000000000000000000000000";var consts={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:ENDOFCHAIN,FREESECT:-1,HEADER_SIGNATURE:HEADER_SIGNATURE,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:HEADER_CLSID,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};exports.read=readSync;exports.parse=parse;exports.utils={ReadShift:ReadShift,CheckField:CheckField,prep_blob:prep_blob,bconcat:bconcat,consts:consts};return exports}();if(typeof require!=="undefined"&&typeof module!=="undefined"&&typeof DO_NOT_EXPORT_CFB==="undefined"){module.exports=CFB}function isval(x){return x!==undefined&&x!==null}function keys(o){return Object.keys(o)}function evert_key(obj,key){var o=[],K=keys(obj);for(var i=0;i!==K.length;++i)o[obj[K[i]][key]]=K[i];return o}function evert(obj){var o=[],K=keys(obj);for(var i=0;i!==K.length;++i)o[obj[K[i]]]=K[i];return o}function evert_num(obj){var o=[],K=keys(obj);for(var i=0;i!==K.length;++i)o[obj[K[i]]]=parseInt(K[i],10);return o}function evert_arr(obj){var o=[],K=keys(obj);for(var i=0;i!==K.length;++i){if(o[obj[K[i]]]==null)o[obj[K[i]]]=[];o[obj[K[i]]].push(K[i])}return o}function datenum(v,date1904){if(date1904)v+=1462;var epoch=Date.parse(v);return(epoch+22091616e5)/(24*60*60*1e3)}function cc2str(arr){var o="";for(var i=0;i!=arr.length;++i)o+=String.fromCharCode(arr[i]);return o}function getdata(data){if(!data)return null;if(data.name.substr(-4)===".bin"){if(data.data)return char_codes(data.data);if(data.asNodeBuffer&&has_buf)return data.asNodeBuffer();if(data._data&&data._data.getContent)return Array.prototype.slice.call(data._data.getContent())}else{if(data.data)return data.name.substr(-4)!==".bin"?debom_xml(data.data):char_codes(data.data);if(data.asNodeBuffer&&has_buf)return debom_xml(data.asNodeBuffer().toString("binary"));if(data.asBinary)return debom_xml(data.asBinary());if(data._data&&data._data.getContent)return debom_xml(cc2str(Array.prototype.slice.call(data._data.getContent(),0)))}return null}function safegetzipfile(zip,file){var f=file;if(zip.files[f])return zip.files[f];f=file.toLowerCase();if(zip.files[f])return zip.files[f];f=f.replace(/\//g,"\\");if(zip.files[f])return zip.files[f];return null}function getzipfile(zip,file){var o=safegetzipfile(zip,file);if(o==null)throw new Error("Cannot find file "+file+" in zip");return o}function getzipdata(zip,file,safe){if(!safe)return getdata(getzipfile(zip,file));if(!file)return null;try{return getzipdata(zip,file)}catch(e){return null}}var _fs,jszip;if(typeof JSZip!=="undefined")jszip=JSZip;if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){if(has_buf&&typeof jszip==="undefined")jszip=require("js"+"zip");if(typeof jszip==="undefined")jszip=require("./js"+"zip").JSZip;_fs=require("f"+"s")}}var attregexg=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g;var tagregex=/<[^>]*>/g;var nsregex=/<\w*:/,nsregex2=/<(\/?)\w+:/;function parsexmltag(tag,skip_root){var z=[];var eq=0,c=0;for(;eq!==tag.length;++eq)if((c=tag.charCodeAt(eq))===32||c===10||c===13)break;if(!skip_root)z[0]=tag.substr(0,eq);if(eq===tag.length)return z;var m=tag.match(attregexg),j=0,w="",v="",i=0,q="",cc="";if(m)for(i=0;i!=m.length;++i){cc=m[i];for(c=0;c!=cc.length;++c)if(cc.charCodeAt(c)===61)break;q=cc.substr(0,c);v=cc.substring(c+2,cc.length-1);for(j=0;j!=q.length;++j)if(q.charCodeAt(j)===58)break;if(j===q.length)z[q]=v;else z[(j===5&&q.substr(0,5)==="xmlns"?"xmlns":"")+q.substr(j+1)]=v}return z}function strip_ns(x){return x.replace(nsregex2,"<$1")}var encodings={""":'"',"'":"'",">":">","<":"<","&":"&"};var rencoding=evert(encodings);var rencstr="&<>'\"".split("");var unescapexml=function(){var encregex=/&[a-z]*;/g,coderegex=/_x([\da-fA-F]+)_/g;return function unescapexml(text){var s=text+"";return s.replace(encregex,function($$){return encodings[$$]}).replace(coderegex,function(m,c){return String.fromCharCode(parseInt(c,16))})}}();var decregex=/[&<>'"]/g,charegex=/[\u0000-\u0008\u000b-\u001f]/g;function escapexml(text){var s=text+"";return s.replace(decregex,function(y){return rencoding[y]}).replace(charegex,function(s){return"_x"+("000"+s.charCodeAt(0).toString(16)).substr(-4)+"_"})}var xlml_fixstr=function(){var entregex=/&#(\d+);/g;function entrepl($$,$1){return String.fromCharCode(parseInt($1,10))}return function xlml_fixstr(str){return str.replace(entregex,entrepl)}}();function parsexmlbool(value,tag){switch(value){case"1":case"true":case"TRUE":return true;default:return false}}var utf8read=function utf8reada(orig){var out="",i=0,c=0,d=0,e=0,f=0,w=0;while(i<orig.length){c=orig.charCodeAt(i++);if(c<128){out+=String.fromCharCode(c);continue}d=orig.charCodeAt(i++);if(c>191&&c<224){out+=String.fromCharCode((c&31)<<6|d&63);continue}e=orig.charCodeAt(i++);if(c<240){out+=String.fromCharCode((c&15)<<12|(d&63)<<6|e&63);continue}f=orig.charCodeAt(i++);w=((c&7)<<18|(d&63)<<12|(e&63)<<6|f&63)-65536;out+=String.fromCharCode(55296+(w>>>10&1023));out+=String.fromCharCode(56320+(w&1023))}return out};if(has_buf){var utf8readb=function utf8readb(data){var out=new Buffer(2*data.length),w,i,j=1,k=0,ww=0,c;for(i=0;i<data.length;i+=j){j=1;if((c=data.charCodeAt(i))<128)w=c;else if(c<224){w=(c&31)*64+(data.charCodeAt(i+1)&63);j=2}else if(c<240){w=(c&15)*4096+(data.charCodeAt(i+1)&63)*64+(data.charCodeAt(i+2)&63);j=3}else{j=4;w=(c&7)*262144+(data.charCodeAt(i+1)&63)*4096+(data.charCodeAt(i+2)&63)*64+(data.charCodeAt(i+3)&63);w-=65536;ww=55296+(w>>>10&1023);w=56320+(w&1023)}if(ww!==0){out[k++]=ww&255;out[k++]=ww>>>8;ww=0}out[k++]=w%256;out[k++]=w>>>8}out.length=k;return out.toString("ucs2")};var corpus="foo bar bazâð£";if(utf8read(corpus)==utf8readb(corpus))utf8read=utf8readb;var utf8readc=function utf8readc(data){return Buffer(data,"binary").toString("utf8")};if(utf8read(corpus)==utf8readc(corpus))utf8read=utf8readc}var matchtag=function(){var mtcache={};return function matchtag(f,g){var t=f+"|"+g;if(mtcache[t]!==undefined)return mtcache[t];return mtcache[t]=new RegExp("<(?:\\w+:)?"+f+'(?: xml:space="preserve")?(?:[^>]*)>([^☃]*)</(?:\\w+:)?'+f+">",g||"")}}();var vtregex=function(){var vt_cache={};return function vt_regex(bt){if(vt_cache[bt]!==undefined)return vt_cache[bt];return vt_cache[bt]=new RegExp("<vt:"+bt+">(.*?)</vt:"+bt+">","g")}}();var vtvregex=/<\/?vt:variant>/g,vtmregex=/<vt:([^>]*)>(.*)</;function parseVector(data){var h=parsexmltag(data);var matches=data.match(vtregex(h.baseType))||[];if(matches.length!=h.size)throw"unexpected vector length "+matches.length+" != "+h.size;var res=[];matches.forEach(function(x){var v=x.replace(vtvregex,"").match(vtmregex);res.push({v:v[2],t:v[1]})});return res}var wtregex=/(^\s|\s$|\n)/;function writetag(f,g){return"<"+f+(g.match(wtregex)?' xml:space="preserve"':"")+">"+g+"</"+f+">"}function wxt_helper(h){return keys(h).map(function(k){return" "+k+'="'+h[k]+'"'}).join("")}function writextag(f,g,h){return"<"+f+(isval(h)?wxt_helper(h):"")+(isval(g)?(g.match(wtregex)?' xml:space="preserve"':"")+">"+g+"</"+f:"/")+">"}function write_w3cdtf(d,t){try{return d.toISOString().replace(/\.\d*/,"")}catch(e){if(t)throw e}}function write_vt(s){switch(typeof s){case"string":return writextag("vt:lpwstr",s);case"number":return writextag((s|0)==s?"vt:i4":"vt:r8",String(s));case"boolean":return writextag("vt:bool",s?"true":"false")}if(s instanceof Date)return writextag("vt:filetime",write_w3cdtf(s));throw new Error("Unable to serialize "+s)}var XML_HEADER='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';var XMLNS={dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",mx:"http://schemas.microsoft.com/office/mac/excel/2008/main",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",sjs:"http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"};XMLNS.main=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"];function readIEEE754(buf,idx,isLE,nl,ml){if(isLE===undefined)isLE=true;if(!nl)nl=8;if(!ml&&nl===8)ml=52;var e,m,el=nl*8-ml-1,eMax=(1<<el)-1,eBias=eMax>>1;var bits=-7,d=isLE?-1:1,i=isLE?nl-1:0,s=buf[idx+i];i+=d;e=s&(1<<-bits)-1;s>>>=-bits;bits+=el;for(;bits>0;e=e*256+buf[idx+i],i+=d,bits-=8);m=e&(1<<-bits)-1;e>>>=-bits;bits+=ml;for(;bits>0;m=m*256+buf[idx+i],i+=d,bits-=8);if(e===eMax)return m?NaN:(s?-1:1)*Infinity;else if(e===0)e=1-eBias;else{m=m+Math.pow(2,ml);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-ml)}var __toBuffer,___toBuffer;__toBuffer=___toBuffer=function toBuffer_(bufs){var x=[];for(var i=0;i<bufs[0].length;++i){x.push.apply(x,bufs[0][i])}return x};var __utf16le,___utf16le;__utf16le=___utf16le=function utf16le_(b,s,e){var ss=[];for(var i=s;i<e;i+=2)ss.push(String.fromCharCode(__readUInt16LE(b,i)));return ss.join("")};var __hexlify,___hexlify;__hexlify=___hexlify=function hexlify_(b,s,l){return b.slice(s,s+l).map(function(x){return(x<16?"0":"")+x.toString(16)}).join("")};var __utf8,___utf8;__utf8=___utf8=function(b,s,e){var ss=[];for(var i=s;i<e;i++)ss.push(String.fromCharCode(__readUInt8(b,i)));return ss.join("")};var __lpstr,___lpstr;__lpstr=___lpstr=function lpstr_(b,i){var len=__readUInt32LE(b,i);return len>0?__utf8(b,i+4,i+4+len-1):""};var __lpwstr,___lpwstr;__lpwstr=___lpwstr=function lpwstr_(b,i){var len=2*__readUInt32LE(b,i);return len>0?__utf8(b,i+4,i+4+len-1):""};var __double,___double;__double=___double=function(b,idx){return readIEEE754(b,idx)};var is_buf=function is_buf_a(a){return Array.isArray(a)};if(has_buf){__utf16le=function utf16le_b(b,s,e){if(!Buffer.isBuffer(b))return ___utf16le(b,s,e);return b.toString("utf16le",s,e)};__hexlify=function(b,s,l){return Buffer.isBuffer(b)?b.toString("hex",s,s+l):___hexlify(b,s,l)};__lpstr=function lpstr_b(b,i){if(!Buffer.isBuffer(b))return ___lpstr(b,i);var len=b.readUInt32LE(i);return len>0?b.toString("utf8",i+4,i+4+len-1):""};__lpwstr=function lpwstr_b(b,i){if(!Buffer.isBuffer(b))return ___lpwstr(b,i);var len=2*b.readUInt32LE(i);return b.toString("utf16le",i+4,i+4+len-1)};__utf8=function utf8_b(s,e){return this.toString("utf8",s,e)};__toBuffer=function(bufs){return bufs[0].length>0&&Buffer.isBuffer(bufs[0][0])?Buffer.concat(bufs[0]):___toBuffer(bufs)};bconcat=function(bufs){return Buffer.isBuffer(bufs[0])?Buffer.concat(bufs):[].concat.apply([],bufs)};__double=function double_(b,i){if(Buffer.isBuffer(b))return b.readDoubleLE(i);return ___double(b,i)};is_buf=function is_buf_b(a){return Buffer.isBuffer(a)||Array.isArray(a)}}if(typeof cptable!=="undefined"){__utf16le=function(b,s,e){return cptable.utils.decode(1200,b.slice(s,e))};__utf8=function(b,s,e){return cptable.utils.decode(65001,b.slice(s,e))};__lpstr=function(b,i){var len=__readUInt32LE(b,i);return len>0?cptable.utils.decode(current_codepage,b.slice(i+4,i+4+len-1)):""};__lpwstr=function(b,i){var len=2*__readUInt32LE(b,i);return len>0?cptable.utils.decode(1200,b.slice(i+4,i+4+len-1)):""}}var __readUInt8=function(b,idx){return b[idx]};var __readUInt16LE=function(b,idx){return b[idx+1]*(1<<8)+b[idx]};var __readInt16LE=function(b,idx){var u=b[idx+1]*(1<<8)+b[idx];return u<32768?u:(65535-u+1)*-1};var __readUInt32LE=function(b,idx){return b[idx+3]*(1<<24)+(b[idx+2]<<16)+(b[idx+1]<<8)+b[idx]};var __readInt32LE=function(b,idx){return b[idx+3]<<24|b[idx+2]<<16|b[idx+1]<<8|b[idx]};var ___unhexlify=function(s){return s.match(/../g).map(function(x){return parseInt(x,16)})};var __unhexlify=typeof Buffer!=="undefined"?function(s){return Buffer.isBuffer(s)?new Buffer(s,"hex"):___unhexlify(s)}:___unhexlify;function ReadShift(size,t){var o="",oI,oR,oo=[],w,vv,i,loc;switch(t){case"dbcs":loc=this.l;if(has_buf&&Buffer.isBuffer(this))o=this.slice(this.l,this.l+2*size).toString("utf16le");else for(i=0;i!=size;++i){o+=String.fromCharCode(__readUInt16LE(this,loc));loc+=2}size*=2;break;case"utf8":o=__utf8(this,this.l,this.l+size);break;case"utf16le":size*=2;o=__utf16le(this,this.l,this.l+size);break;case"lpstr":o=__lpstr(this,this.l);size=5+o.length;break;case"lpwstr":o=__lpwstr(this,this.l);size=5+o.length;if(o[o.length-1]=="\x00")size+=2;break;case"cstr":size=0;o="";while((w=__readUInt8(this,this.l+size++))!==0)oo.push(_getchar(w));o=oo.join("");break;case"wstr":size=0;o="";while((w=__readUInt16LE(this,this.l+size))!==0){oo.push(_getchar(w));size+=2}size+=2;o=oo.join("");break;case"dbcs-cont":o="";loc=this.l;for(i=0;i!=size;++i){if(this.lens&&this.lens.indexOf(loc)!==-1){w=__readUInt8(this,loc);this.l=loc+1;vv=ReadShift.call(this,size-i,w?"dbcs-cont":"sbcs-cont");return oo.join("")+vv}oo.push(_getchar(__readUInt16LE(this,loc)));loc+=2}o=oo.join("");size*=2;break;case"sbcs-cont":o="";loc=this.l;for(i=0;i!=size;++i){if(this.lens&&this.lens.indexOf(loc)!==-1){w=__readUInt8(this,loc);this.l=loc+1;vv=ReadShift.call(this,size-i,w?"dbcs-cont":"sbcs-cont");return oo.join("")+vv}oo.push(_getchar(__readUInt8(this,loc)));loc+=1}o=oo.join("");break;default:switch(size){case 1:oI=__readUInt8(this,this.l);this.l++;return oI;case 2:oI=(t==="i"?__readInt16LE:__readUInt16LE)(this,this.l);this.l+=2;return oI;case 4:if(t==="i"||(this[this.l+3]&128)===0){oI=__readInt32LE(this,this.l);this.l+=4;return oI}else{oR=__readUInt32LE(this,this.l);this.l+=4;return oR}break;case 8:if(t==="f"){oR=__double(this,this.l);this.l+=8;return oR}case 16:o=__hexlify(this,this.l,size);break}}this.l+=size;return o}function WriteShift(t,val,f){var size,i;if(f==="dbcs"){for(i=0;i!=val.length;++i)this.writeUInt16LE(val.charCodeAt(i),this.l+2*i);size=2*val.length}else switch(t){case 1:size=1;this[this.l]=val&255;break;case 3:size=3;this[this.l+2]=val&255;val>>>=8;+ this[this.l+1]=val&255;val>>>=8;this[this.l]=val&255;break;case 4:size=4;this.writeUInt32LE(val,this.l);break;case 8:size=8;if(f==="f"){this.writeDoubleLE(val,this.l);break}case 16:break;case-4:size=4;this.writeInt32LE(val,this.l);break}this.l+=size;return this}function CheckField(hexstr,fld){var m=__hexlify(this,this.l,hexstr.length>>1);if(m!==hexstr)throw fld+"Expected "+hexstr+" saw "+m;this.l+=hexstr.length>>1}function prep_blob(blob,pos){blob.l=pos;blob.read_shift=ReadShift;blob.chk=CheckField;blob.write_shift=WriteShift}function parsenoop(blob,length){blob.l+=length}function writenoop(blob,length){blob.l+=length}function new_buf(sz){var o=new_raw_buf(sz);prep_blob(o,0);return o}function recordhopper(data,cb,opts){var tmpbyte,cntbyte,length;prep_blob(data,data.l||0);while(data.l<data.length){var RT=data.read_shift(1);if(RT&128)RT=(RT&127)+((data.read_shift(1)&127)<<7);var R=XLSBRecordEnum[RT]||XLSBRecordEnum[65535];tmpbyte=data.read_shift(1);length=tmpbyte&127;for(cntbyte=1;cntbyte<4&&tmpbyte&128;++cntbyte)length+=((tmpbyte=data.read_shift(1))&127)<<7*cntbyte;var d=R.f(data,length,opts);if(cb(d,R,RT))return}}function buf_array(){var bufs=[],blksz=2048;var newblk=function ba_newblk(sz){var o=new_buf(sz);prep_blob(o,0);return o};var curbuf=newblk(blksz);var endbuf=function ba_endbuf(){curbuf.length=curbuf.l;if(curbuf.length>0)bufs.push(curbuf);curbuf=null};var next=function ba_next(sz){if(sz<curbuf.length-curbuf.l)return curbuf;endbuf();return curbuf=newblk(Math.max(sz+1,blksz))};var end=function ba_end(){endbuf();return __toBuffer([bufs])};var push=function ba_push(buf){endbuf();curbuf=buf;next(blksz)};return{next:next,push:push,end:end,_bufs:bufs}}function write_record(ba,type,payload,length){var t=evert_RE[type],l;if(!length)length=XLSBRecordEnum[t].p||(payload||[]).length||0;l=1+(t>=128?1:0)+1+length;if(length>=128)++l;if(length>=16384)++l;if(length>=2097152)++l;var o=ba.next(l);if(t<=127)o.write_shift(1,t);else{o.write_shift(1,(t&127)+128);o.write_shift(1,t>>7)}for(var i=0;i!=4;++i){if(length>=128){o.write_shift(1,(length&127)+128);length>>=7}else{o.write_shift(1,length);break}}if(length>0&&is_buf(payload))ba.push(payload)}function shift_cell_xls(cell,tgt){if(tgt.s){if(cell.cRel)cell.c+=tgt.s.c;if(cell.rRel)cell.r+=tgt.s.r}else{cell.c+=tgt.c;cell.r+=tgt.r}cell.cRel=cell.rRel=0;while(cell.c>=256)cell.c-=256;while(cell.r>=65536)cell.r-=65536;return cell}function shift_range_xls(cell,range){cell.s=shift_cell_xls(cell.s,range.s);cell.e=shift_cell_xls(cell.e,range.s);return cell}var OFFCRYPTO={};var make_offcrypto=function(O,_crypto){var crypto;if(typeof _crypto!=="undefined")crypto=_crypto;else if(typeof require!=="undefined"){try{crypto=require("cry"+"pto")}catch(e){crypto=null}}O.rc4=function(key,data){var S=new Array(256);var c=0,i=0,j=0,t=0;for(i=0;i!=256;++i)S[i]=i;for(i=0;i!=256;++i){j=j+S[i]+key[i%key.length].charCodeAt(0)&255;t=S[i];S[i]=S[j];S[j]=t}i=j=0;out=Buffer(data.length);for(c=0;c!=data.length;++c){i=i+1&255;j=(j+S[i])%256;t=S[i];S[i]=S[j];S[j]=t;out[c]=data[c]^S[S[i]+S[j]&255]}return out};if(crypto){O.md5=function(hex){return crypto.createHash("md5").update(hex).digest("hex")}}else{O.md5=function(hex){throw"unimplemented"}}};make_offcrypto(OFFCRYPTO,typeof crypto!=="undefined"?crypto:undefined);function parse_StrRun(data,length){return{ich:data.read_shift(2),ifnt:data.read_shift(2)}}function parse_RichStr(data,length){var start=data.l;var flags=data.read_shift(1);var str=parse_XLWideString(data);var rgsStrRun=[];var z={t:str,h:str};if((flags&1)!==0){var dwSizeStrRun=data.read_shift(4);for(var i=0;i!=dwSizeStrRun;++i)rgsStrRun.push(parse_StrRun(data));z.r=rgsStrRun}else z.r="<t>"+escapexml(str)+"</t>";if((flags&2)!==0){}data.l=start+length;return z}function write_RichStr(str,o){if(o==null)o=new_buf(5+2*str.t.length);o.write_shift(1,0);write_XLWideString(str.t,o);return o}function parse_XLSBCell(data){var col=data.read_shift(4);var iStyleRef=data.read_shift(2);iStyleRef+=data.read_shift(1)<<16;var fPhShow=data.read_shift(1);return{c:col,iStyleRef:iStyleRef}}function write_XLSBCell(cell,o){if(o==null)o=new_buf(8);o.write_shift(-4,cell.c);o.write_shift(3,cell.iStyleRef===undefined?cell.iStyleRef:cell.s);o.write_shift(1,0);return o}function parse_XLSBCodeName(data,length){return parse_XLWideString(data,length)}function parse_XLNullableWideString(data){var cchCharacters=data.read_shift(4);return cchCharacters===0||cchCharacters===4294967295?"":data.read_shift(cchCharacters,"dbcs")}function write_XLNullableWideString(data,o){if(!o)o=new_buf(127);o.write_shift(4,data.length>0?data.length:4294967295);if(data.length>0)o.write_shift(0,data,"dbcs");return o}function parse_XLWideString(data){var cchCharacters=data.read_shift(4);return cchCharacters===0?"":data.read_shift(cchCharacters,"dbcs")}function write_XLWideString(data,o){if(o==null)o=new_buf(4+2*data.length);o.write_shift(4,data.length);if(data.length>0)o.write_shift(0,data,"dbcs");return o}var parse_RelID=parse_XLNullableWideString;var write_RelID=write_XLNullableWideString;function parse_RkNumber(data){var b=data.slice(data.l,data.l+4);var fX100=b[0]&1,fInt=b[0]&2;data.l+=4;b[0]&=252;var RK=fInt===0?__double([0,0,0,0,b[0],b[1],b[2],b[3]],0):__readInt32LE(b,0)>>2;return fX100?RK/100:RK}function parse_UncheckedRfX(data){var cell={s:{},e:{}};cell.s.r=data.read_shift(4);cell.e.r=data.read_shift(4);cell.s.c=data.read_shift(4);cell.e.c=data.read_shift(4);return cell}function write_UncheckedRfX(r,o){if(!o)o=new_buf(16);o.write_shift(4,r.s.r);o.write_shift(4,r.e.r);o.write_shift(4,r.s.c);o.write_shift(4,r.e.c);return o}function parse_Xnum(data,length){return data.read_shift(8,"f")}function write_Xnum(data,o){return(o||new_buf(8)).write_shift(8,"f",data)}var BErr={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"};var RBErr=evert_num(BErr);function parse_BrtColor(data,length){var out={};var d=data.read_shift(1);out.fValidRGB=d&1;out.xColorType=d>>>1;out.index=data.read_shift(1);out.nTintAndShade=data.read_shift(2,"i");out.bRed=data.read_shift(1);out.bGreen=data.read_shift(1);out.bBlue=data.read_shift(1);out.bAlpha=data.read_shift(1)}function parse_FontFlags(data,length){var d=data.read_shift(1);data.l++;var out={fItalic:d&2,fStrikeout:d&8,fOutline:d&16,fShadow:d&32,fCondense:d&64,fExtend:d&128};return out}{var VT_EMPTY=0;var VT_NULL=1;var VT_I2=2;var VT_I4=3;var VT_R4=4;var VT_R8=5;var VT_CY=6;var VT_DATE=7;var VT_BSTR=8;var VT_ERROR=10;var VT_BOOL=11;var VT_VARIANT=12;var VT_DECIMAL=14;var VT_I1=16;var VT_UI1=17;var VT_UI2=18;var VT_UI4=19;var VT_I8=20;var VT_UI8=21;var VT_INT=22;var VT_UINT=23;var VT_LPSTR=30;var VT_LPWSTR=31;var VT_FILETIME=64;var VT_BLOB=65;var VT_STREAM=66;var VT_STORAGE=67;var VT_STREAMED_Object=68;var VT_STORED_Object=69;var VT_BLOB_Object=70;var VT_CF=71;var VT_CLSID=72;var VT_VERSIONED_STREAM=73;var VT_VECTOR=4096;var VT_ARRAY=8192;var VT_STRING=80;var VT_USTR=81;var VT_CUSTOM=[VT_STRING,VT_USTR]}var DocSummaryPIDDSI={1:{n:"CodePage",t:VT_I2},2:{n:"Category",t:VT_STRING},3:{n:"PresentationFormat",t:VT_STRING},4:{n:"ByteCount",t:VT_I4},5:{n:"LineCount",t:VT_I4},6:{n:"ParagraphCount",t:VT_I4},7:{n:"SlideCount",t:VT_I4},8:{n:"NoteCount",t:VT_I4},9:{n:"HiddenCount",t:VT_I4},10:{n:"MultimediaClipCount",t:VT_I4},11:{n:"Scale",t:VT_BOOL},12:{n:"HeadingPair",t:VT_VECTOR|VT_VARIANT},13:{n:"DocParts",t:VT_VECTOR|VT_LPSTR},14:{n:"Manager",t:VT_STRING},15:{n:"Company",t:VT_STRING},16:{n:"LinksDirty",t:VT_BOOL},17:{n:"CharacterCount",t:VT_I4},19:{n:"SharedDoc",t:VT_BOOL},22:{n:"HLinksChanged",t:VT_BOOL},23:{n:"AppVersion",t:VT_I4,p:"version"},26:{n:"ContentType",t:VT_STRING},27:{n:"ContentStatus",t:VT_STRING},28:{n:"Language",t:VT_STRING},29:{n:"Version",t:VT_STRING},255:{}};var SummaryPIDSI={1:{n:"CodePage",t:VT_I2},2:{n:"Title",t:VT_STRING},3:{n:"Subject",t:VT_STRING},4:{n:"Author",t:VT_STRING},5:{n:"Keywords",t:VT_STRING},6:{n:"Comments",t:VT_STRING},7:{n:"Template",t:VT_STRING},8:{n:"LastAuthor",t:VT_STRING},9:{n:"RevNumber",t:VT_STRING},10:{n:"EditTime",t:VT_FILETIME},11:{n:"LastPrinted",t:VT_FILETIME},12:{n:"CreatedDate",t:VT_FILETIME},13:{n:"ModifiedDate",t:VT_FILETIME},14:{n:"PageCount",t:VT_I4},15:{n:"WordCount",t:VT_I4},16:{n:"CharCount",t:VT_I4},17:{n:"Thumbnail",t:VT_CF},18:{n:"ApplicationName",t:VT_LPSTR},19:{n:"DocumentSecurity",t:VT_I4},255:{}};var SpecialProperties={2147483648:{n:"Locale",t:VT_UI4},2147483651:{n:"Behavior",t:VT_UI4},1919054434:{}};(function(){for(var y in SpecialProperties)if(SpecialProperties.hasOwnProperty(y))DocSummaryPIDDSI[y]=SummaryPIDSI[y]=SpecialProperties[y]})();var CountryEnum={1:"US",2:"CA",3:"",7:"RU",20:"EG",30:"GR",31:"NL",32:"BE",33:"FR",34:"ES",36:"HU",39:"IT",41:"CH",43:"AT",44:"GB",45:"DK",46:"SE",47:"NO",48:"PL",49:"DE",52:"MX",55:"BR",61:"AU",64:"NZ",66:"TH",81:"JP",82:"KR",84:"VN",86:"CN",90:"TR",105:"JS",213:"DZ",216:"MA",218:"LY",351:"PT",354:"IS",358:"FI",420:"CZ",886:"TW",961:"LB",962:"JO",963:"SY",964:"IQ",965:"KW",966:"SA",971:"AE",972:"IL",974:"QA",981:"IR",65535:"US"};var XLSFillPattern=[null,"solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"];function rgbify(arr){return arr.map(function(x){return[x>>16&255,x>>8&255,x&255]})}var XLSIcv=rgbify([0,16777215,16711680,65280,255,16776960,16711935,65535,0,16777215,16711680,65280,255,16776960,16711935,65535,8388608,32768,128,8421376,8388736,32896,12632256,8421504,10066431,10040166,16777164,13434879,6684774,16744576,26316,13421823,128,16711935,16776960,65535,8388736,8388608,32896,255,52479,13434879,13434828,16777113,10079487,16751052,13408767,16764057,3368703,3394764,10079232,16763904,16750848,16737792,6710937,9868950,13158,3381606,13056,3355392,10040064,10040166,3355545,3355443,16777215,0]);var ct2type={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":"workbooks","application/vnd.ms-excel.binIndexWs":"TODO","application/vnd.ms-excel.chartsheet":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":"TODO","application/vnd.ms-excel.dialogsheet":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":"TODO","application/vnd.ms-excel.macrosheet":"TODO","application/vnd.ms-excel.macrosheet+xml":"TODO","application/vnd.ms-excel.intlmacrosheet":"TODO","application/vnd.ms-excel.binIndexMs":"TODO","application/vnd.openxmlformats-package.core-properties+xml":"coreprops","application/vnd.openxmlformats-officedocument.custom-properties+xml":"custprops","application/vnd.openxmlformats-officedocument.extended-properties+xml":"extprops","application/vnd.openxmlformats-officedocument.customXmlProperties+xml":"TODO","application/vnd.ms-excel.comments":"comments","application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":"comments","application/vnd.ms-excel.pivotTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml":"TODO","application/vnd.ms-excel.calcChain":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings":"TODO","application/vnd.ms-office.activeX":"TODO","application/vnd.ms-office.activeX+xml":"TODO","application/vnd.ms-excel.attachedToolbars":"TODO","application/vnd.ms-excel.connections":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":"TODO","application/vnd.ms-excel.externalLink":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":"TODO","application/vnd.ms-excel.sheetMetadata":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":"TODO","application/vnd.ms-excel.pivotCacheDefinition":"TODO","application/vnd.ms-excel.pivotCacheRecords":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml":"TODO","application/vnd.ms-excel.queryTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml":"TODO","application/vnd.ms-excel.userNames":"TODO","application/vnd.ms-excel.revisionHeaders":"TODO","application/vnd.ms-excel.revisionLog":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml":"TODO","application/vnd.ms-excel.tableSingleCells":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml":"TODO","application/vnd.ms-excel.slicer":"TODO","application/vnd.ms-excel.slicerCache":"TODO","application/vnd.ms-excel.slicer+xml":"TODO","application/vnd.ms-excel.slicerCache+xml":"TODO","application/vnd.ms-excel.wsSortMap":"TODO","application/vnd.ms-excel.table":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":"TODO","application/vnd.openxmlformats-officedocument.theme+xml":"themes","application/vnd.ms-excel.Timeline+xml":"TODO","application/vnd.ms-excel.TimelineCache+xml":"TODO","application/vnd.ms-office.vbaProject":"vba","application/vnd.ms-office.vbaProjectSignature":"vba","application/vnd.ms-office.volatileDependencies":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml":"TODO","application/vnd.ms-excel.controlproperties+xml":"TODO","application/vnd.openxmlformats-officedocument.model+data":"TODO","application/vnd.ms-excel.Survey+xml":"TODO","application/vnd.openxmlformats-officedocument.drawing+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chart+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml":"TODO","application/vnd.openxmlformats-officedocument.vmlDrawing":"TODO","application/vnd.openxmlformats-package.relationships+xml":"rels","application/vnd.openxmlformats-officedocument.oleObject":"TODO",sheet:"js"};var CT_LIST=function(){var o={workbooks:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};keys(o).forEach(function(k){if(!o[k].xlsm)o[k].xlsm=o[k].xlsx});keys(o).forEach(function(k){keys(o[k]).forEach(function(v){ct2type[o[k][v]]=k})});return o}();var type2ct=evert_arr(ct2type);XMLNS.CT="http://schemas.openxmlformats.org/package/2006/content-types";function parse_ct(data,opts){var ctext={};if(!data||!data.match)return data;var ct={workbooks:[],sheets:[],calcchains:[],themes:[],styles:[],coreprops:[],extprops:[],custprops:[],strs:[],comments:[],vba:[],TODO:[],rels:[],xmlns:""};(data.match(tagregex)||[]).forEach(function(x){var y=parsexmltag(x);switch(y[0].replace(nsregex,"<")){case"<?xml":break;case"<Types":ct.xmlns=y["xmlns"+(y[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":ctext[y.Extension]=y.ContentType;break;case"<Override":if(ct[ct2type[y.ContentType]]!==undefined)ct[ct2type[y.ContentType]].push(y.PartName);else if(opts.WTF)console.error(y);break}});if(ct.xmlns!==XMLNS.CT)throw new Error("Unknown Namespace: "+ct.xmlns);ct.calcchain=ct.calcchains.length>0?ct.calcchains[0]:"";ct.sst=ct.strs.length>0?ct.strs[0]:"";ct.style=ct.styles.length>0?ct.styles[0]:"";ct.defaults=ctext;delete ct.calcchains;return ct}var CTYPE_XML_ROOT=writextag("Types",null,{xmlns:XMLNS.CT,"xmlns:xsd":XMLNS.xsd,"xmlns:xsi":XMLNS.xsi});var CTYPE_DEFAULTS=[["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["rels",type2ct.rels[0]]].map(function(x){return writextag("Default",null,{Extension:x[0],ContentType:x[1]})});function write_ct(ct,opts){var o=[],v;o[o.length]=XML_HEADER;o[o.length]=CTYPE_XML_ROOT;o=o.concat(CTYPE_DEFAULTS);var f1=function(w){if(ct[w]&&ct[w].length>0){v=ct[w][0];o[o.length]=writextag("Override",null,{PartName:(v[0]=="/"?"":"/")+v,ContentType:CT_LIST[w][opts.bookType||"xlsx"]})}};var f2=function(w){ct[w].forEach(function(v){o[o.length]=writextag("Override",null,{PartName:(v[0]=="/"?"":"/")+v,ContentType:CT_LIST[w][opts.bookType||"xlsx"]})})};var f3=function(t){(ct[t]||[]).forEach(function(v){o[o.length]=writextag("Override",null,{PartName:(v[0]=="/"?"":"/")+v,ContentType:type2ct[t][0]})})};f1("workbooks");f2("sheets");f3("themes");["strs","styles"].forEach(f1);["coreprops","extprops","custprops"].forEach(f3);if(o.length>2){o[o.length]="</Types>";o[1]=o[1].replace("/>",">")}return o.join("")}var RELS={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument"};function parse_rels(data,currentFilePath){if(!data)return data;if(currentFilePath.charAt(0)!=="/"){currentFilePath="/"+currentFilePath}var rels={};var hash={};var resolveRelativePathIntoAbsolute=function(to){var toksFrom=currentFilePath.split("/");toksFrom.pop();var toksTo=to.split("/");var reversed=[];while(toksTo.length!==0){var tokTo=toksTo.shift();if(tokTo===".."){toksFrom.pop()}else if(tokTo!=="."){toksFrom.push(tokTo)}}return toksFrom.join("/")};data.match(tagregex).forEach(function(x){var y=parsexmltag(x);if(y[0]==="<Relationship"){var rel={};rel.Type=y.Type;rel.Target=y.Target;rel.Id=y.Id;rel.TargetMode=y.TargetMode;var canonictarget=y.TargetMode==="External"?y.Target:resolveRelativePathIntoAbsolute(y.Target);rels[canonictarget]=rel;hash[y.Id]=rel}});rels["!id"]=hash;return rels}XMLNS.RELS="http://schemas.openxmlformats.org/package/2006/relationships";var RELS_ROOT=writextag("Relationships",null,{xmlns:XMLNS.RELS});function write_rels(rels){var o=[];o[o.length]=XML_HEADER;o[o.length]=RELS_ROOT;keys(rels["!id"]).forEach(function(rid){var rel=rels["!id"][rid];o[o.length]=writextag("Relationship",null,rel)});if(o.length>2){o[o.length]="</Relationships>";o[1]=o[1].replace("/>",">")}return o.join("")}var CORE_PROPS=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]];XMLNS.CORE_PROPS="http://schemas.openxmlformats.org/package/2006/metadata/core-properties";RELS.CORE_PROPS="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";var CORE_PROPS_REGEX=function(){var r=new Array(CORE_PROPS.length);for(var i=0;i<CORE_PROPS.length;++i){var f=CORE_PROPS[i];var g="(?:"+f[0].substr(0,f[0].indexOf(":"))+":)"+f[0].substr(f[0].indexOf(":")+1);r[i]=new RegExp("<"+g+"[^>]*>(.*)</"+g+">")}return r}();function parse_core_props(data){var p={};for(var i=0;i<CORE_PROPS.length;++i){var f=CORE_PROPS[i],cur=data.match(CORE_PROPS_REGEX[i]);if(cur!=null&&cur.length>0)p[f[1]]=cur[1];if(f[2]==="date"&&p[f[1]])p[f[1]]=new Date(p[f[1]])}return p}var CORE_PROPS_XML_ROOT=writextag("cp:coreProperties",null,{"xmlns:cp":XMLNS.CORE_PROPS,"xmlns:dc":XMLNS.dc,"xmlns:dcterms":XMLNS.dcterms,"xmlns:dcmitype":XMLNS.dcmitype,"xmlns:xsi":XMLNS.xsi});function cp_doit(f,g,h,o,p){if(p[f]!=null||g==null||g==="")return;p[f]=g;o[o.length]=h?writextag(f,g,h):writetag(f,g)}function write_core_props(cp,opts){var o=[XML_HEADER,CORE_PROPS_XML_ROOT],p={};if(opts&&opts.Props){if(opts.Props.title)o[o.length]="<dc:title>"+opts.Props.title+"</dc:title>";if(opts.Props.subject)o[o.length]="<dc:subject>"+opts.Props.subject+"</dc:subject>";if(opts.Props.creator)o[o.length]="<dc:creator>"+opts.Props.creator+"</dc:creator>";if(opts.Props.keywords)o[o.length]="<cp:keywords>"+opts.Props.keywords+"</cp:keywords>";if(opts.Props.description)o[o.length]="<dc:description>"+opts.Props.description+"</dc:description>"}if(cp){if(cp.CreatedDate!=null)cp_doit("dcterms:created",typeof cp.CreatedDate==="string"?cp.CreatedDate:write_w3cdtf(cp.CreatedDate,opts.WTF),{"xsi:type":"dcterms:W3CDTF"},o,p);if(cp.ModifiedDate!=null)cp_doit("dcterms:modified",typeof cp.ModifiedDate==="string"?cp.ModifiedDate:write_w3cdtf(cp.ModifiedDate,opts.WTF),{"xsi:type":"dcterms:W3CDTF"},o,p);for(var i=0;i!=CORE_PROPS.length;++i){var f=CORE_PROPS[i];cp_doit(f[0],cp[f[1]],null,o,p)}}if(o.length>2){o[o.length]="</cp:coreProperties>";o[1]=o[1].replace("/>",">")}return o.join("")}var EXT_PROPS=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]];XMLNS.EXT_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";RELS.EXT_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";function parse_ext_props(data,p){var q={};if(!p)p={};EXT_PROPS.forEach(function(f){switch(f[2]){case"string":p[f[1]]=(data.match(matchtag(f[0]))||[])[1];break;case"bool":p[f[1]]=(data.match(matchtag(f[0]))||[])[1]==="true";break;case"raw":var cur=data.match(new RegExp("<"+f[0]+"[^>]*>(.*)</"+f[0]+">"));if(cur&&cur.length>0)q[f[1]]=cur[1];break}});if(q.HeadingPairs&&q.TitlesOfParts){var v=parseVector(q.HeadingPairs);var j=0,widx=0;for(var i=0;i!==v.length;++i){switch(v[i].v){case"Worksheets":widx=j;p.Worksheets=+v[++i].v;break;case"Named Ranges":++i;break}}var parts=parseVector(q.TitlesOfParts).map(function(x){return utf8read(x.v)});p.SheetNames=parts.slice(widx,widx+p.Worksheets)}return p}var EXT_PROPS_XML_ROOT=writextag("Properties",null,{xmlns:XMLNS.EXT_PROPS,"xmlns:vt":XMLNS.vt});function write_ext_props(cp,opts){var o=[],p={},W=writextag;if(!cp)cp={};cp.Application="SheetJS";o[o.length]=XML_HEADER;o[o.length]=EXT_PROPS_XML_ROOT;EXT_PROPS.forEach(function(f){if(cp[f[1]]===undefined)return;var v;switch(f[2]){case"string":v=cp[f[1]];break;case"bool":v=cp[f[1]]?"true":"false";break}if(v!==undefined)o[o.length]=W(f[0],v)});o[o.length]=W("HeadingPairs",W("vt:vector",W("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+W("vt:variant",W("vt:i4",String(cp.Worksheets))),{size:2,baseType:"variant"}));o[o.length]=W("TitlesOfParts",W("vt:vector",cp.SheetNames.map(function(s){return"<vt:lpstr>"+s+"</vt:lpstr>"}).join(""),{size:cp.Worksheets,baseType:"lpstr"}));if(o.length>2){o[o.length]="</Properties>";o[1]=o[1].replace("/>",">")}return o.join("")}XMLNS.CUST_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties";RELS.CUST_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties";var custregex=/<[^>]+>[^<]*/g;function parse_cust_props(data,opts){var p={},name;var m=data.match(custregex);if(m)for(var i=0;i!=m.length;++i){var x=m[i],y=parsexmltag(x);switch(y[0]){case"<?xml":break;case"<Properties":if(y.xmlns!==XMLNS.CUST_PROPS)throw"unrecognized xmlns "+y.xmlns;if(y.xmlnsvt&&y.xmlnsvt!==XMLNS.vt)throw"unrecognized vt "+y.xmlnsvt;break;case"<property":name=y.name;break;case"</property>":name=null;break;default:if(x.indexOf("<vt:")===0){var toks=x.split(">");var type=toks[0].substring(4),text=toks[1];switch(type){case"lpstr":case"lpwstr":case"bstr":case"lpwstr":p[name]=unescapexml(text);break;case"bool":p[name]=parsexmlbool(text,"<vt:bool>");break;case"i1":case"i2":case"i4":case"i8":case"int":case"uint":p[name]=parseInt(text,10);break;case"r4":case"r8":case"decimal":p[name]=parseFloat(text);break;case"filetime":case"date":p[name]=new Date(text);break;case"cy":case"error":p[name]=unescapexml(text);break;default:if(typeof console!=="undefined")console.warn("Unexpected",x,type,toks)}}else if(x.substr(0,2)==="</"){}else if(opts.WTF)throw new Error(x)}}return p}var CUST_PROPS_XML_ROOT=writextag("Properties",null,{xmlns:XMLNS.CUST_PROPS,"xmlns:vt":XMLNS.vt});function write_cust_props(cp,opts){var o=[XML_HEADER,CUST_PROPS_XML_ROOT];if(!cp)return o.join("");var pid=1;keys(cp).forEach(function custprop(k){++pid;o[o.length]=writextag("property",write_vt(cp[k]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:pid,name:k})});if(o.length>2){o[o.length]="</Properties>";o[1]=o[1].replace("/>",">")}return o.join("")}function xlml_set_prop(Props,tag,val){switch(tag){case"Description":tag="Comments";break}Props[tag]=val}function parse_FILETIME(blob){var dwLowDateTime=blob.read_shift(4),dwHighDateTime=blob.read_shift(4);return new Date((dwHighDateTime/1e7*Math.pow(2,32)+dwLowDateTime/1e7-11644473600)*1e3).toISOString().replace(/\.000/,"")}function parse_lpstr(blob,type,pad){var str=blob.read_shift(0,"lpstr");if(pad)blob.l+=4-(str.length+1&3)&3;return str}function parse_lpwstr(blob,type,pad){var str=blob.read_shift(0,"lpwstr");if(pad)blob.l+=4-(str.length+1&3)&3;return str}function parse_VtStringBase(blob,stringType,pad){if(stringType===31)return parse_lpwstr(blob);return parse_lpstr(blob,stringType,pad)}function parse_VtString(blob,t,pad){return parse_VtStringBase(blob,t,pad===false?0:4)}function parse_VtUnalignedString(blob,t){if(!t)throw new Error("dafuq?");return parse_VtStringBase(blob,t,0)}function parse_VtVecUnalignedLpstrValue(blob){var length=blob.read_shift(4);var ret=[];for(var i=0;i!=length;++i)ret[i]=blob.read_shift(0,"lpstr");return ret}function parse_VtVecUnalignedLpstr(blob){return parse_VtVecUnalignedLpstrValue(blob)}function parse_VtHeadingPair(blob){var headingString=parse_TypedPropertyValue(blob,VT_USTR);var headerParts=parse_TypedPropertyValue(blob,VT_I4);return[headingString,headerParts]}function parse_VtVecHeadingPairValue(blob){var cElements=blob.read_shift(4);var out=[];for(var i=0;i!=cElements/2;++i)out.push(parse_VtHeadingPair(blob));return out}function parse_VtVecHeadingPair(blob){return parse_VtVecHeadingPairValue(blob)}function parse_dictionary(blob,CodePage){var cnt=blob.read_shift(4);var dict={};for(var j=0;j!=cnt;++j){var pid=blob.read_shift(4);var len=blob.read_shift(4);dict[pid]=blob.read_shift(len,CodePage===1200?"utf16le":"utf8").replace(chr0,"").replace(chr1,"!")}if(blob.l&3)blob.l=blob.l>>2+1<<2;return dict}function parse_BLOB(blob){var size=blob.read_shift(4);var bytes=blob.slice(blob.l,blob.l+size);if(size&3>0)blob.l+=4-(size&3)&3;return bytes}function parse_ClipboardData(blob){var o={};o.Size=blob.read_shift(4);blob.l+=o.Size;return o}function parse_VtVector(blob,cb){}function parse_TypedPropertyValue(blob,type,_opts){var t=blob.read_shift(2),ret,opts=_opts||{};blob.l+=2;if(type!==VT_VARIANT)if(t!==type&&VT_CUSTOM.indexOf(type)===-1)throw new Error("Expected type "+type+" saw "+t);switch(type===VT_VARIANT?t:type){case 2:ret=blob.read_shift(2,"i");if(!opts.raw)blob.l+=2;return ret;case 3:ret=blob.read_shift(4,"i");return ret;case 11:return blob.read_shift(4)!==0;case 19:ret=blob.read_shift(4);return ret;case 30:return parse_lpstr(blob,t,4).replace(chr0,"");case 31:return parse_lpwstr(blob);case 64:return parse_FILETIME(blob);case 65:return parse_BLOB(blob);case 71:return parse_ClipboardData(blob);case 80:return parse_VtString(blob,t,!opts.raw&&4).replace(chr0,"");case 81:return parse_VtUnalignedString(blob,t,4).replace(chr0,"");case 4108:return parse_VtVecHeadingPair(blob);case 4126:return parse_VtVecUnalignedLpstr(blob);default:throw new Error("TypedPropertyValue unrecognized type "+type+" "+t)}}function parse_PropertySet(blob,PIDSI){var start_addr=blob.l;var size=blob.read_shift(4);var NumProps=blob.read_shift(4);var Props=[],i=0;var CodePage=0;var Dictionary=-1,DictObj;for(i=0;i!=NumProps;++i){var PropID=blob.read_shift(4);var Offset=blob.read_shift(4);Props[i]=[PropID,Offset+start_addr]}var PropH={};for(i=0;i!=NumProps;++i){if(blob.l!==Props[i][1]){var fail=true;if(i>0&&PIDSI)switch(PIDSI[Props[i-1][0]].t){case 2:if(blob.l+2===Props[i][1]){blob.l+=2;fail=false}break;case 80:if(blob.l<=Props[i][1]){blob.l=Props[i][1];fail=false}break;case 4108:if(blob.l<=Props[i][1]){blob.l=Props[i][1];fail=false}break}if(!PIDSI&&blob.l<=Props[i][1]){fail=false;blob.l=Props[i][1]}if(fail)throw new Error("Read Error: Expected address "+Props[i][1]+" at "+blob.l+" :"+i)}if(PIDSI){var piddsi=PIDSI[Props[i][0]];PropH[piddsi.n]=parse_TypedPropertyValue(blob,piddsi.t,{raw:true});if(piddsi.p==="version")PropH[piddsi.n]=String(PropH[piddsi.n]>>16)+"."+String(PropH[piddsi.n]&65535);if(piddsi.n=="CodePage")switch(PropH[piddsi.n]){case 0:PropH[piddsi.n]=1252;case 1e4:case 1252:case 874:case 1250:case 1251:case 1253:case 1254:case 1255:case 1256:case 1257:case 1258:case 932:case 936:case 949:case 950:case 1200:case 1201:case 65e3:case-536:case 65001:case-535:set_cp(CodePage=PropH[piddsi.n]);break;default:throw new Error("Unsupported CodePage: "+PropH[piddsi.n])}}else{if(Props[i][0]===1){CodePage=PropH.CodePage=parse_TypedPropertyValue(blob,VT_I2);set_cp(CodePage);if(Dictionary!==-1){var oldpos=blob.l;blob.l=Props[Dictionary][1];DictObj=parse_dictionary(blob,CodePage);blob.l=oldpos}}else if(Props[i][0]===0){if(CodePage===0){Dictionary=i;blob.l=Props[i+1][1];continue}DictObj=parse_dictionary(blob,CodePage)}else{var name=DictObj[Props[i][0]];var val;switch(blob[blob.l]){case 65:blob.l+=4;val=parse_BLOB(blob);break;case 30:blob.l+=4;val=parse_VtString(blob,blob[blob.l-4]);break;case 31:blob.l+=4;val=parse_VtString(blob,blob[blob.l-4]);break;case 3:blob.l+=4;val=blob.read_shift(4,"i");break;case 19:blob.l+=4;val=blob.read_shift(4);break;case 5:blob.l+=4;val=blob.read_shift(8,"f");break;case 11:blob.l+=4;val=parsebool(blob,4);break;case 64:blob.l+=4;val=new Date(parse_FILETIME(blob));break;default:throw new Error("unparsed value: "+blob[blob.l])}PropH[name]=val}}}blob.l=start_addr+size;return PropH}function parse_PropertySetStream(file,PIDSI){var blob=file.content;prep_blob(blob,0);var NumSets,FMTID0,FMTID1,Offset0,Offset1;blob.chk("feff","Byte Order: ");var vers=blob.read_shift(2);var SystemIdentifier=blob.read_shift(4);blob.chk(CFB.utils.consts.HEADER_CLSID,"CLSID: ");NumSets=blob.read_shift(4);if(NumSets!==1&&NumSets!==2)throw"Unrecognized #Sets: "+NumSets;FMTID0=blob.read_shift(16);Offset0=blob.read_shift(4);if(NumSets===1&&Offset0!==blob.l)throw"Length mismatch";else if(NumSets===2){FMTID1=blob.read_shift(16);Offset1=blob.read_shift(4)}var PSet0=parse_PropertySet(blob,PIDSI);var rval={SystemIdentifier:SystemIdentifier};for(var y in PSet0)rval[y]=PSet0[y];rval.FMTID=FMTID0;if(NumSets===1)return rval;if(blob.l!==Offset1)throw"Length mismatch 2: "+blob.l+" !== "+Offset1;var PSet1;try{PSet1=parse_PropertySet(blob,null)}catch(e){}for(y in PSet1)rval[y]=PSet1[y];rval.FMTID=[FMTID0,FMTID1];return rval}function parsenoop2(blob,length){blob.read_shift(length);return null}function parslurp(blob,length,cb){var arr=[],target=blob.l+length;while(blob.l<target)arr.push(cb(blob,target-blob.l));if(target!==blob.l)throw new Error("Slurp error");return arr}function parslurp2(blob,length,cb){var arr=[],target=blob.l+length,len=blob.read_shift(2);+ while(len--!==0)arr.push(cb(blob,target-blob.l));if(target!==blob.l)throw new Error("Slurp error");return arr}function parsebool(blob,length){return blob.read_shift(length)===1}function parseuint16(blob){return blob.read_shift(2,"u")}function parseuint16a(blob,length){return parslurp(blob,length,parseuint16)}var parse_Boolean=parsebool;function parse_Bes(blob){var v=blob.read_shift(1),t=blob.read_shift(1);return t===1?v:v===1}function parse_ShortXLUnicodeString(blob,length,opts){var cch=blob.read_shift(1);var width=1,encoding="sbcs-cont";var cp=current_codepage;if(opts&&opts.biff>=8)current_codepage=1200;if(opts===undefined||opts.biff!==5){var fHighByte=blob.read_shift(1);if(fHighByte){width=2;encoding="dbcs-cont"}}var o=cch?blob.read_shift(cch,encoding):"";current_codepage=cp;return o}function parse_XLUnicodeRichExtendedString(blob){var cp=current_codepage;current_codepage=1200;var cch=blob.read_shift(2),flags=blob.read_shift(1);var fHighByte=flags&1,fExtSt=flags&4,fRichSt=flags&8;var width=1+(flags&1);var cRun,cbExtRst;var z={};if(fRichSt)cRun=blob.read_shift(2);if(fExtSt)cbExtRst=blob.read_shift(4);var encoding=flags&1?"dbcs-cont":"sbcs-cont";var msg=cch===0?"":blob.read_shift(cch,encoding);if(fRichSt)blob.l+=4*cRun;if(fExtSt)blob.l+=cbExtRst;z.t=msg;if(!fRichSt){z.raw="<t>"+z.t+"</t>";z.r=z.t}current_codepage=cp;return z}function parse_XLUnicodeStringNoCch(blob,cch,opts){var retval;var fHighByte=blob.read_shift(1);if(fHighByte===0){retval=blob.read_shift(cch,"sbcs-cont")}else{retval=blob.read_shift(cch,"dbcs-cont")}return retval}function parse_XLUnicodeString(blob,length,opts){var cch=blob.read_shift(opts!==undefined&&opts.biff>0&&opts.biff<8?1:2);if(cch===0){blob.l++;return""}return parse_XLUnicodeStringNoCch(blob,cch,opts)}function parse_XLUnicodeString2(blob,length,opts){if(opts.biff!==5&&opts.biff!==2)return parse_XLUnicodeString(blob,length,opts);var cch=blob.read_shift(1);if(cch===0){blob.l++;return""}return blob.read_shift(cch,"sbcs-cont")}var parse_ControlInfo=parsenoop;var parse_URLMoniker=function(blob,length){var len=blob.read_shift(4),start=blob.l;var extra=false;if(len>24){blob.l+=len-24;if(blob.read_shift(16)==="795881f43b1d7f48af2c825dc4852763")extra=true;blob.l=start}var url=blob.read_shift((extra?len-24:len)>>1,"utf16le").replace(chr0,"");if(extra)blob.l+=24;return url};var parse_FileMoniker=function(blob,length){var cAnti=blob.read_shift(2);var ansiLength=blob.read_shift(4);var ansiPath=blob.read_shift(ansiLength,"cstr");var endServer=blob.read_shift(2);var versionNumber=blob.read_shift(2);var cbUnicodePathSize=blob.read_shift(4);if(cbUnicodePathSize===0)return ansiPath.replace(/\\/g,"/");var cbUnicodePathBytes=blob.read_shift(4);var usKeyValue=blob.read_shift(2);var unicodePath=blob.read_shift(cbUnicodePathBytes>>1,"utf16le").replace(chr0,"");return unicodePath};var parse_HyperlinkMoniker=function(blob,length){var clsid=blob.read_shift(16);length-=16;switch(clsid){case"e0c9ea79f9bace118c8200aa004ba90b":return parse_URLMoniker(blob,length);case"0303000000000000c000000000000046":return parse_FileMoniker(blob,length);default:throw"unsupported moniker "+clsid}};var parse_HyperlinkString=function(blob,length){var len=blob.read_shift(4);var o=blob.read_shift(len,"utf16le").replace(chr0,"");return o};var parse_Hyperlink=function(blob,length){var end=blob.l+length;var sVer=blob.read_shift(4);if(sVer!==2)throw new Error("Unrecognized streamVersion: "+sVer);var flags=blob.read_shift(2);blob.l+=2;var displayName,targetFrameName,moniker,oleMoniker,location,guid,fileTime;if(flags&16)displayName=parse_HyperlinkString(blob,end-blob.l);if(flags&128)targetFrameName=parse_HyperlinkString(blob,end-blob.l);if((flags&257)===257)moniker=parse_HyperlinkString(blob,end-blob.l);if((flags&257)===1)oleMoniker=parse_HyperlinkMoniker(blob,end-blob.l);if(flags&8)location=parse_HyperlinkString(blob,end-blob.l);if(flags&32)guid=blob.read_shift(16);if(flags&64)fileTime=parse_FILETIME(blob,8);blob.l=end;var target=targetFrameName||moniker||oleMoniker;if(location)target+="#"+location;return{Target:target}};function parse_LongRGBA(blob,length){var r=blob.read_shift(1),g=blob.read_shift(1),b=blob.read_shift(1),a=blob.read_shift(1);return[r,g,b,a]}function parse_LongRGB(blob,length){var x=parse_LongRGBA(blob,length);x[3]=0;return x}function parse_XLSCell(blob,length){var rw=blob.read_shift(2);var col=blob.read_shift(2);var ixfe=blob.read_shift(2);return{r:rw,c:col,ixfe:ixfe}}function parse_frtHeader(blob){var rt=blob.read_shift(2);var flags=blob.read_shift(2);blob.l+=8;return{type:rt,flags:flags}}function parse_OptXLUnicodeString(blob,length,opts){return length===0?"":parse_XLUnicodeString2(blob,length,opts)}var HIDEOBJENUM=["SHOWALL","SHOWPLACEHOLDER","HIDEALL"];var parse_HideObjEnum=parseuint16;function parse_XTI(blob,length){var iSupBook=blob.read_shift(2),itabFirst=blob.read_shift(2,"i"),itabLast=blob.read_shift(2,"i");return[iSupBook,itabFirst,itabLast]}function parse_RkRec(blob,length){var ixfe=blob.read_shift(2);var RK=parse_RkNumber(blob);return[ixfe,RK]}function parse_AddinUdf(blob,length){blob.l+=4;length-=4;var l=blob.l+length;var udfName=parse_ShortXLUnicodeString(blob,length);var cb=blob.read_shift(2);l-=blob.l;if(cb!==l)throw"Malformed AddinUdf: padding = "+l+" != "+cb;blob.l+=cb;return udfName}function parse_Ref8U(blob,length){var rwFirst=blob.read_shift(2);var rwLast=blob.read_shift(2);var colFirst=blob.read_shift(2);var colLast=blob.read_shift(2);return{s:{c:colFirst,r:rwFirst},e:{c:colLast,r:rwLast}}}function parse_RefU(blob,length){var rwFirst=blob.read_shift(2);var rwLast=blob.read_shift(2);var colFirst=blob.read_shift(1);var colLast=blob.read_shift(1);return{s:{c:colFirst,r:rwFirst},e:{c:colLast,r:rwLast}}}var parse_Ref=parse_RefU;function parse_FtCmo(blob,length){blob.l+=4;var ot=blob.read_shift(2);var id=blob.read_shift(2);var flags=blob.read_shift(2);blob.l+=12;return[id,ot,flags]}function parse_FtNts(blob,length){var out={};blob.l+=4;blob.l+=16;out.fSharedNote=blob.read_shift(2);blob.l+=4;return out}function parse_FtCf(blob,length){var out={};blob.l+=4;blob.cf=blob.read_shift(2);return out}var FtTab={21:parse_FtCmo,19:parsenoop,18:function(blob,length){blob.l+=12},17:function(blob,length){blob.l+=8},16:parsenoop,15:parsenoop,13:parse_FtNts,12:function(blob,length){blob.l+=24},11:function(blob,length){blob.l+=10},10:function(blob,length){blob.l+=16},9:parsenoop,8:function(blob,length){blob.l+=6},7:parse_FtCf,6:function(blob,length){blob.l+=6},4:parsenoop,0:function(blob,length){blob.l+=4}};function parse_FtArray(blob,length,ot){var s=blob.l;var fts=[];while(blob.l<s+length){var ft=blob.read_shift(2);blob.l-=2;try{fts.push(FtTab[ft](blob,s+length-blob.l))}catch(e){blob.l=s+length;return fts}}if(blob.l!=s+length)blob.l=s+length;return fts}var parse_FontIndex=parseuint16;function parse_BOF(blob,length){var o={};o.BIFFVer=blob.read_shift(2);length-=2;switch(o.BIFFVer){case 1536:case 1280:case 2:case 7:break;default:throw"Unexpected BIFF Ver "+o.BIFFVer}blob.read_shift(length);return o}function parse_InterfaceHdr(blob,length){if(length===0)return 1200;var q;if((q=blob.read_shift(2))!==1200)throw"InterfaceHdr codePage "+q;return 1200}function parse_WriteAccess(blob,length,opts){if(opts.enc){blob.l+=length;return""}var l=blob.l;var UserName=parse_XLUnicodeString(blob,0,opts);blob.read_shift(length+l-blob.l);return UserName}function parse_BoundSheet8(blob,length,opts){var pos=blob.read_shift(4);var hidden=blob.read_shift(1)>>6;var dt=blob.read_shift(1);switch(dt){case 0:dt="Worksheet";break;case 1:dt="Macrosheet";break;case 2:dt="Chartsheet";break;case 6:dt="VBAModule";break}var name=parse_ShortXLUnicodeString(blob,0,opts);if(name.length===0)name="Sheet1";return{pos:pos,hs:hidden,dt:dt,name:name}}function parse_SST(blob,length){var cnt=blob.read_shift(4);var ucnt=blob.read_shift(4);var strs=[];for(var i=0;i!=ucnt;++i){strs.push(parse_XLUnicodeRichExtendedString(blob))}strs.Count=cnt;strs.Unique=ucnt;return strs}function parse_ExtSST(blob,length){var extsst={};extsst.dsst=blob.read_shift(2);blob.l+=length-2;return extsst}function parse_Row(blob,length){var rw=blob.read_shift(2),col=blob.read_shift(2),Col=blob.read_shift(2),rht=blob.read_shift(2);blob.read_shift(4);var flags=blob.read_shift(1);blob.read_shift(1);blob.read_shift(2);return{r:rw,c:col,cnt:Col-col}}function parse_ForceFullCalculation(blob,length){var header=parse_frtHeader(blob);if(header.type!=2211)throw"Invalid Future Record "+header.type;var fullcalc=blob.read_shift(4);return fullcalc!==0}var parse_CompressPictures=parsenoop2;function parse_RecalcId(blob,length){blob.read_shift(2);return blob.read_shift(4)}function parse_DefaultRowHeight(blob,length){var f=blob.read_shift(2),miyRw;miyRw=blob.read_shift(2);var fl={Unsynced:f&1,DyZero:(f&2)>>1,ExAsc:(f&4)>>2,ExDsc:(f&8)>>3};return[fl,miyRw]}function parse_Window1(blob,length){var xWn=blob.read_shift(2),yWn=blob.read_shift(2),dxWn=blob.read_shift(2),dyWn=blob.read_shift(2);var flags=blob.read_shift(2),iTabCur=blob.read_shift(2),iTabFirst=blob.read_shift(2);var ctabSel=blob.read_shift(2),wTabRatio=blob.read_shift(2);return{Pos:[xWn,yWn],Dim:[dxWn,dyWn],Flags:flags,CurTab:iTabCur,FirstTab:iTabFirst,Selected:ctabSel,TabRatio:wTabRatio}}function parse_Font(blob,length,opts){blob.l+=14;var name=parse_ShortXLUnicodeString(blob,0,opts);return name}function parse_LabelSst(blob,length){var cell=parse_XLSCell(blob);cell.isst=blob.read_shift(4);return cell}function parse_Label(blob,length,opts){var cell=parse_XLSCell(blob,6);var str=parse_XLUnicodeString(blob,length-6,opts);cell.val=str;return cell}function parse_Format(blob,length,opts){var ifmt=blob.read_shift(2);var fmtstr=parse_XLUnicodeString2(blob,0,opts);return[ifmt,fmtstr]}function parse_Dimensions(blob,length){var w=length===10?2:4;var r=blob.read_shift(w),R=blob.read_shift(w),c=blob.read_shift(2),C=blob.read_shift(2);blob.l+=2;return{s:{r:r,c:c},e:{r:R,c:C}}}function parse_RK(blob,length){var rw=blob.read_shift(2),col=blob.read_shift(2);var rkrec=parse_RkRec(blob);return{r:rw,c:col,ixfe:rkrec[0],rknum:rkrec[1]}}function parse_MulRk(blob,length){var target=blob.l+length-2;var rw=blob.read_shift(2),col=blob.read_shift(2);var rkrecs=[];while(blob.l<target)rkrecs.push(parse_RkRec(blob));if(blob.l!==target)throw"MulRK read error";var lastcol=blob.read_shift(2);if(rkrecs.length!=lastcol-col+1)throw"MulRK length mismatch";return{r:rw,c:col,C:lastcol,rkrec:rkrecs}}function parse_CellStyleXF(blob,length,style){var o={};var a=blob.read_shift(4),b=blob.read_shift(4);var c=blob.read_shift(4),d=blob.read_shift(2);o.patternType=XLSFillPattern[c>>26];o.icvFore=d&127;o.icvBack=d>>7&127;return o}function parse_CellXF(blob,length){return parse_CellStyleXF(blob,length,0)}function parse_StyleXF(blob,length){return parse_CellStyleXF(blob,length,1)}function parse_XF(blob,length){var o={};o.ifnt=blob.read_shift(2);o.ifmt=blob.read_shift(2);o.flags=blob.read_shift(2);o.fStyle=o.flags>>2&1;length-=6;o.data=parse_CellStyleXF(blob,length,o.fStyle);return o}function parse_Guts(blob,length){blob.l+=4;var out=[blob.read_shift(2),blob.read_shift(2)];if(out[0]!==0)out[0]--;if(out[1]!==0)out[1]--;if(out[0]>7||out[1]>7)throw"Bad Gutters: "+out;return out}function parse_BoolErr(blob,length){var cell=parse_XLSCell(blob,6);var val=parse_Bes(blob,2);cell.val=val;cell.t=val===true||val===false?"b":"e";return cell}function parse_Number(blob,length){var cell=parse_XLSCell(blob,6);var xnum=parse_Xnum(blob,8);cell.val=xnum;return cell}var parse_XLHeaderFooter=parse_OptXLUnicodeString;function parse_SupBook(blob,length,opts){var end=blob.l+length;var ctab=blob.read_shift(2);var cch=blob.read_shift(2);var virtPath;if(cch>=1&&cch<=255)virtPath=parse_XLUnicodeStringNoCch(blob,cch);var rgst=blob.read_shift(end-blob.l);opts.sbcch=cch;return[cch,ctab,virtPath,rgst]}function parse_ExternName(blob,length,opts){var flags=blob.read_shift(2);var body;var o={fBuiltIn:flags&1,fWantAdvise:flags>>>1&1,fWantPict:flags>>>2&1,fOle:flags>>>3&1,fOleLink:flags>>>4&1,cf:flags>>>5&1023,fIcon:flags>>>15&1};if(opts.sbcch===14849)body=parse_AddinUdf(blob,length-2);o.body=body||blob.read_shift(length-2);return o}function parse_Lbl(blob,length,opts){if(opts.biff<8)return parse_Label(blob,length,opts);var target=blob.l+length;var flags=blob.read_shift(2);var chKey=blob.read_shift(1);var cch=blob.read_shift(1);var cce=blob.read_shift(2);blob.l+=2;var itab=blob.read_shift(2);blob.l+=4;var name=parse_XLUnicodeStringNoCch(blob,cch,opts);var rgce=parse_NameParsedFormula(blob,target-blob.l,opts,cce);return{chKey:chKey,Name:name,rgce:rgce}}function parse_ExternSheet(blob,length,opts){if(opts.biff<8)return parse_ShortXLUnicodeString(blob,length,opts);var o=parslurp2(blob,length,parse_XTI);var oo=[];if(opts.sbcch===1025){for(var i=0;i!=o.length;++i)oo.push(opts.snames[o[i][1]]);return oo}else return o}function parse_ShrFmla(blob,length,opts){var ref=parse_RefU(blob,6);blob.l++;var cUse=blob.read_shift(1);length-=8;return[parse_SharedParsedFormula(blob,length,opts),cUse]}function parse_Array(blob,length,opts){var ref=parse_Ref(blob,6);blob.l+=6;length-=12;return[ref,parse_ArrayParsedFormula(blob,length,opts,ref)]}function parse_MTRSettings(blob,length){var fMTREnabled=blob.read_shift(4)!==0;var fUserSetThreadCount=blob.read_shift(4)!==0;var cUserThreadCount=blob.read_shift(4);return[fMTREnabled,fUserSetThreadCount,cUserThreadCount]}function parse_NoteSh(blob,length,opts){if(opts.biff<8)return;var row=blob.read_shift(2),col=blob.read_shift(2);var flags=blob.read_shift(2),idObj=blob.read_shift(2);var stAuthor=parse_XLUnicodeString2(blob,0,opts);if(opts.biff<8)blob.read_shift(1);return[{r:row,c:col},stAuthor,idObj,flags]}function parse_Note(blob,length,opts){return parse_NoteSh(blob,length,opts)}function parse_MergeCells(blob,length){var merges=[];var cmcs=blob.read_shift(2);while(cmcs--)merges.push(parse_Ref8U(blob,length));return merges}function parse_Obj(blob,length){var cmo=parse_FtCmo(blob,22);var fts=parse_FtArray(blob,length-22,cmo[1]);return{cmo:cmo,ft:fts}}function parse_TxO(blob,length,opts){var s=blob.l;try{blob.l+=4;var ot=(opts.lastobj||{cmo:[0,0]}).cmo[1];var controlInfo;if([0,5,7,11,12,14].indexOf(ot)==-1)blob.l+=6;else controlInfo=parse_ControlInfo(blob,6,opts);var cchText=blob.read_shift(2);var cbRuns=blob.read_shift(2);var ifntEmpty=parse_FontIndex(blob,2);var len=blob.read_shift(2);blob.l+=len;var texts="";for(var i=1;i<blob.lens.length-1;++i){if(blob.l-s!=blob.lens[i])throw"TxO: bad continue record";var hdr=blob[blob.l];var t=parse_XLUnicodeStringNoCch(blob,blob.lens[i+1]-blob.lens[i]-1);texts+=t;if(texts.length>=(hdr?cchText:2*cchText))break}if(texts.length!==cchText&&texts.length!==cchText*2){throw"cchText: "+cchText+" != "+texts.length}blob.l=s+length;return{t:texts}}catch(e){blob.l=s+length;return{t:texts||""}}}var parse_HLink=function(blob,length){var ref=parse_Ref8U(blob,8);blob.l+=16;var hlink=parse_Hyperlink(blob,length-24);return[ref,hlink]};var parse_HLinkTooltip=function(blob,length){var end=blob.l+length;blob.read_shift(2);var ref=parse_Ref8U(blob,8);var wzTooltip=blob.read_shift((length-10)/2,"dbcs-cont");wzTooltip=wzTooltip.replace(chr0,"");return[ref,wzTooltip]};function parse_Country(blob,length){var o=[],d;d=blob.read_shift(2);o[0]=CountryEnum[d]||d;d=blob.read_shift(2);o[1]=CountryEnum[d]||d;return o}function parse_ClrtClient(blob,length){var ccv=blob.read_shift(2);var o=[];while(ccv-->0)o.push(parse_LongRGB(blob,8));return o}function parse_Palette(blob,length){var ccv=blob.read_shift(2);var o=[];while(ccv-->0)o.push(parse_LongRGB(blob,8));return o}function parse_XFCRC(blob,length){blob.l+=2;var o={cxfs:0,crc:0};o.cxfs=blob.read_shift(2);o.crc=blob.read_shift(4);return o}var parse_Style=parsenoop;var parse_StyleExt=parsenoop;var parse_ColInfo=parsenoop;var parse_Window2=parsenoop;var parse_Backup=parsebool;var parse_Blank=parse_XLSCell;var parse_BottomMargin=parse_Xnum;var parse_BuiltInFnGroupCount=parseuint16;var parse_CalcCount=parseuint16;var parse_CalcDelta=parse_Xnum;var parse_CalcIter=parsebool;var parse_CalcMode=parseuint16;var parse_CalcPrecision=parsebool;var parse_CalcRefMode=parsenoop2;var parse_CalcSaveRecalc=parsebool;var parse_CodePage=parseuint16;var parse_Compat12=parsebool;var parse_Date1904=parsebool;var parse_DefColWidth=parseuint16;var parse_DSF=parsenoop2;var parse_EntExU2=parsenoop2;var parse_EOF=parsenoop2;var parse_Excel9File=parsenoop2;var parse_FeatHdr=parsenoop2;var parse_FontX=parseuint16;var parse_Footer=parse_XLHeaderFooter;var parse_GridSet=parseuint16;var parse_HCenter=parsebool;var parse_Header=parse_XLHeaderFooter;var parse_HideObj=parse_HideObjEnum;var parse_InterfaceEnd=parsenoop2;var parse_LeftMargin=parse_Xnum;var parse_Mms=parsenoop2;var parse_ObjProtect=parsebool;var parse_Password=parseuint16;var parse_PrintGrid=parsebool;var parse_PrintRowCol=parsebool;var parse_PrintSize=parseuint16;var parse_Prot4Rev=parsebool;var parse_Prot4RevPass=parseuint16;var parse_Protect=parsebool;var parse_RefreshAll=parsebool;var parse_RightMargin=parse_Xnum;var parse_RRTabId=parseuint16a;var parse_ScenarioProtect=parsebool;var parse_Scl=parseuint16a;var parse_String=parse_XLUnicodeString;var parse_SxBool=parsebool;var parse_TopMargin=parse_Xnum;var parse_UsesELFs=parsebool;var parse_VCenter=parsebool;var parse_WinProtect=parsebool;var parse_WriteProtect=parsenoop;var parse_VerticalPageBreaks=parsenoop;var parse_HorizontalPageBreaks=parsenoop;var parse_Selection=parsenoop;var parse_Continue=parsenoop;var parse_Pane=parsenoop;var parse_Pls=parsenoop;var parse_DCon=parsenoop;var parse_DConRef=parsenoop;var parse_DConName=parsenoop;var parse_XCT=parsenoop;var parse_CRN=parsenoop;var parse_FileSharing=parsenoop;var parse_Uncalced=parsenoop;var parse_Template=parsenoop;var parse_Intl=parsenoop;var parse_WsBool=parsenoop;var parse_Sort=parsenoop;var parse_Sync=parsenoop;var parse_LPr=parsenoop;var parse_DxGCol=parsenoop;var parse_FnGroupName=parsenoop;var parse_FilterMode=parsenoop;var parse_AutoFilterInfo=parsenoop;var parse_AutoFilter=parsenoop;var parse_Setup=parsenoop;var parse_ScenMan=parsenoop;var parse_SCENARIO=parsenoop;var parse_SxView=parsenoop;var parse_Sxvd=parsenoop;var parse_SXVI=parsenoop;var parse_SxIvd=parsenoop;var parse_SXLI=parsenoop;var parse_SXPI=parsenoop;var parse_DocRoute=parsenoop;var parse_RecipName=parsenoop;var parse_MulBlank=parsenoop;var parse_SXDI=parsenoop;var parse_SXDB=parsenoop;var parse_SXFDB=parsenoop;var parse_SXDBB=parsenoop;var parse_SXNum=parsenoop;var parse_SxErr=parsenoop;var parse_SXInt=parsenoop;var parse_SXString=parsenoop;var parse_SXDtr=parsenoop;var parse_SxNil=parsenoop;var parse_SXTbl=parsenoop;var parse_SXTBRGIITM=parsenoop;var parse_SxTbpg=parsenoop;var parse_ObProj=parsenoop;var parse_SXStreamID=parsenoop;var parse_DBCell=parsenoop;var parse_SXRng=parsenoop;var parse_SxIsxoper=parsenoop;var parse_BookBool=parsenoop;var parse_DbOrParamQry=parsenoop;var parse_OleObjectSize=parsenoop;var parse_SXVS=parsenoop;var parse_BkHim=parsenoop;var parse_MsoDrawingGroup=parsenoop;var parse_MsoDrawing=parsenoop;var parse_MsoDrawingSelection=parsenoop;var parse_PhoneticInfo=parsenoop;var parse_SxRule=parsenoop;var parse_SXEx=parsenoop;var parse_SxFilt=parsenoop;var parse_SxDXF=parsenoop;var parse_SxItm=parsenoop;var parse_SxName=parsenoop;var parse_SxSelect=parsenoop;var parse_SXPair=parsenoop;var parse_SxFmla=parsenoop;var parse_SxFormat=parsenoop;var parse_SXVDEx=parsenoop;var parse_SXFormula=parsenoop;var parse_SXDBEx=parsenoop;var parse_RRDInsDel=parsenoop;var parse_RRDHead=parsenoop;var parse_RRDChgCell=parsenoop;var parse_RRDRenSheet=parsenoop;var parse_RRSort=parsenoop;var parse_RRDMove=parsenoop;var parse_RRFormat=parsenoop;var parse_RRAutoFmt=parsenoop;var parse_RRInsertSh=parsenoop;var parse_RRDMoveBegin=parsenoop;var parse_RRDMoveEnd=parsenoop;var parse_RRDInsDelBegin=parsenoop;var parse_RRDInsDelEnd=parsenoop;var parse_RRDConflict=parsenoop;var parse_RRDDefName=parsenoop;var parse_RRDRstEtxp=parsenoop;var parse_LRng=parsenoop;var parse_CUsr=parsenoop;var parse_CbUsr=parsenoop;var parse_UsrInfo=parsenoop;var parse_UsrExcl=parsenoop;var parse_FileLock=parsenoop;var parse_RRDInfo=parsenoop;var parse_BCUsrs=parsenoop;var parse_UsrChk=parsenoop;var parse_UserBView=parsenoop;var parse_UserSViewBegin=parsenoop;var parse_UserSViewEnd=parsenoop;var parse_RRDUserView=parsenoop;var parse_Qsi=parsenoop;var parse_CondFmt=parsenoop;var parse_CF=parsenoop;var parse_DVal=parsenoop;var parse_DConBin=parsenoop;var parse_Lel=parsenoop;var parse_XLSCodeName=parse_XLUnicodeString;var parse_SXFDBType=parsenoop;var parse_ObNoMacros=parsenoop;var parse_Dv=parsenoop;var parse_Index=parsenoop;var parse_Table=parsenoop;var parse_BigName=parsenoop;var parse_ContinueBigName=parsenoop;var parse_WebPub=parsenoop;var parse_QsiSXTag=parsenoop;var parse_DBQueryExt=parsenoop;var parse_ExtString=parsenoop;var parse_TxtQry=parsenoop;var parse_Qsir=parsenoop;var parse_Qsif=parsenoop;var parse_RRDTQSIF=parsenoop;var parse_OleDbConn=parsenoop;var parse_WOpt=parsenoop;var parse_SXViewEx=parsenoop;var parse_SXTH=parsenoop;var parse_SXPIEx=parsenoop;var parse_SXVDTEx=parsenoop;var parse_SXViewEx9=parsenoop;var parse_ContinueFrt=parsenoop;var parse_RealTimeData=parsenoop;var parse_ChartFrtInfo=parsenoop;var parse_FrtWrapper=parsenoop;var parse_StartBlock=parsenoop;var parse_EndBlock=parsenoop;var parse_StartObject=parsenoop;var parse_EndObject=parsenoop;var parse_CatLab=parsenoop;var parse_YMult=parsenoop;var parse_SXViewLink=parsenoop;var parse_PivotChartBits=parsenoop;var parse_FrtFontList=parsenoop;var parse_SheetExt=parsenoop;var parse_BookExt=parsenoop;var parse_SXAddl=parsenoop;var parse_CrErr=parsenoop;var parse_HFPicture=parsenoop;var parse_Feat=parsenoop;var parse_DataLabExt=parsenoop;var parse_DataLabExtContents=parsenoop;var parse_CellWatch=parsenoop;var parse_FeatHdr11=parsenoop;var parse_Feature11=parsenoop;var parse_DropDownObjIds=parsenoop;var parse_ContinueFrt11=parsenoop;var parse_DConn=parsenoop;var parse_List12=parsenoop;var parse_Feature12=parsenoop;var parse_CondFmt12=parsenoop;var parse_CF12=parsenoop;var parse_CFEx=parsenoop;var parse_AutoFilter12=parsenoop;var parse_ContinueFrt12=parsenoop;var parse_MDTInfo=parsenoop;var parse_MDXStr=parsenoop;var parse_MDXTuple=parsenoop;var parse_MDXSet=parsenoop;var parse_MDXProp=parsenoop;var parse_MDXKPI=parsenoop;var parse_MDB=parsenoop;var parse_PLV=parsenoop;var parse_DXF=parsenoop;var parse_TableStyles=parsenoop;var parse_TableStyle=parsenoop;var parse_TableStyleElement=parsenoop;var parse_NamePublish=parsenoop;var parse_NameCmt=parsenoop;var parse_SortData=parsenoop;var parse_GUIDTypeLib=parsenoop;var parse_FnGrp12=parsenoop;var parse_NameFnGrp12=parsenoop;var parse_HeaderFooter=parsenoop;var parse_CrtLayout12=parsenoop;var parse_CrtMlFrt=parsenoop;var parse_CrtMlFrtContinue=parsenoop;var parse_ShapePropsStream=parsenoop;var parse_TextPropsStream=parsenoop;var parse_RichTextStream=parsenoop;var parse_CrtLayout12A=parsenoop;var parse_Units=parsenoop;var parse_Chart=parsenoop;var parse_Series=parsenoop;var parse_DataFormat=parsenoop;var parse_LineFormat=parsenoop;var parse_MarkerFormat=parsenoop;var parse_AreaFormat=parsenoop;var parse_PieFormat=parsenoop;var parse_AttachedLabel=parsenoop;var parse_SeriesText=parsenoop;var parse_ChartFormat=parsenoop;var parse_Legend=parsenoop;var parse_SeriesList=parsenoop;var parse_Bar=parsenoop;var parse_Line=parsenoop;var parse_Pie=parsenoop;var parse_Area=parsenoop;var parse_Scatter=parsenoop;var parse_CrtLine=parsenoop;var parse_Axis=parsenoop;var parse_Tick=parsenoop;var parse_ValueRange=parsenoop;var parse_CatSerRange=parsenoop;var parse_AxisLine=parsenoop;var parse_CrtLink=parsenoop;var parse_DefaultText=parsenoop;var parse_Text=parsenoop;var parse_ObjectLink=parsenoop;var parse_Frame=parsenoop;var parse_Begin=parsenoop;var parse_End=parsenoop;var parse_PlotArea=parsenoop;var parse_Chart3d=parsenoop;var parse_PicF=parsenoop;var parse_DropBar=parsenoop;var parse_Radar=parsenoop;var parse_Surf=parsenoop;var parse_RadarArea=parsenoop;var parse_AxisParent=parsenoop;var parse_LegendException=parsenoop;var parse_ShtProps=parsenoop;var parse_SerToCrt=parsenoop;var parse_AxesUsed=parsenoop;var parse_SBaseRef=parsenoop;var parse_SerParent=parsenoop;var parse_SerAuxTrend=parsenoop;var parse_IFmtRecord=parsenoop;var parse_Pos=parsenoop;var parse_AlRuns=parsenoop;var parse_BRAI=parsenoop;var parse_SerAuxErrBar=parsenoop;var parse_SerFmt=parsenoop;var parse_Chart3DBarShape=parsenoop;var parse_Fbi=parsenoop;var parse_BopPop=parsenoop;var parse_AxcExt=parsenoop;var parse_Dat=parsenoop;var parse_PlotGrowth=parsenoop;var parse_SIIndex=parsenoop;var parse_GelFrame=parsenoop;var parse_BopPopCustom=parsenoop;var parse_Fbi2=parsenoop;function parse_BIFF5String(blob){var len=blob.read_shift(1);return blob.read_shift(len,"sbcs-cont")}function parse_BIFF2STR(blob,length,opts){var cell=parse_XLSCell(blob,6);++blob.l;var str=parse_XLUnicodeString2(blob,length-7,opts);cell.val=str;return cell}function parse_BIFF2NUM(blob,length,opts){var cell=parse_XLSCell(blob,6);++blob.l;var num=parse_Xnum(blob,8);cell.val=num;return cell}var CS2CP={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969};var parse_rs=function parse_rs_factory(){var tregex=matchtag("t"),rpregex=matchtag("rPr"),rregex=/<r>/g,rend=/<\/r>/,nlregex=/\r\n/g;var parse_rpr=function parse_rpr(rpr,intro,outro){var font={},cp=65001;var m=rpr.match(tagregex),i=0;if(m)for(;i!=m.length;++i){var y=parsexmltag(m[i]);switch(y[0]){case"<condense":break;case"<extend":break;case"<shadow":case"<shadow/>":break;case"<charset":if(y.val=="1")break;cp=CS2CP[parseInt(y.val,10)];break;case"<outline":case"<outline/>":break;case"<rFont":font.name=y.val;break;case"<sz":font.sz=y.val;break;case"<strike":if(!y.val)break;case"<strike/>":font.strike=1;break;case"</strike>":break;case"<u":if(!y.val)break;case"<u/>":font.u=1;break;case"</u>":break;case"<b":if(!y.val)break;case"<b/>":font.b=1;break;case"</b>":break;case"<i":if(!y.val)break;case"<i/>":font.i=1;break;case"</i>":break;case"<color":if(y.rgb)font.color=y.rgb.substr(2,6);break;case"<family":font.family=y.val;break;case"<vertAlign":break;case"<scheme":break;default:if(y[0].charCodeAt(1)!==47)throw"Unrecognized rich format "+y[0]}}var style=[];if(font.b)style.push("font-weight: bold;");if(font.i)style.push("font-style: italic;");intro.push('<span style="'+style.join("")+'">');outro.push("</span>");return cp};function parse_r(r){var terms=[[],"",[]];var t=r.match(tregex),cp=65001;if(!isval(t))return"";terms[1]=t[1];var rpr=r.match(rpregex);if(isval(rpr))cp=parse_rpr(rpr[1],terms[0],terms[2]);return terms[0].join("")+terms[1].replace(nlregex,"<br/>")+terms[2].join("")}return function parse_rs(rs){return rs.replace(rregex,"").split(rend).map(parse_r).join("")}}();var sitregex=/<t[^>]*>([^<]*)<\/t>/g,sirregex=/<r>/;function parse_si(x,opts){var html=opts?opts.cellHTML:true;var z={};if(!x)return null;var y;if(x.charCodeAt(1)===116){z.t=utf8read(unescapexml(x.substr(x.indexOf(">")+1).split(/<\/t>/)[0]));z.r=x;if(html)z.h=z.t}else if(y=x.match(sirregex)){z.r=x;z.t=utf8read(unescapexml(x.match(sitregex).join("").replace(tagregex,"")));if(html)z.h=parse_rs(x)}return z}var sstr0=/<sst([^>]*)>([\s\S]*)<\/sst>/;var sstr1=/<(?:si|sstItem)>/g;var sstr2=/<\/(?:si|sstItem)>/;function parse_sst_xml(data,opts){var s=[],ss;var sst=data.match(sstr0);if(isval(sst)){ss=sst[2].replace(sstr1,"").split(sstr2);for(var i=0;i!=ss.length;++i){var o=parse_si(ss[i],opts);if(o!=null)s[s.length]=o}sst=parsexmltag(sst[1]);s.Count=sst.count;s.Unique=sst.uniqueCount}return s}RELS.SST="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings";var straywsregex=/^\s|\s$|[\t\n\r]/;function write_sst_xml(sst,opts){if(!opts.bookSST)return"";var o=[XML_HEADER];o[o.length]=writextag("sst",null,{xmlns:XMLNS.main[0],count:sst.Count,uniqueCount:sst.Unique});for(var i=0;i!=sst.length;++i){if(sst[i]==null)continue;var s=sst[i];var sitag="<si>";if(s.r)sitag+=s.r;else{sitag+="<t";if(s.t.match(straywsregex))sitag+=' xml:space="preserve"';sitag+=">"+escapexml(s.t)+"</t>"}sitag+="</si>";o[o.length]=sitag}if(o.length>2){o[o.length]="</sst>";o[1]=o[1].replace("/>",">")}return o.join("")}function parse_BrtBeginSst(data,length){return[data.read_shift(4),data.read_shift(4)]}function parse_sst_bin(data,opts){var s=[];var pass=false;recordhopper(data,function hopper_sst(val,R,RT){switch(R.n){case"BrtBeginSst":s.Count=val[0];s.Unique=val[1];break;case"BrtSSTItem":s.push(val);break;case"BrtEndSst":return true;case"BrtFRTBegin":pass=true;break;case"BrtFRTEnd":pass=false;break;default:if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R.n)}});return s}function write_BrtBeginSst(sst,o){if(!o)o=new_buf(8);o.write_shift(4,sst.Count);o.write_shift(4,sst.Unique);return o}var write_BrtSSTItem=write_RichStr;function write_sst_bin(sst,opts){var ba=buf_array();write_record(ba,"BrtBeginSst",write_BrtBeginSst(sst));for(var i=0;i<sst.length;++i)write_record(ba,"BrtSSTItem",write_BrtSSTItem(sst[i]));write_record(ba,"BrtEndSst");return ba.end()}function _JS2ANSI(str){if(typeof cptable!=="undefined")return cptable.utils.encode(1252,str);return str.split("").map(function(x){return x.charCodeAt(0)})}function parse_Version(blob,length){var o={};o.Major=blob.read_shift(2);o.Minor=blob.read_shift(2);return o}function parse_EncryptionHeader(blob,length){var o={};o.Flags=blob.read_shift(4);var tmp=blob.read_shift(4);if(tmp!==0)throw"Unrecognized SizeExtra: "+tmp;o.AlgID=blob.read_shift(4);switch(o.AlgID){case 0:case 26625:case 26126:case 26127:case 26128:break;default:throw"Unrecognized encryption algorithm: "+o.AlgID}parsenoop(blob,length-12);return o}function parse_EncryptionVerifier(blob,length){return parsenoop(blob,length)}function parse_RC4CryptoHeader(blob,length){var o={};var vers=o.EncryptionVersionInfo=parse_Version(blob,4);length-=4;if(vers.Minor!=2)throw"unrecognized minor version code: "+vers.Minor;if(vers.Major>4||vers.Major<2)throw"unrecognized major version code: "+vers.Major;o.Flags=blob.read_shift(4);length-=4;var sz=blob.read_shift(4);length-=4;o.EncryptionHeader=parse_EncryptionHeader(blob,sz);length-=sz;o.EncryptionVerifier=parse_EncryptionVerifier(blob,length);return o}function parse_RC4Header(blob,length){var o={};var vers=o.EncryptionVersionInfo=parse_Version(blob,4);length-=4;if(vers.Major!=1||vers.Minor!=1)throw"unrecognized version code "+vers.Major+" : "+vers.Minor;o.Salt=blob.read_shift(16);o.EncryptedVerifier=blob.read_shift(16);o.EncryptedVerifierHash=blob.read_shift(16);return o}function crypto_CreatePasswordVerifier_Method1(Password){var Verifier=0,PasswordArray;var PasswordDecoded=_JS2ANSI(Password);var len=PasswordDecoded.length+1,i,PasswordByte;var Intermediate1,Intermediate2,Intermediate3;PasswordArray=new_raw_buf(len);PasswordArray[0]=PasswordDecoded.length;for(i=1;i!=len;++i)PasswordArray[i]=PasswordDecoded[i-1];for(i=len-1;i>=0;--i){PasswordByte=PasswordArray[i];Intermediate1=(Verifier&16384)===0?0:1;Intermediate2=Verifier<<1&32767;Intermediate3=Intermediate1|Intermediate2;Verifier=Intermediate3^PasswordByte}return Verifier^52811}var crypto_CreateXorArray_Method1=function(){var PadArray=[187,255,255,186,255,255,185,128,0,190,15,0,191,15,0];var InitialCode=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163];var XorMatrix=[44796,19929,39858,10053,20106,40212,10761,31585,63170,64933,60267,50935,40399,11199,17763,35526,1453,2906,5812,11624,23248,885,1770,3540,7080,14160,28320,56640,55369,41139,20807,41614,21821,43642,17621,28485,56970,44341,19019,38038,14605,29210,60195,50791,40175,10751,21502,43004,24537,18387,36774,3949,7898,15796,31592,63184,47201,24803,49606,37805,14203,28406,56812,17824,35648,1697,3394,6788,13576,27152,43601,17539,35078,557,1114,2228,4456,30388,60776,51953,34243,7079,14158,28316,14128,28256,56512,43425,17251,34502,7597,13105,26210,52420,35241,883,1766,3532,4129,8258,16516,33032,4657,9314,18628];+ var Ror=function(Byte){return(Byte/2|Byte*128)&255};var XorRor=function(byte1,byte2){return Ror(byte1^byte2)};var CreateXorKey_Method1=function(Password){var XorKey=InitialCode[Password.length-1];var CurrentElement=104;for(var i=Password.length-1;i>=0;--i){var Char=Password[i];for(var j=0;j!=7;++j){if(Char&64)XorKey^=XorMatrix[CurrentElement];Char*=2;--CurrentElement}}return XorKey};return function(password){var Password=_JS2ANSI(password);var XorKey=CreateXorKey_Method1(Password);var Index=Password.length;var ObfuscationArray=new_raw_buf(16);for(var i=0;i!=16;++i)ObfuscationArray[i]=0;var Temp,PasswordLastChar,PadIndex;if((Index&1)===1){Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(PadArray[0],Temp);--Index;Temp=XorKey&255;PasswordLastChar=Password[Password.length-1];ObfuscationArray[Index]=XorRor(PasswordLastChar,Temp)}while(Index>0){--Index;Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(Password[Index],Temp);--Index;Temp=XorKey&255;ObfuscationArray[Index]=XorRor(Password[Index],Temp)}Index=15;PadIndex=15-Password.length;while(PadIndex>0){Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(PadArray[PadIndex],Temp);--Index;--PadIndex;Temp=XorKey&255;ObfuscationArray[Index]=XorRor(Password[Index],Temp);--Index;--PadIndex}return ObfuscationArray}}();var crypto_DecryptData_Method1=function(password,Data,XorArrayIndex,XorArray,O){if(!O)O=Data;if(!XorArray)XorArray=crypto_CreateXorArray_Method1(password);var Index,Value;for(Index=0;Index!=Data.length;++Index){Value=Data[Index];Value^=XorArray[XorArrayIndex];Value=(Value>>5|Value<<3)&255;O[Index]=Value;++XorArrayIndex}return[O,XorArrayIndex,XorArray]};var crypto_MakeXorDecryptor=function(password){var XorArrayIndex=0,XorArray=crypto_CreateXorArray_Method1(password);return function(Data){var O=crypto_DecryptData_Method1(null,Data,XorArrayIndex,XorArray);XorArrayIndex=O[1];return O[0]}};function parse_XORObfuscation(blob,length,opts,out){var o={key:parseuint16(blob),verificationBytes:parseuint16(blob)};if(opts.password)o.verifier=crypto_CreatePasswordVerifier_Method1(opts.password);out.valid=o.verificationBytes===o.verifier;if(out.valid)out.insitu_decrypt=crypto_MakeXorDecryptor(opts.password);return o}function parse_FilePassHeader(blob,length,oo){var o=oo||{};o.Info=blob.read_shift(2);blob.l-=2;if(o.Info===1)o.Data=parse_RC4Header(blob,length);else o.Data=parse_RC4CryptoHeader(blob,length);return o}function parse_FilePass(blob,length,opts){var o={Type:blob.read_shift(2)};if(o.Type)parse_FilePassHeader(blob,length-2,o);else parse_XORObfuscation(blob,length-2,opts,o);return o}function hex2RGB(h){var o=h.substr(h[0]==="#"?1:0,6);return[parseInt(o.substr(0,2),16),parseInt(o.substr(2,2),16),parseInt(o.substr(4,2),16)]}function rgb2Hex(rgb){for(var i=0,o=1;i!=3;++i)o=o*256+(rgb[i]>255?255:rgb[i]<0?0:rgb[i]);return o.toString(16).toUpperCase().substr(1)}function rgb2HSL(rgb){var R=rgb[0]/255,G=rgb[1]/255,B=rgb[2]/255;var M=Math.max(R,G,B),m=Math.min(R,G,B),C=M-m;if(C===0)return[0,0,R];var H6=0,S=0,L2=M+m;S=C/(L2>1?2-L2:L2);switch(M){case R:H6=((G-B)/C+6)%6;break;case G:H6=(B-R)/C+2;break;case B:H6=(R-G)/C+4;break}return[H6/6,S,L2/2]}function hsl2RGB(hsl){var H=hsl[0],S=hsl[1],L=hsl[2];var C=S*2*(L<.5?L:1-L),m=L-C/2;var rgb=[m,m,m],h6=6*H;var X;if(S!==0)switch(h6|0){case 0:case 6:X=C*h6;rgb[0]+=C;rgb[1]+=X;break;case 1:X=C*(2-h6);rgb[0]+=X;rgb[1]+=C;break;case 2:X=C*(h6-2);rgb[1]+=C;rgb[2]+=X;break;case 3:X=C*(4-h6);rgb[1]+=X;rgb[2]+=C;break;case 4:X=C*(h6-4);rgb[2]+=C;rgb[0]+=X;break;case 5:X=C*(6-h6);rgb[2]+=X;rgb[0]+=C;break}for(var i=0;i!=3;++i)rgb[i]=Math.round(rgb[i]*255);return rgb}function rgb_tint(hex,tint){if(tint==0)return hex;var hsl=rgb2HSL(hex2RGB(hex));if(tint<0)hsl[2]=hsl[2]*(1+tint);else hsl[2]=1-(1-hsl[2])*(1-tint);var rev=rgb2Hex(hsl2RGB(hsl));return rev}var DEF_MDW=7,MAX_MDW=15,MIN_MDW=1,MDW=DEF_MDW;function width2px(width){return(width+(128/MDW|0)/256)*MDW|0}function px2char(px){return((px-5)/MDW*100+.5|0)/100}function char2width(chr){return((chr*MDW+5)/MDW*256|0)/256}function cycle_width(collw){return char2width(px2char(width2px(collw)))}function find_mdw(collw,coll){if(cycle_width(collw)!=collw){for(MDW=DEF_MDW;MDW>MIN_MDW;--MDW)if(cycle_width(collw)===collw)break;if(MDW===MIN_MDW)for(MDW=DEF_MDW+1;MDW<MAX_MDW;++MDW)if(cycle_width(collw)===collw)break;if(MDW===MAX_MDW)MDW=DEF_MDW}}var XLMLPatternTypeMap={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"};var styles={};var themes={};function parse_fills(t,opts){styles.Fills=[];var fill={};t[0].match(tagregex).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<fills":case"<fills>":case"</fills>":break;case"<fill>":break;case"</fill>":styles.Fills.push(fill);fill={};break;case"<patternFill":if(y.patternType)fill.patternType=y.patternType;break;case"<patternFill/>":case"</patternFill>":break;case"<bgColor":if(!fill.bgColor)fill.bgColor={};if(y.indexed)fill.bgColor.indexed=parseInt(y.indexed,10);if(y.theme)fill.bgColor.theme=parseInt(y.theme,10);if(y.tint)fill.bgColor.tint=parseFloat(y.tint);if(y.theme&&themes.themeElements&&themes.themeElements.clrScheme){fill.bgColor.rgb=rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb,fill.bgColor.tint||0);if(opts.WTF)fill.bgColor.raw_rgb=rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb,0)}if(y.rgb)fill.bgColor.rgb=y.rgb;break;case"<bgColor/>":case"</bgColor>":break;case"<fgColor":if(!fill.fgColor)fill.fgColor={};if(y.theme)fill.fgColor.theme=parseInt(y.theme,10);if(y.tint)fill.fgColor.tint=parseFloat(y.tint);if(y.theme&&themes.themeElements&&themes.themeElements.clrScheme){fill.fgColor.rgb=rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb,fill.fgColor.tint||0);if(opts.WTF)fill.fgColor.raw_rgb=rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb,0)}if(y.rgb)fill.fgColor.rgb=y.rgb;break;case"<fgColor/>":case"</fgColor>":break;default:if(opts.WTF)throw"unrecognized "+y[0]+" in fills"}})}function parse_fonts(t,opts){styles.Fonts=[];var font={};t[0].match(tagregex).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<fonts":case"<fonts>":case"</fonts>":break;case"<font":break;case"</font>":styles.Fonts.push(font);font={};break;case"<name":if(y.val)font.name=y.val;break;case"<name/>":case"</name>":break;case"<b/>":font.bold=true;break;case"<u/>":font.underline=true;break;case"<i/>":font.italic=true;break;case"<strike/>":font.strike=true;break;case"<outline/>":font.outline=true;break;case"<shadow/>":font.shadow=true;break;case"<sz":if(y.val)font.sz=y.val;break;case"<sz/>":case"</sz>":break;case"<vertAlign":if(y.val)font.vertAlign=y.val;break;case"<vertAlign/>":case"</vertAlign>":break;case"<color":if(!font.color)font.color={};if(y.theme)font.color.theme=y.theme;if(y.tint)font.color.tint=y.tint;if(y.theme&&themes.themeElements&&themes.themeElements.clrScheme){font.color.rgb=rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb,font.color.tint||0)}if(y.rgb)font.color.rgb=y.rgb;break;case"<color/>":case"</color>":break}})}function parse_borders(t,opts){styles.Borders=[];var border={},sub_border={};t[0].match(tagregex).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<borders":case"<borders>":case"</borders>":break;case"<border":case"<border>":border={};if(y.diagonalUp){border.diagonalUp=y.diagonalUp}if(y.diagonalDown){border.diagonalDown=y.diagonalDown}styles.Borders.push(border);break;break;case"</border>":break;case"<left":sub_border=border.left={};if(y.style){sub_border.style=y.style}break;case"<right":sub_border=border.right={};if(y.style){sub_border.style=y.style}break;case"<top":sub_border=border.top={};if(y.style){sub_border.style=y.style}break;case"<bottom":sub_border=border.bottom={};if(y.style){sub_border.style=y.style}break;case"<diagonal":sub_border=border.diagonal={};if(y.style){sub_border.style=y.style}break;case"<color":sub_border.color={};if(y.theme)sub_border.color.theme=y.theme;if(y.theme&&themes.themeElements&&themes.themeElements.clrScheme){sub_border.color.rgb=rgb_tint(themes.themeElements.clrScheme[sub_border.color.theme].rgb,sub_border.color.tint||0)}if(y.tint)sub_border.color.tint=y.tint;if(y.rgb)sub_border.color.rgb=y.rgb;if(y.auto)sub_border.color.auto=y.auto;break;case"<name/>":case"</name>":break;default:break}})}function parse_numFmts(t,opts){styles.NumberFmt=[];var k=keys(SSF._table);for(var i=0;i<k.length;++i)styles.NumberFmt[k[i]]=SSF._table[k[i]];var m=t[0].match(tagregex);for(i=0;i<m.length;++i){var y=parsexmltag(m[i]);switch(y[0]){case"<numFmts":case"</numFmts>":case"<numFmts/>":case"<numFmts>":break;case"<numFmt":{var f=unescapexml(utf8read(y.formatCode)),j=parseInt(y.numFmtId,10);styles.NumberFmt[j]=f;if(j>0)SSF.load(f,j)}break;default:if(opts.WTF)throw"unrecognized "+y[0]+" in numFmts"}}}function write_numFmts(NF,opts){var o=["<numFmts>"];[[5,8],[23,26],[41,44],[63,66],[164,392]].forEach(function(r){for(var i=r[0];i<=r[1];++i)if(NF[i]!==undefined)o[o.length]=writextag("numFmt",null,{numFmtId:i,formatCode:escapexml(NF[i])})});if(o.length===1)return"";o[o.length]="</numFmts>";o[0]=writextag("numFmts",null,{count:o.length-2}).replace("/>",">");return o.join("")}function parse_cellXfs(t,opts){styles.CellXf=[];var xf;t[0].match(tagregex).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<cellXfs":case"<cellXfs>":case"<cellXfs/>":case"</cellXfs>":break;case"<xf":xf=y;delete xf[0];delete y[0];if(xf.numFmtId)xf.numFmtId=parseInt(xf.numFmtId,10);if(xf.fillId)xf.fillId=parseInt(xf.fillId,10);styles.CellXf.push(xf);break;case"</xf>":break;case"<alignment":case"<alignment/>":var alignment={};if(y.vertical){alignment.vertical=y.vertical}if(y.horizontal){alignment.horizontal=y.horizontal}if(y.textRotation!=undefined){alignment.textRotation=y.textRotation}if(y.indent){alignment.indent=y.indent}if(y.wrapText){alignment.wrapText=y.wrapText}xf.alignment=alignment;break;case"<protection":case"</protection>":case"<protection/>":break;case"<extLst":case"</extLst>":break;case"<ext":break;default:if(opts.WTF)throw"unrecognized "+y[0]+" in cellXfs"}})}function write_cellXfs(cellXfs){var o=[];o[o.length]=writextag("cellXfs",null);cellXfs.forEach(function(c){o[o.length]=writextag("xf",null,c)});o[o.length]="</cellXfs>";if(o.length===2)return"";o[0]=writextag("cellXfs",null,{count:o.length-2}).replace("/>",">");return o.join("")}var parse_sty_xml=function make_pstyx(){var numFmtRegex=/<numFmts([^>]*)>.*<\/numFmts>/;var cellXfRegex=/<cellXfs([^>]*)>.*<\/cellXfs>/;var fillsRegex=/<fills([^>]*)>.*<\/fills>/;var bordersRegex=/<borders([^>]*)>.*<\/borders>/;return function parse_sty_xml(data,opts){var t;if(t=data.match(numFmtRegex))parse_numFmts(t,opts);if(t=data.match(/<fonts([^>]*)>.*<\/fonts>/))parse_fonts(t,opts);if(t=data.match(fillsRegex))parse_fills(t,opts);if(t=data.match(bordersRegex))parse_borders(t,opts);if(t=data.match(cellXfRegex))parse_cellXfs(t,opts);return styles}}();var STYLES_XML_ROOT=writextag("styleSheet",null,{xmlns:XMLNS.main[0],"xmlns:vt":XMLNS.vt});RELS.STY="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";function write_sty_xml(wb,opts){if(typeof style_builder!="undefined"&&typeof"require"!="undefined"){return style_builder.toXml()}var o=[XML_HEADER,STYLES_XML_ROOT],w;if((w=write_numFmts(wb.SSF))!=null)o[o.length]=w;o[o.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>';o[o.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>';o[o.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>';o[o.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>';if(w=write_cellXfs(opts.cellXfs))o[o.length]=w;o[o.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>';o[o.length]='<dxfs count="0"/>';o[o.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>';if(o.length>2){o[o.length]="</styleSheet>";o[1]=o[1].replace("/>",">")}return o.join("")}function parse_BrtFmt(data,length){var ifmt=data.read_shift(2);var stFmtCode=parse_XLWideString(data,length-2);return[ifmt,stFmtCode]}function parse_BrtFont(data,length){var out={flags:{}};out.dyHeight=data.read_shift(2);out.grbit=parse_FontFlags(data,2);out.bls=data.read_shift(2);out.sss=data.read_shift(2);out.uls=data.read_shift(1);out.bFamily=data.read_shift(1);out.bCharSet=data.read_shift(1);data.l++;out.brtColor=parse_BrtColor(data,8);out.bFontScheme=data.read_shift(1);out.name=parse_XLWideString(data,length-21);out.flags.Bold=out.bls===700;out.flags.Italic=out.grbit.fItalic;out.flags.Strikeout=out.grbit.fStrikeout;out.flags.Outline=out.grbit.fOutline;out.flags.Shadow=out.grbit.fShadow;out.flags.Condense=out.grbit.fCondense;out.flags.Extend=out.grbit.fExtend;out.flags.Sub=out.sss&2;out.flags.Sup=out.sss&1;return out}function parse_BrtXF(data,length){var ixfeParent=data.read_shift(2);var ifmt=data.read_shift(2);parsenoop(data,length-4);return{ixfe:ixfeParent,ifmt:ifmt}}function parse_sty_bin(data,opts){styles.NumberFmt=[];for(var y in SSF._table)styles.NumberFmt[y]=SSF._table[y];styles.CellXf=[];var state="";var pass=false;recordhopper(data,function hopper_sty(val,R,RT){switch(R.n){case"BrtFmt":styles.NumberFmt[val[0]]=val[1];SSF.load(val[1],val[0]);break;case"BrtFont":break;case"BrtKnownFonts":break;case"BrtFill":break;case"BrtBorder":break;case"BrtXF":if(state==="CELLXFS"){styles.CellXf.push(val)}break;case"BrtStyle":break;case"BrtDXF":break;case"BrtMRUColor":break;case"BrtIndexedColor":break;case"BrtBeginStyleSheet":break;case"BrtEndStyleSheet":break;case"BrtBeginTableStyle":break;case"BrtTableStyleElement":break;case"BrtEndTableStyle":break;case"BrtBeginFmts":state="FMTS";break;case"BrtEndFmts":state="";break;case"BrtBeginFonts":state="FONTS";break;case"BrtEndFonts":state="";break;case"BrtACBegin":state="ACFONTS";break;case"BrtACEnd":state="";break;case"BrtBeginFills":state="FILLS";break;case"BrtEndFills":state="";break;case"BrtBeginBorders":state="BORDERS";break;case"BrtEndBorders":state="";break;case"BrtBeginCellStyleXFs":state="CELLSTYLEXFS";break;case"BrtEndCellStyleXFs":state="";break;case"BrtBeginCellXFs":state="CELLXFS";break;case"BrtEndCellXFs":state="";break;case"BrtBeginStyles":state="STYLES";break;case"BrtEndStyles":state="";break;case"BrtBeginDXFs":state="DXFS";break;case"BrtEndDXFs":state="";break;case"BrtBeginTableStyles":state="TABLESTYLES";break;case"BrtEndTableStyles":state="";break;case"BrtBeginColorPalette":state="COLORPALETTE";break;case"BrtEndColorPalette":state="";break;case"BrtBeginIndexedColors":state="INDEXEDCOLORS";break;case"BrtEndIndexedColors":state="";break;case"BrtBeginMRUColors":state="MRUCOLORS";break;case"BrtEndMRUColors":state="";break;case"BrtFRTBegin":pass=true;break;case"BrtFRTEnd":pass=false;break;case"BrtBeginStyleSheetExt14":break;case"BrtBeginSlicerStyles":break;case"BrtEndSlicerStyles":break;case"BrtBeginTimelineStylesheetExt15":break;case"BrtEndTimelineStylesheetExt15":break;case"BrtBeginTimelineStyles":break;case"BrtEndTimelineStyles":break;case"BrtEndStyleSheetExt14":break;default:if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R.n)}});return styles}function write_sty_bin(data,opts){var ba=buf_array();write_record(ba,"BrtBeginStyleSheet");write_record(ba,"BrtEndStyleSheet");return ba.end()}RELS.THEME="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";function parse_clrScheme(t,opts){themes.themeElements.clrScheme=[];var color={};t[0].match(tagregex).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<a:clrScheme":case"</a:clrScheme>":break;case"<a:srgbClr":color.rgb=y.val;break;case"<a:sysClr":color.rgb=y.lastClr;break;case"<a:dk1>":case"</a:dk1>":case"<a:dk2>":case"</a:dk2>":case"<a:lt1>":case"</a:lt1>":case"<a:lt2>":case"</a:lt2>":case"<a:accent1>":case"</a:accent1>":case"<a:accent2>":case"</a:accent2>":case"<a:accent3>":case"</a:accent3>":case"<a:accent4>":case"</a:accent4>":case"<a:accent5>":case"</a:accent5>":case"<a:accent6>":case"</a:accent6>":case"<a:hlink>":case"</a:hlink>":case"<a:folHlink>":case"</a:folHlink>":if(y[0][1]==="/"){themes.themeElements.clrScheme.push(color);color={}}else{color.name=y[0].substring(3,y[0].length-1)}break;default:if(opts.WTF)throw"unrecognized "+y[0]+" in clrScheme"}})}function parse_fontScheme(t,opts){}function parse_fmtScheme(t,opts){}var clrsregex=/<a:clrScheme([^>]*)>[^\u2603]*<\/a:clrScheme>/;var fntsregex=/<a:fontScheme([^>]*)>[^\u2603]*<\/a:fontScheme>/;var fmtsregex=/<a:fmtScheme([^>]*)>[^\u2603]*<\/a:fmtScheme>/;function parse_themeElements(data,opts){themes.themeElements={};var t;[["clrScheme",clrsregex,parse_clrScheme],["fontScheme",fntsregex,parse_fontScheme],["fmtScheme",fmtsregex,parse_fmtScheme]].forEach(function(m){if(!(t=data.match(m[1])))throw m[0]+" not found in themeElements";m[2](t,opts)})}var themeltregex=/<a:themeElements([^>]*)>[^\u2603]*<\/a:themeElements>/;function parse_theme_xml(data,opts){if(!data||data.length===0)return themes;var t;if(!(t=data.match(themeltregex)))throw"themeElements not found in theme";parse_themeElements(t[0],opts);return themes}function write_theme(opts){if(opts.themeXml){return opts.themeXml}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="1F497D"/></a:dk2><a:lt2><a:srgbClr val="EEECE1"/></a:lt2><a:accent1><a:srgbClr val="4F81BD"/></a:accent1><a:accent2><a:srgbClr val="C0504D"/></a:accent2><a:accent3><a:srgbClr val="9BBB59"/></a:accent3><a:accent4><a:srgbClr val="8064A2"/></a:accent4><a:accent5><a:srgbClr val="4BACC6"/></a:accent5><a:accent6><a:srgbClr val="F79646"/></a:accent6><a:hlink><a:srgbClr val="0000FF"/></a:hlink><a:folHlink><a:srgbClr val="800080"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Cambria"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/></a:majorFont><a:minorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="1"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst><a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d><a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults><a:spDef><a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style></a:spDef><a:lnDef><a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style></a:lnDef></a:objectDefaults><a:extraClrSchemeLst/></a:theme>'}function parse_Theme(blob,length){var dwThemeVersion=blob.read_shift(4);if(dwThemeVersion===124226)return;blob.l+=length-4}function parse_ColorTheme(blob,length){return blob.read_shift(4)}function parse_FullColorExt(blob,length){var o={};o.xclrType=blob.read_shift(2);o.nTintShade=blob.read_shift(2);switch(o.xclrType){case 0:blob.l+=4;break;case 1:o.xclrValue=parse_IcvXF(blob,4);break;case 2:o.xclrValue=parse_LongRGBA(blob,4);break;case 3:o.xclrValue=parse_ColorTheme(blob,4);break;case 4:blob.l+=4;break}blob.l+=8;return o}function parse_IcvXF(blob,length){return parsenoop(blob,length)}function parse_XFExtGradient(blob,length){return parsenoop(blob,length)}function parse_ExtProp(blob,length){var extType=blob.read_shift(2);var cb=blob.read_shift(2);var o=[extType];switch(extType){case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 13:o[1]=parse_FullColorExt(blob,cb);break;case 6:o[1]=parse_XFExtGradient(blob,cb);break;case 14:case 15:o[1]=blob.read_shift(cb===5?1:2);break;default:throw new Error("Unrecognized ExtProp type: "+extType+" "+cb)}return o}function parse_XFExt(blob,length){var end=blob.l+length;blob.l+=2;var ixfe=blob.read_shift(2);blob.l+=2;var cexts=blob.read_shift(2);var ext=[];while(cexts-->0)ext.push(parse_ExtProp(blob,end-blob.l));return{ixfe:ixfe,ext:ext}}function update_xfext(xf,xfext){xfext.forEach(function(xfe){switch(xfe[0]){case 4:break;case 5:break;case 7:case 8:case 9:case 10:break;case 13:break;case 14:break;default:throw"bafuq"+xfe[0].toString(16)}})}function parse_cc_xml(data,opts){var d=[];var l=0,i=1;(data.match(tagregex)||[]).forEach(function(x){var y=parsexmltag(x);switch(y[0]){case"<?xml":break;case"<calcChain":case"<calcChain>":case"</calcChain>":break;case"<c":delete y[0];if(y.i)i=y.i;else y.i=i;d.push(y);break}});return d}function write_cc_xml(data,opts){}function parse_BrtCalcChainItem$(data,length){var out={};out.i=data.read_shift(4);var cell={};cell.r=data.read_shift(4);cell.c=data.read_shift(4);out.r=encode_cell(cell);var flags=data.read_shift(1);if(flags&2)out.l="1";if(flags&8)out.a="1";return out}function parse_cc_bin(data,opts){var out=[];var pass=false;recordhopper(data,function hopper_cc(val,R,RT){switch(R.n){case"BrtCalcChainItem$":out.push(val);break;case"BrtBeginCalcChain$":break;case"BrtEndCalcChain$":break;default:if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R.n)}});return out}function write_cc_bin(data,opts){}function parse_comments(zip,dirComments,sheets,sheetRels,opts){for(var i=0;i!=dirComments.length;++i){var canonicalpath=dirComments[i];var comments=parse_cmnt(getzipdata(zip,canonicalpath.replace(/^\//,""),true),canonicalpath,opts);if(!comments||!comments.length)continue;var sheetNames=keys(sheets);for(var j=0;j!=sheetNames.length;++j){var sheetName=sheetNames[j];var rels=sheetRels[sheetName];if(rels){var rel=rels[canonicalpath];if(rel)insertCommentsIntoSheet(sheetName,sheets[sheetName],comments)}}}}function insertCommentsIntoSheet(sheetName,sheet,comments){comments.forEach(function(comment){var cell=sheet[comment.ref];if(!cell){cell={};sheet[comment.ref]=cell;var range=safe_decode_range(sheet["!ref"]||"BDWGO1000001:A1");var thisCell=decode_cell(comment.ref);if(range.s.r>thisCell.r)range.s.r=thisCell.r;if(range.e.r<thisCell.r)range.e.r=thisCell.r;if(range.s.c>thisCell.c)range.s.c=thisCell.c;if(range.e.c<thisCell.c)range.e.c=thisCell.c;var encoded=encode_range(range);if(encoded!==sheet["!ref"])sheet["!ref"]=encoded}if(!cell.c)cell.c=[];var o={a:comment.author,t:comment.t,r:comment.r};if(comment.h)o.h=comment.h;cell.c.push(o)})}function parse_comments_xml(data,opts){if(data.match(/<(?:\w+:)?comments *\/>/))return[];var authors=[];var commentList=[];data.match(/<(?:\w+:)?authors>([^\u2603]*)<\/(?:\w+:)?authors>/)[1].split(/<\/\w*:?author>/).forEach(function(x){if(x===""||x.trim()==="")return;authors.push(x.match(/<(?:\w+:)?author[^>]*>(.*)/)[1])});(data.match(/<(?:\w+:)?commentList>([^\u2603]*)<\/(?:\w+:)?commentList>/)||["",""])[1].split(/<\/\w*:?comment>/).forEach(function(x,index){if(x===""||x.trim()==="")return;var y=parsexmltag(x.match(/<(?:\w+:)?comment[^>]*>/)[0]);var comment={author:y.authorId&&authors[y.authorId]?authors[y.authorId]:undefined,ref:y.ref,guid:y.guid};var cell=decode_cell(y.ref);if(opts.sheetRows&&opts.sheetRows<=cell.r)return;var textMatch=x.match(/<text>([^\u2603]*)<\/text>/);if(!textMatch||!textMatch[1])return;var rt=parse_si(textMatch[1]);comment.r=rt.r;comment.t=rt.t;if(opts.cellHTML)comment.h=rt.h;commentList.push(comment)});return commentList}function write_comments_xml(data,opts){}function parse_BrtBeginComment(data,length){var out={};out.iauthor=data.read_shift(4);var rfx=parse_UncheckedRfX(data,16);out.rfx=rfx.s;out.ref=encode_cell(rfx.s);data.l+=16;return out}var parse_BrtCommentAuthor=parse_XLWideString;var parse_BrtCommentText=parse_RichStr;function parse_comments_bin(data,opts){var out=[];var authors=[];var c={};var pass=false;recordhopper(data,function hopper_cmnt(val,R,RT){switch(R.n){case"BrtCommentAuthor":authors.push(val);break;case"BrtBeginComment":c=val;break;case"BrtCommentText":c.t=val.t;c.h=val.h;c.r=val.r;break;case"BrtEndComment":c.author=authors[c.iauthor];delete c.iauthor;if(opts.sheetRows&&opts.sheetRows<=c.rfx.r)break;delete c.rfx;out.push(c);break;case"BrtBeginComments":break;case"BrtEndComments":break;case"BrtBeginCommentAuthors":break;case"BrtEndCommentAuthors":break;case"BrtBeginCommentList":break;case"BrtEndCommentList":break;default:if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R.n)}});return out}function write_comments_bin(data,opts){}var rc_to_a1=function(){var rcregex=/(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g;var rcbase;function rcfunc($$,$1,$2,$3,$4,$5){var R=$3.length>0?parseInt($3,10)|0:0,C=$5.length>0?parseInt($5,10)|0:0;if(C<0&&$4.length===0)C=0;if($4.length>0)C+=rcbase.c;if($2.length>0)R+=rcbase.r;return $1+encode_col(C)+encode_row(R)}return function rc_to_a1(fstr,base){rcbase=base;return fstr.replace(rcregex,rcfunc)}}();function parseread(l){return function(blob,length){blob.l+=l;return}}function parseread1(blob,length){blob.l+=1;return}function parse_ColRelU(blob,length){var c=blob.read_shift(2);return[c&16383,c>>14&1,c>>15&1]}function parse_RgceArea(blob,length){var r=blob.read_shift(2),R=blob.read_shift(2);var c=parse_ColRelU(blob,2);var C=parse_ColRelU(blob,2);return{s:{r:r,c:c[0],cRel:c[1],rRel:c[2]},e:{r:R,c:C[0],cRel:C[1],rRel:C[2]}}}function parse_RgceAreaRel(blob,length){var r=blob.read_shift(2),R=blob.read_shift(2);var c=parse_ColRelU(blob,2);var C=parse_ColRelU(blob,2);return{s:{r:r,c:c[0],cRel:c[1],rRel:c[2]},e:{r:R,c:C[0],cRel:C[1],rRel:C[2]}}}function parse_RgceLoc(blob,length){var r=blob.read_shift(2);var c=parse_ColRelU(blob,2);return{r:r,c:c[0],cRel:c[1],rRel:c[2]}}function parse_RgceLocRel(blob,length){var r=blob.read_shift(2);var cl=blob.read_shift(2);+ var cRel=(cl&32768)>>15,rRel=(cl&16384)>>14;cl&=16383;if(cRel!==0)while(cl>=256)cl-=256;return{r:r,c:cl,cRel:cRel,rRel:rRel}}function parse_PtgArea(blob,length){var type=(blob[blob.l++]&96)>>5;var area=parse_RgceArea(blob,8);return[type,area]}function parse_PtgArea3d(blob,length){var type=(blob[blob.l++]&96)>>5;var ixti=blob.read_shift(2);var area=parse_RgceArea(blob,8);return[type,ixti,area]}function parse_PtgAreaErr(blob,length){var type=(blob[blob.l++]&96)>>5;blob.l+=8;return[type]}function parse_PtgAreaErr3d(blob,length){var type=(blob[blob.l++]&96)>>5;var ixti=blob.read_shift(2);blob.l+=8;return[type,ixti]}function parse_PtgAreaN(blob,length){var type=(blob[blob.l++]&96)>>5;var area=parse_RgceAreaRel(blob,8);return[type,area]}function parse_PtgArray(blob,length){var type=(blob[blob.l++]&96)>>5;blob.l+=7;return[type]}function parse_PtgAttrBaxcel(blob,length){var bitSemi=blob[blob.l+1]&1;var bitBaxcel=1;blob.l+=4;return[bitSemi,bitBaxcel]}function parse_PtgAttrChoose(blob,length){blob.l+=2;var offset=blob.read_shift(2);var o=[];for(var i=0;i<=offset;++i)o.push(blob.read_shift(2));return o}function parse_PtgAttrGoto(blob,length){var bitGoto=blob[blob.l+1]&255?1:0;blob.l+=2;return[bitGoto,blob.read_shift(2)]}function parse_PtgAttrIf(blob,length){var bitIf=blob[blob.l+1]&255?1:0;blob.l+=2;return[bitIf,blob.read_shift(2)]}function parse_PtgAttrSemi(blob,length){var bitSemi=blob[blob.l+1]&255?1:0;blob.l+=4;return[bitSemi]}function parse_PtgAttrSpaceType(blob,length){var type=blob.read_shift(1),cch=blob.read_shift(1);return[type,cch]}function parse_PtgAttrSpace(blob,length){blob.read_shift(2);return parse_PtgAttrSpaceType(blob,2)}function parse_PtgAttrSpaceSemi(blob,length){blob.read_shift(2);return parse_PtgAttrSpaceType(blob,2)}function parse_PtgRef(blob,length){var ptg=blob[blob.l]&31;var type=(blob[blob.l]&96)>>5;blob.l+=1;var loc=parse_RgceLoc(blob,4);return[type,loc]}function parse_PtgRefN(blob,length){var ptg=blob[blob.l]&31;var type=(blob[blob.l]&96)>>5;blob.l+=1;var loc=parse_RgceLocRel(blob,4);return[type,loc]}function parse_PtgRef3d(blob,length){var ptg=blob[blob.l]&31;var type=(blob[blob.l]&96)>>5;blob.l+=1;var ixti=blob.read_shift(2);var loc=parse_RgceLoc(blob,4);return[type,ixti,loc]}function parse_PtgFunc(blob,length){var ptg=blob[blob.l]&31;var type=(blob[blob.l]&96)>>5;blob.l+=1;var iftab=blob.read_shift(2);return[FtabArgc[iftab],Ftab[iftab]]}function parse_PtgFuncVar(blob,length){blob.l++;var cparams=blob.read_shift(1),tab=parsetab(blob);return[cparams,(tab[0]===0?Ftab:Cetab)[tab[1]]]}function parsetab(blob,length){return[blob[blob.l+1]>>7,blob.read_shift(2)&32767]}var parse_PtgAttrSum=parseread(4);var parse_PtgConcat=parseread1;function parse_PtgExp(blob,length){blob.l++;var row=blob.read_shift(2);var col=blob.read_shift(2);return[row,col]}function parse_PtgErr(blob,length){blob.l++;return BErr[blob.read_shift(1)]}function parse_PtgInt(blob,length){blob.l++;return blob.read_shift(2)}function parse_PtgBool(blob,length){blob.l++;return blob.read_shift(1)!==0}function parse_PtgNum(blob,length){blob.l++;return parse_Xnum(blob,8)}function parse_PtgStr(blob,length){blob.l++;return parse_ShortXLUnicodeString(blob)}function parse_SerAr(blob){var val=[];switch(val[0]=blob.read_shift(1)){case 4:val[1]=parsebool(blob,1)?"TRUE":"FALSE";blob.l+=7;break;case 16:val[1]=BErr[blob[blob.l]];blob.l+=8;break;case 0:blob.l+=8;break;case 1:val[1]=parse_Xnum(blob,8);break;case 2:val[1]=parse_XLUnicodeString(blob);break}return val}function parse_PtgExtraMem(blob,cce){var count=blob.read_shift(2);var out=[];for(var i=0;i!=count;++i)out.push(parse_Ref8U(blob,8));return out}function parse_PtgExtraArray(blob){var cols=1+blob.read_shift(1);var rows=1+blob.read_shift(2);for(var i=0,o=[];i!=rows&&(o[i]=[]);++i)for(var j=0;j!=cols;++j)o[i][j]=parse_SerAr(blob);return o}function parse_PtgName(blob,length){var type=blob.read_shift(1)>>>5&3;var nameindex=blob.read_shift(4);return[type,0,nameindex]}function parse_PtgNameX(blob,length){var type=blob.read_shift(1)>>>5&3;var ixti=blob.read_shift(2);var nameindex=blob.read_shift(4);return[type,ixti,nameindex]}function parse_PtgMemArea(blob,length){var type=blob.read_shift(1)>>>5&3;blob.l+=4;var cce=blob.read_shift(2);return[type,cce]}function parse_PtgMemFunc(blob,length){var type=blob.read_shift(1)>>>5&3;var cce=blob.read_shift(2);return[type,cce]}function parse_PtgRefErr(blob,length){var type=blob.read_shift(1)>>>5&3;blob.l+=4;return[type]}var parse_PtgAdd=parseread1;var parse_PtgDiv=parseread1;var parse_PtgEq=parseread1;var parse_PtgGe=parseread1;var parse_PtgGt=parseread1;var parse_PtgIsect=parseread1;var parse_PtgLe=parseread1;var parse_PtgLt=parseread1;var parse_PtgMissArg=parseread1;var parse_PtgMul=parseread1;var parse_PtgNe=parseread1;var parse_PtgParen=parseread1;var parse_PtgPercent=parseread1;var parse_PtgPower=parseread1;var parse_PtgRange=parseread1;var parse_PtgSub=parseread1;var parse_PtgUminus=parseread1;var parse_PtgUnion=parseread1;var parse_PtgUplus=parseread1;var parse_PtgMemErr=parsenoop;var parse_PtgMemNoMem=parsenoop;var parse_PtgRefErr3d=parsenoop;var parse_PtgTbl=parsenoop;var PtgTypes={1:{n:"PtgExp",f:parse_PtgExp},2:{n:"PtgTbl",f:parse_PtgTbl},3:{n:"PtgAdd",f:parse_PtgAdd},4:{n:"PtgSub",f:parse_PtgSub},5:{n:"PtgMul",f:parse_PtgMul},6:{n:"PtgDiv",f:parse_PtgDiv},7:{n:"PtgPower",f:parse_PtgPower},8:{n:"PtgConcat",f:parse_PtgConcat},9:{n:"PtgLt",f:parse_PtgLt},10:{n:"PtgLe",f:parse_PtgLe},11:{n:"PtgEq",f:parse_PtgEq},12:{n:"PtgGe",f:parse_PtgGe},13:{n:"PtgGt",f:parse_PtgGt},14:{n:"PtgNe",f:parse_PtgNe},15:{n:"PtgIsect",f:parse_PtgIsect},16:{n:"PtgUnion",f:parse_PtgUnion},17:{n:"PtgRange",f:parse_PtgRange},18:{n:"PtgUplus",f:parse_PtgUplus},19:{n:"PtgUminus",f:parse_PtgUminus},20:{n:"PtgPercent",f:parse_PtgPercent},21:{n:"PtgParen",f:parse_PtgParen},22:{n:"PtgMissArg",f:parse_PtgMissArg},23:{n:"PtgStr",f:parse_PtgStr},28:{n:"PtgErr",f:parse_PtgErr},29:{n:"PtgBool",f:parse_PtgBool},30:{n:"PtgInt",f:parse_PtgInt},31:{n:"PtgNum",f:parse_PtgNum},32:{n:"PtgArray",f:parse_PtgArray},33:{n:"PtgFunc",f:parse_PtgFunc},34:{n:"PtgFuncVar",f:parse_PtgFuncVar},35:{n:"PtgName",f:parse_PtgName},36:{n:"PtgRef",f:parse_PtgRef},37:{n:"PtgArea",f:parse_PtgArea},38:{n:"PtgMemArea",f:parse_PtgMemArea},39:{n:"PtgMemErr",f:parse_PtgMemErr},40:{n:"PtgMemNoMem",f:parse_PtgMemNoMem},41:{n:"PtgMemFunc",f:parse_PtgMemFunc},42:{n:"PtgRefErr",f:parse_PtgRefErr},43:{n:"PtgAreaErr",f:parse_PtgAreaErr},44:{n:"PtgRefN",f:parse_PtgRefN},45:{n:"PtgAreaN",f:parse_PtgAreaN},57:{n:"PtgNameX",f:parse_PtgNameX},58:{n:"PtgRef3d",f:parse_PtgRef3d},59:{n:"PtgArea3d",f:parse_PtgArea3d},60:{n:"PtgRefErr3d",f:parse_PtgRefErr3d},61:{n:"PtgAreaErr3d",f:parse_PtgAreaErr3d},255:{}};var PtgDupes={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61};(function(){for(var y in PtgDupes)PtgTypes[y]=PtgTypes[PtgDupes[y]]})();var Ptg18={};var Ptg19={1:{n:"PtgAttrSemi",f:parse_PtgAttrSemi},2:{n:"PtgAttrIf",f:parse_PtgAttrIf},4:{n:"PtgAttrChoose",f:parse_PtgAttrChoose},8:{n:"PtgAttrGoto",f:parse_PtgAttrGoto},16:{n:"PtgAttrSum",f:parse_PtgAttrSum},32:{n:"PtgAttrBaxcel",f:parse_PtgAttrBaxcel},64:{n:"PtgAttrSpace",f:parse_PtgAttrSpace},65:{n:"PtgAttrSpaceSemi",f:parse_PtgAttrSpaceSemi},255:{}};function parse_Formula(blob,length,opts){var cell=parse_XLSCell(blob,6);var val=parse_FormulaValue(blob,8);var flags=blob.read_shift(1);blob.read_shift(1);var chn=blob.read_shift(4);var cbf="";if(opts.biff===5)blob.l+=length-20;else cbf=parse_XLSCellParsedFormula(blob,length-20,opts);return{cell:cell,val:val[0],formula:cbf,shared:flags>>3&1,tt:val[1]}}function parse_FormulaValue(blob){var b;if(__readUInt16LE(blob,blob.l+6)!==65535)return[parse_Xnum(blob),"n"];switch(blob[blob.l]){case 0:blob.l+=8;return["String","s"];case 1:b=blob[blob.l+2]===1;blob.l+=8;return[b,"b"];case 2:b=blob[blob.l+2];blob.l+=8;return[b,"e"];case 3:blob.l+=8;return["","s"]}}function parse_RgbExtra(blob,length,rgce,opts){if(opts.biff<8)return parsenoop(blob,length);var target=blob.l+length;var o=[];for(var i=0;i!==rgce.length;++i){switch(rgce[i][0]){case"PtgArray":rgce[i][1]=parse_PtgExtraArray(blob);o.push(rgce[i][1]);break;case"PtgMemArea":rgce[i][2]=parse_PtgExtraMem(blob,rgce[i][1]);o.push(rgce[i][2]);break;default:break}}length=target-blob.l;if(length!==0)o.push(parsenoop(blob,length));return o}function parse_NameParsedFormula(blob,length,opts,cce){var target=blob.l+length;var rgce=parse_Rgce(blob,cce);var rgcb;if(target!==blob.l)rgcb=parse_RgbExtra(blob,target-blob.l,rgce,opts);return[rgce,rgcb]}function parse_XLSCellParsedFormula(blob,length,opts){var target=blob.l+length;var rgcb,cce=blob.read_shift(2);if(cce==65535)return[[],parsenoop(blob,length-2)];var rgce=parse_Rgce(blob,cce);if(length!==cce+2)rgcb=parse_RgbExtra(blob,length-cce-2,rgce,opts);return[rgce,rgcb]}function parse_SharedParsedFormula(blob,length,opts){var target=blob.l+length;var rgcb,cce=blob.read_shift(2);var rgce=parse_Rgce(blob,cce);if(cce==65535)return[[],parsenoop(blob,length-2)];if(length!==cce+2)rgcb=parse_RgbExtra(blob,target-cce-2,rgce,opts);return[rgce,rgcb]}function parse_ArrayParsedFormula(blob,length,opts,ref){var target=blob.l+length;var rgcb,cce=blob.read_shift(2);if(cce==65535)return[[],parsenoop(blob,length-2)];var rgce=parse_Rgce(blob,cce);if(length!==cce+2)rgcb=parse_RgbExtra(blob,target-cce-2,rgce,opts);return[rgce,rgcb]}function parse_Rgce(blob,length){var target=blob.l+length;var R,id,ptgs=[];while(target!=blob.l){length=target-blob.l;id=blob[blob.l];R=PtgTypes[id];if(id===24||id===25){id=blob[blob.l+1];R=(id===24?Ptg18:Ptg19)[id]}if(!R||!R.f){ptgs.push(parsenoop(blob,length))}else{ptgs.push([R.n,R.f(blob,length)])}}return ptgs}function mapper(x){return x.map(function f2(y){return y[1]}).join(",")}function stringify_formula(formula,range,cell,supbooks,opts){if(opts!==undefined&&opts.biff===5)return"BIFF5??";var _range=range!==undefined?range:{s:{c:0,r:0}};var stack=[],e1,e2,type,c,ixti,nameidx,r;if(!formula[0]||!formula[0][0])return"";for(var ff=0,fflen=formula[0].length;ff<fflen;++ff){var f=formula[0][ff];switch(f[0]){case"PtgUminus":stack.push("-"+stack.pop());break;case"PtgUplus":stack.push("+"+stack.pop());break;case"PtgPercent":stack.push(stack.pop()+"%");break;case"PtgAdd":e1=stack.pop();e2=stack.pop();stack.push(e2+"+"+e1);break;case"PtgSub":e1=stack.pop();e2=stack.pop();stack.push(e2+"-"+e1);break;case"PtgMul":e1=stack.pop();e2=stack.pop();stack.push(e2+"*"+e1);break;case"PtgDiv":e1=stack.pop();e2=stack.pop();stack.push(e2+"/"+e1);break;case"PtgPower":e1=stack.pop();e2=stack.pop();stack.push(e2+"^"+e1);break;case"PtgConcat":e1=stack.pop();e2=stack.pop();stack.push(e2+"&"+e1);break;case"PtgLt":e1=stack.pop();e2=stack.pop();stack.push(e2+"<"+e1);break;case"PtgLe":e1=stack.pop();e2=stack.pop();stack.push(e2+"<="+e1);break;case"PtgEq":e1=stack.pop();e2=stack.pop();stack.push(e2+"="+e1);break;case"PtgGe":e1=stack.pop();e2=stack.pop();stack.push(e2+">="+e1);break;case"PtgGt":e1=stack.pop();e2=stack.pop();stack.push(e2+">"+e1);break;case"PtgNe":e1=stack.pop();e2=stack.pop();stack.push(e2+"<>"+e1);break;case"PtgIsect":e1=stack.pop();e2=stack.pop();stack.push(e2+" "+e1);break;case"PtgUnion":e1=stack.pop();e2=stack.pop();stack.push(e2+","+e1);break;case"PtgRange":break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgRef":type=f[1][0];c=shift_cell_xls(decode_cell(encode_cell(f[1][1])),_range);stack.push(encode_cell(c));break;case"PtgRefN":type=f[1][0];c=shift_cell_xls(decode_cell(encode_cell(f[1][1])),cell);stack.push(encode_cell(c));break;case"PtgRef3d":type=f[1][0];ixti=f[1][1];c=shift_cell_xls(f[1][2],_range);stack.push(supbooks[1][ixti+1]+"!"+encode_cell(c));break;case"PtgFunc":case"PtgFuncVar":var argc=f[1][0],func=f[1][1];if(!argc)argc=0;var args=stack.slice(-argc);stack.length-=argc;if(func==="User")func=args.shift();stack.push(func+"("+args.join(",")+")");break;case"PtgBool":stack.push(f[1]?"TRUE":"FALSE");break;case"PtgInt":stack.push(f[1]);break;case"PtgNum":stack.push(String(f[1]));break;case"PtgStr":stack.push('"'+f[1]+'"');break;case"PtgErr":stack.push(f[1]);break;case"PtgArea":type=f[1][0];r=shift_range_xls(f[1][1],_range);stack.push(encode_range(r));break;case"PtgArea3d":type=f[1][0];ixti=f[1][1];r=f[1][2];stack.push(supbooks[1][ixti+1]+"!"+encode_range(r));break;case"PtgAttrSum":stack.push("SUM("+stack.pop()+")");break;case"PtgAttrSemi":break;case"PtgName":nameidx=f[1][2];var lbl=supbooks[0][nameidx];var name=lbl.Name;if(name in XLSXFutureFunctions)name=XLSXFutureFunctions[name];stack.push(name);break;case"PtgNameX":var bookidx=f[1][1];nameidx=f[1][2];var externbook;if(supbooks[bookidx+1])externbook=supbooks[bookidx+1][nameidx];else if(supbooks[bookidx-1])externbook=supbooks[bookidx-1][nameidx];if(!externbook)externbook={body:"??NAMEX??"};stack.push(externbook.body);break;case"PtgParen":stack.push("("+stack.pop()+")");break;case"PtgRefErr":stack.push("#REF!");break;case"PtgExp":c={c:f[1][1],r:f[1][0]};var q={c:cell.c,r:cell.r};if(supbooks.sharedf[encode_cell(c)]){var parsedf=supbooks.sharedf[encode_cell(c)];stack.push(stringify_formula(parsedf,_range,q,supbooks,opts))}else{var fnd=false;for(e1=0;e1!=supbooks.arrayf.length;++e1){e2=supbooks.arrayf[e1];if(c.c<e2[0].s.c||c.c>e2[0].e.c)continue;if(c.r<e2[0].s.r||c.r>e2[0].e.r)continue;stack.push(stringify_formula(e2[1],_range,q,supbooks,opts))}if(!fnd)stack.push(f[1])}break;case"PtgArray":stack.push("{"+f[1].map(mapper).join(";")+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":stack.push("");break;case"PtgAreaErr":break;case"PtgAreaN":stack.push("");break;case"PtgRefErr3d":break;case"PtgMemFunc":break;default:throw"Unrecognized Formula Token: "+f}}return stack[0]}function parse_XLSBCellParsedFormula(data,length){var cce=data.read_shift(4);return parsenoop(data,length-4)}var PtgDataType={1:"REFERENCE",2:"VALUE",3:"ARRAY"};var Cetab={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"};var Ftab={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD"};var FtabArgc={2:1,3:1,15:1,16:1,17:1,18:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,65:3,66:3,67:1,68:1,69:1,71:1,72:1,73:1,75:1,76:1,77:1,79:2,80:2,83:1,86:1,90:1,97:2,98:1,99:1,105:1,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,189:3,190:1,195:3,196:3,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,65535:0};var XLSXFutureFunctions={"_xlfn.ACOT":"ACOT","_xlfn.ACOTH":"ACOTH","_xlfn.AGGREGATE":"AGGREGATE","_xlfn.ARABIC":"ARABIC","_xlfn.AVERAGEIF":"AVERAGEIF","_xlfn.AVERAGEIFS":"AVERAGEIFS","_xlfn.BASE":"BASE","_xlfn.BETA.DIST":"BETA.DIST","_xlfn.BETA.INV":"BETA.INV","_xlfn.BINOM.DIST":"BINOM.DIST","_xlfn.BINOM.DIST.RANGE":"BINOM.DIST.RANGE","_xlfn.BINOM.INV":"BINOM.INV","_xlfn.BITAND":"BITAND","_xlfn.BITLSHIFT":"BITLSHIFT","_xlfn.BITOR":"BITOR","_xlfn.BITRSHIFT":"BITRSHIFT","_xlfn.BITXOR":"BITXOR","_xlfn.CEILING.MATH":"CEILING.MATH","_xlfn.CEILING.PRECISE":"CEILING.PRECISE","_xlfn.CHISQ.DIST":"CHISQ.DIST","_xlfn.CHISQ.DIST.RT":"CHISQ.DIST.RT","_xlfn.CHISQ.INV":"CHISQ.INV","_xlfn.CHISQ.INV.RT":"CHISQ.INV.RT","_xlfn.CHISQ.TEST":"CHISQ.TEST","_xlfn.COMBINA":"COMBINA","_xlfn.CONFIDENCE.NORM":"CONFIDENCE.NORM","_xlfn.CONFIDENCE.T":"CONFIDENCE.T","_xlfn.COT":"COT","_xlfn.COTH":"COTH","_xlfn.COUNTIFS":"COUNTIFS","_xlfn.COVARIANCE.P":"COVARIANCE.P","_xlfn.COVARIANCE.S":"COVARIANCE.S","_xlfn.CSC":"CSC","_xlfn.CSCH":"CSCH","_xlfn.DAYS":"DAYS","_xlfn.DECIMAL":"DECIMAL","_xlfn.ECMA.CEILING":"ECMA.CEILING","_xlfn.ERF.PRECISE":"ERF.PRECISE","_xlfn.ERFC.PRECISE":"ERFC.PRECISE","_xlfn.EXPON.DIST":"EXPON.DIST","_xlfn.F.DIST":"F.DIST","_xlfn.F.DIST.RT":"F.DIST.RT","_xlfn.F.INV":"F.INV","_xlfn.F.INV.RT":"F.INV.RT","_xlfn.F.TEST":"F.TEST","_xlfn.FILTERXML":"FILTERXML","_xlfn.FLOOR.MATH":"FLOOR.MATH","_xlfn.FLOOR.PRECISE":"FLOOR.PRECISE","_xlfn.FORMULATEXT":"FORMULATEXT","_xlfn.GAMMA":"GAMMA","_xlfn.GAMMA.DIST":"GAMMA.DIST","_xlfn.GAMMA.INV":"GAMMA.INV","_xlfn.GAMMALN.PRECISE":"GAMMALN.PRECISE","_xlfn.GAUSS":"GAUSS","_xlfn.HYPGEOM.DIST":"HYPGEOM.DIST","_xlfn.IFNA":"IFNA","_xlfn.IFERROR":"IFERROR","_xlfn.IMCOSH":"IMCOSH","_xlfn.IMCOT":"IMCOT","_xlfn.IMCSC":"IMCSC","_xlfn.IMCSCH":"IMCSCH","_xlfn.IMSEC":"IMSEC","_xlfn.IMSECH":"IMSECH","_xlfn.IMSINH":"IMSINH","_xlfn.IMTAN":"IMTAN","_xlfn.ISFORMULA":"ISFORMULA","_xlfn.ISO.CEILING":"ISO.CEILING","_xlfn.ISOWEEKNUM":"ISOWEEKNUM","_xlfn.LOGNORM.DIST":"LOGNORM.DIST","_xlfn.LOGNORM.INV":"LOGNORM.INV","_xlfn.MODE.MULT":"MODE.MULT","_xlfn.MODE.SNGL":"MODE.SNGL","_xlfn.MUNIT":"MUNIT","_xlfn.NEGBINOM.DIST":"NEGBINOM.DIST","_xlfn.NETWORKDAYS.INTL":"NETWORKDAYS.INTL","_xlfn.NIGBINOM":"NIGBINOM","_xlfn.NORM.DIST":"NORM.DIST","_xlfn.NORM.INV":"NORM.INV","_xlfn.NORM.S.DIST":"NORM.S.DIST","_xlfn.NORM.S.INV":"NORM.S.INV","_xlfn.NUMBERVALUE":"NUMBERVALUE","_xlfn.PDURATION":"PDURATION","_xlfn.PERCENTILE.EXC":"PERCENTILE.EXC","_xlfn.PERCENTILE.INC":"PERCENTILE.INC","_xlfn.PERCENTRANK.EXC":"PERCENTRANK.EXC","_xlfn.PERCENTRANK.INC":"PERCENTRANK.INC","_xlfn.PERMUTATIONA":"PERMUTATIONA","_xlfn.PHI":"PHI","_xlfn.POISSON.DIST":"POISSON.DIST","_xlfn.QUARTILE.EXC":"QUARTILE.EXC","_xlfn.QUARTILE.INC":"QUARTILE.INC","_xlfn.QUERYSTRING":"QUERYSTRING","_xlfn.RANK.AVG":"RANK.AVG","_xlfn.RANK.EQ":"RANK.EQ","_xlfn.RRI":"RRI","_xlfn.SEC":"SEC","_xlfn.SECH":"SECH","_xlfn.SHEET":"SHEET","_xlfn.SHEETS":"SHEETS","_xlfn.SKEW.P":"SKEW.P","_xlfn.STDEV.P":"STDEV.P","_xlfn.STDEV.S":"STDEV.S","_xlfn.SUMIFS":"SUMIFS","_xlfn.T.DIST":"T.DIST","_xlfn.T.DIST.2T":"T.DIST.2T","_xlfn.T.DIST.RT":"T.DIST.RT","_xlfn.T.INV":"T.INV","_xlfn.T.INV.2T":"T.INV.2T","_xlfn.T.TEST":"T.TEST","_xlfn.UNICHAR":"UNICHAR","_xlfn.UNICODE":"UNICODE","_xlfn.VAR.P":"VAR.P","_xlfn.VAR.S":"VAR.S","_xlfn.WEBSERVICE":"WEBSERVICE","_xlfn.WEIBULL.DIST":"WEIBULL.DIST","_xlfn.WORKDAY.INTL":"WORKDAY.INTL","_xlfn.XOR":"XOR","_xlfn.Z.TEST":"Z.TEST"};var strs={};var _ssfopts={};RELS.WS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";function get_sst_id(sst,str){for(var i=0,len=sst.length;i<len;++i)if(sst[i].t===str){sst.Count++;return i}sst[len]={t:str};sst.Count++;sst.Unique++;return len}function get_cell_style(styles,cell,opts){if(typeof style_builder!="undefined"){if(/^\d+$/.exec(cell.s)){return cell.s}if(cell.s&&cell.s==+cell.s){return cell.s}var s=cell.s||{};if(cell.z)s.numFmt=cell.z;return style_builder.addStyle(s)}else{var z=opts.revssf[cell.z!=null?cell.z:"General"];for(var i=0,len=styles.length;i!=len;++i)if(styles[i].numFmtId===z)return i;styles[len]={numFmtId:z,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1};return len}}function get_cell_style_csf(cellXf){if(cellXf){var s={};if(typeof cellXf.numFmtId!=undefined){s.numFmt=SSF._table[cellXf.numFmtId]}if(cellXf.fillId){s.fill=styles.Fills[cellXf.fillId]}if(cellXf.fontId){s.font=styles.Fonts[cellXf.fontId]}if(cellXf.borderId){s.border=styles.Borders[cellXf.borderId];+}if(cellXf.applyAlignment==1){s.alignment=cellXf.alignment}return JSON.parse(JSON.stringify(s))}return null}function safe_format(p,fmtid,fillid,opts){try{if(p.t==="e")p.w=p.w||BErr[p.v];else if(fmtid===0){if(p.t==="n"){if((p.v|0)===p.v)p.w=SSF._general_int(p.v,_ssfopts);else p.w=SSF._general_num(p.v,_ssfopts)}else if(p.t==="d"){var dd=datenum(p.v);if((dd|0)===dd)p.w=SSF._general_int(dd,_ssfopts);else p.w=SSF._general_num(dd,_ssfopts)}else if(p.v===undefined)return"";else p.w=SSF._general(p.v,_ssfopts)}else if(p.t==="d")p.w=SSF.format(fmtid,datenum(p.v),_ssfopts);else p.w=SSF.format(fmtid,p.v,_ssfopts);if(opts.cellNF)p.z=SSF._table[fmtid]}catch(e){if(opts.WTF)throw e}}function parse_ws_xml_dim(ws,s){var d=safe_decode_range(s);if(d.s.r<=d.e.r&&d.s.c<=d.e.c&&d.s.r>=0&&d.s.c>=0)ws["!ref"]=encode_range(d)}var mergecregex=/<mergeCell ref="[A-Z0-9:]+"\s*\/>/g;var sheetdataregex=/<(?:\w+:)?sheetData>([^\u2603]*)<\/(?:\w+:)?sheetData>/;var hlinkregex=/<hyperlink[^>]*\/>/g;var dimregex=/"(\w*:\w*)"/;var colregex=/<col[^>]*\/>/g;function parse_ws_xml(data,opts,rels){if(!data)return data;var s={};var ridx=data.indexOf("<dimension");if(ridx>0){var ref=data.substr(ridx,50).match(dimregex);if(ref!=null)parse_ws_xml_dim(s,ref[1])}var mergecells=[];if(data.indexOf("</mergeCells>")!==-1){var merges=data.match(mergecregex);for(ridx=0;ridx!=merges.length;++ridx)mergecells[ridx]=safe_decode_range(merges[ridx].substr(merges[ridx].indexOf('"')+1))}var columns=[];if(opts.cellStyles&&data.indexOf("</cols>")!==-1){var cols=data.match(colregex);parse_ws_xml_cols(columns,cols)}var refguess={s:{r:1e6,c:1e6},e:{r:0,c:0}};var mtch=data.match(sheetdataregex);if(mtch)parse_ws_xml_data(mtch[1],s,opts,refguess);if(data.indexOf("</hyperlinks>")!==-1)parse_ws_xml_hlinks(s,data.match(hlinkregex),rels);if(!s["!ref"]&&refguess.e.c>=refguess.s.c&&refguess.e.r>=refguess.s.r)s["!ref"]=encode_range(refguess);if(opts.sheetRows>0&&s["!ref"]){var tmpref=safe_decode_range(s["!ref"]);if(opts.sheetRows<+tmpref.e.r){tmpref.e.r=opts.sheetRows-1;if(tmpref.e.r>refguess.e.r)tmpref.e.r=refguess.e.r;if(tmpref.e.r<tmpref.s.r)tmpref.s.r=tmpref.e.r;if(tmpref.e.c>refguess.e.c)tmpref.e.c=refguess.e.c;if(tmpref.e.c<tmpref.s.c)tmpref.s.c=tmpref.e.c;s["!fullref"]=s["!ref"];s["!ref"]=encode_range(tmpref)}}if(mergecells.length>0)s["!merges"]=mergecells;if(columns.length>0)s["!cols"]=columns;return s}function write_ws_xml_merges(merges){if(merges.length==0)return"";var o='<mergeCells count="'+merges.length+'">';for(var i=0;i!=merges.length;++i)o+='<mergeCell ref="'+encode_range(merges[i])+'"/>';return o+"</mergeCells>"}function write_ws_xml_pagesetup(setup){var pageSetup=writextag("pageSetup",null,{scale:setup.scale||"100",orientation:setup.orientation||"portrait",horizontalDpi:setup.horizontalDpi||"4294967292",verticalDpi:setup.verticalDpi||"4294967292"});return pageSetup}function parse_ws_xml_hlinks(s,data,rels){for(var i=0;i!=data.length;++i){var val=parsexmltag(data[i],true);if(!val.ref)return;var rel=rels?rels["!id"][val.id]:null;if(rel){val.Target=rel.Target;if(val.location)val.Target+="#"+val.location;val.Rel=rel}else{val.Target=val.location;rel={Target:val.location,TargetMode:"Internal"};val.Rel=rel}var rng=safe_decode_range(val.ref);for(var R=rng.s.r;R<=rng.e.r;++R)for(var C=rng.s.c;C<=rng.e.c;++C){var addr=encode_cell({c:C,r:R});if(!s[addr])s[addr]={t:"stub",v:undefined};s[addr].l=val}}}function parse_ws_xml_cols(columns,cols){var seencol=false;for(var coli=0;coli!=cols.length;++coli){var coll=parsexmltag(cols[coli],true);var colm=parseInt(coll.min,10)-1,colM=parseInt(coll.max,10)-1;delete coll.min;delete coll.max;if(!seencol&&coll.width){seencol=true;find_mdw(+coll.width,coll)}if(coll.width){coll.wpx=width2px(+coll.width);coll.wch=px2char(coll.wpx);coll.MDW=MDW}while(colm<=colM)columns[colm++]=coll}}function write_ws_xml_cols(ws,cols){var o=["<cols>"],col,width;for(var i=0;i!=cols.length;++i){if(!(col=cols[i]))continue;var p={min:i+1,max:i+1};width=-1;if(col.wpx)width=px2char(col.wpx);else if(col.wch)width=col.wch;if(width>-1){p.width=char2width(width);p.customWidth=1}o[o.length]=writextag("col",null,p)}o[o.length]="</cols>";return o.join("")}function write_ws_xml_cell(cell,ref,ws,opts,idx,wb){if(cell.v===undefined&&cell.s===undefined)return"";var vv="";var oldt=cell.t,oldv=cell.v;switch(cell.t){case"b":vv=cell.v?"1":"0";break;case"n":vv=""+cell.v;break;case"e":vv=BErr[cell.v];break;case"d":if(opts.cellDates)vv=new Date(cell.v).toISOString();else{cell.t="n";vv=""+(cell.v=datenum(cell.v));if(typeof cell.z==="undefined")cell.z=SSF._table[14]}break;default:vv=cell.v;break}var v=writetag("v",escapexml(vv)),o={r:ref};var os=get_cell_style(opts.cellXfs,cell,opts);if(os!==0)o.s=os;switch(cell.t){case"n":break;case"d":o.t="d";break;case"b":o.t="b";break;case"e":o.t="e";break;default:if(opts.bookSST){v=writetag("v",""+get_sst_id(opts.Strings,cell.v));o.t="s";break}o.t="str";break}if(cell.t!=oldt){cell.t=oldt;cell.v=oldv}return writextag("c",v,o)}var parse_ws_xml_data=function parse_ws_xml_data_factory(){var cellregex=/<(?:\w+:)?c[ >]/,rowregex=/<\/(?:\w+:)?row>/;var rregex=/r=["']([^"']*)["']/,isregex=/<is>([\S\s]*?)<\/is>/;var match_v=matchtag("v"),match_f=matchtag("f");return function parse_ws_xml_data(sdata,s,opts,guess){var ri=0,x="",cells=[],cref=[],idx=0,i=0,cc=0,d="",p;var tag,tagr=0,tagc=0;var sstr;var fmtid=0,fillid=0,do_format=Array.isArray(styles.CellXf),cf;for(var marr=sdata.split(rowregex),mt=0,marrlen=marr.length;mt!=marrlen;++mt){x=marr[mt].trim();var xlen=x.length;if(xlen===0)continue;for(ri=0;ri<xlen;++ri)if(x.charCodeAt(ri)===62)break;++ri;tag=parsexmltag(x.substr(0,ri),true);tagr=typeof tag.r!=="undefined"?parseInt(tag.r,10):tagr+1;tagc=-1;if(opts.sheetRows&&opts.sheetRows<tagr)continue;if(guess.s.r>tagr-1)guess.s.r=tagr-1;if(guess.e.r<tagr-1)guess.e.r=tagr-1;cells=x.substr(ri).split(cellregex);for(ri=typeof tag.r==="undefined"?0:1;ri!=cells.length;++ri){x=cells[ri].trim();if(x.length===0)continue;cref=x.match(rregex);idx=ri;i=0;cc=0;x="<c "+(x.substr(0,1)=="<"?">":"")+x;if(cref!==null&&cref.length===2){idx=0;d=cref[1];for(i=0;i!=d.length;++i){if((cc=d.charCodeAt(i)-64)<1||cc>26)break;idx=26*idx+cc}--idx;tagc=idx}else++tagc;for(i=0;i!=x.length;++i)if(x.charCodeAt(i)===62)break;++i;tag=parsexmltag(x.substr(0,i),true);if(!tag.r)tag.r=utils.encode_cell({r:tagr-1,c:tagc});d=x.substr(i);p={t:""};if((cref=d.match(match_v))!==null&&cref[1]!=="")p.v=unescapexml(cref[1]);if(opts.cellFormula&&(cref=d.match(match_f))!==null)p.f=unescapexml(cref[1]);if(tag.t===undefined&&tag.s===undefined&&p.v===undefined){if(!opts.sheetStubs)continue;p.t="stub"}else p.t=tag.t||"n";if(guess.s.c>idx)guess.s.c=idx;if(guess.e.c<idx)guess.e.c=idx;switch(p.t){case"n":p.v=parseFloat(p.v);if(isNaN(p.v))p.v="";break;case"s":sstr=strs[parseInt(p.v,10)];p.v=sstr.t;p.r=sstr.r;if(opts.cellHTML)p.h=sstr.h;break;case"str":p.t="s";p.v=p.v!=null?utf8read(p.v):"";if(opts.cellHTML)p.h=p.v;break;case"inlineStr":cref=d.match(isregex);p.t="s";if(cref!==null){sstr=parse_si(cref[1]);p.v=sstr.t}else p.v="";break;case"b":p.v=parsexmlbool(p.v);break;case"d":if(!opts.cellDates){p.v=datenum(p.v);p.t="n"}break;case"e":p.w=p.v;p.v=RBErr[p.v];break}fmtid=fillid=0;if(do_format&&tag.s!==undefined){cf=styles.CellXf[tag.s];if(opts.cellStyles){p.s=get_cell_style_csf(cf)}if(cf!=null){if(cf.numFmtId!=null)fmtid=cf.numFmtId;if(opts.cellStyles&&cf.fillId!=null)fillid=cf.fillId}}safe_format(p,fmtid,fillid,opts);s[tag.r]=p}}}}();function write_ws_xml_data(ws,opts,idx,wb){var o=[],r=[],range=safe_decode_range(ws["!ref"]),cell,ref,rr="",cols=[],R,C;for(C=range.s.c;C<=range.e.c;++C)cols[C]=encode_col(C);for(R=range.s.r;R<=range.e.r;++R){r=[];rr=encode_row(R);for(C=range.s.c;C<=range.e.c;++C){ref=cols[C]+rr;if(ws[ref]===undefined)continue;if((cell=write_ws_xml_cell(ws[ref],ref,ws,opts,idx,wb))!=null)r.push(cell)}if(r.length>0)o[o.length]=writextag("row",r.join(""),{r:rr})}return o.join("")}var WS_XML_ROOT=writextag("worksheet",null,{xmlns:XMLNS.main[0],"xmlns:r":XMLNS.r});function write_ws_xml(idx,opts,wb){var o=[XML_HEADER,WS_XML_ROOT];var s=wb.SheetNames[idx],sidx=0,rdata="";var ws=wb.Sheets[s];if(ws===undefined)ws={};var ref=ws["!ref"];if(ref===undefined)ref="A1";o[o.length]=writextag("dimension",null,{ref:ref});var sheetView=writextag("sheetView",null,{showGridLines:opts.showGridLines==false?"0":"1",tabSelected:opts.tabSelected===undefined?"0":opts.tabSelected,workbookViewId:opts.workbookViewId===undefined?"0":opts.workbookViewId});o[o.length]=writextag("sheetViews",sheetView);if(ws["!cols"]!==undefined&&ws["!cols"].length>0)o[o.length]=write_ws_xml_cols(ws,ws["!cols"]);o[sidx=o.length]="<sheetData/>";if(ws["!ref"]!==undefined){rdata=write_ws_xml_data(ws,opts,idx,wb);if(rdata.length>0)o[o.length]=rdata}if(o.length>sidx+1){o[o.length]="</sheetData>";o[sidx]=o[sidx].replace("/>",">")}if(ws["!merges"]!==undefined&&ws["!merges"].length>0)o[o.length]=write_ws_xml_merges(ws["!merges"]);if(ws["!pageSetup"]!==undefined)o[o.length]=write_ws_xml_pagesetup(ws["!pageSetup"]);if(ws["!rowBreaks"]!==undefined)o[o.length]=write_ws_xml_row_breaks(ws["!rowBreaks"]);if(ws["!colBreaks"]!==undefined)o[o.length]=write_ws_xml_col_breaks(ws["!colBreaks"]);if(o.length>2){o[o.length]="</worksheet>";o[1]=o[1].replace("/>",">")}return o.join("")}function write_ws_xml_row_breaks(breaks){console.log("Writing breaks");var brk=[];for(var i=0;i<breaks.length;i++){var thisBreak=""+breaks[i];var nextBreak=""+(breaks[i+1]||"16383");brk.push(writextag("brk",null,{id:thisBreak,max:nextBreak,man:"1"}))}return writextag("rowBreaks",brk.join(" "),{count:brk.length,manualBreakCount:brk.length})}function write_ws_xml_col_breaks(breaks){console.log("Writing breaks");var brk=[];for(var i=0;i<breaks.length;i++){var thisBreak=""+breaks[i];var nextBreak=""+(breaks[i+1]||"1048575");brk.push(writextag("brk",null,{id:thisBreak,max:nextBreak,man:"1"}))}return writextag("colBreaks",brk.join(" "),{count:brk.length,manualBreakCount:brk.length})}function parse_BrtRowHdr(data,length){var z=[];z.r=data.read_shift(4);data.l+=length-4;return z}var parse_BrtWsDim=parse_UncheckedRfX;var write_BrtWsDim=write_UncheckedRfX;function parse_BrtWsProp(data,length){var z={};data.l+=19;z.name=parse_XLSBCodeName(data,length-19);return z}function parse_BrtCellBlank(data,length){var cell=parse_XLSBCell(data);return[cell]}function write_BrtCellBlank(cell,val,o){if(o==null)o=new_buf(8);return write_XLSBCell(val,o)}function parse_BrtCellBool(data,length){var cell=parse_XLSBCell(data);var fBool=data.read_shift(1);return[cell,fBool,"b"]}function parse_BrtCellError(data,length){var cell=parse_XLSBCell(data);var fBool=data.read_shift(1);return[cell,fBool,"e"]}function parse_BrtCellIsst(data,length){var cell=parse_XLSBCell(data);var isst=data.read_shift(4);return[cell,isst,"s"]}function parse_BrtCellReal(data,length){var cell=parse_XLSBCell(data);var value=parse_Xnum(data);return[cell,value,"n"]}function parse_BrtCellRk(data,length){var cell=parse_XLSBCell(data);var value=parse_RkNumber(data);return[cell,value,"n"]}function parse_BrtCellSt(data,length){var cell=parse_XLSBCell(data);var value=parse_XLWideString(data);return[cell,value,"str"]}function parse_BrtFmlaBool(data,length,opts){var cell=parse_XLSBCell(data);var value=data.read_shift(1);var o=[cell,value,"b"];if(opts.cellFormula){var formula=parse_XLSBCellParsedFormula(data,length-9);o[3]=""}else data.l+=length-9;return o}function parse_BrtFmlaError(data,length,opts){var cell=parse_XLSBCell(data);var value=data.read_shift(1);var o=[cell,value,"e"];if(opts.cellFormula){var formula=parse_XLSBCellParsedFormula(data,length-9);o[3]=""}else data.l+=length-9;return o}function parse_BrtFmlaNum(data,length,opts){var cell=parse_XLSBCell(data);var value=parse_Xnum(data);var o=[cell,value,"n"];if(opts.cellFormula){var formula=parse_XLSBCellParsedFormula(data,length-16);o[3]=""}else data.l+=length-16;return o}function parse_BrtFmlaString(data,length,opts){var start=data.l;var cell=parse_XLSBCell(data);var value=parse_XLWideString(data);var o=[cell,value,"str"];if(opts.cellFormula){var formula=parse_XLSBCellParsedFormula(data,start+length-data.l)}else data.l=start+length;return o}var parse_BrtMergeCell=parse_UncheckedRfX;function parse_BrtHLink(data,length,opts){var end=data.l+length;var rfx=parse_UncheckedRfX(data,16);var relId=parse_XLNullableWideString(data);var loc=parse_XLWideString(data);var tooltip=parse_XLWideString(data);var display=parse_XLWideString(data);data.l=end;return{rfx:rfx,relId:relId,loc:loc,tooltip:tooltip,display:display}}function parse_ws_bin(data,opts,rels){if(!data)return data;if(!rels)rels={"!id":{}};var s={};var ref;var refguess={s:{r:1e6,c:1e6},e:{r:0,c:0}};var pass=false,end=false;var row,p,cf,R,C,addr,sstr,rr;var mergecells=[];recordhopper(data,function ws_parse(val,R){if(end)return;switch(R.n){case"BrtWsDim":ref=val;break;case"BrtRowHdr":row=val;if(opts.sheetRows&&opts.sheetRows<=row.r)end=true;rr=encode_row(row.r);break;case"BrtFmlaBool":case"BrtFmlaError":case"BrtFmlaNum":case"BrtFmlaString":case"BrtCellBool":case"BrtCellError":case"BrtCellIsst":case"BrtCellReal":case"BrtCellRk":case"BrtCellSt":p={t:val[2]};switch(val[2]){case"n":p.v=val[1];break;case"s":sstr=strs[val[1]];p.v=sstr.t;p.r=sstr.r;break;case"b":p.v=val[1]?true:false;break;case"e":p.v=val[1];p.w=BErr[p.v];break;case"str":p.t="s";p.v=utf8read(val[1]);break}if(opts.cellFormula&&val.length>3)p.f=val[3];if(cf=styles.CellXf[val[0].iStyleRef])safe_format(p,cf.ifmt,null,opts);s[encode_col(C=val[0].c)+rr]=p;if(refguess.s.r>row.r)refguess.s.r=row.r;if(refguess.s.c>C)refguess.s.c=C;if(refguess.e.r<row.r)refguess.e.r=row.r;if(refguess.e.c<C)refguess.e.c=C;break;case"BrtCellBlank":if(!opts.sheetStubs)break;p={t:"s",v:undefined};s[encode_col(C=val[0].c)+rr]=p;if(refguess.s.r>row.r)refguess.s.r=row.r;if(refguess.s.c>C)refguess.s.c=C;if(refguess.e.r<row.r)refguess.e.r=row.r;if(refguess.e.c<C)refguess.e.c=C;break;case"BrtBeginMergeCells":break;case"BrtEndMergeCells":break;case"BrtMergeCell":mergecells.push(val);break;case"BrtHLink":var rel=rels["!id"][val.relId];if(rel){val.Target=rel.Target;if(val.loc)val.Target+="#"+val.loc;val.Rel=rel}for(R=val.rfx.s.r;R<=val.rfx.e.r;++R)for(C=val.rfx.s.c;C<=val.rfx.e.c;++C){addr=encode_cell({c:C,r:R});if(!s[addr])s[addr]={t:"s",v:undefined};s[addr].l=val}break;case"BrtArrFmla":break;case"BrtShrFmla":break;case"BrtBeginSheet":break;case"BrtWsProp":break;case"BrtSheetCalcProp":break;case"BrtBeginWsViews":break;case"BrtBeginWsView":break;case"BrtPane":break;case"BrtSel":break;case"BrtEndWsView":break;case"BrtEndWsViews":break;case"BrtACBegin":break;case"BrtRwDescent":break;case"BrtACEnd":break;case"BrtWsFmtInfoEx14":break;case"BrtWsFmtInfo":break;case"BrtBeginColInfos":break;case"BrtColInfo":break;case"BrtEndColInfos":break;case"BrtBeginSheetData":break;case"BrtEndSheetData":break;case"BrtSheetProtection":break;case"BrtPrintOptions":break;case"BrtMargins":break;case"BrtPageSetup":break;case"BrtFRTBegin":pass=true;break;case"BrtFRTEnd":pass=false;break;case"BrtEndSheet":break;case"BrtDrawing":break;case"BrtLegacyDrawing":break;case"BrtLegacyDrawingHF":break;case"BrtPhoneticInfo":break;case"BrtBeginHeaderFooter":break;case"BrtEndHeaderFooter":break;case"BrtBrk":break;case"BrtBeginRwBrk":break;case"BrtEndRwBrk":break;case"BrtBeginColBrk":break;case"BrtEndColBrk":break;case"BrtBeginUserShViews":break;case"BrtBeginUserShView":break;case"BrtEndUserShView":break;case"BrtEndUserShViews":break;case"BrtBkHim":break;case"BrtBeginOleObjects":break;case"BrtOleObject":break;case"BrtEndOleObjects":break;case"BrtBeginListParts":break;case"BrtListPart":break;case"BrtEndListParts":break;case"BrtBeginSortState":break;case"BrtBeginSortCond":break;case"BrtEndSortCond":break;case"BrtEndSortState":break;case"BrtBeginConditionalFormatting":break;case"BrtEndConditionalFormatting":break;case"BrtBeginCFRule":break;case"BrtEndCFRule":break;case"BrtBeginDVals":break;case"BrtDVal":break;case"BrtEndDVals":break;case"BrtRangeProtection":break;case"BrtBeginDCon":break;case"BrtEndDCon":break;case"BrtBeginDRefs":break;case"BrtDRef":break;case"BrtEndDRefs":break;case"BrtBeginActiveXControls":break;case"BrtActiveX":break;case"BrtEndActiveXControls":break;case"BrtBeginAFilter":break;case"BrtEndAFilter":break;case"BrtBeginFilterColumn":break;case"BrtBeginFilters":break;case"BrtFilter":break;case"BrtEndFilters":break;case"BrtEndFilterColumn":break;case"BrtDynamicFilter":break;case"BrtTop10Filter":break;case"BrtBeginCustomFilters":break;case"BrtCustomFilter":break;case"BrtEndCustomFilters":break;case"BrtBeginSmartTags":break;case"BrtBeginCellSmartTags":break;case"BrtBeginCellSmartTag":break;case"BrtCellSmartTagProperty":break;case"BrtEndCellSmartTag":break;case"BrtEndCellSmartTags":break;case"BrtEndSmartTags":break;case"BrtBeginCellWatches":break;case"BrtCellWatch":break;case"BrtEndCellWatches":break;case"BrtTable":break;case"BrtBeginCellIgnoreECs":break;case"BrtCellIgnoreEC":break;case"BrtEndCellIgnoreECs":break;default:if(!pass||opts.WTF)throw new Error("Unexpected record "+R.n)}},opts);if(!s["!ref"]&&(refguess.s.r<1e6||ref.e.r>0||ref.e.c>0||ref.s.r>0||ref.s.c>0))s["!ref"]=encode_range(ref);if(opts.sheetRows&&s["!ref"]){var tmpref=safe_decode_range(s["!ref"]);if(opts.sheetRows<+tmpref.e.r){tmpref.e.r=opts.sheetRows-1;if(tmpref.e.r>refguess.e.r)tmpref.e.r=refguess.e.r;if(tmpref.e.r<tmpref.s.r)tmpref.s.r=tmpref.e.r;if(tmpref.e.c>refguess.e.c)tmpref.e.c=refguess.e.c;if(tmpref.e.c<tmpref.s.c)tmpref.s.c=tmpref.e.c;s["!fullref"]=s["!ref"];s["!ref"]=encode_range(tmpref)}}if(mergecells.length>0)s["!merges"]=mergecells;return s}function write_ws_bin_cell(ba,cell,R,C,opts){if(cell.v===undefined)return"";var vv="";switch(cell.t){case"b":vv=cell.v?"1":"0";break;case"n":case"e":vv=""+cell.v;break;default:vv=cell.v;break}var o={r:R,c:C};o.s=get_cell_style(opts.cellXfs,cell,opts);switch(cell.t){case"s":case"str":if(opts.bookSST){vv=get_sst_id(opts.Strings,cell.v);o.t="s";break}o.t="str";break;case"n":break;case"b":o.t="b";break;case"e":o.t="e";break}write_record(ba,"BrtCellBlank",write_BrtCellBlank(cell,o))}function write_CELLTABLE(ba,ws,idx,opts,wb){var range=safe_decode_range(ws["!ref"]||"A1"),ref,rr="",cols=[];write_record(ba,"BrtBeginSheetData");for(var R=range.s.r;R<=range.e.r;++R){rr=encode_row(R);for(var C=range.s.c;C<=range.e.c;++C){if(R===range.s.r)cols[C]=encode_col(C);ref=cols[C]+rr;if(!ws[ref])continue;write_ws_bin_cell(ba,ws[ref],R,C,opts)}}write_record(ba,"BrtEndSheetData")}function write_ws_bin(idx,opts,wb){var ba=buf_array();var s=wb.SheetNames[idx],ws=wb.Sheets[s]||{};var r=safe_decode_range(ws["!ref"]||"A1");write_record(ba,"BrtBeginSheet");write_record(ba,"BrtWsDim",write_BrtWsDim(r));write_CELLTABLE(ba,ws,idx,opts,wb);write_record(ba,"BrtEndSheet");return ba.end()}var WBPropsDef=[["allowRefreshQuery","0"],["autoCompressPictures","1"],["backupFile","0"],["checkCompatibility","0"],["codeName",""],["date1904","0"],["dateCompatibility","1"],["filterPrivacy","0"],["hidePivotFieldList","0"],["promptedSolutions","0"],["publishItems","0"],["refreshAllConnections",false],["saveExternalLinkValues","1"],["showBorderUnselectedTables","1"],["showInkAnnotation","1"],["showObjects","all"],["showPivotChartFilter","0"]];var WBViewDef=[["activeTab","0"],["autoFilterDateGrouping","1"],["firstSheet","0"],["minimized","0"],["showHorizontalScroll","1"],["showSheetTabs","1"],["showVerticalScroll","1"],["tabRatio","600"],["visibility","visible"]];var SheetDef=[["state","visible"]];var CalcPrDef=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];var CustomWBViewDef=[["autoUpdate","false"],["changesSavedWin","false"],["includeHiddenRowCol","true"],["includePrintSettings","true"],["maximized","false"],["minimized","false"],["onlySync","false"],["personalView","false"],["showComments","commIndicator"],["showFormulaBar","true"],["showHorizontalScroll","true"],["showObjects","all"],["showSheetTabs","true"],["showStatusbar","true"],["showVerticalScroll","true"],["tabRatio","600"],["xWindow","0"],["yWindow","0"]];function push_defaults_array(target,defaults){for(var j=0;j!=target.length;++j){var w=target[j];for(var i=0;i!=defaults.length;++i){var z=defaults[i];if(w[z[0]]==null)w[z[0]]=z[1]}}}function push_defaults(target,defaults){for(var i=0;i!=defaults.length;++i){var z=defaults[i];if(target[z[0]]==null)target[z[0]]=z[1]}}function parse_wb_defaults(wb){push_defaults(wb.WBProps,WBPropsDef);push_defaults(wb.CalcPr,CalcPrDef);push_defaults_array(wb.WBView,WBViewDef);push_defaults_array(wb.Sheets,SheetDef);_ssfopts.date1904=parsexmlbool(wb.WBProps.date1904,"date1904")}var wbnsregex=/<\w+:workbook/;function parse_wb_xml(data,opts){var wb={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""};var pass=false,xmlns="xmlns";data.match(tagregex).forEach(function xml_wb(x){var y=parsexmltag(x);switch(strip_ns(y[0])){case"<?xml":break;case"<workbook":if(x.match(wbnsregex))xmlns="xmlns"+x.match(/<(\w+):/)[1];wb.xmlns=y[xmlns];break;case"</workbook>":break;case"<fileVersion":delete y[0];wb.AppVersion=y;break;case"<fileVersion/>":break;case"<fileSharing":case"<fileSharing/>":break;case"<workbookPr":delete y[0];wb.WBProps=y;break;case"<workbookPr/>":delete y[0];wb.WBProps=y;break;case"<workbookProtection":break;case"<workbookProtection/>":break;case"<bookViews>":case"</bookViews>":break;case"<workbookView":delete y[0];wb.WBView.push(y);break;case"<sheets>":case"</sheets>":break;case"<sheet":delete y[0];y.name=utf8read(y.name);wb.Sheets.push(y);break;case"<functionGroups":case"<functionGroups/>":break;case"<functionGroup":break;case"<externalReferences":case"</externalReferences>":case"<externalReferences>":break;case"<externalReference":break;case"<definedNames/>":break;case"<definedNames>":case"<definedNames":pass=true;break;case"</definedNames>":pass=false;break;case"<definedName":case"<definedName/>":case"</definedName>":break;case"<calcPr":delete y[0];wb.CalcPr=y;break;case"<calcPr/>":delete y[0];wb.CalcPr=y;break;case"<oleSize":break;case"<customWorkbookViews>":case"</customWorkbookViews>":case"<customWorkbookViews":break;case"<customWorkbookView":case"</customWorkbookView>":break;case"<pivotCaches>":case"</pivotCaches>":case"<pivotCaches":break;case"<pivotCache":break;case"<smartTagPr":case"<smartTagPr/>":break;case"<smartTagTypes":case"<smartTagTypes>":case"</smartTagTypes>":break;case"<smartTagType":break;case"<webPublishing":case"<webPublishing/>":break;case"<fileRecoveryPr":case"<fileRecoveryPr/>":break;case"<webPublishObjects>":case"<webPublishObjects":case"</webPublishObjects>":break;case"<webPublishObject":break;case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":pass=true;break;case"</ext>":pass=false;break;case"<ArchID":break;case"<AlternateContent":pass=true;break;case"</AlternateContent>":pass=false;break;default:if(!pass&&opts.WTF)throw"unrecognized "+y[0]+" in workbook"}});if(XMLNS.main.indexOf(wb.xmlns)===-1)throw new Error("Unknown Namespace: "+wb.xmlns);parse_wb_defaults(wb);return wb}var WB_XML_ROOT=writextag("workbook",null,{xmlns:XMLNS.main[0],"xmlns:r":XMLNS.r});function safe1904(wb){try{return parsexmlbool(wb.Workbook.WBProps.date1904)?"true":"false"}catch(e){return"false"}}function write_wb_xml(wb,opts){var o=[XML_HEADER];o[o.length]=WB_XML_ROOT;o[o.length]=writextag("workbookPr",null,{date1904:safe1904(wb)});o[o.length]="<sheets>";for(var i=0;i!=wb.SheetNames.length;++i)o[o.length]=writextag("sheet",null,{name:wb.SheetNames[i].substr(0,31),sheetId:""+(i+1),"r:id":"rId"+(i+1)});o[o.length]="</sheets>";var hasPrintHeaders=false;for(var i=0;i!=wb.SheetNames.length;++i){var sheetName=wb.SheetNames[i];var sheet=wb.Sheets[sheetName];if(sheet["!printHeader"]){if(sheet["!printHeader"].length!==2){throw"!printHeaders must be an array of length 2: "+sheet["!printHeader"]}hasPrintHeaders=true}}if(hasPrintHeaders){o[o.length]="<definedNames>";for(var i=0;i!=wb.SheetNames.length;++i){var sheetName=wb.SheetNames[i];var sheet=wb.Sheets[sheetName];if(sheet["!printHeader"]){var printHeader=sheet["!printHeader"];var range="'"+sheetName+"'!$"+printHeader[0]+":$"+printHeader[1];o[o.length]=writextag("definedName",range,{name:"_xlnm.Print_Titles",localSheetId:""+i})}}o[o.length]="</definedNames>"}if(o.length>2){o[o.length]="</workbook>";o[1]=o[1].replace("/>",">")}return o.join("")}function parse_BrtBundleSh(data,length){var z={};z.hsState=data.read_shift(4);z.iTabID=data.read_shift(4);z.strRelID=parse_RelID(data,length-8);z.name=parse_XLWideString(data);return z}function write_BrtBundleSh(data,o){if(!o)o=new_buf(127);o.write_shift(4,data.hsState);o.write_shift(4,data.iTabID);write_RelID(data.strRelID,o);write_XLWideString(data.name.substr(0,31),o);return o}function parse_BrtWbProp(data,length){data.read_shift(4);var dwThemeVersion=data.read_shift(4);var strName=length>8?parse_XLWideString(data):"";return[dwThemeVersion,strName]}function write_BrtWbProp(data,o){if(!o)o=new_buf(8);o.write_shift(4,0);o.write_shift(4,0);return o}function parse_BrtFRTArchID$(data,length){var o={};data.read_shift(4);o.ArchID=data.read_shift(4);data.l+=length-8;return o}function parse_wb_bin(data,opts){var wb={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""};var pass=false,z;recordhopper(data,function hopper_wb(val,R){switch(R.n){case"BrtBundleSh":wb.Sheets.push(val);break;case"BrtBeginBook":break;case"BrtFileVersion":break;case"BrtWbProp":break;case"BrtACBegin":break;case"BrtAbsPath15":break;case"BrtACEnd":break;case"BrtWbFactoid":break;case"BrtBookProtection":break;case"BrtBeginBookViews":break;case"BrtBookView":break;case"BrtEndBookViews":break;case"BrtBeginBundleShs":break;case"BrtEndBundleShs":break;case"BrtBeginFnGroup":break;case"BrtEndFnGroup":break;case"BrtBeginExternals":break;case"BrtSupSelf":break;case"BrtSupBookSrc":break;case"BrtExternSheet":break;case"BrtEndExternals":break;case"BrtName":break;case"BrtCalcProp":break;case"BrtUserBookView":break;case"BrtBeginPivotCacheIDs":break;case"BrtBeginPivotCacheID":break;case"BrtEndPivotCacheID":break;case"BrtEndPivotCacheIDs":break;case"BrtWebOpt":break;case"BrtFileRecover":break;case"BrtFileSharing":break;case"BrtBeginSmartTagTypes":break;case"BrtSmartTagType":break;case"BrtEndSmartTagTypes":break;case"BrtFRTBegin":pass=true;break;case"BrtFRTArchID$":break;case"BrtWorkBookPr15":break;case"BrtFRTEnd":pass=false;break;case"BrtEndBook":break;default:if(!pass||opts.WTF)throw new Error("Unexpected record "+R.n)}});parse_wb_defaults(wb);return wb}function write_BUNDLESHS(ba,wb,opts){write_record(ba,"BrtBeginBundleShs");for(var idx=0;idx!=wb.SheetNames.length;++idx){var d={hsState:0,iTabID:idx+1,strRelID:"rId"+(idx+1),name:wb.SheetNames[idx]};write_record(ba,"BrtBundleSh",write_BrtBundleSh(d))}write_record(ba,"BrtEndBundleShs")}function write_BrtFileVersion(data,o){if(!o)o=new_buf(127);for(var i=0;i!=4;++i)o.write_shift(4,0);write_XLWideString("SheetJS",o);write_XLWideString(XLSX.version,o);write_XLWideString(XLSX.version,o);write_XLWideString("7262",o);o.length=o.l;return o}function write_BOOKVIEWS(ba,wb,opts){write_record(ba,"BrtBeginBookViews");write_record(ba,"BrtEndBookViews")}function write_BrtCalcProp(data,o){if(!o)o=new_buf(26);o.write_shift(4,0);o.write_shift(4,1);o.write_shift(4,0);write_Xnum(0,o);o.write_shift(-4,1023);o.write_shift(1,51);o.write_shift(1,0);return o}function write_BrtFileRecover(data,o){if(!o)o=new_buf(1);o.write_shift(1,0);return o}function write_wb_bin(wb,opts){var ba=buf_array();write_record(ba,"BrtBeginBook");write_record(ba,"BrtFileVersion",write_BrtFileVersion());write_record(ba,"BrtWbProp",write_BrtWbProp());write_BOOKVIEWS(ba,wb,opts);write_BUNDLESHS(ba,wb,opts);write_record(ba,"BrtCalcProp",write_BrtCalcProp());write_record(ba,"BrtFileRecover",write_BrtFileRecover());write_record(ba,"BrtEndBook");return ba.end()}function parse_wb(data,name,opts){return(name.substr(-4)===".bin"?parse_wb_bin:parse_wb_xml)(data,opts)}function parse_ws(data,name,opts,rels){return(name.substr(-4)===".bin"?parse_ws_bin:parse_ws_xml)(data,opts,rels)}function parse_sty(data,name,opts){return(name.substr(-4)===".bin"?parse_sty_bin:parse_sty_xml)(data,opts)}function parse_theme(data,name,opts){return parse_theme_xml(data,opts)}function parse_sst(data,name,opts){return(name.substr(-4)===".bin"?parse_sst_bin:parse_sst_xml)(data,opts)}function parse_cmnt(data,name,opts){return(name.substr(-4)===".bin"?parse_comments_bin:parse_comments_xml)(data,opts)}function parse_cc(data,name,opts){return(name.substr(-4)===".bin"?parse_cc_bin:parse_cc_xml)(data,opts)}function write_wb(wb,name,opts){return(name.substr(-4)===".bin"?write_wb_bin:write_wb_xml)(wb,opts)}function write_ws(data,name,opts,wb){return(name.substr(-4)===".bin"?write_ws_bin:write_ws_xml)(data,opts,wb)}function write_sty(data,name,opts){return(name.substr(-4)===".bin"?write_sty_bin:write_sty_xml)(data,opts)}function write_sst(data,name,opts){return(name.substr(-4)===".bin"?write_sst_bin:write_sst_xml)(data,opts)}var attregexg2=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g;var attregex2=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;var _chr=function(c){return String.fromCharCode(c)};function xlml_parsexmltag(tag,skip_root){var words=tag.split(/\s+/);var z=[];if(!skip_root)z[0]=words[0];if(words.length===1)return z;var m=tag.match(attregexg2),y,j,w,i;if(m)for(i=0;i!=m.length;++i){y=m[i].match(attregex2);if((j=y[1].indexOf(":"))===-1)z[y[1]]=y[2].substr(1,y[2].length-2);else{if(y[1].substr(0,6)==="xmlns:")w="xmlns"+y[1].substr(6);else w=y[1].substr(j+1);z[w]=y[2].substr(1,y[2].length-2)}}return z}function xlml_parsexmltagobj(tag){var words=tag.split(/\s+/);var z={};if(words.length===1)return z;var m=tag.match(attregexg2),y,j,w,i;if(m)for(i=0;i!=m.length;++i){y=m[i].match(attregex2);if((j=y[1].indexOf(":"))===-1)z[y[1]]=y[2].substr(1,y[2].length-2);else{if(y[1].substr(0,6)==="xmlns:")w="xmlns"+y[1].substr(6);else w=y[1].substr(j+1);z[w]=y[2].substr(1,y[2].length-2)}}return z}function xlml_format(format,value){var fmt=XLMLFormatMap[format]||unescapexml(format);if(fmt==="General")return SSF._general(value);return SSF.format(fmt,value)}function xlml_set_custprop(Custprops,Rn,cp,val){switch((cp[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]){case"boolean":val=parsexmlbool(val);break;case"i2":case"int":val=parseInt(val,10);break;case"r4":case"float":val=parseFloat(val);break;case"date":case"dateTime.tz":val=new Date(val);break;case"i8":case"string":case"fixed":case"uuid":case"bin.base64":break;default:throw"bad custprop:"+cp[0]}Custprops[unescapexml(Rn[3])]=val}function safe_format_xlml(cell,nf,o){try{if(cell.t==="e"){cell.w=cell.w||BErr[cell.v]}else if(nf==="General"){if(cell.t==="n"){if((cell.v|0)===cell.v)cell.w=SSF._general_int(cell.v);else cell.w=SSF._general_num(cell.v)}else cell.w=SSF._general(cell.v)}else cell.w=xlml_format(nf||"General",cell.v);if(o.cellNF)cell.z=XLMLFormatMap[nf]||nf||"General"}catch(e){if(o.WTF)throw e}}function process_style_xlml(styles,stag,opts){if(opts.cellStyles){if(stag.Interior){var I=stag.Interior;if(I.Pattern)I.patternType=XLMLPatternTypeMap[I.Pattern]||I.Pattern}}styles[stag.ID]=stag}function parse_xlml_data(xml,ss,data,cell,base,styles,csty,row,o){var nf="General",sid=cell.StyleID,S={};o=o||{};var interiors=[];if(sid===undefined&&row)sid=row.StyleID;if(sid===undefined&&csty)sid=csty.StyleID;while(styles[sid]!==undefined){if(styles[sid].nf)nf=styles[sid].nf;if(styles[sid].Interior)interiors.push(styles[sid].Interior);if(!styles[sid].Parent)break;sid=styles[sid].Parent}switch(data.Type){case"Boolean":cell.t="b";cell.v=parsexmlbool(xml);break;case"String":cell.t="s";cell.r=xlml_fixstr(unescapexml(xml));cell.v=xml.indexOf("<")>-1?ss:cell.r;break;case"DateTime":cell.v=(Date.parse(xml)-new Date(Date.UTC(1899,11,30)))/(24*60*60*1e3);if(cell.v!==cell.v)cell.v=unescapexml(xml);else if(cell.v>=1&&cell.v<60)cell.v=cell.v-1;if(!nf||nf=="General")nf="yyyy-mm-dd";case"Number":+ if(cell.v===undefined)cell.v=+xml;if(!cell.t)cell.t="n";break;case"Error":cell.t="e";cell.v=RBErr[xml];cell.w=xml;break;default:cell.t="s";cell.v=xlml_fixstr(ss);break}safe_format_xlml(cell,nf,o);if(o.cellFormula!=null&&cell.Formula){cell.f=rc_to_a1(unescapexml(cell.Formula),base);cell.Formula=undefined}if(o.cellStyles){interiors.forEach(function(x){if(!S.patternType&&x.patternType)S.patternType=x.patternType});cell.s=S}cell.ixfe=cell.StyleID!==undefined?cell.StyleID:"Default"}function xlml_clean_comment(comment){comment.t=comment.v;comment.v=comment.w=comment.ixfe=undefined}function xlml_normalize(d){if(has_buf&&Buffer.isBuffer(d))return d.toString("utf8");if(typeof d==="string")return d;throw"badf"}var xlmlregex=/<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/gm;function parse_xlml_xml(d,opts){var str=xlml_normalize(d);var Rn;var state=[],tmp;var sheets={},sheetnames=[],cursheet={},sheetname="";var table={},cell={},row={},dtag,didx;var c=0,r=0;var refguess={s:{r:1e6,c:1e6},e:{r:0,c:0}};var styles={},stag={};var ss="",fidx=0;var mergecells=[];var Props={},Custprops={},pidx=0,cp={};var comments=[],comment={};var cstys=[],csty;xlmlregex.lastIndex=0;while(Rn=xlmlregex.exec(str))switch(Rn[3]){case"Data":if(state[state.length-1][1])break;if(Rn[1]==="/")parse_xlml_data(str.slice(didx,Rn.index),ss,dtag,state[state.length-1][0]=="Comment"?comment:cell,{c:c,r:r},styles,cstys[c],row,opts);else{ss="";dtag=xlml_parsexmltag(Rn[0]);didx=Rn.index+Rn[0].length}break;case"Cell":if(Rn[1]==="/"){if(comments.length>0)cell.c=comments;if((!opts.sheetRows||opts.sheetRows>r)&&cell.v!==undefined)cursheet[encode_col(c)+encode_row(r)]=cell;if(cell.HRef){cell.l={Target:cell.HRef,tooltip:cell.HRefScreenTip};cell.HRef=cell.HRefScreenTip=undefined}if(cell.MergeAcross||cell.MergeDown){var cc=c+(parseInt(cell.MergeAcross,10)|0);var rr=r+(parseInt(cell.MergeDown,10)|0);mergecells.push({s:{c:c,r:r},e:{c:cc,r:rr}})}++c;if(cell.MergeAcross)c+=+cell.MergeAcross}else{cell=xlml_parsexmltagobj(Rn[0]);if(cell.Index)c=+cell.Index-1;if(c<refguess.s.c)refguess.s.c=c;if(c>refguess.e.c)refguess.e.c=c;if(Rn[0].substr(-2)==="/>")++c;comments=[]}break;case"Row":if(Rn[1]==="/"||Rn[0].substr(-2)==="/>"){if(r<refguess.s.r)refguess.s.r=r;if(r>refguess.e.r)refguess.e.r=r;if(Rn[0].substr(-2)==="/>"){row=xlml_parsexmltag(Rn[0]);if(row.Index)r=+row.Index-1}c=0;++r}else{row=xlml_parsexmltag(Rn[0]);if(row.Index)r=+row.Index-1}break;case"Worksheet":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp;sheetnames.push(sheetname);if(refguess.s.r<=refguess.e.r&&refguess.s.c<=refguess.e.c)cursheet["!ref"]=encode_range(refguess);if(mergecells.length)cursheet["!merges"]=mergecells;sheets[sheetname]=cursheet}else{refguess={s:{r:1e6,c:1e6},e:{r:0,c:0}};r=c=0;state.push([Rn[3],false]);tmp=xlml_parsexmltag(Rn[0]);sheetname=tmp.Name;cursheet={};mergecells=[]}break;case"Table":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp}else if(Rn[0].slice(-2)=="/>")break;else{table=xlml_parsexmltag(Rn[0]);state.push([Rn[3],false]);cstys=[]}break;case"Style":if(Rn[1]==="/")process_style_xlml(styles,stag,opts);else stag=xlml_parsexmltag(Rn[0]);break;case"NumberFormat":stag.nf=xlml_parsexmltag(Rn[0]).Format||"General";break;case"Column":if(state[state.length-1][0]!=="Table")break;csty=xlml_parsexmltag(Rn[0]);cstys[csty.Index-1||cstys.length]=csty;for(var i=0;i<+csty.Span;++i)cstys[cstys.length]=csty;break;case"NamedRange":break;case"NamedCell":break;case"B":break;case"I":break;case"U":break;case"S":break;case"Sub":break;case"Sup":break;case"Span":break;case"Border":break;case"Alignment":break;case"Borders":break;case"Font":if(Rn[0].substr(-2)==="/>")break;else if(Rn[1]==="/")ss+=str.slice(fidx,Rn.index);else fidx=Rn.index+Rn[0].length;break;case"Interior":if(!opts.cellStyles)break;stag.Interior=xlml_parsexmltag(Rn[0]);break;case"Protection":break;case"Author":case"Title":case"Description":case"Created":case"Keywords":case"Subject":case"Category":case"Company":case"LastAuthor":case"LastSaved":case"LastPrinted":case"Version":case"Revision":case"TotalTime":case"HyperlinkBase":case"Manager":if(Rn[0].substr(-2)==="/>")break;else if(Rn[1]==="/")xlml_set_prop(Props,Rn[3],str.slice(pidx,Rn.index));else pidx=Rn.index+Rn[0].length;break;case"Paragraphs":break;case"Styles":case"Workbook":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp}else state.push([Rn[3],false]);break;case"Comment":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp;xlml_clean_comment(comment);comments.push(comment)}else{state.push([Rn[3],false]);tmp=xlml_parsexmltag(Rn[0]);comment={a:tmp.Author}}break;case"Name":break;case"ComponentOptions":case"DocumentProperties":case"CustomDocumentProperties":case"OfficeDocumentSettings":case"PivotTable":case"PivotCache":case"Names":case"MapInfo":case"PageBreaks":case"QueryTable":case"DataValidation":case"AutoFilter":case"Sorting":case"Schema":case"data":case"ConditionalFormatting":case"SmartTagType":case"SmartTags":case"ExcelWorkbook":case"WorkbookOptions":case"WorksheetOptions":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp}else if(Rn[0].charAt(Rn[0].length-2)!=="/")state.push([Rn[3],true]);break;default:var seen=true;switch(state[state.length-1][0]){case"OfficeDocumentSettings":switch(Rn[3]){case"AllowPNG":break;case"RemovePersonalInformation":break;case"DownloadComponents":break;case"LocationOfComponents":break;case"Colors":break;case"Color":break;case"Index":break;case"RGB":break;case"PixelsPerInch":break;case"TargetScreenSize":break;case"ReadOnlyRecommended":break;default:seen=false}break;case"ComponentOptions":switch(Rn[3]){case"Toolbar":break;case"HideOfficeLogo":break;case"SpreadsheetAutoFit":break;case"Label":break;case"Caption":break;case"MaxHeight":break;case"MaxWidth":break;case"NextSheetNumber":break;default:seen=false}break;case"ExcelWorkbook":switch(Rn[3]){case"WindowHeight":break;case"WindowWidth":break;case"WindowTopX":break;case"WindowTopY":break;case"TabRatio":break;case"ProtectStructure":break;case"ProtectWindows":break;case"ActiveSheet":break;case"DisplayInkNotes":break;case"FirstVisibleSheet":break;case"SupBook":break;case"SheetName":break;case"SheetIndex":break;case"SheetIndexFirst":break;case"SheetIndexLast":break;case"Dll":break;case"AcceptLabelsInFormulas":break;case"DoNotSaveLinkValues":break;case"Date1904":break;case"Iteration":break;case"MaxIterations":break;case"MaxChange":break;case"Path":break;case"Xct":break;case"Count":break;case"SelectedSheets":break;case"Calculation":break;case"Uncalced":break;case"StartupPrompt":break;case"Crn":break;case"ExternName":break;case"Formula":break;case"ColFirst":break;case"ColLast":break;case"WantAdvise":break;case"Boolean":break;case"Error":break;case"Text":break;case"OLE":break;case"NoAutoRecover":break;case"PublishObjects":break;case"DoNotCalculateBeforeSave":break;case"Number":break;case"RefModeR1C1":break;case"EmbedSaveSmartTags":break;default:seen=false}break;case"WorkbookOptions":switch(Rn[3]){case"OWCVersion":break;case"Height":break;case"Width":break;default:seen=false}break;case"WorksheetOptions":switch(Rn[3]){case"Unsynced":break;case"Visible":break;case"Print":break;case"Panes":break;case"Scale":break;case"Pane":break;case"Number":break;case"Layout":break;case"Header":break;case"Footer":break;case"PageSetup":break;case"PageMargins":break;case"Selected":break;case"ProtectObjects":break;case"EnableSelection":break;case"ProtectScenarios":break;case"ValidPrinterInfo":break;case"HorizontalResolution":break;case"VerticalResolution":break;case"NumberofCopies":break;case"ActiveRow":break;case"ActiveCol":break;case"ActivePane":break;case"TopRowVisible":break;case"TopRowBottomPane":break;case"LeftColumnVisible":break;case"LeftColumnRightPane":break;case"FitToPage":break;case"RangeSelection":break;case"PaperSizeIndex":break;case"PageLayoutZoom":break;case"PageBreakZoom":break;case"FilterOn":break;case"DoNotDisplayGridlines":break;case"SplitHorizontal":break;case"SplitVertical":break;case"FreezePanes":break;case"FrozenNoSplit":break;case"FitWidth":break;case"FitHeight":break;case"CommentsLayout":break;case"Zoom":break;case"LeftToRight":break;case"Gridlines":break;case"AllowSort":break;case"AllowFilter":break;case"AllowInsertRows":break;case"AllowDeleteRows":break;case"AllowInsertCols":break;case"AllowDeleteCols":break;case"AllowInsertHyperlinks":break;case"AllowFormatCells":break;case"AllowSizeCols":break;case"AllowSizeRows":break;case"NoSummaryRowsBelowDetail":break;case"TabColorIndex":break;case"DoNotDisplayHeadings":break;case"ShowPageLayoutZoom":break;case"NoSummaryColumnsRightDetail":break;case"BlackAndWhite":break;case"DoNotDisplayZeros":break;case"DisplayPageBreak":break;case"RowColHeadings":break;case"DoNotDisplayOutline":break;case"NoOrientation":break;case"AllowUsePivotTables":break;case"ZeroHeight":break;case"ViewableRange":break;case"Selection":break;case"ProtectContents":break;default:seen=false}break;case"PivotTable":case"PivotCache":switch(Rn[3]){case"ImmediateItemsOnDrop":break;case"ShowPageMultipleItemLabel":break;case"CompactRowIndent":break;case"Location":break;case"PivotField":break;case"Orientation":break;case"LayoutForm":break;case"LayoutSubtotalLocation":break;case"LayoutCompactRow":break;case"Position":break;case"PivotItem":break;case"DataType":break;case"DataField":break;case"SourceName":break;case"ParentField":break;case"PTLineItems":break;case"PTLineItem":break;case"CountOfSameItems":break;case"Item":break;case"ItemType":break;case"PTSource":break;case"CacheIndex":break;case"ConsolidationReference":break;case"FileName":break;case"Reference":break;case"NoColumnGrand":break;case"NoRowGrand":break;case"BlankLineAfterItems":break;case"Hidden":break;case"Subtotal":break;case"BaseField":break;case"MapChildItems":break;case"Function":break;case"RefreshOnFileOpen":break;case"PrintSetTitles":break;case"MergeLabels":break;case"DefaultVersion":break;case"RefreshName":break;case"RefreshDate":break;case"RefreshDateCopy":break;case"VersionLastRefresh":break;case"VersionLastUpdate":break;case"VersionUpdateableMin":break;case"VersionRefreshableMin":break;case"Calculation":break;default:seen=false}break;case"PageBreaks":switch(Rn[3]){case"ColBreaks":break;case"ColBreak":break;case"RowBreaks":break;case"RowBreak":break;case"ColStart":break;case"ColEnd":break;case"RowEnd":break;default:seen=false}break;case"AutoFilter":switch(Rn[3]){case"AutoFilterColumn":break;case"AutoFilterCondition":break;case"AutoFilterAnd":break;case"AutoFilterOr":break;default:seen=false}break;case"QueryTable":switch(Rn[3]){case"Id":break;case"AutoFormatFont":break;case"AutoFormatPattern":break;case"QuerySource":break;case"QueryType":break;case"EnableRedirections":break;case"RefreshedInXl9":break;case"URLString":break;case"HTMLTables":break;case"Connection":break;case"CommandText":break;case"RefreshInfo":break;case"NoTitles":break;case"NextId":break;case"ColumnInfo":break;case"OverwriteCells":break;case"DoNotPromptForFile":break;case"TextWizardSettings":break;case"Source":break;case"Number":break;case"Decimal":break;case"ThousandSeparator":break;case"TrailingMinusNumbers":break;case"FormatSettings":break;case"FieldType":break;case"Delimiters":break;case"Tab":break;case"Comma":break;case"AutoFormatName":break;case"VersionLastEdit":break;case"VersionLastRefresh":break;default:seen=false}break;case"Sorting":case"ConditionalFormatting":case"DataValidation":switch(Rn[3]){case"Range":break;case"Type":break;case"Min":break;case"Max":break;case"Sort":break;case"Descending":break;case"Order":break;case"CaseSensitive":break;case"Value":break;case"ErrorStyle":break;case"ErrorMessage":break;case"ErrorTitle":break;case"CellRangeList":break;case"InputMessage":break;case"InputTitle":break;case"ComboHide":break;case"InputHide":break;case"Condition":break;case"Qualifier":break;case"UseBlank":break;case"Value1":break;case"Value2":break;case"Format":break;default:seen=false}break;case"MapInfo":case"Schema":case"data":switch(Rn[3]){case"Map":break;case"Entry":break;case"Range":break;case"XPath":break;case"Field":break;case"XSDType":break;case"FilterOn":break;case"Aggregate":break;case"ElementType":break;case"AttributeType":break;case"schema":case"element":case"complexType":case"datatype":case"all":case"attribute":case"extends":break;case"row":break;default:seen=false}break;case"SmartTags":break;default:seen=false;break}if(seen)break;if(!state[state.length-1][1])throw"Unrecognized tag: "+Rn[3]+"|"+state.join("|");if(state[state.length-1][0]==="CustomDocumentProperties"){if(Rn[0].substr(-2)==="/>")break;else if(Rn[1]==="/")xlml_set_custprop(Custprops,Rn,cp,str.slice(pidx,Rn.index));else{cp=Rn;pidx=Rn.index+Rn[0].length}break}if(opts.WTF)throw"Unrecognized tag: "+Rn[3]+"|"+state.join("|")}var out={};if(!opts.bookSheets&&!opts.bookProps)out.Sheets=sheets;out.SheetNames=sheetnames;out.SSF=SSF.get_table();out.Props=Props;out.Custprops=Custprops;return out}function parse_xlml(data,opts){fix_read_opts(opts=opts||{});switch(opts.type||"base64"){case"base64":return parse_xlml_xml(Base64.decode(data),opts);case"binary":case"buffer":case"file":return parse_xlml_xml(data,opts);case"array":return parse_xlml_xml(data.map(_chr).join(""),opts)}}function write_xlml(wb,opts){}function parse_compobj(obj){var v={};var o=obj.content;var l=28,m;m=__lpstr(o,l);l+=4+__readUInt32LE(o,l);v.UserType=m;m=__readUInt32LE(o,l);l+=4;switch(m){case 0:break;case 4294967295:case 4294967294:l+=4;break;default:if(m>400)throw new Error("Unsupported Clipboard: "+m.toString(16));l+=m}m=__lpstr(o,l);l+=m.length===0?0:5+m.length;v.Reserved1=m;if((m=__readUInt32LE(o,l))!==1907550708)return v;throw"Unsupported Unicode Extension"}function slurp(R,blob,length,opts){var l=length;var bufs=[];var d=blob.slice(blob.l,blob.l+l);if(opts&&opts.enc&&opts.enc.insitu_decrypt)switch(R.n){case"BOF":case"FilePass":case"FileLock":case"InterfaceHdr":case"RRDInfo":case"RRDHead":case"UsrExcl":break;default:if(d.length===0)break;opts.enc.insitu_decrypt(d)}bufs.push(d);blob.l+=l;var next=XLSRecordEnum[__readUInt16LE(blob,blob.l)];while(next!=null&&next.n==="Continue"){l=__readUInt16LE(blob,blob.l+2);bufs.push(blob.slice(blob.l+4,blob.l+4+l));blob.l+=4+l;next=XLSRecordEnum[__readUInt16LE(blob,blob.l)]}var b=bconcat(bufs);prep_blob(b,0);var ll=0;b.lens=[];for(var j=0;j<bufs.length;++j){b.lens.push(ll);ll+=bufs[j].length}return R.f(b,b.length,opts)}function safe_format_xf(p,opts,date1904){if(!p.XF)return;try{var fmtid=p.XF.ifmt||0;if(p.t==="e"){p.w=p.w||BErr[p.v]}else if(fmtid===0){if(p.t==="n"){if((p.v|0)===p.v)p.w=SSF._general_int(p.v);else p.w=SSF._general_num(p.v)}else p.w=SSF._general(p.v)}else p.w=SSF.format(fmtid,p.v,{date1904:date1904||false});if(opts.cellNF)p.z=SSF._table[fmtid]}catch(e){if(opts.WTF)throw e}}function make_cell(val,ixfe,t){return{v:val,ixfe:ixfe,t:t}}function parse_workbook(blob,options){var wb={opts:{}};var Sheets={};var out={};var Directory={};var found_sheet=false;var range={};var last_formula=null;var sst=[];var cur_sheet="";var Preamble={};var lastcell,last_cell,cc,cmnt,rng,rngC,rngR;var shared_formulae={};var array_formulae=[];var temp_val;var country;var cell_valid=true;var XFs=[];var palette=[];var get_rgb=function getrgb(icv){if(icv<8)return XLSIcv[icv];if(icv<64)return palette[icv-8]||XLSIcv[icv];return XLSIcv[icv]};var process_cell_style=function pcs(cell,line){var xfd=line.XF.data;if(!xfd||!xfd.patternType)return;line.s={};line.s.patternType=xfd.patternType;var t;if(t=rgb2Hex(get_rgb(xfd.icvFore))){line.s.fgColor={rgb:t}}if(t=rgb2Hex(get_rgb(xfd.icvBack))){line.s.bgColor={rgb:t}}};var addcell=function addcell(cell,line,options){if(!cell_valid)return;if(options.cellStyles&&line.XF&&line.XF.data)process_cell_style(cell,line);lastcell=cell;last_cell=encode_cell(cell);if(range.s){if(cell.r<range.s.r)range.s.r=cell.r;if(cell.c<range.s.c)range.s.c=cell.c}if(range.e){if(cell.r+1>range.e.r)range.e.r=cell.r+1;if(cell.c+1>range.e.c)range.e.c=cell.c+1}if(options.sheetRows&&lastcell.r>=options.sheetRows)cell_valid=false;else out[last_cell]=line};var opts={enc:false,sbcch:0,snames:[],sharedf:shared_formulae,arrayf:array_formulae,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,wtf:false};if(options.password)opts.password=options.password;var mergecells=[];var objects=[];var supbooks=[[]];var sbc=0,sbci=0,sbcli=0;supbooks.SheetNames=opts.snames;supbooks.sharedf=opts.sharedf;supbooks.arrayf=opts.arrayf;var last_Rn="";var file_depth=0;opts.codepage=1200;set_cp(1200);while(blob.l<blob.length-1){var s=blob.l;var RecordType=blob.read_shift(2);if(RecordType===0&&last_Rn==="EOF")break;var length=blob.l===blob.length?0:blob.read_shift(2),y;var R=XLSRecordEnum[RecordType];if(R&&R.f){if(options.bookSheets){if(last_Rn==="BoundSheet8"&&R.n!=="BoundSheet8")break}last_Rn=R.n;if(R.r===2||R.r==12){var rt=blob.read_shift(2);length-=2;if(!opts.enc&&rt!==RecordType)throw"rt mismatch";if(R.r==12){blob.l+=10;length-=10}}var val;if(R.n==="EOF")val=R.f(blob,length,opts);else val=slurp(R,blob,length,opts);var Rn=R.n;if(opts.biff===5||opts.biff===2)switch(Rn){case"Lbl":Rn="Label";break}switch(Rn){case"Date1904":wb.opts.Date1904=val;break;case"WriteProtect":wb.opts.WriteProtect=true;break;case"FilePass":if(!opts.enc)blob.l=0;opts.enc=val;if(opts.WTF)console.error(val);if(!options.password)throw new Error("File is password-protected");if(val.Type!==0)throw new Error("Encryption scheme unsupported");if(!val.valid)throw new Error("Password is incorrect");break;case"WriteAccess":opts.lastuser=val;break;case"FileSharing":break;case"CodePage":if(val===21010)val=1200;else if(val===32769)val=1252;opts.codepage=val;set_cp(val);break;case"RRTabId":opts.rrtabid=val;break;case"WinProtect":opts.winlocked=val;break;case"Template":break;case"RefreshAll":wb.opts.RefreshAll=val;break;case"BookBool":break;case"UsesELFs":break;case"MTRSettings":{if(val[0]&&val[1])throw"Unsupported threads: "+val}break;case"CalcCount":wb.opts.CalcCount=val;break;case"CalcDelta":wb.opts.CalcDelta=val;break;case"CalcIter":wb.opts.CalcIter=val;break;case"CalcMode":wb.opts.CalcMode=val;break;case"CalcPrecision":wb.opts.CalcPrecision=val;break;case"CalcSaveRecalc":wb.opts.CalcSaveRecalc=val;break;case"CalcRefMode":opts.CalcRefMode=val;break;case"Uncalced":break;case"ForceFullCalculation":wb.opts.FullCalc=val;break;case"WsBool":break;case"XF":XFs.push(val);break;case"ExtSST":break;case"BookExt":break;case"RichTextStream":break;case"BkHim":break;case"SupBook":supbooks[++sbc]=[val];sbci=0;break;case"ExternName":supbooks[sbc][++sbci]=val;break;case"Index":break;case"Lbl":supbooks[0][++sbcli]=val;break;case"ExternSheet":supbooks[sbc]=supbooks[sbc].concat(val);sbci+=val.length;break;case"Protect":out["!protect"]=val;break;case"Password":if(val!==0&&opts.WTF)console.error("Password verifier: "+val);break;case"Prot4Rev":case"Prot4RevPass":break;case"BoundSheet8":{Directory[val.pos]=val;opts.snames.push(val.name)}break;case"EOF":{if(--file_depth)break;if(range.e){out["!range"]=range;if(range.e.r>0&&range.e.c>0){range.e.r--;range.e.c--;out["!ref"]=encode_range(range);range.e.r++;range.e.c++}if(mergecells.length>0)out["!merges"]=mergecells;if(objects.length>0)out["!objects"]=objects}if(cur_sheet==="")Preamble=out;else Sheets[cur_sheet]=out;out={}}break;case"BOF":{if(opts.biff!==8);else if(val.BIFFVer===1280)opts.biff=5;else if(val.BIFFVer===2)opts.biff=2;else if(val.BIFFVer===7)opts.biff=2;if(file_depth++)break;cell_valid=true;out={};if(opts.biff===2){if(cur_sheet==="")cur_sheet="Sheet1";range={s:{r:0,c:0},e:{r:0,c:0}}}else cur_sheet=(Directory[s]||{name:""}).name;mergecells=[];objects=[]}break;case"Number":case"BIFF2NUM":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:"n"};if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"BoolErr":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:val.t};if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"RK":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.rknum,t:"n"};if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"MulRk":{for(var j=val.c;j<=val.C;++j){var ixfe=val.rkrec[j-val.c][0];temp_val={ixfe:ixfe,XF:XFs[ixfe],v:val.rkrec[j-val.c][1],t:"n"};if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:j,r:val.r},temp_val,options)}}break;case"Formula":{switch(val.val){case"String":last_formula=val;break;case"Array Formula":throw"Array Formula unsupported";default:temp_val={v:val.val,ixfe:val.cell.ixfe,t:val.tt};temp_val.XF=XFs[temp_val.ixfe];if(options.cellFormula)temp_val.f="="+stringify_formula(val.formula,range,val.cell,supbooks,opts);if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(val.cell,temp_val,options);last_formula=val}}break;case"String":{if(last_formula){last_formula.val=val;temp_val={v:last_formula.val,ixfe:last_formula.cell.ixfe,t:"s"};temp_val.XF=XFs[temp_val.ixfe];if(options.cellFormula)temp_val.f="="+stringify_formula(last_formula.formula,range,last_formula.cell,supbooks,opts);if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(last_formula.cell,temp_val,options);last_formula=null}}break;case"Array":{array_formulae.push(val)}break;case"ShrFmla":{if(!cell_valid)break;shared_formulae[encode_cell(last_formula.cell)]=val[0]}break;case"LabelSst":temp_val=make_cell(sst[val.isst].t,val.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options);break;case"Label":case"BIFF2STR":temp_val=make_cell(val.val,val.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];if(temp_val.XF)safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options);break;case"Dimensions":{if(file_depth===1)range=val}break;case"SST":{sst=val}break;case"Format":{SSF.load(val[1],val[0])}break;case"MergeCells":mergecells=mergecells.concat(val);break;case"Obj":objects[val.cmo[0]]=opts.lastobj=val;break;case"TxO":opts.lastobj.TxO=val;break;case"HLink":{for(rngR=val[0].s.r;rngR<=val[0].e.r;++rngR)for(rngC=val[0].s.c;rngC<=val[0].e.c;++rngC)if(out[encode_cell({c:rngC,r:rngR})])out[encode_cell({c:rngC,r:rngR})].l=val[1]}break;case"HLinkTooltip":{for(rngR=val[0].s.r;rngR<=val[0].e.r;++rngR)for(rngC=val[0].s.c;rngC<=val[0].e.c;++rngC)if(out[encode_cell({c:rngC,r:rngR})])out[encode_cell({c:rngC,r:rngR})].l.tooltip=val[1]}break;case"Note":{if(opts.biff<=5&&opts.biff>=2)break;cc=out[encode_cell(val[0])];var noteobj=objects[val[2]];if(!cc)break;if(!cc.c)cc.c=[];cmnt={a:val[1],t:noteobj.TxO.t};cc.c.push(cmnt)}break;default:switch(R.n){case"ClrtClient":break;case"XFExt":update_xfext(XFs[val.ixfe],val.ext);break;case"NameCmt":break;case"Header":break;case"Footer":break;case"HCenter":break;case"VCenter":break;case"Pls":break;case"Setup":break;case"DefColWidth":break;case"GCW":break;case"LHRecord":break;case"ColInfo":break;case"Row":break;case"DBCell":break;case"MulBlank":break;case"EntExU2":break;case"SxView":break;case"Sxvd":break;case"SXVI":break;case"SXVDEx":break;case"SxIvd":break;case"SXDI":break;case"SXLI":break;case"SXEx":break;case"QsiSXTag":break;case"Selection":break;case"Feat":break;case"FeatHdr":case"FeatHdr11":break;case"Feature11":case"Feature12":case"List12":break;case"Blank":break;case"Country":country=val;break;case"RecalcId":break;case"DefaultRowHeight":case"DxGCol":break;case"Fbi":case"Fbi2":case"GelFrame":break;case"Font":break;case"XFCRC":break;case"Style":break;case"StyleExt":break;case"Palette":palette=val;break;case"Theme":break;case"ScenarioProtect":break;case"ObjProtect":break;case"CondFmt12":break;case"Table":break;case"TableStyles":break;case"TableStyle":break;case"TableStyleElement":break;case"SXStreamID":break;case"SXVS":break;case"DConRef":break;case"SXAddl":break;case"DConBin":break;case"DConName":break;case"SXPI":break;case"SxFormat":break;case"SxSelect":break;case"SxRule":break;case"SxFilt":break;case"SxItm":break;case"SxDXF":break;case"ScenMan":break;case"DCon":break;case"CellWatch":break;case"PrintRowCol":break;case"PrintGrid":break;case"PrintSize":break;case"XCT":break;case"CRN":break;case"Scl":{}break;case"SheetExt":{}break;case"SheetExtOptional":{}break;case"ObNoMacros":{}break;case"ObProj":{}break;case"CodeName":{}break;case"GUIDTypeLib":{}break;case"WOpt":break;case"PhoneticInfo":break;case"OleObjectSize":break;case"DXF":case"DXFN":case"DXFN12":case"DXFN12List":case"DXFN12NoCB":break;case"Dv":case"DVal":break;case"BRAI":case"Series":case"SeriesText":break;case"DConn":break;case"DbOrParamQry":break;case"DBQueryExt":break;case"IFmtRecord":break;case"CondFmt":case"CF":case"CF12":case"CFEx":break;case"Excel9File":break;case"Units":break;case"InterfaceHdr":case"Mms":case"InterfaceEnd":case"DSF":case"BuiltInFnGroupCount":case"Window1":case"Window2":case"HideObj":case"GridSet":case"Guts":case"UserBView":case"UserSViewBegin":case"UserSViewEnd":case"Pane":break;default:switch(R.n){case"Dat":case"Begin":case"End":case"StartBlock":case"EndBlock":case"Frame":case"Area":case"Axis":case"AxisLine":case"Tick":break;case"AxesUsed":case"CrtLayout12":case"CrtLayout12A":case"CrtLink":case"CrtLine":case"CrtMlFrt":case"CrtMlFrtContinue":break;case"LineFormat":case"AreaFormat":case"Chart":case"Chart3d":case"Chart3DBarShape":case"ChartFormat":case"ChartFrtInfo":break;case"PlotArea":case"PlotGrowth":break;case"SeriesList":case"SerParent":case"SerAuxTrend":break;case"DataFormat":case"SerToCrt":case"FontX":break;case"CatSerRange":case"AxcExt":case"SerFmt":break;case"ShtProps":break;case"DefaultText":case"Text":case"CatLab":break;case"DataLabExtContents":break;case"Legend":case"LegendException":break;case"Pie":case"Scatter":break;case"PieFormat":case"MarkerFormat":break;case"StartObject":case"EndObject":break;case"AlRuns":case"ObjectLink":break;case"SIIndex":break;case"AttachedLabel":case"YMult":break;case"Line":case"Bar":break;case"Surf":break;case"AxisParent":break;case"Pos":break;case"ValueRange":break;case"SXViewEx9":break;case"SXViewLink":break;case"PivotChartBits":break;case"SBaseRef":break;case"TextPropsStream":break;case"LnExt":break;case"MkrExt":break;case"CrtCoopt":break;case"Qsi":case"Qsif":case"Qsir":case"QsiSXTag":break;case"TxtQry":break;case"FilterMode":break;case"AutoFilter":case"AutoFilterInfo":break;case"AutoFilter12":break;case"DropDownObjIds":break;case"Sort":break;case"SortData":break;case"ShapePropsStream":break;case"MsoDrawing":case"MsoDrawingGroup":case"MsoDrawingSelection":break;case"ImData":break;case"WebPub":case"AutoWebPub":case"RightMargin":case"LeftMargin":case"TopMargin":case"BottomMargin":case"HeaderFooter":case"HFPicture":case"PLV":case"HorizontalPageBreaks":case"VerticalPageBreaks":case"Backup":case"CompressPictures":case"Compat12":break;case"Continue":case"ContinueFrt12":break;case"FrtFontList":case"FrtWrapper":break;case"ExternCount":break;case"RString":break;case"TabIdConf":case"Radar":case"RadarArea":case"DropBar":case"Intl":case"CoordList":case"SerAuxErrBar":break;default:switch(R.n){case"SCENARIO":case"DConBin":case"PicF":case"DataLabExt":case"Lel":case"BopPop":case"BopPopCustom":case"RealTimeData":case"Name":break;default:if(options.WTF)throw"Unrecognized Record "+R.n}}}}}else blob.l+=length}var sheetnamesraw=opts.biff===2?["Sheet1"]:Object.keys(Directory).sort(function(a,b){return Number(a)-Number(b)}).map(function(x){return Directory[x].name});var sheetnames=sheetnamesraw.slice();wb.Directory=sheetnamesraw;wb.SheetNames=sheetnamesraw;if(!options.bookSheets)wb.Sheets=Sheets;wb.Preamble=Preamble;wb.Strings=sst;wb.SSF=SSF.get_table();if(opts.enc)wb.Encryption=opts.enc;wb.Metadata={};if(country!==undefined)wb.Metadata.Country=country;return wb}function parse_xlscfb(cfb,options){if(!options)options={};fix_read_opts(options);reset_cp();var CompObj,Summary,Workbook;if(cfb.find){CompObj=cfb.find("!CompObj");Summary=cfb.find("!SummaryInformation");Workbook=cfb.find("/Workbook")}else{prep_blob(cfb,0);Workbook={content:cfb}}if(!Workbook)Workbook=cfb.find("/Book");var CompObjP,SummaryP,WorkbookP;if(CompObj)CompObjP=parse_compobj(CompObj);if(options.bookProps&&!options.bookSheets)WorkbookP={};else{if(Workbook)WorkbookP=parse_workbook(Workbook.content,options,!!Workbook.find);else throw new Error("Cannot find Workbook stream")}if(cfb.find)parse_props(cfb);var props={};for(var y in cfb.Summary)props[y]=cfb.Summary[y];for(y in cfb.DocSummary)props[y]=cfb.DocSummary[y];WorkbookP.Props=WorkbookP.Custprops=props;if(options.bookFiles)WorkbookP.cfb=cfb;WorkbookP.CompObjP=CompObjP;return WorkbookP}function parse_props(cfb){var DSI=cfb.find("!DocumentSummaryInformation");if(DSI)try{cfb.DocSummary=parse_PropertySetStream(DSI,DocSummaryPIDDSI)}catch(e){}var SI=cfb.find("!SummaryInformation");if(SI)try{cfb.Summary=parse_PropertySetStream(SI,SummaryPIDSI)}catch(e){}}var XLSBRecordEnum={0:{n:"BrtRowHdr",f:parse_BrtRowHdr},1:{n:"BrtCellBlank",f:parse_BrtCellBlank},2:{n:"BrtCellRk",f:parse_BrtCellRk},3:{n:"BrtCellError",f:parse_BrtCellError},4:{n:"BrtCellBool",f:parse_BrtCellBool},5:{n:"BrtCellReal",f:parse_BrtCellReal},6:{n:"BrtCellSt",f:parse_BrtCellSt},7:{n:"BrtCellIsst",f:parse_BrtCellIsst},8:{n:"BrtFmlaString",f:parse_BrtFmlaString},9:{n:"BrtFmlaNum",f:parse_BrtFmlaNum},10:{n:"BrtFmlaBool",f:parse_BrtFmlaBool},11:{n:"BrtFmlaError",f:parse_BrtFmlaError},16:{n:"BrtFRTArchID$",f:parse_BrtFRTArchID$},19:{n:"BrtSSTItem",f:parse_RichStr},20:{n:"BrtPCDIMissing",f:parsenoop},21:{n:"BrtPCDINumber",f:parsenoop},22:{n:"BrtPCDIBoolean",f:parsenoop},23:{n:"BrtPCDIError",f:parsenoop},24:{n:"BrtPCDIString",f:parsenoop},25:{n:"BrtPCDIDatetime",f:parsenoop},26:{n:"BrtPCDIIndex",f:parsenoop},27:{n:"BrtPCDIAMissing",f:parsenoop},28:{n:"BrtPCDIANumber",f:parsenoop},29:{n:"BrtPCDIABoolean",f:parsenoop},30:{n:"BrtPCDIAError",f:parsenoop},31:{n:"BrtPCDIAString",f:parsenoop},32:{n:"BrtPCDIADatetime",f:parsenoop},33:{n:"BrtPCRRecord",f:parsenoop},34:{n:"BrtPCRRecordDt",f:parsenoop},35:{n:"BrtFRTBegin",f:parsenoop},36:{n:"BrtFRTEnd",f:parsenoop},37:{n:"BrtACBegin",f:parsenoop},38:{n:"BrtACEnd",f:parsenoop},39:{n:"BrtName",f:parsenoop},40:{n:"BrtIndexRowBlock",f:parsenoop},42:{n:"BrtIndexBlock",f:parsenoop},43:{n:"BrtFont",f:parse_BrtFont},44:{n:"BrtFmt",f:parse_BrtFmt},45:{n:"BrtFill",f:parsenoop},46:{n:"BrtBorder",f:parsenoop},47:{n:"BrtXF",f:parse_BrtXF},48:{n:"BrtStyle",f:parsenoop},49:{n:"BrtCellMeta",f:parsenoop},50:{n:"BrtValueMeta",f:parsenoop},51:{n:"BrtMdb",f:parsenoop},52:{n:"BrtBeginFmd",f:parsenoop},53:{n:"BrtEndFmd",f:parsenoop},54:{n:"BrtBeginMdx",f:parsenoop},55:{n:"BrtEndMdx",f:parsenoop},56:{n:"BrtBeginMdxTuple",f:parsenoop},57:{n:"BrtEndMdxTuple",f:parsenoop},58:{n:"BrtMdxMbrIstr",f:parsenoop},59:{n:"BrtStr",f:parsenoop},60:{n:"BrtColInfo",f:parsenoop},62:{n:"BrtCellRString",f:parsenoop},63:{n:"BrtCalcChainItem$",f:parse_BrtCalcChainItem$},64:{n:"BrtDVal",f:parsenoop},65:{n:"BrtSxvcellNum",f:parsenoop},66:{n:"BrtSxvcellStr",f:parsenoop},67:{n:"BrtSxvcellBool",f:parsenoop},68:{n:"BrtSxvcellErr",f:parsenoop},69:{n:"BrtSxvcellDate",f:parsenoop},70:{n:"BrtSxvcellNil",f:parsenoop},128:{n:"BrtFileVersion",f:parsenoop},129:{n:"BrtBeginSheet",f:parsenoop},130:{n:"BrtEndSheet",f:parsenoop},131:{n:"BrtBeginBook",f:parsenoop,p:0},132:{n:"BrtEndBook",f:parsenoop},133:{n:"BrtBeginWsViews",f:parsenoop},134:{n:"BrtEndWsViews",f:parsenoop},135:{n:"BrtBeginBookViews",f:parsenoop},136:{n:"BrtEndBookViews",f:parsenoop},137:{n:"BrtBeginWsView",f:parsenoop},138:{n:"BrtEndWsView",f:parsenoop},139:{n:"BrtBeginCsViews",f:parsenoop},140:{n:"BrtEndCsViews",f:parsenoop},141:{n:"BrtBeginCsView",f:parsenoop},142:{n:"BrtEndCsView",f:parsenoop},143:{n:"BrtBeginBundleShs",f:parsenoop},144:{n:"BrtEndBundleShs",f:parsenoop},145:{n:"BrtBeginSheetData",f:parsenoop},146:{n:"BrtEndSheetData",f:parsenoop},147:{n:"BrtWsProp",f:parse_BrtWsProp},148:{n:"BrtWsDim",f:parse_BrtWsDim,p:16},151:{n:"BrtPane",f:parsenoop},152:{n:"BrtSel",f:parsenoop},153:{n:"BrtWbProp",f:parse_BrtWbProp},154:{n:"BrtWbFactoid",f:parsenoop+ },155:{n:"BrtFileRecover",f:parsenoop},156:{n:"BrtBundleSh",f:parse_BrtBundleSh},157:{n:"BrtCalcProp",f:parsenoop},158:{n:"BrtBookView",f:parsenoop},159:{n:"BrtBeginSst",f:parse_BrtBeginSst},160:{n:"BrtEndSst",f:parsenoop},161:{n:"BrtBeginAFilter",f:parsenoop},162:{n:"BrtEndAFilter",f:parsenoop},163:{n:"BrtBeginFilterColumn",f:parsenoop},164:{n:"BrtEndFilterColumn",f:parsenoop},165:{n:"BrtBeginFilters",f:parsenoop},166:{n:"BrtEndFilters",f:parsenoop},167:{n:"BrtFilter",f:parsenoop},168:{n:"BrtColorFilter",f:parsenoop},169:{n:"BrtIconFilter",f:parsenoop},170:{n:"BrtTop10Filter",f:parsenoop},171:{n:"BrtDynamicFilter",f:parsenoop},172:{n:"BrtBeginCustomFilters",f:parsenoop},173:{n:"BrtEndCustomFilters",f:parsenoop},174:{n:"BrtCustomFilter",f:parsenoop},175:{n:"BrtAFilterDateGroupItem",f:parsenoop},176:{n:"BrtMergeCell",f:parse_BrtMergeCell},177:{n:"BrtBeginMergeCells",f:parsenoop},178:{n:"BrtEndMergeCells",f:parsenoop},179:{n:"BrtBeginPivotCacheDef",f:parsenoop},180:{n:"BrtEndPivotCacheDef",f:parsenoop},181:{n:"BrtBeginPCDFields",f:parsenoop},182:{n:"BrtEndPCDFields",f:parsenoop},183:{n:"BrtBeginPCDField",f:parsenoop},184:{n:"BrtEndPCDField",f:parsenoop},185:{n:"BrtBeginPCDSource",f:parsenoop},186:{n:"BrtEndPCDSource",f:parsenoop},187:{n:"BrtBeginPCDSRange",f:parsenoop},188:{n:"BrtEndPCDSRange",f:parsenoop},189:{n:"BrtBeginPCDFAtbl",f:parsenoop},190:{n:"BrtEndPCDFAtbl",f:parsenoop},191:{n:"BrtBeginPCDIRun",f:parsenoop},192:{n:"BrtEndPCDIRun",f:parsenoop},193:{n:"BrtBeginPivotCacheRecords",f:parsenoop},194:{n:"BrtEndPivotCacheRecords",f:parsenoop},195:{n:"BrtBeginPCDHierarchies",f:parsenoop},196:{n:"BrtEndPCDHierarchies",f:parsenoop},197:{n:"BrtBeginPCDHierarchy",f:parsenoop},198:{n:"BrtEndPCDHierarchy",f:parsenoop},199:{n:"BrtBeginPCDHFieldsUsage",f:parsenoop},200:{n:"BrtEndPCDHFieldsUsage",f:parsenoop},201:{n:"BrtBeginExtConnection",f:parsenoop},202:{n:"BrtEndExtConnection",f:parsenoop},203:{n:"BrtBeginECDbProps",f:parsenoop},204:{n:"BrtEndECDbProps",f:parsenoop},205:{n:"BrtBeginECOlapProps",f:parsenoop},206:{n:"BrtEndECOlapProps",f:parsenoop},207:{n:"BrtBeginPCDSConsol",f:parsenoop},208:{n:"BrtEndPCDSConsol",f:parsenoop},209:{n:"BrtBeginPCDSCPages",f:parsenoop},210:{n:"BrtEndPCDSCPages",f:parsenoop},211:{n:"BrtBeginPCDSCPage",f:parsenoop},212:{n:"BrtEndPCDSCPage",f:parsenoop},213:{n:"BrtBeginPCDSCPItem",f:parsenoop},214:{n:"BrtEndPCDSCPItem",f:parsenoop},215:{n:"BrtBeginPCDSCSets",f:parsenoop},216:{n:"BrtEndPCDSCSets",f:parsenoop},217:{n:"BrtBeginPCDSCSet",f:parsenoop},218:{n:"BrtEndPCDSCSet",f:parsenoop},219:{n:"BrtBeginPCDFGroup",f:parsenoop},220:{n:"BrtEndPCDFGroup",f:parsenoop},221:{n:"BrtBeginPCDFGItems",f:parsenoop},222:{n:"BrtEndPCDFGItems",f:parsenoop},223:{n:"BrtBeginPCDFGRange",f:parsenoop},224:{n:"BrtEndPCDFGRange",f:parsenoop},225:{n:"BrtBeginPCDFGDiscrete",f:parsenoop},226:{n:"BrtEndPCDFGDiscrete",f:parsenoop},227:{n:"BrtBeginPCDSDTupleCache",f:parsenoop},228:{n:"BrtEndPCDSDTupleCache",f:parsenoop},229:{n:"BrtBeginPCDSDTCEntries",f:parsenoop},230:{n:"BrtEndPCDSDTCEntries",f:parsenoop},231:{n:"BrtBeginPCDSDTCEMembers",f:parsenoop},232:{n:"BrtEndPCDSDTCEMembers",f:parsenoop},233:{n:"BrtBeginPCDSDTCEMember",f:parsenoop},234:{n:"BrtEndPCDSDTCEMember",f:parsenoop},235:{n:"BrtBeginPCDSDTCQueries",f:parsenoop},236:{n:"BrtEndPCDSDTCQueries",f:parsenoop},237:{n:"BrtBeginPCDSDTCQuery",f:parsenoop},238:{n:"BrtEndPCDSDTCQuery",f:parsenoop},239:{n:"BrtBeginPCDSDTCSets",f:parsenoop},240:{n:"BrtEndPCDSDTCSets",f:parsenoop},241:{n:"BrtBeginPCDSDTCSet",f:parsenoop},242:{n:"BrtEndPCDSDTCSet",f:parsenoop},243:{n:"BrtBeginPCDCalcItems",f:parsenoop},244:{n:"BrtEndPCDCalcItems",f:parsenoop},245:{n:"BrtBeginPCDCalcItem",f:parsenoop},246:{n:"BrtEndPCDCalcItem",f:parsenoop},247:{n:"BrtBeginPRule",f:parsenoop},248:{n:"BrtEndPRule",f:parsenoop},249:{n:"BrtBeginPRFilters",f:parsenoop},250:{n:"BrtEndPRFilters",f:parsenoop},251:{n:"BrtBeginPRFilter",f:parsenoop},252:{n:"BrtEndPRFilter",f:parsenoop},253:{n:"BrtBeginPNames",f:parsenoop},254:{n:"BrtEndPNames",f:parsenoop},255:{n:"BrtBeginPName",f:parsenoop},256:{n:"BrtEndPName",f:parsenoop},257:{n:"BrtBeginPNPairs",f:parsenoop},258:{n:"BrtEndPNPairs",f:parsenoop},259:{n:"BrtBeginPNPair",f:parsenoop},260:{n:"BrtEndPNPair",f:parsenoop},261:{n:"BrtBeginECWebProps",f:parsenoop},262:{n:"BrtEndECWebProps",f:parsenoop},263:{n:"BrtBeginEcWpTables",f:parsenoop},264:{n:"BrtEndECWPTables",f:parsenoop},265:{n:"BrtBeginECParams",f:parsenoop},266:{n:"BrtEndECParams",f:parsenoop},267:{n:"BrtBeginECParam",f:parsenoop},268:{n:"BrtEndECParam",f:parsenoop},269:{n:"BrtBeginPCDKPIs",f:parsenoop},270:{n:"BrtEndPCDKPIs",f:parsenoop},271:{n:"BrtBeginPCDKPI",f:parsenoop},272:{n:"BrtEndPCDKPI",f:parsenoop},273:{n:"BrtBeginDims",f:parsenoop},274:{n:"BrtEndDims",f:parsenoop},275:{n:"BrtBeginDim",f:parsenoop},276:{n:"BrtEndDim",f:parsenoop},277:{n:"BrtIndexPartEnd",f:parsenoop},278:{n:"BrtBeginStyleSheet",f:parsenoop},279:{n:"BrtEndStyleSheet",f:parsenoop},280:{n:"BrtBeginSXView",f:parsenoop},281:{n:"BrtEndSXVI",f:parsenoop},282:{n:"BrtBeginSXVI",f:parsenoop},283:{n:"BrtBeginSXVIs",f:parsenoop},284:{n:"BrtEndSXVIs",f:parsenoop},285:{n:"BrtBeginSXVD",f:parsenoop},286:{n:"BrtEndSXVD",f:parsenoop},287:{n:"BrtBeginSXVDs",f:parsenoop},288:{n:"BrtEndSXVDs",f:parsenoop},289:{n:"BrtBeginSXPI",f:parsenoop},290:{n:"BrtEndSXPI",f:parsenoop},291:{n:"BrtBeginSXPIs",f:parsenoop},292:{n:"BrtEndSXPIs",f:parsenoop},293:{n:"BrtBeginSXDI",f:parsenoop},294:{n:"BrtEndSXDI",f:parsenoop},295:{n:"BrtBeginSXDIs",f:parsenoop},296:{n:"BrtEndSXDIs",f:parsenoop},297:{n:"BrtBeginSXLI",f:parsenoop},298:{n:"BrtEndSXLI",f:parsenoop},299:{n:"BrtBeginSXLIRws",f:parsenoop},300:{n:"BrtEndSXLIRws",f:parsenoop},301:{n:"BrtBeginSXLICols",f:parsenoop},302:{n:"BrtEndSXLICols",f:parsenoop},303:{n:"BrtBeginSXFormat",f:parsenoop},304:{n:"BrtEndSXFormat",f:parsenoop},305:{n:"BrtBeginSXFormats",f:parsenoop},306:{n:"BrtEndSxFormats",f:parsenoop},307:{n:"BrtBeginSxSelect",f:parsenoop},308:{n:"BrtEndSxSelect",f:parsenoop},309:{n:"BrtBeginISXVDRws",f:parsenoop},310:{n:"BrtEndISXVDRws",f:parsenoop},311:{n:"BrtBeginISXVDCols",f:parsenoop},312:{n:"BrtEndISXVDCols",f:parsenoop},313:{n:"BrtEndSXLocation",f:parsenoop},314:{n:"BrtBeginSXLocation",f:parsenoop},315:{n:"BrtEndSXView",f:parsenoop},316:{n:"BrtBeginSXTHs",f:parsenoop},317:{n:"BrtEndSXTHs",f:parsenoop},318:{n:"BrtBeginSXTH",f:parsenoop},319:{n:"BrtEndSXTH",f:parsenoop},320:{n:"BrtBeginISXTHRws",f:parsenoop},321:{n:"BrtEndISXTHRws",f:parsenoop},322:{n:"BrtBeginISXTHCols",f:parsenoop},323:{n:"BrtEndISXTHCols",f:parsenoop},324:{n:"BrtBeginSXTDMPS",f:parsenoop},325:{n:"BrtEndSXTDMPs",f:parsenoop},326:{n:"BrtBeginSXTDMP",f:parsenoop},327:{n:"BrtEndSXTDMP",f:parsenoop},328:{n:"BrtBeginSXTHItems",f:parsenoop},329:{n:"BrtEndSXTHItems",f:parsenoop},330:{n:"BrtBeginSXTHItem",f:parsenoop},331:{n:"BrtEndSXTHItem",f:parsenoop},332:{n:"BrtBeginMetadata",f:parsenoop},333:{n:"BrtEndMetadata",f:parsenoop},334:{n:"BrtBeginEsmdtinfo",f:parsenoop},335:{n:"BrtMdtinfo",f:parsenoop},336:{n:"BrtEndEsmdtinfo",f:parsenoop},337:{n:"BrtBeginEsmdb",f:parsenoop},338:{n:"BrtEndEsmdb",f:parsenoop},339:{n:"BrtBeginEsfmd",f:parsenoop},340:{n:"BrtEndEsfmd",f:parsenoop},341:{n:"BrtBeginSingleCells",f:parsenoop},342:{n:"BrtEndSingleCells",f:parsenoop},343:{n:"BrtBeginList",f:parsenoop},344:{n:"BrtEndList",f:parsenoop},345:{n:"BrtBeginListCols",f:parsenoop},346:{n:"BrtEndListCols",f:parsenoop},347:{n:"BrtBeginListCol",f:parsenoop},348:{n:"BrtEndListCol",f:parsenoop},349:{n:"BrtBeginListXmlCPr",f:parsenoop},350:{n:"BrtEndListXmlCPr",f:parsenoop},351:{n:"BrtListCCFmla",f:parsenoop},352:{n:"BrtListTrFmla",f:parsenoop},353:{n:"BrtBeginExternals",f:parsenoop},354:{n:"BrtEndExternals",f:parsenoop},355:{n:"BrtSupBookSrc",f:parsenoop},357:{n:"BrtSupSelf",f:parsenoop},358:{n:"BrtSupSame",f:parsenoop},359:{n:"BrtSupTabs",f:parsenoop},360:{n:"BrtBeginSupBook",f:parsenoop},361:{n:"BrtPlaceholderName",f:parsenoop},362:{n:"BrtExternSheet",f:parsenoop},363:{n:"BrtExternTableStart",f:parsenoop},364:{n:"BrtExternTableEnd",f:parsenoop},366:{n:"BrtExternRowHdr",f:parsenoop},367:{n:"BrtExternCellBlank",f:parsenoop},368:{n:"BrtExternCellReal",f:parsenoop},369:{n:"BrtExternCellBool",f:parsenoop},370:{n:"BrtExternCellError",f:parsenoop},371:{n:"BrtExternCellString",f:parsenoop},372:{n:"BrtBeginEsmdx",f:parsenoop},373:{n:"BrtEndEsmdx",f:parsenoop},374:{n:"BrtBeginMdxSet",f:parsenoop},375:{n:"BrtEndMdxSet",f:parsenoop},376:{n:"BrtBeginMdxMbrProp",f:parsenoop},377:{n:"BrtEndMdxMbrProp",f:parsenoop},378:{n:"BrtBeginMdxKPI",f:parsenoop},379:{n:"BrtEndMdxKPI",f:parsenoop},380:{n:"BrtBeginEsstr",f:parsenoop},381:{n:"BrtEndEsstr",f:parsenoop},382:{n:"BrtBeginPRFItem",f:parsenoop},383:{n:"BrtEndPRFItem",f:parsenoop},384:{n:"BrtBeginPivotCacheIDs",f:parsenoop},385:{n:"BrtEndPivotCacheIDs",f:parsenoop},386:{n:"BrtBeginPivotCacheID",f:parsenoop},387:{n:"BrtEndPivotCacheID",f:parsenoop},388:{n:"BrtBeginISXVIs",f:parsenoop},389:{n:"BrtEndISXVIs",f:parsenoop},390:{n:"BrtBeginColInfos",f:parsenoop},391:{n:"BrtEndColInfos",f:parsenoop},392:{n:"BrtBeginRwBrk",f:parsenoop},393:{n:"BrtEndRwBrk",f:parsenoop},394:{n:"BrtBeginColBrk",f:parsenoop},395:{n:"BrtEndColBrk",f:parsenoop},396:{n:"BrtBrk",f:parsenoop},397:{n:"BrtUserBookView",f:parsenoop},398:{n:"BrtInfo",f:parsenoop},399:{n:"BrtCUsr",f:parsenoop},400:{n:"BrtUsr",f:parsenoop},401:{n:"BrtBeginUsers",f:parsenoop},403:{n:"BrtEOF",f:parsenoop},404:{n:"BrtUCR",f:parsenoop},405:{n:"BrtRRInsDel",f:parsenoop},406:{n:"BrtRREndInsDel",f:parsenoop},407:{n:"BrtRRMove",f:parsenoop},408:{n:"BrtRREndMove",f:parsenoop},409:{n:"BrtRRChgCell",f:parsenoop},410:{n:"BrtRREndChgCell",f:parsenoop},411:{n:"BrtRRHeader",f:parsenoop},412:{n:"BrtRRUserView",f:parsenoop},413:{n:"BrtRRRenSheet",f:parsenoop},414:{n:"BrtRRInsertSh",f:parsenoop},415:{n:"BrtRRDefName",f:parsenoop},416:{n:"BrtRRNote",f:parsenoop},417:{n:"BrtRRConflict",f:parsenoop},418:{n:"BrtRRTQSIF",f:parsenoop},419:{n:"BrtRRFormat",f:parsenoop},420:{n:"BrtRREndFormat",f:parsenoop},421:{n:"BrtRRAutoFmt",f:parsenoop},422:{n:"BrtBeginUserShViews",f:parsenoop},423:{n:"BrtBeginUserShView",f:parsenoop},424:{n:"BrtEndUserShView",f:parsenoop},425:{n:"BrtEndUserShViews",f:parsenoop},426:{n:"BrtArrFmla",f:parsenoop},427:{n:"BrtShrFmla",f:parsenoop},428:{n:"BrtTable",f:parsenoop},429:{n:"BrtBeginExtConnections",f:parsenoop},430:{n:"BrtEndExtConnections",f:parsenoop},431:{n:"BrtBeginPCDCalcMems",f:parsenoop},432:{n:"BrtEndPCDCalcMems",f:parsenoop},433:{n:"BrtBeginPCDCalcMem",f:parsenoop},434:{n:"BrtEndPCDCalcMem",f:parsenoop},435:{n:"BrtBeginPCDHGLevels",f:parsenoop},436:{n:"BrtEndPCDHGLevels",f:parsenoop},437:{n:"BrtBeginPCDHGLevel",f:parsenoop},438:{n:"BrtEndPCDHGLevel",f:parsenoop},439:{n:"BrtBeginPCDHGLGroups",f:parsenoop},440:{n:"BrtEndPCDHGLGroups",f:parsenoop},441:{n:"BrtBeginPCDHGLGroup",f:parsenoop},442:{n:"BrtEndPCDHGLGroup",f:parsenoop},443:{n:"BrtBeginPCDHGLGMembers",f:parsenoop},444:{n:"BrtEndPCDHGLGMembers",f:parsenoop},445:{n:"BrtBeginPCDHGLGMember",f:parsenoop},446:{n:"BrtEndPCDHGLGMember",f:parsenoop},447:{n:"BrtBeginQSI",f:parsenoop},448:{n:"BrtEndQSI",f:parsenoop},449:{n:"BrtBeginQSIR",f:parsenoop},450:{n:"BrtEndQSIR",f:parsenoop},451:{n:"BrtBeginDeletedNames",f:parsenoop},452:{n:"BrtEndDeletedNames",f:parsenoop},453:{n:"BrtBeginDeletedName",f:parsenoop},454:{n:"BrtEndDeletedName",f:parsenoop},455:{n:"BrtBeginQSIFs",f:parsenoop},456:{n:"BrtEndQSIFs",f:parsenoop},457:{n:"BrtBeginQSIF",f:parsenoop},458:{n:"BrtEndQSIF",f:parsenoop},459:{n:"BrtBeginAutoSortScope",f:parsenoop},460:{n:"BrtEndAutoSortScope",f:parsenoop},461:{n:"BrtBeginConditionalFormatting",f:parsenoop},462:{n:"BrtEndConditionalFormatting",f:parsenoop},463:{n:"BrtBeginCFRule",f:parsenoop},464:{n:"BrtEndCFRule",f:parsenoop},465:{n:"BrtBeginIconSet",f:parsenoop},466:{n:"BrtEndIconSet",f:parsenoop},467:{n:"BrtBeginDatabar",f:parsenoop},468:{n:"BrtEndDatabar",f:parsenoop},469:{n:"BrtBeginColorScale",f:parsenoop},470:{n:"BrtEndColorScale",f:parsenoop},471:{n:"BrtCFVO",f:parsenoop},472:{n:"BrtExternValueMeta",f:parsenoop},473:{n:"BrtBeginColorPalette",f:parsenoop},474:{n:"BrtEndColorPalette",f:parsenoop},475:{n:"BrtIndexedColor",f:parsenoop},476:{n:"BrtMargins",f:parsenoop},477:{n:"BrtPrintOptions",f:parsenoop},478:{n:"BrtPageSetup",f:parsenoop},479:{n:"BrtBeginHeaderFooter",f:parsenoop},480:{n:"BrtEndHeaderFooter",f:parsenoop},481:{n:"BrtBeginSXCrtFormat",f:parsenoop},482:{n:"BrtEndSXCrtFormat",f:parsenoop},483:{n:"BrtBeginSXCrtFormats",f:parsenoop},484:{n:"BrtEndSXCrtFormats",f:parsenoop},485:{n:"BrtWsFmtInfo",f:parsenoop},486:{n:"BrtBeginMgs",f:parsenoop},487:{n:"BrtEndMGs",f:parsenoop},488:{n:"BrtBeginMGMaps",f:parsenoop},489:{n:"BrtEndMGMaps",f:parsenoop},490:{n:"BrtBeginMG",f:parsenoop},491:{n:"BrtEndMG",f:parsenoop},492:{n:"BrtBeginMap",f:parsenoop},493:{n:"BrtEndMap",f:parsenoop},494:{n:"BrtHLink",f:parse_BrtHLink},495:{n:"BrtBeginDCon",f:parsenoop},496:{n:"BrtEndDCon",f:parsenoop},497:{n:"BrtBeginDRefs",f:parsenoop},498:{n:"BrtEndDRefs",f:parsenoop},499:{n:"BrtDRef",f:parsenoop},500:{n:"BrtBeginScenMan",f:parsenoop},501:{n:"BrtEndScenMan",f:parsenoop},502:{n:"BrtBeginSct",f:parsenoop},503:{n:"BrtEndSct",f:parsenoop},504:{n:"BrtSlc",f:parsenoop},505:{n:"BrtBeginDXFs",f:parsenoop},506:{n:"BrtEndDXFs",f:parsenoop},507:{n:"BrtDXF",f:parsenoop},508:{n:"BrtBeginTableStyles",f:parsenoop},509:{n:"BrtEndTableStyles",f:parsenoop},510:{n:"BrtBeginTableStyle",f:parsenoop},511:{n:"BrtEndTableStyle",f:parsenoop},512:{n:"BrtTableStyleElement",f:parsenoop},513:{n:"BrtTableStyleClient",f:parsenoop},514:{n:"BrtBeginVolDeps",f:parsenoop},515:{n:"BrtEndVolDeps",f:parsenoop},516:{n:"BrtBeginVolType",f:parsenoop},517:{n:"BrtEndVolType",f:parsenoop},518:{n:"BrtBeginVolMain",f:parsenoop},519:{n:"BrtEndVolMain",f:parsenoop},520:{n:"BrtBeginVolTopic",f:parsenoop},521:{n:"BrtEndVolTopic",f:parsenoop},522:{n:"BrtVolSubtopic",f:parsenoop},523:{n:"BrtVolRef",f:parsenoop},524:{n:"BrtVolNum",f:parsenoop},525:{n:"BrtVolErr",f:parsenoop},526:{n:"BrtVolStr",f:parsenoop},527:{n:"BrtVolBool",f:parsenoop},528:{n:"BrtBeginCalcChain$",f:parsenoop},529:{n:"BrtEndCalcChain$",f:parsenoop},530:{n:"BrtBeginSortState",f:parsenoop},531:{n:"BrtEndSortState",f:parsenoop},532:{n:"BrtBeginSortCond",f:parsenoop},533:{n:"BrtEndSortCond",f:parsenoop},534:{n:"BrtBookProtection",f:parsenoop},535:{n:"BrtSheetProtection",f:parsenoop},536:{n:"BrtRangeProtection",f:parsenoop},537:{n:"BrtPhoneticInfo",f:parsenoop},538:{n:"BrtBeginECTxtWiz",f:parsenoop},539:{n:"BrtEndECTxtWiz",f:parsenoop},540:{n:"BrtBeginECTWFldInfoLst",f:parsenoop},541:{n:"BrtEndECTWFldInfoLst",f:parsenoop},542:{n:"BrtBeginECTwFldInfo",f:parsenoop},548:{n:"BrtFileSharing",f:parsenoop},549:{n:"BrtOleSize",f:parsenoop},550:{n:"BrtDrawing",f:parsenoop},551:{n:"BrtLegacyDrawing",f:parsenoop},552:{n:"BrtLegacyDrawingHF",f:parsenoop},553:{n:"BrtWebOpt",f:parsenoop},554:{n:"BrtBeginWebPubItems",f:parsenoop},555:{n:"BrtEndWebPubItems",f:parsenoop},556:{n:"BrtBeginWebPubItem",f:parsenoop},557:{n:"BrtEndWebPubItem",f:parsenoop},558:{n:"BrtBeginSXCondFmt",f:parsenoop},559:{n:"BrtEndSXCondFmt",f:parsenoop},560:{n:"BrtBeginSXCondFmts",f:parsenoop},561:{n:"BrtEndSXCondFmts",f:parsenoop},562:{n:"BrtBkHim",f:parsenoop},564:{n:"BrtColor",f:parsenoop},565:{n:"BrtBeginIndexedColors",f:parsenoop},566:{n:"BrtEndIndexedColors",f:parsenoop},569:{n:"BrtBeginMRUColors",f:parsenoop},570:{n:"BrtEndMRUColors",f:parsenoop},572:{n:"BrtMRUColor",f:parsenoop},573:{n:"BrtBeginDVals",f:parsenoop},574:{n:"BrtEndDVals",f:parsenoop},577:{n:"BrtSupNameStart",f:parsenoop},578:{n:"BrtSupNameValueStart",f:parsenoop},579:{n:"BrtSupNameValueEnd",f:parsenoop},580:{n:"BrtSupNameNum",f:parsenoop},581:{n:"BrtSupNameErr",f:parsenoop},582:{n:"BrtSupNameSt",f:parsenoop},583:{n:"BrtSupNameNil",f:parsenoop},584:{n:"BrtSupNameBool",f:parsenoop},585:{n:"BrtSupNameFmla",f:parsenoop},586:{n:"BrtSupNameBits",f:parsenoop},587:{n:"BrtSupNameEnd",f:parsenoop},588:{n:"BrtEndSupBook",f:parsenoop},589:{n:"BrtCellSmartTagProperty",f:parsenoop},590:{n:"BrtBeginCellSmartTag",f:parsenoop},591:{n:"BrtEndCellSmartTag",f:parsenoop},592:{n:"BrtBeginCellSmartTags",f:parsenoop},593:{n:"BrtEndCellSmartTags",f:parsenoop},594:{n:"BrtBeginSmartTags",f:parsenoop},595:{n:"BrtEndSmartTags",f:parsenoop},596:{n:"BrtSmartTagType",f:parsenoop},597:{n:"BrtBeginSmartTagTypes",f:parsenoop},598:{n:"BrtEndSmartTagTypes",f:parsenoop},599:{n:"BrtBeginSXFilters",f:parsenoop},600:{n:"BrtEndSXFilters",f:parsenoop},601:{n:"BrtBeginSXFILTER",f:parsenoop},602:{n:"BrtEndSXFilter",f:parsenoop},603:{n:"BrtBeginFills",f:parsenoop},604:{n:"BrtEndFills",f:parsenoop},605:{n:"BrtBeginCellWatches",f:parsenoop},606:{n:"BrtEndCellWatches",f:parsenoop},607:{n:"BrtCellWatch",f:parsenoop},608:{n:"BrtBeginCRErrs",f:parsenoop},609:{n:"BrtEndCRErrs",f:parsenoop},610:{n:"BrtCrashRecErr",f:parsenoop},611:{n:"BrtBeginFonts",f:parsenoop},612:{n:"BrtEndFonts",f:parsenoop},613:{n:"BrtBeginBorders",f:parsenoop},614:{n:"BrtEndBorders",f:parsenoop},615:{n:"BrtBeginFmts",f:parsenoop},616:{n:"BrtEndFmts",f:parsenoop},617:{n:"BrtBeginCellXFs",f:parsenoop},618:{n:"BrtEndCellXFs",f:parsenoop},619:{n:"BrtBeginStyles",f:parsenoop},620:{n:"BrtEndStyles",f:parsenoop},625:{n:"BrtBigName",f:parsenoop},626:{n:"BrtBeginCellStyleXFs",f:parsenoop},627:{n:"BrtEndCellStyleXFs",f:parsenoop},628:{n:"BrtBeginComments",f:parsenoop},629:{n:"BrtEndComments",f:parsenoop},630:{n:"BrtBeginCommentAuthors",f:parsenoop},631:{n:"BrtEndCommentAuthors",f:parsenoop},632:{n:"BrtCommentAuthor",f:parse_BrtCommentAuthor},633:{n:"BrtBeginCommentList",f:parsenoop},634:{n:"BrtEndCommentList",f:parsenoop},635:{n:"BrtBeginComment",f:parse_BrtBeginComment},636:{n:"BrtEndComment",f:parsenoop},637:{n:"BrtCommentText",f:parse_BrtCommentText},638:{n:"BrtBeginOleObjects",f:parsenoop},639:{n:"BrtOleObject",f:parsenoop},640:{n:"BrtEndOleObjects",f:parsenoop},641:{n:"BrtBeginSxrules",f:parsenoop},642:{n:"BrtEndSxRules",f:parsenoop},643:{n:"BrtBeginActiveXControls",f:parsenoop},644:{n:"BrtActiveX",f:parsenoop},645:{n:"BrtEndActiveXControls",f:parsenoop},646:{n:"BrtBeginPCDSDTCEMembersSortBy",f:parsenoop},648:{n:"BrtBeginCellIgnoreECs",f:parsenoop},649:{n:"BrtCellIgnoreEC",f:parsenoop},650:{n:"BrtEndCellIgnoreECs",f:parsenoop},651:{n:"BrtCsProp",f:parsenoop},652:{n:"BrtCsPageSetup",f:parsenoop},653:{n:"BrtBeginUserCsViews",f:parsenoop},654:{n:"BrtEndUserCsViews",f:parsenoop},655:{n:"BrtBeginUserCsView",f:parsenoop},656:{n:"BrtEndUserCsView",f:parsenoop},657:{n:"BrtBeginPcdSFCIEntries",f:parsenoop},658:{n:"BrtEndPCDSFCIEntries",f:parsenoop},659:{n:"BrtPCDSFCIEntry",f:parsenoop},660:{n:"BrtBeginListParts",f:parsenoop},661:{n:"BrtListPart",f:parsenoop},662:{n:"BrtEndListParts",f:parsenoop},663:{n:"BrtSheetCalcProp",f:parsenoop},664:{n:"BrtBeginFnGroup",f:parsenoop},665:{n:"BrtFnGroup",f:parsenoop},666:{n:"BrtEndFnGroup",f:parsenoop},667:{n:"BrtSupAddin",f:parsenoop},668:{n:"BrtSXTDMPOrder",f:parsenoop},669:{n:"BrtCsProtection",f:parsenoop},671:{n:"BrtBeginWsSortMap",f:parsenoop},672:{n:"BrtEndWsSortMap",f:parsenoop},673:{n:"BrtBeginRRSort",f:parsenoop},674:{n:"BrtEndRRSort",f:parsenoop},675:{n:"BrtRRSortItem",f:parsenoop},676:{n:"BrtFileSharingIso",f:parsenoop},677:{n:"BrtBookProtectionIso",f:parsenoop},678:{n:"BrtSheetProtectionIso",f:parsenoop},679:{n:"BrtCsProtectionIso",f:parsenoop},680:{n:"BrtRangeProtectionIso",f:parsenoop},1024:{n:"BrtRwDescent",f:parsenoop},1025:{n:"BrtKnownFonts",f:parsenoop},1026:{n:"BrtBeginSXTupleSet",f:parsenoop},1027:{n:"BrtEndSXTupleSet",f:parsenoop},1028:{n:"BrtBeginSXTupleSetHeader",f:parsenoop},1029:{n:"BrtEndSXTupleSetHeader",f:parsenoop},1030:{n:"BrtSXTupleSetHeaderItem",f:parsenoop},1031:{n:"BrtBeginSXTupleSetData",f:parsenoop},1032:{n:"BrtEndSXTupleSetData",f:parsenoop},1033:{n:"BrtBeginSXTupleSetRow",f:parsenoop},1034:{n:"BrtEndSXTupleSetRow",f:parsenoop},1035:{n:"BrtSXTupleSetRowItem",f:parsenoop},1036:{n:"BrtNameExt",f:parsenoop},1037:{n:"BrtPCDH14",f:parsenoop},1038:{n:"BrtBeginPCDCalcMem14",f:parsenoop},1039:{n:"BrtEndPCDCalcMem14",f:parsenoop},1040:{n:"BrtSXTH14",f:parsenoop},1041:{n:"BrtBeginSparklineGroup",f:parsenoop},1042:{n:"BrtEndSparklineGroup",f:parsenoop},1043:{n:"BrtSparkline",f:parsenoop},1044:{n:"BrtSXDI14",f:parsenoop},1045:{n:"BrtWsFmtInfoEx14",f:parsenoop},1046:{n:"BrtBeginConditionalFormatting14",f:parsenoop},1047:{n:"BrtEndConditionalFormatting14",f:parsenoop},1048:{n:"BrtBeginCFRule14",f:parsenoop},1049:{n:"BrtEndCFRule14",f:parsenoop},1050:{n:"BrtCFVO14",f:parsenoop},1051:{n:"BrtBeginDatabar14",f:parsenoop},1052:{n:"BrtBeginIconSet14",f:parsenoop},1053:{n:"BrtDVal14",f:parsenoop},1054:{n:"BrtBeginDVals14",f:parsenoop},1055:{n:"BrtColor14",f:parsenoop},1056:{n:"BrtBeginSparklines",f:parsenoop},1057:{n:"BrtEndSparklines",f:parsenoop},1058:{n:"BrtBeginSparklineGroups",f:parsenoop},1059:{n:"BrtEndSparklineGroups",f:parsenoop},1061:{n:"BrtSXVD14",f:parsenoop},1062:{n:"BrtBeginSxview14",f:parsenoop},1063:{n:"BrtEndSxview14",f:parsenoop},1066:{n:"BrtBeginPCD14",f:parsenoop},1067:{n:"BrtEndPCD14",f:parsenoop},1068:{n:"BrtBeginExtConn14",f:parsenoop},1069:{n:"BrtEndExtConn14",f:parsenoop},1070:{n:"BrtBeginSlicerCacheIDs",f:parsenoop},1071:{n:"BrtEndSlicerCacheIDs",f:parsenoop},1072:{n:"BrtBeginSlicerCacheID",f:parsenoop},1073:{n:"BrtEndSlicerCacheID",f:parsenoop},1075:{n:"BrtBeginSlicerCache",f:parsenoop},1076:{n:"BrtEndSlicerCache",f:parsenoop},1077:{n:"BrtBeginSlicerCacheDef",f:parsenoop},1078:{n:"BrtEndSlicerCacheDef",f:parsenoop},1079:{n:"BrtBeginSlicersEx",f:parsenoop},1080:{n:"BrtEndSlicersEx",f:parsenoop},1081:{n:"BrtBeginSlicerEx",f:parsenoop},1082:{n:"BrtEndSlicerEx",f:parsenoop},1083:{n:"BrtBeginSlicer",f:parsenoop},1084:{n:"BrtEndSlicer",f:parsenoop},1085:{n:"BrtSlicerCachePivotTables",f:parsenoop},1086:{n:"BrtBeginSlicerCacheOlapImpl",f:parsenoop},1087:{n:"BrtEndSlicerCacheOlapImpl",f:parsenoop},1088:{n:"BrtBeginSlicerCacheLevelsData",f:parsenoop},1089:{n:"BrtEndSlicerCacheLevelsData",f:parsenoop},1090:{n:"BrtBeginSlicerCacheLevelData",f:parsenoop},1091:{n:"BrtEndSlicerCacheLevelData",f:parsenoop},1092:{n:"BrtBeginSlicerCacheSiRanges",f:parsenoop},1093:{n:"BrtEndSlicerCacheSiRanges",f:parsenoop},1094:{n:"BrtBeginSlicerCacheSiRange",f:parsenoop},1095:{n:"BrtEndSlicerCacheSiRange",f:parsenoop},1096:{n:"BrtSlicerCacheOlapItem",f:parsenoop},1097:{n:"BrtBeginSlicerCacheSelections",f:parsenoop},1098:{n:"BrtSlicerCacheSelection",f:parsenoop},1099:{n:"BrtEndSlicerCacheSelections",f:parsenoop},1100:{n:"BrtBeginSlicerCacheNative",f:parsenoop},1101:{n:"BrtEndSlicerCacheNative",f:parsenoop},1102:{n:"BrtSlicerCacheNativeItem",f:parsenoop},1103:{n:"BrtRangeProtection14",f:parsenoop},1104:{n:"BrtRangeProtectionIso14",f:parsenoop},1105:{n:"BrtCellIgnoreEC14",f:parsenoop},1111:{n:"BrtList14",f:parsenoop},1112:{n:"BrtCFIcon",f:parsenoop},1113:{n:"BrtBeginSlicerCachesPivotCacheIDs",f:parsenoop},1114:{n:"BrtEndSlicerCachesPivotCacheIDs",f:parsenoop},1115:{n:"BrtBeginSlicers",f:parsenoop},1116:{n:"BrtEndSlicers",f:parsenoop},1117:{n:"BrtWbProp14",f:parsenoop},1118:{n:"BrtBeginSXEdit",f:parsenoop},1119:{n:"BrtEndSXEdit",f:parsenoop},1120:{n:"BrtBeginSXEdits",f:parsenoop},1121:{n:"BrtEndSXEdits",f:parsenoop},1122:{n:"BrtBeginSXChange",f:parsenoop},1123:{n:"BrtEndSXChange",f:parsenoop},1124:{n:"BrtBeginSXChanges",f:parsenoop},1125:{n:"BrtEndSXChanges",f:parsenoop},1126:{n:"BrtSXTupleItems",f:parsenoop},1128:{n:"BrtBeginSlicerStyle",f:parsenoop},1129:{n:"BrtEndSlicerStyle",f:parsenoop},1130:{n:"BrtSlicerStyleElement",f:parsenoop},1131:{n:"BrtBeginStyleSheetExt14",f:parsenoop},1132:{n:"BrtEndStyleSheetExt14",f:parsenoop},1133:{n:"BrtBeginSlicerCachesPivotCacheID",f:parsenoop},1134:{n:"BrtEndSlicerCachesPivotCacheID",f:parsenoop},1135:{n:"BrtBeginConditionalFormattings",f:parsenoop},1136:{n:"BrtEndConditionalFormattings",f:parsenoop},1137:{n:"BrtBeginPCDCalcMemExt",f:parsenoop},1138:{n:"BrtEndPCDCalcMemExt",f:parsenoop},1139:{n:"BrtBeginPCDCalcMemsExt",f:parsenoop},1140:{n:"BrtEndPCDCalcMemsExt",f:parsenoop},1141:{n:"BrtPCDField14",f:parsenoop},1142:{n:"BrtBeginSlicerStyles",f:parsenoop},1143:{n:"BrtEndSlicerStyles",f:parsenoop},1144:{n:"BrtBeginSlicerStyleElements",f:parsenoop},1145:{n:"BrtEndSlicerStyleElements",f:parsenoop},1146:{n:"BrtCFRuleExt",f:parsenoop},1147:{n:"BrtBeginSXCondFmt14",f:parsenoop},1148:{n:"BrtEndSXCondFmt14",f:parsenoop},1149:{n:"BrtBeginSXCondFmts14",f:parsenoop},1150:{n:"BrtEndSXCondFmts14",f:parsenoop},1152:{n:"BrtBeginSortCond14",f:parsenoop},1153:{n:"BrtEndSortCond14",f:parsenoop},1154:{n:"BrtEndDVals14",f:parsenoop},1155:{n:"BrtEndIconSet14",f:parsenoop},1156:{n:"BrtEndDatabar14",f:parsenoop},1157:{n:"BrtBeginColorScale14",f:parsenoop},1158:{n:"BrtEndColorScale14",f:parsenoop},1159:{n:"BrtBeginSxrules14",f:parsenoop},1160:{n:"BrtEndSxrules14",f:parsenoop},1161:{n:"BrtBeginPRule14",f:parsenoop},1162:{n:"BrtEndPRule14",f:parsenoop},1163:{n:"BrtBeginPRFilters14",f:parsenoop},1164:{n:"BrtEndPRFilters14",f:parsenoop},1165:{n:"BrtBeginPRFilter14",f:parsenoop},1166:{n:"BrtEndPRFilter14",f:parsenoop},1167:{n:"BrtBeginPRFItem14",f:parsenoop},1168:{n:"BrtEndPRFItem14",f:parsenoop},1169:{n:"BrtBeginCellIgnoreECs14",f:parsenoop},1170:{n:"BrtEndCellIgnoreECs14",f:parsenoop},1171:{n:"BrtDxf14",f:parsenoop},1172:{n:"BrtBeginDxF14s",f:parsenoop},1173:{n:"BrtEndDxf14s",f:parsenoop},1177:{n:"BrtFilter14",f:parsenoop},1178:{n:"BrtBeginCustomFilters14",f:parsenoop},1180:{n:"BrtCustomFilter14",f:parsenoop},1181:{n:"BrtIconFilter14",f:parsenoop},1182:{n:"BrtPivotCacheConnectionName",f:parsenoop},2048:{n:"BrtBeginDecoupledPivotCacheIDs",f:parsenoop},2049:{n:"BrtEndDecoupledPivotCacheIDs",f:parsenoop},2050:{n:"BrtDecoupledPivotCacheID",f:parsenoop},2051:{n:"BrtBeginPivotTableRefs",f:parsenoop},2052:{n:"BrtEndPivotTableRefs",f:parsenoop},2053:{n:"BrtPivotTableRef",f:parsenoop},2054:{n:"BrtSlicerCacheBookPivotTables",f:parsenoop},2055:{n:"BrtBeginSxvcells",f:parsenoop},2056:{n:"BrtEndSxvcells",f:parsenoop},2057:{n:"BrtBeginSxRow",f:parsenoop},2058:{n:"BrtEndSxRow",f:parsenoop},2060:{n:"BrtPcdCalcMem15",f:parsenoop},2067:{n:"BrtQsi15",f:parsenoop},2068:{n:"BrtBeginWebExtensions",f:parsenoop},2069:{n:"BrtEndWebExtensions",f:parsenoop},2070:{n:"BrtWebExtension",f:parsenoop},2071:{n:"BrtAbsPath15",f:parsenoop},2072:{n:"BrtBeginPivotTableUISettings",f:parsenoop},2073:{n:"BrtEndPivotTableUISettings",f:parsenoop},2075:{n:"BrtTableSlicerCacheIDs",f:parsenoop},2076:{n:"BrtTableSlicerCacheID",f:parsenoop},2077:{n:"BrtBeginTableSlicerCache",f:parsenoop},2078:{n:"BrtEndTableSlicerCache",f:parsenoop},2079:{n:"BrtSxFilter15",f:parsenoop},2080:{n:"BrtBeginTimelineCachePivotCacheIDs",f:parsenoop},2081:{n:"BrtEndTimelineCachePivotCacheIDs",f:parsenoop},2082:{n:"BrtTimelineCachePivotCacheID",f:parsenoop},2083:{n:"BrtBeginTimelineCacheIDs",f:parsenoop},2084:{n:"BrtEndTimelineCacheIDs",f:parsenoop},2085:{n:"BrtBeginTimelineCacheID",f:parsenoop},2086:{n:"BrtEndTimelineCacheID",f:parsenoop},2087:{n:"BrtBeginTimelinesEx",f:parsenoop},2088:{n:"BrtEndTimelinesEx",f:parsenoop},2089:{n:"BrtBeginTimelineEx",f:parsenoop},2090:{n:"BrtEndTimelineEx",f:parsenoop},2091:{n:"BrtWorkBookPr15",f:parsenoop},2092:{n:"BrtPCDH15",f:parsenoop},2093:{n:"BrtBeginTimelineStyle",f:parsenoop},2094:{n:"BrtEndTimelineStyle",f:parsenoop},2095:{n:"BrtTimelineStyleElement",f:parsenoop},2096:{n:"BrtBeginTimelineStylesheetExt15",f:parsenoop},2097:{n:"BrtEndTimelineStylesheetExt15",f:parsenoop},2098:{n:"BrtBeginTimelineStyles",f:parsenoop},2099:{n:"BrtEndTimelineStyles",f:parsenoop},2100:{n:"BrtBeginTimelineStyleElements",f:parsenoop},2101:{n:"BrtEndTimelineStyleElements",f:parsenoop},2102:{n:"BrtDxf15",f:parsenoop},2103:{n:"BrtBeginDxfs15",f:parsenoop},2104:{n:"brtEndDxfs15",f:parsenoop},2105:{n:"BrtSlicerCacheHideItemsWithNoData",f:parsenoop},2106:{n:"BrtBeginItemUniqueNames",f:parsenoop},2107:{n:"BrtEndItemUniqueNames",f:parsenoop},2108:{n:"BrtItemUniqueName",f:parsenoop},2109:{n:"BrtBeginExtConn15",f:parsenoop},2110:{n:"BrtEndExtConn15",f:parsenoop},2111:{n:"BrtBeginOledbPr15",f:parsenoop},2112:{n:"BrtEndOledbPr15",f:parsenoop},2113:{n:"BrtBeginDataFeedPr15",f:parsenoop},2114:{n:"BrtEndDataFeedPr15",f:parsenoop},2115:{n:"BrtTextPr15",f:parsenoop},2116:{n:"BrtRangePr15",f:parsenoop},2117:{n:"BrtDbCommand15",f:parsenoop},2118:{n:"BrtBeginDbTables15",f:parsenoop},2119:{n:"BrtEndDbTables15",f:parsenoop},2120:{n:"BrtDbTable15",f:parsenoop},2121:{n:"BrtBeginDataModel",f:parsenoop},2122:{n:"BrtEndDataModel",f:parsenoop},2123:{n:"BrtBeginModelTables",f:parsenoop},2124:{n:"BrtEndModelTables",f:parsenoop},2125:{n:"BrtModelTable",f:parsenoop},2126:{n:"BrtBeginModelRelationships",f:parsenoop},2127:{n:"BrtEndModelRelationships",f:parsenoop},2128:{n:"BrtModelRelationship",f:parsenoop},2129:{n:"BrtBeginECTxtWiz15",f:parsenoop},2130:{n:"BrtEndECTxtWiz15",f:parsenoop},2131:{n:"BrtBeginECTWFldInfoLst15",f:parsenoop},2132:{n:"BrtEndECTWFldInfoLst15",f:parsenoop},2133:{n:"BrtBeginECTWFldInfo15",f:parsenoop},2134:{n:"BrtFieldListActiveItem",f:parsenoop},2135:{n:"BrtPivotCacheIdVersion",f:parsenoop},2136:{n:"BrtSXDI15",f:parsenoop},65535:{n:"",f:parsenoop}};var evert_RE=evert_key(XLSBRecordEnum,"n");var XLSRecordEnum={3:{n:"BIFF2NUM",f:parse_BIFF2NUM},4:{n:"BIFF2STR",f:parse_BIFF2STR},6:{n:"Formula",f:parse_Formula},9:{n:"BOF",f:parse_BOF},10:{n:"EOF",f:parse_EOF},12:{n:"CalcCount",f:parse_CalcCount},13:{n:"CalcMode",f:parse_CalcMode},14:{n:"CalcPrecision",f:parse_CalcPrecision},15:{n:"CalcRefMode",f:parse_CalcRefMode},16:{n:"CalcDelta",f:parse_CalcDelta},17:{n:"CalcIter",f:parse_CalcIter},18:{n:"Protect",f:parse_Protect},19:{n:"Password",f:parse_Password},20:{n:"Header",f:parse_Header},21:{n:"Footer",f:parse_Footer},23:{n:"ExternSheet",f:parse_ExternSheet},24:{n:"Lbl",f:parse_Lbl},25:{n:"WinProtect",f:parse_WinProtect},26:{n:"VerticalPageBreaks",f:parse_VerticalPageBreaks},27:{n:"HorizontalPageBreaks",f:parse_HorizontalPageBreaks},28:{n:"Note",f:parse_Note},29:{n:"Selection",f:parse_Selection},34:{n:"Date1904",f:parse_Date1904},35:{n:"ExternName",f:parse_ExternName},38:{n:"LeftMargin",f:parse_LeftMargin},39:{n:"RightMargin",f:parse_RightMargin},40:{n:"TopMargin",f:parse_TopMargin},41:{n:"BottomMargin",f:parse_BottomMargin},42:{n:"PrintRowCol",f:parse_PrintRowCol},43:{n:"PrintGrid",f:parse_PrintGrid},47:{n:"FilePass",f:parse_FilePass},49:{n:"Font",f:parse_Font},51:{n:"PrintSize",f:parse_PrintSize},60:{n:"Continue",f:parse_Continue},61:{n:"Window1",f:parse_Window1},64:{n:"Backup",f:parse_Backup},65:{n:"Pane",f:parse_Pane},66:{n:"CodePage",f:parse_CodePage},77:{n:"Pls",f:parse_Pls},80:{n:"DCon",f:parse_DCon},81:{n:"DConRef",f:parse_DConRef},82:{n:"DConName",f:parse_DConName},85:{n:"DefColWidth",f:parse_DefColWidth},89:{n:"XCT",f:parse_XCT},90:{n:"CRN",f:parse_CRN},91:{n:"FileSharing",f:parse_FileSharing},92:{n:"WriteAccess",f:parse_WriteAccess},93:{n:"Obj",f:parse_Obj},94:{n:"Uncalced",f:parse_Uncalced},95:{n:"CalcSaveRecalc",f:parse_CalcSaveRecalc},96:{n:"Template",f:parse_Template},97:{n:"Intl",f:parse_Intl},99:{n:"ObjProtect",f:parse_ObjProtect},125:{n:"ColInfo",f:parse_ColInfo},128:{n:"Guts",f:parse_Guts},129:{n:"WsBool",f:parse_WsBool},130:{n:"GridSet",f:parse_GridSet},131:{n:"HCenter",f:parse_HCenter},132:{n:"VCenter",f:parse_VCenter},133:{n:"BoundSheet8",f:parse_BoundSheet8},134:{n:"WriteProtect",f:parse_WriteProtect},140:{n:"Country",f:parse_Country},141:{n:"HideObj",f:parse_HideObj},144:{n:"Sort",f:parse_Sort},146:{n:"Palette",f:parse_Palette},151:{n:"Sync",f:parse_Sync},152:{n:"LPr",f:parse_LPr},153:{n:"DxGCol",f:parse_DxGCol},154:{n:"FnGroupName",f:parse_FnGroupName},155:{n:"FilterMode",f:parse_FilterMode},156:{n:"BuiltInFnGroupCount",f:parse_BuiltInFnGroupCount},157:{n:"AutoFilterInfo",f:parse_AutoFilterInfo},158:{n:"AutoFilter",f:parse_AutoFilter},160:{n:"Scl",f:parse_Scl},161:{n:"Setup",f:parse_Setup},174:{n:"ScenMan",f:parse_ScenMan},175:{n:"SCENARIO",f:parse_SCENARIO},176:{n:"SxView",f:parse_SxView},177:{n:"Sxvd",f:parse_Sxvd},178:{n:"SXVI",f:parse_SXVI},180:{n:"SxIvd",f:parse_SxIvd},181:{n:"SXLI",f:parse_SXLI},182:{n:"SXPI",f:parse_SXPI},184:{n:"DocRoute",f:parse_DocRoute},+ 185:{n:"RecipName",f:parse_RecipName},189:{n:"MulRk",f:parse_MulRk},190:{n:"MulBlank",f:parse_MulBlank},193:{n:"Mms",f:parse_Mms},197:{n:"SXDI",f:parse_SXDI},198:{n:"SXDB",f:parse_SXDB},199:{n:"SXFDB",f:parse_SXFDB},200:{n:"SXDBB",f:parse_SXDBB},201:{n:"SXNum",f:parse_SXNum},202:{n:"SxBool",f:parse_SxBool},203:{n:"SxErr",f:parse_SxErr},204:{n:"SXInt",f:parse_SXInt},205:{n:"SXString",f:parse_SXString},206:{n:"SXDtr",f:parse_SXDtr},207:{n:"SxNil",f:parse_SxNil},208:{n:"SXTbl",f:parse_SXTbl},209:{n:"SXTBRGIITM",f:parse_SXTBRGIITM},210:{n:"SxTbpg",f:parse_SxTbpg},211:{n:"ObProj",f:parse_ObProj},213:{n:"SXStreamID",f:parse_SXStreamID},215:{n:"DBCell",f:parse_DBCell},216:{n:"SXRng",f:parse_SXRng},217:{n:"SxIsxoper",f:parse_SxIsxoper},218:{n:"BookBool",f:parse_BookBool},220:{n:"DbOrParamQry",f:parse_DbOrParamQry},221:{n:"ScenarioProtect",f:parse_ScenarioProtect},222:{n:"OleObjectSize",f:parse_OleObjectSize},224:{n:"XF",f:parse_XF},225:{n:"InterfaceHdr",f:parse_InterfaceHdr},226:{n:"InterfaceEnd",f:parse_InterfaceEnd},227:{n:"SXVS",f:parse_SXVS},229:{n:"MergeCells",f:parse_MergeCells},233:{n:"BkHim",f:parse_BkHim},235:{n:"MsoDrawingGroup",f:parse_MsoDrawingGroup},236:{n:"MsoDrawing",f:parse_MsoDrawing},237:{n:"MsoDrawingSelection",f:parse_MsoDrawingSelection},239:{n:"PhoneticInfo",f:parse_PhoneticInfo},240:{n:"SxRule",f:parse_SxRule},241:{n:"SXEx",f:parse_SXEx},242:{n:"SxFilt",f:parse_SxFilt},244:{n:"SxDXF",f:parse_SxDXF},245:{n:"SxItm",f:parse_SxItm},246:{n:"SxName",f:parse_SxName},247:{n:"SxSelect",f:parse_SxSelect},248:{n:"SXPair",f:parse_SXPair},249:{n:"SxFmla",f:parse_SxFmla},251:{n:"SxFormat",f:parse_SxFormat},252:{n:"SST",f:parse_SST},253:{n:"LabelSst",f:parse_LabelSst},255:{n:"ExtSST",f:parse_ExtSST},256:{n:"SXVDEx",f:parse_SXVDEx},259:{n:"SXFormula",f:parse_SXFormula},290:{n:"SXDBEx",f:parse_SXDBEx},311:{n:"RRDInsDel",f:parse_RRDInsDel},312:{n:"RRDHead",f:parse_RRDHead},315:{n:"RRDChgCell",f:parse_RRDChgCell},317:{n:"RRTabId",f:parse_RRTabId},318:{n:"RRDRenSheet",f:parse_RRDRenSheet},319:{n:"RRSort",f:parse_RRSort},320:{n:"RRDMove",f:parse_RRDMove},330:{n:"RRFormat",f:parse_RRFormat},331:{n:"RRAutoFmt",f:parse_RRAutoFmt},333:{n:"RRInsertSh",f:parse_RRInsertSh},334:{n:"RRDMoveBegin",f:parse_RRDMoveBegin},335:{n:"RRDMoveEnd",f:parse_RRDMoveEnd},336:{n:"RRDInsDelBegin",f:parse_RRDInsDelBegin},337:{n:"RRDInsDelEnd",f:parse_RRDInsDelEnd},338:{n:"RRDConflict",f:parse_RRDConflict},339:{n:"RRDDefName",f:parse_RRDDefName},340:{n:"RRDRstEtxp",f:parse_RRDRstEtxp},351:{n:"LRng",f:parse_LRng},352:{n:"UsesELFs",f:parse_UsesELFs},353:{n:"DSF",f:parse_DSF},401:{n:"CUsr",f:parse_CUsr},402:{n:"CbUsr",f:parse_CbUsr},403:{n:"UsrInfo",f:parse_UsrInfo},404:{n:"UsrExcl",f:parse_UsrExcl},405:{n:"FileLock",f:parse_FileLock},406:{n:"RRDInfo",f:parse_RRDInfo},407:{n:"BCUsrs",f:parse_BCUsrs},408:{n:"UsrChk",f:parse_UsrChk},425:{n:"UserBView",f:parse_UserBView},426:{n:"UserSViewBegin",f:parse_UserSViewBegin},427:{n:"UserSViewEnd",f:parse_UserSViewEnd},428:{n:"RRDUserView",f:parse_RRDUserView},429:{n:"Qsi",f:parse_Qsi},430:{n:"SupBook",f:parse_SupBook},431:{n:"Prot4Rev",f:parse_Prot4Rev},432:{n:"CondFmt",f:parse_CondFmt},433:{n:"CF",f:parse_CF},434:{n:"DVal",f:parse_DVal},437:{n:"DConBin",f:parse_DConBin},438:{n:"TxO",f:parse_TxO},439:{n:"RefreshAll",f:parse_RefreshAll},440:{n:"HLink",f:parse_HLink},441:{n:"Lel",f:parse_Lel},442:{n:"CodeName",f:parse_XLSCodeName},443:{n:"SXFDBType",f:parse_SXFDBType},444:{n:"Prot4RevPass",f:parse_Prot4RevPass},445:{n:"ObNoMacros",f:parse_ObNoMacros},446:{n:"Dv",f:parse_Dv},448:{n:"Excel9File",f:parse_Excel9File},449:{n:"RecalcId",f:parse_RecalcId,r:2},450:{n:"EntExU2",f:parse_EntExU2},512:{n:"Dimensions",f:parse_Dimensions},513:{n:"Blank",f:parse_Blank},515:{n:"Number",f:parse_Number},516:{n:"Label",f:parse_Label},517:{n:"BoolErr",f:parse_BoolErr},519:{n:"String",f:parse_String},520:{n:"Row",f:parse_Row},523:{n:"Index",f:parse_Index},545:{n:"Array",f:parse_Array},549:{n:"DefaultRowHeight",f:parse_DefaultRowHeight},566:{n:"Table",f:parse_Table},574:{n:"Window2",f:parse_Window2},638:{n:"RK",f:parse_RK},659:{n:"Style",f:parse_Style},1048:{n:"BigName",f:parse_BigName},1054:{n:"Format",f:parse_Format},1084:{n:"ContinueBigName",f:parse_ContinueBigName},1212:{n:"ShrFmla",f:parse_ShrFmla},2048:{n:"HLinkTooltip",f:parse_HLinkTooltip},2049:{n:"WebPub",f:parse_WebPub},2050:{n:"QsiSXTag",f:parse_QsiSXTag},2051:{n:"DBQueryExt",f:parse_DBQueryExt},2052:{n:"ExtString",f:parse_ExtString},2053:{n:"TxtQry",f:parse_TxtQry},2054:{n:"Qsir",f:parse_Qsir},2055:{n:"Qsif",f:parse_Qsif},2056:{n:"RRDTQSIF",f:parse_RRDTQSIF},2057:{n:"BOF",f:parse_BOF},2058:{n:"OleDbConn",f:parse_OleDbConn},2059:{n:"WOpt",f:parse_WOpt},2060:{n:"SXViewEx",f:parse_SXViewEx},2061:{n:"SXTH",f:parse_SXTH},2062:{n:"SXPIEx",f:parse_SXPIEx},2063:{n:"SXVDTEx",f:parse_SXVDTEx},2064:{n:"SXViewEx9",f:parse_SXViewEx9},2066:{n:"ContinueFrt",f:parse_ContinueFrt},2067:{n:"RealTimeData",f:parse_RealTimeData},2128:{n:"ChartFrtInfo",f:parse_ChartFrtInfo},2129:{n:"FrtWrapper",f:parse_FrtWrapper},2130:{n:"StartBlock",f:parse_StartBlock},2131:{n:"EndBlock",f:parse_EndBlock},2132:{n:"StartObject",f:parse_StartObject},2133:{n:"EndObject",f:parse_EndObject},2134:{n:"CatLab",f:parse_CatLab},2135:{n:"YMult",f:parse_YMult},2136:{n:"SXViewLink",f:parse_SXViewLink},2137:{n:"PivotChartBits",f:parse_PivotChartBits},2138:{n:"FrtFontList",f:parse_FrtFontList},2146:{n:"SheetExt",f:parse_SheetExt},2147:{n:"BookExt",f:parse_BookExt,r:12},2148:{n:"SXAddl",f:parse_SXAddl},2149:{n:"CrErr",f:parse_CrErr},2150:{n:"HFPicture",f:parse_HFPicture},2151:{n:"FeatHdr",f:parse_FeatHdr},2152:{n:"Feat",f:parse_Feat},2154:{n:"DataLabExt",f:parse_DataLabExt},2155:{n:"DataLabExtContents",f:parse_DataLabExtContents},2156:{n:"CellWatch",f:parse_CellWatch},2161:{n:"FeatHdr11",f:parse_FeatHdr11},2162:{n:"Feature11",f:parse_Feature11},2164:{n:"DropDownObjIds",f:parse_DropDownObjIds},2165:{n:"ContinueFrt11",f:parse_ContinueFrt11},2166:{n:"DConn",f:parse_DConn},2167:{n:"List12",f:parse_List12},2168:{n:"Feature12",f:parse_Feature12},2169:{n:"CondFmt12",f:parse_CondFmt12},2170:{n:"CF12",f:parse_CF12},2171:{n:"CFEx",f:parse_CFEx},2172:{n:"XFCRC",f:parse_XFCRC,r:12},2173:{n:"XFExt",f:parse_XFExt,r:12},2174:{n:"AutoFilter12",f:parse_AutoFilter12},2175:{n:"ContinueFrt12",f:parse_ContinueFrt12},2180:{n:"MDTInfo",f:parse_MDTInfo},2181:{n:"MDXStr",f:parse_MDXStr},2182:{n:"MDXTuple",f:parse_MDXTuple},2183:{n:"MDXSet",f:parse_MDXSet},2184:{n:"MDXProp",f:parse_MDXProp},2185:{n:"MDXKPI",f:parse_MDXKPI},2186:{n:"MDB",f:parse_MDB},2187:{n:"PLV",f:parse_PLV},2188:{n:"Compat12",f:parse_Compat12,r:12},2189:{n:"DXF",f:parse_DXF},2190:{n:"TableStyles",f:parse_TableStyles,r:12},2191:{n:"TableStyle",f:parse_TableStyle},2192:{n:"TableStyleElement",f:parse_TableStyleElement},2194:{n:"StyleExt",f:parse_StyleExt},2195:{n:"NamePublish",f:parse_NamePublish},2196:{n:"NameCmt",f:parse_NameCmt},2197:{n:"SortData",f:parse_SortData},2198:{n:"Theme",f:parse_Theme,r:12},2199:{n:"GUIDTypeLib",f:parse_GUIDTypeLib},2200:{n:"FnGrp12",f:parse_FnGrp12},2201:{n:"NameFnGrp12",f:parse_NameFnGrp12},2202:{n:"MTRSettings",f:parse_MTRSettings,r:12},2203:{n:"CompressPictures",f:parse_CompressPictures},2204:{n:"HeaderFooter",f:parse_HeaderFooter},2205:{n:"CrtLayout12",f:parse_CrtLayout12},2206:{n:"CrtMlFrt",f:parse_CrtMlFrt},2207:{n:"CrtMlFrtContinue",f:parse_CrtMlFrtContinue},2211:{n:"ForceFullCalculation",f:parse_ForceFullCalculation},2212:{n:"ShapePropsStream",f:parse_ShapePropsStream},2213:{n:"TextPropsStream",f:parse_TextPropsStream},2214:{n:"RichTextStream",f:parse_RichTextStream},2215:{n:"CrtLayout12A",f:parse_CrtLayout12A},4097:{n:"Units",f:parse_Units},4098:{n:"Chart",f:parse_Chart},4099:{n:"Series",f:parse_Series},4102:{n:"DataFormat",f:parse_DataFormat},4103:{n:"LineFormat",f:parse_LineFormat},4105:{n:"MarkerFormat",f:parse_MarkerFormat},4106:{n:"AreaFormat",f:parse_AreaFormat},4107:{n:"PieFormat",f:parse_PieFormat},4108:{n:"AttachedLabel",f:parse_AttachedLabel},4109:{n:"SeriesText",f:parse_SeriesText},4116:{n:"ChartFormat",f:parse_ChartFormat},4117:{n:"Legend",f:parse_Legend},4118:{n:"SeriesList",f:parse_SeriesList},4119:{n:"Bar",f:parse_Bar},4120:{n:"Line",f:parse_Line},4121:{n:"Pie",f:parse_Pie},4122:{n:"Area",f:parse_Area},4123:{n:"Scatter",f:parse_Scatter},4124:{n:"CrtLine",f:parse_CrtLine},4125:{n:"Axis",f:parse_Axis},4126:{n:"Tick",f:parse_Tick},4127:{n:"ValueRange",f:parse_ValueRange},4128:{n:"CatSerRange",f:parse_CatSerRange},4129:{n:"AxisLine",f:parse_AxisLine},4130:{n:"CrtLink",f:parse_CrtLink},4132:{n:"DefaultText",f:parse_DefaultText},4133:{n:"Text",f:parse_Text},4134:{n:"FontX",f:parse_FontX},4135:{n:"ObjectLink",f:parse_ObjectLink},4146:{n:"Frame",f:parse_Frame},4147:{n:"Begin",f:parse_Begin},4148:{n:"End",f:parse_End},4149:{n:"PlotArea",f:parse_PlotArea},4154:{n:"Chart3d",f:parse_Chart3d},4156:{n:"PicF",f:parse_PicF},4157:{n:"DropBar",f:parse_DropBar},4158:{n:"Radar",f:parse_Radar},4159:{n:"Surf",f:parse_Surf},4160:{n:"RadarArea",f:parse_RadarArea},4161:{n:"AxisParent",f:parse_AxisParent},4163:{n:"LegendException",f:parse_LegendException},4164:{n:"ShtProps",f:parse_ShtProps},4165:{n:"SerToCrt",f:parse_SerToCrt},4166:{n:"AxesUsed",f:parse_AxesUsed},4168:{n:"SBaseRef",f:parse_SBaseRef},4170:{n:"SerParent",f:parse_SerParent},4171:{n:"SerAuxTrend",f:parse_SerAuxTrend},4174:{n:"IFmtRecord",f:parse_IFmtRecord},4175:{n:"Pos",f:parse_Pos},4176:{n:"AlRuns",f:parse_AlRuns},4177:{n:"BRAI",f:parse_BRAI},4187:{n:"SerAuxErrBar",f:parse_SerAuxErrBar},4188:{n:"ClrtClient",f:parse_ClrtClient},4189:{n:"SerFmt",f:parse_SerFmt},4191:{n:"Chart3DBarShape",f:parse_Chart3DBarShape},4192:{n:"Fbi",f:parse_Fbi},4193:{n:"BopPop",f:parse_BopPop},4194:{n:"AxcExt",f:parse_AxcExt},4195:{n:"Dat",f:parse_Dat},4196:{n:"PlotGrowth",f:parse_PlotGrowth},4197:{n:"SIIndex",f:parse_SIIndex},4198:{n:"GelFrame",f:parse_GelFrame},4199:{n:"BopPopCustom",f:parse_BopPopCustom},4200:{n:"Fbi2",f:parse_Fbi2},22:{n:"ExternCount",f:parsenoop},126:{n:"RK",f:parsenoop},127:{n:"ImData",f:parsenoop},135:{n:"Addin",f:parsenoop},136:{n:"Edg",f:parsenoop},137:{n:"Pub",f:parsenoop},145:{n:"Sub",f:parsenoop},148:{n:"LHRecord",f:parsenoop},149:{n:"LHNGraph",f:parsenoop},150:{n:"Sound",f:parsenoop},169:{n:"CoordList",f:parsenoop},171:{n:"GCW",f:parsenoop},188:{n:"ShrFmla",f:parsenoop},194:{n:"AddMenu",f:parsenoop},195:{n:"DelMenu",f:parsenoop},214:{n:"RString",f:parsenoop},223:{n:"UDDesc",f:parsenoop},234:{n:"TabIdConf",f:parsenoop},354:{n:"XL5Modify",f:parsenoop},421:{n:"FileSharing2",f:parsenoop},536:{n:"Name",f:parsenoop},547:{n:"ExternName",f:parse_ExternName},561:{n:"Font",f:parsenoop},1030:{n:"Formula",f:parse_Formula},2157:{n:"FeatInfo",f:parsenoop},2163:{n:"FeatInfo11",f:parsenoop},2177:{n:"SXAddl12",f:parsenoop},2240:{n:"AutoWebPub",f:parsenoop},2241:{n:"ListObj",f:parsenoop},2242:{n:"ListField",f:parsenoop},2243:{n:"ListDV",f:parsenoop},2244:{n:"ListCondFmt",f:parsenoop},2245:{n:"ListCF",f:parsenoop},2246:{n:"FMQry",f:parsenoop},2247:{n:"FMSQry",f:parsenoop},2248:{n:"PLV",f:parsenoop},2249:{n:"LnExt",f:parsenoop},2250:{n:"MkrExt",f:parsenoop},2251:{n:"CrtCoopt",f:parsenoop},0:{}};function parse_ods(zip,opts){if(typeof module!=="undefined"&&typeof require!=="undefined"&&typeof ODS==="undefined")ODS=require("./od"+"s");if(typeof ODS==="undefined"||!ODS.parse_ods)throw new Error("Unsupported ODS");return ODS.parse_ods(zip,opts)}function fix_opts_func(defaults){return function fix_opts(opts){for(var i=0;i!=defaults.length;++i){var d=defaults[i];if(opts[d[0]]===undefined)opts[d[0]]=d[1];if(d[2]==="n")opts[d[0]]=Number(opts[d[0]])}}}var fix_read_opts=fix_opts_func([["cellNF",false],["cellHTML",true],["cellFormula",true],["cellStyles",false],["cellDates",false],["sheetStubs",false],["sheetRows",0,"n"],["bookDeps",false],["bookSheets",false],["bookProps",false],["bookFiles",false],["bookVBA",false],["password",""],["WTF",false]]);var fix_write_opts=fix_opts_func([["cellDates",false],["bookSST",false],["bookType","xlsx"],["WTF",false]]);function safe_parse_wbrels(wbrels,sheets){if(!wbrels)return 0;try{wbrels=sheets.map(function pwbr(w){return[w.name,wbrels["!id"][w.id].Target]})}catch(e){return null}return!wbrels||wbrels.length===0?null:wbrels}function safe_parse_ws(zip,path,relsPath,sheet,sheetRels,sheets,opts){try{sheetRels[sheet]=parse_rels(getzipdata(zip,relsPath,true),path);sheets[sheet]=parse_ws(getzipdata(zip,path),path,opts,sheetRels[sheet])}catch(e){if(opts.WTF)throw e}}var nodirs=function nodirs(x){return x.substr(-1)!="/"};function parse_zip(zip,opts){make_ssf(SSF);opts=opts||{};fix_read_opts(opts);reset_cp();if(safegetzipfile(zip,"META-INF/manifest.xml"))return parse_ods(zip,opts);var entries=keys(zip.files).filter(nodirs).sort();var dir=parse_ct(getzipdata(zip,"[Content_Types].xml"),opts);var xlsb=false;var sheets,binname;if(dir.workbooks.length===0){binname="xl/workbook.xml";if(getzipdata(zip,binname,true))dir.workbooks.push(binname)}if(dir.workbooks.length===0){binname="xl/workbook.bin";if(!getzipfile(zip,binname,true))throw new Error("Could not find workbook");dir.workbooks.push(binname);xlsb=true}if(dir.workbooks[0].substr(-3)=="bin")xlsb=true;if(xlsb)set_cp(1200);if(!opts.bookSheets&&!opts.bookProps){strs=[];if(dir.sst)strs=parse_sst(getzipdata(zip,dir.sst.replace(/^\//,"")),dir.sst,opts);themes={};if(opts.cellStyles&&dir.themes.length)themes=parse_theme(getzipdata(zip,dir.themes[0].replace(/^\//,""),true),dir.themes[0],opts);styles={};if(dir.style)styles=parse_sty(getzipdata(zip,dir.style.replace(/^\//,"")),dir.style,opts)}var wb=parse_wb(getzipdata(zip,dir.workbooks[0].replace(/^\//,"")),dir.workbooks[0],opts);var props={},propdata="";if(dir.coreprops.length!==0){propdata=getzipdata(zip,dir.coreprops[0].replace(/^\//,""),true);if(propdata)props=parse_core_props(propdata);if(dir.extprops.length!==0){propdata=getzipdata(zip,dir.extprops[0].replace(/^\//,""),true);if(propdata)parse_ext_props(propdata,props)}}var custprops={};if(!opts.bookSheets||opts.bookProps){if(dir.custprops.length!==0){propdata=getzipdata(zip,dir.custprops[0].replace(/^\//,""),true);if(propdata)custprops=parse_cust_props(propdata,opts)}}var out={};if(opts.bookSheets||opts.bookProps){if(props.Worksheets&&props.SheetNames.length>0)sheets=props.SheetNames;else if(wb.Sheets)sheets=wb.Sheets.map(function pluck(x){return x.name});if(opts.bookProps){out.Props=props;out.Custprops=custprops}if(typeof sheets!=="undefined")out.SheetNames=sheets;if(opts.bookSheets?out.SheetNames:opts.bookProps)return out}sheets={};var deps={};if(opts.bookDeps&&dir.calcchain)deps=parse_cc(getzipdata(zip,dir.calcchain.replace(/^\//,"")),dir.calcchain,opts);var i=0;var sheetRels={};var path,relsPath;if(!props.Worksheets){var wbsheets=wb.Sheets;props.Worksheets=wbsheets.length;props.SheetNames=[];for(var j=0;j!=wbsheets.length;++j){props.SheetNames[j]=wbsheets[j].name}}var wbext=xlsb?"bin":"xml";var wbrelsfile="xl/_rels/workbook."+wbext+".rels";var wbrels=parse_rels(getzipdata(zip,wbrelsfile,true),wbrelsfile);if(wbrels)wbrels=safe_parse_wbrels(wbrels,wb.Sheets);var nmode=getzipdata(zip,"xl/worksheets/sheet.xml",true)?1:0;for(i=0;i!=props.Worksheets;++i){if(wbrels)path="xl/"+wbrels[i][1].replace(/[\/]?xl\//,"");else{path="xl/worksheets/sheet"+(i+1-nmode)+"."+wbext;path=path.replace(/sheet0\./,"sheet.")}relsPath=path.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels");safe_parse_ws(zip,path,relsPath,props.SheetNames[i],sheetRels,sheets,opts)}if(dir.comments)parse_comments(zip,dir.comments,sheets,sheetRels,opts);out={Directory:dir,Workbook:wb,Props:props,Custprops:custprops,Deps:deps,Sheets:sheets,SheetNames:props.SheetNames,Strings:strs,Styles:styles,Themes:themes,SSF:SSF.get_table()};if(opts.bookFiles){out.keys=entries;out.files=zip.files}if(opts.bookVBA){if(dir.vba.length>0)out.vbaraw=getzipdata(zip,dir.vba[0],true);else if(dir.defaults.bin==="application/vnd.ms-office.vbaProject")out.vbaraw=getzipdata(zip,"xl/vbaProject.bin",true)}return out}function add_rels(rels,rId,f,type,relobj){if(!relobj)relobj={};if(!rels["!id"])rels["!id"]={};relobj.Id="rId"+rId;relobj.Type=type;relobj.Target=f;if(rels["!id"][relobj.Id])throw new Error("Cannot rewrite rId "+rId);rels["!id"][relobj.Id]=relobj;rels[("/"+relobj.Target).replace("//","/")]=relobj}function write_zip(wb,opts){if(wb&&!wb.SSF){wb.SSF=SSF.get_table()}if(wb&&wb.SSF){make_ssf(SSF);SSF.load_table(wb.SSF);opts.revssf=evert_num(wb.SSF);opts.revssf[wb.SSF[65535]]=0}opts.rels={};opts.wbrels={};opts.Strings=[];opts.Strings.Count=0;opts.Strings.Unique=0;var wbext=opts.bookType=="xlsb"?"bin":"xml";var ct={workbooks:[],sheets:[],calcchains:[],themes:[],styles:[],coreprops:[],extprops:[],custprops:[],strs:[],comments:[],vba:[],TODO:[],rels:[],xmlns:""};fix_write_opts(opts=opts||{});var zip=new jszip;var f="",rId=0;opts.cellXfs=[];get_cell_style(opts.cellXfs,{},{revssf:{General:0}});f="docProps/core.xml";zip.file(f,write_core_props(wb.Props,opts));ct.coreprops.push(f);add_rels(opts.rels,2,f,RELS.CORE_PROPS);f="docProps/app.xml";if(!wb.Props)wb.Props={};wb.Props.SheetNames=wb.SheetNames;wb.Props.Worksheets=wb.SheetNames.length;zip.file(f,write_ext_props(wb.Props,opts));ct.extprops.push(f);add_rels(opts.rels,3,f,RELS.EXT_PROPS);if(wb.Custprops!==wb.Props&&keys(wb.Custprops||{}).length>0){f="docProps/custom.xml";zip.file(f,write_cust_props(wb.Custprops,opts));ct.custprops.push(f);add_rels(opts.rels,4,f,RELS.CUST_PROPS)}f="xl/workbook."+wbext;zip.file(f,write_wb(wb,f,opts));ct.workbooks.push(f);add_rels(opts.rels,1,f,RELS.WB);for(rId=1;rId<=wb.SheetNames.length;++rId){f="xl/worksheets/sheet"+rId+"."+wbext;zip.file(f,write_ws(rId-1,f,opts,wb));ct.sheets.push(f);add_rels(opts.wbrels,rId,"worksheets/sheet"+rId+"."+wbext,RELS.WS)}if(opts.Strings!=null&&opts.Strings.length>0){f="xl/sharedStrings."+wbext;zip.file(f,write_sst(opts.Strings,f,opts));ct.strs.push(f);add_rels(opts.wbrels,++rId,"sharedStrings."+wbext,RELS.SST)}f="xl/theme/theme1.xml";zip.file(f,write_theme(opts));ct.themes.push(f);add_rels(opts.wbrels,++rId,"theme/theme1.xml",RELS.THEME);f="xl/styles."+wbext;zip.file(f,write_sty(wb,f,opts));ct.styles.push(f);add_rels(opts.wbrels,++rId,"styles."+wbext,RELS.STY);zip.file("[Content_Types].xml",write_ct(ct,opts));zip.file("_rels/.rels",write_rels(opts.rels));zip.file("xl/_rels/workbook."+wbext+".rels",write_rels(opts.wbrels));return zip}function firstbyte(f,o){switch((o||{}).type||"base64"){case"buffer":return f[0];case"base64":return Base64.decode(f.substr(0,12)).charCodeAt(0);case"binary":return f.charCodeAt(0);case"array":return f[0];default:throw new Error("Unrecognized type "+o.type)}}function read_zip(data,opts){var zip,d=data;var o=opts||{};if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";switch(o.type){case"base64":zip=new jszip(d,{base64:true});break;case"binary":case"array":zip=new jszip(d,{base64:false});break;case"buffer":zip=new jszip(d);break;case"file":zip=new jszip(d=_fs.readFileSync(data));break;default:throw new Error("Unrecognized type "+o.type)}return parse_zip(zip,o)}function readSync(data,opts){var zip,d=data,isfile=false,n;var o=opts||{};if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";if(o.type=="file"){isfile=true;o.type="buffer";d=_fs.readFileSync(data)}switch(n=firstbyte(d,o)){case 208:if(isfile)o.type="file";return parse_xlscfb(CFB.read(data,o),o);case 9:return parse_xlscfb(s2a(o.type==="base64"?Base64.decode(data):data),o);case 60:return parse_xlml(d,o);case 80:if(isfile)o.type="file";return read_zip(data,opts);default:throw new Error("Unsupported file "+n)}}function readFileSync(data,opts){var o=opts||{};o.type="file";var wb=readSync(data,o);wb.FILENAME=data;return wb}function write_zip_type(wb,opts){var o=opts||{};style_builder=new StyleBuilder(opts);var z=write_zip(wb,o);switch(o.type){case"base64":return z.generate({type:"base64"});case"binary":return z.generate({type:"string"});case"buffer":return z.generate({type:"nodebuffer"});case"file":return _fs.writeFileSync(o.file,z.generate({type:"nodebuffer"}));default:throw new Error("Unrecognized type "+o.type)}}function writeSync(wb,opts){var o=opts||{};switch(o.bookType){case"xml":return write_xlml(wb,o);default:return write_zip_type(wb,o)}}function writeFileSync(wb,filename,opts){var o=opts||{};o.type="file";o.file=filename;switch(o.file.substr(-5).toLowerCase()){case".xlsx":o.bookType="xlsx";break;case".xlsm":o.bookType="xlsm";break;case".xlsb":o.bookType="xlsb";break;default:switch(o.file.substr(-4).toLowerCase()){case".xls":o.bookType="xls";break;case".xml":o.bookType="xml";break}}return writeSync(wb,o)}function decode_row(rowstr){return parseInt(unfix_row(rowstr),10)-1}function encode_row(row){return""+(row+1)}function fix_row(cstr){return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function unfix_row(cstr){return cstr.replace(/\$(\d+)$/,"$1")}function decode_col(colstr){var c=unfix_col(colstr),d=0,i=0;for(;i!==c.length;++i)d=26*d+c.charCodeAt(i)-64;return d-1}function encode_col(col){var s="";for(++col;col;col=Math.floor((col-1)/26))s=String.fromCharCode((col-1)%26+65)+s;return s}function fix_col(cstr){return cstr.replace(/^([A-Z])/,"$$$1")}function unfix_col(cstr){return cstr.replace(/^\$([A-Z])/,"$1")}function split_cell(cstr){return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function decode_cell(cstr){var splt=split_cell(cstr);return{c:decode_col(splt[0]),r:decode_row(splt[1])}}function encode_cell(cell){return encode_col(cell.c)+encode_row(cell.r)}function fix_cell(cstr){return fix_col(fix_row(cstr))}function unfix_cell(cstr){return unfix_col(unfix_row(cstr))}function decode_range(range){var x=range.split(":").map(decode_cell);return{s:x[0],e:x[x.length-1]}}function encode_range(cs,ce){if(ce===undefined||typeof ce==="number")return encode_range(cs.s,cs.e);if(typeof cs!=="string")cs=encode_cell(cs);if(typeof ce!=="string")ce=encode_cell(ce);return cs==ce?cs:cs+":"+ce}function safe_decode_range(range){var o={s:{c:0,r:0},e:{c:0,r:0}};var idx=0,i=0,cc=0;var len=range.length;for(idx=0;i<len;++i){if((cc=range.charCodeAt(i)-64)<1||cc>26)break;idx=26*idx+cc}o.s.c=--idx;for(idx=0;i<len;++i){if((cc=range.charCodeAt(i)-48)<0||cc>9)break;idx=10*idx+cc}o.s.r=--idx;if(i===len||range.charCodeAt(++i)===58){o.e.c=o.s.c;o.e.r=o.s.r;return o}for(idx=0;i!=len;++i){if((cc=range.charCodeAt(i)-64)<1||cc>26)break;idx=26*idx+cc}o.e.c=--idx;for(idx=0;i!=len;++i){if((cc=range.charCodeAt(i)-48)<0||cc>9)break;idx=10*idx+cc}o.e.r=--idx;return o}function safe_format_cell(cell,v){if(cell.z!==undefined)try{return cell.w=SSF.format(cell.z,v)}catch(e){}if(!cell.XF)return v;try{return cell.w=SSF.format(cell.XF.ifmt||0,v)}catch(e){return""+v}}function format_cell(cell,v){if(cell==null||cell.t==null)return"";if(cell.w!==undefined)return cell.w;if(v===undefined)return safe_format_cell(cell,cell.v);return safe_format_cell(cell,v)}function sheet_to_json(sheet,opts){var val,row,range,header=0,offset=1,r,hdr=[],isempty,R,C,v;var o=opts!=null?opts:{};var raw=o.raw;if(sheet==null||sheet["!ref"]==null)return[];range=o.range!==undefined?o.range:sheet["!ref"];if(o.header===1)header=1;else if(o.header==="A")header=2;else if(Array.isArray(o.header))header=3;switch(typeof range){case"string":r=safe_decode_range(range);break;case"number":r=safe_decode_range(sheet["!ref"]);r.s.r=range;break;default:r=range}if(header>0)offset=0;var rr=encode_row(r.s.r);var cols=new Array(r.e.c-r.s.c+1);var out=new Array(r.e.r-r.s.r-offset+1);var outi=0;for(C=r.s.c;C<=r.e.c;++C){cols[C]=encode_col(C);val=sheet[cols[C]+rr];switch(header){case 1:hdr[C]=C;break;case 2:hdr[C]=cols[C];break;case 3:hdr[C]=o.header[C-r.s.c];break;default:if(val===undefined)continue;hdr[C]=format_cell(val)}}for(R=r.s.r+offset;R<=r.e.r;++R){rr=encode_row(R);isempty=true;if(header===1)row=[];else{row={};if(Object.defineProperty)Object.defineProperty(row,"__rowNum__",{value:R,enumerable:false});else row.__rowNum__=R}for(C=r.s.c;C<=r.e.c;++C){val=sheet[cols[C]+rr];if(val===undefined||val.t===undefined)continue;v=val.v;switch(val.t){case"e":continue;case"s":break;case"b":case"n":break;default:throw"unrecognized type "+val.t}if(v!==undefined){row[hdr[C]]=raw?v:format_cell(val,v);isempty=false}}if(isempty===false||header===1)out[outi++]=row}out.length=outi;return out}function sheet_to_row_object_array(sheet,opts){return sheet_to_json(sheet,opts!=null?opts:{})}function sheet_to_csv(sheet,opts){var out="",txt="",qreg=/"/g;var o=opts==null?{}:opts;if(sheet==null||sheet["!ref"]==null)return"";var r=safe_decode_range(sheet["!ref"]);var FS=o.FS!==undefined?o.FS:",",fs=FS.charCodeAt(0);var RS=o.RS!==undefined?o.RS:"\n",rs=RS.charCodeAt(0);var row="",rr="",cols=[];var i=0,cc=0,val;var R=0,C=0;for(C=r.s.c;C<=r.e.c;++C)cols[C]=encode_col(C);for(R=r.s.r;R<=r.e.r;++R){row="";rr=encode_row(R);for(C=r.s.c;C<=r.e.c;++C){val=sheet[cols[C]+rr];txt=val!==undefined?""+format_cell(val):"";for(i=0,cc=0;i!==txt.length;++i)if((cc=txt.charCodeAt(i))===fs||cc===rs||cc===34){txt='"'+txt.replace(qreg,'""')+'"';break}row+=(C===r.s.c?"":FS)+txt}out+=row+RS}return out}var make_csv=sheet_to_csv;function sheet_to_formulae(sheet){var cmds,y="",x,val="";if(sheet==null||sheet["!ref"]==null)return"";var r=safe_decode_range(sheet["!ref"]),rr="",cols=[],C;cmds=new Array((r.e.r-r.s.r+1)*(r.e.c-r.s.c+1));var i=0;for(C=r.s.c;C<=r.e.c;++C)cols[C]=encode_col(C);for(var R=r.s.r;R<=r.e.r;++R){rr=encode_row(R);for(C=r.s.c;C<=r.e.c;++C){y=cols[C]+rr;x=sheet[y];val="";if(x===undefined)continue;if(x.f!=null)val=x.f;else if(x.w!==undefined)val="'"+x.w;else if(x.v===undefined)continue;else val=""+x.v;cmds[i++]=y+"="+val}}cmds.length=i;return cmds}var utils={encode_col:encode_col,encode_row:encode_row,encode_cell:encode_cell,encode_range:encode_range,decode_col:decode_col,decode_row:decode_row,split_cell:split_cell,decode_cell:decode_cell,decode_range:decode_range,format_cell:format_cell,get_formulae:sheet_to_formulae,make_csv:sheet_to_csv,make_json:sheet_to_json,make_formulae:sheet_to_formulae,sheet_to_csv:sheet_to_csv,sheet_to_json:sheet_to_json,sheet_to_formulae:sheet_to_formulae,sheet_to_row_object_array:sheet_to_row_object_array};var XmlNode=function(){function XmlNode(tagName,attributes,children){if(!(this instanceof XmlNode)){return new XmlNode(tagName,attributes,children)}this.tagName=tagName;this._attributes=attributes||{};this._children=children||[];this._prefix="";return this}XmlNode.prototype.createElement=function(){return new XmlNode(arguments)};XmlNode.prototype.children=function(){return this._children};XmlNode.prototype.append=function(node){this._children.push(node);return this};XmlNode.prototype.prefix=function(prefix){if(arguments.length==0){return this._prefix}this._prefix=prefix;return this};XmlNode.prototype.attr=function(attr,value){if(value==undefined){delete this._attributes[attr];return this}if(arguments.length==0){return this._attributes}else if(typeof attr=="string"&&arguments.length==1){return this._attributes.attr[attr]}if(typeof attr=="object"&&arguments.length==1){for(var key in attr){this._attributes[key]=attr[key]}}else if(arguments.length==2&&typeof attr=="string"){this._attributes[attr]=value}return this};var APOS="'";QUOTE='"';var ESCAPED_QUOTE={};ESCAPED_QUOTE[QUOTE]=""";ESCAPED_QUOTE[APOS]="'";XmlNode.prototype.escapeAttributeValue=function(att_value){return'"'+att_value.replace(/\"/g,""")+'"'};XmlNode.prototype.toXml=function(node){if(!node)node=this;var xml=node._prefix;xml+="<"+node.tagName;if(node._attributes){for(var key in node._attributes){xml+=" "+key+"="+this.escapeAttributeValue(""+node._attributes[key])+""}}if(node._children&&node._children.length>0){xml+=">";for(var i=0;i<node._children.length;i++){xml+=this.toXml(node._children[i])}xml+="</"+node.tagName+">"}else{xml+="/>"}return xml};return XmlNode}();var StyleBuilder=function(options){var customNumFmtId=164;var table_fmt={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'};var fmt_table={};for(var idx in table_fmt){fmt_table[table_fmt[idx]]=idx}_hashIndex={};_listIndex=[];return{initialize:function(options){this.$fonts=XmlNode("fonts").attr("count",0).attr("x14ac:knownFonts","1");this.$fills=XmlNode("fills").attr("count",0);this.$borders=XmlNode("borders").attr("count",0);this.$numFmts=XmlNode("numFmts").attr("count",0);this.$cellStyleXfs=XmlNode("cellStyleXfs");this.$xf=XmlNode("xf").attr("numFmtId",0).attr("fontId",0).attr("fillId",0).attr("borderId",0);this.$cellXfs=XmlNode("cellXfs").attr("count",0);this.$cellStyles=XmlNode("cellStyles").append(XmlNode("cellStyle").attr("name","Normal").attr("xfId",0).attr("builtinId",0));this.$dxfs=XmlNode("dxfs").attr("count","0");this.$tableStyles=XmlNode("tableStyles").attr("count","0").attr("defaultTableStyle","TableStyleMedium9").attr("defaultPivotStyle","PivotStyleMedium4");this.$styles=XmlNode("styleSheet").attr("xmlns:mc","http://schemas.openxmlformats.org/markup-compatibility/2006").attr("xmlns:x14ac","http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac").attr("xmlns","http://schemas.openxmlformats.org/spreadsheetml/2006/main").attr("mc:Ignorable","x14ac").prefix('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>').append(this.$numFmts).append(this.$fonts).append(this.$fills).append(this.$borders).append(this.$cellStyleXfs.append(this.$xf)).append(this.$cellXfs).append(this.$cellStyles).append(this.$dxfs).append(this.$tableStyles);var defaultStyle=options.defaultCellStyle||{};if(!defaultStyle.font)defaultStyle.font={name:"Calibri",sz:"12"};if(!defaultStyle.font.name)defaultStyle.font.name="Calibri";if(!defaultStyle.font.sz)defaultStyle.font.sz=11;if(!defaultStyle.fill)defaultStyle.fill={patternType:"none",fgColor:{}};if(!defaultStyle.border)defaultStyle.border={};if(!defaultStyle.numFmt)defaultStyle.numFmt=0;this.defaultStyle=defaultStyle;var gray125Style=JSON.parse(JSON.stringify(defaultStyle));gray125Style.fill={patternType:"gray125",fgColor:{}};this.addStyles([defaultStyle,gray125Style]);return this},addStyle:function(attributes){var hashKey=JSON.stringify(attributes);var index=_hashIndex[hashKey];if(index==undefined){index=this._addXf(attributes);_hashIndex[hashKey]=index}else{index=_hashIndex[hashKey]}return index},addStyles:function(styles){var self=this;return styles.map(function(style){return self.addStyle(style)})},_duckTypeStyle:function(attributes){if(typeof attributes=="object"&&(attributes.patternFill||attributes.fgColor)){return{fill:attributes}}else if(attributes.font||attributes.numFmt||attributes.border||attributes.fill){return attributes}else{return this._getStyleCSS(attributes)}},_getStyleCSS:function(css){return css},_addXf:function(attributes){var fontId=this._addFont(attributes.font);var fillId=this._addFill(attributes.fill);var borderId=this._addBorder(attributes.border);var numFmtId=this._addNumFmt(attributes.numFmt);var $xf=XmlNode("xf").attr("numFmtId",numFmtId).attr("fontId",fontId).attr("fillId",fillId).attr("borderId",borderId).attr("xfId","0");if(fontId>0){$xf.attr("applyFont","1")}if(fillId>0){$xf.attr("applyFill","1")}if(borderId>0){$xf.attr("applyBorder","1")}if(numFmtId>0){$xf.attr("applyNumberFormat","1")}if(attributes.alignment){var $alignment=XmlNode("alignment");if(attributes.alignment.horizontal){$alignment.attr("horizontal",attributes.alignment.horizontal)}if(attributes.alignment.vertical){$alignment.attr("vertical",attributes.alignment.vertical)}if(attributes.alignment.indent){$alignment.attr("indent",attributes.alignment.indent)}if(attributes.alignment.readingOrder){$alignment.attr("readingOrder",attributes.alignment.readingOrder)}if(attributes.alignment.wrapText){$alignment.attr("wrapText",attributes.alignment.wrapText)}if(attributes.alignment.textRotation!=undefined){$alignment.attr("textRotation",attributes.alignment.textRotation);+ }$xf.append($alignment).attr("applyAlignment",1)}this.$cellXfs.append($xf);var count=+this.$cellXfs.children().length;this.$cellXfs.attr("count",count);return count-1},_addFont:function(attributes){if(!attributes){return 0}var $font=XmlNode("font").append(XmlNode("sz").attr("val",attributes.sz||this.defaultStyle.font.sz)).append(XmlNode("name").attr("val",attributes.name||this.defaultStyle.font.name));if(attributes.bold)$font.append(XmlNode("b"));if(attributes.underline)$font.append(XmlNode("u"));if(attributes.italic)$font.append(XmlNode("i"));if(attributes.strike)$font.append(XmlNode("strike"));if(attributes.outline)$font.append(XmlNode("outline"));if(attributes.shadow)$font.append(XmlNode("shadow"));if(attributes.vertAlign){$font.append(XmlNode("vertAlign").attr("val",attributes.vertAlign))}if(attributes.color){if(attributes.color.theme){$font.append(XmlNode("color").attr("theme",attributes.color.theme));if(attributes.color.tint){$font.append(XmlNode("tint").attr("theme",attributes.color.tint))}}else if(attributes.color.rgb){$font.append(XmlNode("color").attr("rgb",attributes.color.rgb))}}this.$fonts.append($font);var count=this.$fonts.children().length;this.$fonts.attr("count",count);return count-1},_addNumFmt:function(numFmt){if(!numFmt){return 0}if(typeof numFmt=="string"){var numFmtIdx=fmt_table[numFmt];if(numFmtIdx>=0){return numFmtIdx}}if(/^[0-9]+$/.exec(numFmt)){return numFmt}numFmt=numFmt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var $numFmt=XmlNode("numFmt").attr("numFmtId",++customNumFmtId).attr("formatCode",numFmt);this.$numFmts.append($numFmt);var count=this.$numFmts.children().length;this.$numFmts.attr("count",count);return customNumFmtId},_addFill:function(attributes){if(!attributes){return 0}var $patternFill=XmlNode("patternFill").attr("patternType",attributes.patternType||"solid");if(attributes.fgColor){var $fgColor=XmlNode("fgColor");if(attributes.fgColor.rgb){if(attributes.fgColor.rgb.length==6){attributes.fgColor.rgb="FF"+attributes.fgColor.rgb}$fgColor.attr("rgb",attributes.fgColor.rgb);$patternFill.append($fgColor)}else if(attributes.fgColor.theme){$fgColor.attr("theme",attributes.fgColor.theme);if(attributes.fgColor.tint){$fgColor.attr("tint",attributes.fgColor.tint)}$patternFill.append($fgColor)}if(!attributes.bgColor){attributes.bgColor={indexed:"64"}}}if(attributes.bgColor){var $bgColor=XmlNode("bgColor").attr(attributes.bgColor);$patternFill.append($bgColor)}var $fill=XmlNode("fill").append($patternFill);this.$fills.append($fill);var count=this.$fills.children().length;this.$fills.attr("count",count);return count-1},_getSubBorder:function(direction,spec){var $direction=XmlNode(direction);if(spec){if(spec.style)$direction.attr("style",spec.style);if(spec.color){var $color=XmlNode("color");if(spec.color.auto){$color.attr("auto",spec.color.auto)}else if(spec.color.rgb){$color.attr("rgb",spec.color.rgb)}else if(spec.color.theme||spec.color.tint){$color.attr("theme",spec.color.theme||"1");$color.attr("tint",spec.color.tint||"0")}$direction.append($color)}}return $direction},_addBorder:function(attributes){if(!attributes){return 0}var self=this;var $border=XmlNode("border").attr("diagonalUp",attributes.diagonalUp).attr("diagonalDown",attributes.diagonalDown);var directions=["left","right","top","bottom","diagonal"];directions.forEach(function(direction){$border.append(self._getSubBorder(direction,attributes[direction]))});this.$borders.append($border);var count=this.$borders.children().length;this.$borders.attr("count",count);return count-1},toXml:function(){return this.$styles.toXml()}}.initialize(options||{})};XLSX.parse_xlscfb=parse_xlscfb;XLSX.parse_zip=parse_zip;XLSX.read=readSync;XLSX.readFile=readFileSync;XLSX.readFileSync=readFileSync;XLSX.write=writeSync;XLSX.writeFile=writeFileSync;XLSX.writeFileSync=writeFileSync;XLSX.utils=utils;XLSX.CFB=CFB;XLSX.SSF=SSF})(typeof exports!=="undefined"?exports:XLSX);var XLS=XLSX;diff --git a/resources/views/accessories/index.blade.php b/resources/views/accessories/index.blade.phpindex be1378156e..c8d6cee05a 100755--- a/resources/views/accessories/index.blade.php+++ b/resources/views/accessories/index.blade.php@@ -40,9 +40,9 @@@section('moar_scripts')@include ('partials.bootstrap-table', [- 'exportFile' => 'accessories-export','search' => true,'showFooter' => true,- 'columns' => \App\Presenters\AccessoryPresenter::dataTableLayout()+ 'columns' => \App\Presenters\AccessoryPresenter::dataTableLayout(),+ 'exportFile' => 'accessories-export',])@stopdiff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.phpindex 198729e47a..e08a63c074 100755--- a/resources/views/licenses/view.blade.php+++ b/resources/views/licenses/view.blade.php@@ -42,15 +42,16 @@<div class="table-responsive"><table- name="licenseSeats"+ name="license-seats"class="table table-striped snipe-table"id="licenseSeats"+ data-id-table="licenseSeats"data-search="false"- data-url="{{route('api.license.seats',['licence_id' => $license->id]) }}"- data-export-options='{"fileName": "asset-assets"}'+ data-url="{{ route('api.license.seats',['licence_id' => $license->id]) }}"+ data-export="true"+ data-export-options="{'fileName': 'license-seats'}"data-cookie="true"- data-show-footer="true"- data-cookie-id-table="licenseSeats">+ data-cookie-id-table="licenseSeats-Table"><thead><tr><th class="col-md-1" data-field="name">{{ trans('admin/licenses/general.seat') }}</th>@@ -80,7 +81,7 @@@if ($license->manufacturer)<tr>- <td>{{ trans('admin/hardware/form.manufacturer') }}</td>+ <td>{{ trans('admin/hardware/form.manufacturer') }}:</td><td><p style="line-height: 23px;">@can('view', \App\Models\Manufacturer::class)<a href="{{ route('manufacturers.show', $license->manufacturer->id) }}">@@ -115,7 +116,7 @@@if (!is_null($license->serial))<tr>- <td>{{ trans('admin/licenses/form.license_key') }}</td>+ <td>{{ trans('admin/licenses/form.license_key') }}: </td><td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">@can('viewKeys', $license){!! nl2br(e($license->serial)) !!}@@ -128,16 +129,16 @@@endif- @if (!is_null($license->license_name))+ @if ($license->license_name!='')<tr>- <td>{{ trans('admin/licenses/form.to_name') }}</td>+ <td>{{ trans('admin/licenses/form.to_name') }}: </td><td>{{ $license->license_name }}</td></tr>@endif- @if (!is_null($license->license_email))+ @if ($license->license_email!='')<tr>- <td>{{ trans('admin/licenses/form.to_email') }}</td>+ <td>{{ trans('admin/licenses/form.to_email') }}:</td><td>{{ $license->license_email }}</td></tr>@endifdiff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex 8c5ece9be1..5fff0b538e 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -1,15 +1,16 @@-{{-- This Will load our default bootstrap-table settings on any table with a class of "snipe-table" and export it to the passed 'exportFile' name --}}-<script src="{{ asset('js/bootstrap-table.js') }}"></script>+<script src="{{ asset('js/bootstrap-table.min.js') }}"></script><script src="{{ asset('js/extensions/mobile/bootstrap-table-mobile.js') }}"></script><script src="{{ asset('js/extensions/cookie/bootstrap-table-cookie.min.js?v=1') }}"></script>--@if (!isset($simple_view))<script src="{{ asset('js/extensions/export/bootstrap-table-export.js?v=1') }}"></script>-<script src="{{ asset('js/extensions/export/tableExport.js') }}"></script>+<script src="{{ asset('js/extensions/export/jquery.base64.js') }}"></script><script src="{{ asset('js/FileSaver.min.js') }}"></script>+<script src="{{ asset('js/xlsx.core.min.js') }}"></script><script src="{{ asset('js/jspdf.min.js') }}"></script><script src="{{ asset('js/jspdf.plugin.autotable.js') }}"></script>-<script src="{{ asset('js/extensions/export/jquery.base64.js') }}"></script>+<script src="{{ asset('js/extensions/export/tableExport.min.js') }}"></script>+++@if (!isset($simple_view))<script src="{{ asset('js/extensions/toolbar/bootstrap-table-toolbar.js') }}"></script><script src="{{ asset('js/extensions/sticky-header/bootstrap-table-sticky-header.js') }}"></script>@endif@@ -17,6 +18,9 @@<script nonce="{{ csrf_token() }}">var $table = $('.snipe-table');+++$(function () {buildTable($table, 20, 50);});@@ -34,6 +38,12 @@$('.snipe-table').bootstrapTable('destroy').bootstrapTable({classes: 'table table-responsive table-no-bordered',++ ajaxOptions: {+ headers: {+ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')+ }+ },undefinedText: '',iconsPrefix: 'fa',search: {{ (isset($search)) ? 'true' : 'false' }},@@ -69,10 +79,32 @@@endifrefresh: 'fa-refresh'},- @if (!isset($simple_view))+ showExport: true,+ exportDataType: 'all',+ exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],+ exportOptions: {++ fileName: '{{ ((isset($exportFile)) ? $exportFile : 'table') }}-' + (new Date()).toISOString().slice(0,10),+ ignoreColumn: ['actions','image','change','checkbox','checkincheckout','icon'],+ worksheetName: "Snipe-IT Export",+ escape: false,+ jspdf: {+ orientation: 'l',+ autotable: {+ styles: {+ rowHeight: 20,+ fontSize: 10,+ overflow: 'linebreak',+ },+ headerStyles: {fillColor: 255, textColor: 0},+ //alternateRowStyles: {fillColor: [60, 69, 79], textColor: 255}+ }+ }+ },++ @if (!isset($simple_view))showRefresh: true,- showExport: true,stickyHeader: true,stickyHeaderOffsetY: stickyHeaderOffsetY + 'px',@@ -87,28 +119,8 @@showMultiSort: true,@endif- @if (isset($exportFile))- exportDataType: 'all',- exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],- exportOptions: {-- fileName: '{{ $exportFile . "-" }}' + (new Date()).toISOString().slice(0,10),- ignoreColumn: ['actions','change','checkbox','checkincheckout','icon'],- worksheetName: "Snipe-IT Export",- jspdf: {- orientation: 'l',- autotable: {- styles: {- rowHeight: 20,- fontSize: 10,- overflow: 'linebreak',- },- headerStyles: {fillColor: 255, textColor: 0},- //alternateRowStyles: {fillColor: [60, 69, 79], textColor: 255}- }- }- },- @endif++@endifpageList: ['20', '30','50','100','150','200']