/*! For license information please see 1233.d864fe1e.bundle.js.LICENSE.txt */ (self.webpackChunkamis_rpc_design=self.webpackChunkamis_rpc_design||[]).push([[1233],{31233:(t,e,r)=>{t.exports=function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,r,n)}return r[a].exports}for(var o=void 0,a=0;a2&&void 0!==arguments[2]?arguments[2]:0;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r)if("string"==typeof r){var o=i.decodeAddress(r);this.nativeCol=o.col+n,this.nativeColOff=0,this.nativeRow=o.row+n,this.nativeRowOff=0}else void 0!==r.nativeCol?(this.nativeCol=r.nativeCol||0,this.nativeColOff=r.nativeColOff||0,this.nativeRow=r.nativeRow||0,this.nativeRowOff=r.nativeRowOff||0):void 0!==r.col?(this.col=r.col+n,this.row=r.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0;this.worksheet=e}var e,r,o;return e=t,o=[{key:"asInstance",value:function(e){return e instanceof t||null==e?e:new t(e)}}],(r=[{key:"col",get:function(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth},set:function(t){this.nativeCol=Math.floor(t),this.nativeColOff=Math.floor((t-this.nativeCol)*this.colWidth)}},{key:"row",get:function(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight},set:function(t){this.nativeRow=Math.floor(t),this.nativeRowOff=Math.floor((t-this.nativeRow)*this.rowHeight)}},{key:"colWidth",get:function(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}},{key:"rowHeight",get:function(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}},{key:"model",get:function(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}},set:function(t){this.nativeCol=t.nativeCol,this.nativeColOff=t.nativeColOff,this.nativeRow=t.nativeRow,this.nativeRowOff=t.nativeRowOff}}])&&n(e.prototype,r),o&&n(e,o),t}();e.exports=o},{"../utils/col-cache":19}],3:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r0||this.type===t.Types.Merge}},{key:"master",get:function(){return this.type===t.Types.Merge?this._value.master:this}},{key:"isHyperlink",get:function(){return this._value.type===t.Types.Hyperlink}},{key:"hyperlink",get:function(){return this._value.hyperlink}},{key:"value",get:function(){return this._value.value},set:function(e){this.type!==t.Types.Merge?(this._value.release(),this._value=S.create(S.getType(e),this,e)):this._value.master.value=e}},{key:"note",get:function(){return this._comment&&this._comment.note},set:function(t){this._comment=new f(t)}},{key:"text",get:function(){return this._value.toString()}},{key:"html",get:function(){return s.escapeHtml(this.text)}},{key:"formula",get:function(){return this._value.formula}},{key:"result",get:function(){return this._value.result}},{key:"formulaType",get:function(){return this._value.formulaType}},{key:"fullAddress",get:function(){return{sheetName:this._row.worksheet.name,address:this.address,row:this.row,col:this.col}}},{key:"name",get:function(){return this.names[0]},set:function(t){this.names=[t]}},{key:"names",get:function(){return this.workbook.definedNames.getNamesEx(this.fullAddress)},set:function(t){var e=this,r=this.workbook.definedNames;r.removeAllNames(this.fullAddress),t.forEach((function(t){r.addEx(e.fullAddress,t)}))}},{key:"_dataValidations",get:function(){return this.worksheet.dataValidations}},{key:"dataValidation",get:function(){return this._dataValidations.find(this.address)},set:function(t){this._dataValidations.add(this.address,t)}},{key:"model",get:function(){var t=this._value.model;return t.style=this.style,this._comment&&(t.comment=this._comment.model),t},set:function(t){this._value.release(),this._value=S.create(t.type,this),this._value.model=t,t.comment&&"note"===t.comment.type&&(this._comment=f.fromModel(t.comment)),t.style?this.style=t.style:this.style={}}}]),t}();l.Types=u.ValueType;var h=function(){function t(e){n(this,t),this.model={address:e.address,type:l.Types.Null}}return o(t,[{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){}},{key:"toString",value:function(){return""}},{key:"value",get:function(){return null},set:function(t){}},{key:"type",get:function(){return l.Types.Null}},{key:"effectiveType",get:function(){return l.Types.Null}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),d=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.Number,value:r}}return o(t,[{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.Number}},{key:"effectiveType",get:function(){return l.Types.Number}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),p=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.String,value:r}}return o(t,[{key:"toCsvString",value:function(){return'"'.concat(this.model.value.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.String}},{key:"effectiveType",get:function(){return l.Types.String}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),m=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.String,value:r}}return o(t,[{key:"toString",value:function(){return this.model.value.richText.map((function(t){return t.text})).join("")}},{key:"toCsvString",value:function(){return'"'.concat(this.text.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.RichText}},{key:"effectiveType",get:function(){return l.Types.RichText}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),y=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.Date,value:r}}return o(t,[{key:"toCsvString",value:function(){return this.model.value.toISOString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.Date}},{key:"effectiveType",get:function(){return l.Types.Date}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),b=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.Hyperlink,text:r?r.text:void 0,hyperlink:r?r.hyperlink:void 0},r&&r.tooltip&&(this.model.tooltip=r.tooltip)}return o(t,[{key:"toCsvString",value:function(){return this.model.hyperlink}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.text}},{key:"value",get:function(){var t={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(t.tooltip=this.model.tooltip),t},set:function(t){this.model={text:t.text,hyperlink:t.hyperlink},t.tooltip&&(this.model.tooltip=t.tooltip)}},{key:"text",get:function(){return this.model.text},set:function(t){this.model.text=t}},{key:"hyperlink",get:function(){return this.model.hyperlink},set:function(t){this.model.hyperlink=t}},{key:"type",get:function(){return l.Types.Hyperlink}},{key:"effectiveType",get:function(){return l.Types.Hyperlink}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),v=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.Merge,master:r?r.address:void 0},this._master=r,r&&r.addMergeRef()}return o(t,[{key:"isMergedTo",value:function(t){return t===this._master}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){this._master.releaseMergeRef()}},{key:"toString",value:function(){return this.value.toString()}},{key:"value",get:function(){return this._master.value},set:function(t){t instanceof l?(this._master&&this._master.releaseMergeRef(),t.addMergeRef(),this._master=t):this._master.value=t}},{key:"master",get:function(){return this._master}},{key:"type",get:function(){return l.Types.Merge}},{key:"effectiveType",get:function(){return this._master.effectiveType}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),g=function(){function t(e,r){n(this,t),this.cell=e,this.model={address:e.address,type:l.Types.Formula,shareType:r?r.shareType:void 0,ref:r?r.ref:void 0,formula:r?r.formula:void 0,sharedFormula:r?r.sharedFormula:void 0,result:r?r.result:void 0}}return o(t,[{key:"_copyModel",value:function(t){var e={},r=function(r){var n=t[r];n&&(e[r]=n)};return r("formula"),r("result"),r("ref"),r("shareType"),r("sharedFormula"),e}},{key:"validate",value:function(t){switch(S.getType(t)){case l.Types.Null:case l.Types.String:case l.Types.Number:case l.Types.Date:break;case l.Types.Hyperlink:case l.Types.Formula:default:throw new Error("Cannot process that type of result value")}}},{key:"_getTranslatedFormula",value:function(){if(!this._translatedFormula&&this.model.sharedFormula){var t=this.cell.worksheet.findCell(this.model.sharedFormula);this._translatedFormula=t&&c(t.formula,t.address,this.model.address)}return this._translatedFormula}},{key:"toCsvString",value:function(){return"".concat(this.model.result||"")}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.result?this.model.result.toString():""}},{key:"value",get:function(){return this._copyModel(this.model)},set:function(t){this.model=this._copyModel(t)}},{key:"dependencies",get:function(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}},{key:"formula",get:function(){return this.model.formula||this._getTranslatedFormula()},set:function(t){this.model.formula=t}},{key:"formulaType",get:function(){return this.model.formula?u.FormulaType.Master:this.model.sharedFormula?u.FormulaType.Shared:u.FormulaType.None}},{key:"result",get:function(){return this.model.result},set:function(t){this.model.result=t}},{key:"type",get:function(){return l.Types.Formula}},{key:"effectiveType",get:function(){var t=this.model.result;return null==t?u.ValueType.Null:t instanceof String||"string"==typeof t?u.ValueType.String:"number"==typeof t?u.ValueType.Number:t instanceof Date?u.ValueType.Date:t.text&&t.hyperlink?u.ValueType.Hyperlink:t.formula?u.ValueType.Formula:u.ValueType.Null}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),w=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.SharedString,value:r}}return o(t,[{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.SharedString}},{key:"effectiveType",get:function(){return l.Types.SharedString}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),_=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.Boolean,value:r}}return o(t,[{key:"toCsvString",value:function(){return this.model.value?1:0}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.Boolean}},{key:"effectiveType",get:function(){return l.Types.Boolean}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),k=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.Error,value:r}}return o(t,[{key:"toCsvString",value:function(){return this.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.error.toString()}},{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return l.Types.Error}},{key:"effectiveType",get:function(){return l.Types.Error}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),x=function(){function t(e,r){n(this,t),this.model={address:e.address,type:l.Types.String,value:JSON.stringify(r),rawValue:r}}return o(t,[{key:"toCsvString",value:function(){return this.model.value}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}},{key:"value",get:function(){return this.model.rawValue},set:function(t){this.model.rawValue=t,this.model.value=JSON.stringify(t)}},{key:"type",get:function(){return l.Types.String}},{key:"effectiveType",get:function(){return l.Types.String}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}}]),t}(),S={getType:function(t){return null==t?l.Types.Null:t instanceof String||"string"==typeof t?l.Types.String:"number"==typeof t?l.Types.Number:"boolean"==typeof t?l.Types.Boolean:t instanceof Date?l.Types.Date:t.text&&t.hyperlink?l.Types.Hyperlink:t.formula||t.sharedFormula?l.Types.Formula:t.richText?l.Types.RichText:t.sharedString?l.Types.SharedString:t.error?l.Types.Error:l.Types.JSON},types:[{t:l.Types.Null,f:h},{t:l.Types.Number,f:d},{t:l.Types.String,f:p},{t:l.Types.Date,f:y},{t:l.Types.Hyperlink,f:b},{t:l.Types.Formula,f:g},{t:l.Types.Merge,f:v},{t:l.Types.JSON,f:x},{t:l.Types.SharedString,f:w},{t:l.Types.RichText,f:m},{t:l.Types.Boolean,f:_},{t:l.Types.Error,f:k}].reduce((function(t,e){return t[e.t]=e.f,t}),[]),create:function(t,e,r){var n=this.types[t];if(!n)throw new Error("Could not create Value of type ".concat(t));return new n(e,r)}};e.exports=l},{"../utils/col-cache":19,"../utils/shared-formula":22,"../utils/under-dash":25,"./enums":7,"./note":9}],4:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r=this._worksheet.properties.outlineLevelCol)}},{key:"isDefault",get:function(){if(this.isCustomWidth)return!1;if(this.hidden)return!1;if(this.outlineLevel)return!1;var t=this.style;return!t||!(t.font||t.numFmt||t.alignment||t.border||t.fill||t.protection)}},{key:"headerCount",get:function(){return this.headers.length}},{key:"values",get:function(){var t=[];return this.eachCell((function(e,r){e&&e.type!==o.ValueType.Null&&(t[r]=e.value)})),t},set:function(t){var e=this;if(t){var r=this.number,n=0;t.hasOwnProperty("0")&&(n=1),t.forEach((function(t,i){e._worksheet.getCell(i+n,r).value=t}))}}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(t){this._applyStyle("numFmt",t)}},{key:"font",get:function(){return this.style.font},set:function(t){this._applyStyle("font",t)}},{key:"alignment",get:function(){return this.style.alignment},set:function(t){this._applyStyle("alignment",t)}},{key:"protection",get:function(){return this.style.protection},set:function(t){this._applyStyle("protection",t)}},{key:"border",get:function(){return this.style.border},set:function(t){this._applyStyle("border",t)}},{key:"fill",get:function(){return this.style.fill},set:function(t){this._applyStyle("fill",t)}}])&&n(e.prototype,r),s&&n(e,s),t}();e.exports=s},{"../utils/col-cache":19,"../utils/under-dash":25,"./enums":7}],5:[function(t,e,r){"use strict";function n(t,e){for(var r=0;rthis.bottom)&&(this.bottom=r),(!this.model.right||n>this.right)&&(this.right=n)}},{key:"expandRow",value:function(t){if(t){var e=t.dimensions,r=t.number;e&&this.expand(r,e.min,r,e.max)}}},{key:"expandToAddress",value:function(t){var e=i.decodeEx(t);this.expand(e.row,e.col,e.row,e.col)}},{key:"toString",value:function(){return this.range}},{key:"intersects",value:function(t){return!(t.sheetName&&this.sheetName&&t.sheetName!==this.sheetName||t.bottomthis.bottom||t.rightthis.right)}},{key:"contains",value:function(t){var e=i.decodeEx(t);return this.containsEx(e)}},{key:"containsEx",value:function(t){return(!t.sheetName||!this.sheetName||t.sheetName===this.sheetName)&&t.row>=this.top&&t.row<=this.bottom&&t.col>=this.left&&t.col<=this.right}},{key:"forEachAddress",value:function(t){for(var e=this.left;e<=this.right;e++)for(var r=this.top;r<=this.bottom;r++)t(i.encodeAddress(r,e),r,e)}},{key:"top",get:function(){return this.model.top||1},set:function(t){this.model.top=t}},{key:"left",get:function(){return this.model.left||1},set:function(t){this.model.left=t}},{key:"bottom",get:function(){return this.model.bottom||1},set:function(t){this.model.bottom=t}},{key:"right",get:function(){return this.model.right||1},set:function(t){this.model.right=t}},{key:"sheetName",get:function(){return this.model.sheetName},set:function(t){this.model.sheetName=t}},{key:"_serialisedSheetName",get:function(){var t=this.model.sheetName;return t?/^[a-zA-Z0-9]*$/.test(t)?"".concat(t,"!"):"'".concat(t,"'!"):""}},{key:"tl",get:function(){return i.n2l(this.left)+this.top}},{key:"$t$l",get:function(){return"$".concat(i.n2l(this.left),"$").concat(this.top)}},{key:"br",get:function(){return i.n2l(this.right)+this.bottom}},{key:"$b$r",get:function(){return"$".concat(i.n2l(this.right),"$").concat(this.bottom)}},{key:"range",get:function(){return"".concat(this._serialisedSheetName+this.tl,":").concat(this.br)}},{key:"$range",get:function(){return"".concat(this._serialisedSheetName+this.$t$l,":").concat(this.$b$r)}},{key:"shortRange",get:function(){return this.count>1?this.range:this._serialisedSheetName+this.tl}},{key:"$shortRange",get:function(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}},{key:"count",get:function(){return(1+this.bottom-this.top)*(1+this.right-this.left)}}])&&n(e.prototype,r),t}();e.exports=o},{"../utils/col-cache":19}],11:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r2?n-2:0),o=2;o0)for(a=f;a>=r;a--)(s=this._cells[a-1])?((u=this.getCell(a+c)).value=s.value,u.style=s.style,u._comment=s._comment):this._cells[a+c-1]=void 0;for(a=0;ar.col)&&(t=r.col),e0?{min:t,max:e}:null}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(t){this._applyStyle("numFmt",t)}},{key:"font",get:function(){return this.style.font},set:function(t){this._applyStyle("font",t)}},{key:"alignment",get:function(){return this.style.alignment},set:function(t){this._applyStyle("alignment",t)}},{key:"protection",get:function(){return this.style.protection},set:function(t){this._applyStyle("protection",t)}},{key:"border",get:function(){return this.style.border},set:function(t){this._applyStyle("border",t)}},{key:"fill",get:function(){return this.style.fill},set:function(t){this._applyStyle("fill",t)}},{key:"hidden",get:function(){return!!this._hidden},set:function(t){this._hidden=t}},{key:"outlineLevel",get:function(){return this._outlineLevel||0},set:function(t){this._outlineLevel=t}},{key:"collapsed",get:function(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}},{key:"model",get:function(){var t=[],e=0,r=0;return this._cells.forEach((function(n){if(n){var i=n.model;i&&((!e||e>n.col)&&(e=n.col),r0,"Table must be on valid row"),n(s>0,"Table must be on valid col");var u=this.width,c=this.filterHeight,f=this.tableHeight;e.autoFilterRef=a.encode(o,s,o+c-1,s+u-1),e.tableRef=a.encode(o,s,o+f-1,s+u-1),e.columns.forEach((function(e,i){n(e.name,"Column ".concat(i," must have a name")),0===i?r(e,"totalsRowLabel","Total"):(r(e,"totalsRowFunction","none"),e.totalsRowFormula=t.getFormula(e))}))}},{key:"store",value:function(){var t=this,e=function(t,e){e&&Object.keys(e).forEach((function(r){t[r]=e[r]}))},r=this.worksheet,n=this.table,i=n.tl,o=i.row,a=i.col,s=0;if(n.headerRow){var u=r.getRow(o+s++);n.columns.forEach((function(t,r){var n=t.style,i=t.name,o=u.getCell(a+r);o.value=i,e(o,n)}))}if(n.rows.forEach((function(t){var i=r.getRow(o+s++);t.forEach((function(t,r){var o=i.getCell(a+r);o.value=t,e(o,n.columns[r].style)}))})),n.totalsRow){var c=r.getRow(o+s++);n.columns.forEach((function(r,n){var i=c.getCell(a+n);if(0===n)i.value=r.totalsRowLabel;else{var o=t.getFormula(r);i.value=o?{formula:r.totalsRowFormula,result:r.totalsRowResult}:null}e(i,r.style)}))}}},{key:"load",value:function(t){var e=this,r=this.table,n=r.tl,i=n.row,o=n.col,a=0;if(r.headerRow){var s=t.getRow(i+a++);r.columns.forEach((function(t,e){s.getCell(o+e).value=t.name}))}if(r.rows.forEach((function(e){var r=t.getRow(i+a++);e.forEach((function(t,e){r.getCell(o+e).value=t}))})),r.totalsRow){var u=t.getRow(i+a++);r.columns.forEach((function(t,r){var n=u.getCell(o+r);0===r?n.value=t.totalsRowLabel:e.getFormula(t)&&(n.value={formula:t.totalsRowFormula,result:t.totalsRowResult})}))}}},{key:"cacheState",value:function(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}},{key:"commit",value:function(){if(this._cache){this.validate();var t=a.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:1;this.cacheState(),this.table.rows.splice(t,e)}},{key:"getColumn",value:function(t){var e=this.table.columns[t];return new s(this,e,t)}},{key:"addColumn",value:function(t,e,r){this.cacheState(),void 0===r?(this.table.columns.push(t),this.table.rows.forEach((function(t,r){t.push(e[r])}))):(this.table.columns.splice(r,0,t),this.table.rows.forEach((function(t,n){t.splice(r,0,e[n])})))}},{key:"removeColumns",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cacheState(),this.table.columns.splice(t,e),this.table.rows.forEach((function(r){r.splice(t,e)}))}},{key:"_assign",value:function(t,e,r){this.cacheState(),t[e]=r}},{key:"width",get:function(){return this.table.columns.length}},{key:"height",get:function(){return this.table.rows.length}},{key:"filterHeight",get:function(){return this.height+(this.table.headerRow?1:0)}},{key:"tableHeight",get:function(){return this.filterHeight+(this.table.totalsRow?1:0)}},{key:"model",get:function(){return this.table},set:function(t){this.table=t}},{key:"ref",get:function(){return this.table.ref},set:function(t){this._assign(this.table,"ref",t)}},{key:"name",get:function(){return this.table.name},set:function(t){this.table.name=t}},{key:"displayName",get:function(){return this.table.displyName||this.table.name}},{key:"displayNamename",set:function(t){this.table.displayName=t}},{key:"headerRow",get:function(){return this.table.headerRow},set:function(t){this._assign(this.table,"headerRow",t)}},{key:"totalsRow",get:function(){return this.table.totalsRow},set:function(t){this._assign(this.table,"totalsRow",t)}},{key:"theme",get:function(){return this.table.style.name},set:function(t){this.table.style.name=t}},{key:"showFirstColumn",get:function(){return this.table.style.showFirstColumn},set:function(t){this.table.style.showFirstColumn=t}},{key:"showLastColumn",get:function(){return this.table.style.showLastColumn},set:function(t){this.table.style.showLastColumn=t}},{key:"showRowStripes",get:function(){return this.table.style.showRowStripes},set:function(t){this.table.style.showRowStripes=t}},{key:"showColumnStripes",get:function(){return this.table.style.showColumnStripes},set:function(t){this.table.style.showColumnStripes=t}}]),t}();e.exports=u},{"../utils/col-cache":19}],13:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r31&&console.warn("Worksheet name ".concat(t," exceeds 31 chars. This will be truncated")),/[*?:/\\[\]]/.test(t))throw new Error("Worksheet name ".concat(t," cannot include any of the following characters: * ? : \\ / [ ]"));if(/(^')|('$)/.test(t))throw new Error("The first or last character of worksheet name cannot be a single quotation mark: ".concat(t));if(t=(t||"sheet".concat(r)).substring(0,31),this._worksheets.find((function(e){return e&&e.name.toLowerCase()===t.toLowerCase()})))throw new Error("Worksheet name already exists: ".concat(t));e&&("string"==typeof e?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),e={properties:{tabColor:{argb:e}}}):(e.argb||e.theme||e.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),e={properties:{tabColor:e}}));var n=this._worksheets.reduce((function(t,e){return(e&&e.orderNo)>t?e.orderNo:t}),0),o=Object.assign({},e,{id:r,name:t,orderNo:n+1,workbook:this}),a=new i(o);return this._worksheets[r]=a,a}},{key:"removeWorksheetEx",value:function(t){delete this._worksheets[t.id]}},{key:"removeWorksheet",value:function(t){var e=this.getWorksheet(t);e&&e.destroy()}},{key:"getWorksheet",value:function(t){return void 0===t?this._worksheets.find(Boolean):"number"==typeof t?this._worksheets[t]:"string"==typeof t?this._worksheets.find((function(e){return e&&e.name===t})):void 0}},{key:"eachSheet",value:function(t){this.worksheets.forEach((function(e){t(e,e.id)}))}},{key:"clearThemes",value:function(){this._themes=void 0}},{key:"addImage",value:function(t){var e=this.media.length;return this.media.push(Object.assign({},t,{type:"image"})),e}},{key:"getImage",value:function(t){return this.media[t]}},{key:"xlsx",get:function(){return this._xlsx||(this._xlsx=new a(this)),this._xlsx}},{key:"csv",get:function(){return this._csv||(this._csv=new s(this)),this._csv}},{key:"nextId",get:function(){for(var t=1;tt.length)&&(e=t.length);for(var r=0,n=new Array(e);rthis._columns.length)for(var r=this._columns.length+1;r<=t;)this._columns.push(new d(this,r++));return this._columns[t-1]}},{key:"spliceColumns",value:function(t,e){for(var r=this,n=this._rows.length,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a0)for(var s=function(n){var i=[t,e];o.forEach((function(t){i.push(t[n]||null)}));var a=r.getRow(n+1);a.splice.apply(a,i)},u=0;u0)for(var d=l;d>=f;d--)this.getColumn(d+c).defn=this.getColumn(d).defn;for(var p=t;p1&&void 0!==arguments[1]?arguments[1]:"n",r=this._nextRow,n=this.getRow(r);return n.values=t,this._setStyleOption(r,"i"===e[0]?e:"n"),n}},{key:"addRows",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"n",n=[];return t.forEach((function(t){n.push(e.addRow(t,r))})),n}},{key:"insertRow",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"n";return this.spliceRows(t,0,e),this._setStyleOption(t,r),this.getRow(t)}},{key:"insertRows",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"n";if(this.spliceRows.apply(this,[t,0].concat(a(e))),"n"!==r)for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"n";"o"===e[0]&&void 0!==this.findRow(t+1)?this._copyStyle(t+1,t,"+"===e[1]):"i"===e[0]&&void 0!==this.findRow(t-1)&&this._copyStyle(t-1,t,"+"===e[1])}},{key:"_copyStyle",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.getRow(t),o=this.getRow(e);o.style=Object.freeze(i({},n.style)),n.eachCell({includeEmpty:r},(function(t,e){o.getCell(e).style=Object.freeze(i({},t.style))})),o.height=n.height}},{key:"duplicateRow",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this._rows[t-1],o=new Array(e).fill(i.values);this.spliceRows.apply(this,[t+1,n?0:e].concat(a(o)));for(var s=function(e){var n=r._rows[t+e];n.style=i.style,n.height=i.height,i.eachCell({includeEmpty:!0},(function(t,e){n.getCell(e).style=t.style}))},u=0;u2?i-2:0),a=2;a0)for(s=l;s>=n;s--)(u=this._rows[s-1])?function(){var t=r.getRow(s+f);t.values=u.values,t.style=u.style,t.height=u.height,u.eachCell({includeEmpty:!0},(function(e,n){if(t.getCell(n).style=e.style,"MergeValue"===e._value.constructor.name){var i=r.getRow(e._row._number+c).getCell(n),o=e._value._master,a=r.getRow(o._row._number+c).getCell(o._column._number);i.merge(a)}}))}():this._rows[s+f-1]=void 0;for(s=0;st.top||i>t.left)&&this.getCell(n,i).merge(r,e);this._merges[r.address]=t}},{key:"_unMergeMaster",value:function(t){var e=this._merges[t.address];if(e){for(var r=e.top;r<=e.bottom;r++)for(var n=e.left;n<=e.right;n++)this.getCell(r,n).unmerge();delete this._merges[t.address]}}},{key:"unMergeCells",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r3&&void 0!==arguments[3]?arguments[3]:"shared",o=f.decode(t),a=o.top,s=o.left,u=o.bottom,c=o.right,l=c-s+1,h=f.encodeAddress(a,s),d="shared"===i;n="function"==typeof r?r:Array.isArray(r)?Array.isArray(r[0])?function(t,e){return r[t-a][e-s]}:function(t,e){return r[(t-a)*l+(e-s)]}:function(){};for(var p=!0,m=a;m<=u;m++)for(var y=s;y<=c;y++)p?(this.getCell(m,y).value={shareType:i,formula:e,ref:t,result:n(m,y)},p=!1):this.getCell(m,y).value=d?{sharedFormula:h,result:n(m,y)}:n(m,y)}},{key:"addImage",value:function(t,e){var r={type:"image",imageId:t,range:e};this._media.push(new m(this,r))}},{key:"getImages",value:function(){return this._media.filter((function(t){return"image"===t.type}))}},{key:"addBackgroundImage",value:function(t){var e={type:"background",imageId:t};this._media.push(new m(this,e))}},{key:"getBackgroundImageId",value:function(){var t=this._media.find((function(t){return"background"===t.type}));return t&&t.imageId}},{key:"protect",value:function(t,e){var r=this;return new Promise((function(n){r.sheetProtection={sheet:!0},e&&"spinCount"in e&&(e.spinCount=Number.isFinite(e.spinCount)?Math.round(Math.max(0,e.spinCount)):1e5),t&&(r.sheetProtection.algorithmName="SHA-512",r.sheetProtection.saltValue=v.randomBytes(16).toString("base64"),r.sheetProtection.spinCount=e&&"spinCount"in e?e.spinCount:1e5,r.sheetProtection.hashValue=v.convertPasswordToHash(t,"SHA512",r.sheetProtection.saltValue,r.sheetProtection.spinCount)),e&&(r.sheetProtection=Object.assign(r.sheetProtection,e),!t&&"spinCount"in e&&delete r.sheetProtection.spinCount),n()}))}},{key:"unprotect",value:function(){this.sheetProtection=null}},{key:"addTable",value:function(t){var e=new y(this,t);return this.tables[t.name]=e,e}},{key:"getTable",value:function(t){return this.tables[t]}},{key:"removeTable",value:function(t){delete this.tables[t]}},{key:"getTables",value:function(){return Object.values(this.tables)}},{key:"addConditionalFormatting",value:function(t){this.conditionalFormattings.push(t)}},{key:"removeConditionalFormatting",value:function(t){"number"==typeof t?this.conditionalFormattings.splice(t,1):this.conditionalFormattings=t instanceof Function?this.conditionalFormattings.filter(t):[]}},{key:"_parseRows",value:function(t){var e=this;this._rows=[],t.rows.forEach((function(t){var r=new h(e,t.number);e._rows[r.number-1]=r,r.model=t}))}},{key:"_parseMergeCells",value:function(t){var e=this;c.each(t.mergeCells,(function(t){e.mergeCellsWithoutStyle(t)}))}},{key:"workbook",get:function(){return this._workbook}},{key:"dimensions",get:function(){var t=new l;return this._rows.forEach((function(e){if(e){var r=e.dimensions;r&&t.expand(e.number,r.min,e.number,r.max)}})),t}},{key:"columns",get:function(){return this._columns},set:function(t){var e=this;this._headerRowCount=t.reduce((function(t,e){var r=(e.header?1:e.headers&&e.headers.length)||0;return Math.max(t,r)}),0);var r=1,n=this._columns=[];t.forEach((function(t){var i=new d(e,r++,!1);n.push(i),i.defn=t}))}},{key:"lastColumn",get:function(){return this.getColumn(this.columnCount)}},{key:"columnCount",get:function(){var t=0;return this.eachRow((function(e){t=Math.max(t,e.cellCount)})),t}},{key:"actualColumnCount",get:function(){var t=[],e=0;return this.eachRow((function(r){r.eachCell((function(r){var n=r.col;t[n]||(t[n]=!0,e++)}))})),e}},{key:"_lastRowNumber",get:function(){for(var t=this._rows,e=t.length;e>0&&void 0===t[e-1];)e--;return e}},{key:"_nextRow",get:function(){return this._lastRowNumber+1}},{key:"lastRow",get:function(){if(this._rows.length)return this._rows[this._rows.length-1]}},{key:"rowCount",get:function(){return this._lastRowNumber}},{key:"actualRowCount",get:function(){var t=0;return this.eachRow((function(){t++})),t}},{key:"hasMerges",get:function(){return c.some(this._merges,Boolean)}},{key:"tabColor",get:function(){return console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor},set:function(t){console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor=t}},{key:"model",get:function(){var t={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map((function(t){return t.model})),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map((function(t){return t.model})),conditionalFormattings:this.conditionalFormattings};t.cols=d.toModel(this.columns);var e=t.rows=[],r=t.dimensions=new l;return this._rows.forEach((function(t){var n=t&&t.model;n&&(r.expand(n.number,n.min,n.number,n.max),e.push(n))})),t.merges=[],c.each(this._merges,(function(e){t.merges.push(e.range)})),t},set:function(t){var e=this;this.name=t.name,this._columns=d.fromModel(this,t.cols),this._parseRows(t),this._parseMergeCells(t),this.dataValidations=new b(t.dataValidations),this.properties=t.properties,this.pageSetup=t.pageSetup,this.headerFooter=t.headerFooter,this.views=t.views,this.autoFilter=t.autoFilter,this._media=t.media.map((function(t){return new m(e,t)})),this.sheetProtection=t.sheetProtection,this.tables=t.tables.reduce((function(t,e){var r=new y;return r.model=e,t[e.name]=r,t}),{}),this.conditionalFormattings=t.conditionalFormattings}}])&&u(e.prototype,r),t}();e.exports=g},{"../utils/col-cache":19,"../utils/encryptor":20,"../utils/under-dash":25,"./column":4,"./data-validations":5,"./enums":7,"./image":8,"./range":10,"./row":11,"./table":12}],15:[function(t,e,r){"use strict";t("core-js/modules/es.promise"),t("core-js/modules/es.object.assign"),t("core-js/modules/es.object.keys"),t("core-js/modules/es.object.values"),t("core-js/modules/es.symbol"),t("core-js/modules/es.symbol.async-iterator"),t("core-js/modules/es.array.iterator"),t("core-js/modules/es.array.includes"),t("core-js/modules/es.array.find-index"),t("core-js/modules/es.array.find"),t("core-js/modules/es.string.from-code-point"),t("core-js/modules/es.string.includes"),t("core-js/modules/es.number.is-nan"),t("regenerator-runtime/runtime");var n={Workbook:t("./doc/workbook")},i=t("./doc/enums");Object.keys(i).forEach((function(t){n[t]=i[t]})),e.exports=n},{"./doc/enums":7,"./doc/workbook":13,"core-js/modules/es.array.find":316,"core-js/modules/es.array.find-index":315,"core-js/modules/es.array.includes":317,"core-js/modules/es.array.iterator":318,"core-js/modules/es.number.is-nan":319,"core-js/modules/es.object.assign":320,"core-js/modules/es.object.keys":321,"core-js/modules/es.object.values":322,"core-js/modules/es.promise":323,"core-js/modules/es.string.from-code-point":324,"core-js/modules/es.string.includes":325,"core-js/modules/es.symbol":327,"core-js/modules/es.symbol.async-iterator":326,"regenerator-runtime/runtime":492}],16:[function(t,e,r){"use strict";var n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");r.bufferToString=function(t){return"string"==typeof t?t:n?n.decode(t):t.toString()}},{}],17:[function(t,e,r){"use strict";var n="undefined"==typeof TextEncoder?null:new TextEncoder("utf-8"),i=t("buffer").Buffer;r.stringToBuffer=function(t){return"string"!=typeof t?t:n?i.from(n.encode(t).buffer):i.from(t)}},{buffer:216}],18:[function(t,e,r){"use strict";function n(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=4)throw new Error("Out of bounds. Excel supports columns from 1 to 16384");if(this._l2nFill<1&&t>=1){for(;a<=26;)e=this._dictionary[a-1],this._n2l[a]=e,this._l2n[e]=a,a++;this._l2nFill=1}if(this._l2nFill<2&&t>=2){for(a=27;a<=702;)n=(r=a-27)%26,i=Math.floor(r/26),e=this._dictionary[i]+this._dictionary[n],this._n2l[a]=e,this._l2n[e]=a,a++;this._l2nFill=2}if(this._l2nFill<3&&t>=3){for(a=703;a<=16384;)n=(r=a-703)%26,i=Math.floor(r/26)%26,o=Math.floor(r/676),e=this._dictionary[o]+this._dictionary[i]+this._dictionary[n],this._n2l[a]=e,this._l2n[e]=a,a++;this._l2nFill=3}},l2n:function(t){if(this._l2n[t]||this._fill(t.length),!this._l2n[t])throw new Error("Out of bounds. Invalid column letter: ".concat(t));return this._l2n[t]},n2l:function(t){if(t<1||t>16384)throw new Error("".concat(t," is out of bounds. Excel supports columns from 1 to 16384"));return this._n2l[t]||this._fill(this._level(t)),this._n2l[t]},_hash:{},validateAddress:function(t){if(!s.test(t))throw new Error("Invalid Address: ".concat(t));return!0},decodeAddress:function(t){var e=t.length<5&&this._hash[t];if(e)return e;for(var r,n=!1,i="",o=0,a=!1,s="",u=0,c=0;c=65&&r<=90)n=!0,i+=t[c],o=26*o+r-64;else if(r>=48&&r<=57)a=!0,s+=t[c],u=10*u+r-48;else if(a&&n&&36!==r)break;if(n){if(o>16384)throw new Error("Out of bounds. Invalid column letter: ".concat(i))}else o=void 0;a||(u=void 0);var f={address:t=i+s,col:o,row:u,$col$row:"$".concat(i,"$").concat(s)};return o<=100&&u<=100&&(this._hash[t]=f,this._hash[f.$col$row]=f),f},getAddress:function(t,e){if(e){var r=this.n2l(e)+t;return this.decodeAddress(r)}return this.decodeAddress(t)},decode:function(t){var e=t.split(":");if(2===e.length){var r=this.decodeAddress(e[0]),n=this.decodeAddress(e[1]),i={top:Math.min(r.row,n.row),left:Math.min(r.col,n.col),bottom:Math.max(r.row,n.row),right:Math.max(r.col,n.col)};return i.tl=this.n2l(i.left)+i.top,i.br=this.n2l(i.right)+i.bottom,i.dimensions="".concat(i.tl,":").concat(i.br),i}return this.decodeAddress(t)},decodeEx:function(t){var e=t.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),r=e[1]||e[2],n=e[3],i=n.split(":");if(i.length>1){var s=this.decodeAddress(i[0]),u=this.decodeAddress(i[1]),c=Math.min(s.row,u.row),f=Math.min(s.col,u.col),l=Math.max(s.row,u.row),h=Math.max(s.col,u.col);return s=this.n2l(f)+c,u=this.n2l(h)+l,{top:c,left:f,bottom:l,right:h,sheetName:r,tl:{address:s,col:f,row:c,$col$row:"$".concat(this.n2l(f),"$").concat(c),sheetName:r},br:{address:u,col:h,row:l,$col$row:"$".concat(this.n2l(h),"$").concat(l),sheetName:r},dimensions:"".concat(s,":").concat(u)}}if(n.startsWith("#"))return r?{sheetName:r,error:n}:{error:n};var d=this.decodeAddress(n);return r?function(t){for(var e=1;e=i&&c<=a&&f>=o&&f<=s}};e.exports=u},{}],20:[function(t,e,r){(function(r){"use strict";var n=t("crypto"),i={hash:function(t){for(var e=n.createHash(t),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a3||3===l.length&&l>"XFD")return t;var p=n.l2n(l),m=parseInt(d,10);return f||(p+=s.col-a.col),h||(m+=s.row-a.row),(e||"")+(f||"")+n.n2l(p)+(h||"")+m}return t}))}}},{"./col-cache":19}],23:[function(t,e,r){(function(r,n){"use strict";function i(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function s(t){i(a,n,o,s,u,"next",t)}function u(t){i(a,n,o,s,u,"throw",t)}s(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var r=0;r=this.length?(e=this.toBuffer(),this.iRead=this.iWrite,e):(e=n.alloc(t),this.buffer.copy(e,0,this.iRead,t),this.iRead+=t,e)}},{key:"write",value:function(t,e,r){var n=Math.min(r,this.size-this.iWrite);return t.copy(this.buffer,this.iWrite,e,e+n),this.iWrite+=n,n}},{key:"length",get:function(){return this.iWrite-this.iRead}},{key:"eod",get:function(){return this.iRead===this.iWrite}},{key:"full",get:function(){return this.iWrite===this.size}}]),t}(),y=function(t){t=t||{},this.bufSize=t.bufSize||1048576,this.buffers=[],this.batch=t.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};f.inherits(y,c.Duplex,{toBuffer:function(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return n.concat(this.buffers.map((function(t){return t.toBuffer()})))}},_getWritableBuffer:function(){if(this.buffers.length){var t=this.buffers[this.buffers.length-1];if(!t.full)return t}var e=new m(this.bufSize);return this.buffers.push(e),e},_pipe:function(t){var e=this;return o(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=function(e){return new Promise((function(r){e.write(t.toBuffer(),(function(){r()}))}))},r.next=3,Promise.all(e.pipes.map(n));case 3:case"end":return r.stop()}}),r)})))()},_writeToBuffers:function(t){for(var e=0,r=t.length;e1;)a._pipe(a.buffers.shift());o.next=29;break;case 21:if(a.corked){o.next=27;break}return o.next=24,a._pipe(s);case 24:i(),o.next=29;break;case 27:a._writeToBuffers(s),r.nextTick(i);case 29:o.next=34;break;case 31:a.paused||a.emit("data",s.toBuffer()),a._writeToBuffers(s),a.emit("readable");case 34:return o.abrupt("return",!0);case 35:case"end":return o.stop()}}),o)})))()},cork:function(){this.corked=!0},_flush:function(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork:function(){this.corked=!1,this._flush()},end:function(t,e,r){var n=this,i=function(t){t?r(t):(n._flush(),n.pipes.forEach((function(t){t.end()})),n.emit("finish"))};t?this.write(t,e,i):i()},read:function(t){var e;if(t){for(e=[];t&&this.buffers.length&&!this.buffers[0].eod;){var r=this.buffers[0],i=r.read(t);t-=i.length,e.push(i),r.eod&&r.full&&this.buffers.shift()}return n.concat(e)}return e=this.buffers.map((function(t){return t.toBuffer()})).filter(Boolean),this.buffers=[],n.concat(e)},setEncoding:function(t){this.encoding=t},pause:function(){this.paused=!0},resume:function(){this.paused=!1},isPaused:function(){return!!this.paused},pipe:function(t){this.pipes.push(t),!this.paused&&this.buffers.length&&this.end()},unpipe:function(t){this.pipes=this.pipes.filter((function(e){return e!==t}))},unshift:function(){throw new Error("Not Implemented")},wrap:function(){throw new Error("Not Implemented")}}),e.exports=y}).call(this,t("_process"),t("buffer").Buffer)},{"./string-buf":24,"./utils":26,_process:467,buffer:216,"readable-stream":491}],24:[function(t,e,r){(function(t){"use strict";function r(t,e){for(var r=0;r=this._buf.length-4;)this._grow(this._inPos+t.length),e=this._inPos+this._buf.write(t,this._inPos,this._encoding);this._inPos=e}},{key:"addStringBuf",value:function(t){t.length&&(this._buffer=void 0,this.length+t.length>this.capacity&&this._grow(this.length+t.length),t._buf.copy(this._buf,this._inPos,0,t.length),this._inPos+=t.length)}},{key:"length",get:function(){return this._inPos}},{key:"capacity",get:function(){return this._buf.length}},{key:"buffer",get:function(){return this._buf}}])&&r(n.prototype,i),e}();e.exports=n}).call(this,t("buffer").Buffer)},{buffer:216}],25:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=Object.prototype.toString,o=/["&<>]/,a={each:function(t,e){t&&(Array.isArray(t)?t.forEach(e):Object.keys(t).forEach((function(r){e(t[r],r)})))},some:function(t,e){return!!t&&(Array.isArray(t)?t.some(e):Object.keys(t).some((function(r){return e(t[r],r)})))},every:function(t,e){return!t||(Array.isArray(t)?t.every(e):Object.keys(t).every((function(r){return e(t[r],r)})))},map:function(t,e){return t?Array.isArray(t)?t.map(e):Object.keys(t).map((function(r){return e(t[r],r)})):[]},keyBy:function(t,e){return t.reduce((function(t,r){return t[r[e]]=r,t}),{})},isEqual:function(t,e){var r=n(t),i=n(e),o=Array.isArray(t),s=Array.isArray(e);return r===i&&("object"===n(t)?o||s?!(!o||!s)&&t.length===e.length&&t.every((function(t,r){var n=e[r];return a.isEqual(t,n)})):a.every(t,(function(t,r){var n=e[r];return a.isEqual(t,n)})):t===e)},escapeHtml:function(t){var e=o.exec(t);if(!e)return t;for(var r="",n="",i=0,a=e.index;a":n=">";break;default:continue}i!==a&&(r+=t.substring(i,a)),i=a+1,r+=n}return i!==a?r+t.substring(i,a):r},strcmp:function(t,e){return te?1:0},isUndefined:function(t){return"[object Undefined]"===i.call(t)},isObject:function(t){return"[object Object]"===i.call(t)},deepMerge:function(){var t,e,r,n=arguments[0]||{},i=arguments.length;function o(i,o){t=n[o],r=Array.isArray(i),a.isObject(i)||r?(r?(r=!1,e=t&&Array.isArray(t)?t:[]):e=t&&a.isObject(t)?t:{},n[o]=a.deepMerge(e,i)):a.isUndefined(i)||(n[o]=i)}for(var s=0;s&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/,a={nop:function(){},promiseImmediate:function(t){return new Promise((function(e){r.setImmediate?n((function(){e(t)})):setTimeout((function(){e(t)}),1)}))},inherits:function(t,e,r,n){t.super_=e,n||(n=r,r=null),r&&Object.keys(r).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}));var i={constructor:{value:t,enumerable:!1,writable:!1,configurable:!0}};n&&Object.keys(n).forEach((function(t){i[t]=Object.getOwnPropertyDescriptor(n,t)})),t.prototype=Object.create(e.prototype,i)},dateToExcel:function(t,e){return 25569+t.getTime()/864e5-(e?1462:0)},excelToDate:function(t,e){var r=Math.round(24*(t-25569+(e?1462:0))*3600*1e3);return new Date(r)},parsePath:function(t){var e=t.lastIndexOf("/");return{path:t.substring(0,e),name:t.substring(e+1)}},getRelsPath:function(t){var e=a.parsePath(t);return"".concat(e.path,"/_rels/").concat(e.name,".rels")},xmlEncode:function(t){var e=o.exec(t);if(!e)return t;for(var r="",n="",i=0,a=e.index;a=11&&13!==s)){n="";break}continue}i!==a&&(r+=t.substring(i,a)),i=a+1,n&&(r+=n)}return i!==a?r+t.substring(i,a):r},xmlDecode:function(t){return t.replace(/&([a-z]*);/g,(function(t){switch(t){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case""":return'"';default:return t}}))},validInt:function(t){var e=parseInt(t,10);return Number.isNaN(e)?0:e},isDateFmt:function(t){return!!t&&null!==(t=(t=t.replace(/\[[^\]]*]/g,"")).replace(/"[^"]*"/g,"")).match(/[ymdhMsb]+/)},fs:{exists:function(t){return new Promise((function(e){i.access(t,i.constants.F_OK,(function(t){e(!t)}))}))}},toIsoDateString:function(t){return t.toIsoString().subsstr(0,10)}};e.exports=a}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{fs:215,timers:521}],27:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r\n")}},{key:"openNode",value:function(t,e){var r=this.tos,n=this._xml;r&&this.open&&n.push(">"),this._stack.push(t),n.push("<"),n.push(t),s(n,e),this.leaf=!0,this.open=!0}},{key:"addAttribute",value:function(t,e){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");void 0!==e&&a(this._xml,t,e)}},{key:"addAttributes",value:function(t){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");s(this._xml,t)}},{key:"writeText",value:function(t){var e=this._xml;this.open&&(e.push(">"),this.open=!1),this.leaf=!1,e.push(o.xmlEncode(t.toString()))}},{key:"writeXml",value:function(t){this.open&&(this._xml.push(">"),this.open=!1),this.leaf=!1,this._xml.push(t)}},{key:"closeNode",value:function(){var t=this._stack.pop(),e=this._xml;this.leaf?e.push("/>"):(e.push("")),this.open=!1,this.leaf=!1}},{key:"leafNode",value:function(t,e,r){this.openNode(t,e),void 0!==r&&this.writeText(r),this.closeNode()}},{key:"closeAll",value:function(){for(;this._stack.length;)this.closeNode()}},{key:"addRollback",value:function(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}},{key:"commit",value:function(){this._rollbacks.pop()}},{key:"rollback",value:function(){var t=this._rollbacks.pop();this._xml.length>t.xml&&this._xml.splice(t.xml,this._xml.length-t.xml),this._stack.length>t.stack&&this._stack.splice(t.stack,this._stack.length-t.stack),this.leaf=t.leaf,this.open=t.open}},{key:"tos",get:function(){return this._stack.length?this._stack[this._stack.length-1]:void 0}},{key:"cursor",get:function(){return this._xml.length}},{key:"xml",get:function(){return this.closeAll(),this._xml.join("")}}])&&n(e.prototype,r),t}();u.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"},e.exports=u},{"./under-dash":25,"./utils":26}],28:[function(t,e,r){(function(r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function o(t,e){for(var r=0;r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r2&&void 0!==arguments[2]&&arguments[2];if(void 0===t){if(r)return e}else if(r||t!==e)return t.toString()}},{key:"toStringAttribute",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.toAttribute(e,r,n)}},{key:"toStringValue",value:function(t,e){return void 0===t?e:t}},{key:"toBoolAttribute",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(void 0===t){if(r)return e}else if(r||t!==e)return t?"1":"0"}},{key:"toBoolValue",value:function(t,e){return void 0===t?e:"1"===t}},{key:"toIntAttribute",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.toAttribute(e,r,n)}},{key:"toIntValue",value:function(t,e){return void 0===t?e:parseInt(t,10)}},{key:"toFloatAttribute",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.toAttribute(e,r,n)}},{key:"toFloatValue",value:function(t,e){return void 0===t?e:parseFloat(t)}}],r&&s(e.prototype,r),i&&s(e,i),t}();e.exports=l},{"../../utils/parse-sax":21,"../../utils/xml-stream":27}],32:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;rthis.maxItems))throw new Error("Max ".concat(this.childXform.tag," count (").concat(this.maxItems,") exceeded"));return!0}return!1}},{key:"reconcile",value:function(t,e){if(t){var r=this.childXform;t.forEach((function(t){r.reconcile(t,e)}))}}}])&&i(e.prototype,r),s}(t("./base-xform"));e.exports=c},{"./base-xform":31}],71:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0");case"containsErrors":return"ISERROR(".concat(e,")");case"notContainsErrors":return"NOT(ISERROR(".concat(e,"))");default:return}}(e);r&&this.formulaXform.render(t,r),t.closeNode()}},{key:"renderTimePeriod",value:function(t,e){t.openNode(this.tag,{type:"timePeriod",dxfId:e.dxfId,priority:e.priority,timePeriod:e.timePeriod});var r=function(t){if(t.formulae&&t.formulae[0])return t.formulae[0];var e=new d(t.ref).tl;switch(t.timePeriod){case"thisWeek":return"AND(TODAY()-ROUNDDOWN(".concat(e,",0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(").concat(e,",0)-TODAY()<=7-WEEKDAY(TODAY()))");case"lastWeek":return"AND(TODAY()-ROUNDDOWN(".concat(e,",0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(").concat(e,",0)<(WEEKDAY(TODAY())+7))");case"nextWeek":return"AND(ROUNDDOWN(".concat(e,",0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(").concat(e,",0)-TODAY()<(15-WEEKDAY(TODAY())))");case"yesterday":return"FLOOR(".concat(e,",1)=TODAY()-1");case"today":return"FLOOR(".concat(e,",1)=TODAY()");case"tomorrow":return"FLOOR(".concat(e,",1)=TODAY()+1");case"last7Days":return"AND(TODAY()-FLOOR(".concat(e,",1)<=6,FLOOR(").concat(e,",1)<=TODAY())");case"lastMonth":return"AND(MONTH(".concat(e,")=MONTH(EDATE(TODAY(),0-1)),YEAR(").concat(e,")=YEAR(EDATE(TODAY(),0-1)))");case"thisMonth":return"AND(MONTH(".concat(e,")=MONTH(TODAY()),YEAR(").concat(e,")=YEAR(TODAY()))");case"nextMonth":return"AND(MONTH(".concat(e,")=MONTH(EDATE(TODAY(),0+1)),YEAR(").concat(e,")=YEAR(EDATE(TODAY(),0+1)))");default:return}}(e);r&&this.formulaXform.render(t,r),t.closeNode()}},{key:"createNewModel",value:function(t){var e=t.attributes;return o(o({},function(t){var e=t.type,r=t.operator;switch(e){case"containsText":case"containsBlanks":case"notContainsBlanks":case"containsErrors":case"notContainsErrors":return{type:"containsText",operator:e};default:return{type:e,operator:r}}}(e)),{},{dxfId:l.toIntValue(e.dxfId),priority:l.toIntValue(e.priority),timePeriod:e.timePeriod,percent:l.toBoolValue(e.percent),bottom:l.toBoolValue(e.bottom),rank:l.toIntValue(e.rank),aboveAverage:l.toBoolValue(e.aboveAverage)})}},{key:"onParserClose",value:function(t,e){switch(t){case"dataBar":case"extLst":case"colorScale":case"iconSet":Object.assign(this.model,e.model);break;case"formula":this.model.formulae=this.model.formulae||[],this.model.formulae.push(e.model)}}},{key:"tag",get:function(){return"cfRule"}}])&&s(e.prototype,r),n&&s(e,n),a}(h);e.exports=w},{"../../../../doc/range":10,"../../base-xform":31,"../../composite-xform":47,"./color-scale-xform":84,"./databar-xform":87,"./ext-lst-ref-xform":88,"./formula-xform":89,"./icon-set-xform":90}],83:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1||s>1){var l=i.row+(o-1),d=i.col+(s-1);return f(f({},e.dataValidation),{},{sqref:"".concat(e.address,":").concat(p.encodeAddress(l,d))})}return f(f({},e.dataValidation),{},{sqref:e.address})}return null})).filter(Boolean)}(e);r.length&&(t.openNode("dataValidations",{count:r.length}),r.forEach((function(e){t.openNode("dataValidation"),"any"!==e.type&&(t.addAttribute("type",e.type),e.operator&&"list"!==e.type&&"between"!==e.operator&&t.addAttribute("operator",e.operator),e.allowBlank&&t.addAttribute("allowBlank","1")),e.showInputMessage&&t.addAttribute("showInputMessage","1"),e.promptTitle&&t.addAttribute("promptTitle",e.promptTitle),e.prompt&&t.addAttribute("prompt",e.prompt),e.showErrorMessage&&t.addAttribute("showErrorMessage","1"),e.errorStyle&&t.addAttribute("errorStyle",e.errorStyle),e.errorTitle&&t.addAttribute("errorTitle",e.errorTitle),e.error&&t.addAttribute("error",e.error),t.addAttribute("sqref",e.sqref),(e.formulae||[]).forEach((function(r,n){t.openNode("formula".concat(n+1)),"date"===e.type?t.writeText(d.dateToExcel(new Date(r))):t.writeText(r),t.closeNode()})),t.closeNode()})),t.closeNode())}},{key:"parseOpen",value:function(t){switch(t.name){case"dataValidations":return this.model={},!0;case"dataValidation":this._address=t.attributes.sqref;var e={type:t.attributes.type||"any",formulae:[]};switch(t.attributes.type&&v(e,t.attributes,"allowBlank"),v(e,t.attributes,"showInputMessage"),v(e,t.attributes,"showErrorMessage"),e.type){case"any":case"list":case"custom":break;default:b(e,t.attributes,"operator","between")}return b(e,t.attributes,"promptTitle"),b(e,t.attributes,"prompt"),b(e,t.attributes,"errorStyle"),b(e,t.attributes,"errorTitle"),b(e,t.attributes,"error"),this._dataValidation=e,!0;case"formula1":case"formula2":return this._formula=[],!0;default:return!1}}},{key:"parseText",value:function(t){this._formula&&this._formula.push(t)}},{key:"parseClose",value:function(t){var e=this;switch(t){case"dataValidations":return!1;case"dataValidation":return this._dataValidation.formulae&&this._dataValidation.formulae.length||(delete this._dataValidation.formulae,delete this._dataValidation.operator),(this._address.split(/\s+/g)||[]).forEach((function(t){t.includes(":")?new y(t).forEachAddress((function(t){e.model[t]=e._dataValidation})):e.model[t]=e._dataValidation})),!0;case"formula1":case"formula2":var r=this._formula.join("");switch(this._dataValidation.type){case"whole":case"textLength":r=parseInt(r,10);break;case"decimal":r=parseFloat(r);break;case"date":r=d.excelToDate(parseFloat(r))}return this._dataValidation.formulae.push(r),this._formula=void 0,!0;default:return!0}}},{key:"tag",get:function(){return"dataValidations"}}])&&i(e.prototype,r),s}(m);e.exports=g},{"../../../doc/range":10,"../../../utils/col-cache":19,"../../../utils/under-dash":25,"../../../utils/utils":26,"../base-xform":31}],93:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r0&&e.max>0&&e.min<=e.max&&t.addAttribute("spans","".concat(e.min,":").concat(e.max)),e.styleId&&(t.addAttribute("s",e.styleId),t.addAttribute("customFormat","1")),t.addAttribute("x14ac:dyDescent","0.25"),e.outlineLevel&&t.addAttribute("outlineLevel",e.outlineLevel),e.collapsed&&t.addAttribute("collapsed","1");var n=this.map.c;e.cells.forEach((function(e){n.render(t,e,r)})),t.closeNode()}},{key:"parseOpen",value:function(t){if(this.parser)return this.parser.parseOpen(t),!0;if("row"===t.name){this.numRowsSeen+=1;var e=t.attributes.spans?t.attributes.spans.split(":").map((function(t){return parseInt(t,10)})):[void 0,void 0],r=this.model={number:parseInt(t.attributes.r,10),min:e[0],max:e[1],cells:[]};return t.attributes.s&&(r.styleId=parseInt(t.attributes.s,10)),!0!==t.attributes.hidden&&"true"!==t.attributes.hidden&&1!==t.attributes.hidden&&"1"!==t.attributes.hidden||(r.hidden=!0),t.attributes.bestFit&&(r.bestFit=!0),t.attributes.ht&&(r.height=parseFloat(t.attributes.ht)),t.attributes.outlineLevel&&(r.outlineLevel=parseInt(t.attributes.outlineLevel,10)),t.attributes.collapsed&&(r.collapsed=!0),!0}return this.parser=this.map[t.name],!!this.parser&&(this.parser.parseOpen(t),!0)}},{key:"parseText",value:function(t){this.parser&&this.parser.parseText(t)}},{key:"parseClose",value:function(t){if(this.parser){if(!this.parser.parseClose(t)){if(this.model.cells.push(this.parser.model),this.maxItems&&this.model.cells.length>this.maxItems)throw new Error("Max column count (".concat(this.maxItems,") exceeded"));this.parser=void 0}return!0}return!1}},{key:"reconcile",value:function(t,e){t.style=t.styleId?e.styles.getStyleModel(t.styleId):{},void 0!==t.styleId&&(t.styleId=void 0);var r=this.map.c;t.cells.forEach((function(t){r.reconcile(t,e)}))}},{key:"tag",get:function(){return"row"}}])&&i(e.prototype,r),s}(c);e.exports=l},{"../base-xform":31,"./cell-xform":72}],109:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r0){var o={Id:i(n),Type:h.Comments,Target:"../comments".concat(t.id,".xml")};n.push(o);var a={Id:i(n),Type:h.VmlDrawing,Target:"../drawings/vmlDrawing".concat(t.id,".vml")};n.push(a),t.comments.forEach((function(t){t.refAddress=f.decodeAddress(t.ref)})),e.commentRefs.push({commentName:"comments".concat(t.id),vmlDrawing:"vmlDrawing".concat(t.id)})}var s,u=[];t.media.forEach((function(o){if("background"===o.type){var a=i(n);s=e.media[o.imageId],n.push({Id:a,Type:h.Image,Target:"../media/".concat(s.name,".").concat(s.extension)}),t.background={rId:a},t.image=e.media[o.imageId]}else if("image"===o.type){var c=t.drawing;s=e.media[o.imageId],c||(c=t.drawing={rId:i(n),name:"drawing".concat(++e.drawingsCount),anchors:[],rels:[]},e.drawings.push(c),n.push({Id:c.rId,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:"../drawings/".concat(c.name,".xml")}));var f=r.preImageId===o.imageId?u[o.imageId]:u[c.rels.length];f||(f=i(c.rels),u[c.rels.length]=f,c.rels.push({Id:f,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:"../media/".concat(s.name,".").concat(s.extension)}));var l={picture:{rId:f},range:o.range};if(o.hyperlinks&&o.hyperlinks.hyperlink){var d=i(c.rels);u[c.rels.length]=d,l.picture.hyperlinks={tooltip:o.hyperlinks.tooltip,rId:d},c.rels.push({Id:d,Type:h.Hyperlink,Target:o.hyperlinks.hyperlink,TargetMode:"External"})}r.preImageId=o.imageId,c.anchors.push(l)}})),t.tables.forEach((function(t){var r=i(n);t.rId=r,n.push({Id:r,Type:h.Table,Target:"../tables/".concat(t.target)}),t.columns.forEach((function(t){var r=t.style;r&&(t.dxfId=e.styles.addDxfStyle(r))}))})),this.map.extLst.prepare(t,e)}},{key:"render",value:function(t,e){t.openXml(l.StdDocAttributes),t.openNode("worksheet",s.WORKSHEET_ATTRIBUTES);var r=e.properties?{defaultRowHeight:e.properties.defaultRowHeight,dyDescent:e.properties.dyDescent,outlineLevelCol:e.properties.outlineLevelCol,outlineLevelRow:e.properties.outlineLevelRow}:void 0;e.properties&&e.properties.defaultColWidth&&(r.defaultColWidth=e.properties.defaultColWidth);var n={outlineProperties:e.properties&&e.properties.outlineProperties,tabColor:e.properties&&e.properties.tabColor,pageSetup:e.pageSetup&&e.pageSetup.fitToPage?{fitToPage:e.pageSetup.fitToPage}:void 0},i=e.pageSetup&&e.pageSetup.margins,o={showRowColHeaders:e.pageSetup&&e.pageSetup.showRowColHeaders,showGridLines:e.pageSetup&&e.pageSetup.showGridLines,horizontalCentered:e.pageSetup&&e.pageSetup.horizontalCentered,verticalCentered:e.pageSetup&&e.pageSetup.verticalCentered},a=e.sheetProtection;this.map.sheetPr.render(t,n),this.map.dimension.render(t,e.dimensions),this.map.sheetViews.render(t,e.views),this.map.sheetFormatPr.render(t,r),this.map.cols.render(t,e.cols),this.map.sheetData.render(t,e.rows),this.map.sheetProtection.render(t,a),this.map.autoFilter.render(t,e.autoFilter),this.map.mergeCells.render(t,e.mergeCells),this.map.conditionalFormatting.render(t,e.conditionalFormattings),this.map.dataValidations.render(t,e.dataValidations),this.map.hyperlinks.render(t,e.hyperlinks),this.map.printOptions.render(t,o),this.map.pageMargins.render(t,i),this.map.pageSetup.render(t,e.pageSetup),this.map.headerFooter.render(t,e.headerFooter),this.map.rowBreaks.render(t,e.rowBreaks),this.map.drawing.render(t,e.drawing),this.map.picture.render(t,e.background),this.map.tableParts.render(t,e.tables),this.map.extLst.render(t,e),e.rels&&e.rels.forEach((function(e){e.Type===h.VmlDrawing&&t.leafNode("legacyDrawing",{"r:id":e.Id})})),t.closeNode()}},{key:"parseOpen",value:function(t){return this.parser?(this.parser.parseOpen(t),!0):"worksheet"===t.name?(c.each(this.map,(function(t){t.reset()})),!0):(this.parser=this.map[t.name],this.parser&&this.parser.parseOpen(t),!0)}},{key:"parseText",value:function(t){this.parser&&this.parser.parseText(t)}},{key:"parseClose",value:function(t){if(this.parser)return this.parser.parseClose(t)||(this.parser=void 0),!0;if("worksheet"===t){var e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);var r={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(r,this.map.pageSetup.model,this.map.printOptions.model),i=function(t,e){if(!e||!e.length)return t;if(!t||!t.length)return e;var r={},n={};return t.forEach((function(t){r[t.ref]=t,t.rules.forEach((function(t){var e=t.x14Id;e&&(n[e]=t)}))})),e.forEach((function(e){e.rules.forEach((function(i){var o=n[i.x14Id];o?function(t,e){Object.keys(e).forEach((function(r){var n=t[r],i=e[r];void 0===n&&void 0!==i&&(t[r]=i)}))}(o,i):r[e.ref]?r[e.ref].rules.push(i):t.push({ref:e.ref,rules:[i]})}))})),t}(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model["x14:conditionalFormattings"]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:i},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}return!0}},{key:"reconcile",value:function(t,e){var r=(t.relationships||[]).reduce((function(r,n){if(r[n.Id]=n,n.Type===h.Comments&&(t.comments=e.comments[n.Target].comments),n.Type===h.VmlDrawing&&t.comments&&t.comments.length){var i=e.vmlDrawings[n.Target].comments;t.comments.forEach((function(t,e){t.note=Object.assign({},t.note,i[e])}))}return r}),{});if(e.commentsMap=(t.comments||[]).reduce((function(t,e){return e.ref&&(t[e.ref]=e),t}),{}),e.hyperlinkMap=(t.hyperlinks||[]).reduce((function(t,e){return e.rId&&(t[e.address]=r[e.rId].Target),t}),{}),e.formulae={},t.rows=t.rows&&t.rows.filter(Boolean)||[],t.rows.forEach((function(t){t.cells=t.cells&&t.cells.filter(Boolean)||[]})),this.map.cols.reconcile(t.cols,e),this.map.sheetData.reconcile(t.rows,e),this.map.conditionalFormatting.reconcile(t.conditionalFormattings,e),t.media=[],t.drawing){var n=r[t.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(n){var i=n[1];e.drawings[i].anchors.forEach((function(e){if(e.medium){var r={type:"image",imageId:e.medium.index,range:e.range,hyperlinks:e.picture.hyperlinks};t.media.push(r)}}))}}var o=t.background&&r[t.background.rId];if(o){var a=o.Target.split("/media/")[1],s=e.mediaIndex&&e.mediaIndex[a];void 0!==s&&t.media.push({type:"background",imageId:s})}t.tables=(t.tables||[]).map((function(t){var n=r[t.rId];return e.tables[n.Target]})),delete t.relationships,delete t.hyperlinks,delete t.comments}}])&&i(e.prototype,r),s}(p);B.WORKSHEET_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x14ac","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"},e.exports=B},{"../../../utils/col-cache":19,"../../../utils/under-dash":25,"../../../utils/xml-stream":27,"../../rel-type":30,"../base-xform":31,"../list-xform":70,"./auto-filter-xform":71,"./cf/conditional-formattings-xform":86,"./col-xform":91,"./data-validations-xform":92,"./dimension-xform":93,"./drawing-xform":94,"./ext-lst-xform":95,"./header-footer-xform":96,"./hyperlink-xform":97,"./merge-cell-xform":98,"./merges":99,"./page-margins-xform":102,"./page-setup-xform":104,"./picture-xform":105,"./print-options-xform":106,"./row-breaks-xform":107,"./row-xform":108,"./sheet-format-properties-xform":109,"./sheet-properties-xform":110,"./sheet-protection-xform":111,"./sheet-view-xform":112,"./table-part-xform":113}],115:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r=-90&&t<=90?t:void 0},indent:function(t){return t=f.validInt(t),Math.max(0,t)},readingOrder:function(t){switch(t){case"ltr":return c.ReadingOrder.LeftToRight;case"rtl":return c.ReadingOrder.RightToLeft;default:return}}},d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(s,t);var e,r,n=a(s);function s(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),n.apply(this,arguments)}return e=s,(r=[{key:"render",value:function(t,e){t.addRollback(),t.openNode("alignment");var r=!1;function n(e,n){n&&(t.addAttribute(e,n),r=!0)}n("horizontal",h.horizontal(e.horizontal)),n("vertical",h.vertical(e.vertical)),n("wrapText",!!h.wrapText(e.wrapText)&&"1"),n("shrinkToFit",!!h.shrinkToFit(e.shrinkToFit)&&"1"),n("indent",h.indent(e.indent)),n("textRotation",function(t){if(t=h.textRotation(t)){if("vertical"===t)return 255;var e=Math.round(t);if(e>=0&&e<=90)return e;if(e<0&&e>=-90)return 90-e}}(e.textRotation)),n("readingOrder",h.readingOrder(e.readingOrder)),t.closeNode(),r?t.commit():t.rollback()}},{key:"parseOpen",value:function(t){var e={},r=!1;function n(t,n,i){t&&(e[n]=i,r=!0)}n(t.attributes.horizontal,"horizontal",t.attributes.horizontal),n(t.attributes.vertical,"vertical","center"===t.attributes.vertical?"middle":t.attributes.vertical),n(t.attributes.wrapText,"wrapText",!!t.attributes.wrapText),n(t.attributes.shrinkToFit,"shrinkToFit",!!t.attributes.shrinkToFit),n(t.attributes.indent,"indent",parseInt(t.attributes.indent,10)),n(t.attributes.textRotation,"textRotation",function(t){var e=f.validInt(t);if(void 0!==e){if(255===e)return"vertical";if(e>=0&&e<=90)return e;if(e>90&&e<=180)return 90-e}}(t.attributes.textRotation)),n(t.attributes.readingOrder,"readingOrder","2"===t.attributes.readingOrder?"rtl":"ltr"),this.model=r?e:null}},{key:"parseText",value:function(){}},{key:"parseClose",value:function(){return!1}},{key:"tag",get:function(){return"alignment"}}])&&i(e.prototype,r),s}(l);e.exports=d},{"../../../doc/enums":7,"../../../utils/utils":26,"../base-xform":31}],126:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e=1)){t.next=6;break}return o=n.substr(i+1),a=n.substr(0,i),t.next=6,new Promise((function(t,i){var s=new h;s.on("finish",(function(){r.mediaIndex[n]=r.media.length,r.mediaIndex[a]=r.media.length;var e={type:"image",name:a,extension:o,buffer:s.toBuffer()};r.media.push(e),t()})),e.on("error",(function(t){i(t)})),e.pipe(s)}));case 6:case"end":return t.stop()}}),t)}))),function(t,e,r){return Z.apply(this,arguments)})},{key:"_processDrawingEntry",value:(K=o(regeneratorRuntime.mark((function t(e,r,n){var i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new S,t.next=3,i.parseStream(e);case 3:o=t.sent,r.drawings[n]=o;case 5:case"end":return t.stop()}}),t)}))),function(t,e,r){return K.apply(this,arguments)})},{key:"_processDrawingRelsEntry",value:(X=o(regeneratorRuntime.mark((function t(e,r,n){var i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new g,t.next=3,i.parseStream(e);case 3:o=t.sent,r.drawingRels[n]=o;case 5:case"end":return t.stop()}}),t)}))),function(t,e,r){return X.apply(this,arguments)})},{key:"_processVmlDrawingEntry",value:($=o(regeneratorRuntime.mark((function t(e,r,n){var i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new E,t.next=3,i.parseStream(e);case 3:o=t.sent,r.vmlDrawings["../drawings/".concat(n,".vml")]=o;case 5:case"end":return t.stop()}}),t)}))),function(t,e,r){return $.apply(this,arguments)})},{key:"_processThemeEntry",value:(W=o(regeneratorRuntime.mark((function t(e,r,n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=new h;e.on("error",i),o.on("error",i),o.on("finish",(function(){r.themes[n]=o.read().toString(),t()})),e.pipe(o)}));case 2:case"end":return t.stop()}}),t)}))),function(t,e,r){return W.apply(this,arguments)})},{key:"createInputStream",value:function(){throw new Error("`XLSX#createInputStream` is deprecated. You should use `XLSX#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}},{key:"read",value:(q=o(regeneratorRuntime.mark((function t(e,r){var i,o,a,u,c,l,h,d;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:!e[Symbol.asyncIterator]&&e.pipe&&(e=e.pipe(new f)),i=[],o=!0,a=!1,t.prev=4,c=s(e);case 6:return t.next=8,c.next();case 8:return l=t.sent,o=l.done,t.next=12,l.value;case 12:if(h=t.sent,o){t.next=19;break}d=h,i.push(d);case 16:o=!0,t.next=6;break;case 19:t.next=25;break;case 21:t.prev=21,t.t0=t.catch(4),a=!0,u=t.t0;case 25:if(t.prev=25,t.prev=26,o||null==c.return){t.next=30;break}return t.next=30,c.return();case 30:if(t.prev=30,!a){t.next=33;break}throw u;case 33:return t.finish(30);case 34:return t.finish(25);case 35:return t.abrupt("return",this.load(n.concat(i),r));case 36:case"end":return t.stop()}}),t,this,[[4,21,25,35],[26,,30,34]])}))),function(t,e){return q.apply(this,arguments)})},{key:"load",value:(V=o(regeneratorRuntime.mark((function t(e,i){var o,a,s,u,l,h,d,p,g,w,k,x,S,O,j,E;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i&&i.base64?n.from(e.toString(),"base64"):e,a={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{}},t.next=4,c.loadAsync(o);case 4:s=t.sent,u=0,l=Object.values(s.files);case 6:if(!(u0&&(r=new p,o.render(r,t),e.append(r.xml,{name:"xl/comments".concat(t.id,".xml")}),r=new p,a.render(r,t),e.append(r.xml,{name:"xl/drawings/vmlDrawing".concat(t.id,".vml")}))}));case 5:case"end":return t.stop()}}),t)}))),function(t,e){return M.apply(this,arguments)})},{key:"_finalize",value:function(t){var e=this;return new Promise((function(r,n){t.on("finish",(function(){r(e)})),t.on("error",n),t.finalize()}))}},{key:"prepareModel",value:function(t,e){t.creator=t.creator||"ExcelJS",t.lastModifiedBy=t.lastModifiedBy||"ExcelJS",t.created=t.created||new Date,t.modified=t.modified||new Date,t.useSharedStrings=void 0===e.useSharedStrings||e.useSharedStrings,t.useStyles=void 0===e.useStyles||e.useStyles,t.sharedStrings=new v,t.styles=t.useStyles?new y(!0):new y.Mock;var r=new k,n=new x;r.prepare(t);var i={sharedStrings:t.sharedStrings,styles:t.styles,date1904:t.properties.date1904,drawingsCount:0,media:t.media};i.drawings=t.drawings=[],i.commentRefs=t.commentRefs=[];var o=0;t.tables=[],t.worksheets.forEach((function(e){e.tables.forEach((function(e){o++,e.target="table".concat(o,".xml"),e.id=o,t.tables.push(e)})),n.prepare(e,i)}))}},{key:"write",value:(P=o(regeneratorRuntime.mark((function t(e,r){var n,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=r||{},n=this.workbook.model,(i=new l.ZipWriter(r.zip)).pipe(e),this.prepareModel(n,r),t.next=7,this.addContentTypes(i,n);case 7:return t.next=9,this.addOfficeRels(i,n);case 9:return t.next=11,this.addWorkbookRels(i,n);case 11:return t.next=13,this.addWorksheets(i,n);case 13:return t.next=15,this.addSharedStrings(i,n);case 15:return t.next=17,this.addDrawings(i,n);case 17:return t.next=19,this.addTables(i,n);case 19:return t.next=21,Promise.all([this.addThemes(i,n),this.addStyles(i,n)]);case 21:return t.next=23,this.addMedia(i,n);case 23:return t.next=25,Promise.all([this.addApp(i,n),this.addCore(i,n)]);case 25:return t.next=27,this.addWorkbook(i,n);case 27:return t.abrupt("return",this._finalize(i));case 28:case"end":return t.stop()}}),t,this)}))),function(t,e){return P.apply(this,arguments)})},{key:"writeFile",value:function(t,e){var r=this,n=u.createWriteStream(t);return new Promise((function(t,i){n.on("finish",(function(){t()})),n.on("error",(function(t){i(t)})),r.write(n,e).then((function(){n.end()}))}))}},{key:"writeBuffer",value:(C=o(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new h,t.next=3,this.write(r,e);case 3:return t.abrupt("return",r.read());case 4:case"end":return t.stop()}}),t,this)}))),function(t){return C.apply(this,arguments)})}])&&a(e.prototype,i),t}();C.RelType=t("./rel-type"),e.exports=C}).call(this,t("_process"),t("buffer").Buffer)},{"../utils/browser-buffer-decode":16,"../utils/stream-buf":23,"../utils/utils":26,"../utils/xml-stream":27,"../utils/zip-stream":28,"./rel-type":30,"./xform/book/workbook-xform":37,"./xform/comment/comments-xform":39,"./xform/comment/vml-notes-xform":44,"./xform/core/app-xform":50,"./xform/core/content-types-xform":51,"./xform/core/core-xform":52,"./xform/core/relationships-xform":54,"./xform/drawing/drawing-xform":61,"./xform/sheet/worksheet-xform":114,"./xform/strings/shared-strings-xform":123,"./xform/style/styles-xform":134,"./xform/table/table-xform":140,"./xml/theme1.js":142,_process:467,buffer:216,fs:215,jszip:399,"readable-stream":491}],142:[function(t,e,r){"use strict";e.exports='\n '},{}],143:[function(t,e,r){(function(e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.objectMode=!0,this.delimiter=",",this.rowDelimiter="\n",this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\ufeff",this.alwaysWriteHeaders=!1,Object.assign(this,r||{}),void 0===(null==r?void 0:r.quoteHeaders)&&(this.quoteHeaders=this.quoteColumns),!0===(null==r?void 0:r.quote)?this.quote='"':!1===(null==r?void 0:r.quote)&&(this.quote=""),"string"!=typeof(null==r?void 0:r.escape)&&(this.escape=this.quote),this.shouldWriteHeaders=!!this.headers&&(null===(e=r.writeHeaders)||void 0===e||e),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote="".concat(this.escape).concat(this.quote)}},{}],145:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{},i=[],o=new a.Writable({write:function(t,e,r){i.push(t),r()}});return new Promise((function(a,s){o.on("error",s).on("finish",(function(){return a(e.concat(i))})),r.write(t,n).pipe(o)}))},r.writeToString=function(t,e){return r.writeToBuffer(t,e).then((function(t){return t.toString()}))},r.writeToPath=function(t,e,n){var i=s.createWriteStream(t,{encoding:"utf8"});return r.write(e,n).pipe(i)}}).call(this,t("buffer").Buffer)},{"./CsvFormatterStream":143,"./FormatterOptions":144,"./types":149,buffer:216,fs:215,stream:506,util:525}],149:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isSyncTransform=void 0,r.isSyncTransform=function(t){return 1===t.length}},{}],150:[function(t,e,r){(function(e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r1?r-1:0),i=1;i=i||n.hasHitRowLimit)return r();if(n.parsedLineCount+=1,n.shouldSkipLine)return s();var u=t[a];n.rowCount+=1,n.parsedRowCount+=1;var c=n.rowCount;return n.transformRow(u,(function(t,e){if(t)return n.rowCount-=1,s(t);if(!e)return s(new Error("expected transform result"));if(e.isValid){if(e.row)return n.pushRow(e.row,s)}else n.emit("data-invalid",e.row,c,e.reason);return s()}))}(0)}},{key:"transformRow",value:function(t,e){var r=this;try{this.headerTransformer.transform(t,(function(n,i){return n?e(n):i?i.isValid?i.row?r.shouldEmitRows?r.rowTransformerValidator.transformAndValidate(i.row,e):r.skipRow(e):(r.rowCount-=1,r.parsedRowCount-=1,e(null,{row:null,isValid:!0})):r.shouldEmitRows?e(null,{isValid:!1,row:t}):r.skipRow(e):e(new Error("Expected result from header transform"))}))}catch(t){e(t)}}},{key:"checkAndEmitHeaders",value:function(){!this.headersEmitted&&this.headerTransformer.headers&&(this.headersEmitted=!0,this.emit("headers",this.headerTransformer.headers))}},{key:"skipRow",value:function(t){return this.rowCount-=1,t(null,{row:null,isValid:!0})}},{key:"pushRow",value:function(t,e){try{this.parserOptions.objectMode?this.push(t):this.push(JSON.stringify(t)),e()}catch(t){e(t)}}},{key:"hasHitRowLimit",get:function(){return this.parserOptions.limitRows&&this.rowCount>=this.parserOptions.maxRows}},{key:"shouldEmitRows",get:function(){return this.parsedRowCount>this.parserOptions.skipRows}},{key:"shouldSkipLine",get:function(){return this.parsedLineCount<=this.parserOptions.skipLines}}])&&i(r.prototype,n),l}(l.Transform);r.CsvParserStream=p}).call(this,t("timers").setImmediate)},{"./parser":162,"./transforms":165,stream:506,string_decoder:520,timers:521}],151:[function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.ParserOptions=void 0;var i=n(t("lodash.escaperegexp")),o=n(t("lodash.isnil"));r.ParserOptions=function t(e){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.objectMode=!0,this.delimiter=",",this.ignoreEmpty=!1,this.quote='"',this.escape=null,this.escapeChar=this.quote,this.comment=null,this.supportsComments=!1,this.ltrim=!1,this.rtrim=!1,this.trim=!1,this.headers=null,this.renameHeaders=!1,this.strictColumnHandling=!1,this.discardUnmappedColumns=!1,this.carriageReturn="\r",this.encoding="utf8",this.limitRows=!1,this.maxRows=0,this.skipLines=0,this.skipRows=0,Object.assign(this,e||{}),this.delimiter.length>1)throw new Error("delimiter option must be one character long");this.escapedDelimiter=i.default(this.delimiter),this.escapeChar=null!==(r=this.escape)&&void 0!==r?r:this.quote,this.supportsComments=!o.default(this.comment),this.NEXT_TOKEN_REGEXP=new RegExp("([^\\s]|\\r\\n|\\n|\\r|".concat(this.escapedDelimiter,")")),this.maxRows>0&&(this.limitRows=!0)}},{"lodash.escaperegexp":426,"lodash.isnil":431}],152:[function(t,e,r){"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},i=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Object.defineProperty(r,"__esModule",{value:!0}),r.parseString=r.parseFile=r.parseStream=r.parse=void 0;var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e}(t("fs")),a=t("stream"),s=t("./ParserOptions"),u=t("./CsvParserStream");!function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)}(t("./types"),r);var c=t("./CsvParserStream");Object.defineProperty(r,"CsvParserStream",{enumerable:!0,get:function(){return c.CsvParserStream}});var f=t("./ParserOptions");Object.defineProperty(r,"ParserOptions",{enumerable:!0,get:function(){return f.ParserOptions}}),r.parse=function(t){return new u.CsvParserStream(new s.ParserOptions(t))},r.parseStream=function(t,e){return t.pipe(new u.CsvParserStream(new s.ParserOptions(e)))},r.parseFile=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o.createReadStream(t).pipe(new u.CsvParserStream(new s.ParserOptions(e)))},r.parseString=function(t,e){var r=new a.Readable;return r.push(t),r.push(null),r.pipe(new u.CsvParserStream(new s.ParserOptions(e)))}},{"./CsvParserStream":150,"./ParserOptions":151,"./types":166,fs:215,stream:506}],153:[function(t,e,r){"use strict";function n(t,e){for(var r=0;rthis.cursor}},{key:"nextNonSpaceToken",get:function(){var t=this.lineFromCursor,e=this.parserOptions.NEXT_TOKEN_REGEXP;if(-1===t.search(e))return null;var r=e.exec(t);if(null==r)return null;var n=r[1],o=this.cursor+(r.index||0);return new i.Token({token:n,startCursor:o,endCursor:o+n.length-1})}},{key:"nextCharacterToken",get:function(){var t=this.cursor;return this.lineLength<=t?null:new i.Token({token:this.line[t],startCursor:t,endCursor:t})}},{key:"lineFromCursor",get:function(){return this.line.substr(this.cursor)}}])&&n(e.prototype,r),t}();r.Scanner=a},{"./Token":156}],156:[function(t,e,r){"use strict";function n(t,e){for(var r=0;rthis.headersLength){if(!e.strictColumnHandling)throw new Error("Unexpected Error: column header mismatch expected: ".concat(this.headersLength," columns got: ").concat(t.length));return{row:t,isValid:!1,reason:"Column header mismatch expected: ".concat(this.headersLength," columns got: ").concat(t.length)}}return e.strictColumnHandling&&t.length1}));throw new Error("Duplicate headers found ".concat(JSON.stringify(i)))}this.headers=t,this.receivedHeaders=!0,this.headersLength=(null===(e=this.headers)||void 0===e?void 0:e.length)||0}}])&&n(e.prototype,r),t}();r.HeaderTransformer=c},{"lodash.groupby":427,"lodash.isfunction":430,"lodash.isundefined":432,"lodash.uniq":433}],164:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function l(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var o=0;o=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|a.tagClassByName[r||"universal"]<<6)}(t,e,r,this.reporter);if(n.length<128){var s=i.alloc(2);return s[0]=o,s[1]=n.length,this._createEncoderBuffer([s,n])}for(var u=1,c=n.length;c>=256;c>>=8)u++;var f=i.alloc(2+u);f[0]=o,f[1]=128|u;for(var l=1+u,h=n.length;h>0;l--,h>>=8)f[l]=255&h;return this._createEncoderBuffer([f,n])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=i.alloc(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}for(var a=0,s=0;s=128;u>>=7)a++}for(var c=i.alloc(a),f=c.length-1,l=t.length-1;l>=0;l--){var h=t[l];for(c[f--]=127&h;(h>>=7)>0;)c[f--]=128|127&h}return this._createEncoderBuffer(c)},u.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[c(n.getUTCFullYear()),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[c(n.getUTCFullYear()%100),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=i.from(r)}if(i.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=i.alloc(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);for(var a=1,s=t;s>=256;s>>=8)a++;for(var u=new Array(a),c=u.length-1;c>=0;c--)u[c]=255&t,t>>=8;return 128&u[0]&&u.unshift(0),this._createEncoderBuffer(i.from(u))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}a.isBN=function(t){return t instanceof a||null!==t&&"object"===n(t)&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===n(t))return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var o=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&o++,16===e?this._parseHex(t,o):this._parseBase(t,e,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=u(t,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=u(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=h;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&a}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,a=0;a>>24-n&16777215)||a!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],b=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,k=0|a[4],x=8191&k,S=k>>>13,O=0|a[5],j=8191&O,E=O>>>13,R=0|a[6],T=8191&R,C=R>>>13,P=0|a[7],M=8191&P,A=P>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],F=8191&B,L=B>>>13,z=0|s[0],U=8191&z,H=z>>>13,V=0|s[1],q=8191&V,W=V>>>13,$=0|s[2],X=8191&$,K=$>>>13,Z=0|s[3],Y=8191&Z,G=Z>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],lt=8191&ft,ht=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(c+(n=Math.imul(l,U))|0)+((8191&(i=(i=Math.imul(l,H))+Math.imul(h,U)|0))<<13)|0;c=((o=Math.imul(h,H))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,H))+Math.imul(m,U)|0,o=Math.imul(m,H);var bt=(c+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,H))+Math.imul(v,U)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,W)|0;var vt=(c+(n=n+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,K)|0)+Math.imul(h,X)|0))<<13)|0;c=((o=o+Math.imul(h,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,H))+Math.imul(_,U)|0,o=Math.imul(_,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,K)|0;var gt=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,H))+Math.imul(S,U)|0,o=Math.imul(S,H),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,G)|0;var wt=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,H))+Math.imul(E,U)|0,o=Math.imul(E,H),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(S,q)|0,o=o+Math.imul(S,W)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(c+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(h,rt)|0))<<13)|0;c=((o=o+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,H))+Math.imul(C,U)|0,o=Math.imul(C,H),n=n+Math.imul(j,q)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var kt=(c+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,at)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,H))+Math.imul(A,U)|0,o=Math.imul(A,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,K)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var xt=(c+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,H))+Math.imul(D,U)|0,o=Math.imul(D,H),n=n+Math.imul(M,q)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,H))+Math.imul(L,U)|0,o=Math.imul(L,H),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,W)|0,n=n+Math.imul(M,X)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var Ot=(c+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,W))+Math.imul(L,q)|0,o=Math.imul(L,W),n=n+Math.imul(N,X)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,K)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(j,rt)|0,i=(i=i+Math.imul(j,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var jt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,K))+Math.imul(L,X)|0,o=Math.imul(L,K),n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,n=n+Math.imul(w,lt)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ht)|0;var Et=(c+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Y),i=(i=Math.imul(F,G))+Math.imul(L,Y)|0,o=Math.imul(L,G),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ht)|0;var Rt=(c+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(D,rt)|0,o=o+Math.imul(D,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(j,lt)|0,i=(i=i+Math.imul(j,ht)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ht)|0;var Tt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(L,rt)|0,o=Math.imul(L,nt),n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,n=n+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ht)|0;var Ct=(c+(n=n+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,at))+Math.imul(L,ot)|0,o=Math.imul(L,at),n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,n=n+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Pt=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ut),i=(i=Math.imul(F,ct))+Math.imul(L,ut)|0,o=Math.imul(L,ct),n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Mt=(c+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ht))+Math.imul(L,lt)|0,o=Math.imul(L,ht);var At=(c+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863;var It=(c+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(L,pt)|0))<<13)|0;return c=((o=Math.imul(L,mt))+(i>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=yt,u[1]=bt,u[2]=vt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=kt,u[7]=xt,u[8]=St,u[9]=Ot,u[10]=jt,u[11]=Et,u[12]=Rt,u[13]=Tt,u[14]=Ct,u[15]=Pt,u[16]=Mt,u[17]=At,u[18]=It,0!==c&&(u[19]=c,r.length++),r};function m(t,e,r){return(new y).mulp(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):m(this,t,e)},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},y.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=n);c--){var l=0|this.words[c];this.words[c]=f<<26-o|l>>>o,f=l&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(l)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(c)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new x(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},o(g,v),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return b[t]=e,e},x.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),h=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();i(y=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var l=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4==++s||0===n&&0===f)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}u=26}return i},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new S(t)},o(S,x),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e)},{buffer:185}],182:[function(t,e,r){"use strict";r.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],c=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),f=0,l=s>0?a-4:a;for(r=0;r>16&255,c[f++]=e>>8&255,c[f++]=255&e;return 2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,c[f++]=255&e),1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e),c},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],183:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(e,r){function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function o(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"===n(e)?e.exports=a:(void 0).BN=a,a.BN=a,a.wordSize=26;try{s=t("buffer").Buffer}catch(t){}function u(t,e,r){for(var n=0,o=Math.min(t.length,r),a=0,s=e;s=49&&c<=54?c-49+10:c>=17&&c<=22?c-17+10:c,a|=u}return i(!(240&a),"Invalid character in "+t),n}function c(t,e,r,n){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,i(c>=0&&a0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===n(t))return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var o=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&o++,16===e?this._parseHex(t,o):this._parseBase(t,e,o),"-"===t[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=u(t,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=u(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this._strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){a.prototype.inspect=l}else a.prototype.inspect=l;function l(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=h;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&a}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,a=0;a>>24-n&16777215)||a!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],f=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(f).toString(t);r=(l=l.idivn(f)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16,2)},s&&(a.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},a.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],b=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,k=0|a[4],x=8191&k,S=k>>>13,O=0|a[5],j=8191&O,E=O>>>13,R=0|a[6],T=8191&R,C=R>>>13,P=0|a[7],M=8191&P,A=P>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],F=8191&B,L=B>>>13,z=0|s[0],U=8191&z,H=z>>>13,V=0|s[1],q=8191&V,W=V>>>13,$=0|s[2],X=8191&$,K=$>>>13,Z=0|s[3],Y=8191&Z,G=Z>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],lt=8191&ft,ht=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(c+(n=Math.imul(l,U))|0)+((8191&(i=(i=Math.imul(l,H))+Math.imul(h,U)|0))<<13)|0;c=((o=Math.imul(h,H))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,H))+Math.imul(m,U)|0,o=Math.imul(m,H);var bt=(c+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,H))+Math.imul(v,U)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,W)|0;var vt=(c+(n=n+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,K)|0)+Math.imul(h,X)|0))<<13)|0;c=((o=o+Math.imul(h,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,H))+Math.imul(_,U)|0,o=Math.imul(_,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,K)|0;var gt=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,H))+Math.imul(S,U)|0,o=Math.imul(S,H),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,G)|0;var wt=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,H))+Math.imul(E,U)|0,o=Math.imul(E,H),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(S,q)|0,o=o+Math.imul(S,W)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(c+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(h,rt)|0))<<13)|0;c=((o=o+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,H))+Math.imul(C,U)|0,o=Math.imul(C,H),n=n+Math.imul(j,q)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var kt=(c+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,at)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,H))+Math.imul(A,U)|0,o=Math.imul(A,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,K)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var xt=(c+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,H))+Math.imul(D,U)|0,o=Math.imul(D,H),n=n+Math.imul(M,q)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(h,lt)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,H))+Math.imul(L,U)|0,o=Math.imul(L,H),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,W)|0,n=n+Math.imul(M,X)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ht)|0;var Ot=(c+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,W))+Math.imul(L,q)|0,o=Math.imul(L,W),n=n+Math.imul(N,X)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,K)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(j,rt)|0,i=(i=i+Math.imul(j,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(v,lt)|0,o=o+Math.imul(v,ht)|0;var jt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,K))+Math.imul(L,X)|0,o=Math.imul(L,K),n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,n=n+Math.imul(w,lt)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ht)|0;var Et=(c+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Y),i=(i=Math.imul(F,G))+Math.imul(L,Y)|0,o=Math.imul(L,G),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ht)|0;var Rt=(c+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(D,rt)|0,o=o+Math.imul(D,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(j,lt)|0,i=(i=i+Math.imul(j,ht)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,ht)|0;var Tt=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(L,rt)|0,o=Math.imul(L,nt),n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,n=n+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ht)|0;var Ct=(c+(n=n+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,at))+Math.imul(L,ot)|0,o=Math.imul(L,at),n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,n=n+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,ht)|0;var Pt=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ut),i=(i=Math.imul(F,ct))+Math.imul(L,ut)|0,o=Math.imul(L,ct),n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(D,lt)|0,o=o+Math.imul(D,ht)|0;var Mt=(c+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ht))+Math.imul(L,lt)|0,o=Math.imul(L,ht);var At=(c+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863;var It=(c+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(L,pt)|0))<<13)|0;return c=((o=Math.imul(L,mt))+(i>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=yt,u[1]=bt,u[2]=vt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=kt,u[7]=xt,u[8]=St,u[9]=Ot,u[10]=jt,u[11]=Et,u[12]=Rt,u[13]=Tt,u[14]=Ct,u[15]=Pt,u[16]=Mt,u[17]=At,u[18]=It,0!==c&&(u[19]=c,r.length++),r};function b(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function v(t,e,r){return b(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(y=m),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):r<63?m(this,t,e):r<1024?b(this,t,e):v(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,r+=o/67108864|0,r+=a>>>26,this.words[n]=67108863&a}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=n);c--){var l=0|this.words[c];this.words[c]=f<<26-o|l>>>o,f=l&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n>26,this.words[n+r]=67108863&o;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=h)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},a.prototype.modn=function(t){return this.modrn(t)},a.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(l)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(u)):(r.isub(e),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(c)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new j(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function O(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function j(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){j.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},o(k,_),k.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},k.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new k;else if("p224"===t)e=new x;else if("p192"===t)e=new S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new O}return w[t]=e,e},j.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},j.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},j.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},j.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},j.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},j.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},j.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},j.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},j.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},j.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},j.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},j.prototype.isqr=function(t){return this.imul(t,t.clone())},j.prototype.sqr=function(t){return this.mul(t,t)},j.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,n),h=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();i(y=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var l=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4==++s||0===n&&0===f)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}u=26}return i},j.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},j.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},o(E,j),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e)},{buffer:185}],184:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i;function o(t){this.rand=t}if(e.exports=function(t){return i||(i=new o(null)),i.generate(t)},e.exports.Rand=o,o.prototype.generate=function(t){return this._rand(t)},o.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r>>24]^f[p>>>16&255]^l[m>>>8&255]^h[255&y]^e[b++],a=c[p>>>24]^f[m>>>16&255]^l[y>>>8&255]^h[255&d]^e[b++],s=c[m>>>24]^f[y>>>16&255]^l[d>>>8&255]^h[255&p]^e[b++],u=c[y>>>24]^f[d>>>16&255]^l[p>>>8&255]^h[255&m]^e[b++],d=o,p=a,m=s,y=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&y])^e[b++],a=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[y>>>8&255]<<8|n[255&d])^e[b++],s=(n[m>>>24]<<24|n[y>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^e[b++],u=(n[y>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,n[c]=a;var f=t[a],l=t[f],h=t[l],d=257*t[c]^16843008*c;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*h^65537*l^257*f^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=f^t[t[t[h^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-e]^a}for(var c=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=c},{"safe-buffer":494}],187:[function(t,e,r){"use strict";var n=t("./aes"),i=t("safe-buffer").Buffer,o=t("cipher-base"),a=t("inherits"),s=t("./ghash"),u=t("buffer-xor"),c=t("./incr32");function f(t,e,r,a){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(e);var f=this._cipher.encryptBlock(u);this._ghash=new s(f),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new s(r),o=e.length,a=o%16;n.update(e),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var u=8*o,f=i.alloc(8);f.writeUIntBE(u,0,8),n.update(f),t._finID=n.state;var l=i.from(t._finID);return c(l),l}(this,r,f),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(f,o),f.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(e,!1,r.key,r.iv);return h(t,n.key,n.iv)},r.createDecipheriv=h},{"./aes":186,"./authCipher":187,"./modes":199,"./streamCipher":202,"cipher-base":218,evp_bytestokey:368,inherits:387,"safe-buffer":494}],190:[function(t,e,r){"use strict";var n=t("./modes"),i=t("./authCipher"),o=t("safe-buffer").Buffer,a=t("./streamCipher"),s=t("cipher-base"),u=t("./aes"),c=t("evp_bytestokey");function f(t,e,r){s.call(this),this._cache=new h,this._cipher=new u.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}t("inherits")(f,s),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var l=o.alloc(16,16);function h(){this.cache=o.allocUnsafe(0)}function d(t,e,r){var s=n[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,e,r):"auth"===s.type?new i(s.module,e,r):new f(s.module,e,r)}f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=o.concat([this.cache,t])},h.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},h.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},e.exports=a},{"safe-buffer":494}],192:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},{}],193:[function(t,e,r){"use strict";var n=t("buffer-xor");r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{"buffer-xor":217}],194:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("buffer-xor");function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}r.encrypt=function(t,e,r){for(var i,a=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},{"buffer-xor":217,"safe-buffer":494}],195:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer;function i(t,e,r){for(var n,i,a=-1,s=0;++a<8;)n=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>a%8,t._prev=o(t._prev,r?n:i);return s}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i>7;return o}r.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new n(i(e));return r}e.exports=o,o.getr=a}).call(this,t("buffer").Buffer)},{"bn.js":207,buffer:216,randombytes:475}],207:[function(t,e,r){arguments[4][181][0].apply(r,arguments)},{buffer:185,dup:181}],208:[function(t,e,r){"use strict";e.exports=t("./browser/algorithms.json")},{"./browser/algorithms.json":209}],209:[function(t,e,r){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],210:[function(t,e,r){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],211:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("create-hash"),o=t("readable-stream"),a=t("inherits"),s=t("./sign"),u=t("./verify"),c=t("./algorithms.json");function f(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){return new f(t)}function d(t){return new l(t)}Object.keys(c).forEach((function(t){c[t].id=n.from(c[t].id,"hex"),c[t.toLowerCase()]=c[t]})),a(f,o.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},f.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=s(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},a(l,o.Writable),l.prototype._write=function(t,e,r){this._hash.update(t),r()},l.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},l.prototype.verify=function(t,e,r){"string"==typeof e&&(e=n.from(e,r)),this.end();var i=this._hash.digest();return u(e,i,t,this._signType,this._tag)},e.exports={Sign:h,Verify:d,createSign:h,createVerify:d}},{"./algorithms.json":209,"./sign":212,"./verify":213,"create-hash":331,inherits:387,"readable-stream":491,"safe-buffer":214}],212:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("create-hmac"),o=t("browserify-rsa"),a=t("elliptic").ec,s=t("bn.js"),u=t("parse-asn1"),c=t("./curves.json");function f(t,e,r,o){if((t=n.from(t.toArray())).length0&&r.ishrn(n),r}function h(t,e,r){var o,a;do{for(o=n.alloc(0);8*o.length=e)throw new Error("invalid sig")}e.exports=function(t,e,r,c,f){var l=a(r);if("ec"===l.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),a=r.data.subjectPrivateKey.data;return i.verify(e,t,a)}(t,e,l)}if("dsa"===l.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,o=r.data.q,s=r.data.g,c=r.data.pub_key,f=a.signature.decode(t,"der"),l=f.s,h=f.r;u(l,o),u(h,o);var d=i.mont(n),p=l.invm(o);return 0===s.toRed(d).redPow(new i(e).mul(p).mod(o)).fromRed().mul(c.toRed(d).redPow(h.mul(p).mod(o)).fromRed()).mod(n).mod(o).cmp(h)}(t,e,l)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");e=n.concat([f,e]);for(var h=l.modulus.byteLength(),d=[1],p=0;e.length+d.length+22147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return s(t,e,r)}function s(t,r,i){if("string"==typeof t)return function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|h(t,r),i=a(n),o=i.write(t,r);return o!==n&&(i=i.slice(0,o)),i}(t,r);if(ArrayBuffer.isView(t))return f(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+n(t));if(L(t,ArrayBuffer)||t&&L(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function h(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||L(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+n(t));var i=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===i)return 0;for(var a=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return B(t).length;default:if(a)return o?-1:D(t).length;r=(""+r).toLowerCase(),a=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return E(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return j(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,r,n,i,o){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:y(t,r,n,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):y(t,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,i,o,a){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function A(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,8),o.write(t,e,r,n,52,8),r+8}r.Buffer=e,r.SlowBuffer=function(t){return+t!=t&&(t=0),e.alloc(+t)},r.INSPECT_MAX_BYTES=50,r.kMaxLength=2147483647,e.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),e.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(t,e,r){return s(t,e,r)},e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,e.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},e.allocUnsafe=function(t){return c(t)},e.allocUnsafeSlow=function(t){return c(t)},e.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==e.prototype},e.compare=function(t,r){if(L(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),L(r,Uint8Array)&&(r=e.from(r,r.offset,r.byteLength)),!e.isBuffer(t)||!e.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var n=t.length,i=r.length,o=0,a=Math.min(n,i);oe&&(t+=" ... "),""},e.prototype.compare=function(t,r,i,o,a){if(L(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+n(t));if(void 0===r&&(r=0),void 0===i&&(i=t?t.length:0),void 0===o&&(o=0),void 0===a&&(a=this.length),r<0||i>t.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&r>=i)return 0;if(o>=a)return-1;if(r>=i)return 1;if(this===t)return 0;for(var s=(a>>>=0)-(o>>>=0),u=(i>>>=0)-(r>>>=0),c=Math.min(s,u),f=this.slice(o,a),l=t.slice(r,i),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},e.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),o.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),o.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),o.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),o.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||C(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||C(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return A(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return A(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--a)t[a+r]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return o},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var o=t.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(t=o)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=r;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function L(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":182,buffer:216,ieee754:385}],217:[function(t,e,r){(function(t){"use strict";e.exports=function(e,r){for(var n=Math.min(e.length,r.length),i=new t(n),o=0;of;)if((s=u[f++])!=s)return!0}else for(;c>f;f++)if((t||f in u)&&u[f]===r)return t||f||0;return!t&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},{"../internals/to-absolute-index":304,"../internals/to-indexed-object":305,"../internals/to-length":307}],225:[function(t,e,r){var n=t("../internals/function-bind-context"),i=t("../internals/indexed-object"),o=t("../internals/to-object"),a=t("../internals/to-length"),s=t("../internals/array-species-create"),u=[].push,c=function(t){var e=1==t,r=2==t,c=3==t,f=4==t,l=6==t,h=5==t||l;return function(d,p,m,y){for(var b,v,g=o(d),w=i(g),_=n(p,m,3),k=a(w.length),x=0,S=y||s,O=e?S(d,k):r?S(d,0):void 0;k>x;x++)if((h||x in w)&&(v=_(b=w[x],x,g),t))if(e)O[x]=v;else if(v)switch(t){case 3:return!0;case 5:return b;case 6:return x;case 2:u.call(O,b)}else if(f)return!1;return l?-1:c||f?f:O}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},{"../internals/array-species-create":227,"../internals/function-bind-context":248,"../internals/indexed-object":257,"../internals/to-length":307,"../internals/to-object":308}],226:[function(t,e,r){var n=t("../internals/descriptors"),i=t("../internals/fails"),o=t("../internals/has"),a=Object.defineProperty,s={},u=function(t){throw t};e.exports=function(t,e){if(o(s,t))return s[t];e||(e={});var r=[][t],c=!!o(e,"ACCESSORS")&&e.ACCESSORS,f=o(e,0)?e[0]:u,l=o(e,1)?e[1]:void 0;return s[t]=!!r&&!i((function(){if(c&&!n)return!0;var t={length:-1};c?a(t,1,{enumerable:!0,get:u}):t[1]=1,r.call(t,f,l)}))}},{"../internals/descriptors":240,"../internals/fails":247,"../internals/has":252}],227:[function(t,e,r){var n=t("../internals/is-object"),i=t("../internals/is-array"),o=t("../internals/well-known-symbol")("species");e.exports=function(t,e){var r;return i(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!i(r.prototype)?n(r)&&null===(r=r[o])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)}},{"../internals/is-array":261,"../internals/is-object":263,"../internals/well-known-symbol":314}],228:[function(t,e,r){var n=t("../internals/an-object");e.exports=function(t,e,r,i){try{return i?e(n(r)[0],r[1]):e(r)}catch(e){var o=t.return;throw void 0!==o&&n(o.call(t)),e}}},{"../internals/an-object":223}],229:[function(t,e,r){var n=t("../internals/well-known-symbol")("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}e.exports=function(t,e){if(!e&&!i)return!1;var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},t(o)}catch(t){}return r}},{"../internals/well-known-symbol":314}],230:[function(t,e,r){var n={}.toString;e.exports=function(t){return n.call(t).slice(8,-1)}},{}],231:[function(t,e,r){var n=t("../internals/to-string-tag-support"),i=t("../internals/classof-raw"),o=t("../internals/well-known-symbol")("toStringTag"),a="Arguments"==i(function(){return arguments}());e.exports=n?i:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?r:a?i(e):"Object"==(n=i(e))&&"function"==typeof e.callee?"Arguments":n}},{"../internals/classof-raw":230,"../internals/to-string-tag-support":310,"../internals/well-known-symbol":314}],232:[function(t,e,r){var n=t("../internals/has"),i=t("../internals/own-keys"),o=t("../internals/object-get-own-property-descriptor"),a=t("../internals/object-define-property");e.exports=function(t,e){for(var r=i(e),s=a.f,u=o.f,c=0;c=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=n[1]),e.exports=i&&+i},{"../internals/engine-user-agent":243,"../internals/global":251}],245:[function(t,e,r){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},{}],246:[function(t,e,r){var n=t("../internals/global"),i=t("../internals/object-get-own-property-descriptor").f,o=t("../internals/create-non-enumerable-property"),a=t("../internals/redefine"),s=t("../internals/set-global"),u=t("../internals/copy-constructor-properties"),c=t("../internals/is-forced");e.exports=function(t,e){var r,f,l,h,d,p=t.target,m=t.global,y=t.stat;if(r=m?n:y?n[p]||s(p,{}):(n[p]||{}).prototype)for(f in e){if(h=e[f],l=t.noTargetGet?(d=i(r,f))&&d.value:r[f],!c(m?f:p+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof h==typeof l)continue;u(h,l)}(t.sham||l&&l.sham)&&o(h,"sham",!0),a(r,f,h,t)}}},{"../internals/copy-constructor-properties":232,"../internals/create-non-enumerable-property":236,"../internals/global":251,"../internals/is-forced":262,"../internals/object-get-own-property-descriptor":279,"../internals/redefine":294,"../internals/set-global":296}],247:[function(t,e,r){e.exports=function(t){try{return!!t()}catch(t){return!0}}},{}],248:[function(t,e,r){var n=t("../internals/a-function");e.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)}}return function(){return t.apply(e,arguments)}}},{"../internals/a-function":219}],249:[function(t,e,r){var n=t("../internals/path"),i=t("../internals/global"),o=function(t){return"function"==typeof t?t:void 0};e.exports=function(t,e){return arguments.length<2?o(n[t])||o(i[t]):n[t]&&n[t][e]||i[t]&&i[t][e]}},{"../internals/global":251,"../internals/path":290}],250:[function(t,e,r){var n=t("../internals/classof"),i=t("../internals/iterators"),o=t("../internals/well-known-symbol")("iterator");e.exports=function(t){if(null!=t)return t[o]||t["@@iterator"]||i[n(t)]}},{"../internals/classof":231,"../internals/iterators":268,"../internals/well-known-symbol":314}],251:[function(t,e,n){(function(t){var r=function(t){return t&&t.Math==Math&&t};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||Function("return this")()}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],252:[function(t,e,r){var n={}.hasOwnProperty;e.exports=function(t,e){return n.call(t,e)}},{}],253:[function(t,e,r){e.exports={}},{}],254:[function(t,e,r){var n=t("../internals/global");e.exports=function(t,e){var r=n.console;r&&r.error&&(1===arguments.length?r.error(t):r.error(t,e))}},{"../internals/global":251}],255:[function(t,e,r){var n=t("../internals/get-built-in");e.exports=n("document","documentElement")},{"../internals/get-built-in":249}],256:[function(t,e,r){var n=t("../internals/descriptors"),i=t("../internals/fails"),o=t("../internals/document-create-element");e.exports=!n&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},{"../internals/descriptors":240,"../internals/document-create-element":241,"../internals/fails":247}],257:[function(t,e,r){var n=t("../internals/fails"),i=t("../internals/classof-raw"),o="".split;e.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?o.call(t,""):Object(t)}:Object},{"../internals/classof-raw":230,"../internals/fails":247}],258:[function(t,e,r){var n=t("../internals/shared-store"),i=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return i.call(t)}),e.exports=n.inspectSource},{"../internals/shared-store":300}],259:[function(t,e,r){var n,i,o,a=t("../internals/native-weak-map"),s=t("../internals/global"),u=t("../internals/is-object"),c=t("../internals/create-non-enumerable-property"),f=t("../internals/has"),l=t("../internals/shared-key"),h=t("../internals/hidden-keys"),d=s.WeakMap;if(a){var p=new d,m=p.get,y=p.has,b=p.set;n=function(t,e){return b.call(p,t,e),e},i=function(t){return m.call(p,t)||{}},o=function(t){return y.call(p,t)}}else{var v=l("state");h[v]=!0,n=function(t,e){return c(t,v,e),e},i=function(t){return f(t,v)?t[v]:{}},o=function(t){return f(t,v)}}e.exports={set:n,get:i,has:o,enforce:function(t){return o(t)?i(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!u(e)||(r=i(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},{"../internals/create-non-enumerable-property":236,"../internals/global":251,"../internals/has":252,"../internals/hidden-keys":253,"../internals/is-object":263,"../internals/native-weak-map":272,"../internals/shared-key":299}],260:[function(t,e,r){var n=t("../internals/well-known-symbol"),i=t("../internals/iterators"),o=n("iterator"),a=Array.prototype;e.exports=function(t){return void 0!==t&&(i.Array===t||a[o]===t)}},{"../internals/iterators":268,"../internals/well-known-symbol":314}],261:[function(t,e,r){var n=t("../internals/classof-raw");e.exports=Array.isArray||function(t){return"Array"==n(t)}},{"../internals/classof-raw":230}],262:[function(t,e,r){var n=t("../internals/fails"),i=/#|\.prototype\./,o=function(t,e){var r=s[a(t)];return r==c||r!=u&&("function"==typeof e?n(e):!!e)},a=o.normalize=function(t){return String(t).replace(i,".").toLowerCase()},s=o.data={},u=o.NATIVE="N",c=o.POLYFILL="P";e.exports=o},{"../internals/fails":247}],263:[function(t,e,r){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],264:[function(t,e,r){e.exports=!1},{}],265:[function(t,e,r){var n=t("../internals/is-object"),i=t("../internals/classof-raw"),o=t("../internals/well-known-symbol")("match");e.exports=function(t){var e;return n(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},{"../internals/classof-raw":230,"../internals/is-object":263,"../internals/well-known-symbol":314}],266:[function(t,e,r){var n=t("../internals/an-object"),i=t("../internals/is-array-iterator-method"),o=t("../internals/to-length"),a=t("../internals/function-bind-context"),s=t("../internals/get-iterator-method"),u=t("../internals/call-with-safe-iteration-closing"),c=function(t,e){this.stopped=t,this.result=e};(e.exports=function(t,e,r,f,l){var h,d,p,m,y,b,v,g=a(e,r,f?2:1);if(l)h=t;else{if("function"!=typeof(d=s(t)))throw TypeError("Target is not iterable");if(i(d)){for(p=0,m=o(t.length);m>p;p++)if((y=f?g(n(v=t[p])[0],v[1]):g(t[p]))&&y instanceof c)return y;return new c(!1)}h=d.call(t)}for(b=h.next;!(v=b.call(h)).done;)if("object"==typeof(y=u(h,g,v.value,f))&&y&&y instanceof c)return y;return new c(!1)}).stop=function(t){return new c(!0,t)}},{"../internals/an-object":223,"../internals/call-with-safe-iteration-closing":228,"../internals/function-bind-context":248,"../internals/get-iterator-method":250,"../internals/is-array-iterator-method":260,"../internals/to-length":307}],267:[function(t,e,r){"use strict";var n,i,o,a=t("../internals/object-get-prototype-of"),s=t("../internals/create-non-enumerable-property"),u=t("../internals/has"),c=t("../internals/well-known-symbol"),f=t("../internals/is-pure"),l=c("iterator"),h=!1;[].keys&&("next"in(o=[].keys())?(i=a(a(o)))!==Object.prototype&&(n=i):h=!0),null==n&&(n={}),f||u(n,l)||s(n,l,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:h}},{"../internals/create-non-enumerable-property":236,"../internals/has":252,"../internals/is-pure":264,"../internals/object-get-prototype-of":283,"../internals/well-known-symbol":314}],268:[function(t,e,r){arguments[4][253][0].apply(r,arguments)},{dup:253}],269:[function(t,e,r){var n,i,o,a,s,u,c,f,l=t("../internals/global"),h=t("../internals/object-get-own-property-descriptor").f,d=t("../internals/classof-raw"),p=t("../internals/task").set,m=t("../internals/engine-is-ios"),y=l.MutationObserver||l.WebKitMutationObserver,b=l.process,v=l.Promise,g="process"==d(b),w=h(l,"queueMicrotask"),_=w&&w.value;_||(n=function(){var t,e;for(g&&(t=b.domain)&&t.exit();i;){e=i.fn,i=i.next;try{e()}catch(t){throw i?a():o=void 0,t}}o=void 0,t&&t.enter()},g?a=function(){b.nextTick(n)}:y&&!m?(s=!0,u=document.createTextNode(""),new y(n).observe(u,{characterData:!0}),a=function(){u.data=s=!s}):v&&v.resolve?(c=v.resolve(void 0),f=c.then,a=function(){f.call(c,n)}):a=function(){p.call(l,n)}),e.exports=_||function(t){var e={fn:t,next:void 0};o&&(o.next=e),i||(i=e,a()),o=e}},{"../internals/classof-raw":230,"../internals/engine-is-ios":242,"../internals/global":251,"../internals/object-get-own-property-descriptor":279,"../internals/task":303}],270:[function(t,e,r){var n=t("../internals/global");e.exports=n.Promise},{"../internals/global":251}],271:[function(t,e,r){var n=t("../internals/fails");e.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},{"../internals/fails":247}],272:[function(t,e,r){var n=t("../internals/global"),i=t("../internals/inspect-source"),o=n.WeakMap;e.exports="function"==typeof o&&/native code/.test(i(o))},{"../internals/global":251,"../internals/inspect-source":258}],273:[function(t,e,r){"use strict";var n=t("../internals/a-function"),i=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)};e.exports.f=function(t){return new i(t)}},{"../internals/a-function":219}],274:[function(t,e,r){var n=t("../internals/is-regexp");e.exports=function(t){if(n(t))throw TypeError("The method doesn't accept regular expressions");return t}},{"../internals/is-regexp":265}],275:[function(t,e,r){"use strict";var n=t("../internals/descriptors"),i=t("../internals/fails"),o=t("../internals/object-keys"),a=t("../internals/object-get-own-property-symbols"),s=t("../internals/object-property-is-enumerable"),u=t("../internals/to-object"),c=t("../internals/indexed-object"),f=Object.assign,l=Object.defineProperty;e.exports=!f||i((function(){if(n&&1!==f({b:1},f(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol();return t[r]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){e[t]=t})),7!=f({},t)[r]||"abcdefghijklmnopqrst"!=o(f({},e)).join("")}))?function(t,e){for(var r=u(t),i=arguments.length,f=1,l=a.f,h=s.f;i>f;)for(var d,p=c(arguments[f++]),m=l?o(p).concat(l(p)):o(p),y=m.length,b=0;y>b;)d=m[b++],n&&!h.call(p,d)||(r[d]=p[d]);return r}:f},{"../internals/descriptors":240,"../internals/fails":247,"../internals/indexed-object":257,"../internals/object-get-own-property-symbols":282,"../internals/object-keys":285,"../internals/object-property-is-enumerable":286,"../internals/to-object":308}],276:[function(t,e,r){var n,i=t("../internals/an-object"),o=t("../internals/object-define-properties"),a=t("../internals/enum-bug-keys"),s=t("../internals/hidden-keys"),u=t("../internals/html"),c=t("../internals/document-create-element"),f=t("../internals/shared-key")("IE_PROTO"),l=function(){},h=function(t){return"