@deephaven/embed-chart 0.62.1-beta.0 → 0.62.1-beta.5

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.
@@ -1,3 +1,3 @@
1
- import{r as C,G as K,aZ as At,C as E,D as Ct,E as U,R as It,V as D,F as ke,a_ as xt,L as Lt,a$ as Rt,a3 as ze,b0 as bt,ac as ve,ao as kt,K as _t,U as ge}from"./vendor-c2fe68e8.js";import{T as jt,L as G,k as Vt,w as $t,bk as Ht,bh as Wt,G as Bt,J as Kt,D as qt,F as zt,K as Gt,z as Xt,R as Yt,u as Zt,X as Qt,n as ye,ah as Ge,bl as Ut,bm as Jt,r as er,H as tr,$ as rr}from"./index-c8887f6b.js";import{c as Ie,P as wt,b as nr,h as ir,p as ar,o as or,s as sr,t as lr}from"./plotly-99117086.js";var Ni=Object.freeze([]),Ai=new Map,Ci=()=>{};function xe(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function ur(n,e,t){return e=cr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cr(n){var e=dr(n,"string");return typeof e=="symbol"?e:String(e)}function dr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class hr extends Error{constructor(){super(...arguments),ur(this,"isCanceled",!0)}}const Xe=hr;function fr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=mr(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function mr(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(r))a!=="constructor"&&typeof r[a]=="function"&&t.add(a);r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Ye(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function pr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Ye(a,r,i,s,o,"next",l)}function o(l){Ye(a,r,i,s,o,"throw",l)}s(void 0)})}}function vr(n){return _e.apply(this,arguments)}function _e(){return _e=pr(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return Ze(n)}Ze(n)}),_e.apply(this,arguments)}function Ze(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function gr(n,e,t){return e=yr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yr(n){var e=Er(n,"string");return typeof e=="symbol"?e:String(e)}function Er(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Sr extends Error{constructor(){super(...arguments),gr(this,"isTimeout",!0)}}const Pt=Sr;class je{static makeCancelable(e,t){var r=!1,i,a,s=new Promise((o,l)=>{a=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,o(u))}).catch(u=>l(u))});return s.cancel=()=>{r=!0,a(new Xe),i!=null&&t&&t(i)},s}static isCanceled(e){return e instanceof Xe}static isTimedOut(e){return e instanceof Pt}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(a){i(a)}},e)})}}class Tr{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}const br=Tr;function Qe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){fe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fe(n,e,t){return e=Pr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pr(n){var e=Fr(n,"string");return typeof e=="symbol"?e:String(e)}function Fr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ve extends C.Component{constructor(e){super(e),fe(this,"element",void 0),fe(this,"container",void 0),fe(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=K.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=wr({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new At(r||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){var s=this.element.firstElementChild;s instanceof HTMLElement&&s.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:a}=this.props,{show:s}=this.state;return E.jsx(Ct,{in:s,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:E.jsx("div",{onClick:o=>{o.stopPropagation()},onKeyDown:o=>{o.key==="Escape"&&this.hide()},className:U("popper",{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:E.jsxs("div",{className:"popper-content",children:[t,E.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return E.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&It.createPortal(this.renderContent(),this.element)})}}fe(Ve,"propTypes",{children:D.node.isRequired,options:D.shape({}),className:D.string,timeout:D.number,onEntered:D.func,onExited:D.func,isShown:D.bool,closeOnBlur:D.bool,interactive:D.bool,referenceObject:D.shape({}),"data-testid":D.string});fe(Ve,"defaultProps",{options:{},className:"",timeout:jt.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ft=Ve;function Ue(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Mr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ue(Object(t),!0).forEach(function(r){Y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Y(n,e,t){return e=Dr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dr(n){var e=Or(n,"string");return typeof e=="symbol"?e:String(e)}function Or(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Nr=G.module("Tooltip");class x extends C.Component{static handleHidden(){x.shownTooltipCount-=1,x.shownTooltipCount===0&&(x.lastHiddenTime=Date.now())}static handleShown(){x.shownTooltipCount+=1}constructor(e){super(e),Y(this,"container",void 0),Y(this,"popper",void 0),Y(this,"parent",void 0),Y(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=K.createRef(),this.popper=K.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?x.handleShown():x.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&x.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Nr.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),s=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():t>=s.left&&t<=s.left+s.width&&r>=s.top&&r<=s.top+s.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(x.shownTooltipCount>0||Date.now()-x.lastHiddenTime<x.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":a,onEntered:s}=this.props,{isShown:o}=this.state,{options:l}=this.props;return l=Mr({placement:"bottom"},l),E.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:E.jsx(Ft,{className:U(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:s,onExited:this.handleExited,interactive:e,referenceObject:r,children:E.jsxs("div",{className:"tooltip-content",children:[" ",o&&t]})})})}}Y(x,"defaultTimeout",500);Y(x,"defaultReshowTimeout",100);Y(x,"triggerReshowThreshold",300);Y(x,"shownTooltipCount",0);Y(x,"lastHiddenTime",Date.now());Y(x,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:x.defaultReshowTimeout,timeout:x.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Ar=x;function Oe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=C.useContext(n);if(t==null)throw new Error(e);return t}var Cr=3500,Ir=G.module("useCopyToClipboard");function xr(){var[n,e]=C.useState(!1),t=C.useRef(null),r=C.useCallback(i=>{vr(i).then(()=>{e(!0)}).catch(a=>Ir.error("Unable to copy ".concat(i),`
2
- `,a))},[]);return C.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},Cr)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var Lr=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Je(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(t),!0).forEach(function(r){Rr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Rr(n,e,t){return e=kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kr(n){var e=_r(n,"string");return typeof e=="symbol"?e:String(e)}function _r(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function jr(n,e){if(n==null)return{};var t=Vr(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Vr(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var $r=["primary","secondary","tertiary","success","danger","inline","ghost"],Hr=["group-end"];function Wr(n,e){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Br(n){switch(n){case"group-end":return U("pl-2","pr-3")}}var Ne=K.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:a,icon:s,disabled:o=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:d,onMouseUp:h,onMouseEnter:v,onMouseLeave:p,onKeyDown:y,className:S,style:T,children:P,tabIndex:b,"data-testid":w,"aria-label":F}=n,_=jr(n,Lr),O;r&&(O=Br(r));var N;s&&(N=K.isValidElement(s)?s:E.jsx(ke,{icon:s}));var M=N!=null&&P==null,j=Wr(t,M),X;a!==void 0&&(X=typeof a=="string"?E.jsx(Ar,{children:a}):a);var z=F;F===void 0&&M&&a!=null&&typeof a=="string"&&(z=a);var te=E.jsxs("button",et(et({"data-testid":w,ref:e,type:i,className:U("btn",j,O,{active:l},S),onClick:u,onContextMenu:c,onMouseUp:h,onMouseDown:d,onMouseEnter:v,onMouseLeave:p,onKeyDown:y,style:T,disabled:o,tabIndex:b,"aria-label":z},_),{},{children:[s&&N,P,a!=null&&!o&&X]}));return o&&a!=null?E.jsxs("span",{className:"btn-disabled-wrapper",children:[te,X]}):te});Ne.displayName="Button";Ne.propTypes={kind:D.oneOf($r).isRequired,variant:D.oneOf(Hr),type:D.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!K.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.bool,active:D.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:D.func,onMouseUp:D.func,onMouseDown:D.func,onMouseEnter:D.func,onMouseLeave:D.func,onKeyDown:D.func,tabIndex:D.number,children:D.node,className:D.string,style:D.object,"data-testid":D.string};Ne.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Kr=Ne;function qr(n,e,t){return e=zr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zr(n){var e=Gr(n,"string");return typeof e=="symbol"?e:String(e)}function Gr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ii(n){return n.then!==void 0}class se{static disableAllActions(){se.actionsDisabled=!0}static enableAllActions(){se.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var a,s;return((a=e.order)!==null&&a!==void 0?a:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var o,l;return((o=e.title)!==null&&o!==void 0?o:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(se.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return se.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=se.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var a=0;a<i.length;a+=1){var s=i[a],o=void 0;typeof s=="function"?o=s():o=s,o!=null&&(o instanceof Promise?t&&r.push(o):Array.isArray(o)?r=r.concat(o):r.push(o))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var a=1;a<r.length+1;a+=1){var s=(i+t*a+r.length)%r.length,o=r[s];if(!(o instanceof Promise)&&o.disabled!==!0)return s}return e}}qr(se,"actionsDisabled",!1);const ce=se;var $e=K.forwardRef((n,e)=>{var t,r;function i(O){var{menuItem:N,onMenuItemClick:M}=n;M(N,O)}function a(O){var{menuItem:N,onMenuItemMouseMove:M}=n;M(N,O)}function s(O){var{menuItem:N,onMenuItemContextMenu:M}=n;M(N,O)}function o(O,N,M){if(typeof O.type=="string")return O;var{closeMenu:j,menuItem:X,isKeyboardSelected:z,isMouseSelected:te,"data-testid":ue}=n,he={menuItem:X,closeMenu:j,isKeyboardSelected:z,isMouseSelected:te,iconElement:N,displayShortcut:M,"data-testid":ue};return K.cloneElement(O,{forwardedProps:he})}var{children:l,menuItem:u,isKeyboardSelected:c=!1,isMouseSelected:d=!1,"data-testid":h}=n,v=(t=u.shortcutText)!==null&&t!==void 0?t:(r=u.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(u.icon){var y=u.icon;if(K.isValidElement(y))p=y;else{var S;u.iconColor!=null&&(u.disabled===void 0||!u.disabled)&&(S={color:u.iconColor}),p=E.jsx(ke,{icon:y,style:S})}}var T=null,P=!!l;u.actions&&(T=E.jsx(ke,{icon:Vt}));var b=null;if(u.menuElement)b=E.jsx("div",{className:"custom-menu-item",onMouseMove:a,children:o(u.menuElement,p,v)});else{var w,F=u.disabled,_=u.iconOutline;b=E.jsx("button",{type:"button",className:U("btn-context-menu",{disabled:F},{active:(P||d)&&(F===void 0||!F)},{"keyboard-active":c&&(F===void 0||!F)}),onClick:i,onMouseMove:a,onContextMenu:s,title:(w=u.description)!==null&&w!==void 0?w:"",children:E.jsxs("div",{className:"btn-context-menu-wrapper",children:[E.jsx("span",{className:U("icon",{outline:_}),children:p}),E.jsx("span",{className:"title",children:u.title}),v!==void 0&&E.jsx("span",{className:"shortcut",children:v}),T&&E.jsx("span",{className:U("submenu-indicator",{disabled:F}),children:T})]})})}return E.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[l,b]})});$e.displayName="ContextMenuItem";$e.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Xr=$e;function tt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(t),!0).forEach(function(r){ae(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):tt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ae(n,e,t){return e=Zr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zr(n){var e=Qr(n,"string");return typeof e=="symbol"?e:String(e)}function Qr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rt=G.module("ContextMenu");class Se extends C.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),ae(this,"container",void 0),ae(this,"oldFocus",void 0),ae(this,"activeSubMenuRef",void 0),ae(this,"subMenuTimer",void 0),ae(this,"rAF",void 0),ae(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=K.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=K.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var s;(s=this.container.current)===null||s===void 0||s.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=ce.getMenuItems(r),a=[],s=i.length-1;s>=0;s-=1){var o=i[s];o instanceof Promise?this.initMenuPromise(o):a.push(o)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:ce.sortActions(a)})}initMenuPromise(e){var t=je.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var s=i.pendingItems.slice();return s.splice(a,1),{menuItems:ce.sortActions(i.menuItems.concat(r)),pendingItems:s}}return null})},r=>{je.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var s=i.pendingItems.slice();return s.splice(a,1),{pendingItems:s}}return null}),rt.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:s,subMenuParentWidth:o,subMenuParentHeight:l,top:u,left:c}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:d,left:h}=this.initialPosition,{width:v,height:p}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;p===0||v===0||(d+p>window.innerHeight&&(d-p-l>0?d-=p-l:d=window.innerHeight-p),h+v>window.innerWidth&&(h=h-v-o),(c!==h||u!==d)&&(this.setState({hasOverflow:y}),s(d,h)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){rt.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=ce.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=ce.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:s,menuItems:o,mouseIndex:l,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:h,subMenuParentHeight:v}=this.state,p=0;p<o.length;p+=1){var y=o[p];p>0&&y.group!==o[p-1].group&&e.push(E.jsx("hr",{},"".concat(p,".separator")));var S=E.jsx(Xr,{ref:i===p?this.activeSubMenuRef:null,isKeyboardSelected:s===p,isMouseSelected:l===p,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},p);e.push(S)}var T=null;u.length>0&&(T=E.jsx("div",{className:"loading",children:E.jsx($t,{className:"loading-spinner-vertical-align"})}));var{menuStyle:P,"data-testid":b}=this.props,w=i!==null&&c!==null&&d!==null;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:U({"has-overflow":a},"context-menu-container"),style:Yr({top:t,left:r},P),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Se.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":b,children:[e,T]}),w&&i!==null&&c!==null&&d!==null&&E.jsx(Se,{actions:o[i].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(F,_)=>{this.setState({subMenuTop:F,subMenuLeft:_})},subMenuParentWidth:h,subMenuParentHeight:v},"sub-".concat(i))]})}}ae(Se,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Ur=Se;function nt(n,e,t){return e=Jr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jr(n){var e=en(n,"string");return typeof e=="symbol"?e:String(e)}function en(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tn extends C.Component{constructor(e){super(e),nt(this,"container",void 0),nt(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=K.createRef(),this.openMenu=K.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var o=document.elementFromPoint(i,r),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o==null||o.dispatchEvent(l)});return}if(ce.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var s=ce.getMenuItems(e.contextActions);s.length!==0&&(e.preventDefault(),this.setState({actions:s,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=E.jsx(Ur,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(s,o)=>{this.setState({top:s,left:o})},"data-testid":t})),E.jsx("div",{className:U("context-menu-root",{active:r}),ref:this.container,children:e})}}const xi=tn;function rn(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,style:a,"data-testid":s,children:o}=n,[l,u]=xr();return E.jsx(Kr,{kind:t,className:i,style:a,"data-testid":s,icon:l?Ht:Wt,tooltip:l?"Copied":r,onClick:()=>{u(typeof e=="function"?e():e)},children:o})}const nn={"dh-spectrum-palette":"_dh-spectrum-palette_1mcqx_1"},an={"dh-spectrum-alias":"_dh-spectrum-alias_1uc7a_1"};function it(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?it(Object(t),!0).forEach(function(r){on(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function on(n,e,t){return e=sn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sn(n){var e=ln(n,"string");return typeof e=="symbol"?e:String(e)}function ln(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ot=at(at({},nn),an);function st(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(r){un(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function un(n,e,t){return e=cn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cn(n){var e=dn(n,"string");return typeof e=="symbol"?e:String(e)}function dn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:hn,light:fn,dark:mn,medium:pn,large:vn}=xt,gn={global:hn,light:Fe(Fe({},fn),ot),dark:Fe(Fe({},mn),ot),medium:pn,large:vn};function yn(n){var{children:e,isPortal:t=!1,theme:r=gn,colorScheme:i}=n,[a]=C.useState(t?Lt():null);return E.jsx(Rt,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":a,children:e})}var En=G.module("ThemeProvider"),Mt=C.createContext(null);function Li(n){var{themes:e,defaultPreloadValues:t=Zt,children:r}=n,i=C.useMemo(()=>Bt(),[]),[a,s]=C.useState(null),[o,l]=C.useState(()=>{var d,h;return(d=(h=Kt())===null||h===void 0?void 0:h.themeKey)!==null&&d!==void 0?d:qt}),u=C.useMemo(()=>e==null?null:zt(o,{base:i,custom:e??[]}),[i,o,e]),c=C.useMemo(()=>[...i,...e??[]],[i,e]);return C.useEffect(function(){if(!(u==null||e==null)){Gt(t);var h=Xt(t);En.debug2("updateThemePreloadData:",{active:u.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:h,selectedThemeKey:o}),Yt({themeKey:o,preloadStyleContent:h})}},[u,o,e,t]),C.useEffect(()=>{s({activeThemes:u,selectedThemeKey:o,themes:c,setSelectedThemeKey:l})},[u,o,c]),E.jsxs(E.Fragment,{children:[u==null?null:E.jsx(E.Fragment,{children:u.map(d=>E.jsx("style",{"data-theme-key":d.themeKey,children:d.styleContent},d.themeKey))}),a==null?null:E.jsx(Mt.Provider,{value:a,children:E.jsx(yn,{children:r})})]})}function Sn(){return Oe(Mt,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function Ri(){return Oe(Qt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function He(n,e,t){return e=Tn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tn(n){var e=bn(n,"string");return typeof e=="symbol"?e:String(e)}function bn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ae{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}He(Ae,"TYPE_GLOBAL","type-global");He(Ae,"TYPE_CONTEXT_PRESET","type-context-preset");He(Ae,"TYPE_CONTEXT_CUSTOM","type-context-custom");const W=Ae;class wn extends W{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Pn=wn;class Fn extends W{format(e){return String.fromCharCode(e)}}const Mn=Fn;function oe(n,e,t){return e=Dn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dn(n){var e=On(n,"string");return typeof e=="symbol"?e:String(e)}function On(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=G.module("DateTimeColumnFormatter");class Q extends W{static isValid(e,t){try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.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){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=Q.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=Q.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=Q.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oe(this,"dh",void 0),oe(this,"dhTimeZone",void 0),oe(this,"defaultDateTimeFormatString",void 0),oe(this,"showTimeZone",void 0),oe(this,"showTSeparator",void 0),oe(this,"formatStringMap",void 0);var s=t||Q.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(s)}catch{lt.error("Unsupported time zone id",s),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(Q.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=Q.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{lt.error("Invalid format arguments")}return""}}oe(Q,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");oe(Q,"DEFAULT_TIME_ZONE_ID","America/New_York");function ee(n,e,t){return e=Nn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nn(n){var e=An(n,"string");return typeof e=="symbol"?e:String(e)}function An(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Cn=G.module("DecimalColumnFormatter");class R extends W{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return R.makeFormat(e,t,W.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return R.makeFormat("Custom Format",e,W.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}constructor(e){var{defaultFormatString:t=R.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ee(this,"defaultFormatString",void 0),ee(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Cn.error("Invalid format arguments")}return""}}ee(R,"DEFAULT_FORMAT_STRING","###,##0.0000");ee(R,"FORMAT_PERCENT",R.makePresetFormat("Percent","##0.00%"));ee(R,"FORMAT_BASIS_POINTS",R.makePresetFormat("Basis Points","###,##0 bp",1e4));ee(R,"FORMAT_MILLIONS",R.makePresetFormat("Millions","###,##0.000 mm",1e-6));ee(R,"FORMAT_SCIENTIFIC_NOTATION",R.makePresetFormat("Scientific Notation","0.0000E0"));ee(R,"FORMAT_ROUND",R.makePresetFormat("Round","###,##0"));ee(R,"FORMAT_ROUND_TWO_DECIMALS",R.makePresetFormat("0.00","###,##0.00"));ee(R,"FORMAT_ROUND_FOUR_DECIMALS",R.makePresetFormat("0.0000","###,##0.0000"));class In extends W{format(e){return"".concat(e)}}const xn=In;function Te(n,e,t){return e=Ln(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ln(n){var e=Rn(n,"string");return typeof e=="symbol"?e:String(e)}function Rn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kn=G.module("IntegerColumnFormatter");class J extends W{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return J.makeFormat(e,t,W.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return J.makeFormat("Custom Format",e,W.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}constructor(e){var{defaultFormatString:t=J.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Te(this,"dh",void 0),Te(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{kn.error("Invalid format arguments")}return""}}Te(J,"DEFAULT_FORMAT_STRING","###,##0");Te(J,"FORMAT_MILLIONS",J.makePresetFormat("Millions","###,##0.000 mm",1e-6));Te(J,"FORMAT_SCIENTIFIC_NOTATION",J.makePresetFormat("Scientific Notation","0.0000E0"));class _n extends W{format(e){return e}}function Dt(n,e,t){return e=jn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jn(n){var e=Vn(n,"string");return typeof e=="symbol"?e:String(e)}function Vn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class k{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),d="".concat(i+1).padStart(2,"0"),h="".concat(a).padStart(2,"0"),v="".concat(s).padStart(2,"0"),p="".concat(o).padStart(2,"0"),y="".concat(l).padStart(2,"0"),S="".concat(u).padStart(9,"0"),T="".concat(c,"-").concat(d,"-").concat(h," ").concat(v,":").concat(p,":").concat(y,".").concat(S);return e.i18n.DateTimeFormat.parse(k.FULL_DATE_FORMAT,T,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:a,month:s,date:o,hours:l,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=k.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?o+=1:t.month!=null?s+=1:a+=1;var h=new Date(a,s,o,l,u,c);return k.makeDateWrapper(e,i,h.getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),d)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<k.months.length;i+=1)if(k.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,a,s,o){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=i!=null?parseInt(i,10):0,h=a!=null?parseInt(a,10):0,v=s!=null?parseInt(s,10):0,p=o!=null?parseInt(o.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(v)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:d,minutes:h,seconds:v,nanos:p}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,r=t.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,s,,o,,l,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:i,month:a,date:s,hours:o,minutes:l,seconds:u,nanos:c}}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),s=k.makeDateWrapper(e,r,a.getFullYear(),a.getMonth(),a.getDate()),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=k.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate());return[s,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=k.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),h=k.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,h]}if(i==="now"){var v=new Date(Date.now()),p=e.DateWrapper.ofJsDate(v);return[p,null]}var y=k.parseDateTimeString(i);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var S=k.parseDateValues(y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos);if(S==null)throw new Error("Unable to extract date values from ".concat(y));var T=k.makeDateWrapper(e,r,S.year,S.month,S.date,S.hours,S.minutes,S.seconds,S.nanos),P=k.getNextDate(e,y,S,r);return[T,P]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}Dt(k,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Dt(k,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function ki(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function _i(n,e,t){return function(i){var a=t.trim();if(a==="")return null;var s=Ot(e,o=>o.filter().containsIgnoreCase(n.makeFilterValue(o.type,a)),"or");return s(i)}}function Ot(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(a==null||a.length===0)return null;var s=a.map(e);return s.reduce((o,l)=>o[t](l))}}function $n(n,e,t,r){return Ot(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function ji(n,e,t,r,i){return function(s){var o=s==null?void 0:s.findColumn(e),l=t==="all"||r&&t.size===0;return o==null||l?null:n.makeSelectValueFilter(o,[...t.keys()],i)}}function Vi(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function $i(n,e){return function(r){var i=r.filter(),a=n.makeFilterValue(r.type,""),s=i.eq(a);return e?i.isNull().or(s):s.or(i.notEq(a))}}function We(n,e,t){return e=Hn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hn(n){var e=Wn(n,"string");return typeof e=="symbol"?e:String(e)}function Wn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class be{}We(be,"not","not");We(be,"and","and");We(be,"or","or");function Hi(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function I(n,e,t){return e=Bn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bn(n){var e=Kn(n,"string");return typeof e=="symbol"?e:String(e)}function Kn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class m{}I(m,"eq","eq");I(m,"eqIgnoreCase","eqIgnoreCase");I(m,"notEq","notEq");I(m,"notEqIgnoreCase","notEqIgnoreCase");I(m,"greaterThan","greaterThan");I(m,"greaterThanOrEqualTo","greaterThanOrEqualTo");I(m,"lessThan","lessThan");I(m,"lessThanOrEqualTo","lessThanOrEqualTo");I(m,"in","in");I(m,"inIgnoreCase","inIgnoreCase");I(m,"notIn","notIn");I(m,"notInIgnoreCase","notInIgnoreCase");I(m,"isTrue","isTrue");I(m,"isFalse","isFalse");I(m,"isNull","isNull");I(m,"invoke","invoke");I(m,"contains","contains");I(m,"notContains","notContains");I(m,"containsIgnoreCase","containsIgnoreCase");I(m,"startsWith","startsWith");I(m,"endsWith","endsWith");I(m,"containsAny","containsAny");var ut=G.module("ViewportDataUtils");function qn(n,e){return String(n.offsetInSnapshot+e)}function Wi(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:a,offset:s,rows:o}=i.detail;ut.debug("table updated",i.detail);var l=new Map;o.forEach(u=>{var c=e(u,a),d=qn(u,s);l.set(d,{key:d,item:c})}),ut.debug("update keys",l),t(l)}}function Bi(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*Ki(n,e){for(var t=n;t<=e;++t)yield{key:String(t)}}function zn(n){return n==null||Gn(n)?0:n.size}function Gn(n){return"isClosed"in n?n.isClosed:!1}function qi(n,e,t,r){var i=n+e-1,[a,s]=[0,r-1],o=ze(n-t,a,s),l=ze(i+t,a,s);return[o,l]}function ct(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function ie(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){ct(a,r,i,s,o,"next",l)}function o(l){ct(a,r,i,s,o,"throw",l)}s(void 0)})}}function de(n,e,t){return e=Xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xn(n){var e=Yn(n,"string");return typeof e=="symbol"?e:String(e)}function Yn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var re=G.module("TableUtils");class f{static copyTableAndApplyFilters(e){var t=arguments;return ie(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),s=1;s<i;s++)a[s-1]=t[s];return r.applyFilter(xe(...a.map(o=>o(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,a=e[r];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=f.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return f.isBooleanType(e)?[m.isTrue,m.isFalse,m.isNull]:f.isCharType(e)||f.isNumberType(e)||f.isDateType(e)?[m.eq,m.notEq,m.greaterThan,m.greaterThanOrEqualTo,m.lessThan,m.lessThanOrEqualTo]:f.isTextType(e)?[m.eq,m.eqIgnoreCase,m.notEq,m.notEqIgnoreCase,m.contains,m.notContains,m.startsWith,m.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=f.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===f.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===f.sortDirection.none)return null;var a=e[t].sort();switch(r){case f.sortDirection.ascending:a=a.asc();break;case f.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var a=f.getNextSort(t,e,r);return f.setSortForColumn(e,t[r].name,a,i)}static sortColumn(e,t,r,i,a,s){if(r<0||r>=t.length)return[];var o=f.makeColumnSort(t,r,i,a);return f.setSortForColumn(e,t[r].name,o,s)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=f.getSortIndex(e,t),s=[];return i&&(s=s.concat(e.filter(o=>{var{direction:l}=o;return l!==f.sortDirection.reverse})),a!==null&&s.splice(a,1)),r!==null&&s.push(r),s}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case f.dataType.BOOLEAN:return f.dataType.BOOLEAN;case"char":case"java.lang.Character":case f.dataType.CHAR:return f.dataType.CHAR;case"java.lang.String":case f.dataType.STRING:return f.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case f.dataType.DATETIME:return f.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case f.dataType.DECIMAL:return f.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 f.dataType.INT:return f.dataType.INT;default:return f.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"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return f.isIntegerType(e)||f.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 f.getNormalizedType(e)===f.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}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 je.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,s,o=!0,l=new Promise((u,c)=>{s=setTimeout(()=>{a(),o=!1,c(new Pt('Event "'.concat(t,'" timed out.')))},r),a=e.addEventListener(t,d=>{if(i!=null&&!i(d)){re.debug2("Event triggered, but matcher returned false.");return}re.debug2("Event triggered, resolving."),a(),clearTimeout(s),o=!1,u(d)})});return l.cancel=()=>{if(o){re.debug2("Pending promise cleanup."),a(),clearTimeout(s),o=!1;return}re.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!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 '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=f.removeCommas(t);if(f.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case m.eq:return"=";case m.notEq:return"!=";case m.greaterThan:return">";case m.greaterThanOrEqualTo:return">=";case m.lessThan:return"<";case m.lessThanOrEqualTo:return"<=";case m.contains:return"~";case m.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var a=r.name.toUpperCase(),s=i.name.toUpperCase();return br.sort(a,s,t)})}constructor(e){de(this,"dh",void 0),this.dh=e,fr(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,a=this;return ie(function*(){if(e==null)return null;for(var s=e,o=i.length,l=new Array(o>3?o-3:0),u=3;u<o;u++)l[u-3]=i[u];l.length>0&&(s=yield e.copy(),yield s.applyFilter(xe(...l.map(v=>v(s)))));var c=s.findColumn(t),d=yield s.selectDistinct([c]);s!==e&&s.close();var h=d.findColumn(t).sort()[r]();return a.applySort(d,[h])})()}doesColumnValueExist(e,t,r,i){var a=this;return ie(function*(){if(e==null)return null;var s=$n(a,t,r,i?"eq":"eqIgnoreCase"),o=yield e.copy();yield a.applyFilter(o,xe(s(o)));var l=zn(o);return o.close(),l>0})()}makeQuickFilter(e,t,r){for(var i=t.split("||"),a=null,s=0;s<i.length;s+=1){for(var o=i[s],l=o.split("&&"),u=null,c=0;c<l.length;c+=1){var d=l[c].trim();if(d.length>0){var h=this.makeQuickFilterFromComponent(e,d,r);if(h)u?u=u.and(h):u=h;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&u?a=a.or(u):a=u}return a}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return f.isNumberType(i)?this.makeQuickNumberFilter(e,t):f.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&f.isDateType(i)?this.makeQuickDateFilter(e,t,r):f.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,a=null,s=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,o=s.exec(t),l=null,u=null,c=null,d=null,h=null;if(o!==null&&o.length>3&&([,l,u,c,d,h]=o),h!=null&&h.trim().length>0)return null;if(l==null&&(l="="),d!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":a=r.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?a=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(c==null)return null;if(c=f.removeCommas(c),f.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(v){return re.warn("Unable to create long filter",v),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return a=e.filter(),f.makeRangeFilterWithOperation(a,l,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,s=i.exec(e),o=null,l=null;if(s!==null&&s.length>2&&([,o,l]=s),o!=null){var u;return"\\".concat(o).concat((u=l)!==null&&u!==void 0?u:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=o)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,s=i.exec(e),o=null,l=null;return s!==null&&s.length>2&&([,o,l]=s),o!=null&&(o=o.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),o==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),o==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=o)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,s=a.exec(i),o=null,l=null;if(s!==null&&s.length>2&&([,o,l]=s,l!=null&&(l=l.trim())),l==null||l.length===0&&!(o==="="||o==="!="))return null;o==null&&(o="=");var u=e.filter();if(l.toLowerCase()==="null")switch(o){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(d="*",l=l.substring(0,l.length-1)),l=f.unescapeQuickTextFilter(l),o){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,a,s]=i,o=a==="!"||a==="!=",l=s.trim().toLowerCase(),u=e.filter();try{var c=f.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),o?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,s=a.exec(i);if(s==null||s.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var o=null,l=null;[,o,l]=s;var u=m.eq;switch(o){case"<":u=m.lessThan;break;case"<=":case"=<":u=m.lessThanOrEqualTo;break;case">":u=m.greaterThan;break;case">=":case"=>":u=m.greaterThanOrEqualTo;break;case"!=":case"!":u=m.notEq;break;case"=":case"==":default:u=m.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:a}=this,[s,o]=k.parseDateRange(a,t,i),l=s!=null?a.FilterValue.ofNumber(s):null,u=o!=null?a.FilterValue.ofNumber(o):null,c=e.filter();if(l==null)return r===m.notEq?c.isNull().not():c.isNull();switch(r){case m.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(l),h=c.lessThan(u);return d.and(h)}return c.eq(l)}case m.lessThan:return c.lessThan(l);case m.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case m.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case m.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case m.notEq:{if(u!=null){var v=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return v.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,s=a.exec(i),o=null,l=null,u=null;if(s!==null&&s.length>3&&([,o,l,u]=s),u!=null&&u.trim().length>0||l==null||l.length===0)return null;o==null&&(o="=");var c=e.filter();if(l.toLowerCase()==="null")switch(o){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(f.isRangeOperation(o)?f.quoteValue(l):l);return f.makeRangeFilterWithOperation(c,o,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:a,invertSelection:s,selectedValues:o}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:d,value:h}=c;if(d!=null&&d.length>0&&h!=null&&h.length>0)try{var v=this.makeAdvancedValueFilter(e,d,h,r);if(v!=null){if(u===0)l=v;else if(l!==null&&u-1<a.length){var p=a[u-1];if(p===be.and)l=l.and(v);else if(p===be.or)l=l.or(v);else{re.error("Unexpected filter operator",p,v),l=null;break}}}else re.debug2("Empty filter ignored for",d,h)}catch(S){re.error("Unable to create filter",S),l=null;break}}var y=this.makeSelectValueFilter(e,o,s);return y!=null&&(l!=null?l=l.and(y):l=y),l}makeAdvancedValueFilter(e,t,r,i){var{dh:a}=this;if(f.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(f.isNumberType(e.type)||f.isCharType(e.type))return this.makeQuickFilter(e,"".concat(f.getFilterOperatorString(t)).concat(r));var s=this.makeFilterValue(e.type,r),o=e.filter();switch(t){case m.eq:return o.eq(s);case m.eqIgnoreCase:return o.eqIgnoreCase(s);case m.notEq:return o.notEq(s);case m.notEqIgnoreCase:return o.notEqIgnoreCase(s);case m.greaterThan:return o.greaterThan(s);case m.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(s);case m.lessThan:return o.lessThan(s);case m.lessThanOrEqualTo:return o.lessThanOrEqualTo(s);case m.isTrue:return o.isTrue();case m.isFalse:return o.isFalse();case m.isNull:return o.isNull();case m.contains:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case m.notContains:return o.isNull().or(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case m.startsWith:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case m.endsWith:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case m.in:case m.inIgnoreCase:case m.notIn:case m.notInIgnoreCase:case m.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var s=e.findColumn(t),o=[i.makeNeverFilter(s)];return yield i.applyFilter(e,o,a),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applyCustomColumns(t),e,s.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applyFilter(t),e,s.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applySort(t),e,s.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,r=null;f.isTextType(e.type)?r=t.FilterValue.ofString("a"):f.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):f.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),a=e.filter().notEq(r);return i.and(a)}makeFilterValue(e,t){var{dh:r}=this,i=f.getBaseType(e);return f.isTextType(i)?r.FilterValue.ofString(t):f.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(f.removeCommas(t))):r.FilterValue.ofNumber(f.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return f.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):f.isTextType(e)?r.FilterValue.ofString(t):f.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(f.isTextType(e))return t;if(f.isLongType(e))return i.LongWrapper.ofString(f.removeCommas(t));if(f.isBooleanType(e))return f.makeBooleanValue(t,!0);if(f.isDateType(e)){var[a]=k.parseDateRange(i,t,r);return a}return f.isNumberType(e)?f.makeNumberValue(t):(re.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var a=[],s=!1,o=0;o<t.length;o+=1){var l=t[o];l==null?s=!0:f.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):f.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return s?a.length>0?r?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(a):e.filter().in(a)}}de(f,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});de(f,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});de(f,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);de(f,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));de(f,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);de(f,"executeAndWaitForEvent",function(){var n=ie(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=f.makeCancelableTableEventPromise(t,r,i);return e(t),yield a,t});return function(e,t,r){return n.apply(this,arguments)}}());function Me(n,e,t){return e=Zn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zn(n){var e=Qn(n,"string");return typeof e=="symbol"?e:String(e)}function Qn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Be{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=f.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;Me(this,"defaultColumnFormatter",void 0),Me(this,"typeFormatterMap",void 0),Me(this,"columnFormatMap",void 0),Me(this,"truncateNumbersWithPound",void 0),this.defaultColumnFormatter=new xn,this.typeFormatterMap=new Map([[f.dataType.BOOLEAN,new Pn],[f.dataType.CHAR,new Mn],[f.dataType.DATETIME,new Q(e,r)],[f.dataType.DECIMAL,new R(e,i)],[f.dataType.INT,new J(e,a)],[f.dataType.STRING,new _n]]),this.columnFormatMap=Be.makeColumnFormatMap(t),this.truncateNumbersWithPound=s}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=f.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=f.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),s=i||this.getColumnFormat(t,r);return a.format(e,s??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(f.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function Un(n){if(n&&n.formatter){var{formatter:e}=n;return e}}function Jn(n){return{timeZone:n==null?void 0:n.timeZone,defaultDateTimeFormatString:n==null?void 0:n.defaultDateTimeFormat,showTimeZone:n==null?void 0:n.showTimeZone,showTSeparator:n==null?void 0:n.showTSeparator}}function ei(n,e,t){var r=n.getColumnFormat(t,e);return r!=null&&(r.type===W.TYPE_CONTEXT_PRESET||r.type===W.TYPE_CONTEXT_CUSTOM)}const Le={getColumnFormats:Un,getDateTimeFormatterOptions:Jn,isCustomColumnFormatDefined:ei},ti=typeof Ie=="function"?Ie:Ie.default;wt.register([nr,ir,ar,or,sr,lr]);function B(n,e,t){return e=ri(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ri(n){var e=ni(n,"string");return typeof e=="symbol"?e:String(e)}function ni(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class L{constructor(e){B(this,"dh",void 0),B(this,"listeners",void 0),B(this,"formatter",void 0),B(this,"rect",void 0),B(this,"isDownsamplingDisabled",void 0),B(this,"title",void 0),this.dh=e,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(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(L.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(L.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(L.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(L.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(L.EVENT_ERROR,{detail:e}))}}B(L,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");B(L,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");B(L,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");B(L,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");B(L,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");B(L,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");B(L,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");B(L,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");B(L,"EVENT_ERROR","ChartModel.EVENT_ERROR");const Z=L;function dt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function De(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dt(Object(t),!0).forEach(function(r){$(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $(n,e,t){return e=ii(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ii(n){var e=ai(n,"string");return typeof e=="symbol"?e:String(e)}function ai(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ee=G.module("ChartUtils"),ht="io.deephaven.time.DateTime",oi=36e5,si=1e6;function li(n){return n.asDate!==void 0}function ui(n){return n.asNumber!==void 0}function ft(n){return n.dhTimeZone!==void 0}function ci(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class g{static getPlotlyErrorBars(e,t,r,i){var a=r.map((o,l)=>o-e[l]),s=t.map((o,l)=>e[l]-o);return{type:"data",symmetric:!1,array:a,arrayminus:s,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);ye(a);var[,s,o,l,,u,c,d,h,v]=a,p=l.replace(",","").length,y=o.indexOf(",")>=0||l.indexOf(",")>=0,S=y?",":"",T=d!=null&&d!==""?"e":"f",P=h!==""?h:T,b=u.length+c.length,w="",F="0".concat(p).concat(S,".").concat(b).concat(w).concat(P),_=g.convertNumberPrefix(s),O=g.convertNumberPrefix(v);return{tickformat:F,tickprefix:_,ticksuffix:O,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},s=i;return r&&(s=i/si),t.log&&(s=Math.log(s)),a.tickmode="linear",a.dtick=s,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var s=i.sources[a];if(s.axis===t)return s}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,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:g.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}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 ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getAxisTypeMap(e){var t=g.getAllAxes(e);return g.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],s=0;s<a.series.length;s+=1)if(t===a.series[s])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(o=>o.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],s=e[a];ci(s)&&(t[a]=[...s.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,s=i[t],o=(a=r.get(s))!==null&&a!==void 0?a:[];return o.push(i),r.set(s,o),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Ee.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){$(this,"dh",void 0),$(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},s=g.getAllAxes(e),o=g.groupArray(s,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var c=l[u],d=0;d<c.series.length;d+=1)for(var h=c.series[d],{sources:v}=h,p=v.filter(P=>P.axis),y=function(){var b=p[S],{axis:w}=b,{type:F}=w,_=o.get(F);ye(_);var O=_.indexOf(w),N=r.getAxisPropertyName(F);if(N!=null){var M=g.getAxisLayoutProperty(N,O);if(i.has(M))Ee.debug("".concat(M," already added."));else{Ee.debug("Adding ".concat(M," to axisFormats."));var j=r.getPlotlyAxisFormat(b,t);if(j===null)i.set(M,a);else{i.set(M,j);var{businessCalendar:X}=w;if(X!=null){var z=[],{businessPeriods:te,businessDays:ue,holidays:he,timeZone:me}=X,pe=t==null?void 0:t.getColumnTypeFormatter(ht),we;ft(pe)&&(we=pe.dhTimeZone);var qe=we?(me.standardOffset-we.standardOffset)/60:0;he.length>0&&z.push(...r.createRangeBreakValuesFromHolidays(he,me,we)),te.forEach(Pe=>z.push({pattern:"hour",bounds:[g.periodToDecimal(Pe.close)+qe,g.periodToDecimal(Pe.open)+qe]})),ue.length<r.daysOfWeek.length&&r.createBoundsFromDays(ue).forEach(Pe=>z.push({pattern:"day of week",bounds:Pe})),j.rangebreaks=z}if(i.size===c.axes.length)return{v:i}}}}},S=0;S<p.length;S+=1){var T=y();if(typeof T=="object")return T.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(g.MODE_LINES),(r??!0)&&a.add(g.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(g.MODE_LINES),(r??!1)&&a.add(g.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?g.ORIENTATION.HORIZONTAL:g.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:s,isLinesVisible:o,isShapesVisible:l,plotStyle:u,lineColor:c,shapeColor:d,sources:h,shape:v,shapeSize:p}=e,y=h.some(w=>{var F;return(F=w.axis)===null||F===void 0?void 0:F.businessCalendar}),S=this.getChartType(u,y),T=this.getPlotlyChartMode(u,o??void 0,l??void 0),P=this.getPlotlySeriesOrientation(e),b=g.makeSeriesData(S,T,s,a,P);return this.addSourcesToSeriesData(b,u,h,t),this.addStylingToSeriesData(b,u,i,c,d,v,p,r),b}addSourcesToSeriesData(e,t,r,i){for(var a=e,s=0;s<r.length;s+=1){var o=r[s],{axis:l,type:u}=o,c=this.getPlotlyProperty(t,u);bt(a,c,[]);var d=l!=null?this.getAxisPropertyName(l.type):null;if(d!=null){var h=i.get(l.type);if(h){var v=h.indexOf(l),p=v>0?"".concat(v+1):"";a["".concat(d,"axis")]="".concat(d).concat(p)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,c=e;if(c.marker={line:{}},c.line={width:1},t===u.plot.SeriesPlotStyle.AREA?c.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?c.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?c.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(c.width=[],c.marker.line!==void 0&&Object.assign(c.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(c.increasing={line:{color:r.ohlc_increasing}},c.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(c.textinfo="label+percent",c.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(c.hoverinfo="text",c.textinfo="label+text",c.tiling={packing:"squarify",pad:0},c.textposition="middle center",c.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=i:c.line.color=i),a!=null&&(c.marker.color=a),s!=null&&s.length>0)try{c.marker.symbol=g.getMarkerSymbol(s)}catch(d){Ee.warn("Unable to handle shape",s,":",d)}o!=null&&(c.marker.size=o*g.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=e,l=g.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=i==null?void 0:i(c),h=this.getChartBounds(t,c,a,s);this.updateLayoutAxes(o,c.axes,l,r,a,s,h,d)}this.removeStaleAxes(o,l)}getChartBounds(e,t,r,i){var a,{dh:s}=this,{cols:o,rows:l}=e,{column:u,colspan:c,row:d,rowspan:h}=t,v=u+c,p=d+h,y=1/o,S=1/l,T=g.AXIS_SIZE_PX/r,P=g.AXIS_SIZE_PX/i,b={bottom:(l-p)*S+(p<l?P/2:0),top:(l-d)*S-(d>0?P/2:0),left:u*y+(u>0?T/2:0),right:v*y-(v<o?T/2:0)},w=g.groupArray(t.axes,"position"),F=(a=w.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return F.length>0&&(r>0?b.right-=(b.right-b.left)*Math.max(0,Math.min(g.LEGEND_WIDTH_PX/r,g.MAX_LEGEND_SIZE)):b.right-=(b.right-b.left)*g.DEFAULT_AXIS_SIZE),b}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=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",""),s,o=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&ft(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(s=i.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:a,ticksuffix:s,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:s}=i,o=null;return f.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=g.addTickSpacing(o,i,!0)):f.isNumberType(a)&&(o=g.getPlotlyNumberFormat(t,a,s),o=g.addTickSpacing(o,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,c=a>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/s,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,d=s>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/a,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,h=e,v=g.groupArray(t,"position"),p=g.groupArray(t,"type"),y=[...p.keys()],S=g.groupArray(r,"type"),T=0;T<y.length;T+=1){var P=y[T],b=this.getAxisPropertyName(P);if(b!=null){var w=p.get(P),F=S.get(P),_=P===u.plot.AxisType.Y,O=_?s:a;ye(w),ye(F);for(var N=0;N<w.length;N+=1){var M=w[N],j=F.indexOf(M),X=g.getAxisLayoutProperty(b,j);h[X]==null&&(h[X]=this.makeLayoutAxis(P,i));var z=h[X];if(z!=null){this.updateLayoutAxis(z,M,N,v,c,d,o);var{range:te,autorange:ue}=z;if(l!=null&&te!==void 0&&(ue===void 0||ue===!1)){var he=l(M),[me,pe]=he(te);Ee.debug("Setting downsample range",O,me,pe),M.range(O,me,pe)}else M.range(O)}}}}}removeStaleAxes(e,t){for(var r=e,i=g.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);ye(l);var u=l.length,c=this.getAxisPropertyName(o);if(c!=null)for(var d=g.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=g.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,i,a,s,o){var l,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?s:a,h=e,v=(l=t.label)!==null&&l!==void 0?l:"";if(h.title!==void 0&&typeof h.title!="string"?h.title.text=v:h.title={text:v},t.log&&(h.type="log"),h.side=this.getAxisSide(t.position),r>0){var p,y;h.overlaying=(p=this.getAxisPropertyName(t.type))!==null&&p!==void 0?p:void 0;var S=(y=i.get(t.position))!==null&&y!==void 0?y:[],T=S.indexOf(t);T>0&&(h.anchor="free",t.position===u.plot.AxisPosition.RIGHT?h.position=o.right+(T-S.length+1)*d:t.position===u.plot.AxisPosition.TOP?h.position=o.top+(T-S.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?h.position=o.bottom+(S.length-T+1)*d:t.position===u.plot.AxisPosition.LEFT&&(h.position=o.left+(S.length-T+1)*d))}else if(t.type===u.plot.AxisType.X){var P=i.get(u.plot.AxisPosition.LEFT)||[],b=i.get(u.plot.AxisPosition.RIGHT)||[],w=Math.max(o.left,o.left+(P.length-1)*s),F=Math.min(o.right-(b.length-1)*s,o.right);h.domain=[w,F]}else if(t.type===u.plot.AxisType.Y){var _=i.get(u.plot.AxisPosition.BOTTOM)||[],O=i.get(u.plot.AxisPosition.TOP)||[],N=Math.max(o.bottom,o.bottom+(_.length-1)*a),M=Math.min(o.top-(O.length-1)*a,o.top);h.domain=[N,M]}}createBoundsFromDays(e){var t=e.map(s=>this.daysOfWeek.indexOf(s)),r=this.daysOfWeek.filter(s=>!e.includes(s)).map(s=>this.daysOfWeek.indexOf(s)),i=new Set;r.forEach(s=>{for(var o=s+1;o<s+this.daysOfWeek.length;o+=1){var l=o%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(s=>{for(var o=s-1;o>s-this.daysOfWeek.length;o-=1){var l=o<0?o+this.daysOfWeek.length:o;if(t.includes(l)){var u=(l+1)%7;a.push([u,s]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(s=>{s.businessPeriods.length>0?a.push(...this.createPartialHoliday(s,t,r)):i.push(this.createFullHoliday(s,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(h=>{a.push(h.open),a.push(h.close)}),a.push("24:00");for(var s=[],o=0;o<a.length;o+=2){var l=a[o],u=a[o+1];if(l!==u){var c=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],d=oi*(g.periodToDecimal(u)-g.periodToDecimal(l));s.push({values:c,dvalue:d})}}return s}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ht,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:s}=e,o=g.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(c=>({plotStyle:"".concat(s),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:c,axis:u,table:t}]}))}],title:o}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(li(e))return r.i18n.DateTimeFormat.format(g.DATE_FORMAT,e,t);if(ui(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(f.isDateType(t)&&typeof e=="string"){var a=e,s=g.DATE_FORMAT.substr(0,e.length),o=i.i18n.DateTimeFormat.parse(s,a);if(!r)return o;var l="".concat(s," Z"),u=i.i18n.DateTimeFormat.format("Z",o,r),c=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),d=i.i18n.DateTimeFormat.format("Z",c,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={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}},legend:{font:{color:t.legend_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:r,plot_bgcolor:i,title_color:a,coastline_color:s,land_color:o,ocean_color:l,lake_color:u,river_color:c}=e,d={paper_bgcolor:r,plot_bgcolor:i,autosize:!0,colorway:g.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},yanchor:"top",pad:De({},g.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:De({},g.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:r,coastlinecolor:s,landcolor:o,oceancolor:l,lakecolor:u,rivercolor:c}};return d.datarevision=0,d}hydrateSettings(e){var{dh:t}=this;return De(De({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}$(g,"DEFAULT_AXIS_SIZE",.15);$(g,"MIN_AXIS_SIZE",.025);$(g,"MAX_AXIS_SIZE",.2);$(g,"AXIS_SIZE_PX",75);$(g,"LEGEND_WIDTH_PX",50);$(g,"MAX_LEGEND_SIZE",.25);$(g,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));$(g,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");$(g,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));$(g,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));$(g,"SUBTITLE_LINE_HEIGHT",25);$(g,"DEFAULT_MARKER_SIZE",6);$(g,"MODE_MARKERS","markers");$(g,"MODE_LINES","lines");const q=g;function di(n,e,t){return e=hi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hi(n){var e=fi(n,"string");return typeof e=="symbol"?e:String(e)}function fi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mi extends Error{constructor(){super(...arguments),di(this,"isDownsamplingError",!0)}}const pi=mi;function mt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mt(Object(t),!0).forEach(function(r){H(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function H(n,e,t){return e=vi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vi(n){var e=gi(n,"string");return typeof e=="symbol"?e:String(e)}function gi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ne=G.module("Chart");class le extends C.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,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"}constructor(e){var t;super(e),H(this,"currentSeries",void 0),H(this,"PlotComponent",void 0),H(this,"plot",void 0),H(this,"plotWrapper",void 0),H(this,"columnFormats",void 0),H(this,"dateTimeFormatterOptions",void 0),H(this,"decimalFormatOptions",void 0),H(this,"integerFormatOptions",void 0),H(this,"rect",void 0),H(this,"ranges",void 0),H(this,"isSubscribed",void 0),H(this,"isLoadedFired",void 0),H(this,"resizeObserver",void 0),H(this,"getCachedConfig",kt((r,i,a,s,o,l)=>{var u=[],c=!!r;c&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:le.convertIcon(Ge),attr:"fill-warning"});var d=!!l;if(d&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:le.convertIcon(Ge),attr:"fill-warning"}),i||a||s||c){var h=le.downsampleButtonTitle(a,s),v=le.downsampleButtonAttr(a,s),p=a?Ut:Jt;u.push({name:h,title:"Downsampling status",icon:le.convertIcon(p),click:this.handleDownsampleClick,attr:v})}var y=o.some(b=>{var{type:w}=b;return w!=null&&!w.includes("3d")}),S=o.some(b=>{var{type:w}=b;return w!=null&&w.includes("3d")}),T=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],P=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||c||d?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...y?T:[],...S?P:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=ti(e.Plotly),this.plot=K.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:K.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:pt(pt({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ne.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch(ne.debug2("Received data update",t,r),t){case Z.EVENT_UPDATED:{this.currentSeries+=1,this.setState(v=>{var{layout:p,revision:y}=v;return typeof p.datarevision=="number"&&(p.datarevision+=1),{data:r,layout:p,revision:y+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case Z.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case Z.EVENT_DISCONNECT:{var{onDisconnect:s}=this.props;s();break}case Z.EVENT_RECONNECT:{var{onReconnect:o}=this.props;o();break}case Z.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Z.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Z.EVENT_DOWNSAMPLENEEDED:case Z.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new pi(u));break}case Z.EVENT_ERROR:{var d="".concat(r);this.setState({error:d});var{onError:h}=this.props;h(new Error(d));break}default:ne.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=q.getLayoutRanges(t),i=!ve(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ne.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if(ne.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var s=i.reduce((o,l)=>{var{name:u,visible:c}=l;return u!=null&&c==="legendonly"?[...o,u]:o},[]);a({hiddenSeries:s})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){ne.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=Le.getColumnFormats(e),r=Le.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!ve(this.columnFormats,t)||!ve(this.dateTimeFormatterOptions,r)||!ve(this.decimalFormatOptions,i)||!ve(this.integerFormatOptions,a))&&(this.columnFormats=Le.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Be(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{ne.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:s,error:o,shownError:l,layout:u,revision:c}=this.state,d=this.getCachedConfig(r,i,a,s,t??[],o),h=t!=null;return E.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[h&&E.jsx(e,{ref:this.plot,data:t,layout:u,revision:c,config:d,onAfterPlot:this.handleAfterPlot,onError:ne.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),E.jsx(Ft,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"chart-error",children:l}),E.jsx(rn,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}H(le,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:k.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:wt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const zi=le;function vt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(t),!0).forEach(function(r){A(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function A(n,e,t){return e=yi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yi(n){var e=Ei(n,"string");return typeof e=="symbol"?e:String(e)}function Ei(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var V=G.module("FigureChartModel");class Ce extends Z{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,A(this,"chartUtils",void 0),A(this,"dh",void 0),A(this,"figure",void 0),A(this,"settings",void 0),A(this,"theme",void 0),A(this,"data",void 0),A(this,"layout",void 0),A(this,"seriesDataMap",void 0),A(this,"pendingSeries",void 0),A(this,"oneClicks",void 0),A(this,"filterColumnMap",void 0),A(this,"lastFilter",void 0),A(this,"isConnected",void 0),A(this,"seriesToProcess",void 0),A(this,"addPendingSeries",_t(()=>{for(var o=q.getAxisTypeMap(this.figure),{pendingSeries:l}=this,u=function(){var h,v=l[c],p=i.figure.charts.find(y=>y.series.includes(v));i.addSeries(v,o,(h=p==null?void 0:p.showLegend)!==null&&h!==void 0?h:null),v.subscribe()},c=0;c<l.length;c+=1)u();this.pendingSeries=[]},Ce.ADD_SERIES_DEBOUNCE)),A(this,"getTimeZone",ge((o,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(o);if(u!=null)return u.dhTimeZone}})),A(this,"getValueTranslator",ge((o,l)=>{var u=this.getTimeZone(o,l);return c=>this.chartUtils.unwrapValue(c,u)})),A(this,"getValueParser",ge((o,l)=>{var u=this.getTimeZone(o,l);return c=>this.chartUtils.wrapValue(c,o,u)})),A(this,"getRangeParser",ge((o,l)=>u=>{var[c,d]=u,h=this.getValueParser(o,l);return c=h(c),d=h(d),[c,d]})),A(this,"getAxisRangeParser",ge((o,l)=>u=>{var c=q.getSourceForAxis(o,u);return c!=null?this.getRangeParser(c.columnType,l):d=>d})),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.dh=e,this.chartUtils=new q(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var s={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.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(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,r=q.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var h=t[s],v=0;v<h.series.length;v+=1){var p=h.series[v];i.push(p.name),e.addSeries(p,r,h.showLegend)}var{axes:y,title:S}=h;if(S!=null&&S.length>0&&(t.length>1||e.figure.title!=null)){var T=y.find(j=>j.type===e.dh.plot.AxisType.X),P=y.find(j=>j.type===e.dh.plot.AxisType.Y);if(T==null||P==null)V.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",h);else{var b,w,F,_,O=((b=(w=r.get(T.type))===null||w===void 0?void 0:w.findIndex(j=>j===T))!==null&&b!==void 0?b:0)+1,N=((F=(_=r.get(P.type))===null||_===void 0?void 0:_.findIndex(j=>j===P))!==null&&F!==void 0?F:0)+1,M={align:"center",x:.5,y:1,yshift:17,text:S,showarrow:!1,xref:"x".concat(O," domain"),yref:"y".concat(N," domain")};e.layout.annotations==null?e.layout.annotations=[M]:e.layout.annotations.push(M)}}},s=0;s<t.length;s+=1)a();for(var o=[...this.seriesDataMap.keys()],l=o.filter(d=>i.indexOf(d)<0),u=0;u<l.length;u+=1){var c=l[u];this.seriesDataMap.delete(c)}}addSeries(e,t,r){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,q.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=q.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,l=0;l<o.length;l+=1)this.filterColumnMap.set(o[l].name,o[l]);this.oneClicks.push(s)}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){V.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(V.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){V.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){V.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){V.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){V.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;V.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];V.debug2("handleFigureUpdated updating series",a.name);for(var{sources:s}=a,o=0;o<s.length;o+=1){var l=s[o],{columnType:u,type:c}=l,d=this.getValueTranslator(u,this.formatter),h=t.getArray(a,c,d);this.setDataArrayForSeries(a,c,h)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:v}=this;this.fireUpdate(v)}handleRequestFailed(e){V.error("Request failed",e),this.fireError(["".concat(e.detail)])}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){V.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){V.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;V.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=q.DEFAULT_MARGIN.t+i*q.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=gt({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=gt({},this.layout.title.pad),this.layout.title.pad.t=q.DEFAULT_TITLE_PADDING.t+i*q.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{V.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):V.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,s=this.seriesDataMap.get(i),o=this.chartUtils.getPlotlyProperty(a,t);s&&bt(s,o,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:s,xHigh:o}=a;if(s&&o&&s.length===o.length){for(var l=[],u=0;u<s.length;u+=1)l.push(o[u]-s[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:h,y:v,yLow:p,yHigh:y}=a;d&&h&&d!==c&&(a.error_x=q.getPlotlyErrorBars(c,d,h,this.theme)),p&&y&&p!==v&&(a.error_y=q.getPlotlyErrorBars(v,p,y,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:S,labels:T}=a;S!==void 0&&T===void 0&&(a.labels=S)}}}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){var t=this;if(this.oneClicks.length===0){V.warn("Trying to set a filter, but no one click!");return}V.debug("setFilter",e);for(var r=function(){var s=t.oneClicks[i],{columns:o}=s,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&o.find(d=>d.name===u)!=null&&s.setValueForColumn(u,c)})},i=0;i<this.oneClicks.length;i+=1)r();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}}A(Ce,"ADD_SERIES_DEBOUNCE",50);const yt=Ce;function Et(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Et(a,r,i,s,o,"next",l)}function o(l){Et(a,r,i,s,o,"throw",l)}s(void 0)})}}class Ke{static makeModelFromSettings(e,t,r,i){return Re(function*(){var a=yield Ke.makeFigureFromSettings(e,t,r);return new yt(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return Re(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new q(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return Re(function*(){return new yt(e,r,i,t)})()}}const Gi=Ke,Si="var(--dh-color-chart-colorway)",Ti="var(--dh-color-chart-grid)",bi="var(--dh-color-chart-axis-line)",wi="var(--dh-color-chart-axis-line-zero)",St={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:Si,gridcolor:Ti,linecolor:bi,zerolinecolor:wi,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var Tt=G.module("ChartTheme");function Pi(){var n,e=er(St);return e.colorway=tr((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return rr.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Tt.debug2("Chart theme:",St),Tt.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}var Nt=C.createContext(null);function Xi(n){var{children:e}=n,{activeThemes:t}=Sn(),r=C.useMemo(Pi,[t]);return E.jsx(Nt.Provider,{value:r,children:e})}function Yi(){return Oe(Nt,"No ChartThemeContext value found.")}var Fi=C.createContext(null);function Zi(){return Oe(Fi,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{xe as $,ki as A,Kr as B,zi as C,Q as D,Ot as E,Be as F,qn as G,Vi as H,J as I,Wi as J,_i as K,ji as L,$i as M,$n as N,Bi as O,je as P,Ki as Q,Un as R,_n as S,Ar as T,Jn as U,zn as V,Gn as W,ei as X,qi as Y,Ci as Z,Ni as _,Ri as a,Xe as a0,Z as a1,Pi as a2,q as a3,ti as a4,Nt as a5,Xi as a6,mi as a7,yt as a8,Ai as a9,vr as aa,be as ab,Hi as ac,br as ad,Fi as ae,Yi as b,xi as c,Gi as d,Oe as e,xr as f,Ft as g,ce as h,Ii as i,Xr as j,Sn as k,rn as l,Mt as m,Li as n,Pt as o,m as p,Pn as q,Mn as r,k as s,gn as t,Zi as u,R as v,xn as w,Le as x,W as y,f as z};
3
- //# sourceMappingURL=useConnection-faad8059.js.map
1
+ import{r as C,G as K,aZ as At,C as E,D as Ct,E as U,R as It,V as D,F as ke,a_ as xt,L as Lt,a$ as Rt,a3 as ze,b0 as bt,ac as ve,ao as kt,K as _t,U as ge}from"./vendor-c2fe68e8.js";import{T as jt,L as G,k as Vt,w as $t,bm as Ht,bj as Wt,G as Bt,J as Kt,D as qt,F as zt,K as Gt,z as Xt,R as Yt,u as Zt,X as Qt,n as ye,aj as Ge,bn as Ut,bo as Jt,r as er,H as tr,$ as rr}from"./index-da469645.js";import{c as Ie,P as wt,b as nr,h as ir,p as ar,o as or,s as sr,t as lr}from"./plotly-99117086.js";var Ni=Object.freeze([]),Ai=new Map,Ci=()=>{};function xe(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function ur(n,e,t){return e=cr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cr(n){var e=dr(n,"string");return typeof e=="symbol"?e:String(e)}function dr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class hr extends Error{constructor(){super(...arguments),ur(this,"isCanceled",!0)}}const Xe=hr;function fr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=mr(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function mr(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(r))a!=="constructor"&&typeof r[a]=="function"&&t.add(a);r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Ye(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function pr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Ye(a,r,i,s,o,"next",l)}function o(l){Ye(a,r,i,s,o,"throw",l)}s(void 0)})}}function vr(n){return _e.apply(this,arguments)}function _e(){return _e=pr(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return Ze(n)}Ze(n)}),_e.apply(this,arguments)}function Ze(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function gr(n,e,t){return e=yr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yr(n){var e=Er(n,"string");return typeof e=="symbol"?e:String(e)}function Er(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Sr extends Error{constructor(){super(...arguments),gr(this,"isTimeout",!0)}}const Pt=Sr;class je{static makeCancelable(e,t){var r=!1,i,a,s=new Promise((o,l)=>{a=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,o(u))}).catch(u=>l(u))});return s.cancel=()=>{r=!0,a(new Xe),i!=null&&t&&t(i)},s}static isCanceled(e){return e instanceof Xe}static isTimedOut(e){return e instanceof Pt}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(a){i(a)}},e)})}}class Tr{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}const br=Tr;function Qe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qe(Object(t),!0).forEach(function(r){fe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fe(n,e,t){return e=Pr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pr(n){var e=Fr(n,"string");return typeof e=="symbol"?e:String(e)}function Fr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ve extends C.Component{constructor(e){super(e),fe(this,"element",void 0),fe(this,"container",void 0),fe(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=K.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=wr({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new At(r||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){var s=this.element.firstElementChild;s instanceof HTMLElement&&s.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:a}=this.props,{show:s}=this.state;return E.jsx(Ct,{in:s,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:E.jsx("div",{onClick:o=>{o.stopPropagation()},onKeyDown:o=>{o.key==="Escape"&&this.hide()},className:U("popper",{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:E.jsxs("div",{className:"popper-content",children:[t,E.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return E.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&It.createPortal(this.renderContent(),this.element)})}}fe(Ve,"propTypes",{children:D.node.isRequired,options:D.shape({}),className:D.string,timeout:D.number,onEntered:D.func,onExited:D.func,isShown:D.bool,closeOnBlur:D.bool,interactive:D.bool,referenceObject:D.shape({}),"data-testid":D.string});fe(Ve,"defaultProps",{options:{},className:"",timeout:jt.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ft=Ve;function Ue(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Mr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ue(Object(t),!0).forEach(function(r){Y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Y(n,e,t){return e=Dr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dr(n){var e=Or(n,"string");return typeof e=="symbol"?e:String(e)}function Or(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Nr=G.module("Tooltip");class x extends C.Component{static handleHidden(){x.shownTooltipCount-=1,x.shownTooltipCount===0&&(x.lastHiddenTime=Date.now())}static handleShown(){x.shownTooltipCount+=1}constructor(e){super(e),Y(this,"container",void 0),Y(this,"popper",void 0),Y(this,"parent",void 0),Y(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=K.createRef(),this.popper=K.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?x.handleShown():x.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&x.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Nr.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),s=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():t>=s.left&&t<=s.left+s.width&&r>=s.top&&r<=s.top+s.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(x.shownTooltipCount>0||Date.now()-x.lastHiddenTime<x.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":a,onEntered:s}=this.props,{isShown:o}=this.state,{options:l}=this.props;return l=Mr({placement:"bottom"},l),E.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:E.jsx(Ft,{className:U(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:s,onExited:this.handleExited,interactive:e,referenceObject:r,children:E.jsxs("div",{className:"tooltip-content",children:[" ",o&&t]})})})}}Y(x,"defaultTimeout",500);Y(x,"defaultReshowTimeout",100);Y(x,"triggerReshowThreshold",300);Y(x,"shownTooltipCount",0);Y(x,"lastHiddenTime",Date.now());Y(x,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:x.defaultReshowTimeout,timeout:x.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Ar=x;function Oe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=C.useContext(n);if(t==null)throw new Error(e);return t}var Cr=3500,Ir=G.module("useCopyToClipboard");function xr(){var[n,e]=C.useState(!1),t=C.useRef(null),r=C.useCallback(i=>{vr(i).then(()=>{e(!0)}).catch(a=>Ir.error("Unable to copy ".concat(i),`
2
+ `,a))},[]);return C.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},Cr)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var Lr=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Je(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(t),!0).forEach(function(r){Rr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Rr(n,e,t){return e=kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kr(n){var e=_r(n,"string");return typeof e=="symbol"?e:String(e)}function _r(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function jr(n,e){if(n==null)return{};var t=Vr(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Vr(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var $r=["primary","secondary","tertiary","success","danger","inline","ghost"],Hr=["group-end"];function Wr(n,e){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Br(n){switch(n){case"group-end":return U("pl-2","pr-3")}}var Ne=K.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:a,icon:s,disabled:o=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:d,onMouseUp:h,onMouseEnter:v,onMouseLeave:p,onKeyDown:y,className:S,style:T,children:P,tabIndex:b,"data-testid":w,"aria-label":F}=n,_=jr(n,Lr),O;r&&(O=Br(r));var N;s&&(N=K.isValidElement(s)?s:E.jsx(ke,{icon:s}));var M=N!=null&&P==null,j=Wr(t,M),X;a!==void 0&&(X=typeof a=="string"?E.jsx(Ar,{children:a}):a);var z=F;F===void 0&&M&&a!=null&&typeof a=="string"&&(z=a);var te=E.jsxs("button",et(et({"data-testid":w,ref:e,type:i,className:U("btn",j,O,{active:l},S),onClick:u,onContextMenu:c,onMouseUp:h,onMouseDown:d,onMouseEnter:v,onMouseLeave:p,onKeyDown:y,style:T,disabled:o,tabIndex:b,"aria-label":z},_),{},{children:[s&&N,P,a!=null&&!o&&X]}));return o&&a!=null?E.jsxs("span",{className:"btn-disabled-wrapper",children:[te,X]}):te});Ne.displayName="Button";Ne.propTypes={kind:D.oneOf($r).isRequired,variant:D.oneOf(Hr),type:D.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!K.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.bool,active:D.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:D.func,onMouseUp:D.func,onMouseDown:D.func,onMouseEnter:D.func,onMouseLeave:D.func,onKeyDown:D.func,tabIndex:D.number,children:D.node,className:D.string,style:D.object,"data-testid":D.string};Ne.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Kr=Ne;function qr(n,e,t){return e=zr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zr(n){var e=Gr(n,"string");return typeof e=="symbol"?e:String(e)}function Gr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ii(n){return n.then!==void 0}class se{static disableAllActions(){se.actionsDisabled=!0}static enableAllActions(){se.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var a,s;return((a=e.order)!==null&&a!==void 0?a:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var o,l;return((o=e.title)!==null&&o!==void 0?o:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(se.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return se.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=se.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var a=0;a<i.length;a+=1){var s=i[a],o=void 0;typeof s=="function"?o=s():o=s,o!=null&&(o instanceof Promise?t&&r.push(o):Array.isArray(o)?r=r.concat(o):r.push(o))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var a=1;a<r.length+1;a+=1){var s=(i+t*a+r.length)%r.length,o=r[s];if(!(o instanceof Promise)&&o.disabled!==!0)return s}return e}}qr(se,"actionsDisabled",!1);const ce=se;var $e=K.forwardRef((n,e)=>{var t,r;function i(O){var{menuItem:N,onMenuItemClick:M}=n;M(N,O)}function a(O){var{menuItem:N,onMenuItemMouseMove:M}=n;M(N,O)}function s(O){var{menuItem:N,onMenuItemContextMenu:M}=n;M(N,O)}function o(O,N,M){if(typeof O.type=="string")return O;var{closeMenu:j,menuItem:X,isKeyboardSelected:z,isMouseSelected:te,"data-testid":ue}=n,he={menuItem:X,closeMenu:j,isKeyboardSelected:z,isMouseSelected:te,iconElement:N,displayShortcut:M,"data-testid":ue};return K.cloneElement(O,{forwardedProps:he})}var{children:l,menuItem:u,isKeyboardSelected:c=!1,isMouseSelected:d=!1,"data-testid":h}=n,v=(t=u.shortcutText)!==null&&t!==void 0?t:(r=u.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(u.icon){var y=u.icon;if(K.isValidElement(y))p=y;else{var S;u.iconColor!=null&&(u.disabled===void 0||!u.disabled)&&(S={color:u.iconColor}),p=E.jsx(ke,{icon:y,style:S})}}var T=null,P=!!l;u.actions&&(T=E.jsx(ke,{icon:Vt}));var b=null;if(u.menuElement)b=E.jsx("div",{className:"custom-menu-item",onMouseMove:a,children:o(u.menuElement,p,v)});else{var w,F=u.disabled,_=u.iconOutline;b=E.jsx("button",{type:"button",className:U("btn-context-menu",{disabled:F},{active:(P||d)&&(F===void 0||!F)},{"keyboard-active":c&&(F===void 0||!F)}),onClick:i,onMouseMove:a,onContextMenu:s,title:(w=u.description)!==null&&w!==void 0?w:"",children:E.jsxs("div",{className:"btn-context-menu-wrapper",children:[E.jsx("span",{className:U("icon",{outline:_}),children:p}),E.jsx("span",{className:"title",children:u.title}),v!==void 0&&E.jsx("span",{className:"shortcut",children:v}),T&&E.jsx("span",{className:U("submenu-indicator",{disabled:F}),children:T})]})})}return E.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[l,b]})});$e.displayName="ContextMenuItem";$e.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Xr=$e;function tt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(t),!0).forEach(function(r){ae(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):tt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ae(n,e,t){return e=Zr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zr(n){var e=Qr(n,"string");return typeof e=="symbol"?e:String(e)}function Qr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rt=G.module("ContextMenu");class Se extends C.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),ae(this,"container",void 0),ae(this,"oldFocus",void 0),ae(this,"activeSubMenuRef",void 0),ae(this,"subMenuTimer",void 0),ae(this,"rAF",void 0),ae(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=K.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=K.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var s;(s=this.container.current)===null||s===void 0||s.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=ce.getMenuItems(r),a=[],s=i.length-1;s>=0;s-=1){var o=i[s];o instanceof Promise?this.initMenuPromise(o):a.push(o)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:ce.sortActions(a)})}initMenuPromise(e){var t=je.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var s=i.pendingItems.slice();return s.splice(a,1),{menuItems:ce.sortActions(i.menuItems.concat(r)),pendingItems:s}}return null})},r=>{je.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var s=i.pendingItems.slice();return s.splice(a,1),{pendingItems:s}}return null}),rt.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:s,subMenuParentWidth:o,subMenuParentHeight:l,top:u,left:c}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:d,left:h}=this.initialPosition,{width:v,height:p}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},y=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;p===0||v===0||(d+p>window.innerHeight&&(d-p-l>0?d-=p-l:d=window.innerHeight-p),h+v>window.innerWidth&&(h=h-v-o),(c!==h||u!==d)&&(this.setState({hasOverflow:y}),s(d,h)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){rt.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=ce.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=ce.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:s,menuItems:o,mouseIndex:l,pendingItems:u,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:h,subMenuParentHeight:v}=this.state,p=0;p<o.length;p+=1){var y=o[p];p>0&&y.group!==o[p-1].group&&e.push(E.jsx("hr",{},"".concat(p,".separator")));var S=E.jsx(Xr,{ref:i===p?this.activeSubMenuRef:null,isKeyboardSelected:s===p,isMouseSelected:l===p,menuItem:y,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},p);e.push(S)}var T=null;u.length>0&&(T=E.jsx("div",{className:"loading",children:E.jsx($t,{className:"loading-spinner-vertical-align"})}));var{menuStyle:P,"data-testid":b}=this.props,w=i!==null&&c!==null&&d!==null;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:U({"has-overflow":a},"context-menu-container"),style:Yr({top:t,left:r},P),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Se.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":b,children:[e,T]}),w&&i!==null&&c!==null&&d!==null&&E.jsx(Se,{actions:o[i].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(F,_)=>{this.setState({subMenuTop:F,subMenuLeft:_})},subMenuParentWidth:h,subMenuParentHeight:v},"sub-".concat(i))]})}}ae(Se,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Ur=Se;function nt(n,e,t){return e=Jr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jr(n){var e=en(n,"string");return typeof e=="symbol"?e:String(e)}function en(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tn extends C.Component{constructor(e){super(e),nt(this,"container",void 0),nt(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=K.createRef(),this.openMenu=K.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var o=document.elementFromPoint(i,r),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o==null||o.dispatchEvent(l)});return}if(ce.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var s=ce.getMenuItems(e.contextActions);s.length!==0&&(e.preventDefault(),this.setState({actions:s,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=E.jsx(Ur,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(s,o)=>{this.setState({top:s,left:o})},"data-testid":t})),E.jsx("div",{className:U("context-menu-root",{active:r}),ref:this.container,children:e})}}const xi=tn;function rn(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,style:a,"data-testid":s,children:o}=n,[l,u]=xr();return E.jsx(Kr,{kind:t,className:i,style:a,"data-testid":s,icon:l?Ht:Wt,tooltip:l?"Copied":r,onClick:()=>{u(typeof e=="function"?e():e)},children:o})}const nn={"dh-spectrum-palette":"_dh-spectrum-palette_1mcqx_1"},an={"dh-spectrum-alias":"_dh-spectrum-alias_1uc7a_1"};function it(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?it(Object(t),!0).forEach(function(r){on(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function on(n,e,t){return e=sn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sn(n){var e=ln(n,"string");return typeof e=="symbol"?e:String(e)}function ln(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ot=at(at({},nn),an);function st(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(r){un(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function un(n,e,t){return e=cn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cn(n){var e=dn(n,"string");return typeof e=="symbol"?e:String(e)}function dn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:hn,light:fn,dark:mn,medium:pn,large:vn}=xt,gn={global:hn,light:Fe(Fe({},fn),ot),dark:Fe(Fe({},mn),ot),medium:pn,large:vn};function yn(n){var{children:e,isPortal:t=!1,theme:r=gn,colorScheme:i}=n,[a]=C.useState(t?Lt():null);return E.jsx(Rt,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":a,children:e})}var En=G.module("ThemeProvider"),Mt=C.createContext(null);function Li(n){var{themes:e,defaultPreloadValues:t=Zt,children:r}=n,i=C.useMemo(()=>Bt(),[]),[a,s]=C.useState(null),[o,l]=C.useState(()=>{var d,h;return(d=(h=Kt())===null||h===void 0?void 0:h.themeKey)!==null&&d!==void 0?d:qt}),u=C.useMemo(()=>e==null?null:zt(o,{base:i,custom:e??[]}),[i,o,e]),c=C.useMemo(()=>[...i,...e??[]],[i,e]);return C.useEffect(function(){if(!(u==null||e==null)){Gt(t);var h=Xt(t);En.debug2("updateThemePreloadData:",{active:u.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:h,selectedThemeKey:o}),Yt({themeKey:o,preloadStyleContent:h})}},[u,o,e,t]),C.useEffect(()=>{s({activeThemes:u,selectedThemeKey:o,themes:c,setSelectedThemeKey:l})},[u,o,c]),E.jsxs(E.Fragment,{children:[u==null?null:E.jsx(E.Fragment,{children:u.map(d=>E.jsx("style",{"data-theme-key":d.themeKey,children:d.styleContent},d.themeKey))}),a==null?null:E.jsx(Mt.Provider,{value:a,children:E.jsx(yn,{children:r})})]})}function Sn(){return Oe(Mt,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function Ri(){return Oe(Qt,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function He(n,e,t){return e=Tn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tn(n){var e=bn(n,"string");return typeof e=="symbol"?e:String(e)}function bn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ae{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}He(Ae,"TYPE_GLOBAL","type-global");He(Ae,"TYPE_CONTEXT_PRESET","type-context-preset");He(Ae,"TYPE_CONTEXT_CUSTOM","type-context-custom");const W=Ae;class wn extends W{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Pn=wn;class Fn extends W{format(e){return String.fromCharCode(e)}}const Mn=Fn;function oe(n,e,t){return e=Dn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dn(n){var e=On(n,"string");return typeof e=="symbol"?e:String(e)}function On(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=G.module("DateTimeColumnFormatter");class Q extends W{static isValid(e,t){try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.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){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=Q.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=Q.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=Q.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oe(this,"dh",void 0),oe(this,"dhTimeZone",void 0),oe(this,"defaultDateTimeFormatString",void 0),oe(this,"showTimeZone",void 0),oe(this,"showTSeparator",void 0),oe(this,"formatStringMap",void 0);var s=t||Q.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(s)}catch{lt.error("Unsupported time zone id",s),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(Q.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=Q.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{lt.error("Invalid format arguments")}return""}}oe(Q,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");oe(Q,"DEFAULT_TIME_ZONE_ID","America/New_York");function ee(n,e,t){return e=Nn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nn(n){var e=An(n,"string");return typeof e=="symbol"?e:String(e)}function An(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Cn=G.module("DecimalColumnFormatter");class R extends W{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return R.makeFormat(e,t,W.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return R.makeFormat("Custom Format",e,W.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}constructor(e){var{defaultFormatString:t=R.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ee(this,"defaultFormatString",void 0),ee(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Cn.error("Invalid format arguments")}return""}}ee(R,"DEFAULT_FORMAT_STRING","###,##0.0000");ee(R,"FORMAT_PERCENT",R.makePresetFormat("Percent","##0.00%"));ee(R,"FORMAT_BASIS_POINTS",R.makePresetFormat("Basis Points","###,##0 bp",1e4));ee(R,"FORMAT_MILLIONS",R.makePresetFormat("Millions","###,##0.000 mm",1e-6));ee(R,"FORMAT_SCIENTIFIC_NOTATION",R.makePresetFormat("Scientific Notation","0.0000E0"));ee(R,"FORMAT_ROUND",R.makePresetFormat("Round","###,##0"));ee(R,"FORMAT_ROUND_TWO_DECIMALS",R.makePresetFormat("0.00","###,##0.00"));ee(R,"FORMAT_ROUND_FOUR_DECIMALS",R.makePresetFormat("0.0000","###,##0.0000"));class In extends W{format(e){return"".concat(e)}}const xn=In;function Te(n,e,t){return e=Ln(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ln(n){var e=Rn(n,"string");return typeof e=="symbol"?e:String(e)}function Rn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kn=G.module("IntegerColumnFormatter");class J extends W{static isValid(e,t){try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return J.makeFormat(e,t,W.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return J.makeFormat("Custom Format",e,W.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}constructor(e){var{defaultFormatString:t=J.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Te(this,"dh",void 0),Te(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{kn.error("Invalid format arguments")}return""}}Te(J,"DEFAULT_FORMAT_STRING","###,##0");Te(J,"FORMAT_MILLIONS",J.makePresetFormat("Millions","###,##0.000 mm",1e-6));Te(J,"FORMAT_SCIENTIFIC_NOTATION",J.makePresetFormat("Scientific Notation","0.0000E0"));class _n extends W{format(e){return e}}function Dt(n,e,t){return e=jn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jn(n){var e=Vn(n,"string");return typeof e=="symbol"?e:String(e)}function Vn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class k{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),d="".concat(i+1).padStart(2,"0"),h="".concat(a).padStart(2,"0"),v="".concat(s).padStart(2,"0"),p="".concat(o).padStart(2,"0"),y="".concat(l).padStart(2,"0"),S="".concat(u).padStart(9,"0"),T="".concat(c,"-").concat(d,"-").concat(h," ").concat(v,":").concat(p,":").concat(y,".").concat(S);return e.i18n.DateTimeFormat.parse(k.FULL_DATE_FORMAT,T,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:a,month:s,date:o,hours:l,minutes:u,seconds:c,nanos:d}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;d=k.getNextNanos(t.nanos),d>999999999&&(c+=1,d=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?o+=1:t.month!=null?s+=1:a+=1;var h=new Date(a,s,o,l,u,c);return k.makeDateWrapper(e,i,h.getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),d)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<k.months.length;i+=1)if(k.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,a,s,o){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,d=i!=null?parseInt(i,10):0,h=a!=null?parseInt(a,10):0,v=s!=null?parseInt(s,10):0,p=o!=null?parseInt(o.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(v)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:d,minutes:h,seconds:v,nanos:p}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,r=t.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,s,,o,,l,,u,,c,d]=r;if(d!=null&&d.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(d));return{year:i,month:a,date:s,hours:o,minutes:l,seconds:u,nanos:c}}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),s=k.makeDateWrapper(e,r,a.getFullYear(),a.getMonth(),a.getDate()),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=k.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate());return[s,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),d=k.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),h=k.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[d,h]}if(i==="now"){var v=new Date(Date.now()),p=e.DateWrapper.ofJsDate(v);return[p,null]}var y=k.parseDateTimeString(i);if(y.year==null&&y.month==null&&y.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var S=k.parseDateValues(y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos);if(S==null)throw new Error("Unable to extract date values from ".concat(y));var T=k.makeDateWrapper(e,r,S.year,S.month,S.date,S.hours,S.minutes,S.seconds,S.nanos),P=k.getNextDate(e,y,S,r);return[T,P]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}Dt(k,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Dt(k,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function ki(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function _i(n,e,t){return function(i){var a=t.trim();if(a==="")return null;var s=Ot(e,o=>o.filter().containsIgnoreCase(n.makeFilterValue(o.type,a)),"or");return s(i)}}function Ot(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(a==null||a.length===0)return null;var s=a.map(e);return s.reduce((o,l)=>o[t](l))}}function $n(n,e,t,r){return Ot(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function ji(n,e,t,r,i){return function(s){var o=s==null?void 0:s.findColumn(e),l=t==="all"||r&&t.size===0;return o==null||l?null:n.makeSelectValueFilter(o,[...t.keys()],i)}}function Vi(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function $i(n,e){return function(r){var i=r.filter(),a=n.makeFilterValue(r.type,""),s=i.eq(a);return e?i.isNull().or(s):s.or(i.notEq(a))}}function We(n,e,t){return e=Hn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hn(n){var e=Wn(n,"string");return typeof e=="symbol"?e:String(e)}function Wn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class be{}We(be,"not","not");We(be,"and","and");We(be,"or","or");function Hi(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function I(n,e,t){return e=Bn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bn(n){var e=Kn(n,"string");return typeof e=="symbol"?e:String(e)}function Kn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class m{}I(m,"eq","eq");I(m,"eqIgnoreCase","eqIgnoreCase");I(m,"notEq","notEq");I(m,"notEqIgnoreCase","notEqIgnoreCase");I(m,"greaterThan","greaterThan");I(m,"greaterThanOrEqualTo","greaterThanOrEqualTo");I(m,"lessThan","lessThan");I(m,"lessThanOrEqualTo","lessThanOrEqualTo");I(m,"in","in");I(m,"inIgnoreCase","inIgnoreCase");I(m,"notIn","notIn");I(m,"notInIgnoreCase","notInIgnoreCase");I(m,"isTrue","isTrue");I(m,"isFalse","isFalse");I(m,"isNull","isNull");I(m,"invoke","invoke");I(m,"contains","contains");I(m,"notContains","notContains");I(m,"containsIgnoreCase","containsIgnoreCase");I(m,"startsWith","startsWith");I(m,"endsWith","endsWith");I(m,"containsAny","containsAny");var ut=G.module("ViewportDataUtils");function qn(n,e){return String(n.offsetInSnapshot+e)}function Wi(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:a,offset:s,rows:o}=i.detail;ut.debug("table updated",i.detail);var l=new Map;o.forEach(u=>{var c=e(u,a),d=qn(u,s);l.set(d,{key:d,item:c})}),ut.debug("update keys",l),t(l)}}function Bi(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*Ki(n,e){for(var t=n;t<=e;++t)yield{key:String(t)}}function zn(n){return n==null||Gn(n)?0:n.size}function Gn(n){return"isClosed"in n?n.isClosed:!1}function qi(n,e,t,r){var i=n+e-1,[a,s]=[0,r-1],o=ze(n-t,a,s),l=ze(i+t,a,s);return[o,l]}function ct(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function ie(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){ct(a,r,i,s,o,"next",l)}function o(l){ct(a,r,i,s,o,"throw",l)}s(void 0)})}}function de(n,e,t){return e=Xn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xn(n){var e=Yn(n,"string");return typeof e=="symbol"?e:String(e)}function Yn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var re=G.module("TableUtils");class f{static copyTableAndApplyFilters(e){var t=arguments;return ie(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),s=1;s<i;s++)a[s-1]=t[s];return r.applyFilter(xe(...a.map(o=>o(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,a=e[r];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=f.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return f.isBooleanType(e)?[m.isTrue,m.isFalse,m.isNull]:f.isCharType(e)||f.isNumberType(e)||f.isDateType(e)?[m.eq,m.notEq,m.greaterThan,m.greaterThanOrEqualTo,m.lessThan,m.lessThanOrEqualTo]:f.isTextType(e)?[m.eq,m.eqIgnoreCase,m.notEq,m.notEqIgnoreCase,m.contains,m.notContains,m.startsWith,m.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=f.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===f.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===f.sortDirection.none)return null;var a=e[t].sort();switch(r){case f.sortDirection.ascending:a=a.asc();break;case f.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var a=f.getNextSort(t,e,r);return f.setSortForColumn(e,t[r].name,a,i)}static sortColumn(e,t,r,i,a,s){if(r<0||r>=t.length)return[];var o=f.makeColumnSort(t,r,i,a);return f.setSortForColumn(e,t[r].name,o,s)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=f.getSortIndex(e,t),s=[];return i&&(s=s.concat(e.filter(o=>{var{direction:l}=o;return l!==f.sortDirection.reverse})),a!==null&&s.splice(a,1)),r!==null&&s.push(r),s}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case f.dataType.BOOLEAN:return f.dataType.BOOLEAN;case"char":case"java.lang.Character":case f.dataType.CHAR:return f.dataType.CHAR;case"java.lang.String":case f.dataType.STRING:return f.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case f.dataType.DATETIME:return f.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case f.dataType.DECIMAL:return f.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 f.dataType.INT:return f.dataType.INT;default:return f.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"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return f.isIntegerType(e)||f.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 f.getNormalizedType(e)===f.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}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 je.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,s,o=!0,l=new Promise((u,c)=>{s=setTimeout(()=>{a(),o=!1,c(new Pt('Event "'.concat(t,'" timed out.')))},r),a=e.addEventListener(t,d=>{if(i!=null&&!i(d)){re.debug2("Event triggered, but matcher returned false.");return}re.debug2("Event triggered, resolving."),a(),clearTimeout(s),o=!1,u(d)})});return l.cancel=()=>{if(o){re.debug2("Pending promise cleanup."),a(),clearTimeout(s),o=!1;return}re.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!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 '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=f.removeCommas(t);if(f.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case m.eq:return"=";case m.notEq:return"!=";case m.greaterThan:return">";case m.greaterThanOrEqualTo:return">=";case m.lessThan:return"<";case m.lessThanOrEqualTo:return"<=";case m.contains:return"~";case m.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var a=r.name.toUpperCase(),s=i.name.toUpperCase();return br.sort(a,s,t)})}constructor(e){de(this,"dh",void 0),this.dh=e,fr(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,a=this;return ie(function*(){if(e==null)return null;for(var s=e,o=i.length,l=new Array(o>3?o-3:0),u=3;u<o;u++)l[u-3]=i[u];l.length>0&&(s=yield e.copy(),yield s.applyFilter(xe(...l.map(v=>v(s)))));var c=s.findColumn(t),d=yield s.selectDistinct([c]);s!==e&&s.close();var h=d.findColumn(t).sort()[r]();return a.applySort(d,[h])})()}doesColumnValueExist(e,t,r,i){var a=this;return ie(function*(){if(e==null)return null;var s=$n(a,t,r,i?"eq":"eqIgnoreCase"),o=yield e.copy();yield a.applyFilter(o,xe(s(o)));var l=zn(o);return o.close(),l>0})()}makeQuickFilter(e,t,r){for(var i=t.split("||"),a=null,s=0;s<i.length;s+=1){for(var o=i[s],l=o.split("&&"),u=null,c=0;c<l.length;c+=1){var d=l[c].trim();if(d.length>0){var h=this.makeQuickFilterFromComponent(e,d,r);if(h)u?u=u.and(h):u=h;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&u?a=a.or(u):a=u}return a}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return f.isNumberType(i)?this.makeQuickNumberFilter(e,t):f.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&f.isDateType(i)?this.makeQuickDateFilter(e,t,r):f.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,a=null,s=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,o=s.exec(t),l=null,u=null,c=null,d=null,h=null;if(o!==null&&o.length>3&&([,l,u,c,d,h]=o),h!=null&&h.trim().length>0)return null;if(l==null&&(l="="),d!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":a=r.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?a=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(c==null)return null;if(c=f.removeCommas(c),f.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(v){return re.warn("Unable to create long filter",v),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return a=e.filter(),f.makeRangeFilterWithOperation(a,l,c)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,s=i.exec(e),o=null,l=null;if(s!==null&&s.length>2&&([,o,l]=s),o!=null){var u;return"\\".concat(o).concat((u=l)!==null&&u!==void 0?u:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=o)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,s=i.exec(e),o=null,l=null;return s!==null&&s.length>2&&([,o,l]=s),o!=null&&(o=o.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),o==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),o==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=o)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,s=a.exec(i),o=null,l=null;if(s!==null&&s.length>2&&([,o,l]=s,l!=null&&(l=l.trim())),l==null||l.length===0&&!(o==="="||o==="!="))return null;o==null&&(o="=");var u=e.filter();if(l.toLowerCase()==="null")switch(o){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,d=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(d="*",l=l.substring(0,l.length-1)),l=f.unescapeQuickTextFilter(l),o){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):d==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):d==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,a,s]=i,o=a==="!"||a==="!=",l=s.trim().toLowerCase(),u=e.filter();try{var c=f.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),o?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,s=a.exec(i);if(s==null||s.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var o=null,l=null;[,o,l]=s;var u=m.eq;switch(o){case"<":u=m.lessThan;break;case"<=":case"=<":u=m.lessThanOrEqualTo;break;case">":u=m.greaterThan;break;case">=":case"=>":u=m.greaterThanOrEqualTo;break;case"!=":case"!":u=m.notEq;break;case"=":case"==":default:u=m.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:a}=this,[s,o]=k.parseDateRange(a,t,i),l=s!=null?a.FilterValue.ofNumber(s):null,u=o!=null?a.FilterValue.ofNumber(o):null,c=e.filter();if(l==null)return r===m.notEq?c.isNull().not():c.isNull();switch(r){case m.eq:{if(u!=null){var d=c.greaterThanOrEqualTo(l),h=c.lessThan(u);return d.and(h)}return c.eq(l)}case m.lessThan:return c.lessThan(l);case m.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case m.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case m.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case m.notEq:{if(u!=null){var v=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return v.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,s=a.exec(i),o=null,l=null,u=null;if(s!==null&&s.length>3&&([,o,l,u]=s),u!=null&&u.trim().length>0||l==null||l.length===0)return null;o==null&&(o="=");var c=e.filter();if(l.toLowerCase()==="null")switch(o){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var d=r.FilterValue.ofString(f.isRangeOperation(o)?f.quoteValue(l):l);return f.makeRangeFilterWithOperation(c,o,d)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:a,invertSelection:s,selectedValues:o}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:d,value:h}=c;if(d!=null&&d.length>0&&h!=null&&h.length>0)try{var v=this.makeAdvancedValueFilter(e,d,h,r);if(v!=null){if(u===0)l=v;else if(l!==null&&u-1<a.length){var p=a[u-1];if(p===be.and)l=l.and(v);else if(p===be.or)l=l.or(v);else{re.error("Unexpected filter operator",p,v),l=null;break}}}else re.debug2("Empty filter ignored for",d,h)}catch(S){re.error("Unable to create filter",S),l=null;break}}var y=this.makeSelectValueFilter(e,o,s);return y!=null&&(l!=null?l=l.and(y):l=y),l}makeAdvancedValueFilter(e,t,r,i){var{dh:a}=this;if(f.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(f.isNumberType(e.type)||f.isCharType(e.type))return this.makeQuickFilter(e,"".concat(f.getFilterOperatorString(t)).concat(r));var s=this.makeFilterValue(e.type,r),o=e.filter();switch(t){case m.eq:return o.eq(s);case m.eqIgnoreCase:return o.eqIgnoreCase(s);case m.notEq:return o.notEq(s);case m.notEqIgnoreCase:return o.notEqIgnoreCase(s);case m.greaterThan:return o.greaterThan(s);case m.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(s);case m.lessThan:return o.lessThan(s);case m.lessThanOrEqualTo:return o.lessThanOrEqualTo(s);case m.isTrue:return o.isTrue();case m.isFalse:return o.isFalse();case m.isNull:return o.isNull();case m.contains:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case m.notContains:return o.isNull().or(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case m.startsWith:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case m.endsWith:return o.isNull().not().and(o.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case m.in:case m.inIgnoreCase:case m.notIn:case m.notInIgnoreCase:case m.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var s=e.findColumn(t),o=[i.makeNeverFilter(s)];return yield i.applyFilter(e,o,a),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applyCustomColumns(t),e,s.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applyFilter(t),e,s.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var r=arguments,i=this;return ie(function*(){var a=r.length>2&&r[2]!==void 0?r[2]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:s}=i;return f.executeAndWaitForEvent(o=>o==null?void 0:o.applySort(t),e,s.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,r=null;f.isTextType(e.type)?r=t.FilterValue.ofString("a"):f.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):f.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),a=e.filter().notEq(r);return i.and(a)}makeFilterValue(e,t){var{dh:r}=this,i=f.getBaseType(e);return f.isTextType(i)?r.FilterValue.ofString(t):f.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(f.removeCommas(t))):r.FilterValue.ofNumber(f.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return f.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):f.isTextType(e)?r.FilterValue.ofString(t):f.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(f.isTextType(e))return t;if(f.isLongType(e))return i.LongWrapper.ofString(f.removeCommas(t));if(f.isBooleanType(e))return f.makeBooleanValue(t,!0);if(f.isDateType(e)){var[a]=k.parseDateRange(i,t,r);return a}return f.isNumberType(e)?f.makeNumberValue(t):(re.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var a=[],s=!1,o=0;o<t.length;o+=1){var l=t[o];l==null?s=!0:f.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):f.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return s?a.length>0?r?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(a):e.filter().in(a)}}de(f,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});de(f,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});de(f,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);de(f,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));de(f,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);de(f,"executeAndWaitForEvent",function(){var n=ie(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=f.makeCancelableTableEventPromise(t,r,i);return e(t),yield a,t});return function(e,t,r){return n.apply(this,arguments)}}());function Me(n,e,t){return e=Zn(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zn(n){var e=Qn(n,"string");return typeof e=="symbol"?e:String(e)}function Qn(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Be{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=f.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;Me(this,"defaultColumnFormatter",void 0),Me(this,"typeFormatterMap",void 0),Me(this,"columnFormatMap",void 0),Me(this,"truncateNumbersWithPound",void 0),this.defaultColumnFormatter=new xn,this.typeFormatterMap=new Map([[f.dataType.BOOLEAN,new Pn],[f.dataType.CHAR,new Mn],[f.dataType.DATETIME,new Q(e,r)],[f.dataType.DECIMAL,new R(e,i)],[f.dataType.INT,new J(e,a)],[f.dataType.STRING,new _n]]),this.columnFormatMap=Be.makeColumnFormatMap(t),this.truncateNumbersWithPound=s}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=f.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=f.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),s=i||this.getColumnFormat(t,r);return a.format(e,s??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(f.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function Un(n){if(n&&n.formatter){var{formatter:e}=n;return e}}function Jn(n){return{timeZone:n==null?void 0:n.timeZone,defaultDateTimeFormatString:n==null?void 0:n.defaultDateTimeFormat,showTimeZone:n==null?void 0:n.showTimeZone,showTSeparator:n==null?void 0:n.showTSeparator}}function ei(n,e,t){var r=n.getColumnFormat(t,e);return r!=null&&(r.type===W.TYPE_CONTEXT_PRESET||r.type===W.TYPE_CONTEXT_CUSTOM)}const Le={getColumnFormats:Un,getDateTimeFormatterOptions:Jn,isCustomColumnFormatDefined:ei},ti=typeof Ie=="function"?Ie:Ie.default;wt.register([nr,ir,ar,or,sr,lr]);function B(n,e,t){return e=ri(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ri(n){var e=ni(n,"string");return typeof e=="symbol"?e:String(e)}function ni(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class L{constructor(e){B(this,"dh",void 0),B(this,"listeners",void 0),B(this,"formatter",void 0),B(this,"rect",void 0),B(this,"isDownsamplingDisabled",void 0),B(this,"title",void 0),this.dh=e,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(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(L.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(L.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(L.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(L.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(L.EVENT_ERROR,{detail:e}))}}B(L,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");B(L,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");B(L,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");B(L,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");B(L,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");B(L,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");B(L,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");B(L,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");B(L,"EVENT_ERROR","ChartModel.EVENT_ERROR");const Z=L;function dt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function De(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dt(Object(t),!0).forEach(function(r){$(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $(n,e,t){return e=ii(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ii(n){var e=ai(n,"string");return typeof e=="symbol"?e:String(e)}function ai(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ee=G.module("ChartUtils"),ht="io.deephaven.time.DateTime",oi=36e5,si=1e6;function li(n){return n.asDate!==void 0}function ui(n){return n.asNumber!==void 0}function ft(n){return n.dhTimeZone!==void 0}function ci(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class g{static getPlotlyErrorBars(e,t,r,i){var a=r.map((o,l)=>o-e[l]),s=t.map((o,l)=>e[l]-o);return{type:"data",symmetric:!1,array:a,arrayminus:s,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);ye(a);var[,s,o,l,,u,c,d,h,v]=a,p=l.replace(",","").length,y=o.indexOf(",")>=0||l.indexOf(",")>=0,S=y?",":"",T=d!=null&&d!==""?"e":"f",P=h!==""?h:T,b=u.length+c.length,w="",F="0".concat(p).concat(S,".").concat(b).concat(w).concat(P),_=g.convertNumberPrefix(s),O=g.convertNumberPrefix(v);return{tickformat:F,tickprefix:_,ticksuffix:O,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},s=i;return r&&(s=i/si),t.log&&(s=Math.log(s)),a.tickmode="linear",a.dtick=s,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var s=i.sources[a];if(s.axis===t)return s}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,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:g.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}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 ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getAxisTypeMap(e){var t=g.getAllAxes(e);return g.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],s=0;s<a.series.length;s+=1)if(t===a.series[s])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(o=>o.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],s=e[a];ci(s)&&(t[a]=[...s.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,s=i[t],o=(a=r.get(s))!==null&&a!==void 0?a:[];return o.push(i),r.set(s,o),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Ee.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){$(this,"dh",void 0),$(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},s=g.getAllAxes(e),o=g.groupArray(s,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var c=l[u],d=0;d<c.series.length;d+=1)for(var h=c.series[d],{sources:v}=h,p=v.filter(P=>P.axis),y=function(){var b=p[S],{axis:w}=b,{type:F}=w,_=o.get(F);ye(_);var O=_.indexOf(w),N=r.getAxisPropertyName(F);if(N!=null){var M=g.getAxisLayoutProperty(N,O);if(i.has(M))Ee.debug("".concat(M," already added."));else{Ee.debug("Adding ".concat(M," to axisFormats."));var j=r.getPlotlyAxisFormat(b,t);if(j===null)i.set(M,a);else{i.set(M,j);var{businessCalendar:X}=w;if(X!=null){var z=[],{businessPeriods:te,businessDays:ue,holidays:he,timeZone:me}=X,pe=t==null?void 0:t.getColumnTypeFormatter(ht),we;ft(pe)&&(we=pe.dhTimeZone);var qe=we?(me.standardOffset-we.standardOffset)/60:0;he.length>0&&z.push(...r.createRangeBreakValuesFromHolidays(he,me,we)),te.forEach(Pe=>z.push({pattern:"hour",bounds:[g.periodToDecimal(Pe.close)+qe,g.periodToDecimal(Pe.open)+qe]})),ue.length<r.daysOfWeek.length&&r.createBoundsFromDays(ue).forEach(Pe=>z.push({pattern:"day of week",bounds:Pe})),j.rangebreaks=z}if(i.size===c.axes.length)return{v:i}}}}},S=0;S<p.length;S+=1){var T=y();if(typeof T=="object")return T.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(g.MODE_LINES),(r??!0)&&a.add(g.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(g.MODE_LINES),(r??!1)&&a.add(g.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?g.ORIENTATION.HORIZONTAL:g.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:s,isLinesVisible:o,isShapesVisible:l,plotStyle:u,lineColor:c,shapeColor:d,sources:h,shape:v,shapeSize:p}=e,y=h.some(w=>{var F;return(F=w.axis)===null||F===void 0?void 0:F.businessCalendar}),S=this.getChartType(u,y),T=this.getPlotlyChartMode(u,o??void 0,l??void 0),P=this.getPlotlySeriesOrientation(e),b=g.makeSeriesData(S,T,s,a,P);return this.addSourcesToSeriesData(b,u,h,t),this.addStylingToSeriesData(b,u,i,c,d,v,p,r),b}addSourcesToSeriesData(e,t,r,i){for(var a=e,s=0;s<r.length;s+=1){var o=r[s],{axis:l,type:u}=o,c=this.getPlotlyProperty(t,u);bt(a,c,[]);var d=l!=null?this.getAxisPropertyName(l.type):null;if(d!=null){var h=i.get(l.type);if(h){var v=h.indexOf(l),p=v>0?"".concat(v+1):"";a["".concat(d,"axis")]="".concat(d).concat(p)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,c=e;if(c.marker={line:{}},c.line={width:1},t===u.plot.SeriesPlotStyle.AREA?c.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?c.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?c.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(c.width=[],c.marker.line!==void 0&&Object.assign(c.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(c.increasing={line:{color:r.ohlc_increasing}},c.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(c.textinfo="label+percent",c.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(c.hoverinfo="text",c.textinfo="label+text",c.tiling={packing:"squarify",pad:0},c.textposition="middle center",c.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?c.marker.color=i:c.line.color=i),a!=null&&(c.marker.color=a),s!=null&&s.length>0)try{c.marker.symbol=g.getMarkerSymbol(s)}catch(d){Ee.warn("Unable to handle shape",s,":",d)}o!=null&&(c.marker.size=o*g.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(c.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=e,l=g.getAllAxes(t),u=0;u<t.charts.length;u+=1){var c=t.charts[u],d=i==null?void 0:i(c),h=this.getChartBounds(t,c,a,s);this.updateLayoutAxes(o,c.axes,l,r,a,s,h,d)}this.removeStaleAxes(o,l)}getChartBounds(e,t,r,i){var a,{dh:s}=this,{cols:o,rows:l}=e,{column:u,colspan:c,row:d,rowspan:h}=t,v=u+c,p=d+h,y=1/o,S=1/l,T=g.AXIS_SIZE_PX/r,P=g.AXIS_SIZE_PX/i,b={bottom:(l-p)*S+(p<l?P/2:0),top:(l-d)*S-(d>0?P/2:0),left:u*y+(u>0?T/2:0),right:v*y-(v<o?T/2:0)},w=g.groupArray(t.axes,"position"),F=(a=w.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return F.length>0&&(r>0?b.right-=(b.right-b.left)*Math.max(0,Math.min(g.LEGEND_WIDTH_PX/r,g.MAX_LEGEND_SIZE)):b.right-=(b.right-b.left)*g.DEFAULT_AXIS_SIZE),b}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=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",""),s,o=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&ft(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(s=i.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:a,ticksuffix:s,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:s}=i,o=null;return f.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=g.addTickSpacing(o,i,!0)):f.isNumberType(a)&&(o=g.getPlotlyNumberFormat(t,a,s),o=g.addTickSpacing(o,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,c=a>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/s,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,d=s>0?Math.max(g.MIN_AXIS_SIZE,Math.min(g.AXIS_SIZE_PX/a,g.MAX_AXIS_SIZE)):g.DEFAULT_AXIS_SIZE,h=e,v=g.groupArray(t,"position"),p=g.groupArray(t,"type"),y=[...p.keys()],S=g.groupArray(r,"type"),T=0;T<y.length;T+=1){var P=y[T],b=this.getAxisPropertyName(P);if(b!=null){var w=p.get(P),F=S.get(P),_=P===u.plot.AxisType.Y,O=_?s:a;ye(w),ye(F);for(var N=0;N<w.length;N+=1){var M=w[N],j=F.indexOf(M),X=g.getAxisLayoutProperty(b,j);h[X]==null&&(h[X]=this.makeLayoutAxis(P,i));var z=h[X];if(z!=null){this.updateLayoutAxis(z,M,N,v,c,d,o);var{range:te,autorange:ue}=z;if(l!=null&&te!==void 0&&(ue===void 0||ue===!1)){var he=l(M),[me,pe]=he(te);Ee.debug("Setting downsample range",O,me,pe),M.range(O,me,pe)}else M.range(O)}}}}}removeStaleAxes(e,t){for(var r=e,i=g.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);ye(l);var u=l.length,c=this.getAxisPropertyName(o);if(c!=null)for(var d=g.getAxisLayoutProperty(c,u);r[d]!=null;)delete r[d],u+=1,d=g.getAxisLayoutProperty(c,u)}}updateLayoutAxis(e,t,r,i,a,s,o){var l,{dh:u}=this,c=t.type===u.plot.AxisType.Y,d=c?s:a,h=e,v=(l=t.label)!==null&&l!==void 0?l:"";if(h.title!==void 0&&typeof h.title!="string"?h.title.text=v:h.title={text:v},t.log&&(h.type="log"),h.side=this.getAxisSide(t.position),r>0){var p,y;h.overlaying=(p=this.getAxisPropertyName(t.type))!==null&&p!==void 0?p:void 0;var S=(y=i.get(t.position))!==null&&y!==void 0?y:[],T=S.indexOf(t);T>0&&(h.anchor="free",t.position===u.plot.AxisPosition.RIGHT?h.position=o.right+(T-S.length+1)*d:t.position===u.plot.AxisPosition.TOP?h.position=o.top+(T-S.length+1)*d:t.position===u.plot.AxisPosition.BOTTOM?h.position=o.bottom+(S.length-T+1)*d:t.position===u.plot.AxisPosition.LEFT&&(h.position=o.left+(S.length-T+1)*d))}else if(t.type===u.plot.AxisType.X){var P=i.get(u.plot.AxisPosition.LEFT)||[],b=i.get(u.plot.AxisPosition.RIGHT)||[],w=Math.max(o.left,o.left+(P.length-1)*s),F=Math.min(o.right-(b.length-1)*s,o.right);h.domain=[w,F]}else if(t.type===u.plot.AxisType.Y){var _=i.get(u.plot.AxisPosition.BOTTOM)||[],O=i.get(u.plot.AxisPosition.TOP)||[],N=Math.max(o.bottom,o.bottom+(_.length-1)*a),M=Math.min(o.top-(O.length-1)*a,o.top);h.domain=[N,M]}}createBoundsFromDays(e){var t=e.map(s=>this.daysOfWeek.indexOf(s)),r=this.daysOfWeek.filter(s=>!e.includes(s)).map(s=>this.daysOfWeek.indexOf(s)),i=new Set;r.forEach(s=>{for(var o=s+1;o<s+this.daysOfWeek.length;o+=1){var l=o%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(s=>{for(var o=s-1;o>s-this.daysOfWeek.length;o-=1){var l=o<0?o+this.daysOfWeek.length:o;if(t.includes(l)){var u=(l+1)%7;a.push([u,s]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(s=>{s.businessPeriods.length>0?a.push(...this.createPartialHoliday(s,t,r)):i.push(this.createFullHoliday(s,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(h=>{a.push(h.open),a.push(h.close)}),a.push("24:00");for(var s=[],o=0;o<a.length;o+=2){var l=a[o],u=a[o+1];if(l!==u){var c=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],d=oi*(g.periodToDecimal(u)-g.periodToDecimal(l));s.push({values:c,dvalue:d})}}return s}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ht,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:s}=e,o=g.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(c=>({plotStyle:"".concat(s),name:c,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:c,axis:u,table:t}]}))}],title:o}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(li(e))return r.i18n.DateTimeFormat.format(g.DATE_FORMAT,e,t);if(ui(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(f.isDateType(t)&&typeof e=="string"){var a=e,s=g.DATE_FORMAT.substr(0,e.length),o=i.i18n.DateTimeFormat.parse(s,a);if(!r)return o;var l="".concat(s," Z"),u=i.i18n.DateTimeFormat.format("Z",o,r),c=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),d=i.i18n.DateTimeFormat.format("Z",c,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={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}},legend:{font:{color:t.legend_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:r,plot_bgcolor:i,title_color:a,coastline_color:s,land_color:o,ocean_color:l,lake_color:u,river_color:c}=e,d={paper_bgcolor:r,plot_bgcolor:i,autosize:!0,colorway:g.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},yanchor:"top",pad:De({},g.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:De({},g.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:r,coastlinecolor:s,landcolor:o,oceancolor:l,lakecolor:u,rivercolor:c}};return d.datarevision=0,d}hydrateSettings(e){var{dh:t}=this;return De(De({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}$(g,"DEFAULT_AXIS_SIZE",.15);$(g,"MIN_AXIS_SIZE",.025);$(g,"MAX_AXIS_SIZE",.2);$(g,"AXIS_SIZE_PX",75);$(g,"LEGEND_WIDTH_PX",50);$(g,"MAX_LEGEND_SIZE",.25);$(g,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));$(g,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");$(g,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));$(g,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));$(g,"SUBTITLE_LINE_HEIGHT",25);$(g,"DEFAULT_MARKER_SIZE",6);$(g,"MODE_MARKERS","markers");$(g,"MODE_LINES","lines");const q=g;function di(n,e,t){return e=hi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hi(n){var e=fi(n,"string");return typeof e=="symbol"?e:String(e)}function fi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mi extends Error{constructor(){super(...arguments),di(this,"isDownsamplingError",!0)}}const pi=mi;function mt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mt(Object(t),!0).forEach(function(r){H(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function H(n,e,t){return e=vi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vi(n){var e=gi(n,"string");return typeof e=="symbol"?e:String(e)}function gi(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ne=G.module("Chart");class le extends C.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,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"}constructor(e){var t;super(e),H(this,"currentSeries",void 0),H(this,"PlotComponent",void 0),H(this,"plot",void 0),H(this,"plotWrapper",void 0),H(this,"columnFormats",void 0),H(this,"dateTimeFormatterOptions",void 0),H(this,"decimalFormatOptions",void 0),H(this,"integerFormatOptions",void 0),H(this,"rect",void 0),H(this,"ranges",void 0),H(this,"isSubscribed",void 0),H(this,"isLoadedFired",void 0),H(this,"resizeObserver",void 0),H(this,"getCachedConfig",kt((r,i,a,s,o,l)=>{var u=[],c=!!r;c&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:le.convertIcon(Ge),attr:"fill-warning"});var d=!!l;if(d&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:le.convertIcon(Ge),attr:"fill-warning"}),i||a||s||c){var h=le.downsampleButtonTitle(a,s),v=le.downsampleButtonAttr(a,s),p=a?Ut:Jt;u.push({name:h,title:"Downsampling status",icon:le.convertIcon(p),click:this.handleDownsampleClick,attr:v})}var y=o.some(b=>{var{type:w}=b;return w!=null&&!w.includes("3d")}),S=o.some(b=>{var{type:w}=b;return w!=null&&w.includes("3d")}),T=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],P=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||c||d?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...y?T:[],...S?P:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=ti(e.Plotly),this.plot=K.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:K.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:pt(pt({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ne.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch(ne.debug2("Received data update",t,r),t){case Z.EVENT_UPDATED:{this.currentSeries+=1,this.setState(v=>{var{layout:p,revision:y}=v;return typeof p.datarevision=="number"&&(p.datarevision+=1),{data:r,layout:p,revision:y+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case Z.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case Z.EVENT_DISCONNECT:{var{onDisconnect:s}=this.props;s();break}case Z.EVENT_RECONNECT:{var{onReconnect:o}=this.props;o();break}case Z.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Z.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Z.EVENT_DOWNSAMPLENEEDED:case Z.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:c}=this.props;c(new pi(u));break}case Z.EVENT_ERROR:{var d="".concat(r);this.setState({error:d});var{onError:h}=this.props;h(new Error(d));break}default:ne.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=q.getLayoutRanges(t),i=!ve(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ne.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if(ne.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var s=i.reduce((o,l)=>{var{name:u,visible:c}=l;return u!=null&&c==="legendonly"?[...o,u]:o},[]);a({hiddenSeries:s})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){ne.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=Le.getColumnFormats(e),r=Le.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!ve(this.columnFormats,t)||!ve(this.dateTimeFormatterOptions,r)||!ve(this.decimalFormatOptions,i)||!ve(this.integerFormatOptions,a))&&(this.columnFormats=Le.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Be(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{ne.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:s,error:o,shownError:l,layout:u,revision:c}=this.state,d=this.getCachedConfig(r,i,a,s,t??[],o),h=t!=null;return E.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[h&&E.jsx(e,{ref:this.plot,data:t,layout:u,revision:c,config:d,onAfterPlot:this.handleAfterPlot,onError:ne.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),E.jsx(Ft,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"chart-error",children:l}),E.jsx(rn,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}H(le,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:k.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:wt,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const zi=le;function vt(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(t),!0).forEach(function(r){A(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vt(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function A(n,e,t){return e=yi(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yi(n){var e=Ei(n,"string");return typeof e=="symbol"?e:String(e)}function Ei(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var V=G.module("FigureChartModel");class Ce extends Z{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,A(this,"chartUtils",void 0),A(this,"dh",void 0),A(this,"figure",void 0),A(this,"settings",void 0),A(this,"theme",void 0),A(this,"data",void 0),A(this,"layout",void 0),A(this,"seriesDataMap",void 0),A(this,"pendingSeries",void 0),A(this,"oneClicks",void 0),A(this,"filterColumnMap",void 0),A(this,"lastFilter",void 0),A(this,"isConnected",void 0),A(this,"seriesToProcess",void 0),A(this,"addPendingSeries",_t(()=>{for(var o=q.getAxisTypeMap(this.figure),{pendingSeries:l}=this,u=function(){var h,v=l[c],p=i.figure.charts.find(y=>y.series.includes(v));i.addSeries(v,o,(h=p==null?void 0:p.showLegend)!==null&&h!==void 0?h:null),v.subscribe()},c=0;c<l.length;c+=1)u();this.pendingSeries=[]},Ce.ADD_SERIES_DEBOUNCE)),A(this,"getTimeZone",ge((o,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(o);if(u!=null)return u.dhTimeZone}})),A(this,"getValueTranslator",ge((o,l)=>{var u=this.getTimeZone(o,l);return c=>this.chartUtils.unwrapValue(c,u)})),A(this,"getValueParser",ge((o,l)=>{var u=this.getTimeZone(o,l);return c=>this.chartUtils.wrapValue(c,o,u)})),A(this,"getRangeParser",ge((o,l)=>u=>{var[c,d]=u,h=this.getValueParser(o,l);return c=h(c),d=h(d),[c,d]})),A(this,"getAxisRangeParser",ge((o,l)=>u=>{var c=q.getSourceForAxis(o,u);return c!=null?this.getRangeParser(c.columnType,l):d=>d})),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.dh=e,this.chartUtils=new q(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var s={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.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(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,r=q.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var h=t[s],v=0;v<h.series.length;v+=1){var p=h.series[v];i.push(p.name),e.addSeries(p,r,h.showLegend)}var{axes:y,title:S}=h;if(S!=null&&S.length>0&&(t.length>1||e.figure.title!=null)){var T=y.find(j=>j.type===e.dh.plot.AxisType.X),P=y.find(j=>j.type===e.dh.plot.AxisType.Y);if(T==null||P==null)V.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",h);else{var b,w,F,_,O=((b=(w=r.get(T.type))===null||w===void 0?void 0:w.findIndex(j=>j===T))!==null&&b!==void 0?b:0)+1,N=((F=(_=r.get(P.type))===null||_===void 0?void 0:_.findIndex(j=>j===P))!==null&&F!==void 0?F:0)+1,M={align:"center",x:.5,y:1,yshift:17,text:S,showarrow:!1,xref:"x".concat(O," domain"),yref:"y".concat(N," domain")};e.layout.annotations==null?e.layout.annotations=[M]:e.layout.annotations.push(M)}}},s=0;s<t.length;s+=1)a();for(var o=[...this.seriesDataMap.keys()],l=o.filter(d=>i.indexOf(d)<0),u=0;u<l.length;u+=1){var c=l[u];this.seriesDataMap.delete(c)}}addSeries(e,t,r){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,q.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=q.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,l=0;l<o.length;l+=1)this.filterColumnMap.set(o[l].name,o[l]);this.oneClicks.push(s)}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){V.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(V.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){V.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){V.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){V.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){V.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;V.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];V.debug2("handleFigureUpdated updating series",a.name);for(var{sources:s}=a,o=0;o<s.length;o+=1){var l=s[o],{columnType:u,type:c}=l,d=this.getValueTranslator(u,this.formatter),h=t.getArray(a,c,d);this.setDataArrayForSeries(a,c,h)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:v}=this;this.fireUpdate(v)}handleRequestFailed(e){V.error("Request failed",e),this.fireError(["".concat(e.detail)])}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){V.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){V.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;V.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=q.DEFAULT_MARGIN.t+i*q.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=gt({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=gt({},this.layout.title.pad),this.layout.title.pad.t=q.DEFAULT_TITLE_PADDING.t+i*q.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{V.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):V.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,s=this.seriesDataMap.get(i),o=this.chartUtils.getPlotlyProperty(a,t);s&&bt(s,o,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:s,xHigh:o}=a;if(s&&o&&s.length===o.length){for(var l=[],u=0;u<s.length;u+=1)l.push(o[u]-s[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:c,xLow:d,xHigh:h,y:v,yLow:p,yHigh:y}=a;d&&h&&d!==c&&(a.error_x=q.getPlotlyErrorBars(c,d,h,this.theme)),p&&y&&p!==v&&(a.error_y=q.getPlotlyErrorBars(v,p,y,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:S,labels:T}=a;S!==void 0&&T===void 0&&(a.labels=S)}}}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){var t=this;if(this.oneClicks.length===0){V.warn("Trying to set a filter, but no one click!");return}V.debug("setFilter",e);for(var r=function(){var s=t.oneClicks[i],{columns:o}=s,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var c=e.get(u);t.lastFilter.get(u)!==c&&o.find(d=>d.name===u)!=null&&s.setValueForColumn(u,c)})},i=0;i<this.oneClicks.length;i+=1)r();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}}A(Ce,"ADD_SERIES_DEBOUNCE",50);const yt=Ce;function Et(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Et(a,r,i,s,o,"next",l)}function o(l){Et(a,r,i,s,o,"throw",l)}s(void 0)})}}class Ke{static makeModelFromSettings(e,t,r,i){return Re(function*(){var a=yield Ke.makeFigureFromSettings(e,t,r);return new yt(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return Re(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new q(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return Re(function*(){return new yt(e,r,i,t)})()}}const Gi=Ke,Si="var(--dh-color-chart-colorway)",Ti="var(--dh-color-chart-grid)",bi="var(--dh-color-chart-axis-line)",wi="var(--dh-color-chart-axis-line-zero)",St={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:Si,gridcolor:Ti,linecolor:bi,zerolinecolor:wi,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var Tt=G.module("ChartTheme");function Pi(){var n,e=er(St);return e.colorway=tr((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return rr.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Tt.debug2("Chart theme:",St),Tt.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}var Nt=C.createContext(null);function Xi(n){var{children:e}=n,{activeThemes:t}=Sn(),r=C.useMemo(Pi,[t]);return E.jsx(Nt.Provider,{value:r,children:e})}function Yi(){return Oe(Nt,"No ChartThemeContext value found.")}var Fi=C.createContext(null);function Zi(){return Oe(Fi,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}export{xe as $,ki as A,Kr as B,zi as C,Q as D,Ot as E,Be as F,qn as G,Vi as H,J as I,Wi as J,_i as K,ji as L,$i as M,$n as N,Bi as O,je as P,Ki as Q,Un as R,_n as S,Ar as T,Jn as U,zn as V,Gn as W,ei as X,qi as Y,Ci as Z,Ni as _,Ri as a,Xe as a0,Z as a1,Pi as a2,q as a3,ti as a4,Nt as a5,Xi as a6,mi as a7,yt as a8,Ai as a9,vr as aa,br as ab,be as ac,Hi as ad,Fi as ae,Yi as b,xi as c,Gi as d,Oe as e,xr as f,Ft as g,ce as h,Ii as i,Xr as j,Sn as k,rn as l,Mt as m,Li as n,Pt as o,m as p,Pn as q,Mn as r,k as s,gn as t,Zi as u,R as v,xn as w,Le as x,W as y,f as z};
3
+ //# sourceMappingURL=useConnection-ffb1e08e.js.map