/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@highcharts/dashboards@4.1.0/dashboards.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!/**
 * Highcharts Dashboards v4.1.0 (2026-01-21)
 * @module dashboards/dashboards
 *
 * (c) 2009-2026 Highsoft AS
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */function(e,t){"object"==typeof exports&&"object"==typeof module?(e._Dashboards=t(),module.exports=e._Dashboards):"function"==typeof define&&define.amd?define("dashboards/dashboards",[],t):"object"==typeof exports?(e._Dashboards=t(),exports["dashboards/dashboards"]=e._Dashboards):(e.Dashboards&&e.Dashboards.error(16,!0),e.Dashboards=t())}("u"<typeof window?this:window,()=>(()=>{"use strict";let e,t,i;var n,s,o={};o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r={};o.d(r,{default:()=>s4}),(n=s||(s={})).SVG_NS="http://www.w3.org/2000/svg",n.product="Highcharts",n.version="4.1.0",n.win="u">typeof window?window:{},n.doc=n.win.document,n.svg=!!n.doc?.createElementNS?.(n.SVG_NS,"svg")?.createSVGRect,n.pageLang=n.doc?.documentElement?.closest("[lang]")?.lang,n.userAgent=n.win.navigator?.userAgent||"",n.isChrome=n.win.chrome,n.isFirefox=-1!==n.userAgent.indexOf("Firefox"),n.isMS=/(edge|msie|trident)/i.test(n.userAgent)&&!n.win.opera,n.isSafari=!n.isChrome&&-1!==n.userAgent.indexOf("Safari"),n.isTouchDevice=/(Mobile|Android|Windows Phone)/.test(n.userAgent),n.isWebKit=-1!==n.userAgent.indexOf("AppleWebKit"),n.deg2rad=2*Math.PI/360,n.marginNames=["plotTop","marginRight","marginBottom","plotLeft"],n.noop=function(){},n.supportsPassiveEvents=function(){let e=!1;if(!n.isMS){let t=Object.defineProperty({},"passive",{get:function(){e=!0}});n.win.addEventListener&&n.win.removeEventListener&&(n.win.addEventListener("testPassive",n.noop,t),n.win.removeEventListener("testPassive",n.noop,t))}return e}(),n.charts=[],n.composed=[],n.dateFormats={},n.seriesTypes={},n.symbolSizes={},n.chartCount=0;let a=s,{charts:l,doc:h,win:c}=a;function d(e,t,i,n){let s=t?"Highcharts error":"Highcharts warning";32===e&&(e=`${s}: Deprecated member`);let o=b(e),r=o?`${s} #${e}: www.highcharts.com/errors/${e}/`:e.toString();if(void 0!==n){let e="";o&&(r+="?"),S(n,function(t,i){e+=`
 - ${i}: ${t}`,o&&(r+=encodeURI(i)+"="+encodeURI(t))}),r+=e}A(a,"displayError",{chart:i,code:e,message:r,params:n},function(){if(t)throw Error(r);c.console&&-1===d.messages.indexOf(r)&&console.warn(r)}),d.messages.push(r)}function u(e,t){return parseInt(e,t||10)}function p(e){return"string"==typeof e}function m(e){let t=Object.prototype.toString.call(e);return"[object Array]"===t||"[object Array Iterator]"===t}function f(e,t){return!!e&&"object"==typeof e&&(!t||!m(e))}function g(e){return f(e)&&"number"==typeof e.nodeType}function y(e){let t=e?.constructor;return!!(f(e,!0)&&!g(e)&&t?.name&&"Object"!==t.name)}function b(e){return"number"==typeof e&&!isNaN(e)&&e<1/0&&e>-1/0}function C(e){return null!=e}function w(e,t,i){let n,s=p(t)&&!C(i),o=(t,i)=>{C(t)?e.setAttribute(i,t):s?(n=e.getAttribute(i))||"class"!==i||(n=e.getAttribute(i+"Name")):e.removeAttribute(i)};return p(t)?o(i,t):S(t,o),n}function v(e){return m(e)?e:[e]}function O(e,t){let i;for(i in e||(e={}),t)e[i]=t[i];return e}function x(){let e=arguments,t=e.length;for(let i=0;i<t;i++){let t=e[i];if(null!=t)return t}}function T(e,t){O(e.style,t)}function E(e){return Math.pow(10,Math.floor(Math.log(e)/Math.LN10))}function N(e,t){return e>1e14?e:parseFloat(e.toPrecision(t||14))}(d||(d={})).messages=[],Math.easeInOutSine=function(e){return -.5*(Math.cos(Math.PI*e)-1)};let M=Array.prototype.find?function(e,t){return e.find(t)}:function(e,t){let i,n=e.length;for(i=0;i<n;i++)if(t(e[i],i))return e[i]};function S(e,t,i){for(let n in e)Object.hasOwnProperty.call(e,n)&&t.call(i||e[n],e[n],n,e)}function R(e,t,i){function n(t,i){let n=e.removeEventListener;n&&n.call(e,t,i,!1)}function s(i){let s,o;e.nodeName&&(t?(s={})[t]=!0:s=i,S(s,function(e,t){if(i[t])for(o=i[t].length;o--;)n(t,i[t][o].fn)}))}let o="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(o,"hcEvents")){let e=o.hcEvents;if(t){let o=e[t]||[];i?(e[t]=o.filter(function(e){return i!==e.fn}),n(t,i)):(s(e),e[t]=[])}else s(e),delete o.hcEvents}}function A(e,t,i,n){if(i=i||{},h?.createEvent&&(e.dispatchEvent||e.fireEvent&&e!==a)){let n=h.createEvent("Events");n.initEvent(t,!0,!0),i=O(n,i),e.dispatchEvent?e.dispatchEvent(i):e.fireEvent(t,i)}else if(e.hcEvents){i.target||O(i,{preventDefault:function(){i.defaultPrevented=!0},target:e,type:t});let n=[],s=e,o=!1;for(;s.hcEvents;)Object.hasOwnProperty.call(s,"hcEvents")&&s.hcEvents[t]&&(n.length&&(o=!0),n.unshift.apply(n,s.hcEvents[t])),s=Object.getPrototypeOf(s);o&&n.sort((e,t)=>e.order-t.order),n.forEach(t=>{!1===t.fn.call(e,i)&&i.preventDefault()})}n&&!i.defaultPrevented&&n.call(e,i)}let P=(t=Math.random().toString(36).substring(2,9)+"-",i=0,function(){return"highcharts-"+(e?"":t)+i++});c.jQuery&&(c.jQuery.fn.highcharts=function(){let e=[].slice.call(arguments);if(this[0])return e[0]?(new a[p(e[0])?e.shift():"Chart"](this[0],e[0],e[1]),this):l[w(this[0],"data-highcharts-chart")]});let I={addEvent:function(e,t,i,n={}){let s="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let o=s.hcEvents;a.Point&&e instanceof a.Point&&e.series&&e.series.chart&&(e.series.chart.runTrackerClick=!0);let r=e.addEventListener;r&&r.call(e,t,i,!!a.supportsPassiveEvents&&{passive:void 0===n.passive?-1!==t.indexOf("touch"):n.passive,capture:!1}),o[t]||(o[t]=[]);let l={fn:i,order:"number"==typeof n.order?n.order:1/0};return o[t].push(l),o[t].sort((e,t)=>e.order-t.order),function(){R(e,t,i)}},arrayMax:function(e){let t=e.length,i=e[0];for(;t--;)e[t]>i&&(i=e[t]);return i},arrayMin:function(e){let t=e.length,i=e[0];for(;t--;)e[t]<i&&(i=e[t]);return i},attr:w,clamp:function(e,t,i){return e>t?e<i?e:i:t},clearTimeout:function(e){C(e)&&clearTimeout(e)},correctFloat:N,createElement:function(e,t,i,n,s){let o=h.createElement(e);return t&&O(o,t),s&&T(o,{padding:"0",border:"none",margin:"0"}),i&&T(o,i),n&&n.appendChild(o),o},crisp:function(e,t=0,i){let n=t%2/2,s=i?-1:1;return(Math.round(e*s-n)+n)*s},css:T,defined:C,destroyObjectProperties:function(e,t,i){S(e,function(n,s){n!==t&&n?.destroy&&n.destroy(),(n?.destroy||!i)&&delete e[s]})},diffObjects:function(e,t,i,n){let s={};return!function e(t,s,o,r){let a=i?s:t;S(t,function(i,l){if(!r&&n&&n.indexOf(l)>-1&&s[l]){i=v(i),o[l]=[];for(let t=0;t<Math.max(i.length,s[l].length);t++)s[l][t]&&(void 0===i[t]?o[l][t]=s[l][t]:(o[l][t]={},e(i[t],s[l][t],o[l][t],r+1)))}else f(i,!0)&&!i.nodeType?(o[l]=m(i)?[]:{},e(i,s[l]||{},o[l],r+1),0===Object.keys(o[l]).length&&("colorAxis"!==l||0!==r)&&delete o[l]):(t[l]!==s[l]||l in t&&!(l in s))&&"__proto__"!==l&&"constructor"!==l&&(o[l]=a[l])})}(e,t,s,0),s},discardElement:function(e){e?.parentElement?.removeChild(e)},erase:function(e,t){let i=e.length;for(;i--;)if(e[i]===t){e.splice(i,1);break}},error:d,extend:O,extendClass:function(e,t){let i=function(){};return i.prototype=new e,O(i.prototype,t),i},find:M,fireEvent:A,getAlignFactor:(e="")=>({center:.5,right:1,middle:.5,bottom:1})[e]||0,getClosestDistance:function(e,t){let i,n,s,o,r=!t;return e.forEach(e=>{if(e.length>1)for(o=n=e.length-1;o>0;o--)(s=e[o]-e[o-1])<0&&!r?(t?.(),t=void 0):s&&(void 0===i||s<i)&&(i=s)}),i},getMagnitude:E,getNestedProperty:function(e,t){let i=e.split(".");for(;i.length&&C(t);){let e=i.shift();if(void 0===e||"__proto__"===e)return;if("this"===e){let e;return f(t)&&(e=t["@this"]),e??t}let n=t[e.replace(/[\\'"]/g,"")];if(!C(n)||"function"==typeof n||"number"==typeof n.nodeType||n===c)return;t=n}return t},getStyle:function e(t,i,n){let s;if("width"===i){let i=Math.min(t.offsetWidth,t.scrollWidth),n=t.getBoundingClientRect?.().width;return n<i&&n>=i-1&&(i=Math.floor(n)),Math.max(0,i-(e(t,"padding-left",!0)||0)-(e(t,"padding-right",!0)||0))}if("height"===i)return Math.max(0,Math.min(t.offsetHeight,t.scrollHeight)-(e(t,"padding-top",!0)||0)-(e(t,"padding-bottom",!0)||0));let o=c.getComputedStyle(t,void 0);return o&&(s=o.getPropertyValue(i),x(n,"opacity"!==i)&&(s=u(s))),s},insertItem:function(e,t){let i,n=e.options.index,s=t.length;for(i=e.options.isInternal?s:0;i<s+1;i++)if(!t[i]||b(n)&&n<x(t[i].options.index,t[i]._i)||t[i].options.isInternal){t.splice(i,0,e);break}return i},isArray:m,isClass:y,isDOMElement:g,isFunction:function(e){return"function"==typeof e},isNumber:b,isObject:f,isString:p,merge:function(e,...t){let i,n=[e,...t],s={},o=function(e,t){return"object"!=typeof e&&(e={}),S(t,function(i,n){"__proto__"!==n&&"constructor"!==n&&(!f(i,!0)||y(i)||g(i)?e[n]=t[n]:e[n]=o(e[n]||{},i))}),e};!0===e&&(s=n[1],n=Array.prototype.slice.call(n,2));let r=n.length;for(i=0;i<r;i++)s=o(s,n[i]);return s},normalizeTickInterval:function(e,t,i,n,s){let o,r=e;i=x(i,E(e));let a=e/i;for(!t&&(t=s?[1,1.2,1.5,2,2.5,3,4,5,6,8,10]:[1,2,2.5,5,10],!1===n&&(1===i?t=t.filter(function(e){return e%1==0}):i<=.1&&(t=[1/i]))),o=0;o<t.length&&(r=t[o],(!s||!(r*i>=e))&&(s||!(a<=(t[o]+(t[o+1]||t[o]))/2)));o++);return N(r*i,-Math.round(Math.log(.001)/Math.LN10))},objectEach:S,offset:function(e){let t=h.documentElement,i=e.parentElement||e.parentNode?e.getBoundingClientRect():{top:0,left:0,width:0,height:0};return{top:i.top+(c.pageYOffset||t.scrollTop)-(t.clientTop||0),left:i.left+(c.pageXOffset||t.scrollLeft)-(t.clientLeft||0),width:i.width,height:i.height}},pad:function(e,t,i){return Array((t||2)+1-String(e).replace("-","").length).join(i||"0")+e},pick:x,pInt:u,pushUnique:function(e,t){return 0>e.indexOf(t)&&!!e.push(t)},relativeLength:function(e,t,i){return/%$/.test(e)?t*parseFloat(e)/100+(i||0):parseFloat(e)},removeEvent:R,replaceNested:function(e,...t){let i,n;do for(n of(i=e,t))e=e.replace(n[0],n[1]);while(e!==i);return e},splat:v,stableSort:function(e,t){let i,n,s=e.length;for(n=0;n<s;n++)e[n].safeI=n;for(e.sort(function(e,n){return 0===(i=t(e,n))?e.safeI-n.safeI:i}),n=0;n<s;n++)delete e[n].safeI},syncTimeout:function(e,t,i){return t>0?setTimeout(e,t,i):(e.call(0,i),-1)},timeUnits:{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:24192e5,year:314496e5},ucfirst:function(e){return p(e)?e.substring(0,1).toUpperCase()+e.substring(1):String(e)},uniqueKey:P,useSerialIds:function(t){return e=x(t,e)},wrap:function(e,t,i){let n=e[t];e[t]=function(){let e=arguments,t=this;return i.apply(this,[function(){return n.apply(t,arguments.length?arguments:e)}].concat([].slice.call(arguments)))}}},{SVG_NS:L,win:D}=a,{attr:k,createElement:H,css:j,error:F,isFunction:z,isString:V,objectEach:$,splat:B}=I,{trustedTypes:U}=D,Y=U&&z(U.createPolicy)&&U.createPolicy("highcharts",{createHTML:e=>e}),_=Y?Y.createHTML(""):"";class G{static filterUserAttributes(e){return $(e,(t,i)=>{let n=!0;-1===G.allowedAttributes.indexOf(i)&&(n=!1),-1!==["background","dynsrc","href","lowsrc","src"].indexOf(i)&&(n=V(t)&&G.allowedReferences.some(e=>0===t.indexOf(e))),n||(F(33,!1,void 0,{"Invalid attribute in config":`${i}`}),delete e[i]),V(t)&&e[i]&&(e[i]=t.replace(/</g,"&lt;"))}),e}static parseStyle(e){return e.split(";").reduce((e,t)=>{let i=t.split(":").map(e=>e.trim()),n=i.shift();return n&&i.length&&(e[n.replace(/-([a-z])/g,e=>e[1].toUpperCase())]=i.join(":")),e},{})}static setElementHTML(e,t){e.innerHTML=G.emptyHTML,t&&new G(t).addToDOM(e)}constructor(e){this.nodes="string"==typeof e?this.parseMarkup(e):e}addToDOM(e){return function e(t,i){let n;return B(t).forEach(function(t){let s,o=t.tagName,r=t.textContent?a.doc.createTextNode(t.textContent):void 0,l=G.bypassHTMLFiltering;if(o)if("#text"===o)s=r;else if(-1!==G.allowedTags.indexOf(o)||l){let n="svg"===o?L:i.namespaceURI||L,h=a.doc.createElementNS(n,o),c=t.attributes||{};$(t,function(e,t){"tagName"!==t&&"attributes"!==t&&"children"!==t&&"style"!==t&&"textContent"!==t&&(c[t]=e)}),k(h,l?c:G.filterUserAttributes(c)),t.style&&j(h,t.style),r&&h.appendChild(r),e(t.children||[],h),s=h}else F(33,!1,void 0,{"Invalid tagName in config":o});s&&i.appendChild(s),n=s}),n}(this.nodes,e)}parseMarkup(e){let t,i=[];e=e.trim().replace(/ style=(["'])/g," data-style=$1");try{t=new DOMParser().parseFromString(Y?Y.createHTML(e):e,"text/html")}catch{}if(!t){let i=H("div");i.innerHTML=e,t={body:i}}let n=(e,t)=>{let i=e.nodeName.toLowerCase(),s={tagName:i};"#text"===i&&(s.textContent=e.textContent||"");let o=e.attributes;if(o){let e={};[].forEach.call(o,t=>{"data-style"===t.name?s.style=G.parseStyle(t.value):e[t.name]=t.value}),s.attributes=e}if(e.childNodes.length){let t=[];[].forEach.call(e.childNodes,e=>{n(e,t)}),t.length&&(s.children=t)}t.push(s)};return[].forEach.call(t.body.childNodes,e=>n(e,i)),i}}G.allowedAttributes=["alt","aria-controls","aria-describedby","aria-expanded","aria-haspopup","aria-hidden","aria-label","aria-labelledby","aria-live","aria-pressed","aria-readonly","aria-roledescription","aria-selected","class","clip-path","color","colspan","cx","cy","d","disabled","dx","dy","fill","filterUnits","flood-color","flood-opacity","height","href","id","in","in2","markerHeight","markerWidth","offset","opacity","operator","orient","padding","paddingLeft","paddingRight","patternUnits","r","radius","refX","refY","result","role","rowspan","scope","slope","src","startOffset","stdDeviation","stroke-linecap","stroke-width","stroke","style","summary","tabindex","tableValues","target","text-align","text-anchor","textAnchor","textLength","title","type","valign","width","x","x1","x2","xlink:href","y","y1","y2","zIndex"],G.allowedReferences=["https://","http://","mailto:","/","../","./","#"],G.allowedTags=["#text","a","abbr","b","br","button","caption","circle","clipPath","code","dd","defs","div","dl","dt","em","feComponentTransfer","feComposite","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","filter","h1","h2","h3","h4","h5","h6","hr","i","img","li","linearGradient","marker","ol","p","path","pattern","pre","rect","small","span","stop","strong","style","sub","sup","svg","table","tbody","td","text","textPath","th","thead","title","tr","tspan","u","ul"],G.emptyHTML=_,G.bypassHTMLFiltering=!1;let W="highcharts-dashboards-",K=window,J=document,q=function(){},Z=/(edge|msie|trident)/i.test(K.navigator&&K.navigator.userAgent||"")&&!K.opera,X=function(){let e=!1;if(!Z){let t=Object.defineProperty({},"passive",{get:function(){e=!0}});K.addEventListener&&K.removeEventListener&&(K.addEventListener("testPassive",q,t),K.removeEventListener("testPassive",q,t))}return e}(),Q={boards:[],classNamePrefix:W,classNames:{layout:W+"layout",cell:W+"cell",cellHover:W+"cell-state-hover",cellActive:W+"cell-state-active",cellLoading:W+"cell-state-loading",row:W+"row",layoutsWrapper:W+"layouts-wrapper",boardContainer:W+"wrapper"},doc:J,guiElementType:{row:"row",cell:"cell",layout:"layout"},isMS:Z,noop:q,supportsPassiveEvents:X,version:"4.1.0",win:K},ee=Q.classNamePrefix+"edit-",et={classNames:{resizeSnap:ee+"resize-snap",resizeSnapX:ee+"resize-snap-x",resizeSnapY:ee+"resize-snap-y",separator:ee+"separator",contextMenuBtn:ee+"context-menu-btn",contextMenuBtnText:ee+"context-menu-btn-text",contextMenu:ee+"context-menu",contextMenuItem:ee+"context-menu-item",editModeEnabled:ee+"enabled",editToolbar:ee+"toolbar",editToolbarCellOutline:ee+"toolbar-cell-outline",editToolbarRowOutline:ee+"toolbar-row-outline",editToolbarItem:ee+"toolbar-item",editToolbarRow:ee+"toolbar-row",editToolbarCell:ee+"toolbar-cell",editSidebar:ee+"sidebar",editSidebarShow:ee+"sidebar-show",editSidebarHide:ee+"sidebar-hide",editSidebarHeader:ee+"sidebar-header",editSidebarTitle:ee+"sidebar-title",editSidebarMenuItem:ee+"sidebar-item",rowContextHighlight:ee+"row-context-highlight",cellEditHighlight:ee+"cell-highlight",dashboardCellEditHighlightActive:ee+"cell-highlight-active",dragMock:ee+"drag-mock",dropPointer:ee+"drop-pointer",contextDetectionPointer:ee+"ctx-detection-pointer",resizePointer:ee+"resize-pointer",currentEditedElement:ee+"unmask",maskElement:ee+"mask",menuItem:ee+"menu-item",menu:ee+"menu",menuVerticalSeparator:ee+"menu-vertical-separator",menuHorizontalSeparator:ee+"menu-horizontal-separator",menuDestroy:ee+"menu-destroy",editSidebarWrapper:ee+"sidebar-wrapper",customSelect:ee+"custom-select",customSelectButton:ee+"custom-option-button",toggleContainer:ee+"toggle-container",toggleWrapper:ee+"toggle-wrapper",toggleSlider:ee+"toggle-slider",toggleWrapperColored:ee+"toggle-wrapper-colored",toggleLabels:ee+"toggle-labels",labeledToggleWrapper:ee+"labeled-toggle-wrapper",button:ee+"button",sidebarNavButton:ee+"sidebar-button-nav",labelText:ee+"label-text",editSidebarTabBtn:ee+"sidebar-tab-btn",editToolsBtn:ee+"tools-btn",editTools:ee+"tools",editGridItems:ee+"grid-items",editStandaloneToggle:ee+"standalone-toggle",confirmationPopup:ee+"confirmation-popup",popupButtonContainer:ee+"confirmation-popup-button-container",popupContentContainer:ee+"confirmation-popup-content",popupCancelBtn:ee+"confirmation-popup-cancel-btn",popupConfirmBtn:ee+"confirmation-popup-confirm-btn",popupCloseButton:ee+"popup-close",editOverlay:ee+"overlay",editOverlayActive:ee+"overlay-active",resizerMenuBtnActive:ee+"resizer-menu-btn-active",sidebarCloseButton:ee+"close-btn",editSidebarTabBtnWrapper:ee+"tabs-buttons-wrapper",editSidebarRight:ee+"sidebar-right",editSidebarRightShow:ee+"sidebar-right-show",viewFullscreen:ee+"view-fullscreen",accordionMenu:ee+"accordion-menu",accordionContainer:ee+"accordion",accordionHeader:ee+"accordion-header",accordionHeaderBtn:ee+"accordion-header-btn",accordionHeaderWrapper:ee+"accordion-header-wrapper",accordionHeaderIcon:ee+"accordion-header-icon",accordionContent:ee+"accordion-content",accordionNestedWrapper:ee+"accordion-nested",accordionMenuButtonsContainer:ee+"accordion-menu-buttons-container",accordionMenuButton:ee+"accordion-menu-button",accordionStandaloneWrapper:ee+"accordion-standalone-wrapper",hiddenElement:ee+"hidden-element",collapsableContentHeader:ee+"collapsable-content-header",standaloneElement:ee+"standalone-element",collapsedElement:ee+"collapsed-element",dropdown:ee+"dropdown",dropdownContent:ee+"dropdown-content",dropdownButton:ee+"dropdown-button",dropdownButtonContent:ee+"dropdown-button-content",dropdownIcon:ee+"pointer",icon:ee+"icon"}},{addEvent:ei,createElement:en,uniqueKey:es,objectEach:eo,error:er}=I,ea=class{static getOffsets(e,t){let i={left:0,top:0,right:0,bottom:0};if(!e.container)return i;let n=e.container.getBoundingClientRect(),s=t?t.getBoundingClientRect():{left:0,top:0};return i.left=n.left-s.left,i.top=n.top-s.top,i.right=n.right-s.left,i.bottom=n.bottom-s.top,i}static getDimFromOffsets(e){return{width:e.right-e.left,height:e.bottom-e.top}}static getElementId(e){return Q.classNamePrefix+e+"-"+es().slice(11)}static getPercentageWidth(e){let t,i=/^(\d{1})[\-\/\.](\d{1,2})$/;if(i.test(e)){let n=e.match(i)||[];t=((t=100*n[1]/n[2])<=100?t:100)+"%"}else if(-1!==e.indexOf("%")){let i=parseFloat(e);t=(i<=100?i>=0?i:0:100)+"%"}return t}getElementContainer(e){let t,i=this;if(e.render)e.attribs&&!e.attribs.id&&delete e.attribs.id;else if("string"==typeof e.elementId){let t=document.getElementById(e.elementId);t?i.container=t:er("Element "+e.elementId+" does not exist")}return i.removeBindedEventFn=ei(t=e.element instanceof HTMLElement?e.element:en("div",e.attribs||{},e.style||{},e.parentContainer),"bindedGUIElement",function(e){e.guiElement=i,e.stopImmediatePropagation()}),t}destroy(){let e=this;e.removeBindedEventFn&&e.removeBindedEventFn(),e.container&&e.container.parentNode&&e.container.parentNode.removeChild(e.container),eo(e,function(t,i){delete e[i]})}getType(){return this.type}changeVisibility(e=!0,t){let i=this.isVisible&&!e||!this.isVisible&&e;this.container&&i&&(this.container.style.display=e?t||"block":"none",this.isVisible=e)}hide(){this.changeVisibility(!1)}show(){this.changeVisibility()}},{merge:el,fireEvent:eh}=I;function ec(e){return!!e&&"row"in e&&"cell"===e.type}let ed=class extends ea{constructor(e,t,i){super(),this.type=Q.guiElementType.cell,this.id=t.id,this.options=t,this.row=e,this.isVisible=!0;const n=document.getElementById(t.parentContainerId||"")||e.container,s=e.layout.options||{},o=e.options||{},r=s.cellClassName||"";this.container=this.getElementContainer({render:e.layout.board.guiEnabled,parentContainer:n,attribs:{id:t.id,className:Q.classNames.cell+" "+r},element:i,elementId:t.id,style:el(s.style,o.style,t.style,{height:this.height})}),this.options.layout&&this.setNestedLayout()}setNestedLayout(){let e=this.row.layout.board,t=this.row.layout.constructor,i=e.options.gui;this.nestedLayout=new t(e,el({},i&&i.layoutOptions,this.options.layout,{parentContainerId:this.options.id}),this)}destroy(){let{row:e}=this;this.mountedComponent?.destroy(),this.nestedLayout?.destroy(),e.unmountCell(this);let t=e.cells?.length===0;super.destroy(),t&&e.destroy()}getOptions(){return this.options.layout&&this.nestedLayout?{...this.options,layout:this.nestedLayout.getOptions()}:this.options}changeVisibility(e=!0){super.changeVisibility(e);let t=this,i=t.row;t.row.getVisibleCells().length?t.isVisible&&!i.isVisible&&t.row.show():t.row.hide(),setTimeout(()=>{eh(i,"cellChange",{row:i,cell:t})},0)}getParentCell(e){let t;if(e<=this.row.layout.level){if(this.row.layout.level===e)return this;if(this.row.layout.level-1>=0&&(t=this.row.layout.parentCell))return t.getParentCell(e)}}getOverlappingLevels(e,t,i){let n=this.row.layout.parentCell,s=[this.row.layout.level];if(n){let o=i||ea.getOffsets(this)[e],r=ea.getOffsets(n)[e];Math.abs(o-r)<t&&(s=[...s,...n.getOverlappingLevels(e,t,r)])}return s}setSize(e,t){let i=this.row.layout.board.editMode;if(this.container){if(e)if("auto"===e&&"1 1 0%"!==this.container.style.flex)this.container.style.flex="1 1 0%";else{let t=this.convertWidthToValue(e);t&&this.container.style.flex!=="0 0 "+t&&(this.container.style.flex="0 0 "+t)}t&&(this.height=this.container.style.height=t+"px"),i&&(i.hideContextPointer(),i.cellToolbar&&i.cellToolbar.isVisible&&(i.cellToolbar.cell===this?i.cellToolbar.showToolbar(this):i.cellToolbar.hide())),eh(this.row.layout.board,"cellResize",{cell:this}),eh(this.row,"cellChange",{cell:this,row:this.row})}}setHighlight(e){let t=this.row?.layout.board.editMode;if(this.container&&t){let t=this.container,i=t.classList.contains(et.classNames.cellEditHighlight);e||i?e&&i&&(t.classList.remove(et.classNames.cellEditHighlight),this.row.layout.board.container.classList.remove(et.classNames.dashboardCellEditHighlightActive),this.isHighlighted=!1):(t.classList.add(et.classNames.cellEditHighlight),this.row.layout.board.container.classList.add(et.classNames.dashboardCellEditHighlightActive),this.isHighlighted=!0)}}setActiveState(){this.row.layout.board.mountedComponents.forEach(e=>{e.cell.container&&e.cell.container.classList.remove(Q.classNames.cellActive),e.component.isActive=!1}),this.container&&this.container.classList.add(Q.classNames.cellActive)}setLoadingState(e=!0){this.container?.classList?.toggle(Q.classNames.cellLoading,e)}convertWidthToValue(e){return"number"==typeof e?e+"px":/px/.test(e)?e:ea.getPercentageWidth(e)||""}},eu=class{constructor(){this.registry={}}addCallback(e,t){this.registry[e]=t}getCallback(e){return this.registry[e]}toJSON(){let e={};return Object.keys(this.registry).forEach(t=>{let{func:i,type:n}=this.getCallback(t);e[t]={func:i.toString(),type:n}}),e}},ep=class{constructor(e,t){this.tableEvents=[],this.component=e,this.options=t}async initConnector(){let e=this.component,t=this.options.id,i=this.component.board.dataPool;if(t&&(this.connectorId!==t||i.isNewConnector(t))){ec(e.cell)&&e.cell.setLoadingState();let n=await i.getConnector(t);this.destroyed||this.setConnector(n)}return e}setTable(e){this.clearTableListeners(e),this.setupTableListeners(e),e.on("setModifier",()=>this.clearTableListeners(e)),e.on("afterSetModifier",e=>{"afterSetModifier"===e.type&&e.modified&&(this.setupTableListeners(e.modified),this.component.emit({type:"tableChanged",connector:this.connector}))}),this.dataTable=e}setConnector(e){for(;this.tableEvents.length;){let e=this.tableEvents.pop();"function"==typeof e&&e()}return this.connector=e,e&&this.setTable(e.getTable(this.options.dataTableKey)),this.addConnectorAssignment(),this.component}setupTableListeners(e){let t=this.connector;t&&e&&["afterDeleteRows","afterSetCell","afterSetColumns","afterSetRows"].forEach(i=>{this.tableEvents.push(e.on(i,e=>{clearTimeout(this.tableEventTimeout),this.tableEventTimeout=Q.win.setTimeout(()=>{this.component.emit({...e,type:"tableChanged",targetConnector:t}),this.tableEventTimeout=void 0})}))})}clearTableListeners(e){let t=this.connector,i=this.tableEvents;this.removeTableEvents(),t&&i.push(e.on("afterSetModifier",e=>{"afterSetModifier"===e.type&&(clearTimeout(this.tableEventTimeout),this.tableEventTimeout=Q.win.setTimeout(()=>{this.component.emit({...e,type:"tableChanged",targetConnector:t}),this.tableEventTimeout=void 0}))}))}addConnectorAssignment(){let{connector:e}=this;if(e&&(e.components||(e.components=[]),!e.components.includes(this.component))){let t=e.options;e.components.push(this.component),"enablePolling"in t&&t.enablePolling&&!e.polling&&1===e.components.length&&"dataRefreshRate"in t&&e.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}}removeConnectorAssignment(){let{connector:e}=this;if(!e?.components)return;let t=e.components.indexOf(this.component);t>-1&&(e.components.splice(t,1),e.components.length||(e.stopPolling(),delete e.components))}removeTableEvents(){this.tableEvents.forEach(e=>e()),this.tableEvents.length=0}updateOptions(e){this.options=e}destroy(){this.destroyed=!0,this.removeConnectorAssignment(),this.removeTableEvents()}};class em{constructor(e,t=em.defaultBindings){this.component=e,this.bindings=t}getOptions(){let e=this.component.options.editableOptions;if(!e)return[];for(let t=0,i=e.length;t<i;t++){let i=e[t];if(i.propertyPath?.some(e=>"connector"===e)){let e=this.component.board;i.selectOptions=e?e.dataPool.getConnectorIds().map(e=>({name:e})):[]}}return e}}em.defaultBindings={keyMap:{color:"colorPicker",title:"text",caption:"text",style:"textarea"},typeMap:{string:"text",number:"input",boolean:"toggle"},skipRedraw:[]},em.defaultTypeMap={string:"text",number:"input",boolean:"toggle"};class ef{static register(e){let{id:t}=e;this.registry[t]=e}static get(e){return this.registry[e]}constructor(e,t){this.id=e,this.func=t,ef.register(this)}create(e){this.callback=this.func.call(e)}remove(){this.callback&&this.callback()}}ef.registry={};class eg{static register(e){let{id:t}=e;this.registry[t]=e}static get(e){return this.registry[e]}constructor(e,t){this.id=e,this.func=t,eg.register(this)}register(e){let{func:t}=this;this.callback=t.call(e)}remove(){this.callback&&this.callback()}}eg.registry={};let{merge:ey,isObject:eb}=I;class eC{constructor(e,t){this.component=e,this.predefinedSyncConfig=t,this.syncConfig=eC.prepareSyncConfig(t,e.options.sync),this.registeredSyncHandlers={},this.registeredSyncEmitters={},this.isSyncing=!1,this.listeners=[]}static prepareSyncConfig(e,t={}){let{defaultSyncPairs:i,defaultSyncOptions:n}=e;return Object.keys(t).reduce((e,s)=>{if(s){let o=i[s],r=n[s],a=t[s],l=ey(r||{},{enabled:eb(a)?a.enabled:a},eb(a)?a:{});if(o&&l.enabled)for(let e of["emitter","handler"])(!0===l[e]||void 0===l[e])&&(l[e]=o[e]);e[s]=l}return e},{})}registerSyncEmitter(e){let{id:t}=e;this.registeredSyncEmitters[t]=e}isRegisteredEmitter(e){return!!this.registeredSyncEmitters[e]}registerSyncHandler(e){let{id:t}=e;this.registeredSyncHandlers[t]=e}isRegisteredHandler(e){return!!this.registeredSyncHandlers[e]}start(){let{component:e}=this;for(let t of(this.syncConfig=eC.prepareSyncConfig(this.predefinedSyncConfig,e.options.sync),Object.keys(this.syncConfig))){let i=this.syncConfig[t];if(!i)continue;let{emitter:n,handler:s}=i;if(s){!0===s&&(s=eC.defaultHandlers[t].handler);let i=new eg(t,s);this.isRegisteredHandler(i.id)||(this.registerSyncHandler(i),i.register(e))}if(n){!0===n&&(n=eC.defaultHandlers[t].emitter);let i=new ef(t,n);this.isRegisteredEmitter(i.id)||(this.registerSyncEmitter(i),i.create(e))}}this.isSyncing=!0,this.listeners.push(e.on("update",()=>this.stop()))}stop(){let{component:e,listeners:t,registeredSyncHandlers:i,registeredSyncEmitters:n}=this;Object.keys(i).forEach(e=>{i[e].remove(),delete i[e]}),Object.keys(n).forEach(e=>{n[e].remove(),delete n[e]}),this.isSyncing=!1;for(let e=0,i=t.length;e<i;++e)t[e]();this.listeners.length=0,this.listeners.push(e.on("afterUpdate",()=>{this.start()}))}}function ew(e,t){let i=window.getComputedStyle(e);return t.map(e=>i[e])}function ev(e,t){return t&&(e+="number"==typeof t?t:parseFloat(t)),e}eC.defaultHandlers={};let{doc:eO,supportsPassiveEvents:ex}=Q,{error:eT,isClass:eE,isDOMElement:eN,isObject:eM,objectEach:eS,uniqueKey:eR}=I;function eA(e,t){let i;for(i in e||(e={}),t)e[i]=t[i];return e}function eP(e,t,i){function n(t,i){let n=e.removeEventListener;n&&n.call(e,t,i,!1)}function s(i){let s,o;e.nodeName&&(t?(s={})[t]=!0:s=i,eS(s,function(e,t){if(i[t])for(o=i[t].length;o--;)n(t,i[t][o].fn)}))}let o="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(o,"hcEvents")){let e=o.hcEvents;if(t){let o=e[t]||[];i?(e[t]=o.filter(function(e){return i!==e.fn}),n(t,i)):(s(e),e[t]=[])}else s(e),delete o.hcEvents}}let eI={addEvent:function(e,t,i,n={}){let s="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let o=s.hcEvents,r=e.addEventListener;r&&r.call(e,t,i,!!ex&&{passive:void 0===n.passive?-1!==t.indexOf("touch"):n.passive,capture:!1}),o[t]||(o[t]=[]);let a={fn:i,order:"number"==typeof n.order?n.order:1/0};return o[t].push(a),o[t].sort((e,t)=>e.order-t.order),function(){eP(e,t,i)}},deepClone:function e(t,i){if(Array.isArray(t))return t.map(t=>e(t,i));if(t&&"object"==typeof t){let n={};for(let s of Object.keys(t))i&&i.includes(s)?n[s]=t[s]:n[s]=e(t[s],i);return n}return t},error:function(e,t){16===e?console.warn("Dashboard error: Dashboards library loaded more than once.This may cause undefined behavior."):eT(e,t)},fireEvent:function(e,t,i,n){if(i=i||{},eO?.createEvent&&(e.dispatchEvent||e.fireEvent&&e!==Q)){let n=eO.createEvent("Events");n.initEvent(t,!0,!0),i=eA(n,i),e.dispatchEvent?e.dispatchEvent(i):e.fireEvent(t,i)}else if(e.hcEvents){i.target||eA(i,{preventDefault:function(){i.defaultPrevented=!0},target:e,type:t});let n=[],s=e,o=!1;for(;s.hcEvents;)Object.hasOwnProperty.call(s,"hcEvents")&&s.hcEvents[t]&&(n.length&&(o=!0),n.unshift.apply(n,s.hcEvents[t])),s=Object.getPrototypeOf(s);o&&n.sort((e,t)=>e.order-t.order),n.forEach(t=>{!1===t.fn.call(e,i)&&i.preventDefault()})}n&&!i.defaultPrevented&&n.call(e,i)},merge:function(e,...t){let i=0,n={},s=Error("Recursive copy depth > 100"),o=(e,t)=>{if("object"!=typeof e&&(e={}),++i>100)throw s;return eS(t,(i,n)=>{"__proto__"!==n&&"constructor"!==n&&(!eM(i,!0)||eE(i)||eN(i)?e[n]=t[n]:e[n]=o(e[n]||{},i))}),--i,e};!0===e?n=t.shift():t.unshift(e);for(let e=0,i=t.length;e<i;++e)n=o(n,t[e]);return n},removeEvent:eP,uniqueKey:function(){return`dashboard-${eR().replace("highcharts-","")}`}},{classNamePrefix:eL}=Q,{createElement:eD,isArray:ek,merge:eH,fireEvent:ej,addEvent:eF,objectEach:ez,isFunction:eV,getStyle:e$,diffObjects:eB,removeEvent:eU}=I,{getMargins:eY,getPaddings:e_}={getMargins:function(e,t=!0){return{y:ew(e,["marginTop","marginBottom",...t?["borderTop","borderBottom"]:[]]).reduce(ev,0),x:ew(e,["marginLeft","marginTop",...t?["borderLeft","borderRight"]:[]]).reduce(ev,0)}},getPaddings:function(e){return{x:ew(e,["paddingLeft","paddingRight"]).reduce(ev,0),y:ew(e,["paddingTop","paddingBottom"]).reduce(ev,0)}},getStyles:ew,sumPixels:ev},{deepClone:eG,uniqueKey:eW}=eI;class eK{static createTextElement(e,t,i){if("object"==typeof i){let{className:n,text:s,style:o}=i;return eD(e,{className:n||`${eL}component-${t}`,textContent:s},o)}if("string"==typeof i)return eD(e,{className:`${eL}component-${t}`,textContent:i},{})}constructor(e,t,i){this.connectorHandlers=[],this.callbackRegistry=new eu,this.cellListeners=[],this.resizeTimeouts=[],this.innerResizeTimeouts=[];const n=t.renderTo;if(this.board=i||e?.row?.layout?.board||{},this.parentElement=e?.container||document.querySelector("#"+n),this.cell=e,this.options=eH(eK.defaultOptions,t),this.id=this.options.id&&this.options.id.length?this.options.id:eW(),this.options.connector)for(const e of ek(this.options.connector)?this.options.connector:[this.options.connector])this.connectorHandlers.push(new ep(this,e));this.editableOptions=new em(this,t.editableOptionsBindings),this.dimensions={width:null,height:null},this.element=eD("div",{className:this.options.className},{},this.parentElement),Number(e$(this.element,"padding"))||(this.element.style.padding="0.1px"),this.contentElement=eD("div",{className:`${this.options.className}-content`},{},this.element,!0),this.sync=new eC(this,this.constructor.predefinedSyncConfig),this.setupEventListeners(),e&&(this.attachCellListeners(),this.on("update",()=>{ec(this.cell)&&this.cell.setLoadingState()}),this.on("afterRender",()=>{ec(this.cell)&&this.cell.setLoadingState(!1)})),this.on("tableChanged",()=>{this.onTableChanged()})}getOptionsOnDrop(e){return{}}getFirstConnector(){return this.connectorHandlers[0]?.connector}getDataTable(e,t){for(let i of this.connectorHandlers)if((!e||i.options.id===e)&&(!t||i.options.dataTableKey===t))return i.dataTable}attachCellListeners(){for(;this.cellListeners.length;){let e=this.cellListeners.pop();e&&e()}if(this.cell&&ec(this.cell)&&Object.keys(this.cell).length){let e=this.cell.row.layout.board;this.cellListeners.push(eF(e,"cellResize",()=>{this.resizeTo(this.parentElement)}),eF(this.cell.row,"cellChange",e=>{let{row:t}=e;t&&this.cell&&void 0===t.getCellIndex(this.cell)&&this.cell&&this.setCell(this.cell)}))}}setCell(e,t=!1){this.cell=e,e.container&&(this.parentElement=e.container),this.attachCellListeners(),t&&this.resizeTo(this.parentElement)}async initConnectors(){for(let e of(ej(this,"setConnectors",{connectorHandlers:this.connectorHandlers}),this.connectorHandlers))await e.initConnector();return ej(this,"afterSetConnectors",{connectorHandlers:this.connectorHandlers}),this}getContentHeight(){return(this.titleElement?this.titleElement.clientHeight+eY(this.titleElement).y:0)+(this.captionElement?this.captionElement.clientHeight+eY(this.captionElement).y:0)}resize(e,t){if(t){let e=e_(this.element).y+eY(this.element).y;this.element.style.height="calc(100% - "+e+"px)",this.contentElement.style.height="calc(100% - "+this.getContentHeight()+"px)"}else null===t&&(this.dimensions.height=null,this.element.style.removeProperty("height"));ej(this,"resize",{width:e,height:t})}resizeDynamicContent(e,t){let{element:i}=this;if(t){let e=eY(i).y,n=e_(i).y;"string"==typeof t&&(t=parseFloat(t)),t=Math.round(t),i.style.height=`${t-e-n}px`,this.contentElement.style.height=`${i.clientHeight-this.getContentHeight()-n}px`}else null===t&&(this.dimensions.height=null,i.style.removeProperty("height"));ej(this,"resize",{width:e,height:t})}resizeTo(e){for(;this.resizeTimeouts.length;){let e=this.resizeTimeouts.pop();e&&cancelAnimationFrame(e)}let t=requestAnimationFrame(()=>{let{width:t,height:i}=e.getBoundingClientRect(),n=e_(e),s=eY(e);this.resize(t-n.x-s.x,i-n.y-s.y)});this.resizeTimeouts.push(t)}async update(e,t=!0){let i={options:e,shouldForceRerender:!1};ej(this,"update",i),e.connector&&Array.isArray(this.options.connector)&&(this.options.connector=void 0),this.options=eH(this.options,e);let n=this.options.connector?ek(this.options.connector)?this.options.connector:[this.options.connector]:[],s=n.length!==this.connectorHandlers.length;if(!s)for(let e=0,t=n.length;e<t;e++){let t=this.connectorHandlers[e]?.options,i=n[e];if(t.id!==i.id||t.dataTableKey!==i.dataTableKey){s=!0;break}this.connectorHandlers[e].updateOptions(i)}if(s){for(let e of this.connectorHandlers)e.destroy();for(let e of(this.connectorHandlers.length=0,n))this.connectorHandlers.push(new ep(this,e));await this.initConnectors()}(t||i.shouldForceRerender)&&this.render()}setupEventListeners(){let e=this.options.events;e&&(Object.keys(e).forEach(t=>{let i=e[t];i&&this.callbackRegistry.addCallback(t,{type:"component",func:i})}),ez(e,(e,t)=>{eV(e)&&this.on(t,e)}));let t=()=>{this.resizeTo(this.parentElement)};if("function"==typeof ResizeObserver)this.resizeObserver=new ResizeObserver(t),this.resizeObserver.observe(this.element);else{let e=eF(window,"resize",t);eF(this,"destroy",e)}}setTitle(e){let t=this.titleElement;if(e&&("string"==typeof e||e.text)){let i=eK.createTextElement("h2","title",e);i&&(t?t.replaceWith(i):this.element.insertBefore(i,this.element.firstChild),this.titleElement=i)}else if(t){t.remove(),delete this.titleElement;return}}setCaption(e){let t=this.captionElement;if(e&&("string"==typeof e||e.text)){let i=eK.createTextElement("div","caption",e);i&&(t?t.replaceWith(i):this.element.appendChild(i),this.captionElement=i)}else if(t){t.remove(),delete this.captionElement;return}}async load(){return await this.initConnectors(),this.render(),this}render(){return this.emit({type:"render"}),this.setTitle(this.options.title),this.setCaption(this.options.caption),this.resizeTo(this.parentElement),this}destroy(){for(this.sync.isSyncing&&this.sync.stop();this.element.firstChild;)this.element.firstChild.remove();for(let e of(ej(this,"unmount"),this.connectorHandlers))e.destroy();eU(this),this.element.remove()}on(e,t){return eF(this,e,t)}emit(e){e.target||(e.target=this),ej(this,e.type,e)}getOptions(){return eB(this.options,eK.defaultOptions)}getEditableOptions(){return eG(this.options,["dataTable","points","series","data","editableOptions"])}getEditableOptionValue(e){if(!e)return;let t=this.getEditableOptions();for(let i=0,n=e.length;i<n;i++){if(ek(t)&&"connector"===e[0]&&t.length>1)return"multiple connectors";if(!t)return;!1===(t=t[e[i]])&&(e.indexOf("title")>=0||e.indexOf("subtitle")>=0||e.indexOf("caption")>=0)&&(t="")}return t}}eK.Sync=eC,eK.predefinedSyncConfig={defaultSyncOptions:{},defaultSyncPairs:{}},eK.defaultOptions={className:`${eL}component`,id:"",title:!1,caption:!1,sync:eC.defaultHandlers,editableOptions:[{name:"title",propertyPath:["title"],type:"input"},{name:"caption",propertyPath:["caption"],type:"input"}]};let eJ=eK,eq={type:"HTML",className:[eJ.defaultOptions.className,`${eJ.defaultOptions.className}-html`].join(" "),elements:[],editableOptions:[...eJ.defaultOptions.editableOptions||[],{name:"htmlInput",propertyPath:["html"],type:"textarea"}]},{merge:eZ,diffObjects:eX}=I,{deepClone:eQ}=eI;G.allowedTags=[...G.allowedTags,"option","select","label","input","textarea"],G.allowedAttributes=[...G.allowedAttributes,"for","value","checked","src","name","selected"],G.allowedReferences=[...G.allowedReferences,"data:image/"];class e0 extends eJ{constructor(e,t){t.className&&(t.className=`${e0.defaultOptions.className} ${t.className}`),super(e,t=eZ(e0.defaultOptions,t)),this.options=t,this.type="HTML",this.elements=[]}async load(){this.emit({type:"load"}),await super.load();let e=this.options,t=!1;if(e.elements?.length?this.elements=e.elements.map(function(e){return"string"==typeof e?new G(e).nodes[0]:(e.textContent||e.tagName||!e.attributes||(t=!0),e)}):e.html&&(this.elements=this.getElementsFromString(e.html),this.options.elements=this.elements),this.constructTree(),this.emit({type:"afterLoad"}),t)throw Error(`Missing tagName param in component: ${e.renderTo}`);return this}render(){return super.render(),this.constructTree(),this.sync.start(),this.emit({type:"afterRender"}),this}resize(e,t){return super.resize(e,t),this}async update(e,t=!0){e.html?(this.elements=this.getElementsFromString(e.html),this.options.elements=this.elements,this.constructTree()):e.elements&&(this.elements=e.elements),await super.update(e,t),this.emit({type:"afterUpdate"})}getOptionsOnDrop(){return{type:"HTML",elements:[{tagName:"span",textContent:"[Your custom HTML here- edit the component]"}]}}constructTree(){for(;this.contentElement.firstChild;)this.contentElement.firstChild.remove();new G(this.options.elements||[]).addToDOM(this.contentElement)}getElementsFromString(e){return new G(e).nodes}getOptions(){return{...eX(this.options,e0.defaultOptions),type:"HTML"}}getEditableOptions(){return eQ(this.options,["editableOptions"])}getEditableOptionValue(e){if(e){if("html"===e[0]){let t=this.getEditableOptions();return!t.html&&t.elements?this.getStringFromElements(t.elements):t[e[0]]}return super.getEditableOptionValue(e)}}getStringFromElements(e){let t="";for(let i of e)t+=this.serializeNode(i);return t}serializeNode(e){if(!e.tagName||"#text"===e.tagName)return e.textContent||"";let t=e.attributes,i=`<${e.tagName}`;if(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];void 0!==n&&(i+=` ${e}="${n}"`)}}return i+=">",i+=e.textContent||"",(e.children||[]).forEach(e=>{i+=this.serializeNode(e)}),i+=`</${e.tagName}>`}onTableChanged(e){e.detail?.sender!==this.id&&this.render()}}e0.defaultOptions=eZ(eJ.defaultOptions,eq),e0.predefinedSyncConfig={defaultSyncPairs:{},defaultSyncOptions:{}};let{isNumber:e1}=I;function e2(e,t){return"string"==typeof e&&(e=e.replace(/^\s+|\s+$/g,""),t&&/^[\d\s]+$/.test(e)&&(e=e.replace(/\s/g,""))),e}let e3=function(e,t){let i;if("string"==typeof e)i=t.parseDate(e);else if("number"==typeof e)i=e;else{if(e instanceof Date)return e;i=t.parseDate(""+e)}return new Date(i)},e6=function(e,t){if("number"==typeof e)return e;if("boolean"==typeof e)return+!!e;if("string"==typeof e){if(e.indexOf(" ")>-1&&(e=e.replace(/\s+/g,"")),t){if(!t.test(e))return NaN;e=e.replace(t,"$1.$2")}return parseFloat(e)}return e instanceof Date?e.getDate():e?e.getRowCount():NaN},e5=function(e){return""+e},e4=function(e=[],t){let i={};for(let n=0,s=Math.max(t.length,e.length);n<s;++n)i[t[n]||`${n}`]=e[n]?e[n].slice():[];return i},e9=function(e,t){let i="string";if("string"==typeof e){let n=e2(`${e}`),s=t.decimalRegExp,o=e2(n,!0);s&&(o=s.test(o)?o.replace(s,"$1.$2"):"");let r=parseFloat(o);+o===r?e=r:i=e1(t.parseDate(e))?"Date":"string"}return"number"==typeof e&&(i=e>31536e6?"Date":"number"),i},{addEvent:e8,fireEvent:e7,merge:te}=I;class tt{static registerType(e,t){return!!e&&!tt.types[e]&&!!(tt.types[e]=t)}constructor(e){this.dateFormats={"YYYY/mm/dd":{regex:/^(\d{4})([\-\.\/])(\d{1,2})\2(\d{1,2})$/,parser:function(e){return e?Date.UTC(+e[1],e[3]-1,+e[4]):NaN}},"dd/mm/YYYY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{4})$/,parser:function(e){return e?Date.UTC(+e[4],e[3]-1,+e[1]):NaN},alternative:"mm/dd/YYYY"},"mm/dd/YYYY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{4})$/,parser:function(e){return e?Date.UTC(+e[4],e[1]-1,+e[3]):NaN}},"dd/mm/YY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{2})$/,parser:function(e){let t=new Date;if(!e)return NaN;let i=+e[4];return i>t.getFullYear()-2e3?i+=1900:i+=2e3,Date.UTC(i,e[3]-1,+e[1])},alternative:"mm/dd/YY"},"mm/dd/YY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{2})$/,parser:function(e){return e?Date.UTC(+e[4]+2e3,e[1]-1,+e[3]):NaN}}};const t=te(tt.defaultOptions,e);let i=t.decimalPoint;("."===i||","===i)&&(i="."===i?"\\.":",",this.decimalRegExp=RegExp("^(-?[0-9]+)"+i+"([0-9]+)$")),this.options=t}convertByType(e){let t=this;return({number:e=>e6(e,t.decimalRegExp),Date:e=>e3(e,t),string:e5})[e9(e,t)].call(t,e)}deduceDateFormat(e,t,i){let n=[],s=[],o="YYYY/mm/dd",r,a=[],l=0,h=!1,c,d;for((!t||t>e.length)&&(t=e.length);l<t;l++)if(void 0!==e[l]&&e[l]&&e[l].length)for(d=0,r=e[l].trim().replace(/[\-\.\/]/g," ").split(" "),a=["","",""];d<r.length;d++)d<a.length&&(c=parseInt(r[d],10))&&(s[d]=!s[d]||s[d]<c?c:s[d],void 0!==n[d]?n[d]!==c&&(n[d]=!1):n[d]=c,c>31?c<100?a[d]="YY":a[d]="YYYY":c>12&&c<=31?(a[d]="dd",h=!0):a[d].length||(a[d]="mm"));if(h){for(d=0;d<n.length;d++)!1!==n[d]?s[d]>12&&"YY"!==a[d]&&"YYYY"!==a[d]&&(a[d]="YY"):s[d]>12&&"mm"===a[d]&&(a[d]="dd");3===a.length&&"dd"===a[1]&&"dd"===a[2]&&(a[2]="YY"),o=a.join("/")}return i&&(this.options.dateFormat=o),o}emit(e){e7(this,e.type,e)}on(e,t){return e8(this,e,t)}parseDate(e,t){let i=this.options,n=t||i.dateFormat,s=NaN,o,r=null;if(i.parseDate)s=i.parseDate(e);else{let t=this.dateFormats;if(n){let i=t[n];i||(i=t["YYYY/mm/dd"]),(r=e.match(i.regex))&&(s=i.parser(r))}else for(o in t){let i=t[o];if(r=e.match(i.regex)){n=o,s=i.parser(r);break}}if(!r){let t=Date.parse(e);!isNaN(t)&&(s=t-6e4*new Date(t).getTimezoneOffset(),e.includes("2001")||2001!==new Date(s).getFullYear()||(s=NaN))}}return s}}tt.defaultOptions={dateFormat:"",firstRowAsNames:!0},tt.types={};let ti=tt,{merge:tn}=I;class ts extends ti{constructor(e){const t=tn(ts.defaultOptions,e);super(t),this.headers=[],this.dataTypes=[],this.options=t}parse(e,t){let i=this.dataTypes,n=tn(this.options,e),{beforeParse:s,lineDelimiter:o,firstRowAsNames:r,itemDelimiter:a}=n,l,h=0,{csv:c,startRow:d,endRow:u}=n,p,m=[];if(this.emit({type:"parse",columns:m,detail:t,headers:this.headers}),c&&s&&(c=s(c)),c){if(l=c.replace(/\r\n|\r/g,"\n").split(o||"\n"),(!d||d<0)&&(d=0),(!u||u>=l.length)&&(u=l.length-1),a||(this.guessedItemDelimiter=this.guessDelimiter(l)),r){let e=l[0].split(a||this.guessedItemDelimiter||",");for(let t=0;t<e.length;t++)e[t]=e[t].trim().replace(/^["']|["']$/g,"");this.headers=e,d++}let e=0;for(h=d;h<=u;h++)"#"===l[h][0]?e++:this.parseCSVRow(m,l[h],h-d-e);i.length&&i[0].length&&"date"===i[0][1]&&!this.options.dateFormat&&this.deduceDateFormat(m[0],null,!0);for(let e=0,t=m.length;e<t;++e){p=m[e];for(let t=0,i=p.length;t<i;++t)if(p[t]&&"string"==typeof p[t]){let i=this.convertByType(p[t]);i instanceof Date&&(i=i.getTime()),m[e][t]=i}}}return m.forEach(e=>{e.length=Math.max(...m.map(e=>e.length))}),this.emit({type:"afterParse",columns:m,detail:t,headers:this.headers}),e4(m,this.headers)}parseCSVRow(e,t,i){let n=this,s=n.dataTypes,{startColumn:o,endColumn:r}=n.options,a=n.options.itemDelimiter||n.guessedItemDelimiter,{decimalPoint:l}=n.options;l&&l!==a||(l=n.guessedDecimalPoint||".");let h=0,c="",d="",u=0,p=0,m=e=>{c=t[e]},f=e=>{s.length<p+1&&s.push([e]),s[p][s[p].length-1]!==e&&s[p].push(e)},g=()=>{if(o>u||u>r){++u,d="";return}if("string"==typeof d){let e=parseFloat(d);!isNaN(e)&&isFinite(Number(d))?(d=e,f("number")):isNaN(Date.parse(d))?f("string"):(d=d.replace(/\//g,"-"),f("date"))}else f("number");if(e.length<p+1&&e.push([]),"number"!=typeof d&&"number"!==e9(d,n)&&l){let e=d;"number"!==e9(d=d.replace(l,"."),n)&&(d=e)}e[p][i]=d,d="",++p,++u};if(t.trim().length&&"#"!==t.trim()[0]){for(;h<t.length;h++){if(m(h),"#"===c&&!/^#[A-F\d]{3,3}|[A-F\d]{6,6}/i.test(t.substring(h)))return void g();if('"'===c)for(m(++h);h<t.length&&'"'!==c;)d+=c,m(++h);else c===a?g():d+=c}g()}}guessDelimiter(e){let t=0,i=0,n,s={",":0,";":0,"	":0},o=e.length;for(let n=0;n<o;n++){let o=!1,r,a,l,h="";if(n>13)break;let c=e[n];for(let e=0;e<c.length&&(r=c[e],a=c[e+1],l=c[e-1],"#"!==r);e++){if('"'===r)if(o){if('"'!==l&&'"'!==a){for(;" "===a&&e<c.length;)a=c[++e];void 0!==s[a]&&s[a]++,o=!1}}else o=!0;else void 0!==s[r]?(isNaN(Date.parse(h=h.trim()))?(isNaN(Number(h))||!isFinite(Number(h)))&&s[r]++:s[r]++,h=""):h+=r;","===r&&i++,"."===r&&t++}}return s[";"]>s[","]?n=";":(s[","]>s[";"],n=","),t>i?this.guessedDecimalPoint=".":this.guessedDecimalPoint=",",n}}ts.defaultOptions={...ti.defaultOptions,lineDelimiter:"\n",startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE},ti.registerType("CSV",ts);let{addEvent:to,fireEvent:tr,merge:ta}=I;class tl{static registerType(e,t){return!!e&&!tl.types[e]&&!!(tl.types[e]=t)}benchmark(e,t){let i=[],n=this,s=()=>{n.modifyTable(e),n.emit({type:"afterBenchmarkIteration"})},{iterations:o}=ta({iterations:1},t);n.on("afterBenchmarkIteration",()=>{i.length===o?n.emit({type:"afterBenchmark",results:i}):s()});let r={startTime:0,endTime:0};return n.on("modify",()=>{r.startTime=window.performance.now()}),n.on("afterModify",()=>{r.endTime=window.performance.now(),i.push(r.endTime-r.startTime)}),s(),i}emit(e){tr(this,e.type,e)}modify(e,t){let i=this;return new Promise((n,s)=>{e.modified||(e.modified=e.clone(!1,t));try{n(i.modifyTable(e,t))}catch(n){i.emit({type:"error",detail:t,table:e}),s(n instanceof Error?n:Error(""+n))}})}on(e,t){return to(this,e,t)}}tl.types={};let th=tl,tc={convertToNumber:function(e,t){switch(typeof e){case"boolean":return+!!e;case"number":return isNaN(e)&&!t?null:e;default:return isNaN(e=parseFloat(`${e??""}`))&&!t?null:e}},setLength:function(e,t,i){return Array.isArray(e)?(e.length=t,e):e[i?"subarray":"slice"](0,t)},splice:function(e,t,i,n,s=[]){if(Array.isArray(e))return Array.isArray(s)||(s=Array.from(s)),{removed:e.splice(t,i,...s),array:e};let o=Object.getPrototypeOf(e).constructor,r=e[n?"subarray":"slice"](t,t+i),a=new o(e.length-i+s.length);return a.set(e.subarray(0,t),0),a.set(s,t),a.set(e.subarray(t+i),t+s.length),{removed:r,array:a}}},{setLength:td,splice:tu}=tc,{fireEvent:tp,objectEach:tm,uniqueKey:tf}=I,tg=class{constructor(e={}){this.autoId=!e.id,this.columns={},this.id=e.id||tf(),this.rowCount=0,this.versionTag=tf();let t=0;tm(e.columns||{},(e,i)=>{this.columns[i]=e.slice(),t=Math.max(t,e.length)}),this.applyRowCount(t)}applyRowCount(e){this.rowCount=e,tm(this.columns,(t,i)=>{t.length!==e&&(this.columns[i]=td(t,e))})}deleteRows(e,t=1){if(t>0&&e<this.rowCount){let i=0;tm(this.columns,(n,s)=>{this.columns[s]=tu(n,e,t).array,i=n.length}),this.rowCount=i}tp(this,"afterDeleteRows",{rowIndex:e,rowCount:t}),this.versionTag=tf()}getColumn(e,t){return this.columns[e]}getColumns(e,t){return(e||Object.keys(this.columns)).reduce((e,t)=>(e[t]=this.columns[t],e),{})}getRow(e,t){return(t||Object.keys(this.columns)).map(t=>this.columns[t]?.[e])}setColumn(e,t=[],i=0,n){this.setColumns({[e]:t},i,n)}setColumns(e,t,i){let n=this.rowCount;tm(e,(e,t)=>{this.columns[t]=e.slice(),n=e.length}),this.applyRowCount(n),i?.silent||(tp(this,"afterSetColumns"),this.versionTag=tf())}setRow(e,t=this.rowCount,i,n){let{columns:s}=this,o=i?this.rowCount+1:t+1,r=Object.keys(e);if(n?.addColumns!==!1)for(let e=0,t=r.length;e<t;e++){let t=r[e];s[t]||(s[t]=[])}tm(s,(r,a)=>{r||n?.addColumns===!1||(r=Array(o)),r&&(i?r=tu(r,t,0,!0,[e[a]??null]).array:r[t]=e[a]??null,s[a]=r)}),o>this.rowCount&&this.applyRowCount(o),n?.silent||(tp(this,"afterSetRows"),this.versionTag=tf())}getModified(){return this.modified||this}},{splice:ty,setLength:tb}=tc,{addEvent:tC,defined:tw,extend:tv,fireEvent:tO,isNumber:tx,uniqueKey:tT}=I;class tE extends tg{constructor(e={}){super(e),this.metadata=e.metadata}clone(e,t){let i={};this.emit({type:"cloneTable",detail:t}),e||(i.columns=this.columns),this.autoId||(i.id=this.id);let n=new tE(i);return e||(n.versionTag=this.versionTag,n.originalRowIndexes=this.originalRowIndexes,n.localRowIndexes=this.localRowIndexes),n.metadata={...this.metadata},this.emit({type:"afterCloneTable",detail:t,tableClone:n}),n}deleteColumns(e,t){let i=this.columns,n={},s={},o=this.modifier,r=this.rowCount;if((e=e||Object.keys(i)).length){this.emit({type:"deleteColumns",columnIds:e,detail:t});for(let t=0,o=e.length,a,l;t<o;++t)(a=i[l=e[t]])&&(n[l]=a,s[l]=Array(r)),delete i[l];return Object.keys(i).length||(this.rowCount=0,this.deleteRowIndexReferences()),o&&o.modifyTable(this),this.emit({type:"afterDeleteColumns",columns:n,columnIds:e,detail:t}),n}}deleteRowIndexReferences(){delete this.originalRowIndexes,delete this.localRowIndexes}deleteRows(e,t=1,i){let n,s,{columns:o,modifier:r}=this,a=[];if(tw(e)?Array.isArray(e)?s=(n=e.filter((e,t,i)=>e>=0&&e<this.rowCount&&i.indexOf(e)===t).sort((e,t)=>t-e)).length:(n=[e],s=t):(n=[0],s=this.rowCount),this.emit({type:"deleteRows",detail:i,rowCount:s,rowIndex:e??0}),s>0){let e=Object.keys(o);for(let t=0;t<e.length;++t){let i,r=e[t],l=o[r];if(1===n.length&&s>1){let e=ty(l,n[0],s);i=e.removed,o[r]=e.array}else{for(let e of(i=[],n))i.push(l[e]),ty(l,e,1);i.reverse()}t||(this.rowCount=l.length);for(let e=0,n=i.length;e<n;++e)a[e]=a[e]||[],a[e][t]=i[e]}}return r&&r.modifyTable(this),this.emit({type:"afterDeleteRows",detail:i,rowCount:s,rowIndex:e??0,rows:a}),a}emit(e){["afterDeleteColumns","afterDeleteRows","afterSetCell","afterSetColumns","afterSetRows"].includes(e.type)&&(this.versionTag=tT()),tO(this,e.type,e)}getCell(e,t){let i=this.columns[e];if(i)return i[t]}getColumn(e,t){return this.getColumns([e],t)[e]}getColumnIds(){return Object.keys(this.columns)}getColumns(e,t,i){let n=this.columns,s={};e=e||Object.keys(n);for(let o=0,r=e.length,a,l;o<r;++o)(a=n[l=e[o]])&&(t?s[l]=a:i&&!Array.isArray(a)?s[l]=Array.from(a):s[l]=a.slice());return s}getLocalRowIndex(e){let{localRowIndexes:t}=this;return t?t[e]:e}getModifier(){return this.modifier}getOriginalRowIndex(e){let{originalRowIndexes:t}=this;return t?t[e]:e}getRow(e,t){return this.getRows(e,1,t)[0]}getRowCount(){return this.rowCount}getRowIndexBy(e,t,i){let n=this.columns[e];if(n){let e=-1;if(Array.isArray(n)?e=n.indexOf(t,i):tx(t)&&(e=n.indexOf(t,i)),-1!==e)return e}}getRowObject(e,t){return this.getRowObjects(e,1,t)[0]}getRowObjects(e=0,t=this.rowCount-e,i){let n=this.columns,s=Array(t);i=i||Object.keys(n);for(let o=e,r=0,a=Math.min(this.rowCount,e+t),l,h;o<a;++o,++r)for(let e of(h=s[r]={},i))l=n[e],h[e]=l?l[o]:void 0;return s}getRows(e=0,t=this.rowCount-e,i){let n=this.columns,s=Array(t);i=i||Object.keys(n);for(let o=e,r=0,a=Math.min(this.rowCount,e+t),l,h;o<a;++o,++r)for(let e of(h=s[r]=[],i))l=n[e],h.push(l?l[o]:void 0);return s}getVersionTag(){return this.versionTag}hasColumns(e){let t=this.columns;for(let i=0,n=e.length;i<n;++i)if(!t[e[i]])return!1;return!0}hasRowWith(e,t){let i=this.columns[e];return Array.isArray(i)?-1!==i.indexOf(t):!!(tw(t)&&Number.isFinite(t))&&-1!==i.indexOf(+t)}on(e,t){return tC(this,e,t)}changeColumnId(e,t){let i=this.columns;return!!i[e]&&(e!==t&&(i[t]=i[e],delete i[e]),!0)}setCell(e,t,i,n){let s=this.columns,o=this.modifier,r=s[e];r&&r[t]===i||(this.emit({type:"setCell",cellValue:i,columnId:e,detail:n,rowIndex:t}),r||(r=s[e]=Array(this.rowCount)),t>=this.rowCount&&(this.rowCount=t+1),r[t]=i,o&&o.modifyTable(this),this.emit({type:"afterSetCell",cellValue:i,columnId:e,detail:n,rowIndex:t}))}setColumns(e,t,i,n){let s=this.columns,o=this.modifier,r=Object.keys(e),a=this.rowCount;if(this.emit({type:"setColumns",columns:e,columnIds:r,detail:i,rowIndex:t}),tw(t)||n){for(let i=0,o=r.length,l,h,c,d;i<o;++i){l=e[c=r[i]],d=Object.getPrototypeOf((h=s[c])&&n?h:l).constructor,h?d===Array?Array.isArray(h)||(h=Array.from(h)):h.length<a&&(h=new d(a)).set(s[c]):h=new d(a),s[c]=h;for(let e=t||0,i=l.length;e<i;++e)h[e]=l[e];a=Math.max(a,l.length)}this.applyRowCount(a)}else super.setColumns(e,t,tv(i,{silent:!0}));o&&o.modifyTable(this),this.emit({type:"afterSetColumns",columns:e,columnIds:r,detail:i,rowIndex:t})}setModifier(e,t){let i=this;return i.emit({type:"setModifier",detail:t,modifier:e,modified:i.getModified()}),i.modifier=e,(e?e.modify(i):Promise.resolve(i)).then(i=>(i.emit({type:"afterSetModifier",detail:t,modifier:e,modified:i.getModified()}),i)).catch(t=>{throw i.emit({type:"setModifierError",error:t,modifier:e,modified:i.getModified()}),t})}setOriginalRowIndexes(e,t=!1){if(this.originalRowIndexes=e,t)return;let i=this.localRowIndexes=[];for(let t=0,n=e.length,s;t<n;++t)tw(s=e[t])&&(i[s]=t)}setRow(e,t,i,n){this.setRows([e],t,i,n)}setRows(e,t=this.rowCount,i,n){let s=this.columns,o=Object.keys(s),r=this.modifier,a=e.length;this.emit({type:"setRows",detail:n,rowCount:a,rowIndex:t,rows:e});for(let n=0,r=t,l;n<a;++n,++r)if(0===Object.keys(l=e[n]).length)for(let e=0,t=o.length;e<t;++e){let t=s[o[e]];i?s[o[e]]=ty(t,r,0,!0,[null]).array:t[r]=null}else if(Array.isArray(l))for(let e=0,t=o.length;e<t;++e)s[o[e]][r]=l[e];else super.setRow(l,r,i,{silent:!0});let l=i?a+e.length:t+a;if(l>this.rowCount){this.rowCount=l;for(let e=0,t=o.length;e<t;++e){let t=o[e];s[t]=tb(s[t],l)}}r&&r.modifyTable(this),this.emit({type:"afterSetRows",detail:n,rowCount:a,rowIndex:t,rows:e})}}let{addEvent:tN,fireEvent:tM,merge:tS,pick:tR}=I;class tA{static registerType(e,t){return!!e&&!tA.types[e]&&!!(tA.types[e]=t)}get polling(){return!!this._polling}constructor(e){this.dataTables={},this.loaded=!1,this.metadata=e.metadata||{columns:{}},this.options=e;const t=e?.dataTables;let i=0;if(e.options&&console.error("The `DataConnectorOptions.options` property was removed in Dashboards v4.0.0. Check how to upgrade your connector to use the new options structure here: https://api.highcharts.com/dashboards/#interfaces/Data_DataTableOptions.DataTableOptions"),t&&t?.length>0)for(let e=0,n=t.length;e<n;++e){const n=t[e],s=n?.key;this.dataTables[s??i]=new tE(n),!s&&i++}else this.dataTables[0]=new tE({id:e.id})}getTable(e){return e?this.dataTables[e]:Object.values(this.dataTables)[0]}describeColumn(e,t){let i=this.metadata.columns;i[e]=tS(i[e]||{},t)}describeColumns(e){let t,i=Object.keys(e);for(;"string"==typeof(t=i.pop());)this.describeColumn(t,e[t])}getColumnOrder(){let e=this.metadata.columns,t=Object.keys(e||{});if(t.length)return t.sort((t,i)=>tR(e[t].index,0)-tR(e[i].index,0))}getSortedColumns(){return this.getTable().getColumns(this.getColumnOrder())}setColumnOrder(e){for(let t=0,i=e.length;t<i;++t)this.describeColumn(e[t],{index:t})}async update(e,t=!0){this.emit({type:"beforeUpdate"}),tS(!0,this.options,e);let{options:i}=this;("enablePolling"in e||"dataRefreshRate"in e)&&("enablePolling"in i&&i.enablePolling?(this.stopPolling(),this.startPolling("dataRefreshRate"in i&&"number"==typeof i.dataRefreshRate?1e3*Math.max(i.dataRefreshRate,1):1e3)):this.stopPolling()),t&&await this.load(),this.emit({type:"afterUpdate"})}load(){return this.emit({type:"afterLoad"}),Promise.resolve(this)}async applyTableModifiers(){let e=this.options?.dataTables;for(let[t,i]of Object.entries(this.dataTables)){let n=e?.find(e=>e.key===t)?.dataModifier??this.options?.dataModifier,s=n&&th.types[n.type];await i.setModifier(s?new s(n):void 0)}return this}startPolling(e=1e3){let t=this;this.pollingController=new AbortController,window.clearTimeout(t._polling),t._polling=window.setTimeout(()=>t.load().catch(e=>t.emit({type:"loadError",error:e})).then(()=>{t._polling&&t.startPolling(e)}),e)}stopPolling(){this.polling&&(this?.pollingController?.abort(),window.clearTimeout(this._polling),delete this._polling)}emit(e){tM(this,e.type,e)}on(e,t){return tN(this,e,t)}initConverters(e,t,i){let n=0;for(let[s,o]of Object.entries(this.dataTables)){let r=t(s),a=i(r,e);o.deleteColumns(),o.setColumns(a),0===n&&(this.converter=r),n++}}}tA.types={};let tP=tA,{merge:tI,fireEvent:tL}=I;class tD extends tP{constructor(e){const t=tI(tD.defaultOptions,e);super(t),this.options=t,t.enablePolling&&this.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}emit(e){tL(this,e.type,e)}load(e){let t=this,i=t.options,{csv:n,csvURL:s,dataTables:o,decimalPoint:r}=i;return t.emit({type:"load",csv:n}),Promise.resolve(s?fetch(s,{signal:t?.pollingController?.signal}).then(e=>e.text()):n||"").then(e=>(e&&this.initConverters(e,e=>{let{firstRowAsNames:t=i.firstRowAsNames,beforeParse:n=i.beforeParse}=o?.find(t=>t.key===e)||{};return new ts(tI(i,{decimalPoint:r,firstRowAsNames:t,beforeParse:n}))},(e,t)=>e.parse({csv:t})),t.applyTableModifiers().then(()=>e))).then(i=>(t.emit({type:"afterLoad",detail:e,csv:i}),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}tD.defaultOptions={id:"csv-connector",type:"CSV",csv:"",csvURL:"",enablePolling:!1,dataRefreshRate:1,firstRowAsNames:!0},tP.registerType("CSV",tD);let{merge:tk,uniqueKey:tH}=I;class tj extends ti{constructor(e){const t=tk(tj.defaultOptions,e);super(t),this.header=[],this.options=t}parse(e,t){let i,n=tk(this.options,e),s=(n.json?.values||[]).map(e=>e.slice());if(0===s.length)return{};this.header=[],this.emit({type:"parse",columns:[],detail:t,headers:this.header});let{beforeParse:o,json:r}=n;o&&r&&(s=o(r.values));for(let e=0,t=s.length;e<t;e++){i=s[e],this.header[e]=n.firstRowAsNames?`${i.shift()}`:tH();for(let t=0,n=i.length;t<n;++t){var a;let n=i[t];a=n,"[object Date]"===Object.prototype.toString.call(a)&&(n=n.getTime()),s[e][t]=n}}return this.emit({type:"afterParse",columns:s,detail:t,headers:this.header}),e4(s,this.header)}}tj.defaultOptions={...ti.defaultOptions},ti.registerType("GoogleSheets",tj);let{merge:tF,pick:tz,fireEvent:tV}=I;class t$ extends tP{constructor(e){const t=tF(t$.defaultOptions,e);super(t),this.options=t}emit(e){tV(this,e.type,e)}load(e){let t=this,i=t.options,{dataRefreshRate:n,enablePolling:s,googleAPIKey:o,googleSpreadsheetKey:r,dataTables:a}=i,l=function(e,t,i={}){let n=new URL(`https://sheets.googleapis.com/v4/spreadsheets/${t}/values/`),s=i.onlyColumnIds?"A1:Z1":function(e={}){let{endColumn:t,endRow:i,googleSpreadsheetRange:n,startColumn:s,startRow:o}=e;return n||(tB[s||0]||"A")+(Math.max(o||0,0)+1)+":"+(tB[tz(t,25)]||"Z")+(i?Math.max(i,0):"Z")}(i);n.pathname+=s;let o=n.searchParams;return o.set("alt","json"),i.onlyColumnIds||(o.set("dateTimeRenderOption","FORMATTED_STRING"),o.set("majorDimension","COLUMNS"),o.set("valueRenderOption","UNFORMATTED_VALUE")),o.set("prettyPrint","false"),o.set("key",e),n.href}(o,r,i);if(t.emit({type:"load",detail:e,url:l}),!URL.canParse(l))throw Error("Invalid URL: "+l);return fetch(l,{signal:t?.pollingController?.signal}).then(e=>e.json()).then(e=>{if("object"==typeof e&&e&&"object"==typeof e.error&&e.error&&"number"==typeof e.error.code&&"string"==typeof e.error.message&&"string"==typeof e.error.status)throw Error(e.error.message);return this.initConverters(e,e=>{let{firstRowAsNames:t=i.firstRowAsNames,beforeParse:n=i.beforeParse}=a?.find(t=>t.key===e)||{};return new tj({firstRowAsNames:t,beforeParse:n})},(e,t)=>e.parse({json:t})),t.applyTableModifiers()}).then(()=>(t.emit({type:"afterLoad",detail:e,url:l}),s&&setTimeout(()=>t.load(),1e3*Math.max(n||0,1)),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}t$.defaultOptions={id:"google-sheets-connector",type:"GoogleSheets",googleAPIKey:"",googleSpreadsheetKey:"",enablePolling:!1,dataRefreshRate:2,firstRowAsNames:!0};let tB="ABCDEFGHIJKLMNOPQRSTUVWXYZ";tP.registerType("GoogleSheets",t$);let{merge:tU}=I;class tY extends ti{constructor(e){const t=tU(tY.defaultOptions,e);super(t),this.headers=[],this.options=t,t.tableElement&&(this.tableElement=t.tableElement,this.tableElementID=t.tableElement.id)}export(e,t=this.options){let i=!1!==t.firstRowAsNames,n=t.useMultiLevelHeaders,s=e.getSortedColumns(),o=Object.keys(s),r=[],a=o.length,l=[],h="";if(i){let e=[];if(n){for(let t of o){let i=s[t];Array.isArray(i)||(i=Array.from(i));let n=(i.shift()||"").toString();s[t]=i,e.push(n)}h=this.getTableHeaderHTML(o,e,t)}else h=this.getTableHeaderHTML(void 0,o,t)}for(let e=0;e<a;e++){let t=s[o[e]],i=t.length;for(let n=0;n<i;n++){let i=t[n];l[n]||(l[n]=[]),"string"!=typeof i&&"number"!=typeof i&&void 0!==i&&(i=(i||"").toString()),l[n][e]=this.getCellHTMLFromValue(e?"td":"th",null,e?"":'scope="row"',i),e===a-1&&r.push("<tr>"+l[n].join("")+"</tr>")}}let c="";return t.tableCaption&&(c='<caption class="highcharts-table-caption">'+t.tableCaption+"</caption>"),"<table>"+c+h+"<tbody>"+r.join("")+"</tbody></table>"}getCellHTMLFromValue(e,t,i,n,s){let o=n,r="text"+(t?" "+t:"");return"number"==typeof o?(o=o.toString(),","===s&&(o=o.replace(".",s)),r="number"):n||(o="",r="empty"),"<"+e+(i?" "+i:"")+' class="'+r+'">'+o+"</"+e+">"}getTableHeaderHTML(e=[],t=[],i=this.options){let{useMultiLevelHeaders:n,useRowspanHeaders:s}=i,o="<thead>",r=0,a=t&&t.length,l,h=0,c;if(n&&e&&t&&!function(e,t){let i=e.length;if(t.length!==i)return!1;for(;--i;)if(e[i]!==t[i])return!1;return!0}(e,t)){for(o+="<tr>";r<a;++r)(l=e[r])===e[r+1]?++h:h?(o+=this.getCellHTMLFromValue("th","highcharts-table-topheading",'scope="col" colspan="'+(h+1)+'"',l),h=0):(l===t[r]?s?(c=2,t.splice(r,1)):(c=1,t[r]=""):c=1,o+=this.getCellHTMLFromValue("th","highcharts-table-topheading",'scope="col"'+(c>1?' valign="top" rowspan="'+c+'"':""),l));o+="</tr>"}if(t){for(o+="<tr>",r=0,a=t.length;r<a;++r)void 0!==t[r]&&(o+=this.getCellHTMLFromValue("th",null,'scope="col"',t[r]));o+="</tr>"}return o+"</thead>"}parse(e,t){let i=[],n=[],s=tU(this.options,e),{endRow:o,startColumn:r,endColumn:a,firstRowAsNames:l}=s,h=s.tableElement||this.tableElement;if(!(h instanceof HTMLElement))return this.emit({type:"parseError",columns:i,detail:t,headers:n,error:"Not a valid HTML Table"}),{};this.tableElement=h,this.tableElementID=h.id,this.emit({type:"parse",columns:i,detail:t,headers:this.headers});let c=h.getElementsByTagName("tr"),d=c.length,u=0,p,{startRow:m}=s;if(l&&d){let e=c[0].children,t=e.length;for(let i=r;i<t&&!(i>a);i++)("TD"===(p=e[i]).tagName||"TH"===p.tagName)&&n.push(p.innerHTML);m++}for(;u<d;){if(u>=m&&u<=o){let e=c[u].children,t=e.length,n=0;for(;n<t;){let t=n-r,s=i[t];if(("TD"===(p=e[n]).tagName||"TH"===p.tagName)&&n>=r&&n<=a){i[t]||(i[t]=[]);let e=this.convertByType(p.innerHTML);e instanceof Date&&(e=e.getTime()),i[t][u-m]=e;let n=1;for(;u-m>=n&&void 0===s[u-m-n];)s[u-m-n]=null,n++}n++}}u++}return this.headers=n,this.emit({type:"afterParse",columns:i,detail:t,headers:n}),e4(i,this.headers)}}tY.defaultOptions={...ti.defaultOptions,useRowspanHeaders:!0,useMultiLevelHeaders:!0,startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE},ti.registerType("HTMLTable",tY);let{win:t_}=a,{merge:tG}=I;class tW extends tP{constructor(e){const t=tG(tW.defaultOptions,e);super(t),this.options=t,this.converter=new tY(t)}async load(e){let t,i=this.options,n=this.converter,s=this.getTable(),o=i.htmlTable;if(this.emit({type:"load",detail:e}),"string"==typeof o?(this.tableID=o,t=t_.document.getElementById(o)):(t=o,this.tableID=t.id),this.tableElement=t||void 0,!this.tableElement){let t="HTML table not provided, or element with ID not found";return this.emit({type:"loadError",detail:e,error:t}),Promise.reject(Error(t))}let r=n.parse(tG({tableElement:this.tableElement},i),e);return s.deleteColumns(),s.setColumns(r),await this.applyTableModifiers(),this.emit({type:"afterLoad",detail:e}),this}}tW.defaultOptions={id:"HTML-table-connector",type:"HTMLTable",htmlTable:""},tP.registerType("HTMLTable",tW);let{error:tK,isArray:tJ,merge:tq,objectEach:tZ}=I;class tX extends ti{constructor(e){const t=tq(tX.defaultOptions,e);super(t),this.headerColumnIds=[],this.headers=[],this.options=t}parse(e,t){let{beforeParse:i,orientation:n,firstRowAsNames:s,columnIds:o}=e=tq(this.options,e),r=e.data;if(!r)return{};this.headers=[];let a=[];return this.emit({type:"parse",columns:a,detail:t,headers:this.headers}),i&&(r=i(r)),r=r.slice(),"columns"===n?this.parseColumnsOrientation(a,r,s,o):"rows"===n&&this.parseRowsOrientation(a,r,s,o),this.emit({type:"afterParse",columns:a,detail:t,headers:this.headers}),e4(a,this.headers)}parseColumnsOrientation(e,t,i,n){for(let s=0,o=t.length;s<o;s++){let o=t[s];if(!Array.isArray(o))return;Array.isArray(this.headers)?(i?this.headers.push(`${o.shift()}`):n&&Array.isArray(n)&&this.headers.push(n[s]),e.push(o)):tK("JSONConverter: Invalid `columnIds` option.",!1)}}parseRowsOrientation(e,t,i,n){i?this.headers=t.shift():n&&(this.headerColumnIds=n);for(let s=0,o=t.length;s<o;s++){let o=t[s];tJ(o)||(o=this.convertItemToRow(o,n));for(let t=0,n=o.length;t<n;t++)e.length<t+1&&e.push([]),e[t].push(o[t]),i||0!==s||(Array.isArray(this.headerColumnIds)?this.headers.push(this.headerColumnIds[t]||t.toString()):tK("JSONConverter: Invalid `columnIds` option.",!1))}}convertItemToRow(e,t){let i=this;if(t&&!Array.isArray(t)){let n=[];return tZ(t,(t,s)=>{n.push(t.reduce((e,t)=>e[t],e)),0>i.headers.indexOf(s)&&i.headers.push(s)}),n}return i.headerColumnIds=Object.keys(e),Object.values(e)}}tX.defaultOptions={...ti.defaultOptions,orientation:"rows"},ti.registerType("JSON",tX);let{merge:tQ,fireEvent:t0}=I;class t1 extends tP{constructor(e){const t=tQ(t1.defaultOptions,e);super(t),this.options=t,t.enablePolling&&this.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}emit(e){t0(this,e.type,e)}load(e){let t=this,i=t.options,{data:n,dataUrl:s,dataTables:o}=i;return t.emit({type:"load",detail:e,data:n}),Promise.resolve(s?fetch(s,{signal:t?.pollingController?.signal}).then(e=>e.json()).catch(i=>{t.emit({type:"loadError",detail:e,error:i}),console.warn(`Unable to fetch data from ${s}.`)}):n||[]).then(async e=>(e&&this.initConverters(e,t=>{let{columnIds:n=i.columnIds,firstRowAsNames:s=i.firstRowAsNames,orientation:r=i.orientation,beforeParse:a=i.beforeParse}=o?.find(e=>e.key===t)||{};return new tX({data:e,columnIds:n,firstRowAsNames:s,orientation:r,beforeParse:a})},(e,t)=>e.parse({data:t})),t.applyTableModifiers().then(()=>e??[]))).then(i=>(t.emit({type:"afterLoad",detail:e,data:i}),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}t1.defaultOptions={type:"JSON",id:"json-connector",data:[],enablePolling:!1,dataRefreshRate:0,firstRowAsNames:!0,orientation:"rows"},tP.registerType("JSON",t1);let{addEvent:t2,fireEvent:t3,merge:t6}=I;class t5 extends th{constructor(e,...t){super(),this.chain=t,this.options=t6(t5.defaultOptions,e);const i=this.options.chain||[];for(let e=0,n=i.length,s,o;e<n;++e)(s=i[e]).type&&(o=th.types[s.type])&&t.push(new o(s))}add(e,t){this.emit({type:"addModifier",detail:t,modifier:e}),this.chain.push(e),this.emit({type:"addModifier",detail:t,modifier:e})}clear(e){this.emit({type:"clearChain",detail:e}),this.chain.length=0,this.emit({type:"afterClearChain",detail:e})}async modify(e,t){let i=this.options.reverse?this.chain.slice().reverse():this.chain.slice();e.modified||(e.modified=e.clone(!1,t));let n=e;for(let s=0,o=i.length;s<o;++s){try{await i[s].modify(n,t)}catch(i){throw this.emit({type:"error",detail:t,table:e}),i}n=n.getModified()}return e.modified=n,e}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let i=this.options.reverse?this.chain.reverse():this.chain.slice(),n=e.getModified();for(let e=0,s=i.length;e<s;++e)n=i[e].modifyTable(n,t).getModified();return e.modified=n,this.emit({type:"afterModify",detail:t,table:e}),e}remove(e,t){let i=this.chain;this.emit({type:"removeModifier",detail:t,modifier:e}),i.splice(i.indexOf(e),1),this.emit({type:"afterRemoveModifier",detail:t,modifier:e})}emit(e){t3(this,e.type,e)}on(e,t){return t2(this,e,t)}}t5.defaultOptions={type:"Chain"},th.registerType("Chain",t5);let{merge:t4}=I;class t9 extends th{constructor(e){super(),this.options=t4(t9.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let i=e.getModified();if(e.hasColumns(["columnIds"])){let t=(e.deleteColumns(["columnIds"])||{}).columnIds||[],n={},s=[];for(let e=0,i=t.length;e<i;++e)s.push(""+t[e]);for(let t=0,i=e.getRowCount(),o;t<i;++t)(o=e.getRow(t))&&(n[s[t]]=o);i.deleteColumns(),i.setColumns(n)}else{let t={};for(let i=0,n=e.getRowCount(),s;i<n;++i)(s=e.getRow(i))&&(t[`${i}`]=s);t.columnIds=e.getColumnIds(),i.deleteColumns(),i.setColumns(t)}return this.emit({type:"afterModify",detail:t,table:e}),e}}t9.defaultOptions={type:"Invert"},th.registerType("Invert",t9);let{merge:t8}=I;class t7 extends th{constructor(e){super(),this.options=t8(t7.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let{start:i,end:n}=this.options;i=Math.max(0,i||0);let s=Math.max((n=Math.min(n||1/0,e.getRowCount()))-i,0),o=e.getModified();return o.deleteRows(),o.setRows(e.getRows(i,s)),o.setOriginalRowIndexes(Array.from({length:s},(t,n)=>e.getOriginalRowIndex(i+n))),this.emit({type:"afterModify",detail:t,table:e}),e}}t7.defaultOptions={type:"Range",start:0,end:1/0},th.registerType("Range",t7);let{merge:ie}=I;class it extends th{static ascending(e,t){return(e||0)<(t||0)?-1:+((e||0)>(t||0))}static descending(e,t){return(t||0)<(e||0)?-1:+((t||0)>(e||0))}static compareFactory(e,t){return t?"desc"===e?(e,i)=>-t(e,i):t:"asc"===e?it.ascending:it.descending}constructor(e){super(),this.options=ie(it.defaultOptions,e)}getRowReferences(e){let t=e.getRows(),i=[];for(let e=0,n=t.length;e<n;++e)i.push({index:e,row:t[e]});return i}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let i=e.getColumnIds(),n=e.getRowCount(),s=this.getRowReferences(e),{direction:o,orderInColumn:r,compare:a}=this.options,l=e.getModified(),h="columns"in this.options?this.options.columns:[this.options.orderByColumn],c=[];for(let e=0,t=h.length;e<t;++e){let t=h[e],n="string"==typeof t,s=n?t:t.column,r=i.indexOf(s);-1!==r&&c.push({columnIndex:r,compare:it.compareFactory(n?o:t.direction||o,n?a:t.compare||a)})}if(c.length&&s.sort((e,t)=>{for(let i=0,n=c.length;i<n;++i){let{columnIndex:n,compare:s}=c[i],o=s(e.row[n],t.row[n]);if(o)return o}return e.index-t.index}),r){let e=[];for(let t=0;t<n;++t)e[s[t].index]=t;l.setColumns({[r]:e})}else{let t,i=[],o=[];for(let r=0;r<n;++r)t=s[r],i.push(e.getOriginalRowIndex(t.index)),o.push(t.row);l.setRows(o,0),l.setOriginalRowIndexes(i)}return this.emit({type:"afterModify",detail:t,table:e}),e}}it.defaultOptions={type:"Sort",direction:"desc",orderByColumn:"y"},th.registerType("Sort",it);let{isFunction:ii,merge:is}=I;class io extends th{static compile(e){if(ii(e))return e;let t=e.operator;switch(t){case"and":{let t=e.conditions.map(e=>this.compile(e));return(e,i,n)=>t.every(t=>t(e,i,n))}case"or":{let t=e.conditions.map(e=>this.compile(e));return(e,i,n)=>t.some(t=>t(e,i,n))}case"not":{let t=this.compile(e.condition);return(e,i,n)=>!t(e,i,n)}}let{columnId:i,value:n}=e;switch(t){case"==":return e=>e[i]==n;case"===":return e=>e[i]===n;case"!=":return e=>e[i]!=n;case"!==":return e=>e[i]!==n;case">":return e=>(e[i]||0)>(n||0);case">=":return e=>(e[i]||0)>=(n||0);case"<":return e=>(e[i]||0)<(n||0);case"<=":return e=>(e[i]||0)<=(n||0);case"empty":return e=>null===e[i]||""===e[i]}let{ignoreCase:s}=e,o=e=>{let t=""+e;return s??!0?t.toLowerCase():t};return"contains"===t?e=>o(e[i]).includes(o(n)):e=>o(e[i])[t](o(n))}constructor(e){super(),this.options=is(io.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let{condition:i}=this.options;if(!i)return e;let n=io.compile(i),s=e.getModified(),o=[],r=[];for(let t=0,i=e.getRowCount();t<i;++t){let i=e.getRowObject(t);i&&n(i,e,t)&&(o.push(i),r.push(e.getOriginalRowIndex(t)))}return s.deleteRows(),s.setRows(o),s.setOriginalRowIndexes(r),this.emit({type:"afterModify",detail:t,table:e}),e}}io.defaultOptions={type:"Filter"},th.registerType("Filter",io);let ir={},ia=function(e){if(ir[e.$class])throw Error("A serializer for '"+e.$class+"' is already registered.");ir[e.$class]=e},il={$class:"Data.DataTable",fromJSON:function(e){return new tE({columns:e.columns,id:e.id})},jsonSupportFor:function(e){return e instanceof tE},toJSON:function(e){let t={$class:"Data.DataTable",columns:e.getColumns(void 0,!1,!0)};return e.autoId||(t.id=e.id),t}};ia(il);let{merge:ih}=I;ia({$class:"Data.CSVConnector",fromJSON:function(e){return new tD(e.options)},jsonSupportFor:function(e){return e instanceof tD},toJSON:function(e){let t=ih(e.options);return t.dataTable=il.toJSON(e.getTable()),{$class:"Data.CSVConnector",options:t}}});let{merge:ic}=I;function id(e,t){if("position"===e.type){for(let i,n=0,s=t.length;n<s;++n)if("position"===(i=t[n]).type&&i.state===e.state&&i.column===e.column&&i.row===e.row)return n}else{let i=JSON.stringify(e.columns);for(let n,s=0,o=t.length;s<o;++s)if("range"===(n=t[s]).type&&n.state===e.state&&n.firstRow===e.firstRow&&n.lastRow===e.lastRow&&JSON.stringify(n.columns)===i)return s}return -1}ia({$class:"Data.DataConverter",fromJSON:function(e){return new ti(e.options)},jsonSupportFor:function(e){return e instanceof ti},toJSON:function(e){return{$class:"Data.DataConverter",options:ic(e.options)}}});let iu=class{constructor(e={}){this.emittingRegister=[],this.listenerMap={},this.stateMap=e}addListener(e,t,i){let n=this.listenerMap[e]=this.listenerMap[e]||{};return(n[t]=n[t]||[]).push(i),this}buildEmittingTag(e){return("position"===e.cursor.type?[e.table.id,e.cursor.column,e.cursor.row,e.cursor.state,e.cursor.type]:[e.table.id,e.cursor.columns,e.cursor.firstRow,e.cursor.lastRow,e.cursor.state,e.cursor.type]).join("\0")}emitCursor(e,t,i,n){let s=e.id,o=t.state,r=this.listenerMap[s]&&this.listenerMap[s][o];if(r){let o=this.stateMap[s]=this.stateMap[s]??{},a=o[t.state]||[];n&&(a.length||(o[t.state]=a),-1===id(t,a)&&a.push(t));let l={cursor:t,cursors:a,table:e};i&&(l.event=i);let h=this.emittingRegister,c=this.buildEmittingTag(l);if(h.indexOf(c)>=0)return this;try{this.emittingRegister.push(c);for(let e=0,t=r.length;e<t;++e)r[e].call(this,l)}finally{let e=this.emittingRegister.indexOf(c);e>=0&&this.emittingRegister.splice(e,1)}}return this}remitCursor(e,t){let i=this.stateMap[e]&&this.stateMap[e][t.state];if(i){let e=id(t,i);e>=0&&i.splice(e,1)}return this}removeListener(e,t,i){let n=this.listenerMap[e]&&this.listenerMap[e][t];if(n){let e=n.indexOf(i);e>=0&&n.splice(e,1)}return this}};ia({$class:"Data.DataCursor",fromJSON:function(e){return new iu(e.stateMap)},jsonSupportFor:function(e){return e instanceof iu},toJSON:function(e){let t,i,n,s,o,r=e.stateMap,a={},l=Object.keys(e.stateMap);for(let e=0,h=l.length;e<h;++e){o=Object.keys(r[n=l[e]]),a[n]={};for(let e=0,l=o.length;e<l;++e){s=o[e],t=r[n][s],a[n][s]=i=[];for(let e=0,n=t.length;e<n;++e)i.push({...t[e]})}}return{$class:"Data.DataCursor",stateMap:a}}});let{merge:ip}=I;ia({$class:"Data.GoogleSheetsConnector",fromJSON:function(e){return new t$(e.options||{googleAPIKey:"",googleSpreadsheetKey:""})},jsonSupportFor:function(e){return e instanceof t$},toJSON:function(e){let t=ip(e.options);return t.dataTable=il.toJSON(e.getTable()),{$class:"Data.GoogleSheetsConnector",options:t}}});let{merge:im}=I;ia({$class:"Data.HTMLTableConnector",fromJSON:function(e){return new tW(e.options)},jsonSupportFor:function(e){return e instanceof tW},toJSON:function(e){let t=im(e.options);return t.dataTable=il.toJSON(e.getTable()),{$class:"Data.HTMLTableConnector",options:t}}});let{merge:ig}=I,iy={},ib={registerComponent:function(e,t){return!!e&&!iy[e]&&!!(iy[e]=t)},types:iy},iC=class extends ea{constructor(e){super(),this.type="cell-html",this.options=e,this.id=e.id,this.container=e.container,this.mountedComponent=e.mountedComponent}destroy(){this.mountedComponent?.destroy(),super.destroy()}setHighlight(){this.container.classList.toggle(et.classNames.cellEditHighlight),this.mountedComponent?.board.container.classList.toggle(et.classNames.dashboardCellEditHighlightActive)}setActiveState(){this.container&&this.container.classList.add(Q.classNames.cellActive)}},{addEvent:iw,fireEvent:iv}=I;function iO(e,t){let i;"string"==typeof e&&document.querySelectorAll("#"+e).length>1&&console.warn(`Multiple cells have identical ID %c${e}%c, potentially leading to unexpected behavior. 
Ensure that each cell has a unique ID on the page.`,"font-weight: bold","");let n=t?t.querySelector("#"+e):document.getElementById(e);return null!==n&&iv(n,"bindedGUIElement",{},function(e){i=e.guiElement}),i}let ix={addComponent:async function e(e,t,i){let n=e.states,s=e.events,o=e.renderTo;if(!o)return void console.error("The%c renderTo%c option is required to render the component.","font-weight: bold","");if(t.mountedComponents.filter(e=>e.options.renderTo===o).length>0)return void console.error(`A component has already been declared in the cell %c${o}%c use a different cell.`,"font-weight: bold","");i=i||ix.getCell(o,t.container);let r=i?.container||document.querySelector("#"+o);if(!r||!e.type)return void console.error(`The component is unable to find the HTML cell element %c${o}%c to render the content.`,"font-weight: bold","");let a=ib.types[e.type];!a&&(console.error(`The component's type %c${e.type}%c does not exist.`,"font-weight: bold",""),i&&(a=ib.types.HTML,e.title={text:t.editMode?.lang.errorMessage||"Something went wrong",className:Q.classNamePrefix+"component-title-error "+Q.classNamePrefix+"component-title"}));let l=new a(i,e,t),h=l.load().catch(e=>{console.error(e),l.update({connector:{id:""},title:{text:t.editMode?.lang.errorMessage||"Something went wrong",className:Q.classNamePrefix+"component-title-error "+Q.classNamePrefix+"component-title"}})});return i&&(l.setCell(i),i.mountedComponent=l),t.mountedComponents.push({options:e,component:l,cell:i||new iC({id:o,container:r,mountedComponent:l})}),i&&n?.active?.enabled&&n?.active?.isActive&&(i.setActiveState(),l.isActive=!0),iv(l,"mount"),iw(r,"click",()=>{s&&s.click&&s.click.call(l),i&&l&&r&&n?.active?.enabled&&(i.setActiveState(),l.isActive=!0)}),n?.hover?.enabled&&r.classList.add(Q.classNames.cellHover),iv(l,"afterLoad"),h},getCell:function(e,t){let i=iO(e,t);if(i&&"cell"===i.getType())return i}},iT=class{constructor(e){this.board=e,this.addTabIndexToCells()}addTabIndexToCells(){let e,t=this.board.mountedComponents;for(let i=0,n=t.length;i<n;++i)(e=t[i].cell)&&e.container&&e.container.setAttribute("tabindex",-1)}},{addEvent:iE,fireEvent:iN,merge:iM}=I;class iS{constructor(e){this.options=iM(iS.defaultOptions,e),this.connectors={},this.waiting={}}emit(e){iN(this,e.type,e)}getConnector(e){let t=this.connectors[e];if(t?.loaded)return Promise.resolve(t);let i=this.waiting[e];if(!i){i=this.waiting[e]=[];let t=this.getConnectorOptions(e);if(!t)throw Error(`Connector '${e}' not found.`);this.loadConnector(t).then(t=>{delete this.waiting[e];for(let e=0,n=i.length;e<n;++e)i[e][0](t)}).catch(t=>{delete this.waiting[e];for(let e=0,n=i.length;e<n;++e)i[e][1](t)})}return new Promise((e,t)=>{i.push([e,t])})}getConnectorIds(){let e=this.options.connectors,t=[];for(let i=0,n=e.length;i<n;++i)t.push(e[i].id);return t}getConnectorOptions(e){let t=this.options.connectors;for(let i=0,n=t.length;i<n;++i)if(t[i].id===e)return t[i]}isNewConnector(e){return!this.connectors[e]}loadConnector(e){return new Promise((t,i)=>{this.emit({type:"load",options:e});let n=tP.types[e.type];if(!n)throw Error(`Connector type not found. (${e.type})`);let s=this.connectors[e.id]=new n(e);s.load().then(({converter:i})=>{s.converter=i,s.loaded=!0,this.emit({type:"afterLoad",options:e}),t(s)}).catch(i)})}cancelPendingRequests(){let{connectors:e}=this;for(let t of Object.keys(e))e[t].stopPolling()}on(e,t){return iE(this,e,t)}async setConnectorOptions(e,t){let i=this.options.connectors,n=this.connectors;this.emit({type:"setConnectorOptions",options:e});for(let t=0,n=i.length;t<n;++t)if(i[t].id===e.id){i.splice(t,1);break}let s=n[e.id];s&&(t?await s.update(e,!0):(s.stopPolling(),s=void 0,delete n[e.id])),s||i.push(e),this.emit({type:"afterSetConnectorOptions",options:e})}}iS.defaultOptions={connectors:[]};let{merge:iR}=I,iA={gui:{enabled:!0,layoutOptions:{rowClassName:void 0,cellClassName:void 0},layouts:[]},components:[]},{pick:iP,defined:iI,merge:iL,objectEach:iD,fireEvent:ik}=I;class iH extends ea{static setContainerHeight(e,t){t&&(e.style.height=t+"px")}constructor(e,t,i){super(),this.type=Q.guiElementType.row,this.layout=e,this.cells=[],this.options=t,this.isVisible=!0;const n=document.getElementById(t.parentContainerId||"")||e.container,s=e.options||{},o=s.rowClassName||"";this.container=this.getElementContainer({render:e.board.guiEnabled,parentContainer:n,attribs:{id:t.id,className:Q.classNames.row+" "+o},element:i,elementId:t.id,style:iL(s.style,t.style)}),this.options.cells&&this.setCells()}setCells(){let e,t,i,n=(this.layout.options||{}).cellClassName||"",s=iP(this.options.cells,this.container&&this.container.getElementsByClassName(n))||[];for(t=0,i=s.length;t<i;++t)e=s[t],this.addCell(this.layout.board.guiEnabled?e:{id:""},e instanceof HTMLElement?e:void 0)}addCell(e,t,i){let n=new ed(this,e,t);return iI(i)?this.mountCell(n,i):this.cells.push(n),this.layout.board.editMode&&this.layout.board.editMode.setCellEvents(n),n}destroy(){let{layout:e}=this,t=this.layout.board,i=t.editMode;if(this.cells){let e=[...this.cells];for(let t=0,i=e.length;t<i;++t)e[t]&&e[t].destroy()}this.layout&&(this.layout.unmountRow(this),super.destroy(),e.rows?.length===0&&e.destroy()),ik(i,"rowDestroyed",{target:this,board:t})}getOptions(){let e=[];for(let t=0,i=this.cells.length;t<i;++t)e.push(this.cells[t].getOptions());return{id:this.options.id,style:this.options.style,cells:e}}setSize(e){iH.setContainerHeight(this.container,e)}getCellIndex(e){for(let t=0,i=this.cells?.length;t<i;++t)if(this.cells[t].id===e.id)return t}mountCell(e,t=0){let i=this,n=i.cells[t],s=i.cells[t-1];e.container&&(n&&n.container?n.container.parentNode.insertBefore(e.container,n.container):s&&s.container?s.container.parentNode.insertBefore(e.container,s.container.nextSibling):s||n||!i.container||i.container.appendChild(e.container),i.cells.splice(t,0,e),e.row=i,setTimeout(()=>{ik(i,"cellChange",{row:i,cell:e})},0))}unmountCell(e){let t=this.getCellIndex(e);iI(t)&&this.cells.splice(t,1),setTimeout(()=>{ik(this,"cellChange",{row:this,cell:e})},0)}getVisibleCells(){let e=[];for(let t=0,i=this.cells.length;t<i;++t)this.cells[t].isVisible&&e.push(this.cells[t]);return e}changeVisibility(e=!0,t){super.changeVisibility(e,t),this.layout.getVisibleRows().length?this.isVisible&&!this.layout.isVisible&&this.layout.show():this.layout.hide()}show(){this.changeVisibility(!0,"flex")}setHighlight(e){let t=this.container.classList,i=et.classNames.rowContextHighlight;!0===e?t.remove(i):t.toggle(i,!e)}getRowLevels(){let e,t,i={},n=[];for(let n=0,s=this.cells.length;n<s;++n)(e=this.cells[n]).isVisible&&(i[(t=ea.getOffsets(e)).top]||(i[t.top]={top:t.top,bottom:t.bottom,cells:[]}),i[t.top].bottom<t.bottom&&(i[t.top].bottom=t.bottom),i[t.top].cells.push(e));return iD(i,e=>{n.push(e)}),n}getRowLevelInfo(e){let t,i=this.getRowLevels();for(let n=0,s=i.length;n<s;++n)i[n].top<=e&&i[n].bottom>e&&(t={index:n,rowLevels:i,rowLevel:i[n]});return t}}let{pick:ij,defined:iF}=I,iz=class extends ea{constructor(e,t,i){super(),this.type=Q.guiElementType.layout,this.board=e,this.rows=[],this.options=t,this.isVisible=!0;const n=i?i.container:document.getElementById(t.parentContainerId||"")||e.layoutsWrapper;i?(this.parentCell=i,this.level=i.row.layout.level+1):this.level=0,t.copyId&&(this.copyId=t.copyId);const s=(this.options||{}).rowClassName||"";this.container=this.getElementContainer({render:e.guiEnabled,parentContainer:n,attribs:{id:(t.id||"")+(this.copyId?"_"+this.copyId:""),className:Q.classNames.layout+" "+s},elementId:t.id,style:this.options.style}),this.options.rows&&this.setRows()}setRows(){let e,t,i,n=ij(this.options.rows,this.container&&this.container.getElementsByClassName(this.options.rowClassName||""))||[];for(t=0,i=n.length;t<i;++t)e=n[t],this.addRow(this.board.guiEnabled?e:{},e instanceof HTMLElement?e:void 0)}addRow(e,t,i){let n=new iH(this,e,t);return iF(i)?this.mountRow(n,i):this.rows.push(n),this.board.editMode&&this.board.editMode.setRowEvents(n),n}destroy(){for(let e=this.board.layouts.length-1;e>=0;e--)this.board.layouts[e]===this&&this.board.layouts.splice(e,1);this.parentCell&&delete this.parentCell.nestedLayout;for(let e=this.rows.length-1;e>=0;e--)this.rows[e].destroy();this.parentCell&&this.parentCell.destroy(),super.destroy()}getRowIndex(e){for(let t=0,i=this.rows.length;t<i;++t)if(this.rows[t]===e)return t}mountRow(e,t){let i=this.rows[t],n=this.rows[t-1];e.container&&(i&&i.container?i.container.parentNode.insertBefore(e.container,i.container):n&&n.container&&n.container.parentNode.insertBefore(e.container,n.container.nextSibling),this.rows.splice(t,0,e),e.layout=this)}unmountRow(e){let t=this.getRowIndex(e);iF(t)&&this.rows.splice(t,1)}getVisibleRows(){let e=[];for(let t=0,i=this.rows.length;t<i;++t)this.rows[t].isVisible&&e.push(this.rows[t]);return e}changeVisibility(e=!0){super.changeVisibility(e),this.parentCell&&(this.isVisible&&!this.parentCell.isVisible?this.parentCell.show():!this.isVisible&&this.parentCell.isVisible&&this.parentCell.hide())}getOptions(){let e=[];for(let t=0,i=this.rows.length;t<i;++t)e.push(this.rows[t].getOptions());return{id:this.options.id,layoutClassName:this.options.layoutClassName,rowClassName:this.options.rowClassName,cellClassName:this.options.cellClassName,style:this.options.style,rows:e}}},{merge:iV,addEvent:i$,createElement:iB,error:iU,objectEach:iY,uniqueKey:i_}=I;class iG{static board(e,t,i){return new iG(e,t).init(i)}constructor(e,t){this.componentTypes=ib.types,this.options=iV(iA,t),this.dataPool=new iS(t.dataPool),this.id=i_(),this.guiEnabled=!!t.gui&&this.options?.gui?.enabled,this.editModeEnabled=!!t.editMode&&this.options?.editMode?.enabled,this.layouts=[],this.mountedComponents=[],this.initContainer(e),this.initEditMode(),this.dataCursor=new iu,this.index=Q.boards.length,Q.boards.push(this),this.a11y=new iT(this)}init(e){let t=this.options,i=t.components?this.setComponents(t.components):[];return(this.initEvents(),e)?Promise.all(i).then(()=>(t.events?.mounted?.call(this),this)):(t.events?.mounted?.call(this),this)}initEvents(){let e=this,t=()=>{e.reflow()};if("function"==typeof ResizeObserver)this.resizeObserver=new ResizeObserver(t),this.resizeObserver.observe(e.container);else{let e=i$(window,"resize",t);i$(this,"destroy",e)}}initContainer(e){"string"==typeof e&&(e=window.document.getElementById(e)),e||iU(13,!0),this.container=e}initEditMode(){let{EditMode:e}=Q.win.Dashboards;if(e)this.editMode=new e(this,this.options.editMode);else if(this.editModeEnabled)throw Error("Missing layout.js module")}setComponents(e){let t=[];for(let i=0,n=e.length;i<n;++i)t.push(ix.addComponent(e[i],this));return t}destroy(){let e=this,t=this.index;if(this.dataPool.cancelPendingRequests(),this.guiEnabled)for(let t=0,i=e.layouts?.length;t<i;++t)e.layouts[t].destroy();else for(let t of e.mountedComponents)t.component.destroy();this.resizeObserver?.unobserve(e.container),this.guiEnabled&&e.container?.remove(),iY(e,function(t,i){delete e[i]}),Q.boards[t]=void 0}reflow(){if(this.editMode){let e=this.editMode.tools;this.editMode.hideToolbars(["cell","row"]),this.editMode.hideContextPointer(),e.contextMenu&&e.contextMenu.updatePosition(e.contextButtonElement)}}update(e){for(let t of(this.options=iV(this.options,e),e.dataPool&&(this.dataPool=new iS(this.options.dataPool)),void 0!==e.gui&&(this.guiEnabled=!!e.gui&&this.options?.gui?.enabled),void 0!==e.editMode&&(this.editModeEnabled=!!e.editMode&&this.options?.editMode?.enabled),this.mountedComponents))t.component.destroy();if(this.mountedComponents=[],this.guiEnabled&&this.layouts){for(let e=0,t=this.layouts.length;e<t;++e)this.layouts[e].destroy();if(this.layouts=[],!this.layoutsWrapper&&this.container&&(this.layoutsWrapper=iB("div",{className:Q.classNames.layoutsWrapper},{},this.container)),this.options.gui?.layouts){let e=this.options.gui;for(let t=0,i=e.layouts.length;t<i;++t)this.layouts.push(new iz(this,iV({},e.layoutOptions,e.layouts[t])));if(this.editMode){let e=0,t=this.layouts.length;for(;e<t;++e)this.editMode.setLayoutEvents(this.layouts[e])}}}this.options.components&&this.setComponents(this.options.components)}getOptions(){let e={...this.options,components:[]};for(let t=0,i=this.mountedComponents.length;t<i;++t)this.mountedComponents[t].cell&&this.mountedComponents[t].cell.mountedComponent&&e.components?.push(this.mountedComponents[t].component.getOptions());if(this.guiEnabled){e.gui={layouts:[]};for(let t=0,i=this.layouts.length;t<i;++t)e.gui.layouts?.push(this.layouts[t].getOptions())}else delete e.gui;return e}getComponentById(e){return this.mountedComponents.find(t=>t.component.id===e)?.component}getComponentByCellId(e){return this.mountedComponents.find(t=>t.cell.id===e)?.component}}ib.registerComponent("HTML",e0);let{addEvent:iW,removeEvent:iK}=I,iJ={defaultOptions:{autoScroll:!1},syncPair:{emitter:function(){if("Grid"!==this.type)return;let{grid:e,board:t}=this,i=this.sync.syncConfig.highlight,n=i.group?":"+i.group:"";if(!t||!e||!i?.enabled)return;let{dataCursor:s}=t,o=this.getDataTable(),r=e=>{if(o){let t=e.target;s.emitCursor(o,{type:"position",row:t.row.id,column:t.column.id,state:"point.mouseOver"+n,sourceId:this.id})}},a=e=>{if(o){let t=e.target;s.emitCursor(o,{type:"position",row:t.row.id,column:t.column.id,state:"point.mouseOut"+n,sourceId:this.id})}};return iW(e,"cellMouseOver",r),iW(e,"cellMouseOut",a),function(){iK(e.container,"cellMouseOver",r),iK(e.container,"cellMouseOut",a)}},handler:function(){if("Grid"!==this.type)return;let e=this,{board:t}=e,i=e.sync.syncConfig.highlight,n=i.group?":"+i.group:"";if(!i?.enabled)return;let s=e.getDataTable(),o=t=>{let n=t.cursor;if(n.sourceId===e.id||"position"!==n.type)return;let{row:s,column:o}=n,{grid:r}=e,a=r?.viewport;if(void 0===s||!a)return;let l=a.dataTable.getLocalRowIndex(s);void 0!==l&&(i.autoScroll&&a.scrollToRow(l),r.syncRow(l),r.syncColumn(o))},r=t=>{let{grid:i}=e;i&&t.cursor.sourceId!==e.id&&(i.syncColumn(),i.syncRow())};if(t)return(()=>{let{dataCursor:e}=t;!e||s&&(e.addListener(s.id,"point.mouseOver"+n,o),e.addListener(s.id,"point.mouseOut"+n,r))})(),()=>{if(!s)return;let e=t.dataCursor;e.removeListener(s.id,"point.mouseOver"+n,o),e.removeListener(s.id,"point.mouseOut"+n,r)}}}},iq={defaultOptions:{},syncPair:{emitter:void 0,handler:function(){if("Grid"!==this.type)return;let e=this,t=this.sync.syncConfig.visibility,i=t.group?":"+t.group:"",{board:n}=e,s=t=>{let n=t.cursor,s=e.grid;s&&"position"===n.type&&n.column&&s.updateColumn(n.column,{enabled:n.state!=="series.hide"+i})};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let o=e.getDataTable();o&&(t.addListener(o.id,"series.show"+i,s),t.addListener(o.id,"series.hide"+i,s))})(),()=>{let t=e.getDataTable(),{dataCursor:o}=n;t&&(o.removeListener(t.id,"series.show"+i,s),o.removeListener(t.id,"series.hide"+i,s))}}}},iZ={defaultSyncPairs:{extremes:{emitter:void 0,handler:function(){if("Grid"!==this.type)return;let e=this,t=this.sync.syncConfig.extremes,i=t.group?":"+t.group:"",{board:n}=e,s=t=>{let i=t.cursor;if("position"===i.type&&e.grid&&"number"==typeof i?.row){let{row:t}=i,{viewport:n}=e.grid,s=n?.dataTable?.getLocalRowIndex(t);void 0!==s&&e.grid.viewport?.scrollToRow(s)}};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let o=e.connectorHandlers?.[0]?.connector?.getTable();o&&t.addListener(o.id,"xAxis.extremes.min"+i,s)})(),()=>{let t=e.connectorHandlers?.[0]?.connector?.getTable(),{dataCursor:o}=n;t&&o.removeListener(t.id,"xAxis.extremes.min"+i,s)}}},highlight:iJ.syncPair,visibility:iq.syncPair},defaultSyncOptions:{extremes:{},highlight:iJ.defaultOptions,visibility:iq.defaultOptions}},{uniqueKey:iX}=I,iQ={gridClassName:"highcharts-grid-container",gridID:"grid-"+iX(),gridOptions:{},editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},{name:"title",propertyPath:["title"],type:"input"},{name:"caption",propertyPath:["caption"],type:"input"},{name:"Grid options",type:"nested",nestedOptions:[{name:"General",options:[{name:"Caption/title",propertyPath:["gridOptions","caption","text"],type:"input"},{name:"Columns resizing mode",propertyPath:["gridOptions","rendering","columns","resizing","mode"],type:"select",selectOptions:[{name:"adjacent"},{name:"distributed"},{name:"independent"}]},{name:"Editable Grid",propertyPath:["gridOptions","columnDefaults","cells","editMode","enabled"],type:"toggle"},{name:"Resizable columns",propertyPath:["gridOptions","rendering","columns","resizing","enabled"],type:"toggle"},{name:"Sortable columns",propertyPath:["gridOptions","columnDefaults","sorting","enabled"],type:"toggle"},{name:"Cell text truncation",propertyPath:["gridOptions","rendering","rows","strictHeights"],type:"toggle"}]}]},{name:"Grid class name",propertyPath:["gridClassName"],type:"input"},{name:"Grid ID",propertyPath:["gridID"],type:"input"}],onUpdate:(e,t)=>{let i=e.target;if(i){let e=i.closest(".hcg-row"),n=i.closest(".hcg-cell");if(e&&e instanceof HTMLElement&&n&&n instanceof HTMLElement){let s=e.dataset.rowIndex,{columnId:o}=n.dataset;if(void 0!==s&&void 0!==o){let e=t.getTable();if(e){let t=new ti().convertByType(i.value);t instanceof Date&&(t=t.toString()),e.setCell(o,Number(s),t)}}}}}},{merge:i0,diffObjects:i1,getStyle:i2}=I,{deepClone:i3}=eI;class i6 extends eJ{constructor(e,t,i){super(e,t=i0(i6.defaultOptions,t),i),this.options=t,this.type="Grid",this.setOptions()}async update(e){if(await super.update(e),this.setOptions(),this.grid){this.grid.update(e.gridOptions,!1);let t=this.getDataTable();this.grid?.viewport?.dataTable?.id!==t?.id&&this.grid.update({dataTable:t?.getModified()},!1),await this.grid.redraw()}this.emit({type:"afterUpdate"})}render(){return super.render(),this.grid?this.grid.renderViewport():this.grid=this.constructGrid(),this.grid.initialContainerHeight=i2(this.parentElement,"height",!0)||0,this.sync.start(),this.emit({type:"afterRender"}),this}resize(e,t){t?this.contentElement.style.minHeight="0":null===t&&this.contentElement.style.removeProperty("min-height"),this.resizeDynamicContent(e,t),this.grid?.viewport?.reflow()}onTableChanged(){let{grid:e}=this;if(!e)return;let t=this.getDataTable()?.getModified();if(!t)return void e.update({dataTable:void 0});if(!e.options?.header){let i=t.getColumnIds(),{columnOptionsMap:n,enabledColumns:s}=e,o=0;for(let r of i)if(n[r]?.options?.enabled!==!1){if(s?.[o]!==r)return void e.update({dataTable:t});o++}}e.dataTable=t,e.querying.shouldBeUpdated=!0,e.viewport?.updateRows()}getEditableOptions(){let e=this.options;return i3(i0({gridOptions:this.grid?.options},e),["editableOptions","dataTable"])}getOptionsOnDrop(e){let t=e.editMode.board.dataPool.getConnectorIds(),i={type:"Grid"};return t.length&&(i={...i,connector:{id:t[0]}}),i}getOptions(){let e=i0(this.options);return e.gridOptions=this.grid?.getOptions(),e.connector?.id?delete e.gridOptions?.dataTable:e.gridOptions?.dataTable?.id&&(e.gridOptions.dataTable={columns:e.gridOptions.dataTable.columns}),{...i1(e,i6.defaultOptions),type:"Grid"}}destroy(){this.sync.stop(),this.grid?.destroy(),super.destroy()}setOptions(){let e=this.options,t=e.gridClassName,i=e.gridID;t&&(this.contentElement.classList.value=iQ.gridClassName+" "+t),i&&(this.contentElement.id=i)}constructGrid(){let e=i6.GridNamespace;if(!e)throw Error("Grid not connected.");let t=this.getDataTable(),i=this.options.gridOptions;if(!i)throw Error("Grid options are not set.");t&&(i.dataTable=t.getModified());let n=new e.Grid(this.contentElement,i);return this.options.gridOptions=n.options,n}}i6.predefinedSyncConfig=iZ,i6.defaultOptions=i0(eJ.defaultOptions,iQ);let i5={custom:{connectGrid:function(e){i6.GridNamespace=e}},name:"Grid.DashboardsPlugin",onRegister:function(e){let{ComponentRegistry:t}=e;t.registerComponent("Grid",i6)},onUnregister:function(e){}},{addEvent:i4,isString:i9}=I,i8={defaultOptions:{},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this,t=[],{chart:i,board:n}=e,s=e.connectorHandlers?.[0]?.connector,o=s&&s.getTable(),r=this.sync.syncConfig.extremes,a=r.group?":"+r.group:"",{dataCursor:l}=n;if(o&&i){let n=t=>{let n=!!t.resetSelection;if((!t.trigger||t.trigger&&"dashboards-sync"!==t.trigger)&&!n){let n=t.target,s=Object.keys(e.seriesFromConnector),r=s.length>0?i.get(s[0]):n.series[0];if(r){let i=r.points.filter(e=>e.isInside||!1),h={type:"position",state:`${n.coll}.extremes.min${a}`},c={type:"position",state:`${n.coll}.extremes.max${a}`};if(s.length>0&&"xAxis"===n.coll&&i.length){let t,s=(e.connectorHandlers[0]?.options).columnAssignment;if(s){let e=s.find(e=>e.seriesId===r.options.id);if(e){let i=e.data;t=i9(i)?i:Array.isArray(i)?i[i.length-1]:i.y}}t||(t=n.dateTime&&(o.hasColumns(["x"])?"x":r.options.id??r.name)),h.row=i[0].index,h.column=t,c.row=i[i.length-1].index,c.column=t}l.emitCursor(o,h,t,!0).emitCursor(o,c,t,!0)}}},s=()=>i.axes.map(e=>i4(e,"afterSetExtremes",n)),r=s(),h=()=>{r.forEach(e=>{e()}),r=[]};t.push(i4(i,"selection",e=>{e.resetSelection&&(h(),l.emitCursor(o,{type:"position",state:"chart.zoomOut"+a},e),r.push(...s()))})),t.push(()=>{l.remitCursor(o.id,{type:"position",state:"xAxis.extremes.min"+a}),l.remitCursor(o.id,{type:"position",state:"xAxis.extremes.max"+a}),h()})}return function(){t.forEach(e=>{e()})}},handler:function(){if("Highcharts"!==this.type)return;let e=this,t=this.sync.syncConfig.extremes,i=t.group?":"+t.group:"",{chart:n,board:s}=e;if(n&&s&&n.zooming?.type){let t=n.zooming.type.split("").map(e=>e+"Axis"),o=[];return t.forEach(t=>{let r=e=>{let{cursor:i,event:s}=e;if("position"===i.type){let e=s?.target;if(e&&n){let i=n[t],s=!1;i.forEach(t=>{e.coll===t.coll&&e!==t&&null!==e.min&&null!==e.max&&(t.max!==e.max||t.min!==e.min)&&(t.setExtremes(e.min,e.max,!1,void 0,{trigger:"dashboards-sync"}),s=!0)}),s&&!n.resetZoomButton&&n.showResetZoom(),n.redraw()}}};s&&(()=>{let{dataCursor:a}=s,l=e.connectorHandlers?.[0]?.connector;if(l){let s=l.getTable();a.addListener(s.id,`${t}.extremes.min${i}`,r),a.addListener(s.id,`${t}.extremes.max${i}`,r);let h=()=>{n.zoomOut(),setTimeout(()=>{e.element.querySelectorAll(".highcharts-reset-zoom").forEach(e=>{e.remove()})})};a.addListener(s.id,"chart.zoomOut",h),o.push(()=>{a.removeListener(s.id,`${t}.extremes.min${i}`,r),a.removeListener(s.id,`${t}.extremes.max${i}`,r),a.removeListener(s.id,"chart.zoomOut"+i,h)})}})()}),function(){o.forEach(e=>{e()})}}}}},{error:i7}=eI,ne={defaultOptions:{affectedSeriesId:null,highlightPoint:!0,showTooltip:!0,showCrosshair:!0},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this,{chart:t,board:i}=e,n=this.sync.syncConfig.highlight,s=n.group?":"+n.group:"";if(!n.enabled||!t)return;let{dataCursor:o}=i;for(let i=0,n=t.series?.length??0;i<n;++i){let n,r=t.series[i],a=r.options.id??"",l=e.seriesFromConnector[a],h=l?.options.id,c=this.getDataTable(h);if(!c)continue;let d=c?.getModified(),u=l?.columnAssignment?.find(e=>e.seriesId===a);if(u){let{data:e}=u;n="string"==typeof e?e:Array.isArray(e)?e[1]:e.y??e.value}n||(n=r.name),r.update({point:{events:{mouseOver:function(){o.emitCursor(c,{type:"position",row:d.getOriginalRowIndex(this.index),column:n,state:"point.mouseOver"+s,sourceId:e.id})},mouseOut:function(){o.emitCursor(c,{type:"position",row:d.getOriginalRowIndex(this.index),column:n,state:"point.mouseOut"+s,sourceId:e.id})}}}},!1)}return t.redraw(),function(){t&&t.series&&(t.series.forEach(e=>{e.update({point:{events:{mouseOver:void 0,mouseOut:void 0}}},!1)}),t.redraw())}},handler:function(){if("Highcharts"!==this.type)return;let e=this,t=this.sync.syncConfig.highlight.group?":"+this.sync.syncConfig.highlight.group:"",{chart:i,board:n}=e,s=t=>{let{table:n,cursor:s}=t,o=this.sync.syncConfig.highlight;if(i&&i.series?.length&&"position"===s.type){let t,r=o.affectedSeriesId;if(o.affectedSeriesId){let e=i.get(o.affectedSeriesId);e?.points?t=e:i7("No series with ID '"+r+"' found in the chart. Affected series will be selected according to the column assignment.")}if(!t){let o=Object.keys(e.seriesFromConnector);for(let r=0,a=o.length;r<a;++r){let a=o[r],l=e.seriesFromConnector[a],h=l?.options.dataTableKey;if(l?.connector?.getTable(h)!==n)continue;let c=l.columnAssignment;if(t=i.get(a),!c)break;let{data:d}=c.find(e=>e.seriesId===a)??{};if(!d||!s.column)break;if("string"==typeof d){if(d===s.column)break}else if(Array.isArray(d)){if(d.includes(s.column))break}else if(Object.keys(d).map(e=>d[e]).includes(s.column))break}}let a=s.row;if(t?.visible&&void 0!==a){let e=n.getModified().getLocalRowIndex(a);if(void 0===e)return;let i=t.data[e];if(i?.visible)return i}}},o=t=>{let n=this.sync.syncConfig.highlight;if(!n.enabled||t.cursor.sourceId===e.id)return;let o=s(t);if(!o||!i||!o.isInside&&o.series.isCartesian||o===i.hoverPoint)return;let r=i.tooltip;if(r&&n.showTooltip){let e=r.shared,t=i.hoverPoint,n=t?.series||i.hoverSeries,s=i.pointer?.getHoverData(o,n,i.series,!0,!0);i.tooltip&&s?.hoverPoints.length&&r.refresh(e?s.hoverPoints:o)}n.highlightPoint&&(!r?.shared&&n.showTooltip||!n.showTooltip)&&o.setState("hover"),n.showCrosshair&&(o.series.xAxis?.drawCrosshair(void 0,o),o.series.yAxis?.drawCrosshair(void 0,o))},r=t=>{let n=this.sync.syncConfig.highlight;if(!i||!i.series.length||!n.enabled||t.cursor.sourceId===e.id)return;let o=s(t);if(o&&(!o.isInside&&o.series.isCartesian||o===i.hoverPoint))return;let r=!1,a=()=>{let e=i.series.length;for(let t=0;t<e;t++){let e=i.series[t].points,n=e.length;for(let t=0;t<n;t++)e[t].setState()}},l=i.tooltip;if(l&&n.showTooltip&&(l.hide(),l.shared&&(a(),r=!0)),n.highlightPoint&&!r&&(o?o.setState():a()),n.showCrosshair)if(o)o.series.xAxis?.drawCrosshair(),o.series.yAxis?.drawCrosshair();else{let e=i.xAxis,t=i.yAxis;for(let t=0,i=e.length;t<i;t++)e[t].drawCrosshair();for(let e=0,i=t.length;e<i;e++)t[e].drawCrosshair()}},a=()=>{let{dataCursor:e}=n,{connectorHandlers:i}=this;if(e)for(let n=0,s=i.length;n<s;++n){let s=i[n]?.options.id,a=this.getDataTable(s);a&&(e.addListener(a.id,"point.mouseOver"+t,o),e.addListener(a.id,"point.mouseOut"+t,r))}},l=()=>{let{dataCursor:e}=n,{connectorHandlers:i}=this;if(e)for(let n=0,s=i.length;n<s;++n){let s=i[n]?.connector?.getTable();s&&(e.removeListener(s.id,"point.mouseOver"+t,o),e.removeListener(s.id,"point.mouseOut"+t,r))}};if(n)return a(),l}}},nt={defaultOptions:{},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this.sync.syncConfig.visibility,t=e.group?":"+e.group:"",{chart:i,board:n}=this;if(!n||!i)return;let s=this.getDataTable();if(s){let{dataCursor:e}=n,{series:o}=i;o.forEach(i=>{i.update({events:{show:function(){e.emitCursor(s,{type:"position",state:"series.show"+t,column:this.name})},hide:function(){e.emitCursor(s,{type:"position",state:"series.hide"+t,column:this.name})}}},!1)}),i.redraw()}return function(){i&&i.series?.length&&(i.series.forEach(e=>{e.update({events:{show:void 0,hide:void 0}},!1)}),i.redraw())}},handler:function(){if("Highcharts"!==this.type)return;let e=this,t=this.sync.syncConfig.visibility,i=t.group?":"+t.group:"",{board:n}=e,s=(e,t)=>{for(let i of e)if(i.name===t)return i},o=t=>{let i=e.chart;if(i&&i.series?.length&&"position"===t.cursor.type&&void 0!==t.cursor.column){let e=s(i.series,t.cursor.column);e&&e.setVisible(!0,!0)}},r=t=>{let i=e.chart;if(i&&i.series?.length&&"position"===t.cursor.type&&void 0!==t.cursor.column){let e=s(i.series,t.cursor.column);e&&e.setVisible(!1,!0)}};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let s=e.getDataTable();s&&(t.addListener(s.id,"series.show"+i,o),t.addListener(s.id,"series.hide"+i,r))})(),()=>{let t=e.getDataTable();t&&(n.dataCursor.removeListener(t.id,"series.show"+i,o),n.dataCursor.removeListener(t.id,"series.hide"+i,r))}}}},ni={defaultSyncPairs:{extremes:i8.syncPair,highlight:ne.syncPair,visibility:nt.syncPair},defaultSyncOptions:{extremes:i8.defaultOptions,highlight:ne.defaultOptions,visibility:nt.defaultOptions}},{merge:nn,uniqueKey:ns}=I,no={allowConnectorUpdate:!0,className:[eJ.defaultOptions.className,`${eJ.defaultOptions.className}-highcharts`].join(" "),chartClassName:"chart-container",chartID:"chart-"+ns(),chartOptions:{series:[]},chartConstructor:"chart",editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},...eJ.defaultOptions.editableOptions||[],{name:"chartOptions",type:"nested",nestedOptions:[{name:"chart",options:[{name:"title",propertyPath:["chartOptions","title","text"],type:"input"},{name:"subtitle",propertyPath:["chartOptions","subtitle","text"],type:"input"},{name:"type",propertyPath:["chartOptions","chart","type"],type:"select",selectOptions:[{name:"column",iconURL:"series-types/icon-column.svg"},{name:"line",iconURL:"series-types/icon-line.svg"},{name:"scatter",iconURL:"series-types/icon-scatter.svg"},{name:"pie",iconURL:"series-types/icon-pie.svg"}]}]},{name:"xAxis",options:[{name:"title",propertyPath:["chartOptions","xAxis","title","text"],type:"input"},{name:"type",propertyPath:["chartOptions","xAxis","type"],type:"select",selectOptions:[{name:"linear"},{name:"datetime"},{name:"logarithmic"}]}]},{name:"yAxis",options:[{name:"title",propertyPath:["chartOptions","yAxis","title","text"],type:"input"},{name:"type",propertyPath:["chartOptions","yAxis","type"],type:"select",selectOptions:[{name:"linear"},{name:"datetime"},{name:"logarithmic"}]}]},{name:"legend",showToggle:!0,propertyPath:["chartOptions","legend","enabled"],options:[{name:"align",propertyPath:["chartOptions","legend","align"],type:"select",selectOptions:[{name:"left"},{name:"center"},{name:"right"}]}]},{name:"tooltip",showToggle:!0,propertyPath:["chartOptions","tooltip","enabled"],options:[{name:"split",propertyPath:["chartOptions","tooltip","split"],type:"toggle"}]},{name:"dataLabels",propertyPath:["chartOptions","plotOptions","series","dataLabels","enabled"],showToggle:!0,options:[{name:"align",propertyPath:["chartOptions","plotOptions","series","dataLabels","align"],type:"select",selectOptions:[{name:"left"},{name:"center"},{name:"right"}]}]},{name:"credits",showToggle:!0,propertyPath:["chartOptions","credits","enabled"],options:[{name:"name",propertyPath:["chartOptions","credits","text"],type:"input"},{name:"url",propertyPath:["chartOptions","credits","href"],type:"input"}]}]},{name:"chartConfig",propertyPath:["chartOptions"],type:"textarea"},{name:"chartClassName",propertyPath:["chartClassName"],type:"input"},{name:"chartID",propertyPath:["chartID"],type:"input"}],editableOptionsBindings:nn(eJ.defaultOptions.editableOptionsBindings,{skipRedraw:["chartOptions","chartConfig"]})},{createElement:nr,diffObjects:na,isString:nl,merge:nh,splat:nc}=I,{deepClone:nd}=eI;class nu extends eJ{constructor(e,t,i){super(e,t=nh(nu.defaultOptions,t),i),this.seriesFromConnector={},this.options=t,this.chartConstructor=this.options.chartConstructor||"chart",this.type="Highcharts",this.chartContainer=nr("figure",void 0,void 0,this.contentElement,!0),this.setOptions(),this.chartOptions=nh(this.options.chartOptions||{chart:{}},{tooltip:{}}),this.innerResizeTimeouts=[]}onTableChanged(){this.updateSeries()}async load(){return this.emit({type:"load"}),await super.load(),this.emit({type:"afterLoad"}),this}render(){return super.render(),this.chart=this.getChart(),this.updateSeries(),this.emit({type:"afterRender"}),this.setupConnectorUpdate(),this.sync.start(),this}resize(e,t){for(this.resizeDynamicContent(e,t);this.innerResizeTimeouts.length;){let e=this.innerResizeTimeouts.pop();e&&clearTimeout(e)}return this.innerResizeTimeouts.push(setTimeout(()=>{if(this.chart&&this.chart.container){let e=this.contentElement.offsetHeight-this.chart?.container.offsetHeight;this.chart.setSize(null,Math.abs(e)>1?this.contentElement.offsetHeight:null,!1)}},33)),this}setupConnectorUpdate(){let{connectorHandlers:e,chart:t}=this;if(!t||!this.options.allowConnectorUpdate)return;let i=t.series.length;for(let n=0,s=e.length;n<s;n++){let s=e[n];for(let e=0;e<i;e++)t.series[e].update({point:{events:{update:e=>{this.onChartUpdate(e.target,s)}}}},!1)}}onChartUpdate(e,t){let i,n=t.dataTable,s=t.columnAssignment,o=e.series.options.id,r=new ti,a=e6(e.y,r.decimalRegExp);if(n){if(s&&o){let e=s.find(e=>e.seriesId===o)?.data;nl(e)?i=e:Array.isArray(e)?i=e[1]:e&&(i=e.y??e.value)}i||(i=o??e.series.name),n.setCell(i,e.index,a)}}setOptions(){this.options.chartClassName&&(this.chartContainer.classList.value=no.className+" "+this.options.chartClassName),this.options.chartID&&(this.chartContainer.id=this.options.chartID)}async update(e,t=!0){await super.update(e,!1),this.setOptions(),this.options.chartConstructor!==this.chartConstructor?(this.chartConstructor=this.options.chartConstructor||"chart",this.chartOptions=this.options.chartOptions||{},this.chart?.destroy(),delete this.chart):this.chart?.update(nh(this.options.chartOptions)||{}),this.emit({type:"afterUpdate"}),t&&this.render()}updateSeries(){let{chart:e}=this,t=this.connectorHandlers;if(!e)return;let i=[];for(let e of t){let t=e.options.columnAssignment;if(!t&&e.dataTable&&(t=this.getDefaultColumnAssignment(e.dataTable.getColumnIds(),e.dataTable)),t)for(let{seriesId:n}of(e.columnAssignment=t,t))n&&i.push(n)}let n=Object.keys(this.seriesFromConnector);for(let t=0,s=n.length;t<s;++t){let s=n[t];if(i.some(e=>e===s))continue;let o=e.get(s);o&&o.destroy()}for(let e of(this.seriesFromConnector={},t))this.updateSeriesFromConnector(e);e.redraw()}updateSeriesFromConnector(e){let t=this.chart;if(!e.connector||!t||!e.dataTable)return;let i=e.dataTable.getModified(),n=e.dataTable.getModifier()?.options,s=e.columnAssignment??[];for(let o=0,r=s.length;o<r;++o){let r=s[o],a=r.data,l=t.get(r.seriesId),h={},c=e=>{n?.type==="Math"&&n.columnFormulas?.some(t=>e(t.column))&&(h.dragDrop={draggableY:!1})};if(nl(a)){let e=i.getColumn(a);e&&(h.data=e.slice()),c(e=>e===a)}else if(Array.isArray(a))h.data=new tE({columns:i.getColumns(a)}).getRows(),c(e=>a.some(t=>t===e));else{let e=Object.keys(a),t=[];for(let i=0,n=e.length;i<n;++i)t.push(a[e[i]]);let n=new tE({columns:i.getColumns(t)});h.keys=e,h.data=n.getRows(),c(e=>t.some(t=>t===e))}l?l.update(h,!1):t.addSeries({name:r.seriesId,id:r.seriesId,...h},!1),this.seriesFromConnector[r.seriesId]=e}}getChart(){return this.chart||this.createChart()}destroy(){if(this.chart&&this.chart.renderTo&&this.chart.renderer){try{this.chart.destroy()}catch(e){console.warn("Error destroying chart:",e)}this.chart=void 0}super.destroy()}getDefaultColumnAssignment(e=[],t){let i=[],n=t.getColumn(e[0]);if(n&&nl(n[0])){for(let t=1,n=e.length;t<n;++t)i.push({seriesId:e[t],data:[e[0],e[t]]});return i}for(let t=0,n=e.length;t<n;++t)i.push({seriesId:e[t],data:e[t]});return i}createChart(){let e=nu.charter||Q.win.Highcharts;this.chartConstructor||(this.chartConstructor="chart");let t=e[this.chartConstructor];if(t)try{if("chart"===this.chartConstructor)return e.Chart.chart(this.chartContainer,this.chartOptions);return new t(this.chartContainer,this.chartOptions)}catch(e){throw Error(`The Highcharts component in cell '${this.cell.id}' is misconfigured. 
____________
${e}`)}if("function"!=typeof e.chart)throw Error("Chart constructor not found");return this.chart}getOptionsOnDrop(e){let t=e.editMode.board.dataPool.getConnectorIds(),i={type:"Highcharts",chartOptions:{chart:{animation:!1,type:"column",zooming:{}}}};return t.length&&(i={...i,connector:{id:t[0]}}),i}getOptions(){return{...na(this.options,nu.defaultOptions),type:"Highcharts"}}getEditableOptions(){let e=this.options,t=this.chart,i=t&&t.options,n=i?.chart?.type||"line";return nd(nh({chartOptions:i},{chartOptions:{yAxis:nc(t&&t.yAxis[0].options),xAxis:nc(t&&t.xAxis[0].options),plotOptions:{series:(i&&i.plotOptions||{})[n]}}},e),["dataTable","points","series","data","editableOptions"])}getEditableOptionValue(e){if(e)return 1===e.length&&"chartOptions"===e[0]?JSON.stringify(this.options.chartOptions,null,2):super.getEditableOptionValue.call(this,e)}}nu.predefinedSyncConfig=ni,nu.defaultOptions=nh(eJ.defaultOptions,no);let{defined:np}=I,nm={defaultOptions:{},syncPair:{emitter:void 0,handler:function(){if("KPI"!==this.type)return;let e=this,t=this.sync.syncConfig.extremes,i=t.group?":"+t.group:"",{board:n}=this,s=t=>{let i=t.cursor;if("position"===i.type&&"number"==typeof i?.row&&np(i.column)&&e.connectorHandlers?.[0]?.connector&&!np(e.options.value)){let t=String(e.connectorHandlers[0].connector.getTable().getModified().getCell(i.column,i.row));e.setValue(t)}},o=()=>{let{dataCursor:e}=n;if(!e)return;let t=this.getDataTable();t&&e.addListener(t.id,"xAxis.extremes.max"+i,s)},r=()=>{let e=this.getDataTable(),{dataCursor:t}=n;e&&t.removeListener(e.id,"xAxis.extremes.max"+i,s)};if(n)return o(),r}}},nf={defaultSyncPairs:{extremes:nm.syncPair},defaultSyncOptions:{extremes:nm.defaultOptions}},ng={type:"KPI",className:[eJ.defaultOptions.className,`${eJ.defaultOptions.className}-kpi`].join(" "),minFontSize:20,thresholdColors:["#f45b5b","#90ed7d"],editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},...eJ.defaultOptions.editableOptions||[],{name:"Value",type:"input",propertyPath:["value"]},{name:"Column name",type:"input",propertyPath:["columnId"]},{name:"Value format",type:"input",propertyPath:["valueFormat"]}],linkedValueTo:{enabled:!0,seriesIndex:0,pointIndex:0}},ny=["+","-","*","/","^","=","<","<=",">",">="],{isFormula:nb,isFunction:nC,isOperator:nw,isRange:nv,isReference:nO,isValue:nx}={isFormula:function(e){return Array.isArray(e)},isFunction:function(e){return"object"==typeof e&&!Array.isArray(e)&&"function"===e.type},isOperator:function(e){return"string"==typeof e&&ny.indexOf(e)>=0},isRange:function(e){return"object"==typeof e&&!Array.isArray(e)&&"range"===e.type},isReference:function(e){return"object"==typeof e&&!Array.isArray(e)&&"reference"===e.type},isValue:function(e){return"boolean"==typeof e||"number"==typeof e||"string"==typeof e}},{defined:nT}=I,nE=/ */,nN=Number.MAX_VALUE/1.000000000001,nM=Number.MAX_VALUE/1.000000000002,nS=Number.MAX_VALUE,nR={"^":3,"*":2,"/":2,"+":1,"-":1,"=":0,"<":0,"<=":0,">":0,">=":0},nA={},nP=/^[A-Z][A-Z\.]*$/;function nI(e){switch(typeof e){case"boolean":return e?nS:nN;case"string":return nM;case"number":return e;default:return NaN}}function nL(e){return"string"==typeof e?e.toLowerCase().replace(nE,"\0"):e}function nD(e){switch(typeof e){case"boolean":return+!!e;case"string":return parseFloat(e.replace(",","."));case"number":return e;default:return NaN}}function nk(e,t){return nx(e)?e:nv(e)?t&&nH(e,t)||[]:nC(e)?nV(e,t):nz(nb(e)?e:[e],t)}function nH(e,t){let i=t.getColumnIds().slice(e.beginColumn,e.endColumn+1),n=[];for(let s=0,o=i.length,r;s<o;++s){let o=t.getColumn(i[s],!0)||[];for(let a=e.beginRow,l=e.endRow+1;a<l;++a)"string"==typeof(r=o[a])&&"="===r[0]&&t!==t.getModified()&&(r=t.getModified().getCell(i[s],a)),n.push(nx(r)?r:NaN)}return n}function nj(e,t){let i=t.getColumnIds()[e.column];if(i){let n=t.getCell(i,e.row);if("string"==typeof n&&"="===n[0]&&t!==t.getModified()){let n=t.getModified().getCell(i,e.row);return nx(n)?n:NaN}if(nx(n))return e.isNegative?-n:n}return NaN}function nF(e,t){(e.length<2||t.length<1)&&e.push(NaN);let i=e.pop(),n=e.pop(),s=t.pop();nT(i)&&nT(n)&&nT(s)?e.push(function(e,t,i){let n;switch(e){case"=":return nL(t)===nL(i);case"<":if(typeof t==typeof i)return nL(t)<nL(i);return nI(t)<nI(i);case"<=":if(typeof t==typeof i)return nL(t)<=nL(i);return nI(t)<=nI(i);case">":if(typeof t==typeof i)return nL(t)>nL(i);return nI(t)>nI(i);case">=":if(typeof t==typeof i)return nL(t)>=nL(i);return nI(t)>=nI(i)}switch(t=nD(t),i=nD(i),e){case"+":n=t+i;break;case"-":n=t-i;break;case"*":n=t*i;break;case"/":n=t/i;break;case"^":n=Math.pow(t,i);break;default:return NaN}return n%1?Math.round(1e9*n)/1e9:n}(s,n,i)):e.push(NaN)}function nz(e,t){let i=[],n=[],s=!0;for(let o=0,r=e.length;o<r;++o){let r,a=e[o];if(nw(a)){if(s&&"-"===a)i.push(0),n.push("-"),s=!0;else{for(;n.length&&nR[n[n.length-1]]>=nR[a];)nF(i,n);n.push(a),s=!0}continue}if(nx(a))r=a;else if(nO(a))r=t?nj(a,t):NaN;else if(nC(a)){let e=nV(a,t);r=nx(e)?e:NaN}else nb(a)&&(r=nz(a,t));if(void 0===r)return NaN;i.push(r),s=!1}for(;n.length;)nF(i,n);return 1!==i.length?NaN:i[0]}function nV(e,t,i){let n=nA[e.name];if(n)try{return n(e.args,t)}catch{return NaN}let s=Error(`Function "${e.name}" not found.`);throw s.name="FormulaProcessError",s}let n$={asNumber:nD,getArgumentValue:nk,getArgumentsValues:function(e,t){let i=[];for(let n=0,s=e.length;n<s;++n)i.push(nk(e[n],t));return i},getRangeValues:nH,getReferenceValue:nj,processFormula:nz,processorFunctions:nA,registerProcessorFunction:function(e,t){return nP.test(e)&&!nA[e]&&!!(nA[e]=t)},translateReferences:function e(t,i=0,n=0){for(let s=0,o=t.length,r;s<o;++s)Array.isArray(r=t[s])?e(r,i,n):nC(r)?e(r.args,i,n):nv(r)?(r.beginColumnRelative&&(r.beginColumn+=i),r.beginRowRelative&&(r.beginRow+=n),r.endColumnRelative&&(r.endColumn+=i),r.endRowRelative&&(r.endRow+=n)):nO(r)&&(r.columnRelative&&(r.column+=i),r.rowRelative&&(r.row+=n));return t}};function nB(e,t){let i=n$.getArgumentsValues(e,t),n=0;for(let e=0,s=i.length,o;e<s;++e)switch(typeof(o=i[e])){case"number":isNaN(o)||(n+=o);break;case"object":n+=nB(o,t)}return n}n$.registerProcessorFunction("SUM",nB);let{getArgumentsValues:nU}=n$;function nY(e,t){let i=nU(e,t),n=0,s=0;for(let e=0,t=i.length,o;e<t;++e)switch(typeof(o=i[e])){case"number":isNaN(o)||(++n,s+=o);break;case"object":for(let e=0,t=o.length,i;e<t;++e)"number"!=typeof(i=o[e])||isNaN(i)||(++n,s+=i)}return n?s/n:0}function n_(e,t){let i=[],n=n$.getArgumentsValues(e,t);for(let e=0,t=n.length,s;e<t;++e)switch(typeof(s=n[e])){case"number":isNaN(s)||i.push(s);break;case"object":for(let e=0,t=s.length,n;e<t;++e)"number"!=typeof(n=s[e])||isNaN(n)||i.push(n)}let s=i.length;if(!s)return NaN;let o=Math.floor(s/2);return s%2?i[o]:(i[o-1]+i[o])/2}n$.registerProcessorFunction("AVERAGE",nY),n$.registerProcessorFunction("MEDIAN",n_);let{getArgumentsValues:nG}=n$;function nW(e,t){let i=nG(e,t),n=-1/0;for(let e=0,t=i.length,s;e<t;++e)switch(typeof(s=i[e])){case"number":s>n&&(n=s);break;case"object":(s=nW(s))>n&&(n=s)}return isFinite(n)?n:0}n$.registerProcessorFunction("MAX",nW);let{getArgumentsValues:nK}=n$;function nJ(e,t){let i=nK(e,t),n=1/0;for(let e=0,t=i.length,s;e<t;++e)switch(typeof(s=i[e])){case"number":s<n&&(n=s);break;case"object":(s=nJ(s))<n&&(n=s)}return isFinite(n)?n:0}function nq(e,t){let i=n$.getArgumentsValues(e,t),n=0;for(let e=0,s=i.length,o;e<s;++e)switch(typeof(o=i[e])){case"number":!isNaN(o)&&++n;break;case"object":n+=nq(o,t)}return n}n$.registerProcessorFunction("MIN",nJ),n$.registerProcessorFunction("COUNT",nq);let{getArgumentsValues:nZ}=n$;function nX(e,t){let i=nZ(e,t),n=1,s=!1;for(let e=0,o=i.length,r;e<o;++e)switch(typeof(r=i[e])){case"number":isNaN(r)||(s=!0,n*=r);break;case"object":s=!0,n*=nX(r,t)}return s?n:0}n$.registerProcessorFunction("PRODUCT",nX);let{pageLang:nQ,win:n0}=a,{defined:n1,error:n2,extend:n3,isNumber:n6,isObject:n5,isString:n4,merge:n9,objectEach:n8,pad:n7,splat:se,timeUnits:st,ucfirst:si}=I,sn=a.isSafari&&n0.Intl&&!n0.Intl.DateTimeFormat.prototype.formatRange,ss=class{constructor(e,t){this.options={timezone:"UTC"},this.variableTimezone=!1,this.Date=n0.Date,this.update(e),this.lang=t}update(e={}){this.dTLCache={},this.options=e=n9(!0,this.options,e);let{timezoneOffset:t,useUTC:i,locale:n}=e;this.Date=e.Date||n0.Date||Date;let s=e.timezone;n1(i)&&(s=i?"UTC":void 0),t&&t%60==0&&(s="Etc/GMT"+(t>0?"+":"")+t/60),this.variableTimezone="UTC"!==s&&s?.indexOf("Etc/GMT")!==0,this.timezone=s,this.lang&&n&&(this.lang.locale=n),["months","shortMonths","weekdays","shortWeekdays"].forEach(e=>{let t=/months/i.test(e),i=/short/.test(e),n={timeZone:"UTC"};n[t?"month":"weekday"]=i?"short":"long",this[e]=(t?[0,1,2,3,4,5,6,7,8,9,10,11]:[3,4,5,6,7,8,9]).map(e=>this.dateFormat(n,(t?31:1)*24*36e5*e))})}toParts(e){let[t,i,n,s,o,r,a]=this.dateTimeFormat({weekday:"narrow",day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},e,"es").split(/(?:, | |\/|:)/g);return[s,n-1,i,o,r,a,Math.floor(Number(e)||0)%1e3,"DLMXJVS".indexOf(t)].map(Number)}dateTimeFormat(e,t,i=this.options.locale||nQ){let n=JSON.stringify(e)+i;n4(e)&&(e=this.str2dtf(e));let s=this.dTLCache[n];if(!s){e.timeZone??(e.timeZone=this.timezone);try{s=new Intl.DateTimeFormat(i,e)}catch(t){/Invalid time zone/i.test(t.message)?(n2(34),e.timeZone="UTC",s=new Intl.DateTimeFormat(i,e)):n2(t.message,!1)}}return this.dTLCache[n]=s,s?.format(t)||""}str2dtf(e,t={}){let i={L:{fractionalSecondDigits:3},S:{second:"2-digit"},M:{minute:"numeric"},H:{hour:"2-digit"},k:{hour:"numeric"},E:{weekday:"narrow"},a:{weekday:"short"},A:{weekday:"long"},d:{day:"2-digit"},e:{day:"numeric"},b:{month:"short"},B:{month:"long"},m:{month:"2-digit"},o:{month:"numeric"},y:{year:"2-digit"},Y:{year:"numeric"}};return Object.keys(i).forEach(n=>{-1!==e.indexOf(n)&&n3(t,i[n])}),t}makeTime(e,t,i=1,n=0,s,o,r){let a=this.Date.UTC(e,t,i,n,s||0,o||0,r||0);if("UTC"!==this.timezone){let e=this.getTimezoneOffset(a);if(a+=e,-1!==[2,3,8,9,10,11].indexOf(t)&&(n<5||n>20)){let t=this.getTimezoneOffset(a);e!==t?a+=t-e:e-36e5!==this.getTimezoneOffset(a-36e5)||sn||(a-=36e5)}}return a}parse(e){if(!n4(e))return e??void 0;let t=(e=e.replace(/\//g,"-").replace(/(GMT|UTC)/,"")).indexOf("Z")>-1||/([+-][0-9]{2}):?[0-9]{2}$/.test(e),i=/^[0-9]{4}-[0-9]{2}(-[0-9]{2}|)$/.test(e);t||i||(e+="Z");let n=Date.parse(e);if(n6(n))return n+(!t||i?this.getTimezoneOffset(n):0)}getTimezoneOffset(e){if("UTC"!==this.timezone){let[t,i,n,s,o=0]=this.dateTimeFormat({timeZoneName:"shortOffset"},e,"en").split(/(GMT|:)/).map(Number),r=-(60*(n+o/60)*6e4);if(n6(r))return r}return 0}dateFormat(e,t,i){let n=this.lang;if(!n1(t)||isNaN(t))return n?.invalidDate||"";if(n4(e=e??"%Y-%m-%d %H:%M:%S")){let i,s=/%\[([a-zA-Z]+)\]/g;for(;i=s.exec(e);)e=e.replace(i[0],this.dateTimeFormat(i[1],t,n?.locale))}if(n4(e)&&-1!==e.indexOf("%")){let i=this,[s,o,r,l,h,c,d,u]=this.toParts(t),p=n?.weekdays||this.weekdays,m=n?.shortWeekdays||this.shortWeekdays,f=n?.months||this.months,g=n?.shortMonths||this.shortMonths;n8(n3({a:m?m[u]:p[u].substr(0,3),A:p[u],d:n7(r),e:n7(r,2," "),w:u,v:n?.weekFrom??"",b:g[o],B:f[o],m:n7(o+1),o:o+1,y:s.toString().substr(2,2),Y:s,H:n7(l),k:l,I:n7(l%12||12),l:l%12||12,M:n7(h),p:l<12?"AM":"PM",P:l<12?"am":"pm",S:n7(c),L:n7(d,3)},a.dateFormats),function(n,s){if(n4(e))for(;-1!==e.indexOf("%"+s);)e=e.replace("%"+s,"function"==typeof n?n.call(i,t):n)})}else if(n5(e)){let i=(this.getTimezoneOffset(t)||0)/36e5,n=this.timezone||"Etc/GMT"+(i>=0?"+":"")+i,{prefix:s="",suffix:o=""}=e;e=s+this.dateTimeFormat(n3({timeZone:n},e),t)+o}return i?si(e):e}resolveDTLFormat(e){return n5(e,!0)?n5(e,!0)&&void 0===e.main?{main:e}:e:{main:(e=se(e))[0],from:e[1],to:e[2]}}getDateFormat(e,t,i,n){let s=this.dateFormat("%m-%d %H:%M:%S.%L",t),o="01-01 00:00:00.000",r={millisecond:15,second:12,minute:9,hour:6,day:3},a="millisecond",l=a;for(a in st){if(e&&e===st.week&&+this.dateFormat("%w",t)===i&&s.substr(6)===o.substr(6)){a="week";break}if(e&&st[a]>e){a=l;break}if(r[a]&&s.substr(r[a])!==o.substr(r[a]))break;"week"!==a&&(l=a)}return this.resolveDTLFormat(n[a]).main}},{defined:so,extend:sr,timeUnits:sa}=I,sl=class extends ss{getTimeTicks(e,t,i,n){let s=this,o=[],r={},{count:a=1,unitRange:l}=e,[h,c,d,u,p,m]=s.toParts(t),f=(t||0)%1e3,g;if(n??(n=1),so(t)){if(f=l>=sa.second?0:a*Math.floor(f/a),l>=sa.second&&(m=l>=sa.minute?0:a*Math.floor(m/a)),l>=sa.minute&&(p=l>=sa.hour?0:a*Math.floor(p/a)),l>=sa.hour&&(u=l>=sa.day?0:a*Math.floor(u/a)),l>=sa.day&&(d=l>=sa.month?1:Math.max(1,a*Math.floor(d/a))),l>=sa.month&&(c=l>=sa.year?0:a*Math.floor(c/a)),l>=sa.year&&(h-=h%a),l===sa.week){a&&(t=s.makeTime(h,c,d,u,p,m,f));let e=this.dateTimeFormat({timeZone:this.timezone,weekday:"narrow"},t,"es"),i="DLMXJVS".indexOf(e);d+=-i+n+(i<n?-7:0)}t=s.makeTime(h,c,d,u,p,m,f),s.variableTimezone&&so(i)&&(g=i-t>4*sa.month||s.getTimezoneOffset(t)!==s.getTimezoneOffset(i));let e=t,y=1;for(;e<i;)o.push(e),l===sa.year?e=s.makeTime(h+y*a,0):l===sa.month?e=s.makeTime(h,c+y*a):g&&(l===sa.day||l===sa.week)?e=s.makeTime(h,c,d+y*a*(l===sa.day?1:7)):g&&l===sa.hour&&a>1?e=s.makeTime(h,c,d,u+y*a):e+=l*a,y++;o.push(e),l<=sa.hour&&o.length<1e4&&o.forEach(e=>{e%18e5==0&&"000000000"===s.dateFormat("%H%M%S%L",e)&&(r[e]="day")})}return o.info=sr(e,{higherRanks:r,totalRange:l*a}),o}},{isTouchDevice:sh}=a,{fireEvent:sc,merge:sd}=I,su={colors:["#2caffe","#544fc5","#00e272","#fe6a35","#6b8abc","#d568fb","#2ee0ca","#fa4b42","#feb56a","#91e8e1"],symbols:["circle","diamond","square","triangle","triangle-down"],lang:{weekFrom:"week from",chartTitle:"Chart title",locale:void 0,loading:"Loading...",months:void 0,seriesName:"Series {add index 1}",shortMonths:void 0,weekdays:void 0,numericSymbols:["k","M","G","T","P","E"],pieSliceName:"Slice",resetZoom:"Reset zoom",yAxisTitle:"Values",resetZoomTitle:"Reset zoom level 1:1"},global:{buttonTheme:{fill:"#f7f7f7",padding:8,r:2,stroke:"#cccccc","stroke-width":1,style:{color:"#333333",cursor:"pointer",fontSize:"0.8em",fontWeight:"normal"},states:{hover:{fill:"#e6e6e6"},select:{fill:"#e6e9ff",style:{color:"#000000",fontWeight:"bold"}},disabled:{style:{color:"#cccccc"}}}}},time:{Date:void 0,timezone:"UTC",timezoneOffset:0,useUTC:void 0},chart:{alignThresholds:!1,panning:{enabled:!1,type:"x"},styledMode:!1,borderRadius:0,colorCount:10,allowMutatingData:!0,ignoreHiddenSeries:!0,spacing:[10,10,15,10],resetZoomButton:{theme:{},position:{}},reflow:!0,type:"line",zooming:{singleTouch:!1,resetButton:{theme:{zIndex:6},position:{align:"right",x:-10,y:10}}},width:null,height:null,borderColor:"#334eff",backgroundColor:"#ffffff",plotBorderColor:"#cccccc"},title:{style:{color:"#333333",fontWeight:"bold"},text:"Chart title",margin:15,minScale:.67},subtitle:{style:{color:"#666666",fontSize:"0.8em"},text:""},caption:{margin:15,style:{color:"#666666",fontSize:"0.8em"},text:"",align:"left",verticalAlign:"bottom"},plotOptions:{},legend:{enabled:!0,align:"center",alignColumns:!0,className:"highcharts-no-tooltip",events:{},layout:"horizontal",itemMarginBottom:2,itemMarginTop:2,labelFormatter:function(){return this.name},borderColor:"#999999",borderRadius:0,navigation:{style:{fontSize:"0.8em"},activeColor:"#0022ff",inactiveColor:"#cccccc"},itemStyle:{color:"#333333",cursor:"pointer",fontSize:"0.8em",textDecoration:"none",textOverflow:"ellipsis"},itemHoverStyle:{color:"#000000"},itemHiddenStyle:{color:"#666666",textDecoration:"line-through"},shadow:!1,itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},squareSymbol:!0,symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{color:"#333333",fontSize:"0.8em",fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"45%"},style:{position:"absolute",backgroundColor:"#ffffff",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,animation:{duration:300,easing:e=>Math.sqrt(1-Math.pow(e-1,2))},borderRadius:3,dateTimeLabelFormats:{millisecond:"%[AebHMSL]",second:"%[AebHMS]",minute:"%[AebHM]",hour:"%[AebHM]",day:"%[AebY]",week:"%v %[AebY]",month:"%[BY]",year:"%Y"},footerFormat:"",headerShape:"callout",hideDelay:500,padding:8,position:{x:0,y:3},shared:!1,snap:sh?25:10,headerFormat:'<span style="font-size: 0.8em">{ucfirst point.key}</span><br/>',pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.y}</b><br/>',backgroundColor:"#ffffff",borderWidth:void 0,stickOnContact:!1,style:{color:"#333333",cursor:"default",fontSize:"0.8em"},useHTML:!1},credits:{enabled:!0,href:"https://www.highcharts.com?credits",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#999999",fontSize:"0.6em"},text:"Highcharts.com"}},sp=new sl(su.time,su.lang),{defaultOptions:sm,defaultTime:sf}={defaultOptions:su,defaultTime:sp,getOptions:function(){return su},setOptions:function(e){return sc(a,"setOptions",{options:e}),sd(!0,su,e),e.time&&sp.update(su.time),e.lang&&"locale"in e.lang&&sp.update({locale:e.lang.locale}),e.lang?.chartTitle&&(su.title={...su.title,text:e.lang.chartTitle}),su}},{pageLang:sg}=a,{extend:sy,getNestedProperty:sb,isArray:sC,isNumber:sw,isObject:sv,isString:sO,pick:sx,ucfirst:sT}=I,sE={add:(e,t)=>e+t,divide:(e,t)=>0!==t?e/t:"",eq:(e,t)=>e==t,each:function(e){let t=arguments[arguments.length-1];return!!sC(e)&&e.map((i,n)=>sM(t.body,sy(sv(i)?i:{"@this":i},{"@index":n,"@first":0===n,"@last":n===e.length-1}))).join("")},ge:(e,t)=>e>=t,gt:(e,t)=>e>t,if:e=>!!e,le:(e,t)=>e<=t,lt:(e,t)=>e<t,multiply:(e,t)=>e*t,ne:(e,t)=>e!=t,subtract:(e,t)=>e-t,ucfirst:sT,unless:e=>!e},sN={};function sM(e="",t,i){let n=RegExp("\\{([\\p{L}\\d:\\.,;\\-\\/<>\\[\\]%_@+\"'’= #\\(\\)]+)\\}","gu"),s=RegExp("\\(([\\p{L}\\d:\\.,;\\-\\/<>\\[\\]%_@+\"'= ]+)\\)","gu"),o=[],r=/f$/,a=/\.(\d)/,l=i?.options?.lang||sm.lang,h=i?.time||sf,c=i?.numberFormatter||sS.bind(i),d=(e="")=>{let i;return"true"===e||"false"!==e&&((i=Number(e)).toString()===e?i:/^["'].+["']$/.test(e)?e.slice(1,-1):sb(e,t))},u,p,m=0,f;for(;null!==(u=n.exec(e));){let i=u,n=s.exec(u[1]);n&&(u=n,f=!0),p?.isBlock||(p={ctx:t,expression:u[1],find:u[0],isBlock:"#"===u[1].charAt(0),start:u.index,startInner:u.index+u[0].length,length:u[0].length});let r=(p.isBlock?i:u)[1].split(" ")[0].replace("#","");sE[r]&&(p.isBlock&&r===p.fn&&m++,p.fn||(p.fn=r));let a="else"===u[1];if(p.isBlock&&p.fn&&(u[1]===`/${p.fn}`||a))if(m)!a&&m--;else{let t=p.startInner,i=e.substr(t,u.index-t);void 0===p.body?(p.body=i,p.startInner=u.index+u[0].length):p.elseBody=i,p.find+=i+u[0],a||(o.push(p),p=void 0)}else p.isBlock||o.push(p);if(n&&!p?.isBlock)break}return o.forEach(n=>{let o,u,{body:p,elseBody:m,expression:f,fn:g}=n;if(g){let e=[n],s=[],r=f.length,a=0,l;for(u=0;u<=r;u++){let e=f.charAt(u);l||'"'!==e&&"'"!==e?l===e&&(l=""):l=e,l||" "!==e&&u!==r||(s.push(f.substr(a,u-a)),a=u+1)}for(u=sE[g].length;u--;)e.unshift(d(s[u+1]));o=sE[g].apply(t,e),n.isBlock&&"boolean"==typeof o&&(o=sM(o?p:m,t,i))}else{let e=/^["'].+["']$/.test(f)?[f]:f.split(":");if(o=d(e.shift()||""),e.length&&"number"==typeof o){let t=e.join(":");if(r.test(t)){let e=parseInt((t.match(a)||["","-1"])[1],10);null!==o&&(o=c(o,e,l.decimalPoint,t.indexOf(",")>-1?l.thousandsSep:""))}else o=h.dateFormat(t,o)}s.lastIndex=0,s.test(n.find)&&sO(o)&&(o=`"${o}"`)}e=e.replace(n.find,sx(o,""))}),f?sM(e,t,i):e}function sS(e,t,i,n){t*=1;let s,o,[r,a]=(e=+e||0).toString().split("e").map(Number),l=this?.options?.lang||sm.lang,h=(e.toString().split(".")[1]||"").split("e")[0].length,c=t,d={};i??(i=l.decimalPoint),n??(n=l.thousandsSep),-1===t?t=Math.min(h,20):sw(t)?t&&a<0&&((o=t+a)>=0?(r=+r.toExponential(o).split("e")[0],t=o):(r=Math.floor(r),e=t<20?+(r*Math.pow(10,a)).toFixed(t):0,a=0)):t=2,a&&(t??(t=2),e=r),sw(t)&&t>=0&&(d.minimumFractionDigits=t,d.maximumFractionDigits=t),""===n&&(d.useGrouping=!1);let u=n||i,p=u?"en":this?.locale||l.locale||sg,m=JSON.stringify(d)+p;return s=(sN[m]??(sN[m]=new Intl.NumberFormat(p,d))).format(e),u&&(s=s.replace(/([,\.])/g,"_$1").replace(/_\,/g,n??",").replace("_.",i??".")),(t||0!=+s)&&(!(a<0)||c)||(s="0"),a&&0!=+s&&(s+="e"+(a<0?"":"+")+a),s}let{format:sR}={dateFormat:function(e,t,i){return sf.dateFormat(e,t,i)},format:sM,helpers:sE,numberFormat:sS},{createElement:sA,css:sP,defined:sI,diffObjects:sL,isArray:sD,isNumber:sk,merge:sH,isFunction:sj}=I;class sF extends eJ{constructor(e,t,i){super(e,t=sH(sF.defaultOptions,t),i),this.options=t,this.type="KPI",this.value=sA("span",{className:`${t.className}-value`},{},this.contentElement),this.subtitle=sA("span",{className:this.getSubtitleClassName()},{},this.contentElement)}async load(){return await super.load(),this.linkValueToChart(),this}resize(e,t){return super.resize(e,t),this.chart&&this.chart.container&&this.chart.reflow(),this}render(){super.render(),this.updateElements();let e=sF.charter?.Chart;return e&&this.options.chartOptions&&!this.chart?(this.chartContainer||(this.chartContainer=sA("div",{className:`${this.options.className}-chart-container`},{padding:"0.1px"},this.contentElement)),this.chart=e.chart(this.chartContainer,sH(sF.defaultChartOptions,this.options.chartOptions))):this.chart&&!this.options.chartOptions&&"chartOptions"in this.options&&(this.chart.destroy(),this.chart=void 0),this.sync.start(),this.emit({type:"afterRender"}),this}async update(e,t=!0){await super.update(e),e.chartOptions&&this.chart&&this.chart.update(e.chartOptions),t&&this.render()}onTableChanged(){this.setValue()}destroy(){this.chart?.destroy(),super.destroy()}getFormulaValue(){let e=this.options.formula,t=this.getDataTable(),i=t?.getColumn(this.options.columnId);if(!i||!e)return;if(sj(e))return e.call(this,i);let n=Array.isArray(i)?i.slice().filter(sI):Array.from(i);("MIN"===e||"MAX"===e||"MEDIAN"===e)&&(n=n.filter(e=>""!==e&&!isNaN(Number(e)))),"MEDIAN"===e&&n.sort((e,t)=>Number(e)-Number(t));try{return sF.formulaFunctions[e](n)}catch{console.warn("Invalid formula option provided.")}}getValue(){if(sI(this.options.value))return this.options.value;let e=this.getDataTable()?.getModified();if(e&&this.options.columnId){if(sI(this.options.formula))return this.getFormulaValue();let t=e.getColumn(this.options.columnId),i=t?.length||0;return String(e.getCell(this.options.columnId,i-1))}}setValue(e=this.getValue()){let{valueFormat:t,valueFormatter:i}=this.options;if(sI(e)){let n;sk(+e)&&(n=+e),i?e=i.call(this,e):t?e=sR(t,{value:e}):sk(e)&&(e=e.toLocaleString()),G.setElementHTML(this.value,""+e),this.linkValueToChart(n),this.prevValue=n}}linkValueToChart(e=this.getValue()){let t=this.chart,i=this.options.linkedValueTo;if(!t||!i.enabled||!sI(e)||!sk(+e))return;e*=1;let n=t.series[i.seriesIndex??0],s=n?.points[i.pointIndex??0];n?s?s.update({y:e}):n.addPoint({y:e}):t.addSeries({data:[{y:e}]})}updateElements(){let{style:e,subtitle:t}=this.options;this.setValue(),G.setElementHTML(this.subtitle,this.getSubtitle()),e&&sP(this.element,e),"object"==typeof t&&(t.style&&sP(this.subtitle,t.style),this.subtitle.className=this.getSubtitleClassName()),this.chartContainer&&(this.chartContainer.style.flex=this.options.chartOptions?"1":"0"),this.chart&&this.chart.reflow(),this.value.style.color=this.getValueColor()}getSubtitle(){let{subtitle:e,value:t}=this.options;if("string"==typeof e)return e;if(e){if(sk(this.prevValue)&&sk(t)){let i=t-this.prevValue,n="";if(i>0)n='<span style="color:green">&#9650;</span> +';else{if(!(i<0))return this.subtitle.innerHTML;n='<span style="color:red">&#9660;</span> '}if("diff"===e.type)return n+i.toLocaleString();if("diffpercent"===e.type)return n+sR("{v:,.2f}%",{v:i/this.prevValue*100})}return e.text||""}return""}getSubtitleClassName(){let{subtitle:e}=this.options;return`${eJ.defaultOptions.className}-subtitle`+("object"==typeof e&&e.className||"")}getValueColor(){let{threshold:e,thresholdColors:t,value:i}=this.options;if(t&&e&&sk(i)){if(sD(e)){for(let n=e.length-1;n>=0;n--)if(i>=e[n]){if(n+1<t.length)return t[n+1];return t[t.length-1]}}else if(i>=e)return t[1];return t[0]}return""}getOptionsOnDrop(e){let t=e.editMode.board.dataPool.getConnectorIds(),i={type:"KPI"};return t.length&&(i={...i,connector:{id:t[0]}}),i}getOptions(){return{...sL(this.options,sF.defaultOptions),type:"KPI"}}}sF.defaultOptions=sH(eJ.defaultOptions,ng),sF.predefinedSyncConfig=nf,sF.defaultChartOptions={chart:{type:"spline",zooming:{mouseWheel:{enabled:!1}}},title:{text:void 0},xAxis:{visible:!1},yAxis:{visible:!1,title:{text:null}},legend:{enabled:!1},credits:{enabled:!1},tooltip:{outside:!0},plotOptions:{series:{marker:{enabled:!1}}}},sF.formulaFunctions={SUM:nB,AVERAGE:nY,MEDIAN:n_,MAX:nW,MIN:nJ,COUNT:nq,PRODUCT:nX};let sz={type:"Navigator",className:[eJ.defaultOptions.className,`${eJ.defaultOptions.className}-navigator`].join(" "),chartOptions:{chart:{animation:!1,height:200,type:"column",zooming:{mouseWheel:{enabled:!1}}},credits:{enabled:!1},legend:{enabled:!1},navigator:{enabled:!0,outlineWidth:0,series:{animation:!1,lineWidth:0,colorIndex:0},xAxis:{endOnTick:!0,gridZIndex:4,labels:{x:1,y:22},opposite:!0,showFirstLabel:!0,showLastLabel:!0,startOnTick:!0,tickPosition:"inside"},yAxis:{maxPadding:.5}},plotOptions:{series:{borderRadius:0,marker:{enabled:!1},states:{hover:{enabled:!1}}}},scrollbar:{enabled:!0},title:{text:""},tooltip:{enabled:!1},xAxis:{visible:!1,minRange:5e-324},yAxis:{visible:!1}},editableOptions:(eJ.defaultOptions.editableOptions||[]).concat()},{defined:sV}=I,s$=function(e,t,i,n){let s=!1,o=!1;("object"!=typeof e.condition||"and"!==e.condition.operator)&&(e.condition={operator:"and",conditions:[]});let{conditions:r}=e.condition;for(let e=0,a=r.length;e<a;++e){let a=r[e];if(a&&"object"==typeof a&&("<="===a.operator||">="===a.operator)&&a.columnId===t&&("<="===a.operator?(a.value=n,o=!0):(a.value=i,s=!0),s&&o))return}o||r.push({operator:"<=",columnId:t,value:n}),s||r.push({operator:">=",columnId:t,value:i})},sB=function(e){let t={};if("object"!=typeof e.condition||"and"!==e.condition.operator)return[];let{conditions:i}=e.condition;for(let e=0,n=i.length;e<n;++e){let n=i[e];if(!n||"object"!=typeof n||"<="!==n.operator&&">="!==n.operator||"string"!=typeof n.columnId||!sV(n.value))continue;let s=n.columnId;t[s]||(t[s]={maxValue:1/0,minValue:-1/0,columnId:s}),"<="===n.operator?t[s].maxValue=n.value:t[s].minValue=n.value}return Object.values(t)},{Filter:sU}=th.types,{addEvent:sY}=I,s_={defaultOptions:{affectNavigator:!1},syncPair:{emitter:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.crossfilter,n=i.group?":"+i.group:"",s=async e=>{if(t.connectorHandlers?.[0]?.connector){let i=t.connectorHandlers[0].connector.getTable(),s=t.board.dataCursor,o=t.getColumnAssignment()[0],[r,a]=t.getAxisExtremes(),l=i.getModifier();l instanceof sU?s$(l.options,o,r,a):l=new sU({condition:{operator:"and",conditions:[{columnId:o,operator:">=",value:r},{columnId:o,operator:"<=",value:a}]}}),await i.setModifier(l),s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,r),state:"crossfilter"+n},e),s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,a),state:"crossfilter"+n},e)}};return sY(t.chart.xAxis[0],"afterSetExtremes",function(t){clearTimeout(e),e=setTimeout(s,50,this,t)})},handler:void 0}},{Filter:sG}=th.types,{addEvent:sW,pick:sK,defined:sJ}=I,sq={defaultOptions:{},syncPair:{emitter:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.extremes,n=i.group?":"+i.group:"",s=e=>{if(t.connectorHandlers?.[0]?.connector){let i=t.connectorHandlers[0].connector.getTable(),s=t.board.dataCursor,o=t.getColumnAssignment()[0],[r,a]=t.getAxisExtremes();s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,r),state:"xAxis.extremes.min"+n},e),s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,a),state:"xAxis.extremes.max"+n},e)}};return sW(t.chart.xAxis[0],"afterSetExtremes",function(t){clearTimeout(e),e=setTimeout(s,50,this,t)})},handler:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.extremes,n=i.group?":"+i.group:"",s=t.board.dataCursor,o=e=>{let i=e.cursor;if(!t.connectorHandlers?.[0]?.connector)return;let s=t.connectorHandlers[0].connector.getTable(),o=s.getColumnIds()[0],r=s.getRowCount(),a=0;"range"===i.type?(r=i.lastRow,a=i.firstRow,i.columns&&(o=sK(i.columns[0],o))):i.state==="xAxis.extremes.max"+n?(o=sK(i.column,o),r=sK(i.row,r)):(o=sK(i.column,o),a=sK(i.row,a));let l=s.getModifier();if("string"==typeof o&&l instanceof sG){let e=s.getCell(o,a),t=s.getCell(o,r);sJ(t)&&sJ(e)&&(s$(l.options,o,e,t),s.setModifier(l))}};return(e=t.connectorHandlers?.[0]?.connector?.getTable())&&(s.addListener(e.id,"xAxis.extremes"+n,o),s.addListener(e.id,"xAxis.extremes.max"+n,o),s.addListener(e.id,"xAxis.extremes.min"+n,o)),()=>{let e=t.connectorHandlers?.[0]?.connector?.getTable();e&&(s.removeListener(e.id,"xAxis.extremes"+n,o),s.removeListener(e.id,"xAxis.extremes.max"+n,o),s.removeListener(e.id,"xAxis.extremes.min"+n,o))}}}},sZ={defaultSyncPairs:{crossfilter:s_.syncPair,extremes:sq.syncPair},defaultSyncOptions:{crossfilter:s_.defaultOptions,extremes:sq.defaultOptions}},{diffObjects:sX,isNumber:sQ,isString:s0,merge:s1,pick:s2}=I;class s3 extends eJ{constructor(e,t){super(e,t),this.type="Navigator",this.options=s1(s3.defaultOptions,t);const i=s3.charter.Chart||Q.win.Highcharts;this.chartContainer=Q.win.document.createElement("div"),this.chart=i.chart(this.chartContainer,this.options.chartOptions||{}),this.chartContainer.classList.add(Q.classNamePrefix+"navigator"),this.sync.syncConfig.crossfilter?.enabled&&this.chart.update(s1({navigator:{xAxis:{labels:{format:"{value}"}}}},this.options.chartOptions||{}),!1)}adjustNavigator(){let e=this.chart,t=s2(e.chartHeight,this.contentElement.clientHeight),i=this.contentElement.clientWidth,n={};if((e.chartHeight!==t||e.chartWidth!==i)&&(n.chart={height:t,width:i}),e.navigator){let i=e.navigator,s=i.top-e.plotTop+i.height;i.height!==s&&(n.navigator={handles:{height:Math.round(t/4)},height:s}),Object.keys(n).length&&e.update(n,!1),i.series&&i.series[0]&&i.series[0].update({type:e.series[0].type},!1)}else Object.keys(n).length&&e.update(n,!1)}getColumnAssignment(){let e,t=this.options.columnAssignment??{};for(let i of Object.keys(t))if(null!==(e=t[i]))return[i,e];let i=this.getDataTable();if(i){let e=i.getColumnIds();if(e.length)return[e[0],"y"]}return["","y"]}getOptions(){return{...sX(this.options,sz),type:"Navigator"}}getAxisExtremes(){let e=this.chart.xAxis[0],t=e.getExtremes(),i=sQ(t.min)?t.min:t.dataMin,n=sQ(t.max)?t.max:t.dataMax;return this.categories?[this.categories[Math.max(0,Math.ceil(i))],this.categories[Math.min(this.categories.length-1,Math.floor(n))]]:e.hasNames?[e.names[Math.ceil(i)],e.names[Math.floor(n)]]:[i,n]}async load(){return await super.load(),this.contentElement.appendChild(this.chartContainer),this.parentElement.appendChild(this.element),this.adjustNavigator(),this.emit({type:"afterLoad"}),this}onTableChanged(){this.renderNavigator()}redrawNavigator(){let e=this.resizeTimeouts;for(let t=0,i=e.length;t<i;++t)clearTimeout(e[t]);e.length=0,e.push(setTimeout(()=>{this.adjustNavigator(),this.chart.redraw()},33))}render(){return super.render(),this.renderNavigator(),this.sync.start(),this.emit({type:"afterRender"}),this}renderNavigator(){let e=this.chart,t=this.getDataTable();if(t){let i,n=this.getColumnAssignment(),s=t.getColumn(n[0],!0)||[];i=this.sync.syncConfig.crossfilter?.enabled?this.generateCrossfilterData():s.slice(),e.series[0]?e.series[0].setData(i,!1):e.addSeries({id:t.id,data:i},!1)}this.redrawNavigator()}generateCrossfilterData(){let e,t=this.sync.syncConfig.crossfilter,i=this.getDataTable(),n=i?.getColumn(this.getColumnAssignment()[0],!0)||[];if(!i||n.length<1||!t)return[];let s=[],o=[];for(let e=0,t=n.length;e<t;e++){let t=n[e];if(null!==t){if(sQ(t)||(t=`${t}`),void 0===this.stringData)this.stringData=s0(t);else if(this.stringData!==s0(t))throw Error("Mixed data types in crossfilter navigator are not supported.");s.push(t),-1===o.indexOf(t)&&o.push(t)}}o.sort((e,t)=>s2(e,NaN)<s2(t,NaN)?-1:+(e!==t));let r=i.getModifier()?.options;if(t.affectNavigator&&r?.type==="Filter"){let t=[],n=[],o=sB(r);for(let e=0,s=o.length;e<s;e++)o[e].columnId!==this.getColumnAssignment()[0]&&(t.push(o[e]),n.push(i.getColumn(o[e].columnId,!0)||[]));e=[];let a=t.length;for(let i=0,o=s.length;i<o;i++){let o=s[i],r=!0;for(let e=0;e<a;e++){let s=t[e];if(!(n[e][i]>=(s.minValue??-1/0)&&n[e][i]<=(s.maxValue??1/0))){r=!1;break}}r&&e.push(o)}}else e=s;let a=[];if(this.stringData){this.categories=o;for(let e=0,t=o.length;e<t;e++)a.push([e,null])}else for(let e=0,t=o.length;e<t;e++)a.push([o[e],null]);for(let t=0,i=e.length;t<i;t++){let i=o.indexOf(e[t]);a[i][1]=(a[i][1]||0)+1}return a}resize(e,t){return super.resize(e,t),this.redrawNavigator(),this}async update(e,t=!0){let i=this.chart;await super.update(e,!1),e.chartOptions&&i.update(s1(this.sync.syncConfig.crossfilter?.enabled?{navigator:{xAxis:{labels:{format:"{value}"}}}}:{},e.chartOptions),!1),this.emit({type:"afterUpdate"}),t&&this.render()}getOptionsOnDrop(){return{}}}s3.defaultOptions=s1(eJ.defaultOptions,sz),s3.predefinedSyncConfig=sZ;let s6={custom:{connectHighcharts:function(e){nu.charter=e,sF.charter=e,s3.charter=e}},name:"Highcharts.DashboardsPlugin",onRegister:function(e){let{ComponentRegistry:t}=e;t.registerComponent("Highcharts",nu),t.registerComponent("KPI",sF),t.registerComponent("Navigator",s3)},onUnregister:function(e){}},s5={};Q.board=iG.board,Q.addEvent=eI.addEvent,Q.error=eI.error,Q.merge=eI.merge,Q.removeEvent=eI.removeEvent,Q.setOptions=function(e){iR(!0,iA,e)},Q.uniqueKey=eI.uniqueKey,Q.AST=G,Q.Board=iG,Q.Component=eJ,Q.ComponentRegistry=ib,Q.DataConnector=tP,Q.DataConverter=ti,Q.DataCursor=iu,Q.DataModifier=th,Q.DataPool=iS,Q.DataTable=tE,Q.defaultOptions=iA,Q.GridPlugin=i5,Q.HighchartsPlugin=s6,Q.PluginHandler={addPlugin:function(e,t=e.name){let{maxRevision:i,minRevision:n,onRegister:s}=e;if(s5[t]){if(t!==e.name)throw Error(`Plugin '${t}' already registered.`);return}if("number"==typeof n&&n>0||"number"==typeof i&&i<0)throw Error(`Plugin '${t}' does not support revision 0.`);s({Board:iG,ComponentRegistry:ib,Sync:eC,revision:0}),s5[t]=e},removePlugin:function(e){s5[e]&&(s5[e].onUnregister({ComponentRegistry:ib,Board:iG,Sync:eC,revision:0}),delete s5[e])},registry:s5,revision:0},Q.Sync=eC,I.extend(Q,I),Q.win.Dashboards||(Q.win.Dashboards=Q),Q.win.Grid&&(i5.custom.connectGrid(Q.win.Grid),Q.PluginHandler.addPlugin(i5)),Q.win.Highcharts&&(s6.custom.connectHighcharts(Q.win.Highcharts),Q.PluginHandler.addPlugin(s6));let s4=Q;return r.default})());