@deephaven/embed-chart 0.29.2-beta.0 → 0.30.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/App.730dc7d8.js +2 -0
- package/build/assets/App.730dc7d8.js.map +1 -0
- package/build/assets/App.a2eeb683.css +1 -0
- package/build/assets/{index.bfd797a6.css → index.4b16900b.css} +1 -1
- package/build/assets/index.68e7d47b.js +2 -0
- package/build/assets/index.68e7d47b.js.map +1 -0
- package/build/assets/{plotly.07dce3c8.js → plotly.ec77b778.js} +2 -2
- package/build/assets/{plotly.07dce3c8.js.map → plotly.ec77b778.js.map} +1 -1
- package/build/assets/{vendor.345ec474.js → vendor.cb50d8fc.js} +908 -908
- package/build/assets/vendor.cb50d8fc.js.map +1 -0
- package/build/index.html +4 -37
- package/package.json +13 -12
- package/build/assets/index.ae07dbcd.js +0 -2
- package/build/assets/index.ae07dbcd.js.map +0 -1
- package/build/assets/vendor.345ec474.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{A as z,R as ce,C as X,E as Ie,B as m,T as be,U as Me,V as re,I as Oe,H as se,F as _e}from"./vendor.cb50d8fc.js";import{C as Fe,a as Re,L as B,P as Pe,T as ke,d as Le,v as ve,b as $e,c as Ue}from"./index.68e7d47b.js";import{P as de,b as Ve,h as qe,p as He,o as Be,s as We,t as je,c as me}from"./plotly.ec77b778.js";import"./helpers.162e09a8.js";function ne(e){if(e==null)throw new Error("Value is null or undefined")}class ze{static join(t,r="and"){if(t==null||t.length===0)return"";if(t.length===1)return t[0];if(t.length===2)return`${t[0]} ${r} ${t[1]}`;const s=t.slice(0,t.length-1).join(", "),i=t[t.length-1];return`${s}, ${r} ${i}`}static toLower(t,r=!0){if(t==null){if(r)return"";throw new Error("Null string passed in to TextUtils.toLower")}return t.toLowerCase()}static sort(t,r,s=!0){return t<r?s?-1:1:t>r?s?1:-1:0}}class Xe extends z.exports.Component{constructor(t){super(t),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=ce.createRef(),this.openMenu=ce.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(t){if(!Fe.isContextActionEvent(t)||!this.container.current||t.metaKey||t.ctrlKey)return;const r=Fe.getMenuItems(t.contextActions),s=this.container.current.getBoundingClientRect(),i=t.clientY-s.top,n=t.clientX-s.left;if(r.length===0){if(t.target===this.container.current){t.preventDefault(),this.setState({actions:null},()=>{const a=document.elementFromPoint(n,i),o=new MouseEvent("contextmenu",{clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0});a==null||a.dispatchEvent(o)});return}return}t.preventDefault(),this.setState({actions:r,top:i,left:n})}handleMenuClose(t){t===this.openMenu.current&&this.setState({actions:null})}render(){let t=null;const{"data-testid":r}=this.props,{actions:s,top:i,left:n}=this.state;return s&&(t=X(Re,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:n,updatePosition:(a,o)=>{this.setState({top:a,left:o})},"data-testid":r})),X("div",{className:Ie("context-menu-root",{active:s}),ref:this.container,children:t})}}class N{static isValid(t){return!0}static isSameFormat(t,r){throw new Error("isSameFormat not implemented")}static makeFormat(t,r,s){return{label:t,formatString:r,type:s}}format(t,r){return""}}N.TYPE_GLOBAL="type-global";N.TYPE_CONTEXT_PRESET="type-context-preset";N.TYPE_CONTEXT_CUSTOM="type-context-custom";class Ze extends N{format(t){switch(t){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Ge extends N{format(t){return String.fromCharCode(t)}}const{dh:u}=globalThis,pe=m.exports.shape({name:m.exports.string.isRequired,type:m.exports.string.isRequired,description:m.exports.string,constituentType:m.exports.string}),Ce=m.exports.shape({not:m.exports.func.isRequired,and:m.exports.func.isRequired,or:m.exports.func.isRequired}),Ye=m.exports.shape({asc:m.exports.func.isRequired,desc:m.exports.func.isRequired,abs:m.exports.func.isRequired,column:pe.isRequired,direction:m.exports.string.isRequired,isAbs:m.exports.bool.isRequired}),Qe=m.exports.shape({columns:m.exports.arrayOf(pe).isRequired,customColumns:m.exports.arrayOf(m.exports.string).isRequired,filter:m.exports.arrayOf(Ce),addEventListener:m.exports.func.isRequired,removeEventListener:m.exports.func.isRequired,size:m.exports.number.isRequired,sort:m.exports.arrayOf(m.exports.any),copy:m.exports.func.isRequired,applyFilter:m.exports.func.isRequired,applySort:m.exports.func.isRequired,applyCustomColumns:m.exports.func.isRequired,description:m.exports.string}),Ke=m.exports.shape({columns:m.exports.arrayOf(pe),filter:m.exports.arrayOf(m.exports.any),isExpanded:m.exports.func.isRequired,saveExpandedState:m.exports.func.isRequired,addEventListener:m.exports.func.isRequired,removeEventListener:m.exports.func.isRequired,size:m.exports.number.isRequired,sort:m.exports.arrayOf(m.exports.any),applyFilter:m.exports.func.isRequired,applySort:m.exports.func.isRequired}),ue=m.exports.shape({name:m.exports.string.isRequired,type:m.exports.string.isRequired}),Je=m.exports.shape({created:m.exports.arrayOf(ue).isRequired,updated:m.exports.arrayOf(ue).isRequired,removed:m.exports.arrayOf(ue).isRequired}),et=m.exports.shape({groupingColumns:m.exports.arrayOf(m.exports.string),aggregations:m.exports.shape({}),includeConstituents:m.exports.bool,includeOriginalColumns:m.exports.bool,includeDescriptions:m.exports.bool}),tt=m.exports.shape({addEventListener:m.exports.func.isRequired,removeEventListener:m.exports.func.isRequired,onLogMessage:m.exports.func,getTable:m.exports.func.isRequired,runCode:m.exports.func.isRequired});Object.freeze({Column:pe,FilterCondition:Ce,IdeSession:tt,RollupConfig:et,Sort:Ye,Table:Qe,TreeTable:Ke,VariableChanges:Je,VariableDefinition:ue});dh;const De=B.module("DateTimeColumnFormatter"),j=class extends N{constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:r=!1,defaultDateTimeFormatString:s=j.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=e||j.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=u.i18n.TimeZone.getTimeZone(i)}catch{De.error("Unsupported time zone id",i),this.dhTimeZone=u.i18n.TimeZone.getTimeZone(j.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=r,this.formatStringMap=j.makeFormatStringMap(t,r)}static isValid(e){try{return u.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,r=N.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const r=t?"'T'":" ",s=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${r}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${r}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${r}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(e,t){return[...j.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const r=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${r}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${r}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${r}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(e,t){return[...j.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!=null?t:e}format(e,t={}){const r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(r);try{return u.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{De.error("Invalid format arguments")}return""}};let Ee=j;Ee.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";Ee.DEFAULT_TIME_ZONE_ID="America/New_York";const rt=B.module("DecimalColumnFormatter"),R=class extends N{constructor({defaultFormatString:e=R.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return u.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,r=N.TYPE_CONTEXT_PRESET,s){return{label:e,type:r,formatString:t,multiplier:s}}static makePresetFormat(e,t="",r){return R.makeFormat(e,t,N.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(e="",t){return R.makeFormat("Custom Format",e,N.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return u.i18n.NumberFormat.format(r,s)}catch{rt.error("Invalid format arguments")}return""}};let V=R;V.DEFAULT_FORMAT_STRING="###,##0.0000";V.FORMAT_PERCENT=R.makePresetFormat("Percent","##0.00%");V.FORMAT_BASIS_POINTS=R.makePresetFormat("Basis Points","###,##0 bp",1e4);V.FORMAT_MILLIONS=R.makePresetFormat("Millions","###,##0.000 mm",1e-6);V.FORMAT_SCIENTIFIC_NOTATION=R.makePresetFormat("Scientific Notation","0.0000E0");V.FORMAT_ROUND=R.makePresetFormat("Round","###,##0");V.FORMAT_ROUND_TWO_DECIMALS=R.makePresetFormat("0.00","###,##0.00");V.FORMAT_ROUND_FOUR_DECIMALS=R.makePresetFormat("0.0000","###,##0.0000");class st extends N{format(t){return`${t}`}}const nt=B.module("IntegerColumnFormatter"),K=class extends N{constructor({defaultFormatString:e=K.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return u.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,r=N.TYPE_CONTEXT_PRESET,s){return{label:e,type:r,formatString:t,multiplier:s}}static makePresetFormat(e,t="",r){return K.makeFormat(e,t,N.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(e="",t){return K.makeFormat("Custom Format",e,N.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return u.i18n.NumberFormat.format(r,s)}catch{nt.error("Invalid format arguments")}return""}};let he=K;he.DEFAULT_FORMAT_STRING="###,##0";he.FORMAT_MILLIONS=K.makePresetFormat("Millions","###,##0.000 mm",1e-6);he.FORMAT_SCIENTIFIC_NOTATION=K.makePresetFormat("Scientific Notation","0.0000E0");class it extends N{format(t){return t}}const I=class{static makeDateWrapper(e,t,r=0,s=1,i=0,n=0,a=0,o=0){if(!e)throw new Error("No timezone provided");const l=`${t}`.padStart(4,"0"),c=`${r+1}`.padStart(2,"0"),g=`${s}`.padStart(2,"0"),f=`${i}`.padStart(2,"0"),y=`${n}`.padStart(2,"0"),T=`${a}`.padStart(2,"0"),S=`${o}`.padStart(9,"0"),F=`${l}-${c}-${g} ${f}:${y}:${T}.${S}`;return u.i18n.DateTimeFormat.parse(I.FULL_DATE_FORMAT,F,u.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),r="0".repeat(9-e.length),s=`${t+1}${r}`;return parseInt(s,10)}static getNextDate(e,t,r){let{year:s,month:i,date:n,hours:a,minutes:o,seconds:l,nanos:c}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;c=I.getNextNanos(e.nanos),c>999999999&&(l+=1,c=0)}else e.seconds!=null?l+=1:e.minutes!=null?o+=1:e.hours!=null?a+=1:e.date!=null?n+=1:e.month!=null?i+=1:s+=1;const g=new Date(s,i,n,a,o,l);return I.makeDateWrapper(r,g.getFullYear(),g.getMonth(),g.getDate(),g.getHours(),g.getMinutes(),g.getSeconds(),c)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const r=e.trim().toLowerCase();if(r.length>=3){for(let s=0;s<I.months.length;s+=1)if(I.months[s].startsWith(r))return s}return NaN}static parseDateValues(e,t,r,s,i,n,a){const o=parseInt(e,10),l=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,g=s!=null?parseInt(s,10):0,f=i!=null?parseInt(i,10):0,y=n!=null?parseInt(n,10):0,T=a!=null?parseInt(a.padEnd(9,"0"),10):0;return Number.isNaN(o)||Number.isNaN(l)||Number.isNaN(c)||Number.isNaN(g)||Number.isNaN(f)||Number.isNaN(y)||Number.isNaN(T)?null:{year:o,month:l,date:c,hours:g,minutes:f,seconds:y,nanos:T}}static parseDateTimeString(e){const r=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(r==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,i,,n,,a,,o,,l,,c,g]=r;if(g!=null&&g.length>0)throw new Error(`Unexpected characters after date string '${e}': ${g}`);return{year:s,month:i,date:n,hours:a,minutes:o,seconds:l,nanos:c}}static parseDateRange(e,t){const r=e.trim().toLowerCase();if(r.length===0)throw new Error("Cannot parse date range from empty string");if(r==="null")return[null,null];if(r==="today"){const o=new Date(Date.now()),l=I.makeDateWrapper(t,o.getFullYear(),o.getMonth(),o.getDate()),c=I.makeDateWrapper(t,o.getFullYear(),o.getMonth(),o.getDate()+1);return[l,c]}if(r==="yesterday"){const o=new Date(Date.now()),l=I.makeDateWrapper(t,o.getFullYear(),o.getMonth(),o.getDate()-1),c=I.makeDateWrapper(t,o.getFullYear(),o.getMonth(),o.getDate());return[l,c]}if(r==="now"){const o=new Date(Date.now());return[u.DateWrapper.ofJsDate(o),null]}const s=I.parseDateTimeString(r);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${r}`);const i=I.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(i==null)throw new Error(`Unable to extract date values from ${s}`);const n=I.makeDateWrapper(t,i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos),a=I.getNextDate(s,i,t);return[n,a]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}};let oe=I;oe.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";oe.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class le{}le.not="not";le.and="and";le.or="or";class p{}p.eq="eq";p.eqIgnoreCase="eqIgnoreCase";p.notEq="notEq";p.notEqIgnoreCase="notEqIgnoreCase";p.greaterThan="greaterThan";p.greaterThanOrEqualTo="greaterThanOrEqualTo";p.lessThan="lessThan";p.lessThanOrEqualTo="lessThanOrEqualTo";p.in="in";p.inIgnoreCase="inIgnoreCase";p.notIn="notIn";p.notInIgnoreCase="notInIgnoreCase";p.isTrue="isTrue";p.isFalse="isFalse";p.isNull="isNull";p.invoke="invoke";p.contains="contains";p.notContains="notContains";p.startsWith="startsWith";p.endsWith="endsWith";p.containsAny="containsAny";const $=B.module("TableUtils"),h=class{static getSortIndex(e,t){var r;for(let s=0;s<e.length;s+=1)if(((r=e[s].column)==null?void 0:r.index)===t)return s;return null}static getSortForColumn(e,t){const r=h.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return h.isBooleanType(e)?[p.isTrue,p.isFalse,p.isNull]:h.isCharType(e)||h.isNumberType(e)||h.isDateType(e)?[p.eq,p.notEq,p.greaterThan,p.greaterThanOrEqualTo,p.lessThan,p.lessThanOrEqualTo]:h.isTextType(e)?[p.eq,p.eqIgnoreCase,p.notEq,p.notEqIgnoreCase,p.contains,p.notContains,p.startsWith,p.endsWith]:[]}static getNextSort(e,t,r){if(e==null||r<0||r>=e.length)return null;const s=h.getSortForColumn(t,r);return s===null?e[r].sort().asc():s.direction===h.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,r,s){if(e==null||t<0||t>=e.length||r===h.sortDirection.none)return null;let i=e[t].sort();switch(r){case h.sortDirection.ascending:i=i.asc();break;case h.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(e,t,r,s=!1){if(r<0||r>=t.length)return[];const i=h.getNextSort(t,e,r);return h.setSortForColumn(e,r,i,s)}static sortColumn(e,t,r,s,i,n){if(e==null||r<0||r>=t.length)return[];const a=h.makeColumnSort(t,r,s,i);return h.setSortForColumn(e,r,a,n)}static setSortForColumn(e,t,r,s=!1){const i=h.getSortIndex(e,t);let n=[];return s&&(n=n.concat(e.filter(({direction:a})=>a!==h.sortDirection.reverse)),i!==null&&n.splice(i,1)),r!==null&&n.push(r),n}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case h.dataType.BOOLEAN:return h.dataType.BOOLEAN;case"char":case"java.lang.Character":case h.dataType.CHAR:return h.dataType.CHAR;case"java.lang.String":case h.dataType.STRING:return h.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case h.dataType.DATETIME:return h.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case h.dataType.DECIMAL:return h.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case h.dataType.INT:return h.dataType.INT;default:return h.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return h.isIntegerType(e)||h.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return h.getNormalizedType(e)===h.getNormalizedType(t)}static makeQuickFilter(e,t,r){const s=t.split("||");let i=null;for(let n=0;n<s.length;n+=1){const o=s[n].split("&&");let l=null;for(let c=0;c<o.length;c+=1){const g=o[c].trim();if(g.length>0){const f=h.makeQuickFilterFromComponent(e,g,r);if(f)l?l=l.and(f):l=f;else throw new Error(`Unable to parse quick filter from text ${t}`)}}i&&l?i=i.or(l):i=l}return i}static makeQuickFilterFromComponent(e,t,r){const{type:s}=e;return h.isNumberType(s)?this.makeQuickNumberFilter(e,t):h.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):r!=null&&h.isDateType(s)?this.makeQuickDateFilter(e,t,r):h.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){if(t==null)return null;const r=e.filter();let s=null;const n=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let a=null,o=null,l=null,c=null,g=null;if(n!==null&&n.length>3&&([,a,o,l,c,g]=n),g!=null&&g.trim().length>0)return null;if(a==null&&(a="="),c!=null){if(!(a==="="||a==="!"||a==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":s=r.isNull();break;case"nan":s=u.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"\u221E":o!=null?s=u.FilterCondition.invoke("isInf",r).and(r.lessThan(u.FilterValue.ofNumber(0))):s=u.FilterCondition.invoke("isInf",r).and(r.greaterThan(u.FilterValue.ofNumber(0)));break}return s!==null&&(a==="!"||a==="!=")&&(s=s.not()),s}if(l==null)return null;if(l=h.removeCommas(l),h.isLongType(e.type))try{l=u.FilterValue.ofNumber(u.LongWrapper.ofString(`${o!=null?"-":""}${l}`))}catch(f){return $.warn("Unable to create long filter",f),null}else{if(l=parseFloat(l),l==null||Number.isNaN(l))return null;l=u.FilterValue.ofNumber(o!=null?0-l:l)}return s=e.filter(),h.makeRangeFilterWithOperation(s,a,l)}static makeQuickTextFilter(e,t){if(t==null)return null;const r=`${t}`.trim(),i=/^(!~|!=|~|=|!)?(.*)/.exec(r);let n=null,a=null;if(i!==null&&i.length>2&&([,n,a]=i,a!=null&&(a=a.trim())),a==null||a.length===0)return null;n==null&&(n="=");const o=e.filter();if(a.toLowerCase()==="null")switch(n){case"=":return o.isNull();case"!=":case"!":return o.isNull().not();default:return null}let l=null,c=null;switch(a.startsWith("*")?(l="*",a=a.substring(1)):a.endsWith("*")&&!a.endsWith("\\*")&&(c="*",a=a.substring(0,a.length-1)),a=a.replace("\\",""),n){case"~":return o.isNull().not().and(o.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${a}\\E.*`)));case"!~":return o.isNull().or(o.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${a}\\E.*`)).not());case"!=":return l==="*"?o.isNull().or(o.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${a}\\E$`)).not()):c==="*"?o.isNull().or(o.invoke("matches",u.FilterValue.ofString(`(?s)(?i)^\\Q${a}\\E.*`)).not()):o.notEqIgnoreCase(u.FilterValue.ofString(a.toLowerCase()));case"=":return l==="*"?o.isNull().not().and(o.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${a}\\E$`))):c==="*"?o.isNull().not().and(o.invoke("matches",u.FilterValue.ofString(`(?s)(?i)^\\Q${a}\\E.*`))):o.eqIgnoreCase(u.FilterValue.ofString(a.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){if(t==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,i,n]=s,a=i==="!"||i==="!=",o=n.trim().toLowerCase();let l=e.filter();try{const c=h.makeBooleanValue(o);return c!=null&&c?l=l.isTrue():c===null?l=l.isNull():l=l.isFalse(),a?l.not():l}catch{return null}}static makeQuickDateFilter(e,t,r){const s=t.trim(),n=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(n==null||n.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let a=null,o=null;[,a,o]=n;let l=p.eq;switch(a){case"<":l=p.lessThan;break;case"<=":case"=<":l=p.lessThanOrEqualTo;break;case">":l=p.greaterThan;break;case">=":case"=>":l=p.greaterThanOrEqualTo;break;case"!=":case"!":l=p.notEq;break;case"=":case"==":default:l=p.eq;break}return h.makeQuickDateFilterWithOperation(e,o,l,r)}static makeQuickDateFilterWithOperation(e,t,r,s){if(e==null)throw new Error("Column is null");const[i,n]=oe.parseDateRange(t,s),a=i!=null?u.FilterValue.ofNumber(i):null,o=n!=null?u.FilterValue.ofNumber(n):null,l=e.filter();if(a==null)return r===p.notEq?l.isNull().not():l.isNull();switch(r){case p.eq:{if(o!=null){const c=l.greaterThanOrEqualTo(a),g=l.lessThan(o);return c.and(g)}return l.eq(a)}case p.lessThan:return l.lessThan(a);case p.lessThanOrEqualTo:return o!=null?l.lessThan(o):l.lessThanOrEqualTo(a);case p.greaterThan:return o!=null?l.greaterThanOrEqualTo(o):l.greaterThan(a);case p.greaterThanOrEqualTo:return l.greaterThanOrEqualTo(a);case p.notEq:{if(o!=null){const c=l.lessThan(a),g=l.greaterThanOrEqualTo(o);return c.or(g)}return l.notEq(a)}default:throw new Error(`Invalid operator: ${r}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){if(t==null)return null;const r=`${t}`.trim(),i=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(r);let n=null,a=null,o=null;if(i!==null&&i.length>3&&([,n,a,o]=i),o!=null&&o.trim().length>0||a==null||a.length===0)return null;n==null&&(n="=");const l=e.filter();if(a.toLowerCase()==="null")switch(n){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}const c=u.FilterValue.ofString(h.isRangeOperation(n)?h.quoteValue(a):a);return h.makeRangeFilterWithOperation(l,n,c)}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return Pe.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,r=0,s=null){let i,n,a=!0;const o=new Promise((l,c)=>{n=setTimeout(()=>{i(),a=!1,c(new ke(`Event "${t}" timed out.`))},r),i=e.addEventListener(t,g=>{if(s!=null&&!s(g)){$.debug2("Event triggered, but matcher returned false.");return}$.debug2("Event triggered, resolving."),i(),clearTimeout(n),a=!1,l(g)})});return o.cancel=()=>{if(a){$.debug2("Pending promise cleanup."),i(),clearTimeout(n),a=!1;return}$.debug2("Ignoring non-pending promise cancel.")},o}static makeAdvancedFilter(e,t,r){const{filterItems:s,filterOperators:i,invertSelection:n,selectedValues:a}=t;let o=null;for(let c=0;c<s.length;c+=1){const g=s[c],{selectedType:f,value:y}=g;if(f!=null&&f.length>0&&y!=null&&y.length>0)try{const T=h.makeAdvancedValueFilter(e,f,y,r);if(T!=null){if(c===0)o=T;else if(o!==null&&c-1<i.length){const S=i[c-1];if(S===le.and)o=o.and(T);else if(S===le.or)o=o.or(T);else{$.error("Unexpected filter operator",S,T),o=null;break}}}else $.debug2("Empty filter ignored for",f,y)}catch(T){$.error("Unable to create filter",T),o=null;break}}const l=h.makeSelectValueFilter(e,a,n);return l!=null&&(o!=null?o=o.and(l):o=l),o}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const r=h.getBaseType(e);return h.isTextType(r)?u.FilterValue.ofString(t):h.isLongType(r)?u.FilterValue.ofNumber(u.LongWrapper.ofString(h.removeCommas(t))):u.FilterValue.ofNumber(h.removeCommas(t))}static makeFilterRawValue(e,t){return h.isTextType(e)?u.FilterValue.ofString(t):h.isBooleanType(e)?u.FilterValue.ofBoolean(t):u.FilterValue.ofNumber(t)}static makeValue(e,t,r){if(t==null||t==="null")return null;if(h.isTextType(e))return t;if(h.isLongType(e))return u.LongWrapper.ofString(h.removeCommas(t));if(h.isBooleanType(e))return h.makeBooleanValue(t,!0);if(h.isDateType(e)){const[s]=oe.parseDateRange(t,r);return s}return h.isNumberType(e)?h.makeNumberValue(t):($.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${e}'`)}}static makeNumberValue(e){if(e==null||e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="\u221E"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-\u221E"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const r=h.removeCommas(t);if(h.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case p.eq:return"=";case p.notEq:return"!=";case p.greaterThan:return">";case p.greaterThanOrEqualTo:return">=";case p.lessThan:return"<";case p.lessThanOrEqualTo:return"<=";case p.contains:return"~";case p.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,r,s){if(h.isDateType(e.type))return h.makeQuickDateFilterWithOperation(e,r,t,s);if(h.isNumberType(e.type)||h.isCharType(e.type))return h.makeQuickFilter(e,`${h.getFilterOperatorString(t)}${r}`);const i=h.makeFilterValue(e.type,r),n=e.filter();switch(t){case p.eq:return n.eq(i);case p.eqIgnoreCase:return n.eqIgnoreCase(i);case p.notEq:return n.notEq(i);case p.notEqIgnoreCase:return n.notEqIgnoreCase(i);case p.greaterThan:return n.greaterThan(i);case p.greaterThanOrEqualTo:return n.greaterThanOrEqualTo(i);case p.lessThan:return n.lessThan(i);case p.lessThanOrEqualTo:return n.lessThanOrEqualTo(i);case p.isTrue:return n.isTrue();case p.isFalse:return n.isFalse();case p.isNull:return n.isNull();case p.contains:return n.isNull().not().and(n.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case p.notContains:return n.isNull().or(n.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case p.startsWith:return n.isNull().not().and(n.invoke("matches",u.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)));case p.endsWith:return n.isNull().not().and(n.invoke("matches",u.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)));case p.in:case p.inIgnoreCase:case p.notIn:case p.notInIgnoreCase:case p.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,r){if(t.length===0){if(r)return null;let n=null;h.isTextType(e.type)?n=u.FilterValue.ofString("a"):h.isBooleanType(e.type)?n=u.FilterValue.ofBoolean(!0):h.isDateType(e.type)?n=u.FilterValue.ofNumber(u.DateWrapper.ofJsDate(new Date)):n=u.FilterValue.ofNumber(0);const a=e.filter().eq(n),o=e.filter().notEq(n);return a.and(o)}const s=[];let i=!1;for(let n=0;n<t.length;n+=1){const a=t[n];a==null?i=!0:h.isTextType(e.type)?s.push(u.FilterValue.ofString(typeof a=="number"?String.fromCharCode(a):a)):h.isBooleanType(e.type)?s.push(u.FilterValue.ofBoolean(Boolean(a))):s.push(u.FilterValue.ofNumber(a))}return i?s.length>0?r?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((r,s)=>{const i=r.name.toUpperCase(),n=s.name.toUpperCase();return ze.sort(i,n,t)})}};let A=h;A.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};A.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};A.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});A.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class ye{static makeColumnFormatMap(t){return t==null?new Map:t.reduce((r,s)=>{const i=A.getNormalizedType(s.columnType);if(i===null)return r;r.has(i)||r.set(i,new Map);const n=r.get(i);return n==null||n.set(s.columnName,s.format),r},new Map)}static makeColumnFormattingRule(t,r,s){return{columnType:t,columnName:r,format:s}}constructor(t=[],r,s,i,n=!1){this.defaultColumnFormatter=new st,this.typeFormatterMap=new Map([[A.dataType.BOOLEAN,new Ze],[A.dataType.CHAR,new Ge],[A.dataType.DATETIME,new Ee(r)],[A.dataType.DECIMAL,new V(s)],[A.dataType.INT,new he(i)],[A.dataType.STRING,new it]]),this.columnFormatMap=ye.makeColumnFormatMap(t),this.truncateNumbersWithPound=n}getColumnFormatMapForType(t,r=!1){const s=A.getNormalizedType(t);if(s!==null)return r&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(t,r){var i;const s=this.getColumnFormatMapForType(t);return(i=s==null?void 0:s.get(r))!=null?i:null}getColumnTypeFormatter(t){var i;const r=A.getNormalizedType(t);let s=this.defaultColumnFormatter;return r&&(s=(i=this.typeFormatterMap.get(r))!=null?i:s),s}getFormattedString(t,r,s="",i){if(t==null)return"";const n=this.getColumnTypeFormatter(r),a=i||this.getColumnFormat(r,s);return n.format(t,a!=null?a:void 0)}get timeZone(){var r;const t=this.typeFormatterMap.get(A.dataType.DATETIME);return(r=t==null?void 0:t.dhTimeZone)==null?void 0:r.id}}function at(e){if(e&&e.formatter){const{formatter:t}=e;return t}}function ot(e){return{timeZone:e==null?void 0:e.timeZone,defaultDateTimeFormatString:e==null?void 0:e.defaultDateTimeFormat,showTimeZone:e==null?void 0:e.showTimeZone,showTSeparator:e==null?void 0:e.showTSeparator}}function lt(e,t,r){const s=e.getColumnFormat(r,t);return s!=null&&(s.type===N.TYPE_CONTEXT_PRESET||s.type===N.TYPE_CONTEXT_CUSTOM)}const fe={getColumnFormats:at,getDateTimeFormatterOptions:ot,isCustomColumnFormatDefined:lt};de.register([Ve,qe,He,Be,We,je]);const ut=typeof me=="function"?me(de):me.default(de),U=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(let t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(U.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(U.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(U.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(U.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(U.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(U.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(U.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(U.EVENT_LOADFINISHED))}};let b=U;b.EVENT_UPDATED="ChartModel.EVENT_UPDATED";b.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";b.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";b.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";b.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";b.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";b.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";b.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const ct="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",dt="#403e41",pt="#5b5a5c",ht="#c0bfbf",gt="#4878ea",mt="rgba(91, 90, 92, 0.7)",C={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:ct,gridcolor:dt,linecolor:pt,zerolinecolor:ht,activecolor:gt,rangebgcolor:mt,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},k=Object.freeze({paper_bgcolor:C["paper-bgcolor"],plot_bgcolor:C["plot-bgcolor"],title_color:C["title-color"],colorway:C.colorway,gridcolor:C.gridcolor,linecolor:C.linecolor,zerolinecolor:C.zerolinecolor,activecolor:C.activecolor,rangebgcolor:C.rangebgcolor,area_color:C["area-color"],trend_color:C["trend-color"],line_color:C["line-color"],error_band_line_color:C["error-band-line-color"],error_band_fill_color:C["error-band-fill-color"],ohlc_increasing:C["ohlc-increasing"],ohlc_decreasing:C["ohlc-decreasing"]}),ie=B.module("ChartUtils"),q=Object.freeze(u.calendar.DayOfWeek.values()),Ne="io.deephaven.time.DateTime",ft=36e5,Tt=1e6;function Et(e){return e.asDate!==void 0}function yt(e){return e.asNumber!==void 0}function Ae(e){return e.dhTimeZone!==void 0}function St(e){return e!=null&&e.range!=null&&(e.autorange===!1||e.autorange===void 0)}const d=class{static getPlotlyChartType(e,t){switch(e){case u.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case u.plot.SeriesPlotStyle.LINE:return"scatter";case u.plot.SeriesPlotStyle.BAR:case u.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case u.plot.SeriesPlotStyle.PIE:return"pie";case u.plot.SeriesPlotStyle.TREEMAP:return"treemap";case u.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case u.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(e,t,r){const s=new Set;switch(e){case u.plot.SeriesPlotStyle.SCATTER:t!=null&&t&&s.add(d.MODE_LINES),(r==null||r)&&s.add(d.MODE_MARKERS);break;case u.plot.SeriesPlotStyle.LINE:(t==null||t)&&s.add(d.MODE_LINES),r!=null&&r&&s.add(d.MODE_MARKERS);break}return s.size>0?[...s].join("+"):void 0}static getPlotlyProperty(e,t){switch(e){case u.plot.SeriesPlotStyle.PIE:switch(t){case u.plot.SourceType.X:return"labels";case u.plot.SourceType.Y:return"values"}break;case u.plot.SeriesPlotStyle.OHLC:switch(t){case u.plot.SourceType.TIME:return"x"}break;case u.plot.SeriesPlotStyle.TREEMAP:switch(t){case u.plot.SourceType.X:return"ids";case u.plot.SourceType.Y:return"values";case u.plot.SourceType.LABEL:return"labels";case u.plot.SourceType.PARENT:return"parents";case u.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case u.plot.SourceType.X:return"x";case u.plot.SourceType.Y:return"y";case u.plot.SourceType.Z:return"z";case u.plot.SourceType.X_LOW:return"xLow";case u.plot.SourceType.X_HIGH:return"xHigh";case u.plot.SourceType.Y_LOW:return"yLow";case u.plot.SourceType.Y_HIGH:return"yHigh";case u.plot.SourceType.TIME:return"time";case u.plot.SourceType.OPEN:return"open";case u.plot.SourceType.HIGH:return"high";case u.plot.SourceType.LOW:return"low";case u.plot.SourceType.CLOSE:return"close";case u.plot.SourceType.SHAPE:return"shape";case u.plot.SourceType.SIZE:return"size";case u.plot.SourceType.LABEL:return"label";case u.plot.SourceType.COLOR:return"color";case u.plot.SourceType.PARENT:return"parent";case u.plot.SourceType.HOVER_TEXT:return"hovertext";case u.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${t}`)}}static getPlotlySeriesOrientation(e){var r,s;const{sources:t}=e;return t.length===2&&((s=(r=t[0])==null?void 0:r.axis)==null?void 0:s.type)===u.plot.AxisType.Y?d.ORIENTATION.HORIZONTAL:d.ORIENTATION.VERTICAL}static getPlotlyErrorBars(e,t,r){const s=r.map((n,a)=>n-e[a]),i=t.map((n,a)=>e[a]-n);return{type:"data",symmetric:!1,array:s,arrayminus:i}}static getPlotlyDateFormat(e,t,r){const s=r==null?void 0:r.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let i;const n=e==null?void 0:e.getColumnTypeFormatter(t);return n!=null&&Ae(n)&&n.dhTimeZone!=null&&n.showTimeZone&&(i=u.i18n.DateTimeFormat.format(" z",new Date,n.dhTimeZone)),{tickformat:s,ticksuffix:i,automargin:!0}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;const i=r.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);ne(i);const[,n,a,o,,l,c,g,f,y]=i,T=o.replace(",","").length,F=a.indexOf(",")>=0||o.indexOf(",")>=0?",":"",D=g!=null&&g!==""?"e":"f",w=f!==""?f:D,M=l.length+c.length,_=`0${T}${F}.${M}${w}`,L=d.convertNumberPrefix(n),v=d.convertNumberPrefix(y);return{tickformat:_,tickprefix:L,ticksuffix:v,automargin:!0}}static getPlotlyAxisFormat(e,t=null){const{axis:r,columnType:s}=e,{formatPattern:i}=r;let n=null;return A.isDateType(s)?(n=d.getPlotlyDateFormat(t,s,i),n=d.addTickSpacing(n,r,!0)):A.isNumberType(s)&&(n=d.getPlotlyNumberFormat(t,s,i),n=d.addTickSpacing(n,r,!1)),r.formatType===u.plot.AxisFormatType.CATEGORY&&(n?n.type="category":n={type:"category",tickformat:void 0,ticksuffix:void 0}),n}static addTickSpacing(e,t,r){const{gapBetweenMajorTicks:s}=t;if(s>0){const i=e||{};let n=s;return r&&(n=s/Tt),t.log&&(n=Math.log(n)),i.tickmode="linear",i.dtick=n,i}return e}static getSourceForAxis(e,t){for(let r=0;r<e.series.length;r+=1){const s=e.series[r];for(let i=0;i<s.sources.length;i+=1){const n=s.sources[i];if(n.axis===t)return n}}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,r,s,i=d.ORIENTATION.VERTICAL){return{type:e,mode:t,name:r,orientation:i,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(e,t,r,s=null,i=k){const{name:n,isLinesVisible:a,isShapesVisible:o,plotStyle:l,lineColor:c,shapeColor:g,sources:f,shape:y,shapeSize:T}=e,S=f.some(O=>{var _;return(_=O.axis)==null?void 0:_.businessCalendar}),F=d.getChartType(l,S),D=d.getPlotlyChartMode(l,a!=null?a:void 0,o!=null?o:void 0),w=d.getPlotlySeriesOrientation(e),M=d.makeSeriesData(F,D,n,s,w);return d.addSourcesToSeriesData(M,l,f,t),d.addStylingToSeriesData(M,l,i,c,g,y,T,r),M}static addSourcesToSeriesData(e,t,r,s){const i=e;for(let n=0;n<r.length;n+=1){const a=r[n],{axis:o,type:l}=a,c=d.getPlotlyProperty(t,l);be(i,c,[]);const g=o!=null?d.getAxisPropertyName(o.type):null;if(g!=null){const f=s.get(o.type);if(f){const y=f.indexOf(o),T=y>0?`${y+1}`:"";i[`${g}axis`]=`${g}${T}`}}}}static addStylingToSeriesData(e,t,r=k,s=null,i=null,n=null,a=null,o=null){const l=e;if(l.marker={line:{}},l.line={width:1},t===u.plot.SeriesPlotStyle.AREA?l.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?l.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?l.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(l.width=[],l.marker.line!==void 0&&Object.assign(l.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(l.increasing={line:{color:r.ohlc_increasing}},l.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(l.textinfo="label+percent",l.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(l.hoverinfo="text",l.textinfo="label+text",l.tiling={packing:"squarify",pad:0},l.textposition="middle center",l.outsidetextfont={color:r.title_color}),s!=null&&(t===u.plot.SeriesPlotStyle.BAR?l.marker.color=s:l.line.color=s),i!=null&&(l.marker.color=i),n!=null&&n.length>0)try{l.marker.symbol=d.getMarkerSymbol(n)}catch(c){ie.warn("Unable to handle shape",n,":",c)}a!=null&&(l.marker.size=a*d.DEFAULT_MARKER_SIZE),o!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(l.visible=o)}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error(`Unrecognized shape ${e}`)}}static getAxisFormats(e,t){const r=new Map,s={tickformat:null,ticksuffix:null},i=d.getAllAxes(e),n=d.groupArray(i,"type"),{charts:a}=e;for(let o=0;o<a.length;o+=1){const l=a[o];for(let c=0;c<l.series.length;c+=1){const g=l.series[c],{sources:f}=g,y=f.filter(T=>T.axis);for(let T=0;T<y.length;T+=1){const S=y[T],{axis:F}=S,{type:D}=F,w=n.get(D);ne(w);const M=w.indexOf(F),O=d.getAxisPropertyName(D);if(O!=null){const _=d.getAxisLayoutProperty(O,M);if(r.has(_))ie.debug(`${_} already added.`);else{ie.debug(`Adding ${_} to axisFormats.`);const L=d.getPlotlyAxisFormat(S,t);if(L===null)r.set(_,s);else{r.set(_,L);const{businessCalendar:v}=F;if(v!=null){const P=[],{businessPeriods:ge,businessDays:Z,holidays:G,timeZone:J}=v,ee=t==null?void 0:t.getColumnTypeFormatter(Ne);let Y;Ae(ee)&&(Y=ee.dhTimeZone);const te=Y?(J.standardOffset-Y.standardOffset)/60:0;G.length>0&&P.push(...d.createRangeBreakValuesFromHolidays(G,J,Y)),ge.forEach(W=>P.push({pattern:"hour",bounds:[d.periodToDecimal(W.close)+te,d.periodToDecimal(W.open)+te]})),Z.length<q.length&&d.createBoundsFromDays(Z).forEach(W=>P.push({pattern:"day of week",bounds:W})),L.rangebreaks=P}if(r.size===l.axes.length)return r}}}}}}return r}static getChartType(e,t){switch(e){case u.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return d.getPlotlyChartType(e,t)}}static getAxisPropertyName(e){switch(e){case u.plot.AxisType.X:return"x";case u.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(e){switch(e){case u.plot.AxisPosition.BOTTOM:return"bottom";case u.plot.AxisPosition.TOP:return"top";case u.plot.AxisPosition.LEFT:return"left";case u.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getChartForSeries(e,t){const{charts:r}=e;for(let s=0;s<r.length;s+=1){const i=r[s];for(let n=0;n<i.series.length;n+=1)if(t===i.series[n])return i}return null}static getLayoutRanges(e){const t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<r.length;s+=1){const i=r[s],n=e[i];St(n)&&(t[i]=[...n.range])}return t}static updateFigureAxes(e,t,r,s=0,i=0,n=k){const a=e,o=d.getAllAxes(t);for(let l=0;l<t.charts.length;l+=1){const c=t.charts[l],g=r==null?void 0:r(c),f=d.getChartBounds(t,c,s,i);d.updateLayoutAxes(a,c.axes,o,s,i,f,g,n)}d.removeStaleAxes(a,o)}static getChartBounds(e,t,r=0,s=0){var O;const{cols:i,rows:n}=e,{column:a,colspan:o,row:l,rowspan:c}=t,g=a+o,f=l+c,y=1/i,T=1/n,S=d.AXIS_SIZE_PX/r,F=d.AXIS_SIZE_PX/s,D={left:a*y+(a>0?S/2:0),bottom:l*T+(l>0?F/2:0),top:f*T-(f<n?F/2:0),right:g*y-(g<i?S/2:0)};return((O=d.groupArray(t.axes,"position").get(u.plot.AxisPosition.RIGHT))!=null?O:[]).length>0&&(r>0?D.right-=(D.right-D.left)*Math.max(0,Math.min(d.LEGEND_WIDTH_PX/r,d.MAX_LEGEND_SIZE)):D.right-=(D.right-D.left)*d.DEFAULT_AXIS_SIZE),D}static updateLayoutAxes(e,t,r,s=0,i=0,n={left:0,top:0,right:1,bottom:1},a,o=k){const l=s>0?Math.max(d.MIN_AXIS_SIZE,Math.min(d.AXIS_SIZE_PX/i,d.MAX_AXIS_SIZE)):d.DEFAULT_AXIS_SIZE,c=i>0?Math.max(d.MIN_AXIS_SIZE,Math.min(d.AXIS_SIZE_PX/s,d.MAX_AXIS_SIZE)):d.DEFAULT_AXIS_SIZE,g=e,f=d.groupArray(t,"position"),y=d.groupArray(t,"type"),T=[...y.keys()],S=d.groupArray(r,"type");for(let F=0;F<T.length;F+=1){const D=T[F],w=d.getAxisPropertyName(D);if(w!=null){const M=y.get(D),O=S.get(D),L=D===u.plot.AxisType.Y?i:s;ne(M),ne(O);for(let v=0;v<M.length;v+=1){const P=M[v],ge=O.indexOf(P),Z=d.getAxisLayoutProperty(w,ge);g[Z]==null&&(g[Z]=d.makeLayoutAxis(D,o));const G=g[Z];if(G!=null){d.updateLayoutAxis(G,P,v,f,l,c,n);const{range:J,autorange:ee}=G;if(a!=null&&J!==void 0&&(ee===void 0||ee===!1)){const Y=a(P),[te,W]=Y(J);ie.debug("Setting downsample range",L,te,W),P.range(L,te,W)}else P.range(L)}}}}}static removeStaleAxes(e,t){const r=e,s=d.groupArray(t,"type"),i=[...s.keys()];for(let n=0;n<i.length;n+=1){const a=i[n],o=s.get(a);ne(o);let l=o.length;const c=d.getAxisPropertyName(a);if(c!=null){let g=d.getAxisLayoutProperty(c,l);for(;r[g]!=null;)delete r[g],l+=1,g=d.getAxisLayoutProperty(c,l)}}}static getAxisLayoutProperty(e,t){const r=t>0?`${t+1}`:"";return`${e!=null?e:""}axis${r}`}static updateLayoutAxis(e,t,r,s,i,n,a){var f,y,T;const l=t.type===u.plot.AxisType.Y?n:i,c=e,g=(f=t.label)!=null?f:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=g:c.title={text:g},t.log&&(c.type="log"),c.side=d.getAxisSide(t.position),r>0){c.overlaying=(y=d.getAxisPropertyName(t.type))!=null?y:void 0;const S=(T=s.get(t.position))!=null?T:[],F=S.indexOf(t);F>0&&(c.anchor="free",t.position===u.plot.AxisPosition.RIGHT?c.position=a.right+(F-S.length+1)*l:t.position===u.plot.AxisPosition.TOP?c.position=a.top+(F-S.length+1)*l:t.position===u.plot.AxisPosition.BOTTOM?c.position=a.bottom+(S.length-F+1)*l:t.position===u.plot.AxisPosition.LEFT&&(c.position=a.left+(S.length-F+1)*l))}else if(t.type===u.plot.AxisType.X){const S=s.get(u.plot.AxisPosition.LEFT)||[],F=s.get(u.plot.AxisPosition.RIGHT)||[],D=Math.max(a.left,a.left+(S.length-1)*n),w=Math.min(a.right-(F.length-1)*n,a.right);c.domain=[D,w]}else if(t.type===u.plot.AxisType.Y){const S=s.get(u.plot.AxisPosition.BOTTOM)||[],F=s.get(u.plot.AxisPosition.TOP)||[],D=Math.max(a.bottom,a.bottom+(S.length-1)*i),w=Math.min(a.top-(F.length-1)*i,a.top);c.domain=[D,w]}}static periodToDecimal(e){const t=e.split(":");return Number(t[0])+Number(t[1])/60}static createBoundsFromDays(e){const t=e.map(n=>q.indexOf(n)),r=q.filter(n=>!e.includes(n)).map(n=>q.indexOf(n)),s=new Set;r.forEach(n=>{for(let a=n+1;a<n+q.length;a+=1){const o=a%q.length;if(t.includes(o)){s.add(o);break}}});const i=[];return s.forEach(n=>{for(let a=n-1;a>n-q.length;a-=1){const o=a<0?a+q.length:a;if(t.includes(o)){const l=(o+1)%7;i.push([l,n]);break}}}),i}static createRangeBreakValuesFromHolidays(e,t,r){const s=[],i=[];return e.forEach(n=>{n.businessPeriods.length>0?i.push(...d.createPartialHoliday(n,t,r)):s.push(d.createFullHoliday(n,t,r))}),[{values:s},...i]}static createFullHoliday(e,t,r){return d.adjustDateForTimeZone(`${e.date.toString()} 00:00:00.000000`,t,r)}static createPartialHoliday(e,t,r){const s=e.date.toString(),i=["00:00"];e.businessPeriods.forEach(a=>{i.push(a.open),i.push(a.close)}),i.push("24:00");const n=[];for(let a=0;a<i.length;a+=2){const o=i[a],l=i[a+1];if(o!==l){const c=[d.adjustDateForTimeZone(`${s} ${o}:00.000000`,t,r)],g=ft*(d.periodToDecimal(l)-d.periodToDecimal(o));n.push({values:c,dvalue:g})}}return n}static adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?d.unwrapValue(d.wrapValue(e,Ne,t),r):e}static groupArray(e,t){return e.reduce((r,s)=>{var a;const i=s[t],n=(a=r.get(i))!=null?a:[];return n.push(s),r.set(i,n),r},new Map)}static unwrapValue(e,t){if(e!=null){if(Et(e))return u.i18n.DateTimeFormat.format(d.DATE_FORMAT,e,t);if(yt(e))return e.asNumber()}return e}static wrapValue(e,t,r=null){if(A.isDateType(t)&&typeof e=="string"){const s=e,i=d.DATE_FORMAT.substr(0,e.length),n=u.i18n.DateTimeFormat.parse(i,s);if(!r)return n;const a=`${i} Z`,o=u.i18n.DateTimeFormat.format("Z",n,r),l=u.i18n.DateTimeFormat.parse(a,`${s} ${o}`),c=u.i18n.DateTimeFormat.format("Z",l,r);return u.i18n.DateTimeFormat.parse(a,`${s} ${c}`)}return e}static makeLayoutAxis(e,t=k){const r={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===u.plot.AxisType.X?Object.assign(r,{showgrid:!0}):e===u.plot.AxisType.Y&&Object.assign(r,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),r}static getColorwayFromTheme(e=k){let t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):ie.warn(`Unable to handle colorway property: ${e.colorway}`)),t}static makeDefaultLayout(e=k){const t={...e,autosize:!0,colorway:d.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:e.title_color},yanchor:"top",pad:{...d.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:e.title_color}},margin:{...d.DEFAULT_MARGIN},xaxis:d.makeLayoutAxis(u.plot.AxisType.X,e),yaxis:d.makeLayoutAxis(u.plot.AxisType.Y,e)};return t.datarevision=0,t}static hydrateSettings(e){return{...e,type:u.plot.SeriesPlotStyle[e.type]}}static titleFromSettings(e){const{series:t,xAxis:r,title:s=`${t.join(", ")} by ${r}`}=e;return s}static makeFigureSettings(e,t){const{series:r,xAxis:s,type:i}=e,n=d.titleFromSettings(e),a={formatType:`${u.plot.AxisFormatType.NUMBER}`,type:`${u.plot.AxisType.X}`,position:`${u.plot.AxisPosition.BOTTOM}`},o={formatType:`${u.plot.AxisFormatType.NUMBER}`,type:`${u.plot.AxisType.Y}`,position:`${u.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${u.plot.ChartType.XY}`,axes:[a,o],series:r.map(l=>({plotStyle:`${i}`,name:l,dataSources:[{type:`${u.plot.SourceType.X}`,columnName:s,axis:a,table:t},{type:`${u.plot.SourceType.Y}`,columnName:l,axis:o,table:t}]}))}],title:n}}};let E=d;E.DEFAULT_AXIS_SIZE=.15;E.MIN_AXIS_SIZE=.025;E.MAX_AXIS_SIZE=.2;E.AXIS_SIZE_PX=75;E.LEGEND_WIDTH_PX=50;E.MAX_LEGEND_SIZE=.25;E.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});E.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";E.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});E.DEFAULT_TITLE_PADDING=Object.freeze({t:8});E.SUBTITLE_LINE_HEIGHT=25;E.DEFAULT_MARKER_SIZE=6;E.MODE_MARKERS="markers";E.MODE_LINES="lines";const H=B.module("Chart"),ae=class extends z.exports.Component{constructor(e){super(e),this.getCachedConfig=Me((t,r,s,i)=>{const n=[],a=Boolean(t);if(a&&n.push({name:`Downsampling failed: ${t}`,click:()=>{},icon:ae.convertIcon(Le),attr:"fill-warning"}),r||s||i||a){const o=ae.downsampleButtonTitle(s,i),l=ae.downsampleButtonAttr(s,i),c=s?ve:$e;n.push({name:o,icon:ae.convertIcon(c),click:this.handleDownsampleClick,attr:l})}return{displaylogo:!1,displayModeBar:s||a?!0:"hover",modeBarButtons:[n,["toImage"],["zoom2d","pan2d"],["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=ce.createRef(),this.plotWrapper=ce.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(e){const[t,,,,r]=e.icon,s=`${r}`;return{width:t,path:s,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:r}=this.props;this.updateFormatterSettings(r),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(t=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?t:null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){H.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var s;const{type:t,detail:r}=e;switch(H.debug2("Received data update",t,r),t){case b.EVENT_UPDATED:{this.currentSeries+=1,this.setState(n=>{const{layout:a,revision:o}=n;return typeof a.datarevision=="number"&&(a.datarevision+=1),{data:r,layout:a,revision:o+1}});const{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case b.EVENT_LOADFINISHED:{const{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case b.EVENT_DISCONNECT:{const{onDisconnect:i}=this.props;i();break}case b.EVENT_RECONNECT:{const{onReconnect:i}=this.props;i();break}case b.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case b.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case b.EVENT_DOWNSAMPLENEEDED:case b.EVENT_DOWNSAMPLEFAILED:{const i=(s=r.message)!=null?s:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:i});const{onError:n}=this.props;n(new Error(i));break}default:H.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,r=E.getLayoutRanges(t);!re(r,this.ranges)&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(H.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleRestyle([e,t]){if(H.debug("handleRestyle",e,t),Object.keys(e).includes("visible")){const{data:r}=this.state,{onSettingsChanged:s}=this.props;if(r!=null){const i=r.reduce((n,{name:a,visible:o})=>a!=null&&o==="legendonly"?[...n,a]:n,[]);s({hiddenSeries:i})}}}updateModelDimensions(e=!1){const t=this.getPlotRect();if(!t){H.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:s,model:i}=this.props;i.setDimensions(t),s&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=fe.getColumnFormats(e),r=fe.getDateTimeFormatterOptions(e),{decimalFormatOptions:s={},integerFormatOptions:i={}}=e;(!re(this.columnFormats,t)||!re(this.dateTimeFormatterOptions,r)||!re(this.decimalFormatOptions,s)||!re(this.integerFormatOptions,i))&&(this.columnFormats=fe.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=s,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){const e=new ye(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:t}=this.props;t.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&de.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{H.debug("Unable to resize, promise rejected",t)})}render(){const{data:e,downsamplingError:t,isDownsampleFinished:r,isDownsampleInProgress:s,isDownsamplingDisabled:i,layout:n,revision:a}=this.state,o=this.getCachedConfig(t,r,s,i),l=e!=null;return X("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:l&&X(ut,{ref:this.plot,data:e,layout:n,revision:a,config:o,onAfterPlot:this.handleAfterPlot,onError:H.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let xe=ae;xe.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:oe.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const x=B.module("FigureChartModel"),we=class extends b{constructor(e,t={},r=k){super(),this.addPendingSeries=Oe(()=>{var a;const i=E.getAllAxes(this.figure),{pendingSeries:n}=this;for(let o=0;o<n.length;o+=1){const l=n[o],c=this.figure.charts.find(g=>g.series.includes(l));this.addSeries(l,i,(a=c==null?void 0:c.showLegend)!=null?a:null),l.subscribe()}this.pendingSeries=[]},we.ADD_SERIES_DEBOUNCE),this.getTimeZone=se((i,n)=>{if(n!=null){const a=n.getColumnTypeFormatter(i);if(a!=null)return a.dhTimeZone}}),this.getValueTranslator=se((i,n)=>{const a=this.getTimeZone(i,n);return o=>E.unwrapValue(o,a)}),this.getValueParser=se((i,n)=>{const a=this.getTimeZone(i,n);return o=>E.wrapValue(o,i,a)}),this.getRangeParser=se((i,n)=>a=>{let[o,l]=a;const c=this.getValueParser(i,n);return o=c(o),l=c(l),[o,l]}),this.getAxisRangeParser=se((i,n)=>a=>{const o=E.getSourceForAxis(i,a);return o?this.getRangeParser(o.columnType,n):l=>l}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=e,this.settings=t,this.theme=r,this.data=[];const s={data:{},layout:E.makeDefaultLayout(r)};this.layout={grid:{rows:e.rows,columns:e.cols,pattern:"independent"},template:s},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,t=E.getAllAxes(this.figure),r=[];for(let n=0;n<e.length;n+=1){const a=e[n];for(let o=0;o<a.series.length;o+=1){const l=a.series[o];r.push(l.name),this.addSeries(l,t,a.showLegend)}}const i=[...this.seriesDataMap.keys()].filter(n=>r.indexOf(n)<0);for(let n=0;n<i.length;n+=1){const a=i[n];this.seriesDataMap.delete(a)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){const s=E.groupArray(t,"type"),i=E.makeSeriesDataFromSeries(e,s,E.getSeriesVisibility(e.name,this.settings),r,this.theme);if(this.seriesDataMap.set(e.name,i),this.data=[...this.seriesDataMap.values()],e.plotStyle===u.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===u.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=E.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===u.plot.SeriesPlotStyle.PIE?r!=null?r:void 0:!1,e.oneClick!=null){const{oneClick:n}=e,{columns:a}=n;for(let o=0;o<a.length;o+=1)this.filterColumnMap.set(a[o].name,a[o]);this.oneClicks.push(n)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){x.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?u.plot.DownsampleOptions.DISABLE:u.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(u.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(u.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(u.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(u.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(u.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(u.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(u.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(u.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(u.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(u.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(u.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(u.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(u.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(u.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(u.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(u.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(u.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(u.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){x.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){x.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){x.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){x.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:r}=t;x.debug2("handleFigureUpdated",r);for(let i=0;i<r.length;i+=1){const n=r[i];x.debug2("handleFigureUpdated updating series",n.name);const{sources:a}=n;for(let o=0;o<a.length;o+=1){const l=a[o],{columnType:c,type:g}=l,f=this.getValueTranslator(c,this.formatter),y=t.getArray(n,g,f);this.setDataArrayForSeries(n,g,y)}this.seriesToProcess.delete(n.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(n)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(e){x.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){x.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){x.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;x.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var s,i;super.setTitle(e);const t=(i=(s=(e!=null?e:"").match(/<br>/g))==null?void 0:s.length)!=null?i:0,r=E.DEFAULT_MARGIN.t+t*E.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=r:this.layout.margin={t:r},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=E.DEFAULT_TITLE_PADDING.t+t*E.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((t=(e=this.layout.margin)==null?void 0:e.l)!=null?t:0)-((s=(r=this.layout.margin)==null?void 0:r.r)!=null?s:0),0)}getPlotHeight(){var e,t,r,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((t=(e=this.layout.margin)==null?void 0:e.t)!=null?t:0)-((s=(r=this.layout.margin)==null?void 0:r.b)!=null?s:0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();E.updateFigureAxes(this.layout,this.figure,r=>this.getAxisRangeParser(r,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;E.getAxisFormats(this.figure,this.formatter).forEach((t,r)=>{x.debug(`Assigning ${r}`,this.layout[r],t);const s=this.layout[r];s!=null?Object.assign(s,t):x.debug(`Ignoring null layout.${r}`)})}setDataArrayForSeries(e,t,r){const{name:s,plotStyle:i}=e,n=this.seriesDataMap.get(s),a=E.getPlotlyProperty(i,t);n&&be(n,a,r)}cleanSeries(e){const{name:t,plotStyle:r}=e,s=this.seriesDataMap.get(t);if(s!=null){if(r===u.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:i,xHigh:n}=s;if(i&&n&&i.length===n.length){const a=[];for(let o=0;o<i.length;o+=1)a.push(n[o]-i[o]);s.width=a}}else if(r===u.plot.SeriesPlotStyle.LINE){const{x:i,xLow:n,xHigh:a,y:o,yLow:l,yHigh:c}=s;n&&a&&n!==i&&(s.error_x=E.getPlotlyErrorBars(i,n,a)),l&&c&&l!==o&&(s.error_y=E.getPlotlyErrorBars(o,l,c))}else if(r===u.plot.SeriesPlotStyle.TREEMAP){const{ids:i,labels:n}=s;i!==void 0&&n===void 0&&(s.labels=i)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){x.warn("Trying to set a filter, but no one click!");return}x.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const r=this.oneClicks[t],{columns:s}=r;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(n=>{const a=e.get(n);this.lastFilter.get(n)!==a&&s.find(o=>o.name===n)!=null&&r.setValueForColumn(n,a)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let Te=we;Te.ADD_SERIES_DEBOUNCE=50;class Se{static async makeModelFromSettings(t,r,s=k){const i=await Se.makeFigureFromSettings(t,r);return new Te(i,t,s)}static async makeFigureFromSettings(t,r){const s=await r.copy();return s.applyCustomColumns(r.customColumns),s.applyFilter(r.filter),s.applySort(r.sort),u.plot.Figure.create(E.makeFigureSettings(t,s))}static async makeModel(t,r,s=k){return new Te(r,t,s)}}const Q=B.module("EmbedChart.App");async function Ft(e,t){Q.info(`Fetching figure ${t}...`);const r={name:t,type:u.VariableType.FIGURE};return e.getObject(r)}function Ct(){const[e,t]=z.exports.useState(),[r,s]=z.exports.useState(),[i,n]=z.exports.useState(!0),a=z.exports.useMemo(()=>new URLSearchParams(window.location.search),[]);z.exports.useEffect(function(){async function c(){try{const g=a.get("name");if(g==null)throw new Error("No name param provided");const f=new URL("/jsapi",`${window.location}`),y=`${f.protocol}//${f.host}`;Q.debug("Starting connection...");const T=new u.IdeConnection(y);Q.debug("Loading figure",g,"...");const S=await Ft(T,g);Q.debug("Creating model...");const F=await Se.makeModel(void 0,S);t(F),Q.debug("Figure successfully loaded!")}catch(g){Q.error("Unable to load figure",g),s(`${g}`)}n(!1)}c()},[a]);const o=e!=null;return _e("div",{className:"App",children:[o&&X(xe,{model:e}),!o&&X(Ue,{isLoaded:o,isLoading:i,errorMessage:r!=null?r:null}),X(Xe,{})]})}export{Ct as default};
|
|
2
|
+
//# sourceMappingURL=App.730dc7d8.js.map
|