@deephaven/embed-grid 0.38.1-beta.2 → 0.38.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.
@@ -0,0 +1,3 @@
1
+ var Vt=Object.defineProperty;var Bt=(r,n,e)=>n in r?Vt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var u=(r,n,e)=>(Bt(r,typeof n!="symbol"?n+"":n,e),e);import{r as S,p as C,a as v,V as Ht,j as h,C as Ke,c as N,R as Kt,F as oe,s as Ze,m as Q,W as Wt,X as qt,P as Gt,h as zt,Y as Qt,E as Ct}from"./vendor-80145ba5.js";import{T as We,L as j,ag as Tt,a as Zt,a8 as Xt,i as _t,ah as Jt,ai as Yt,A as en,aj as tn,S as nn,af as sn,aa as an}from"./index-7716a920.js";class qe extends S.Component{constructor(e){super(e);u(this,"element");u(this,"container");u(this,"rAF");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=v.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{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(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:s}=this.props;if(e||this.container.current===null)return;let{options:i}=this.props;i={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...i},document.body.appendChild(this.element);let a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new Ht(s||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{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(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:s,interactive:i,closeOnBlur:a}=this.props,{show:o}=this.state;return h.jsx(Ke,{in:o,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:h.jsx("div",{onClick:l=>{l.stopPropagation()},onKeyDown:l=>{l.key==="Escape"&&this.hide()},className:N("popper",{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:h.jsxs("div",{className:"popper-content",children:[t,h.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return h.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Kt.createPortal(this.renderContent(),this.element)})}}u(qe,"propTypes",{children:C.node.isRequired,options:C.shape({}),className:C.string,timeout:C.number,onEntered:C.func,onExited:C.func,isShown:C.bool,closeOnBlur:C.bool,interactive:C.bool,referenceObject:C.shape({}),"data-testid":C.string}),u(qe,"defaultProps",{options:{},className:"",timeout:We.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Xe=qe,on=j.module("Tooltip"),B=class extends S.Component{constructor(e){super(e);u(this,"container");u(this,"popper");u(this,"parent");u(this,"timer");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=v.createRef(),this.popper=v.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){B.shownTooltipCount-=1,B.shownTooltipCount===0&&(B.lastHiddenTime=Date.now())}static handleShown(){B.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:s}=t,{isShown:i}=this.state;i!==s&&(i?B.handleShown():B.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&B.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){on.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(){const{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(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,s=e.clientY,{isShown:i}=this.state;if(!this.popper.current||!this.parent)return;const a=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&s>=a.top&&s<=a.top+a.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&s>=o.top&&s<=o.top+o.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let s=e;(B.shownTooltipCount>0||Date.now()-B.lastHiddenTime<B.triggerReshowThreshold)&&(s=t),this.timer=window.setTimeout(this.handleTimeout,s)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var t;const{isShown:e}=this.state;if(this.stopTimer(),!e){(t=this.popper.current)==null||t.show(),this.setState({isShown:!0});const{interactive:s}=this.props;s&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)==null||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:s,popperClassName:i,"data-testid":a,onEntered:o}=this.props,{isShown:l}=this.state;let{options:c}=this.props;return c={placement:"bottom",...c},h.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:h.jsx(Xe,{className:N(i),options:c,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:s,children:h.jsxs("div",{className:"tooltip-content",children:[" ",l&&t]})})})}};let Y=B;u(Y,"defaultTimeout",500),u(Y,"defaultReshowTimeout",100),u(Y,"triggerReshowThreshold",300),u(Y,"shownTooltipCount",0),u(Y,"lastHiddenTime",Date.now()),u(Y,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:B.defaultReshowTimeout,timeout:B.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const yt=Y,rn=["primary","secondary","tertiary","success","danger","inline","ghost"],ln=["group-end"];function cn(r,n){switch(r){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 N("btn-link",{"btn-link-icon":n,"btn-link-icon-only":n})}}function un(r){switch(r){case"group-end":return N("pl-2","pr-3")}}const Pe=v.forwardRef((r,n)=>{const{kind:e,variant:t,type:s,tooltip:i,icon:a,disabled:o=!1,active:l,onClick:c,onContextMenu:d,onMouseDown:p,onMouseUp:f,onMouseEnter:b,onMouseLeave:w,onKeyDown:D,className:A,style:I,children:k,tabIndex:x,"data-testid":H,"aria-label":W}=r,Z=Boolean(a&&k==null),_=cn(e,Z);let re;t&&(re=un(t));let he;a&&(he=v.isValidElement(a)?a:h.jsx(oe,{icon:a}));let be;i!==void 0&&(be=typeof i=="string"?h.jsx(yt,{children:i}):i);let Ee=W;W===void 0&&Z&&i!=null&&typeof i=="string"&&(Ee=i);const we=h.jsxs("button",{"data-testid":H,ref:n,type:s,className:N("btn",_,re,{active:l},A),onClick:c,onContextMenu:d,onMouseUp:f,onMouseDown:p,onMouseEnter:b,onMouseLeave:w,onKeyDown:D,style:I,disabled:o,tabIndex:x,"aria-label":Ee,children:[a&&he,k,i!=null&&!o&&be]});return o?h.jsxs("span",{className:"btn-disabled-wrapper",children:[we,i!==void 0&&be]}):we});Pe.displayName="Button";Pe.propTypes={kind:C.oneOf(rn).isRequired,variant:C.oneOf(ln),type:C.oneOf(["submit","reset","button"]),tooltip(r){const{tooltip:n,icon:e,children:t}=r;return n===void 0&&e!=null&&t==null?new Error("Tooltip is required for icon only buttons"):null},icon(r){const{children:n,icon:e}=r;return e==null&&n==null?new Error("Icon is required if no children are provided"):n==null&&!v.isValidElement(e)&&(e==null||e.iconName===""||e.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:C.bool,active:C.bool,onClick(r){const{onClick:n,type:e}=r;return e==="button"&&typeof n!="function"?new Error("type button requires an onClick function"):n!==void 0&&typeof n!="function"?new Error("onClick must be a function"):null},onContextMenu:C.func,onMouseUp:C.func,onMouseDown:C.func,onMouseEnter:C.func,onMouseLeave:C.func,onKeyDown:C.func,tabIndex:C.number,children:C.node,className:C.string,style:C.object,"data-testid":C.string};Pe.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 Ge=Pe;function _e(r,n="No value available in context. Was code wrapped in a provider?"){const e=S.useContext(r);if(e==null)throw new Error(n);return e}function dn(r){const n=S.useRef();return S.useEffect(function(){n.current=r}),n.current}function It(r){const n=S.useRef(null);return S.useEffect(function(){r&&(typeof r=="function"?r(n.current):r.current=n.current)}),n}const ps=Object.freeze([]),ms=new Map,fs=()=>{};class hn extends Error{constructor(){super(...arguments);u(this,"isCanceled",!0)}}const rt=hn;async function pn(r){const{clipboard:n}=navigator;if(n!==void 0)try{return navigator.clipboard.writeText(r)}catch{return lt(r)}lt(r)}function lt(r){const n=document.activeElement,e=document.createElement("textarea");e.value=r,document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");if(document.body.removeChild(e),n instanceof HTMLElement&&n.focus(),!t)throw new Error("Unable to execute copy command")}class vt extends CustomEvent{constructor(n,e){super(n,e)}}class mn extends Error{constructor(){super(...arguments);u(this,"isTimeout",!0)}}const Je=mn;class ze{static makeCancelable(n,e){let t=!1,s,i;const a=new Promise((o,l)=>{i=l,Promise.resolve(n).then(c=>{t?e&&e(c):(s=c,o(c))}).catch(c=>l(c))});return a.cancel=()=>{t=!0,i(new rt),s!=null&&e&&e(s)},a}static isCanceled(n){return n instanceof rt}static isTimedOut(n){return n instanceof Je}static withTimeout(n,e){return new Promise((t,s)=>{setTimeout(()=>{try{t(e())}catch(i){s(i)}},n)})}}function gs(r){if(r==null)throw new Error("Value is null or undefined")}function Ms(r,n,e=void 0){const t=r.get(n)??e;if(t!==void 0)return t;throw new Error(`Missing value for key ${n}`)}class Ye{static isValidRange(n){return n!=null&&n.length===2&&Number.isInteger(n[0])&&Number.isInteger(n[1])&&n[0]<=n[1]}static validateRange(n){if(!Ye.isValidRange(n))throw new Error(`Invalid range! ${n}`)}static isSelected(n,e){for(let t=0;t<n.length;t+=1){const s=n[t],i=s[0],a=s[1];if(i<=e&&e<=a)return!0}return!1}static selectRange(n,e){let[t,s]=e;const i=[...n];for(let a=i.length-1;a>=0;a-=1){const o=i[a],l=o[0],c=o[1];if(l<=t&&s<=c)return i;t<=c&&l<=s&&(t=Math.min(t,l),s=Math.max(s,c),i.splice(a,1))}return i.push([t,s]),i}static deselectRange(n,e){const[t,s]=e,i=[...n];for(let a=i.length-1;a>=0;a-=1){const o=i[a],l=o[0],c=o[1];if(!(s<l||c<t))if(l<t&&s<c){i[a]=[l,t-1],i.splice(a+1,0,[s+1,c]);break}else t<=l&&c<=s?i.splice(a,1):l<t?i[a]=[l,t-1]:i[a]=[s+1,c]}return i}static count(n){return n.reduce((e,t)=>e+(t[1]-t[0]+1),0)}static getItemsInRanges(n,e){return e.reduce((t,s)=>{const i=[...t];for(let a=s[0];a<=s[1];a+=1)i.push(n[a]);return i},[])}}const te=Ye;class fn{static join(n,e="and"){if(n==null||n.length===0)return"";if(n.length===1)return n[0];if(n.length===2)return`${n[0]} ${e} ${n[1]}`;const t=n.slice(0,n.length-1).join(", "),s=n[n.length-1];return`${t}, ${e} ${s}`}static toLower(n,e=!0){if(n==null){if(e)return"";throw new Error("Null string passed in to TextUtils.toLower")}return n.toLowerCase()}static sort(n,e,t=!0){return n<e?t?-1:1:n>e?t?1:-1:0}}const gn=fn,st=class{static formatElapsedTime(n){if(typeof n!="number"||!Number.isInteger(n))throw new Error(`${n} is not a number that can be expressed as a formatted time`);const e=Math.floor(n/3600),t=Math.floor(n%3600/60),s=n%60;return`${e>0?`${e}h `:""}${t>0||e>0?`${t}m `:""}${n>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(n){if(typeof n!="number"||!Number.isInteger(n)||n<0)throw new Error(`${n} is not a number that can be expressed as a formatted time`);const e=String(Math.floor(n/(60*60))).padStart(2,"0"),t=n%(60*60),s=String(Math.floor(t/60)).padStart(2,"0"),i=t%60,a=String(Math.ceil(i)).padStart(2,"0");return`${e}:${s}:${a}`}static isTimeString(n){return new RegExp(st.TIME_PATTERN).test(n)}static parseTime(n){if(n==null||typeof n!="string")throw new Error(`${n} is not a valid string`);const e=n.split(":");if(e.length!==3)throw new Error(`${n} is not a time string that can be parsed`);return Number(e[0])*60*60+Number(e[1])*60+Number(e[2])}};let Ce=st;u(Ce,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"),u(Ce,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const Ss=Ce,Mn=3500,Sn=j.module("useCopyToClipboard");function bn(){const[r,n]=S.useState(!1),e=S.useRef(null),t=S.useCallback(s=>{pn(s).then(()=>{n(!0)}).catch(i=>Sn.error(`Unable to copy ${s}`,`
2
+ `,i))},[]);return S.useEffect(()=>(e.current&&clearTimeout(e.current),r&&(e.current=setTimeout(()=>{n(!1)},Mn)),()=>{e.current&&clearTimeout(e.current)}),[r]),[r,t]}function Be(r){return r.then!==void 0}const ce=class{static disableAllActions(){ce.actionsDisabled=!0}static enableAllActions(){ce.actionsDisabled=!1}static isContextActionEvent(n){return Array.isArray(n.contextActions)}static compareActions(n,e){return n.group!==e.group?(n.group??0)>(e.group??0)?1:-1:n.order!==e.order?(n.order??0)>(e.order??0)?1:-1:n.title!==e.title?(n.title??"")>(e.title??"")?1:-1:n!==e?n>e?1:-1:0}static sortActions(n){if(n==null||!Array.isArray(n))return[];const e=n.slice();return e.sort(ce.compareActions),e}static isMacPlatform(){const{platform:n}=window.navigator;return n.startsWith("Mac")}static getModifierKey(){return ce.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(n){const e=ce.getModifierKey();return n[e]}static getMenuItems(n,e=!0){let t=[],s=n;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const a=s[i];let o;typeof a=="function"?o=a():o=a,o!=null&&(o instanceof Promise?e&&t.push(o):Array.isArray(o)?t=t.concat(o):t.push(o))}return t=t.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),t}static getNextMenuItem(n,e,t){let s=n;s<0&&e<0&&(s=t.length);for(let i=1;i<t.length+1;i+=1){const a=(s+e*i+t.length)%t.length,o=t[a];if(!(o instanceof Promise)&&o.disabled!==!0)return a}return n}};let De=ce;u(De,"actionsDisabled",!1);const O=De,ct=j.module("GlobalContextAction");class Cn extends S.Component{constructor(n){super(n),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(n){const e=n;e.contextActions==null&&(e.contextActions=[]);const{action:t}=this.props;t.title==null&&!t.menuElement||(e.contextActions==null&&(e.contextActions=[]),e.contextActions.push(t),ct.debug("Received context menu event at global action! Menu items are now: ",e.contextActions))}handleKeyDown(n){var t;const{action:e}=this.props;!O.actionsDisabled&&e.shortcut!==void 0&&e.shortcut.matchesEvent(n)&&(ct.debug("Global hotkey matched!",n),(t=e.action)==null||t.call(e,n),n.preventDefault(),n.stopPropagation())}render(){return null}}const Tn=Cn;class yn extends S.Component{render(){const{actions:n,"data-testid":e}=this.props,t=[];for(let s=0;s<n.length;s+=1){const i=n[s],{shortcut:a}=i;if(i.title!=null||i.menuElement||a){const o=h.jsx(Tn,{action:i,"data-testid":e},`${i.title}.${a==null?void 0:a.id}`);t.push(o)}}return t}}const In=yn;const xe=j.module("ContextActions");class Et extends S.Component{constructor(e){super(e);u(this,"container");this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=v.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(e,t,s,i){if(i.length===0)return;const a=new MouseEvent("contextmenu",{clientX:t,clientY:s,bubbles:!0,cancelable:!0});a.contextActions=i,e.dispatchEvent(a)}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(i=>!Be(i)&&typeof i!="function"&&i.isGlobal),s=e.actions.filter(i=>!Be(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let i=e.target;for(;i!=null;){const{classList:a}=i,o=t.find(l=>a.contains(l));if(o!==void 0){xe.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}i=i.parentElement}}if(O.isContextActionEvent(e)||(e.contextActions=[]),!O.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let i=s;Array.isArray(i)&&(i=i.filter(a=>Be(a)||typeof a=="function"||a.isGlobal===void 0||!a.isGlobal)),e.contextActions=e.contextActions.concat(i)}xe.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){var s;const{keyboardActions:t}=this.state;for(let i=0;i<t.length;i+=1){const a=t[i];!O.actionsDisabled&&a.shortcut!=null&&a.shortcut.matchesEvent(e)&&(xe.debug("Context hotkey matched!",e),(s=a.action)==null||s.call(a,e),e.stopPropagation(),e.preventDefault(),xe.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return h.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:h.jsx(In,{actions:t})})}}u(Et,"groups",{default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const bs=Et,et=v.forwardRef((r,n)=>{var A;function e(I){const{menuItem:k,onMenuItemClick:x}=r;x(k,I)}function t(I){const{menuItem:k,onMenuItemMouseMove:x}=r;x(k,I)}function s(I){const{menuItem:k,onMenuItemContextMenu:x}=r;x(k,I)}function i(I,k,x){if(typeof I.type=="string")return I;const{closeMenu:H,menuItem:W,isKeyboardSelected:Z,isMouseSelected:_,"data-testid":re}=r,he={menuItem:W,closeMenu:H,isKeyboardSelected:Z,isMouseSelected:_,iconElement:k,displayShortcut:x,"data-testid":re};return v.cloneElement(I,{forwardedProps:he})}const{children:a,menuItem:o,isKeyboardSelected:l=!1,isMouseSelected:c=!1,"data-testid":d}=r,p=(A=o.shortcut)==null?void 0:A.getDisplayText();let f=null;if(o.icon){const I=o.icon;if(v.isValidElement(I))f=I;else{let k;o.iconColor!=null&&(o.disabled===void 0||!o.disabled)&&(k={color:o.iconColor}),f=h.jsx(oe,{icon:I,style:k})}}let b=null;const w=Boolean(a);o.actions&&(b=h.jsx(oe,{icon:Tt}));let D=null;if(o.menuElement)D=h.jsx("div",{className:"custom-menu-item",onMouseMove:t,children:i(o.menuElement,f,p)});else{const I=o.disabled,k=o.iconOutline;D=h.jsx("button",{type:"button",className:N("btn-context-menu",{disabled:I},{active:(w||c)&&(I===void 0||!I)},{"keyboard-active":l&&(I===void 0||!I)}),onClick:e,onMouseMove:t,onContextMenu:s,title:o.description??"",children:h.jsxs("div",{className:"btn-context-menu-wrapper",children:[h.jsx("span",{className:N("icon",{outline:k}),children:f}),h.jsx("span",{className:"title",children:o.title}),p!==void 0&&h.jsx("span",{className:"shortcut",children:p}),b&&h.jsx("span",{className:N("submenu-indicator",{disabled:I}),children:b})]})})}return h.jsxs("div",{className:"context-menu-item",ref:n,"data-testid":d,children:[a,D]})});et.displayName="ContextMenuItem";et.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const wt=et,ut=j.module("ContextMenu"),Le=class extends S.PureComponent{constructor(e){super(e);u(this,"container");u(this,"oldFocus");u(this,"activeSubMenuRef");u(this,"subMenuTimer");u(this,"rAF");u(this,"initialPosition");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=v.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=v.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}}static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){var a,o;const{actions:s}=this.props,{activeSubMenu:i}=this.state;i!==t.activeSubMenu&&(i==null?(a=this.container.current)==null||a.focus():this.setActiveSubMenuPosition()),e.actions!==s&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&((o=this.container.current)==null||o.focus())),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:s}=this.props,i=O.getMenuItems(s),a=[];for(let o=i.length-1;o>=0;o-=1){const l=i[o];l instanceof Promise?this.initMenuPromise(l):a.push(l)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:O.sortActions(a)})}initMenuPromise(e){const t=ze.makeCancelable(e);this.setState(s=>({pendingItems:s.pendingItems.concat(t)})),t.then(s=>{this.setState(i=>{const a=i.pendingItems.indexOf(t);if(a>=0){const o=i.pendingItems.slice();return o.splice(a,1),{menuItems:O.sortActions(i.menuItems.concat(s)),pendingItems:o}}return null})},s=>{ze.isCanceled(s)||(this.setState(i=>{const a=i.pendingItems.indexOf(t);if(a>=0){const o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),ut.error(s))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){var b,w;const{options:e,updatePosition:t,subMenuParentWidth:s,subMenuParentHeight:i,top:a,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:l,left:c}=this.initialPosition;const{width:d,height:p}=((b=this.container.current)==null?void 0:b.getBoundingClientRect())??{width:0,height:0},f=(((w=this.container.current)==null?void 0:w.scrollHeight)??0)>window.innerHeight;p===0||d===0||(l+p>window.innerHeight&&(l-p-i>0?l-=p-i:l=window.innerHeight-p),c+d>window.innerWidth&&(c=c-d-s),(o!==c||a!==l)&&(this.setState({hasOverflow:f}),t(l,c)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){ut.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,s=!1;for(;t&&!s;)s=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;s||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,s=this.getKeyboardIndex();let i=s,a=!1;if(e.key==="Enter"||e.key===" "){s>=0&&s<t.length&&this.handleMenuItemClick(t[s],e);return}if(e.key==="ArrowRight"?s>=0&&s<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=O.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=O.getNextMenuItem(i,1,t)),a){this.openSubMenu(s),e.preventDefault(),e.stopPropagation();return}s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:s}=this.state,i=t[e].actions?e:null;s!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),s(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:s}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(s.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,s=t.indexOf(e);this.setMouseIndex(s),s>=0&&s<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:s}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:l,mouseIndex:c,pendingItems:d,subMenuTop:p,subMenuLeft:f,subMenuParentWidth:b,subMenuParentHeight:w}=this.state;for(let x=0;x<l.length;x+=1){const H=l[x];x>0&&H.group!==l[x-1].group&&e.push(h.jsx("hr",{},`${x}.separator`));const W=h.jsx(wt,{ref:i===x?this.activeSubMenuRef:null,isKeyboardSelected:o===x,isMouseSelected:c===x,menuItem:H,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},x);e.push(W)}let D=null;d.length>0&&(D=h.jsx("div",{className:"loading",children:h.jsx(Zt,{})}));const{menuStyle:A,"data-testid":I}=this.props,k=i!==null&&p!==null&&f!==null;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:N({"has-overflow":a},"context-menu-container"),style:{top:t,left:s,...A},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Le.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":I,children:[e,D]}),k&&i!==null&&p!==null&&f!==null&&h.jsx(Le,{actions:l[i].actions||[],closeMenu:this.handleCloseSubMenu,top:p,left:f,updatePosition:(x,H)=>{this.setState({subMenuTop:x,subMenuLeft:H})},subMenuParentWidth:b,subMenuParentHeight:w},`sub-${i}`)]})}};let Fe=Le;u(Fe,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const vn=Fe;class En extends S.Component{constructor(e){super(e);u(this,"container");u(this,"openMenu");this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=v.createRef(),this.openMenu=v.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(!O.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=O.getMenuItems(e.contextActions),s=this.container.current.getBoundingClientRect(),i=e.clientY-s.top,a=e.clientX-s.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const o=document.elementFromPoint(a,i),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o==null||o.dispatchEvent(l)});return}return}e.preventDefault(),this.setState({actions:t,top:i,left:a})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:s,top:i,left:a}=this.state;return s&&(e=h.jsx(vn,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,l)=>{this.setState({top:o,left:l})},"data-testid":t})),h.jsx("div",{className:N("context-menu-root",{active:s}),ref:this.container,children:e})}}const Cs=En,$e=v.forwardRef((r,n)=>{const{checked:e=!1,children:t,className:s,disabled:i,inputClassName:a,isInvalid:o,labelClassName:l,name:c,onChange:d,"data-testid":p}=r,[f]=S.useState(Ze()),b=It(n);S.useEffect(function(){b.current&&(b.current.indeterminate=e===null)},[b,e]);const w=S.useCallback(D=>{b.current&&(b.current.indeterminate=e===null),d&&d(D)},[b,e,d]);return h.jsxs("div",{className:N("custom-control custom-checkbox",s),children:[h.jsx("input",{type:"checkbox",ref:b,checked:e??!1,className:N("custom-control-input",a,{"is-invalid":o}),disabled:i,id:f,name:c,onChange:w,"data-testid":p}),h.jsx("label",{className:N("custom-control-label",l),htmlFor:f,children:t})]})});$e.displayName="Checkbox";$e.propTypes={checked:(r,n)=>{const{[n]:e}=r;return e!==null&&typeof e!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:C.node.isRequired,className:C.string,disabled:C.bool,inputClassName:C.string,isInvalid:C.bool,labelClassName:C.string,name:C.string,onChange:C.func,"data-testid":C.string};$e.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const wn=$e;class xt extends S.PureComponent{constructor(e){super(e);u(this,"inputField");this.inputField=v.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:t,onBlur:s,onChange:i,className:a,disabled:o,matchCount:l,id:c,onKeyDown:d,"data-testid":p}=this.props;return h.jsxs("div",{className:N("search-group",a),children:[h.jsx("input",{type:"search",value:e,onBlur:s,onChange:i,onKeyDown:d,className:"form-control",disabled:o,placeholder:t,ref:this.inputField,id:c,"data-testid":p}),l!=null&&h.jsx("span",{className:"search-match",children:l}),h.jsx("span",{className:"search-icon",children:h.jsx(oe,{icon:Xt})})]})}}u(xt,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0});const xn=xt;var Nt=(r=>(r.UP="UP",r.DOWN="DOWN",r))(Nt||{});const Se=class extends S.Component{constructor(e){super(e);u(this,"popper");u(this,"cbContainer");u(this,"toggleButton");u(this,"menuContainer");u(this,"input");u(this,"searchInput");u(this,"getCachedFilteredOptions",Q((e,t)=>e.filter(s=>s.title.toLowerCase().indexOf(t.toLowerCase())>=0||s.value.toLowerCase().indexOf(t.toLowerCase())>=0)));this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=v.createRef(),this.cbContainer=v.createRef(),this.toggleButton=v.createRef(),this.menuContainer=v.createRef(),this.input=v.createRef(),this.searchInput=v.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var l,c;const{filter:t,filteredOptions:s,keyboardOptionIndex:i}=this.state,{options:a}=this.props,o=t?s:a;switch(e.key){case"Enter":((l=o[i])==null?void 0:l.value)!=null&&this.updateInputValue(o[i].value),this.closeMenu(),(c=this.input.current)==null||c.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Se.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&i===o.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:s,keyboardOptionIndex:i}=this.state,{options:a}=this.props,l=(t?s:a).length;let c=0;switch(e){case Se.MENU_NAVIGATION_DIRECTION.UP:c=-1;break;case Se.MENU_NAVIGATION_DIRECTION.DOWN:c=1;break}c!==0&&this.setState({keyboardOptionIndex:(i+c+l)%l})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:s}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?s||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var l;const t=Number(e.currentTarget.value),{filter:s,filteredOptions:i}=this.state,{options:a}=this.props,o=s?i:a;this.updateInputValue(o[t].value),this.closeMenu(),(l=this.input.current)==null||l.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var a;const{options:t}=this.props,s=e.target.value,i=this.getCachedFilteredOptions(t,s);this.setState({filter:s,filteredOptions:i,keyboardOptionIndex:0}),(a=this.popper.current)==null||a.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,s;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(s=this.popper.current)==null||s.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:s}=this.state,{options:i}=this.props,o=(t?s:i).findIndex(l=>l.value===e);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:s}=this.state;return h.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:i=>{i.stopPropagation()},style:{width:s},onBlur:this.handleMenuBlur,children:[h.jsx("div",{className:"cb-search-input-container",children:h.jsx(xn,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),h.jsx("div",{className:"cb-options-container",children:h.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:s,filteredOptions:i}=this.state;return(s?i:e).map((o,l)=>{const c=`option-${l}-${o.value}`;return h.jsx("button",{type:"button",value:l,className:N("cb-option-btn",{"keyboard-active":t===l}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},c)})}render(){const{options:e,inputPlaceholder:t,disabled:s,className:i,defaultValue:a,spellCheck:o,"data-testid":l}=this.props,{value:c}=this.state;let{popperOptions:d}=this.props;return d={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...d},h.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h.jsx("input",{value:c||a,className:N("form-control",i,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:s,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":l!==void 0?`${l}-input`:void 0}),h.jsx("div",{className:"input-group-append cb-dropdown",children:h.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:s,"data-testid":l!==void 0?`${l}-btn`:void 0,children:[h.jsx(oe,{icon:_t}),h.jsx(Xe,{ref:this.popper,options:d,className:N("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let le=Se;u(le,"MENU_NAVIGATION_DIRECTION",Nt),u(le,"DROP_DOWN_MENU_HEIGHT",200),u(le,"propTypes",{options:C.arrayOf(C.shape({title:C.string.isRequired,value:C.string.isRequired})).isRequired,popperOptions:C.shape({title:C.string.isRequired,value:C.string.isRequired}),onChange:C.func,inputPlaceholder:C.string,searchPlaceholder:C.string,disabled:C.bool,className:C.string,defaultValue:C.string,spellCheck:C.bool,onEnter:C.func,"data-testid":C.string}),u(le,"defaultProps",{onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0});const Ts=le;function ys({copy:r,kind:n="ghost",tooltip:e="Copy",className:t,"data-testid":s,children:i}){const[a,o]=bn();return h.jsx(Ge,{kind:n,className:t,"data-testid":s,icon:a?Jt:Yt,tooltip:a?"Copied":e,onClick:()=>{o(typeof r=="function"?r():r)},children:i})}function Dt(r,n,e){return r.substring(0,n)+e+r.substring(n+1)}function Nn(r,n,e){return r.length<e?`${r}${n.substring(r.length,e)}`:r}function dt(r,n){let{length:e}=r;for(let t=r.length-1;t>=0&&n[t]===r[t];t-=1)e=t;return r.substring(0,e)}const q=j.module("MaskedInput"),pe={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Ne=" ",Ft=v.forwardRef((r,n)=>{const{className:e,example:t,getNextSegmentValue:s=(y,T,M)=>M,getPreferredReplacementString:i=Dt,onChange:a=()=>!1,onSelect:o=()=>!1,onSubmit:l,pattern:c,placeholder:d,selection:p,value:f,onFocus:b=()=>!1,onBlur:w=()=>!1,"data-testid":D}=r,A=It(n),I=S.useMemo(()=>Array.isArray(t)?t:[t],[t]),k=S.useMemo(()=>I[0].replace(/[a-zA-Z0-9]/g,Ne),[I]);S.useEffect(function(){var T;if(p!=null){q.debug("setting selection...",p);const{selectionStart:M,selectionEnd:E,selectionDirection:R}=p;(T=A.current)==null||T.setSelectionRange(M,E,R),q.debug("selection set!")}},[p,A]);const x=S.useCallback(y=>{let T=y,M=y;const E=I.length>0?I[0]:f;for(let F=T-1;F>=0&&/[a-zA-Z0-9]/g.test(E.charAt(F));F-=1)T=F;for(let F=M;F<E.length&&/[a-zA-Z0-9]/g.test(E.charAt(F));F+=1)M=F+1;const R=T===M?pe.NONE:pe.BACKWARD;return{selectionStart:T,selectionEnd:M,selectionDirection:R}},[I,f]);function H(y,T,M=y.length){let E="";for(let R=0;R<M;R+=1)y.charAt(R)!==Ne?E=E.concat(y[R]):E=E.concat(T[R]);return E=E.concat(T.substring(M)),E}function W(y,T=y.length){const M=new RegExp(`^${c}$`);if(M.test(y))return!0;for(let E=0;E<I.length;E+=1){const R=H(y,I[E],T);if(M.test(R))return!0}return!1}function Z(y){const T=x(y),M=T.selectionEnd+1;return M>=f.length?T:x(M)}function _(y){const T=x(y),M=T.selectionStart-1;return M<=0?T:x(M)}function re(y,T){const M=x(y),E=f.substring(M.selectionStart,M.selectionEnd),R=s(M,T,E,f),F=f.substring(0,M.selectionStart)+R+f.substring(M.selectionEnd);W(F,M.selectionEnd)&&(a(F),o(M))}const he=S.useCallback(y=>{const{selectionStart:T=0,selectionEnd:M=0,selectionDirection:E="none"}=y.target;if(T===null||M===null||E===null){q.error("Selection attempted on non-text input element",y.target);return}if(q.debug2("handleSelect",T,M,E),!(p!=null&&T===p.selectionStart&&M===p.selectionEnd)){if(p!=null&&T===f.length&&M===f.length&&y.nativeEvent.type!=="mouseup"){o({...p});return}if(T===M){const R=x(T);q.debug("Selection segment from ",T,M,"=>",R),o(R)}else o({selectionStart:T,selectionEnd:M,selectionDirection:E})}},[x,o,p,f]),be=S.useCallback(y=>{if(!A.current)return;q.debug("handleSelectCapture",y);const T=A.current.selectionStart??0;T===f.length&&p!=null&&T!==p.selectionStart&&(y.preventDefault(),y.stopPropagation())},[A,p,f]);function Ee(y){if(y.preventDefault(),y.stopPropagation(),!A.current)return;const{key:T}=y,{selectionStart:M=0,selectionEnd:E=0}=A.current;if(M===null||E===null){q.error("Selection arrow nvaigation attempted on non-text input element",y.target);return}T==="ArrowLeft"?o(_(M)):T==="ArrowRight"?o(Z(E)):T==="ArrowUp"?re(M,-1):T==="ArrowDown"&&re(M,1)}function we(y){if(!A.current)return;q.debug("handleKeyDown",y);const{key:T}=y,{selectionStart:M=0,selectionEnd:E=0}=A.current;if(M===null||E===null){q.error("Selection key event on non-text input element",y.target);return}if(T==="Enter"){l==null||l(y);return}if(T.startsWith("Arrow")){Ee(y);return}if(T==="Delete"||T==="Backspace"){if(y.preventDefault(),y.stopPropagation(),E>=dt(f,k).length){const F=f.substring(0,M===E?M-1:M),X=dt(F,k);X!==f&&(a(X),o({selectionStart:X.length,selectionEnd:X.length,selectionDirection:pe.NONE}));return}if(M!==E){const F=f.substring(0,M)+f.substring(M,E).replace(/[a-zA-Z0-9]/g,Ne)+f.substring(E);q.debug("Range ",M,E,"deleted, setting value",F),a(F),o({selectionStart:M,selectionEnd:M,selectionDirection:pe.NONE})}else if(M>0)for(let F=M-1;F>=0;F-=1){const X=f.substring(0,F)+f.substring(F,M).replace(/[a-zA-Z0-9]/g,Ne)+f.substring(M);if(X!==f){a(X),o({selectionStart:F,selectionEnd:F,selectionDirection:pe.NONE});return}}return}if(y.altKey||y.metaKey||y.ctrlKey||T.length>1)return;y.preventDefault(),y.stopPropagation();const R=Array.from(new Set([T,T.toUpperCase(),T.toLowerCase()]));for(let F=0;F<R.length;F+=1){const X=R[F],jt=/[a-zA-Z0-9]/g.test(X)?I[0].length-1:M;for(let ee=M;ee<=jt;ee+=1){const Ut=Nn(f,I[0],ee+1),je=i(Ut,ee,X,M,E);if(W(je,ee+1)){const at=x(ee),Ue=ee+1;let Ve={selectionStart:Ue,selectionEnd:Ue,selectionDirection:pe.NONE};if(Ue>=at.selectionEnd){const ot=Z(ee);ot.selectionStart!==at.selectionStart&&(Ve=ot)}q.debug("handleKeyDown",T,"=>",je,Ve),a(je),o(Ve);return}}}}return h.jsx("input",{ref:A,className:N("form-control masked-input",e),type:"text",pattern:c,placeholder:d,value:f,onChange:()=>{},onKeyDown:we,onSelect:he,onSelectCapture:be,onFocus:b,onBlur:w,"data-testid":D})});Ft.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(r,n,e)=>e,getPreferredReplacementString:Dt,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const Dn=Ft;var He;let Fn=(He=class extends S.PureComponent{constructor(e){super(e);u(this,"container");u(this,"oldFocus");u(this,"rAF");this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=v.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,s=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=O.getMenuItems(e,!1);t.length>0&&this.setState(s=>({menuItems:O.sortActions(s.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,s=this.getKeyboardIndex();let i=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<t.length&&this.handleMenuItemClick(t[s],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=O.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=O.getNextMenuItem(i??0,1,t)),s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,s=t.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:s,menuItems:i,mouseIndex:a}=this.state;for(let l=0;l<i.length;l+=1){const c=i[l];l>0&&c.group!==i[l-1].group&&e.push(h.jsx("hr",{},`${l}.separator`));const d=h.jsx(wt,{isKeyboardSelected:s===l,isMouseSelected:a===l,menuItem:c,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);e.push(d)}const{menuStyle:o}=this.props;return h.jsx("div",{className:"context-menu-container",style:{...o},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}},u(He,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0}),He);const An=Fn;class At extends S.PureComponent{constructor(e){super(e);u(this,"container");u(this,"parent");u(this,"popper");u(this,"isOpen");this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=v.createRef(),this.parent=null,this.popper=v.createRef(),this.isOpen=!1}componentDidMount(){var t;const{isShown:e}=this.props;e===null?(t=this.container.current)!=null&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:s,"data-testid":i}=this.props,{menuStyle:a}=this.props;let{options:o,popperOptions:l}=this.props;return l={placement:"bottom",...l},o={separateKeyboardMouse:!0,...o},h.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h.jsx(Xe,{ref:this.popper,options:l,className:N("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h.jsx(An,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:a})})})}}u(At,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const vs=At;function me(r,n,e,t,s){const i=t-e+1;return`${((parseInt(n,10)-r-e)%i+i)%i+e}`.padStart(s,"0")}function kn(r,n,e){const{selectionStart:t}=r;return t===0?me(n,e,1900,2099,4):t===5?me(n,e,1,12,2):t===8?me(n,e,1,31,2):t===11?me(n,e,0,23,2):t===17||t===14?me(n,e,0,59,2):t===20||t===24||t===28?me(n,e,0,999,3):e}function Qe(r){const n=r.substring(0,23),e=r.substring(23,26),t=r.substring(26);return[n,e,t].filter(s=>s!=="").join("​")}const On=j.module("DateTimeInput"),Rn="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Ln="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",Pn=`${Rn} ${Ln}`,Ae="2022-01-01",kt=`${Ae} 00:00:00.000000000`,$n="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function ht(r){return r!=null&&r.length>=Ae.length?`${r.substring(0,Ae.length)}${r.substring(Ae.length).replace(/\u2007/g,"0")}${kt.substring(r.length)}`:r}function pt(r){return r.replace(/\u200B/g,"")}const jn=[Qe(kt)],tt=v.forwardRef((r,n)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:a=()=>{},onSubmit:o,"data-testid":l}=r,[c,d]=S.useState(s.length>0?Qe(s):""),[p,f]=S.useState(),b=S.useCallback(D=>{On.debug("handleChange",D),d(D),t(ht(pt(D)))},[t]),w=S.useCallback(()=>{const D=pt(c),A=ht(D);A!==D&&d(Qe(A)),a()},[c,a]);return h.jsx("div",{className:"d-flex flex-row align-items-center",children:h.jsx(Dn,{ref:n,className:N(e),example:jn,getNextSegmentValue:kn,onChange:b,onSelect:f,onSubmit:o,pattern:Pn,placeholder:$n,selection:p,value:c,onFocus:i,onBlur:w,"data-testid":l})})});tt.displayName="DateTimeInput";tt.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const Es=tt;const Un=j.module("ItemListItem"),it=class extends S.Component{constructor(e){super(e);u(this,"itemRef");this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=v.createRef()}static handleKeyDown(){return Un.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:s}=this.props;s(t,e)}handleFocus(e){const{itemIndex:t,onFocus:s}=this.props;s(t,e)}handleClick(e){const{itemIndex:t,onClick:s}=this.props;s(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:s}=this.props;s(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:s}=this.props;s(t,e)}handleDrag(e){const{itemIndex:t,onDrag:s}=this.props;s(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:s}=this.props;s(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:s}=this.props;s(t,e)}handleDrop(e){const{itemIndex:t,onDrop:s}=this.props;s(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:s}=this.props;s(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:s}=this.props;s(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:s}=this.props;s(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:s}=this.props;s(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:s,style:i,children:a,"data-testid":o}=this.props;return h.jsx("div",{className:N("item-list-item",{active:s},{"is-focused":t},{"is-draggable":e}),onKeyDown:it.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":o,children:a})}};let ke=it;u(ke,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const Vn=ke;const mt=j.module("ItemList"),ft=5,ue=class extends S.PureComponent{constructor(e){super(e);u(this,"list");u(this,"listContainer");u(this,"getItemSelected",Q((e,t)=>te.isSelected(t,e),{max:ue.CACHE_SIZE}));u(this,"getCachedItem",Q((e,t,s,i,a,o,l,c)=>{const d=o({item:s,itemIndex:e,isFocused:i,isSelected:a,style:l});return h.jsx(Vn,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:i,isSelected:a,itemIndex:e,style:l,children:d},t)},{max:ue.CACHE_SIZE}));u(this,"getOuterElement",Q(e=>{const t=v.forwardRef((s,i)=>h.jsx("div",{ref:i,tabIndex:-1,onKeyDown:e,role:"presentation",...s}));return t.displayName="ItemListOuterElement",t}));u(this,"getInnerElement",Q(()=>{const e=v.forwardRef((t,s)=>h.jsx("div",{className:"item-list-inner-element",ref:s,...t}));return e.displayName="ItemListInnerElement",e}));u(this,"getItemData",Q((e,t,s)=>({items:e,selectedRanges:t,renderItem:s})));this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=v.createRef(),this.listContainer=v.createRef();const{isStickyBottom:t,selectedRanges:s}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:s,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}static renderItem({item:e}){return h.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:s,itemCount:i}=this.props,{focusIndex:a,isStuckToBottom:o,scrollOffset:l,height:c,selectedRanges:d}=this.state;if(o&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(l!==t.scrollOffset||c!==t.height)&&this.sendViewportUpdate(),s!==e.selectedRanges&&s!==d)this.setSelectedRanges(s);else if(d!==t.selectedRanges){const{onSelectionChange:p}=this.props;p(d)}if(a!==t.focusIndex){const{onFocusChange:p}=this.props;p(a)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:s}=this.state,i=this.listContainer.current.querySelectorAll(t),a=e-s;return i[a]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const s=this.getElement(e);s instanceof HTMLElement&&s.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:s}=this.state,a=te.isSelected(s,e)||O.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,a,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:s,onSelect:i}=this.props;s&&this.setState(({selectedRanges:a})=>({selectedRanges:te.selectRange(a,[e,e])}),()=>{i(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&s.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){mt.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){mt.debug2("item focus",e,t.target),this.setState(s=>{const{focusIndex:i}=s;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:s,isMultiSelect:i,disableSelect:a}=this.props,{mouseDownIndex:o,selectedRanges:l,mouseX:c,mouseY:d}=this.state;if(o==null||a)return;const p=Math.abs(t.clientX-(c??0)),f=Math.abs(t.clientY-(d??0));p>ft&&f>ft&&this.setState({isDragging:!0}),(s||o===e)&&(this.focusItem(e),i?(!s&&!this.getItemSelected(e,l)&&!O.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,O.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:s,isDoubleClickSelect:i,onSelect:a}=this.props,{mouseDownIndex:o,isDragging:l}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!l){const c=t.shiftKey,d=O.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,c,d,s),!i&&!c&&!d&&a(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var l;const{isMultiSelect:t,itemCount:s,onSelect:i}=this.props,{focusIndex:a}=this.state;let o=a;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&i(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=s-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,s-1):o=0;else return;if(a!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);const{selectedRanges:c}=this.state;if(e.shiftKey&&c.length>0){const d=c[c.length-1];this.selectRange([Math.min(o,d[0]),Math.max(o,d[1])])}else this.deselectAll(),o!==null?this.selectItem(o):(l=this.listContainer.current)==null||l.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(s=>{if(e)return{scrollOffset:t};const{isStickyBottom:i}=this.props,{height:a}=s;return{isStuckToBottom:i&&this.isListAtBottom({scrollOffset:t,height:a}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,s,i=!0){const{isMultiSelect:a}=this.props,{selectedRanges:o}=this.state;if(a&&t&&o.length>0){const l=o[o.length-1];this.selectRange([Math.min(l[0],e),Math.max(e,l[1])])}else a&&o.length===1&&o[0][0]===e&&o[0][1]===e?i&&this.deselectItem(e):a&&s?this.getItemSelected(e,o)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){te.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:te.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){te.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:te.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:s,rowHeight:i}=this.props,a=Math.floor(e/i),o=a+Math.ceil(t/i);s(a,o)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:s,rowHeight:i}=this.props;return e+t>=s*i}renderInnerElement({index:e,style:t}){const{items:s,offset:i,renderItem:a,disableSelect:o}=this.props,{focusIndex:l,selectedRanges:c}=this.state;if(e<i||e>=i+s.length)return null;const d=s[e-i];return this.getCachedItem(e,e,d,e===l&&!o,this.getItemSelected(e,c),a,t,o)}render(){const{items:e,itemCount:t,overscanCount:s,renderItem:i,rowHeight:a,"data-testid":o}=this.props,{selectedRanges:l,isStuckToBottom:c}=this.state;return h.jsx(Wt,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:d,height:p})=>h.jsx(qt,{className:"item-list-scroll-pane",height:p,width:d,initialScrollOffset:c?t*a:0,itemCount:t,itemSize:a,itemData:this.getItemData(e,l,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:s,"data-testid":o,children:this.renderInnerElement})})}};let ne=ue;u(ne,"CACHE_SIZE",1e3),u(ne,"DEFAULT_ROW_HEIGHT",20),u(ne,"DEFAULT_OVERSCAN",10),u(ne,"defaultProps",{offset:0,items:[],rowHeight:ue.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:ue.DEFAULT_OVERSCAN,renderItem:ue.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});const se=class extends S.PureComponent{constructor(e){super(e);u(this,"itemList");u(this,"getCachedDraggableItem",Q((e,t,s,i,a,o,l,c)=>h.jsx(Gt,{draggableId:se.getDraggableId(e,i),index:i,isDragDisabled:l,children:d=>h.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:d.innerRef,tabIndex:-1,...d.draggableProps,...d.dragHandleProps,children:t({item:s,itemIndex:i,isFocused:a,isSelected:o,style:c,isClone:!1})})},i),{max:ne.CACHE_SIZE}));u(this,"getCachedRenderDraggableItem",Q((e,t,s)=>({item:i,itemIndex:a,isFocused:o,isSelected:l,style:c})=>this.getCachedDraggableItem(e,s,i,a,o,l,t,c),{max:1}));u(this,"getCachedRenderClone",Q((e,t,s,i)=>(a,o,l)=>{const{selectedCount:c}=this.state,{draggableProps:d,dragHandleProps:p,innerRef:f}=a,{index:b}=l.source,w=t[b-s];return h.jsx("div",{className:N("draggable-item-list-dragging-item-container",e),...d,...p,ref:f,children:h.jsx("div",{className:N("draggable-item-list-dragging-item",{"two-dragged":c===2},{"multiple-dragged":c>2}),children:i({item:w,itemIndex:b,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:c})})})},{max:1}));this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=v.createRef(),this.state={selectedCount:0}}static renderHandle(){return h.jsxs("div",{children:[h.jsx(yt,{children:"Drag to re-order"}),h.jsx(oe,{icon:en})]})}static renderBadge({text:e}){return e!=null&&e.length>0?h.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:s=""}){return h.jsxs("div",{className:N("item-list-item-content","draggable-item-list-item-content",s),children:[h.jsx("span",{className:"title",children:e}),se.renderBadge({text:t}),se.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:s}){const i=e!=null?e.displayValue??e.value??`${e}`:"",a=t!==void 0&&t?`${s}`:"",o=t!==void 0&&t?"item-list-item-clone":"";return se.renderTextItem({text:i,badgeText:a,className:o})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:te.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:s,droppableId:i,isDoubleClickSelect:a,isDragDisabled:o,isDropDisabled:l,isMultiSelect:c,isStickyBottom:d,itemCount:p,items:f,offset:b,onFocusChange:w,onSelect:D,onViewportChange:A,renderItem:I,rowHeight:k,selectedRanges:x,style:H,"data-testid":W}=this.props;return h.jsx(zt,{isDropDisabled:l,droppableId:i,mode:"virtual",renderClone:this.getCachedRenderClone(s,f,b,I),"data-testid":W,children:(Z,_)=>h.jsx("div",{role:"menu",className:N("draggable-item-list",e,{"is-drop-disabled":l,"is-drag-disabled":o,"is-dragging-from-this":_.draggingFromThisWith,"is-dragging-over":_.isDraggingOver,"is-dropping":_.draggingOverWith}),style:H,ref:Z.innerRef,...Z.droppableProps,children:h.jsx(ne,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:a,isDragSelect:!1,isMultiSelect:c,isStickyBottom:d,itemCount:p,items:f,onFocusChange:w,onSelect:D,onSelectionChange:this.handleSelectionChange,onViewportChange:A,offset:b,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,o,I),rowHeight:k,selectedRanges:x})})})}};let Te=se;u(Te,"DEFAULT_ROW_HEIGHT",30),u(Te,"defaultProps",{className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:se.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:se.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0});const ws=Te;class Re{static reorder(n,e,t,s){const i=n===t?Re.adjustDestinationIndex(s,e):s,a=Re.removeItems(n,e);return t.splice(i,0,...a),a}static removeItems(n,e){const t=[],s=e.map((i,a)=>({range:i,index:a})).sort((i,a)=>a.range[0]-i.range[0]);for(let i=0;i<s.length;i+=1){const{range:a,index:o}=s[i],[l,c]=a;t[o]=n.splice(l,c-l+1)}return Qt(t)}static adjustDestinationIndex(n,e){let t=n;for(let s=0;s<e.length;s+=1){const[i,a]=e[s];if(i>n)break;t-=Math.min(a,n-1)-i+1}return t}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const xs=Re;function Bn({on:r,id:n,className:e,isInvalid:t,disabled:s=!1,onClick:i,"data-testid":a}){return h.jsx("button",{type:"button",className:N("btn","btn-switch",e,{active:r},{"is-invalid":t}),id:n,onClick:i,disabled:s,"data-testid":a,children:h.jsx("div",{className:"handle"})})}function gt(r){return r.isOn!==void 0}function Hn({item:r,onSelect:n=()=>{},"data-testid":e}){const{icon:t,subtitle:s,title:i}=r,a=S.useMemo(()=>gt(r)?()=>{r.onChange(!r.isOn)}:n,[r,n]);return h.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:a,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[t!==void 0&&h.jsx("div",{className:"icon",children:h.jsx(oe,{icon:t})}),h.jsx("div",{className:"title",children:i}),s!==void 0&&h.jsx("div",{className:"shortcut",children:s}),h.jsx("div",{className:"accessory","data-testid":e,children:gt(r)?h.jsx(Bn,{on:r.isOn,onClick:o=>{o.stopPropagation(),a()}}):h.jsx(oe,{icon:Tt})})]})}function Ns({items:r,onSelect:n=()=>{},"data-testid":e}){return h.jsx("div",{className:"navigation-menu-view","data-testid":e,children:h.jsx("ul",{className:"navigation-menu-list",children:r.map((t,s)=>h.jsx("li",{children:h.jsx(Hn,{item:t,onSelect:()=>{n(s)}})},t.title))})})}function Ds({children:r,onBack:n,onClose:e,title:t,"data-testid":s}){return h.jsxs("div",{className:"navigation-page","data-testid":s,children:[h.jsxs("div",{className:"navigation-title-bar",children:[h.jsx("div",{className:"navigation-left-buttons",children:n!==void 0&&h.jsx(Ge,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:n,icon:tn,children:"Back"})}),h.jsx("div",{className:"navigation-title",children:t}),h.jsx("div",{className:"navigation-right-buttons",children:e!==void 0&&h.jsx(Ge,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:e,icon:nn,tooltip:"Close"})})]}),h.jsx("div",{className:"navigation-content",children:r})]})}function Fs({children:r,"data-testid":n}){const e=S.useMemo(()=>v.Children.toArray(r),[r]),t=dn(e),[s,i]=S.useState(e[e.length-1]),[a,o]=S.useState(null),[l,c]=S.useState(null);S.useEffect(function(){if(t===void 0||e===t)return;const b=e[e.length-1];e.length===t.length||t.length===0||a!==null||l!==null?a!==null&&b!==a?o(b):b!==l&&b!==s&&i(b):e.length>t.length?o(b):e.length<t.length&&(i(b),c(t[t.length-1]))},[e,t,a,l,s]);const d=S.useCallback(()=>{i(a),o(null)},[a]),p=S.useCallback(()=>{c(null)},[]);return h.jsxs("div",{className:"navigation-stack",children:[h.jsx("div",{className:"main-view","data-testid":n,children:s}),h.jsx(Ke,{in:l!=null,timeout:We.transitionMidMs,classNames:"slide-right",onEntered:p,children:h.jsx(h.Fragment,{children:l!=null&&h.jsx("div",{className:"popping-view",children:l})})}),h.jsx(Ke,{in:a!=null,timeout:We.transitionMidMs,classNames:"slide-left",onEntered:d,children:h.jsx(h.Fragment,{children:a!=null&&h.jsx("div",{className:"pushing-view",children:a})})})]})}function As({children:r,disabled:n,value:e,"data-testid":t}){return h.jsx("option",{value:e,disabled:n,"data-testid":t,children:r})}function ks(r){const{children:n,disabled:e=!1,name:t,onChange:s,value:i="","data-testid":a}=r,[o]=S.useState(t??Ze());return h.jsx(h.Fragment,{children:v.Children.map(n,l=>l?v.cloneElement(l,{name:o,onChange:l.props.onChange??s,checked:i===l.props.value,disabled:l.props.disabled??e,"data-testid":a}):null)})}const nt=v.forwardRef((r,n)=>{const{checked:e,children:t,className:s="",disabled:i=!1,inputClassName:a="",isInvalid:o=!1,labelClassName:l="",name:c,onChange:d,value:p,"data-testid":f}=r,[b]=S.useState(Ze());return h.jsxs("div",{className:N("custom-control custom-radio",s),children:[h.jsx("input",{type:"radio",id:b,"data-testid":f,name:c,ref:n,className:N("custom-control-input",a,{"is-invalid":o}),checked:e,disabled:i,value:p,onChange:d}),h.jsx("label",{className:N("custom-control-label",l),htmlFor:b,children:t})]})});nt.displayName="RadioItem";nt.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Os=nt;function Rs({children:r,onBlur:n,onChange:e,className:t,defaultValue:s,name:i,value:a,disabled:o,"data-testid":l}){const c=S.useCallback(d=>{e(d.target.value)},[e]);return h.jsx("select",{className:N("custom-select",t),onBlur:n,onChange:c,defaultValue:s,value:a,name:i,disabled:o,"data-testid":l,children:r})}class Ot extends S.PureComponent{constructor(e){super(e);u(this,"list");u(this,"topRow");u(this,"bottomRow");u(this,"getCachedItem",Q((e,t,s,i,a,o,l)=>{const c={height:a},d=i??s;return h.jsx("li",{className:"value-list-item",style:c,tabIndex:-1,children:h.jsx(wn,{checked:o,disabled:l,onChange:()=>this.handleSelect(e),children:d})},t)},{max:1e3}));u(this,"getCachedItems",Q((e,t,s,i)=>{const a=[];for(let o=0;o<e.length;o+=1){const l=e[o],{value:c,displayValue:d,isSelected:p}=l,f=s+o,b=f,w=this.getCachedItem(f,b,c,d,t,p,i);a.push(w)}return a},{max:1}));this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=v.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t==null||t(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:s,onSelect:i}=this.props,a=e-s;if(a>=0&&a<t.length){const o=t[a],{value:l}=o;i(e,l)}else i(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,s=this.list.current.scrollTop,i=s+this.list.current.clientHeight,a=Math.floor(s/t),o=Math.ceil(i/t);(this.topRow!==a||this.bottomRow!==o)&&(this.topRow=a,this.bottomRow=o,e(a,o))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const t=this.getElement(e);t==null||t.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:s,items:i,itemCount:a,offset:o,rowHeight:l,"data-testid":c}=this.props,d=this.getCachedItems(i,l,o,t);return h.jsx("div",{className:N("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":c,children:h.jsx("div",{className:"select-value-list",style:{height:a*l},children:h.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:i.length*l,top:o*l,left:0},children:d})})})}}u(Ot,"defaultProps",{disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0});const Ls=Ot,Mt=j.module("Shortcut");var G=(r=>(r.CTRL="MODIFIER_CTRL",r.CMD="MODIFIER_CMD",r.ALT="MODIFIER_ALT",r.OPTION="MODIFIER_OPTION",r.SHIFT="MODIFIER_SHIFT",r))(G||{}),V=(r=>(r.A="A",r.B="B",r.C="C",r.D="D",r.E="E",r.F="F",r.G="G",r.H="H",r.I="I",r.J="J",r.K="K",r.L="L",r.M="M",r.N="N",r.O="O",r.P="P",r.Q="Q",r.R="R",r.S="S",r.T="T",r.U="U",r.V="V",r.W="W",r.X="X",r.Y="Y",r.Z="Z",r.ZERO="0",r.ONE="1",r.TWO="2",r.THREE="3",r.FOUR="4",r.FIVE="5",r.SIX="6",r.SEVEN="7",r.EIGHT="8",r.NINE="9",r.BACKSPACE="Backspace",r.ESCAPE="Escape",r.ENTER="Enter",r.DELETE="Delete",r.SLASH="/",r.QUESTION_MARK="?",r.BACKSLASH="\\",r.PIPE="|",r.MINUS="-",r.UNDERSCORE="_",r.EQUALS="=",r.PLUS="+",r.BACKTICK="`",r.TILDE="~",r.COMMA=",",r.LEFT_CHEVRON="<",r.PERIOD=".",r.RIGHT_CHEVRON=">",r.SEMICOLON=";",r.COLON=":",r.SINGLE_QUOTE="'",r.DOUBLE_QUOTE='"',r.LEFT_BRACKET="[",r.RIGHT_BRACKET="]",r.LEFT_CURLY="{",r.RIGHT_CURLY="}",r.F1="F1",r.F2="F2",r.F3="F3",r.F4="F4",r.F5="F5",r.F6="F6",r.F7="F7",r.F8="F8",r.F9="F9",r.F10="F10",r.F11="F11",r.F12="F12",r))(V||{});const Kn=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),L=class extends Ct{constructor({id:e,shortcut:t,macShortcut:s,isEditable:i=!0,name:a,tooltip:o}){super();u(this,"id");u(this,"name");u(this,"tooltip");u(this,"isEditable");u(this,"defaultKeyState");u(this,"keyState");this.id=e,this.name=a,this.tooltip=o,this.isEditable=i;const c=L.isMacPlatform?s:t;this.defaultKeyState=L.createKeyState(c),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(V).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!L.isMacPlatform&&e.metaKey||!L.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Kn.has(t)}static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(s=>{switch(s){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:s}=e;let i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!L.isAllowedKey(t)&&L.isAllowedKey(String.fromCharCode(s))?i=String.fromCharCode(s):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case"Enter":t+="⏎";break;case"Escape":t+="⎋";break;case"Backspace":t+="⌫";break;case"Delete":t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var s,i;return((s=e.keyValue)==null?void 0:s.toUpperCase())===((i=t.keyValue)==null?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":L.isMacPlatform?L.getMacDisplayText(e):L.getWindowsDisplayText(e)}getDisplayText(){return L.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){L.isValidKeyState(e)?(Mt.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new vt("onUpdate",{detail:this}))):Mt.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return L.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(L.NULL_KEY_STATE)}isNull(){return L.doKeyStatesMatch(this.keyState,L.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return L.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(L.getKeyStateFromEvent(e))}};let ye=L;u(ye,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null}),u(ye,"isMacPlatform",O.isMacPlatform());const St=j.module("ShortcutRegistry");class Wn extends Ct{constructor(){super(...arguments);u(this,"shortcutMap",new Map);u(this,"shortcutsByCategory",new Map)}createAndAdd(e){const t=new ye(e);return this.add(t)}add(e){var i;const t=this.shortcutMap.get(e.id);if(t)return St.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;St.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:a})=>this.dispatchEvent(new vt("onUpdate",{detail:a})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(i=this.shortcutsByCategory.get(s))==null||i.push(e):this.shortcutsByCategory.set(s,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}const qn=Object.freeze(new Wn),fe=qn,Gn={COPY:fe.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[G.CTRL,V.C],macShortcut:[G.CMD,V.C],isEditable:!1}),PASTE:fe.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[G.CTRL,V.V],macShortcut:[G.CMD,V.V],isEditable:!1}),SAVE:fe.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[G.CTRL,V.S],macShortcut:[G.CMD,V.S],isEditable:!1}),SELECT_ALL:fe.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[G.CTRL,V.A],macShortcut:[G.CMD,V.A],isEditable:!1}),LINKER:fe.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[G.CTRL,V.L],macShortcut:[G.CMD,V.L]}),LINKER_CLOSE:fe.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[V.ESCAPE],macShortcut:[V.ESCAPE],isEditable:!1})},Ps=Gn;function Rt(){return _e(sn,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function zn(r,n){const e=Rt(),t=S.useMemo(()=>new e.CoreClient(r,n),[e,r,n]);return S.useEffect(()=>()=>{t.disconnect()},[t]),t}const Lt=S.createContext(null);function $s({serverUrl:r,options:n,children:e}){const t=zn(r,n);return h.jsx(Lt.Provider,{value:t,children:e})}function Qn(){return _e(Lt,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}const Zn=1e4;function js(r,n,e=Zn){return new Promise((t,s)=>{let i;const a=setTimeout(()=>{i==null||i(),s(new Je(`Variable ${n} not found`))},e);function o(l){const c=l.created.find(d=>d.title===n);c!=null&&(clearTimeout(a),i==null||i(),t(c))}i=r.subscribeToFieldUpdates(o)})}class Oe{static isValid(n){return!0}static isSameFormat(n,e){throw new Error("isSameFormat not implemented")}static makeFormat(n,e,t){return{label:n,formatString:e,type:t}}format(n,e){return""}}u(Oe,"TYPE_GLOBAL","type-global"),u(Oe,"TYPE_CONTEXT_PRESET","type-context-preset"),u(Oe,"TYPE_CONTEXT_CUSTOM","type-context-custom");const $=Oe;class Xn extends ${format(n){switch(n){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const _n=Xn;class Jn extends ${format(n){return String.fromCharCode(n)}}const Yn=Jn,{dh:es}=globalThis,ae=es,bt=j.module("DateTimeColumnFormatter"),ie=class extends ${constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:s=!1,defaultDateTimeFormatString:i=ie.DEFAULT_DATETIME_FORMAT_STRING}={}){super();u(this,"dhTimeZone");u(this,"defaultDateTimeFormatString");u(this,"showTimeZone");u(this,"showTSeparator");u(this,"formatStringMap");const a=e||ie.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=ae.i18n.TimeZone.getTimeZone(a)}catch{bt.error("Unsupported time zone id",a),this.dhTimeZone=ae.i18n.TimeZone.getTimeZone(ie.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=i,this.showTimeZone=t,this.showTSeparator=s,this.formatStringMap=ie.makeFormatStringMap(t,s)}static isValid(e){try{return ae.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,s=$.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:s}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const s=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${s}HH:mm:ss${i}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${s}HH:mm:ss.SSS${i}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${s}HH:mm:ss.SSSSSSSSS${i}`]])}static getGlobalFormats(e,t){return[...ie.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const s=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${i}`],["MM-dd-yyyy",`MM-dd-yyyy${i}`],["HH:mm:ss",`HH:mm:ss${i}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${i}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${i}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${s}HH:mm:ss${i}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${s}HH:mm:ss.SSS${i}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${s}HH:mm:ss.SSSSSSSSS${i}`]])}static getFormats(e,t){return[...ie.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){return this.formatStringMap.get(e)??e}format(e,t={}){const s=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(s);try{return ae.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{bt.error("Invalid format arguments")}return""}};let Ie=ie;u(Ie,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS"),u(Ie,"DEFAULT_TIME_ZONE_ID","America/New_York");const ts=j.module("DecimalColumnFormatter"),K=class extends ${constructor({defaultFormatString:e=K.DEFAULT_FORMAT_STRING}={}){super();u(this,"defaultFormatString");this.defaultFormatString=e}static isValid(e){try{return ae.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,s=$.TYPE_CONTEXT_PRESET,i){return{label:e,type:s,formatString:t,multiplier:i}}static makePresetFormat(e,t="",s){return K.makeFormat(e,t,$.TYPE_CONTEXT_PRESET,s)}static makeCustomFormat(e="",t){return K.makeFormat("Custom Format",e,$.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const s=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return ae.i18n.NumberFormat.format(s,i)}catch{ts.error("Invalid format arguments")}return""}};let z=K;u(z,"DEFAULT_FORMAT_STRING","###,##0.0000"),u(z,"FORMAT_PERCENT",K.makePresetFormat("Percent","##0.00%")),u(z,"FORMAT_BASIS_POINTS",K.makePresetFormat("Basis Points","###,##0 bp",1e4)),u(z,"FORMAT_MILLIONS",K.makePresetFormat("Millions","###,##0.000 mm",1e-6)),u(z,"FORMAT_SCIENTIFIC_NOTATION",K.makePresetFormat("Scientific Notation","0.0000E0")),u(z,"FORMAT_ROUND",K.makePresetFormat("Round","###,##0")),u(z,"FORMAT_ROUND_TWO_DECIMALS",K.makePresetFormat("0.00","###,##0.00")),u(z,"FORMAT_ROUND_FOUR_DECIMALS",K.makePresetFormat("0.0000","###,##0.0000"));class ns extends ${format(n){return`${n}`}}const ss=ns,is=j.module("IntegerColumnFormatter"),de=class extends ${constructor({defaultFormatString:e=de.DEFAULT_FORMAT_STRING}={}){super();u(this,"defaultFormatString");this.defaultFormatString=e}static isValid(e){try{return ae.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,s=$.TYPE_CONTEXT_PRESET,i){return{label:e,type:s,formatString:t,multiplier:i}}static makePresetFormat(e,t="",s){return de.makeFormat(e,t,$.TYPE_CONTEXT_PRESET,s)}static makeCustomFormat(e="",t){return de.makeFormat("Custom Format",e,$.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const s=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return ae.i18n.NumberFormat.format(s,i)}catch{is.error("Invalid format arguments")}return""}};let ge=de;u(ge,"DEFAULT_FORMAT_STRING","###,##0"),u(ge,"FORMAT_MILLIONS",de.makePresetFormat("Millions","###,##0.000 mm",1e-6)),u(ge,"FORMAT_SCIENTIFIC_NOTATION",de.makePresetFormat("Scientific Notation","0.0000E0"));class as extends ${format(n){return n}}const U=class{static makeDateWrapper(n,e,t,s=0,i=1,a=0,o=0,l=0,c=0){if(!e)throw new Error("No timezone provided");const d=`${t}`.padStart(4,"0"),p=`${s+1}`.padStart(2,"0"),f=`${i}`.padStart(2,"0"),b=`${a}`.padStart(2,"0"),w=`${o}`.padStart(2,"0"),D=`${l}`.padStart(2,"0"),A=`${c}`.padStart(9,"0"),I=`${d}-${p}-${f} ${b}:${w}:${D}.${A}`;return n.i18n.DateTimeFormat.parse(U.FULL_DATE_FORMAT,I,n.i18n.TimeZone.getTimeZone(e))}static getNextNanos(n){const e=parseInt(n,10),t="0".repeat(9-n.length),s=`${e+1}${t}`;return parseInt(s,10)}static getNextDate(n,e,t,s){let{year:i,month:a,date:o,hours:l,minutes:c,seconds:d,nanos:p}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;p=U.getNextNanos(e.nanos),p>999999999&&(d+=1,p=0)}else e.seconds!=null?d+=1:e.minutes!=null?c+=1:e.hours!=null?l+=1:e.date!=null?o+=1:e.month!=null?a+=1:i+=1;const f=new Date(i,a,o,l,c,d);return U.makeDateWrapper(n,s,f.getFullYear(),f.getMonth(),f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),p)}static parseMonth(n){const e=parseInt(n,10);if(!Number.isNaN(e))return e>=1&&e<=12?e-1:NaN;const t=n.trim().toLowerCase();if(t.length>=3){for(let s=0;s<U.months.length;s+=1)if(U.months[s].startsWith(t))return s}return NaN}static parseDateValues(n,e,t,s,i,a,o){const l=parseInt(n,10),c=e!=null?this.parseMonth(e):0,d=t!=null?parseInt(t,10):1,p=s!=null?parseInt(s,10):0,f=i!=null?parseInt(i,10):0,b=a!=null?parseInt(a,10):0,w=o!=null?parseInt(o.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(p)||Number.isNaN(f)||Number.isNaN(b)||Number.isNaN(w)?null:{year:l,month:c,date:d,hours:p,minutes:f,seconds:b,nanos:w}}static parseDateTimeString(n){const t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(n);if(t==null)throw new Error(`Unexpected date string: ${n}`);const[,s,,i,,a,,o,,l,,c,,d,p]=t;if(p!=null&&p.length>0)throw new Error(`Unexpected characters after date string '${n}': ${p}`);return{year:s,month:i,date:a,hours:o,minutes:l,seconds:c,nanos:d}}static parseDateRange(n,e,t){const s=e.trim().toLowerCase();if(s.length===0)throw new Error("Cannot parse date range from empty string");if(s==="null")return[null,null];if(s==="today"){const c=new Date(Date.now()),d=U.makeDateWrapper(n,t,c.getFullYear(),c.getMonth(),c.getDate()),p=U.makeDateWrapper(n,t,c.getFullYear(),c.getMonth(),c.getDate()+1);return[d,p]}if(s==="yesterday"){const c=new Date(Date.now()),d=U.makeDateWrapper(n,t,c.getFullYear(),c.getMonth(),c.getDate()-1),p=U.makeDateWrapper(n,t,c.getFullYear(),c.getMonth(),c.getDate());return[d,p]}if(s==="now"){const c=new Date(Date.now());return[n.DateWrapper.ofJsDate(c),null]}const i=U.parseDateTimeString(s);if(i.year==null&&i.month==null&&i.date==null)throw new Error(`Unable to extract year, month, or day ${s}`);const a=U.parseDateValues(i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos);if(a==null)throw new Error(`Unable to extract date values from ${i}`);const o=U.makeDateWrapper(n,t,a.year,a.month,a.date,a.hours,a.minutes,a.seconds,a.nanos),l=U.getNextDate(n,i,a,t);return[o,l]}static getJsDate(n){return typeof n=="number"?new Date(n):n.asDate()}};let Me=U;u(Me,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS"),u(Me,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);class ve{}u(ve,"not","not"),u(ve,"and","and"),u(ve,"or","or");function Us(r){if(!(r==="not"||r==="and"||r==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class g{}u(g,"eq","eq"),u(g,"eqIgnoreCase","eqIgnoreCase"),u(g,"notEq","notEq"),u(g,"notEqIgnoreCase","notEqIgnoreCase"),u(g,"greaterThan","greaterThan"),u(g,"greaterThanOrEqualTo","greaterThanOrEqualTo"),u(g,"lessThan","lessThan"),u(g,"lessThanOrEqualTo","lessThanOrEqualTo"),u(g,"in","in"),u(g,"inIgnoreCase","inIgnoreCase"),u(g,"notIn","notIn"),u(g,"notInIgnoreCase","notInIgnoreCase"),u(g,"isTrue","isTrue"),u(g,"isFalse","isFalse"),u(g,"isNull","isNull"),u(g,"invoke","invoke"),u(g,"contains","contains"),u(g,"notContains","notContains"),u(g,"startsWith","startsWith"),u(g,"endsWith","endsWith"),u(g,"containsAny","containsAny");const J=j.module("TableUtils"),m=class{constructor(n){u(this,"dh");this.dh=n}static async applyCustomColumns(n,e,t=m.APPLY_TABLE_CHANGE_TIMEOUT_MS){return m.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(e),n,dh.Table.EVENT_CUSTOMCOLUMNSCHANGED,t)}static async applyFilter(n,e,t=m.APPLY_TABLE_CHANGE_TIMEOUT_MS){return m.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(e),n,dh.Table.EVENT_FILTERCHANGED,t)}static async applyNeverFilter(n,e,t=m.APPLY_TABLE_CHANGE_TIMEOUT_MS){if(n==null)return null;const s=n.findColumn(e),i=[m.makeNeverFilter(s)];return await m.applyFilter(n,i,t),n}static async applySort(n,e,t=m.APPLY_TABLE_CHANGE_TIMEOUT_MS){return m.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(e),n,dh.Table.EVENT_SORTCHANGED,t)}static getSortIndex(n,e){var t;for(let s=0;s<n.length;s+=1)if(((t=n[s].column)==null?void 0:t.name)===e)return s;return null}static getSortForColumn(n,e){const t=m.getSortIndex(n,e);return t!=null?n[t]:null}static getFilterText(n){return n?n.toString():null}static getFilterTypes(n){return m.isBooleanType(n)?[g.isTrue,g.isFalse,g.isNull]:m.isCharType(n)||m.isNumberType(n)||m.isDateType(n)?[g.eq,g.notEq,g.greaterThan,g.greaterThanOrEqualTo,g.lessThan,g.lessThanOrEqualTo]:m.isTextType(n)?[g.eq,g.eqIgnoreCase,g.notEq,g.notEqIgnoreCase,g.contains,g.notContains,g.startsWith,g.endsWith]:[]}static getNextSort(n,e,t){if(t<0||t>=n.length)return null;const s=m.getSortForColumn(e,n[t].name);return s===null?n[t].sort().asc():s.direction===m.sortDirection.ascending?s.desc():null}static makeColumnSort(n,e,t,s){if(e<0||e>=n.length||t===m.sortDirection.none)return null;let i=n[e].sort();switch(t){case m.sortDirection.ascending:i=i.asc();break;case m.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(n,e,t,s=!1){if(t<0||t>=e.length)return[];const i=m.getNextSort(e,n,t);return m.setSortForColumn(n,e[t].name,i,s)}static sortColumn(n,e,t,s,i,a){if(t<0||t>=e.length)return[];const o=m.makeColumnSort(e,t,s,i);return m.setSortForColumn(n,e[t].name,o,a)}static setSortForColumn(n,e,t,s=!1){const i=m.getSortIndex(n,e);let a=[];return s&&(a=a.concat(n.filter(({direction:o})=>o!==m.sortDirection.reverse)),i!==null&&a.splice(i,1)),t!==null&&a.push(t),a}static getNormalizedType(n){switch(n){case"boolean":case"java.lang.Boolean":case m.dataType.BOOLEAN:return m.dataType.BOOLEAN;case"char":case"java.lang.Character":case m.dataType.CHAR:return m.dataType.CHAR;case"java.lang.String":case m.dataType.STRING:return m.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 m.dataType.DATETIME:return m.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case m.dataType.DECIMAL:return m.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 m.dataType.INT:return m.dataType.INT;default:return m.dataType.UNKNOWN}}static isLongType(n){switch(n){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(n){switch(n){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(n){return m.isIntegerType(n)||m.isDecimalType(n)}static isIntegerType(n){switch(n){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(n){switch(n){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(n){switch(n){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(n){switch(n){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(n){switch(n){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(n){switch(n){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(n){switch(n){case"java.lang.String":return!0;default:return!1}}static isTextType(n){return this.isStringType(n)||this.isCharType(n)}static getBaseType(n){return n.split("[]")[0]}static isCompatibleType(n,e){return m.getNormalizedType(n)===m.getNormalizedType(e)}static quoteValue(n){return n.length>=2&&(n.charAt(0)==='"'&&n.charAt(n.length-1)==='"'||n.charAt(0)==="'"&&n.charAt(n.length-1)==="'")?n:`"${n}"`}static isRangeOperation(n){switch(n){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(n,e,t){switch(e){case"=":return n.eq(t);case"<":return n.lessThan(t);case"<=":case"=<":return n.lessThanOrEqualTo(t);case">":return n.greaterThan(t);case">=":case"=>":return n.greaterThanOrEqualTo(t);case"!=":case"!":return n.notEq(t);default:return null}}static makeCancelableTablePromise(n){return ze.makeCancelable(n,e=>{e.close()})}static makeCancelableTableEventPromise(n,e,t=0,s=null){let i,a,o=!0;const l=new Promise((c,d)=>{a=setTimeout(()=>{i(),o=!1,d(new Je(`Event "${e}" timed out.`))},t),i=n.addEventListener(e,p=>{if(s!=null&&!s(p)){J.debug2("Event triggered, but matcher returned false.");return}J.debug2("Event triggered, resolving."),i(),clearTimeout(a),o=!1,c(p)})});return l.cancel=()=>{if(o){J.debug2("Pending promise cleanup."),i(),clearTimeout(a),o=!1;return}J.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(n){return n.replace(/[\s|,]/g,"")}static makeBooleanValue(n,e=!1){if(n===""&&e)return null;switch(n==null?void 0:n.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 '${n}'`)}}static makeNumberValue(n){if(n==="null"||n==="")return null;const e=n.toLowerCase().trim();if(e==="∞"||e==="infinity"||e==="inf")return Number.POSITIVE_INFINITY;if(e==="-∞"||e==="-infinity"||e==="-inf")return Number.NEGATIVE_INFINITY;const t=m.removeCommas(e);if(m.NUMBER_REGEX.test(t))return parseFloat(t);throw new Error(`Invalid number '${n}'`)}static getFilterOperatorString(n){switch(n){case g.eq:return"=";case g.notEq:return"!=";case g.greaterThan:return">";case g.greaterThanOrEqualTo:return">=";case g.lessThan:return"<";case g.lessThanOrEqualTo:return"<=";case g.contains:return"~";case g.notContains:return"!~";default:throw new Error(`Unexpected filter type ${n}`)}}static isTreeTable(n){return n!=null&&n.expand!==void 0&&n.collapse!==void 0}static sortColumns(n,e=!0){return[...n].sort((t,s)=>{const i=t.name.toUpperCase(),a=s.name.toUpperCase();return gn.sort(i,a,e)})}makeQuickFilter(n,e,t){const s=e.split("||");let i=null;for(let a=0;a<s.length;a+=1){const l=s[a].split("&&");let c=null;for(let d=0;d<l.length;d+=1){const p=l[d].trim();if(p.length>0){const f=this.makeQuickFilterFromComponent(n,p,t);if(f)c?c=c.and(f):c=f;else throw new Error(`Unable to parse quick filter from text ${e}`)}}i&&c?i=i.or(c):i=c}return i}makeQuickFilterFromComponent(n,e,t){const{type:s}=n;return m.isNumberType(s)?this.makeQuickNumberFilter(n,e):m.isBooleanType(s)?this.makeQuickBooleanFilter(n,e):t!=null&&m.isDateType(s)?this.makeQuickDateFilter(n,e,t):m.isCharType(s)?this.makeQuickCharFilter(n,e):this.makeQuickTextFilter(n,e)}makeQuickNumberFilter(n,e){const t=n.filter(),{dh:s}=this;let i=null;const o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(e);let l=null,c=null,d=null,p=null,f=null;if(o!==null&&o.length>3&&([,l,c,d,p,f]=o),f!=null&&f.trim().length>0)return null;if(l==null&&(l="="),p!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(p=p.trim().toLowerCase(),p){case"null":i=t.isNull();break;case"nan":i=s.FilterCondition.invoke("isNaN",t);break;case"infinity":case"inf":case"∞":c!=null?i=s.FilterCondition.invoke("isInf",t).and(t.lessThan(s.FilterValue.ofNumber(0))):i=s.FilterCondition.invoke("isInf",t).and(t.greaterThan(s.FilterValue.ofNumber(0)));break}return i!==null&&(l==="!"||l==="!=")&&(i=i.not()),i}if(d==null)return null;if(d=m.removeCommas(d),m.isLongType(n.type))try{d=s.FilterValue.ofNumber(s.LongWrapper.ofString(`${c!=null?"-":""}${d}`))}catch(b){return J.warn("Unable to create long filter",b),null}else{if(d=parseFloat(d),d==null||Number.isNaN(d))return null;d=s.FilterValue.ofNumber(c!=null?0-d:d)}return i=n.filter(),m.makeRangeFilterWithOperation(i,l,d)}makeQuickTextFilter(n,e){const{dh:t}=this,s=`${e}`.trim(),a=/^(!~|!=|~|=|!)?(.*)/.exec(s);let o=null,l=null;if(a!==null&&a.length>2&&([,o,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0)return null;o==null&&(o="=");const c=n.filter();if(l.toLowerCase()==="null")switch(o){case"=":return c.isNull();case"!=":case"!":return c.isNull().not()}let d=null,p=null;switch(l.startsWith("*")?(d="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(p="*",l=l.substring(0,l.length-1)),l=l.replace("\\",""),o){case"~":return c.isNull().not().and(c.invoke("matches",t.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E.*`)));case"!~":return c.isNull().or(c.invoke("matches",t.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E.*`)).not());case"!=":return d==="*"?c.isNull().or(c.invoke("matches",t.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E$`)).not()):p==="*"?c.isNull().or(c.invoke("matches",t.FilterValue.ofString(`(?s)(?i)^\\Q${l}\\E.*`)).not()):c.notEqIgnoreCase(t.FilterValue.ofString(l.toLowerCase()));case"=":return d==="*"?c.isNull().not().and(c.invoke("matches",t.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E$`))):p==="*"?c.isNull().not().and(c.invoke("matches",t.FilterValue.ofString(`(?s)(?i)^\\Q${l}\\E.*`))):c.eqIgnoreCase(t.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(n,e){const s=/^(!=|=|!)?(.*)/.exec(`${e}`.trim());if(s===null)return null;const[,i,a]=s,o=i==="!"||i==="!=",l=a.trim().toLowerCase();let c=n.filter();try{const d=m.makeBooleanValue(l);return d!=null&&d?c=c.isTrue():d===null?c=c.isNull():c=c.isFalse(),o?c.not():c}catch{return null}}makeQuickDateFilter(n,e,t){const s=e.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(a==null||a.length<=2)throw new Error(`Unable to parse date filter: ${e}`);let o=null,l=null;[,o,l]=a;let c=g.eq;switch(o){case"<":c=g.lessThan;break;case"<=":case"=<":c=g.lessThanOrEqualTo;break;case">":c=g.greaterThan;break;case">=":case"=>":c=g.greaterThanOrEqualTo;break;case"!=":case"!":c=g.notEq;break;case"=":case"==":default:c=g.eq;break}return this.makeQuickDateFilterWithOperation(n,l,c,t)}makeQuickDateFilterWithOperation(n,e,t,s){const{dh:i}=this,[a,o]=Me.parseDateRange(i,e,s),l=a!=null?i.FilterValue.ofNumber(a):null,c=o!=null?i.FilterValue.ofNumber(o):null,d=n.filter();if(l==null)return t===g.notEq?d.isNull().not():d.isNull();switch(t){case g.eq:{if(c!=null){const p=d.greaterThanOrEqualTo(l),f=d.lessThan(c);return p.and(f)}return d.eq(l)}case g.lessThan:return d.lessThan(l);case g.lessThanOrEqualTo:return c!=null?d.lessThan(c):d.lessThanOrEqualTo(l);case g.greaterThan:return c!=null?d.greaterThanOrEqualTo(c):d.greaterThan(l);case g.greaterThanOrEqualTo:return d.greaterThanOrEqualTo(l);case g.notEq:{if(c!=null){const p=d.lessThan(l),f=d.greaterThanOrEqualTo(c);return p.or(f)}return d.notEq(l)}default:throw new Error(`Invalid operator: ${t}`)}}makeQuickCharFilter(n,e){const{dh:t}=this,s=`${e}`.trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(s);let o=null,l=null,c=null;if(a!==null&&a.length>3&&([,o,l,c]=a),c!=null&&c.trim().length>0||l==null||l.length===0)return null;o==null&&(o="=");const d=n.filter();if(l.toLowerCase()==="null")switch(o){case"=":return d.isNull();case"!=":case"!":return d.isNull().not();default:return null}const p=t.FilterValue.ofString(m.isRangeOperation(o)?m.quoteValue(l):l);return m.makeRangeFilterWithOperation(d,o,p)}makeAdvancedFilter(n,e,t){const{filterItems:s,filterOperators:i,invertSelection:a,selectedValues:o}=e;let l=null;for(let d=0;d<s.length;d+=1){const p=s[d],{selectedType:f,value:b}=p;if(f!=null&&f.length>0&&b!=null&&b.length>0)try{const w=this.makeAdvancedValueFilter(n,f,b,t);if(w!=null){if(d===0)l=w;else if(l!==null&&d-1<i.length){const D=i[d-1];if(D===ve.and)l=l.and(w);else if(D===ve.or)l=l.or(w);else{J.error("Unexpected filter operator",D,w),l=null;break}}}else J.debug2("Empty filter ignored for",f,b)}catch(w){J.error("Unable to create filter",w),l=null;break}}const c=this.makeSelectValueFilter(n,o,a);return c!=null&&(l!=null?l=l.and(c):l=c),l}makeAdvancedValueFilter(n,e,t,s){if(m.isDateType(n.type))return this.makeQuickDateFilterWithOperation(n,t,e,s);if(m.isNumberType(n.type)||m.isCharType(n.type))return this.makeQuickFilter(n,`${m.getFilterOperatorString(e)}${t}`);const i=this.makeFilterValue(n.type,t),a=n.filter();switch(e){case g.eq:return a.eq(i);case g.eqIgnoreCase:return a.eqIgnoreCase(i);case g.notEq:return a.notEq(i);case g.notEqIgnoreCase:return a.notEqIgnoreCase(i);case g.greaterThan:return a.greaterThan(i);case g.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(i);case g.lessThan:return a.lessThan(i);case g.lessThanOrEqualTo:return a.lessThanOrEqualTo(i);case g.isTrue:return a.isTrue();case g.isFalse:return a.isFalse();case g.isNull:return a.isNull();case g.contains:return a.isNull().not().and(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i).*\\Q${t}\\E.*`)));case g.notContains:return a.isNull().or(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i).*\\Q${t}\\E.*`)).not());case g.startsWith:return a.isNull().not().and(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i)^\\Q${t}\\E.*`)));case g.endsWith:return a.isNull().not().and(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i).*\\Q${t}\\E$`)));case g.in:case g.inIgnoreCase:case g.notIn:case g.notInIgnoreCase:case g.invoke:default:throw new Error(`Unexpected filter operation: ${e}`)}}static makeNeverFilter(n){let e=null;m.isTextType(n.type)?e=dh.FilterValue.ofString("a"):m.isBooleanType(n.type)?e=dh.FilterValue.ofBoolean(!0):m.isDateType(n.type)?e=dh.FilterValue.ofNumber(dh.DateWrapper.ofJsDate(new Date)):e=dh.FilterValue.ofNumber(0);const t=n.filter().eq(e),s=n.filter().notEq(e);return t.and(s)}makeFilterValue(n,e){const{dh:t}=this,s=m.getBaseType(n);return m.isTextType(s)?t.FilterValue.ofString(e):m.isLongType(s)?t.FilterValue.ofNumber(t.LongWrapper.ofString(m.removeCommas(e))):t.FilterValue.ofNumber(m.removeCommas(e))}makeFilterRawValue(n,e){const{dh:t}=this;return m.isTextType(n)?t.FilterValue.ofString(e):m.isBooleanType(n)?t.FilterValue.ofBoolean(e):t.FilterValue.ofNumber(e)}makeValue(n,e,t){const{dh:s}=this;if(e==="null")return null;if(m.isTextType(n))return e;if(m.isLongType(n))return s.LongWrapper.ofString(m.removeCommas(e));if(m.isBooleanType(n))return m.makeBooleanValue(e,!0);if(m.isDateType(n)){const[i]=Me.parseDateRange(s,e,t);return i}return m.isNumberType(n)?m.makeNumberValue(e):(J.error("Unexpected column type",n),null)}makeSelectValueFilter(n,e,t){const{dh:s}=this;if(e.length===0)return t?null:m.makeNeverFilter(n);const i=[];let a=!1;for(let o=0;o<e.length;o+=1){const l=e[o];l==null?a=!0:m.isTextType(n.type)?i.push(s.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):m.isBooleanType(n.type)?i.push(s.FilterValue.ofBoolean(Boolean(l))):i.push(s.FilterValue.ofNumber(l))}return a?i.length>0?t?n.filter().isNull().not().and(n.filter().notIn(i)):n.filter().isNull().or(n.filter().in(i)):t?n.filter().isNull().not():n.filter().isNull():t?n.filter().notIn(i):n.filter().in(i)}};let P=m;u(P,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"}),u(P,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null}),u(P,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4),u(P,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"})),u(P,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/),u(P,"executeAndWaitForEvent",async(n,e,t,s=m.APPLY_TABLE_CHANGE_TIMEOUT_MS)=>{if(e==null)return null;const i=m.makeCancelableTableEventPromise(e,t,s);return n(e),await i,e});class Pt{constructor(n=[],e,t,s,i=!1){u(this,"defaultColumnFormatter");u(this,"typeFormatterMap");u(this,"columnFormatMap");u(this,"truncateNumbersWithPound");this.defaultColumnFormatter=new ss,this.typeFormatterMap=new Map([[P.dataType.BOOLEAN,new _n],[P.dataType.CHAR,new Yn],[P.dataType.DATETIME,new Ie(e)],[P.dataType.DECIMAL,new z(t)],[P.dataType.INT,new ge(s)],[P.dataType.STRING,new as]]),this.columnFormatMap=Pt.makeColumnFormatMap(n),this.truncateNumbersWithPound=i}static makeColumnFormatMap(n){return n==null?new Map:n.reduce((e,t)=>{const s=P.getNormalizedType(t.columnType);if(s===null)return e;e.has(s)||e.set(s,new Map);const i=e.get(s);return i==null||i.set(t.columnName,t.format),e},new Map)}static makeColumnFormattingRule(n,e,t){return{columnType:n,columnName:e,format:t}}getColumnFormatMapForType(n,e=!1){const t=P.getNormalizedType(n);if(t!==null)return e&&!this.columnFormatMap.has(t)&&this.columnFormatMap.set(t,new Map),this.columnFormatMap.get(t)}getColumnFormat(n,e){const t=this.getColumnFormatMapForType(n);return(t==null?void 0:t.get(e))??null}getColumnTypeFormatter(n){const e=P.getNormalizedType(n);let t=this.defaultColumnFormatter;return e&&(t=this.typeFormatterMap.get(e)??t),t}getFormattedString(n,e,t="",s){if(n==null)return"";const i=this.getColumnTypeFormatter(e),a=s||this.getColumnFormat(e,t);return i.format(n,a??void 0)}get timeZone(){var e;const n=this.typeFormatterMap.get(P.dataType.DATETIME);return(e=n==null?void 0:n.dhTimeZone)==null?void 0:e.id}}function os(r){if(r&&r.formatter){const{formatter:n}=r;return n}}function rs(r){return{timeZone:r==null?void 0:r.timeZone,defaultDateTimeFormatString:r==null?void 0:r.defaultDateTimeFormat,showTimeZone:r==null?void 0:r.showTimeZone,showTSeparator:r==null?void 0:r.showTSeparator}}function ls(r,n,e){const t=r.getColumnFormat(e,n);return t!=null&&(t.type===$.TYPE_CONTEXT_PRESET||t.type===$.TYPE_CONTEXT_CUSTOM)}const Vs={getColumnFormats:os,getDateTimeFormatterOptions:rs,isCustomColumnFormatDefined:ls},cs=j.module("@deephaven/jsapi-components.ConnectionBootstrap"),$t=S.createContext(null);function Bs({children:r}){const n=Rt(),e=Qn(),[t,s]=S.useState(),[i,a]=S.useState();return S.useEffect(function(){let l=!1;async function c(){try{const d=await e.getAsIdeConnection();if(l)return;a(d)}catch(d){if(l)return;s(d)}}return c(),()=>{l=!0}},[n,e]),S.useEffect(function(){if(i==null)return;function l(d){const{detail:p}=d;cs.info("Shutdown",`${JSON.stringify(p)}`),s(`Server shutdown: ${p??"Unknown reason"}`)}return i.addEventListener(n.IdeConnection.EVENT_SHUTDOWN,l)},[n,i]),i==null||t!=null?h.jsx(an,{"data-testid":"connection-bootstrap-loading",isLoading:i==null,errorMessage:t!=null?`${t}`:void 0}):h.jsx($t.Provider,{value:i,children:r})}function Hs(){return _e($t,"No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?")}export{bn as $,vs as A,Ge as B,rt as C,Me as D,ps as E,Vs as F,Ps as G,Ns as H,ge as I,Ts as J,V as K,Es as L,G as M,Pt as N,ve as O,ze as P,Fs as Q,ks as R,fe as S,g as T,Ds as U,vt as V,ae as W,Hs as X,Cs as Y,js as Z,_e as _,gs as a,It as a0,Dn as a1,Dt as a2,kn as a3,te as a4,wt as a5,Vn as a6,Hn as a7,ye as a8,Bn as a9,Nn as aa,dt as ab,$s as ac,Lt as ad,Rt as ae,Qn as af,Je as ag,_n as ah,Yn as ai,ss as aj,Zn as ak,as as al,os as am,rs as an,ls as ao,fs as ap,Bs as aq,$t as ar,P as b,ms as c,pn as d,O as e,yt as f,Ms as g,$ as h,Ie as i,z as j,bs as k,ys as l,Ls as m,Us as n,xs as o,ws as p,Rs as q,As as r,Os as s,wn as t,dn as u,ne as v,xn as w,Ss as x,gn as y,Xe as z};
3
+ //# sourceMappingURL=useConnection-7dcdf123.js.map