!/** * Highcharts JS v11.4.1 (2024-04-04) * * Highcharts * * (c) 2010-2024 Highsoft AS * * License: www.highcharts.com/license */function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/modules/data-tools",["highcharts"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function r(e,t,r,s){e.hasOwnProperty(t)||(e[t]=s.apply(null,r),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}r(t,"Data/Modifiers/DataModifier.js",[t["Core/Utilities.js"]],function(e){var t;let{addEvent:r,fireEvent:s,merge:o}=e;class n{benchmark(e,t){let r=[],s=this,n=()=>{s.modifyTable(e),s.emit({type:"afterBenchmarkIteration"})},{iterations:i}=o({iterations:1},t);s.on("afterBenchmarkIteration",()=>{if(r.length===i){s.emit({type:"afterBenchmark",results:r});return}n()});let l={startTime:0,endTime:0};return s.on("modify",()=>{l.startTime=window.performance.now()}),s.on("afterModify",()=>{l.endTime=window.performance.now(),r.push(l.endTime-l.startTime)}),n(),r}emit(e){s(this,e.type,e)}modify(e,t){let r=this;return new Promise((s,o)=>{e.modified===e&&(e.modified=e.clone(!1,t));try{s(r.modifyTable(e,t))}catch(s){r.emit({type:"error",detail:t,table:e}),o(s)}})}modifyCell(e,t,r,s,o){return this.modifyTable(e)}modifyColumns(e,t,r,s){return this.modifyTable(e)}modifyRows(e,t,r,s){return this.modifyTable(e)}on(e,t){return r(this,e,t)}}return(t=n||(n={})).types={},t.registerType=function(e,r){return!!e&&!t.types[e]&&!!(t.types[e]=r)},n}),r(t,"Data/DataTable.js",[t["Core/Utilities.js"]],function(e){let{addEvent:t,fireEvent:r,uniqueKey:s}=e;class o{static isNull(e){if(e===o.NULL)return!0;if(e instanceof Array){if(!e.length)return!1;for(let t=0,r=e.length;t0&&e=this.rowCount&&(this.rowCount=t+1),i[t]=r,n&&n.modifyCell(this,e,t,r),this.emit({type:"afterSetCell",cellValue:r,columnName:e,detail:s,rowIndex:t}))}setColumn(e,t=[],r=0,s){this.setColumns({[e]:t},r,s)}setColumns(e,t,r){let s=this.columns,o=this.modifier,n=void 0===t,i=Object.keys(e);this.emit({type:"setColumns",columns:e,columnNames:i,detail:r,rowIndex:t});for(let r=0,o=i.length,l,a;r(r.emit({type:"afterSetModifier",detail:t,modifier:e,modified:r.modified}),r)).catch(t=>{throw r.emit({type:"setModifierError",error:t,modifier:e,modified:r.modified}),t})}setRow(e,t,r){this.setRows([e],t,r)}setRows(e,t=this.rowCount,r){let s=this.aliases,n=this.columns,i=Object.keys(n),l=this.modifier,a=e.length;this.emit({type:"setRows",detail:r,rowCount:a,rowIndex:t,rows:e});for(let r=0,l=t,u;rthis.rowCount){this.rowCount=u;for(let e=0,t=i.length;el(t[e].index,0)-l(t[r].index,0))}getSortedColumns(e){return this.table.getColumns(this.getColumnOrder(e))}load(){return n(this,"afterLoad",{table:this.table}),Promise.resolve(this)}on(e,t){return o(this,e,t)}save(){return n(this,"saveError",{table:this.table}),Promise.reject(Error("Not implemented"))}setColumnOrder(e){for(let t=0,r=e.length;tthis)}startPolling(e=1e3){let t=this;window.clearTimeout(t._polling),t._polling=window.setTimeout(()=>t.load().catch(e=>t.emit({type:"loadError",error:e,table:t.table})).then(()=>{t._polling&&t.startPolling(e)}),e)}stopPolling(){window.clearTimeout(this._polling),delete this._polling}whatIs(e){return this.metadata.columns[e]}}return(s=a||(a={})).types={},s.registerType=function(e,t){return!!e&&!s.types[e]&&!!(s.types[e]=t)},a}),r(t,"Data/Converters/DataConverter.js",[t["Data/DataTable.js"],t["Core/Utilities.js"]],function(e,t){let{addEvent:r,fireEvent:s,isNumber:o,merge:n}=t;class i{constructor(e){this.dateFormats={"YYYY/mm/dd":{regex:/^([0-9]{4})([\-\.\/])([0-9]{1,2})\2([0-9]{1,2})$/,parser:function(e){return e?Date.UTC(+e[1],e[3]-1,+e[4]):NaN}},"dd/mm/YYYY":{regex:/^([0-9]{1,2})([\-\.\/])([0-9]{1,2})\2([0-9]{4})$/,parser:function(e){return e?Date.UTC(+e[4],e[3]-1,+e[1]):NaN},alternative:"mm/dd/YYYY"},"mm/dd/YYYY":{regex:/^([0-9]{1,2})([\-\.\/])([0-9]{1,2})\2([0-9]{4})$/,parser:function(e){return e?Date.UTC(+e[4],e[1]-1,+e[3]):NaN}},"dd/mm/YY":{regex:/^([0-9]{1,2})([\-\.\/])([0-9]{1,2})\2([0-9]{2})$/,parser:function(e){let t=new Date;if(!e)return NaN;let r=+e[4];return r>t.getFullYear()-2e3?r+=1900:r+=2e3,Date.UTC(r,e[3]-1,+e[1])},alternative:"mm/dd/YY"},"mm/dd/YY":{regex:/^([0-9]{1,2})([\-\.\/])([0-9]{1,2})\2([0-9]{2})$/,parser:function(e){return e?Date.UTC(+e[4]+2e3,e[1]-1,+e[3]):NaN}}};let t=n(i.defaultOptions,e),r=t.decimalPoint;("."===r||","===r)&&(r="."===r?"\\.":",",this.decimalRegExp=RegExp("^(-?[0-9]+)"+r+"([0-9]+)$")),this.options=t}asBoolean(e){return"boolean"==typeof e?e:"string"==typeof e?""!==e&&"0"!==e&&"false"!==e:!!this.asNumber(e)}asDate(e){let t;if("string"==typeof e)t=this.parseDate(e);else if("number"==typeof e)t=e;else{if(e instanceof Date)return e;t=this.parseDate(this.asString(e))}return new Date(t)}asGuessedType(e){return({number:this.asNumber,Date:this.asDate,string:this.asString})[this.guessType(e)].call(this,e)}asNumber(e){if("number"==typeof e)return e;if("boolean"==typeof e)return e?1:0;if("string"==typeof e){let t=this.decimalRegExp;if(e.indexOf(" ")>-1&&(e=e.replace(/\s+/g,"")),t){if(!t.test(e))return NaN;e=e.replace(t,"$1.$2")}return parseFloat(e)}return e instanceof Date?e.getDate():e?e.getRowCount():NaN}asString(e){return""+e}deduceDateFormat(e,t,r){let s=[],o=[],n="YYYY/mm/dd",i,l=[],a=0,u=!1,h,m;for((!t||t>e.length)&&(t=e.length);a31?h<100?l[m]="YY":l[m]="YYYY":h>12&&h<=31?(l[m]="dd",u=!0):l[m].length||(l[m]="mm"));if(u){for(m=0;m12&&"YY"!==l[m]&&"YYYY"!==l[m]&&(l[m]="YY"):o[m]>12&&"mm"===l[m]&&(l[m]="dd");3===l.length&&"dd"===l[1]&&"dd"===l[2]&&(l[2]="YY"),n=l.join("/")}return r&&(this.options.dateFormat=n),n}emit(e){s(this,e.type,e)}export(e,t){throw this.emit({type:"exportError",columns:[],headers:[]}),Error("Not implemented")}getTable(){throw Error("Not implemented")}guessType(e){let t="string";if("string"==typeof e){let r=this.trim(`${e}`),s=this.decimalRegExp,n=this.trim(r,!0);s&&(n=s.test(n)?n.replace(s,"$1.$2"):"");let i=parseFloat(n);+n===i?e=i:t=o(this.parseDate(e))?"Date":"string"}return"number"==typeof e&&(t=e>31536e6?"Date":"number"),t}on(e,t){return r(this,e,t)}parse(e){throw this.emit({type:"parseError",columns:[],headers:[]}),Error("Not implemented")}parseDate(e,t){let r=this.options,s=t||r.dateFormat,n=NaN,i,l,a;if(r.parseDate)n=r.parseDate(e);else{if(s)(l=this.dateFormats[s])||(l=this.dateFormats["YYYY/mm/dd"]),(a=e.match(l.regex))&&(n=l.parser(a));else for(i in this.dateFormats)if(l=this.dateFormats[i],a=e.match(l.regex)){s=i,n=l.parser(a);break}!a&&("object"==typeof(a=Date.parse(e))&&null!==a&&a.getTime?n=a.getTime()-6e4*a.getTimezoneOffset():o(a)&&(n=a-6e4*new Date(a).getTimezoneOffset(),-1===e.indexOf("2001")&&2001===new Date(n).getFullYear()&&(n=NaN)))}return n}trim(e,t){return"string"==typeof e&&(e=e.replace(/^\s+|\s+$/g,""),t&&/^[0-9\s]+$/.test(e)&&(e=e.replace(/\s/g,""))),e}}return i.defaultOptions={dateFormat:"",alternativeFormat:"",startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE,firstRowAsNames:!0,switchRowsAndColumns:!1},(i||(i={})).getTableFromColumns=function(t=[],r=[]){let s=new e;for(let e=0,o=Math.max(r.length,t.length);e=0)return this;try{this.emittingRegister.push(c);for(let e=0,t=m.length;e=0&&this.emittingRegister.splice(e,1)}}return this}remitCursor(t,r){let s=this.stateMap[t]&&this.stateMap[t][r.state];if(s){let t=e.getIndex(r,s);t>=0&&s.splice(t,1)}return this}removeListener(e,t,r){let s=this.listenerMap[e]&&this.listenerMap[e][t];if(s){let e=s.indexOf(r);e&&s.splice(e,1)}return this}}return e.version="1.0.0",function(e){function t(e,t){if("range"===e.type)return e;let r={type:"range",firstRow:e.row??(t&&t.firstRow)??0,lastRow:e.row??(t&&t.lastRow)??Number.MAX_VALUE,state:e.state};return void 0!==e.column&&(r.columns=[e.column]),r}e.getIndex=function(e,t){if("position"===e.type){for(let r,s=0,o=t.length;s=r.firstRow&&e.lastRow<=r.lastRow&&(!s||!o||s.every(e=>o.indexOf(e)>=0))},e.toPositions=function(e){if("position"===e.type)return[e];let t=e.columns||[],r=[],s=e.state;for(let o=e.firstRow,n=e.lastRow;o{delete this.waiting[e];for(let e=0,s=r.length;e{delete this.waiting[e];for(let e=0,s=r.length;e{r.push([e,t])})}getConnectorIds(){let e=this.options.connectors,t=[];for(let r=0,s=e.length;re.table)}isNewConnector(e){return!this.connectors[e]}loadConnector(t){return new Promise((r,s)=>{this.emit({type:"load",options:t});let o=e.types[t.type];if(!o)throw Error(`Connector type not found. (${t.type})`);new o(t.options).load().then(e=>{this.connectors[t.id]=e,this.emit({type:"afterLoad",options:t}),r(e)}).catch(s)})}on(e,t){return r.addEvent(this,e,t)}setConnectorOptions(e){let t=this.options.connectors,r=this.connectors;this.emit({type:"setConnectorOptions",options:e});for(let r=0,s=t.length;r]|<=|=>)/,n=/^(\$?[A-Z]+)(\$?\d+)\:(\$?[A-Z]+)(\$?\d+)/,i=/^R(\d*|\[\d+\])C(\d*|\[\d+\])\:R(\d*|\[\d+\])C(\d*|\[\d+\])/,l=/^(\$?[A-Z]+)(\$?\d+)(?![\:C])/,a=/^R(\d*|\[\d+\])C(\d*|\[\d+\])(?!\:)/;function u(e){let t=0;for(let r=0,s=e.length,o,n=1;r0){let e=Error("Incomplete parantheses.");throw e.name="FormulaParseError",e}return""}function h(e){let t=-1;for(let r=0,s=e.length,o,n=!1;r=65&&o<=90&&(t+=(o-64)*Math.pow(26,n)),--n;return t}return{parseFormula:c}}),r(t,"Data/Formula/FormulaTypes.js",[],function(){let e=["+","-","*","/","^","=","<","<=",">",">="];return{isFormula:function(e){return e instanceof Array},isFunction:function(e){return"object"==typeof e&&!(e instanceof Array)&&"function"===e.type},isOperator:function(t){return"string"==typeof t&&e.indexOf(t)>=0},isRange:function(e){return"object"==typeof e&&!(e instanceof Array)&&"range"===e.type},isReference:function(e){return"object"==typeof e&&!(e instanceof Array)&&"reference"===e.type},isValue:function(e){return"boolean"==typeof e||"number"==typeof e||"string"==typeof e}}}),r(t,"Data/Formula/FormulaProcessor.js",[t["Data/Formula/FormulaTypes.js"]],function(e){let{isFormula:t,isFunction:r,isOperator:s,isRange:o,isReference:n,isValue:i}=e,l=/ */,a=Number.MAX_VALUE/1.000000000001,u=Number.MAX_VALUE/1.000000000002,h=Number.MAX_VALUE,m={"^":3,"*":2,"/":2,"+":1,"-":1,"=":0,"<":0,"<=":0,">":0,">=":0},c={},f=/^[A-Z][A-Z\.]*$/;function d(e){switch(typeof e){case"boolean":return e?h:a;case"string":return u;case"number":return e;default:return NaN}}function p(e){return"string"==typeof e?e.toLowerCase().replace(l,"\0"):e}function g(e){switch(typeof e){case"boolean":return e?1:0;case"string":return parseFloat(e.replace(",","."));case"number":return e;default:return NaN}}function y(e,t,r){let s;switch(e){case"=":return p(t)===p(r);case"<":if(typeof t==typeof r)return p(t)":if(typeof t==typeof r)return p(t)>p(r);return d(t)>d(r);case">=":if(typeof t==typeof r)return p(t)>=p(r);return d(t)>=d(r)}switch(t=g(t),r=g(r),e){case"+":s=t+r;break;case"-":s=t-r;break;case"*":s=t*r;break;case"/":s=t/r;break;case"^":s=Math.pow(t,r);break;default:return NaN}return s%1?Math.round(1e9*s)/1e9:s}function C(e,s){return i(e)?e:o(e)?s&&b(e,s)||[]:r(e)?N(e,s):D(t(e)?e:[e],s)}function b(e,t){let r=t.getColumnNames().slice(e.beginColumn,e.endColumn+1),s=[];for(let o=0,n=r.length,l;on&&(n=s);break;case"object":(s=r(s))>n&&(n=s)}return isFinite(n)?n:0}return e.registerProcessorFunction("MAX",r),r}),r(t,"Data/Formula/Functions/MEDIAN.js",[t["Data/Formula/FormulaProcessor.js"]],function(e){function t(t,r){let s=[],o=e.getArgumentsValues(t,r);for(let e=0,t=o.length,r;e1?n:NaN}function s(e,r){let s=t(e,r),o=Object.keys(s);if(!o.length)return NaN;let n=parseFloat(o[0]),i=s[o[0]];for(let e=1,t=o.length,r,l,a;e(l=parseFloat(r))&&(n=l,i=a);return i>1?n:NaN}return e.registerProcessorFunction("MODE",s),e.registerProcessorFunction("MODE.MULT",r),e.registerProcessorFunction("MODE.SNGL",s),{MULT:r,SNGL:s}}),r(t,"Data/Formula/Functions/NOT.js",[t["Data/Formula/FormulaProcessor.js"]],function(e){let{getArgumentValue:t}=e;function r(e,r){let s=t(e[0],r);switch("object"==typeof s&&(s=s[0]),typeof s){case"boolean":case"number":return!s}return NaN}return e.registerProcessorFunction("NOT",r),r}),r(t,"Data/Formula/Functions/OR.js",[t["Data/Formula/FormulaProcessor.js"]],function(e){let{getArgumentValue:t}=e;function r(e,s){for(let o=0,n=e.length,i;o`"${e}"`).join(i));for(let t=0;t2&&void 0===m[e][r];)m[e].pop(),r--;u.push(m[e].join(i))}}}return u.join(s)}parse(e,t){let s=this.dataTypes,o=r(this.options,e),{beforeParse:n,lineDelimiter:i,firstRowAsNames:l,itemDelimiter:a}=o,u,h=0,{csv:m,startRow:c,endRow:f}=o,d;if(this.columns=[],this.emit({type:"parse",columns:this.columns,detail:t,headers:this.headers}),m&&n&&(m=n(m)),m){if(u=m.replace(/\r\n|\r/g,"\n").split(i||"\n"),(!c||c<0)&&(c=0),(!f||f>=u.length)&&(f=u.length-1),a||(this.guessedItemDelimiter=this.guessDelimiter(u)),l){let e=u[0].split(a||this.guessedItemDelimiter||",");for(let t=0;t{h=e[t]},p=e=>{o.length{if(n>c||c>i){++c,m="";return}if("string"==typeof m?!isNaN(parseFloat(m))&&isFinite(m)?(m=parseFloat(m),p("number")):isNaN(Date.parse(m))?p("string"):(m=m.replace(/\//g,"-"),p("date")):p("number"),s.length13)break;let h=e[s];for(let e=0;eo[","]?s=";":(o[","],o[";"],s=","),t>r?this.guessedDecimalPoint=".":this.guessedDecimalPoint=",",s}getTable(){return e.getTableFromColumns(this.columns,this.headers)}}return s.defaultOptions={...e.defaultOptions,lineDelimiter:"\n"},s}),r(t,"Data/Connectors/CSVConnector.js",[t["Data/Converters/CSVConverter.js"],t["Data/Connectors/DataConnector.js"],t["Core/Utilities.js"]],function(e,t,r){let{merge:s}=r;class o extends t{constructor(t){let r=s(o.defaultOptions,t);super(r),this.converter=new e(r),this.options=r,r.enablePolling&&this.startPolling(1e3*Math.max(r.dataRefreshRate||0,1))}load(e){let t=this,r=t.converter,s=t.table,{csv:o,csvURL:n,dataModifier:i}=t.options;return t.emit({type:"load",csv:o,detail:e,table:s}),Promise.resolve(n?fetch(n).then(e=>e.text()):o||"").then(e=>(e&&(s.deleteColumns(),r.parse({csv:e}),s.setColumns(r.getTable().getColumns())),t.setModifierOptions(i).then(()=>e))).then(r=>(t.emit({type:"afterLoad",csv:r,detail:e,table:s}),t)).catch(r=>{throw t.emit({type:"loadError",detail:e,error:r,table:s}),r})}}return o.defaultOptions={csv:"",csvURL:"",enablePolling:!1,dataRefreshRate:1,firstRowAsNames:!0},t.registerType("CSV",o),o}),r(t,"Data/Converters/JSONConverter.js",[t["Data/Converters/DataConverter.js"],t["Data/DataTable.js"],t["Core/Utilities.js"]],function(e,t,r){let{error:s,isArray:o,merge:n,objectEach:i}=r;class l extends e{constructor(e){let r=n(l.defaultOptions,e);super(r),this.columns=[],this.headers=[],this.options=r,this.table=new t}parse(e,t){let{beforeParse:r,orientation:l,firstRowAsNames:a,columnNames:u}=e=n(this.options,e),h=e.data;if(h){if(this.columns=[],this.emit({type:"parse",columns:this.columns,detail:t,headers:this.headers}),r&&(h=r(h)),h=h.slice(),"columns"===l)for(let e=0,t=h.length;e{e[s]=r.reduce((e,t)=>e[t],t)}),t=e}this.table.setRows([t],e)}}}this.emit({type:"afterParse",columns:this.columns,detail:t,headers:this.headers})}}getTable(){return this.table}}return l.defaultOptions={...e.defaultOptions,data:[],orientation:"rows"},l}),r(t,"Data/Connectors/JSONConnector.js",[t["Data/Connectors/DataConnector.js"],t["Core/Utilities.js"],t["Data/Converters/JSONConverter.js"]],function(e,t,r){let{merge:s}=t;class o extends e{constructor(e){let t=s(o.defaultOptions,e);super(t),this.converter=new r(t),this.options=t,t.enablePolling&&this.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}load(e){let t=this,r=t.converter,s=t.table,{data:o,dataUrl:n,dataModifier:i}=t.options;return t.emit({type:"load",data:o,detail:e,table:s}),Promise.resolve(n?fetch(n).then(e=>e.json()):o||[]).then(e=>(e&&(s.deleteColumns(),r.parse({data:e}),s.setColumns(r.getTable().getColumns())),t.setModifierOptions(i).then(()=>e))).then(r=>(t.emit({type:"afterLoad",data:r,detail:e,table:s}),t)).catch(r=>{throw t.emit({type:"loadError",detail:e,error:r,table:s}),r})}}return o.defaultOptions={data:[],enablePolling:!1,dataRefreshRate:0,firstRowAsNames:!0,orientation:"rows"},e.registerType("JSON",o),o}),r(t,"Data/Converters/GoogleSheetsConverter.js",[t["Data/Converters/DataConverter.js"],t["Core/Utilities.js"]],function(e,t){let{merge:r,uniqueKey:s}=t;class o extends e{constructor(e){let t=r(o.defaultOptions,e);super(t),this.columns=[],this.header=[],this.options=t}parse(e,t){let o;let n=r(this.options,e),i=(n.json&&n.json.values||[]).map(e=>e.slice());if(0===i.length)return!1;this.header=[],this.columns=[],this.emit({type:"parse",columns:this.columns,detail:t,headers:this.header}),this.columns=i;for(let e=0,t=i.length;ee.json()).then(e=>{if("object"==typeof e&&e&&"object"==typeof e.error&&e.error&&"number"==typeof e.error.code&&"string"==typeof e.error.message&&"string"==typeof e.error.status)throw Error(e.error.message);return r.parse({firstRowAsNames:a,json:e}),s.deleteColumns(),s.setColumns(r.getTable().getColumns()),t.setModifierOptions(o)}).then(()=>(t.emit({type:"afterLoad",detail:e,table:s,url:m}),l&&setTimeout(()=>t.load(),1e3*Math.max(i||0,1)),t)).catch(r=>{throw t.emit({type:"loadError",detail:e,error:r,table:s}),r})}}return n.defaultOptions={googleAPIKey:"",googleSpreadsheetKey:"",worksheet:1,enablePolling:!1,dataRefreshRate:2,firstRowAsNames:!0},function(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(e={}){let{endColumn:r,endRow:s,googleSpreadsheetRange:n,startColumn:i,startRow:l}=e;return n||(t[i||0]||"A")+(Math.max(l||0,0)+1)+":"+(t[o(r,25)]||"Z")+(s?Math.max(s,0):"Z")}e.buildFetchURL=function(e,t,s={}){return`https://sheets.googleapis.com/v4/spreadsheets/${t}/values/`+(s.onlyColumnNames?"A1:Z1":r(s))+"?alt=json"+(s.onlyColumnNames?"":"&dateTimeRenderOption=FORMATTED_STRING&majorDimension=COLUMNS&valueRenderOption=UNFORMATTED_VALUE")+"&prettyPrint=false"+`&key=${e}`},e.buildQueryRange=r}(n||(n={})),e.registerType("GoogleSheets",n),n}),r(t,"Data/Converters/HTMLTableConverter.js",[t["Data/Converters/DataConverter.js"],t["Core/Utilities.js"]],function(e,t){let{merge:r}=t;class s extends e{constructor(e){let t=r(s.defaultOptions,e);super(t),this.columns=[],this.headers=[],this.options=t,t.tableElement&&(this.tableElement=t.tableElement,this.tableElementID=t.tableElement.id)}export(e,t=this.options){let r=!1!==t.firstRowAsNames,s=t.useMultiLevelHeaders,o=e.getSortedColumns(t.usePresentationOrder),n=Object.keys(o),i=[],l=n.length,a=[],u="";if(r){let e=[];if(s){for(let t of n){let r=(o[t].shift()||"").toString();e.push(r)}u=this.getTableHeaderHTML(n,e,t)}else u=this.getTableHeaderHTML(void 0,n,t)}for(let e=0;e"+a[s].join("")+"")}}let h="";return t.tableCaption&&(h=''+t.tableCaption+""),""+h+u+""+i.join("")+"
"}getCellHTMLFromValue(e,t,r,s,o){let n=s,i="text"+(t?" "+t:"");return"number"==typeof n?(n=n.toString(),","===o&&(n=n.replace(".",o)),i="number"):s||(n="",i="empty"),"<"+e+(r?" "+r:"")+' class="'+i+'">'+n+""}getTableHeaderHTML(e=[],t=[],r=this.options){let{useMultiLevelHeaders:s,useRowspanHeaders:o}=r,n="",i=0,l=t&&t.length,a,u=0,h;if(s&&e&&t&&!function(e,t){let r=e.length;if(t.length!==r)return!1;for(;--r;)if(e[r]!==t[r])return!1;return!0}(e,t)){for(n+="";i1?' valign="top" rowspan="'+h+'"':""),a));n+=""}if(t){for(n+="",i=0,l=t.length;i"}return n+""}parse(e,t){let s=[],o=[],n=r(this.options,e),{endRow:i,startColumn:l,endColumn:a,firstRowAsNames:u}=n,h=n.tableElement||this.tableElement;if(!(h instanceof HTMLElement)){this.emit({type:"parseError",columns:s,detail:t,headers:o,error:"Not a valid HTML Table"});return}this.tableElement=h,this.tableElementID=h.id,this.emit({type:"parse",columns:this.columns,detail:t,headers:this.headers});let m=h.getElementsByTagName("tr"),c=m.length,f=0,d,{startRow:p}=n;if(u&&c){let e=m[0].children,t=e.length;for(let r=l;ra);r++)("TD"===(d=e[r]).tagName||"TH"===d.tagName)&&o.push(d.innerHTML);p++}for(;f=p&&f<=i){let e=m[f].children,t=e.length,r=0;for(;r=l&&r<=a){s[t]||(s[t]=[]);let e=this.asGuessedType(d.innerHTML);e instanceof Date&&(e=e.getTime()),s[t][f-p]=e;let r=1;for(;f-p>=r&&void 0===o[f-p-r];)o[f-p-r]=null,r++}r++}}f++}this.columns=s,this.headers=o,this.emit({type:"afterParse",columns:s,detail:t,headers:o})}getTable(){return e.getTableFromColumns(this.columns,this.headers)}}return s.defaultOptions={...e.defaultOptions,useRowspanHeaders:!0,useMultiLevelHeaders:!0},s}),r(t,"Data/Connectors/HTMLTableConnector.js",[t["Data/Connectors/DataConnector.js"],t["Core/Globals.js"],t["Data/Converters/HTMLTableConverter.js"],t["Core/Utilities.js"]],function(e,t,r,s){let{win:o}=t,{merge:n}=s;class i extends e{constructor(e){let t=n(i.defaultOptions,e);super(t),this.converter=new r(t),this.options=t}load(e){let t;let r=this,s=r.converter,i=r.table,{dataModifier:l,table:a}=r.options;if(r.emit({type:"load",detail:e,table:i,tableElement:r.tableElement}),"string"==typeof a?(r.tableID=a,t=o.document.getElementById(a)):(t=a,r.tableID=t.id),r.tableElement=t||void 0,!r.tableElement){let t="HTML table not provided, or element with ID not found";return r.emit({type:"loadError",detail:e,error:t,table:i}),Promise.reject(Error(t))}return s.parse(n({tableElement:r.tableElement},r.options),e),i.deleteColumns(),i.setColumns(s.getTable().getColumns()),r.setModifierOptions(l).then(()=>(r.emit({type:"afterLoad",detail:e,table:i,tableElement:r.tableElement}),r))}}return i.defaultOptions={table:""},e.registerType("HTMLTable",i),i}),r(t,"Data/Modifiers/ChainModifier.js",[t["Data/Modifiers/DataModifier.js"],t["Core/Utilities.js"]],function(e,t){let{merge:r}=t;class s extends e{constructor(t,...o){super(),this.chain=o,this.options=r(s.defaultOptions,t);let n=this.options.chain||[];for(let t=0,r=n.length,s,i;to.modify(e.modified,t))}return(s=s.then(t=>(e.modified.deleteColumns(),e.modified.setColumns(t.modified.getColumns()),e))).catch(r=>{throw this.emit({type:"error",detail:t,table:e}),r})}modifyCell(e,t,r,s,o){let n=this.options.reverse?this.chain.reverse():this.chain;if(n.length){let i=e.clone();for(let e=0,l=n.length;e`${e}`),s={};for(let r=0,o=e.getRowCount(),n;r=0&&n.setColumn(s,this.processColumn(e,s));let i=this.options.columnFormulas||[];for(let r=0,o=i.length,l,a;r0?o:0);for(let s=0,o=i.length,l=[],a;s=0?s:0,o=o>=0?o:t.getRowCount()+o;let n=[],i=t.modified;for(let t=0,l=o-s;t0&&!r&&(t.deleteRows(),t.setRows(i),n=t.getColumns(),i=[]),h=n[u.column]||[];for(let s=0,n=h.length,l,a;s=u.minValue&&l<=u.maxValue&&(a=r?e.getRow(s):t.getRow(s))&&i.push(a)}}t.deleteRows(),t.setRows(i)}return this.emit({type:"afterModify",detail:t,table:e}),e}}return s.defaultOptions={type:"Range",ranges:[]},e.registerType("Range",s),s}),r(t,"Data/Modifiers/SortModifier.js",[t["Data/Modifiers/DataModifier.js"],t["Data/DataTable.js"],t["Core/Utilities.js"]],function(e,t,r){let{merge:s}=r;class o extends e{static ascending(e,t){return(e||0)<(t||0)?-1:(e||0)>(t||0)?1:0}static descending(e,t){return(t||0)<(e||0)?-1:(t||0)>(e||0)?1:0}constructor(e){super(),this.options=s(o.defaultOptions,e)}getRowReferences(e){let t=e.getRows(),r=[];for(let e=0,s=t.length;e-1&&(i&&r[l[0]].length?(e.modified.setColumns(r,s),e.modified.setColumn(i,this.modifyTable(new t({columns:e.getColumns([n,i])})).modified.getColumn(i))):this.modifyTable(e,o)),e}modifyRows(e,r,s,o){let{orderByColumn:n,orderInColumn:i}=this.options;return i&&r.length?(e.modified.setRows(r,s),e.modified.setColumn(i,this.modifyTable(new t({columns:e.getColumns([n,i])})).modified.getColumn(i))):this.modifyTable(e,o),e}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let r=e.getColumnNames(),s=e.getRowCount(),n=this.getRowReferences(e),{direction:i,orderByColumn:l,orderInColumn:a}=this.options,u="asc"===i?o.ascending:o.descending,h=r.indexOf(l),m=e.modified;if(-1!==h&&n.sort((e,t)=>u(e.row[h],t.row[h])),a){let e=[];for(let t=0;t