@interopio/widget 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,43 @@
1
- import React, { createContext, useContext, useEffect, memo, useState, forwardRef, useMemo, useCallback, useRef, useLayoutEffect } from 'react';
2
- import require$$0 from 'react-dom';
1
+ import * as i from 'react';
2
+ import i__default, { createContext, useContext, useEffect, memo, useState, forwardRef, useCallback, useMemo, useRef, useLayoutEffect } from 'react';
3
+ import * as require$$0 from 'react-dom';
4
+ import require$$0__default from 'react-dom';
5
+
6
+ const GLUE42_EVENT_NAME = "Glue42";
7
+ const WIDGET_READY = "widgetFactoryReady";
8
+ const REQUEST_WIDGET_READY = "requestWidgetFactoryReady";
9
+
10
+ class EventController {
11
+ events = {
12
+ [REQUEST_WIDGET_READY]: { name: REQUEST_WIDGET_READY, handle: this.handleWidgetReadyRequest.bind(this) },
13
+ };
14
+ wireCustomEventListener = () => {
15
+ window.addEventListener(GLUE42_EVENT_NAME, this.handleMessage.bind(this));
16
+ };
17
+ notifyStarted() {
18
+ this.send(WIDGET_READY);
19
+ }
20
+ handleMessage(event) {
21
+ const data = event.detail;
22
+ if (!data?.glue42) {
23
+ return;
24
+ }
25
+ const eventName = data.glue42.event;
26
+ const foundHandler = this.events[eventName];
27
+ if (!foundHandler) {
28
+ return;
29
+ }
30
+ foundHandler.handle(data.glue42.message);
31
+ }
32
+ handleWidgetReadyRequest() {
33
+ this.send(WIDGET_READY);
34
+ }
35
+ send(eventName, message) {
36
+ const payload = { glue42: { event: eventName, message } };
37
+ const event = new CustomEvent(GLUE42_EVENT_NAME, { detail: payload });
38
+ window.dispatchEvent(event);
39
+ }
40
+ }
3
41
 
4
42
  /**
5
43
  * Wraps values in an `Ok` type.
@@ -789,23 +827,19 @@ const channelSelectorDecoder = object({
789
827
  });
790
828
  const positionDecoder = oneOf(constant("top"), constant("bottom"), constant("left"), constant("right"));
791
829
  const modeDecoder = oneOf(constant("default"), constant("compact"));
830
+ const displayModeDecoder = oneOf(constant("all"), constant("fdc3"));
831
+ const channelsDecoder = object({
832
+ selector: optional(channelSelectorDecoder),
833
+ displayMode: optional(displayModeDecoder)
834
+ });
792
835
  const configDecoder = object({
793
- channelSelector: optional(channelSelectorDecoder),
836
+ enable: boolean(),
837
+ channels: optional(channelsDecoder),
794
838
  position: optional(positionDecoder),
795
839
  mode: optional(modeDecoder),
796
840
  displayInWorkspace: optional(boolean())
797
841
  });
798
842
 
799
- const defaultConfig = {
800
- channelSelector: {
801
- enable: true,
802
- type: "default"
803
- },
804
- position: "bottom",
805
- mode: "default",
806
- displayInWorkspace: false
807
- };
808
-
809
843
  const browserPlatformMethodName = "T42.Web.Platform.Control";
810
844
 
811
845
  class Bridge {
@@ -878,20 +912,26 @@ class Bridge {
878
912
 
879
913
  var createRoot;
880
914
 
881
- var m$1 = require$$0;
915
+ var m$1 = require$$0__default;
882
916
  {
883
917
  createRoot = m$1.createRoot;
884
918
  m$1.hydrateRoot;
885
919
  }
886
920
 
887
- let GlueControllerContext;
888
- const createGlueControllerContext = (glueController) => {
889
- GlueControllerContext = createContext(glueController);
890
- return GlueControllerContext;
921
+ const GlueControllerContext = createContext(null);
922
+ const useGlueController = () => {
923
+ const context = useContext(GlueControllerContext);
924
+ if (!context) {
925
+ throw new Error(`useGlueController must be used within a GlueControllerContextProvider`);
926
+ }
927
+ return context;
928
+ };
929
+ const CustomGlueControllerProvider = ({ glueController, children }) => {
930
+ return i__default.createElement(GlueControllerContext.Provider, { value: glueController }, children);
891
931
  };
892
932
 
893
933
  const useThemeSync = () => {
894
- const glueController = useContext(GlueControllerContext);
934
+ const glueController = useGlueController();
895
935
  useEffect(() => {
896
936
  let isUnsubscribed = false;
897
937
  const themesApi = glueController.io?.themes;
@@ -950,15 +990,15 @@ const drop = (e, setSelectedPosition) => {
950
990
  };
951
991
 
952
992
  const DragSection = () => {
953
- return (React.createElement("div", { className: "drag-element" },
954
- React.createElement("div", null),
955
- React.createElement("div", null),
956
- React.createElement("div", null),
957
- React.createElement("div", null),
958
- React.createElement("div", null),
959
- React.createElement("div", null),
960
- React.createElement("div", null),
961
- React.createElement("div", null)));
993
+ return (i__default.createElement("div", { className: "drag-element" },
994
+ i__default.createElement("div", null),
995
+ i__default.createElement("div", null),
996
+ i__default.createElement("div", null),
997
+ i__default.createElement("div", null),
998
+ i__default.createElement("div", null),
999
+ i__default.createElement("div", null),
1000
+ i__default.createElement("div", null),
1001
+ i__default.createElement("div", null)));
962
1002
  };
963
1003
 
964
1004
  var jsxRuntime = {exports: {}};
@@ -974,8 +1014,8 @@ var reactJsxRuntime_production_min = {};
974
1014
  * This source code is licensed under the MIT license found in the
975
1015
  * LICENSE file in the root directory of this source tree.
976
1016
  */
977
- var f$1=React,k$1=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$1={key:!0,ref:!0,__self:!0,__source:!0};
978
- function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p$1.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k$1,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
1017
+ var f=i__default,k$1=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
1018
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k$1,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
979
1019
 
980
1020
  {
981
1021
  jsxRuntime.exports = reactJsxRuntime_production_min;
@@ -1113,7 +1153,7 @@ const useIOConnectInit = (settings, onInitError) => {
1113
1153
  const IOConnectContext = createContext(null);
1114
1154
  const IOConnectProvider = memo(({ children, fallback = null, settings = {}, onInitError }) => {
1115
1155
  const glue = useIOConnectInit(settings, onInitError);
1116
- return glue ? (React.createElement(IOConnectContext.Provider, { value: glue }, children)) : (React.createElement(React.Fragment, null, fallback));
1156
+ return glue ? (i__default.createElement(IOConnectContext.Provider, { value: glue }, children)) : (i__default.createElement(i__default.Fragment, null, fallback));
1117
1157
  });
1118
1158
  IOConnectProvider.propTypes = {
1119
1159
  children: propTypesExports.node,
@@ -1122,12 +1162,16 @@ IOConnectProvider.propTypes = {
1122
1162
  };
1123
1163
  IOConnectProvider.displayName = 'IOConnectProvider';
1124
1164
 
1125
- function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p,b={exports:{}};
1165
+ function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b,y={exports:{}};
1126
1166
  /*!
1127
1167
  Copyright (c) 2018 Jed Watson.
1128
1168
  Licensed under the MIT License (MIT), see
1129
1169
  http://jedwatson.github.io/classnames
1130
- */p=b,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var o=arguments[t];o&&(e=i(e,n(o)));}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return "";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var o="";for(var a in n)e.call(n,a)&&n[a]&&(o=i(o,a));return o}function i(e,t){return t?e?e+" "+t:e+t:e}p.exports?(t.default=t,p.exports=t):window.classNames=t;}();var v=f(b.exports);function y({className:t,size:n="16",variant:i="workspace",...o}){const a=v(t,"icon",{[`icon-size-${n}`]:n});return jsxRuntimeExports.jsx("span",{className:a,...o,children:jsxRuntimeExports.jsx("i",{className:`icon-${i}`})})}function w({className:i="io-alert",variant:o="low",title:a="Alert title",text:s,children:r,...l}){const c=v(i,o);return jsxRuntimeExports.jsx("div",{className:c,...l,children:a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("h3",{className:`io-color-${o}`,children:[jsxRuntimeExports.jsx(y,{variant:{info:"circle-info",low:"circle-info",medium:"circle-info",high:"triangle-exclamation",critical:"ban"}[o],size:"12"}),a]}),s&&jsxRuntimeExports.jsx("p",{children:s}),r]})})}function N({className:t="io-badge",variant:n="default",children:i,...o}){const a=v(t,{[`${t}-${n}`]:"default"!==n});return jsxRuntimeExports.jsx("div",{className:a,...o,children:i})}function S({className:t="io-title",tag:n="h2",size:i="normal",text:o="Title",...a}){const s=n,r=v({[`${t}-semibold`]:"small"===i,[t]:"normal"===i,[`${t}-${i}`]:"large"===i});return jsxRuntimeExports.jsx(s,{className:r,...a,children:o})}function k({className:n="io-block",title:i,titleSize:o="normal",tag:a,hint:s,children:r,...l}){return jsxRuntimeExports.jsxs("div",{className:n,...l,children:[i&&jsxRuntimeExports.jsx(S,{tag:a,text:i,size:o}),r,s&&jsxRuntimeExports.jsx("p",{className:"io-text-smaller",children:s})]})}function C({className:n="io-btn",variant:o="default",size:a="normal",icon:s,iconRight:r=!1,text:l,onClick:c,disabled:d,children:u,...h}){const m=v(n,{[`${n}-${o}`]:"primary"===o||"outline"===o||"link"===o,[`${n}-lg`]:"large"===a}),g=useCallback((e=>{if(!d)return c?c(e):void 0;e.preventDefault();}),[c,d]);return jsxRuntimeExports.jsxs("button",{type:"button",className:m,"aria-label":"button",onClick:g,disabled:d,tabIndex:0,...h,children:[s&&!r&&jsxRuntimeExports.jsx(y,{variant:s,size:"12"}),u??l,s&&r&&jsxRuntimeExports.jsx(y,{variant:s,size:"12"})]})}function B({className:t="io-btn-icon",variant:n="default",icon:o="workspace",size:a="16",iconSize:s="16",onClick:r,disabled:l,children:c,...d}){const u=v(t,{[`${t}-${n}`]:"default"!==n,[`${t}-size-${a}`]:"24"===a||"32"===a}),h=useCallback((e=>{if(!l)return r?r(e):void 0;e.preventDefault();}),[r,l]);return jsxRuntimeExports.jsx("button",{type:"button",className:u,"aria-label":"button",onClick:h,disabled:l,...d,children:c??(o&&jsxRuntimeExports.jsx(y,{variant:o,size:s}))})}const x=createContext({});const I=createContext({});function $({className:n="io-list",prepend:o,append:s,isSelected:r,disabled:l=!1,children:c,...d}){const{variant:u,selected:h,checkIcon:m,handleItemClick:g}=useContext(I),f=r??h?.some((e=>e.children===c)),p=v(`${n}-item`,{selected:"default"!==u&&f,[`${n}-item-disabled`]:l}),b=useCallback(((e,t)=>{l?e.preventDefault():g&&g(e,t);}),[g,l]);return jsxRuntimeExports.jsxs("li",{className:p,role:"menuitem","aria-roledescription":"menuitem",tabIndex:0,onClick:e=>b(e,{children:c}),...d,children:[(m&&"none"!==m||o)&&jsxRuntimeExports.jsxs("div",{className:`${n}-left-column`,children:["default"!==u&&"none"!==m&&jsxRuntimeExports.jsx(y,{variant:m}),o]}),jsxRuntimeExports.jsx("span",{className:`${n}-text`,children:c}),s&&jsxRuntimeExports.jsx("div",{className:`${n}-right-column`,children:s})]})}function T({className:n="io-list-item io-list-item-title",prepend:i,append:o,children:a,...s}){return jsxRuntimeExports.jsxs("li",{className:n,...s,children:[i,jsxRuntimeExports.jsx("span",{className:"io-list-text",children:a}),o]})}function A({className:n="io-list-item io-list-item-section",prepend:i,append:o,children:a,...s}){return jsxRuntimeExports.jsxs("li",{className:n,...s,children:[i,jsxRuntimeExports.jsx("span",{className:"io-list-text",children:a}),o]})}function P({className:t="io-list",variant:n="default",checkIcon:i="none",children:o,...a}){const[r,l]=useState([]),c=v(t,{[`${t}-selectable`]:"default"!==n});return jsxRuntimeExports.jsx(I.Provider,{value:{variant:n,selected:r,checkIcon:i,handleItemClick:(e,t)=>{if("single"===n)l([t]);else {const e=r.some((e=>e.children?.toString()===t.children?.toString())),n=r.filter((e=>e.children!==t.children));l(e?n:[...r,t]);}}},children:jsxRuntimeExports.jsx("ul",{className:c,...a,children:o})})}function F(e,t){useEffect((()=>{const n=n=>{e.current&&!e.current.contains(n.target)&&t();};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n);}}),[e,t]);}function L({className:t="io-dropdown",variant:n="default",align:o="down",disabled:a,children:r,...c}){const[d,u]=useState(!1),h=useRef(null),m=v(t,{[`${t}-open`]:d,[`${t}-${n}`]:"default"!==n}),g=useCallback((()=>{u(!d);}),[d]);return F(h,useCallback((()=>{u(!1);}),[])),jsxRuntimeExports.jsx(x.Provider,{value:{isOpen:d,handleOpen:g,variant:n,align:o,disabled:a},children:jsxRuntimeExports.jsx("div",{className:m,ref:h,...c,children:r})})}function z({className:t="io-btn-group",variant:n="default",align:i="left",children:o,...a}){const s=v(t,{[`${t}-sticky`]:"sticky"===n,[`${t}-append`]:"append"===n,[`${t}-fullwidth`]:"fullwidth"===n,[`${t}-right`]:"right"===i});return jsxRuntimeExports.jsx("div",{className:s,...a,children:o})}function _({className:t="io-header",draggable:n=!1,children:i,...o}){const a=v(t,{draggable:n});return jsxRuntimeExports.jsx("header",{className:a,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--spacing-8)"},...o,children:i})}function E({className:t="io-dialog-header",children:n,...i}){return jsxRuntimeExports.jsx(_,{className:t,...i,children:n})}function D({className:t="io-dialog-body",children:n,...i}){return jsxRuntimeExports.jsx("div",{className:t,...i,children:n})}function H({className:t="io-footer",children:n,...i}){return jsxRuntimeExports.jsx("footer",{className:t,...i,children:n})}function O({className:t="io-dialog-footer",...n}){return jsxRuntimeExports.jsx(H,{className:t,...n})}function M({className:n="io-loader",size:i="large",variant:o="default",align:a="up",text:s,...r}){const l=v(n,{[`${n}-${o}`]:"default"!==o,[`${n}-md`]:"normal"===i,[`${n}-sm`]:"small"===i,[`direction-${a}`]:a});return jsxRuntimeExports.jsxs("div",{className:l,...r,children:[jsxRuntimeExports.jsx("div",{className:`${n}-icon`}),s&&jsxRuntimeExports.jsx("div",{className:`${n}-text`,children:s})]})}function V({className:t="io-panel-header",children:n,...i}){return jsxRuntimeExports.jsx(_,{className:t,...i,children:n})}P.Item=$,P.ItemTitle=T,P.ItemSection=A,L.Button=function({icon:t="chevron-down",...n}){const{handleOpen:o,disabled:s}=useContext(x),r=useCallback((e=>{e.stopPropagation(),o&&o();}),[o]);return jsxRuntimeExports.jsx(C,{icon:t,iconRight:!0,onClick:r,disabled:s,...n})},L.ButtonIcon=function({size:t="32",...n}){const{handleOpen:o,disabled:s}=useContext(x),r=useCallback((()=>{o&&o();}),[o]);return jsxRuntimeExports.jsx(B,{size:t,onClick:r,disabled:s,...n})},L.Content=function({className:t="io-dropdown-content",...n}){const{handleOpen:o}=useContext(x),s=useCallback((e=>{e.stopPropagation(),o&&o();}),[o]);return jsxRuntimeExports.jsx("div",{className:t,role:"button",onClick:s,...n})},L.List=P,L.Item=$,L.ItemTitle=T,L.ItemSection=A,z.Button=C,z.ButtonIcon=B,z.Dropdown=L,_.Title=S,_.ButtonGroup=z,_.Button=C,_.ButtonIcon=B,_.Dropdown=L,E.Title=S,E.ButtonGroup=z,E.Button=C,E.ButtonIcon=B,E.Dropdown=L,D.Content=function({className:t="io-dialog-content",children:n,...i}){return jsxRuntimeExports.jsx("div",{className:t,...i,children:n})},H.ButtonGroup=z,H.Button=C,H.ButtonIcon=B,H.Dropdown=L,O.ButtonGroup=z,O.Button=C,O.ButtonIcon=B,O.Dropdown=L,V.Title=S,V.ButtonGroup=z,V.Button=C,V.ButtonIcon=B,V.Dropdown=L;const R=forwardRef((({className:t="io-panel-body",children:n,...i},o)=>jsxRuntimeExports.jsx("div",{className:t,ref:o,...i,children:n})));function J({className:t="io-panel-footer",...n}){return jsxRuntimeExports.jsx(H,{className:t,...n})}function U({className:t="io-panel",children:n,...i}){return jsxRuntimeExports.jsx("div",{className:t,...i,children:n})}function Q({className:t="io-progress",variant:n="active",value:i=0,...o}){return jsxRuntimeExports.jsx("div",{className:`${t} ${n}`,...o,children:jsxRuntimeExports.jsx("div",{className:`${t}-bar`,style:{width:`${i<0?0:i>100?100:i}%`}})})}function Y({text:t="Label",...n}){return jsxRuntimeExports.jsx("label",{...n,children:t})}R.displayName="PanelBody",J.ButtonGroup=z,J.Button=C,J.ButtonIcon=B,J.Dropdown=L,U.Header=V,U.Body=R,U.Footer=J;const K=forwardRef((function({id:n="input",className:i="io",type:o="text",name:a="input",align:s="up",label:r,iconPrepend:l,iconAppend:c,placeholder:d,disabled:u,readOnly:h,...m},g){const f=v(`${i}-control-input`,{[`${i}-control-leading-icon`]:l,[`${i}-control-trailing-icon`]:c,[`${i}-control-disabled`]:u,[`${i}-control-readonly`]:h,[`direction-${s}`]:s});return jsxRuntimeExports.jsxs("div",{className:f,children:[r&&jsxRuntimeExports.jsx(Y,{htmlFor:n,text:r}),l&&jsxRuntimeExports.jsx(y,{variant:l}),jsxRuntimeExports.jsx("input",{id:n,className:`${i}-input`,ref:g,type:o,name:a,tabIndex:0,placeholder:d||(()=>{switch(o){case"email":return "Enter your email here...";case"number":return "Enter number here...";case"password":return "Enter your password here...";case"tel":return "Enter your phone number here...";case"file":return "Select a file...";default:return "Enter text here..."}})(),disabled:u,readOnly:h,...m}),c&&jsxRuntimeExports.jsx(y,{variant:c})]})})),W=forwardRef((function({id:n="textarea",className:i="io",name:o="textarea",align:a="up",label:s,rows:r=4,placeholder:l="Enter text here...",disabled:c,readOnly:d,...u},h){const m=v(`${i}-control-textarea`,{[`${i}-control-disabled`]:c,[`${i}-control-readonly`]:d,[`direction-${a}`]:a});return jsxRuntimeExports.jsxs("div",{className:m,children:[s&&jsxRuntimeExports.jsx(Y,{htmlFor:n,text:s}),jsxRuntimeExports.jsx("textarea",{id:n,className:`${i}-textarea`,ref:h,name:o,tabIndex:0,placeholder:l,disabled:c,readOnly:d,rows:r,...u})]})})),X=forwardRef((function({id:n="checkbox",className:i="io",name:o="checkbox",align:a="left",label:s,checked:r,disabled:l,...c},d){const u=v(`${i}-control-checkbox`,{[`${i}-control-checked`]:r,[`${i}-control-disabled`]:l,[`direction-${a}`]:a});return jsxRuntimeExports.jsxs("div",{className:u,children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:n,className:`${i}-checkbox`,ref:d,name:o,tabIndex:0,checked:r,disabled:l,...c}),s&&jsxRuntimeExports.jsx(Y,{htmlFor:n,text:s})]})}));forwardRef((function({id:n="radio",className:i="io",name:o="radio",align:a="left",label:s,checked:r,disabled:l,...c},d){const u=v(`${i}-control-radio`,{[`${i}-control-checked`]:r,[`${i}-control-disabled`]:l,[`direction-${a}`]:a});return jsxRuntimeExports.jsxs("div",{className:u,children:[jsxRuntimeExports.jsx("input",{type:"radio",id:n,className:`${i}-radio`,ref:d,name:o,tabIndex:0,checked:r,disabled:l,...c}),s&&jsxRuntimeExports.jsx(Y,{htmlFor:n,text:s})]})}));const ee=forwardRef((function({id:n="toggle",className:i="io",name:o="toggle",align:a="left",label:s="Toggle",checked:r,disabled:l,...c},d){const u=v(`${i}-control-toggle`,{[`${i}-control-checked`]:r,[`${i}-control-disabled`]:l,[`direction-${a}`]:a});return jsxRuntimeExports.jsx("div",{className:u,children:jsxRuntimeExports.jsxs("label",{className:`${i}-toggle`,tabIndex:0,children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:n,className:`${i}-checkbox`,ref:d,name:o,checked:r,disabled:l,...c}),jsxRuntimeExports.jsx("span",{className:"slider"}),s]})})}));function ne(e,t){const n=useCallback((n=>{t.some((e=>n.key===e))&&(n.preventDefault(),e());}),[e,t]);useEffect((()=>(document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n);})),[n]);}function ae(e,t=500){const[n,i]=useState(e);return useEffect((()=>{const n=setTimeout((()=>{i(e);}),t);return ()=>clearTimeout(n)}),[e,t]),n}createContext({theme:"dark"});function ue(e,t,n){return Math.min(Math.max(e,n),t)}class he extends Error{constructor(e){super(`Failed to parse color: "${e}"`);}}var me=he;function ge(e){if("string"!=typeof e)throw new me(e);if("transparent"===e.trim().toLowerCase())return [0,0,0,0];let t=e.trim();t=Se.test(e)?function(e){const t=e.toLowerCase().trim(),n=pe[function(e){let t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return (t>>>0)%2341}(t)];if(!n)throw new me(e);return `#${n}`}(e):e;const n=ve.exec(t);if(n){const e=Array.from(n).slice(1);return [...e.slice(0,3).map((e=>parseInt(be(e,2),16))),parseInt(be(e[3]||"f",2),16)/255]}const i=ye.exec(t);if(i){const e=Array.from(i).slice(1);return [...e.slice(0,3).map((e=>parseInt(e,16))),parseInt(e[3]||"ff",16)/255]}const o=we.exec(t);if(o){const e=Array.from(o).slice(1);return [...e.slice(0,3).map((e=>parseInt(e,10))),parseFloat(e[3]||"1")]}const a=Ne.exec(t);if(a){const[t,n,i,o]=Array.from(a).slice(1).map(parseFloat);if(ue(0,100,n)!==n)throw new me(e);if(ue(0,100,i)!==i)throw new me(e);return [...Ce(t,n,i),Number.isNaN(o)?1:o]}throw new me(e)}const fe=e=>parseInt(e.replace(/_/g,""),36),pe="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce(((e,t)=>{const n=fe(t.substring(0,3)),i=fe(t.substring(3)).toString(16);let o="";for(let e=0;e<6-i.length;e++)o+="0";return e[n]=`${o}${i}`,e}),{});const be=(e,t)=>Array.from(Array(t)).map((()=>e)).join(""),ve=new RegExp(`^#${be("([a-f0-9])",3)}([a-f0-9])?$`,"i"),ye=new RegExp(`^#${be("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),we=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${be(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Ne=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,Se=/^[a-z]+$/i,ke=e=>Math.round(255*e),Ce=(e,t,n)=>{let i=n/100;if(0===t)return [i,i,i].map(ke);const o=(e%360+360)%360/60,a=(1-Math.abs(2*i-1))*(t/100),s=a*(1-Math.abs(o%2-1));let r=0,l=0,c=0;o>=0&&o<1?(r=a,l=s):o>=1&&o<2?(r=s,l=a):o>=2&&o<3?(l=a,c=s):o>=3&&o<4?(l=s,c=a):o>=4&&o<5?(r=s,c=a):o>=5&&o<6&&(r=a,c=s);const d=i-a/2;return [r+d,l+d,c+d].map(ke)};function Be(e){return function(e){if("transparent"===e)return 0;function t(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}const[n,i,o]=ge(e);return .2126*t(n)+.7152*t(i)+.0722*t(o)}(e)>.179}function xe({className:t="io-channel-badge",channel:n,...i}){return jsxRuntimeExports.jsx("div",{className:t,style:{color:(o=n.color,Be(o)?"#000":"#fff"),backgroundColor:n.color},...i,children:n.label});var o;}const Ie=createContext({});function $e({channel:o,isSelected:s,onChannelSelect:r,...l}){const{variant:c,selectedChannels:d}=useContext(Ie),u=s||o.isSelected||d?.includes(o),h=useCallback((e=>{r&&r(e);}),[r]);return jsxRuntimeExports.jsx($,{prepend:jsxRuntimeExports.jsx(xe,{channel:o}),append:jsxRuntimeExports.jsx("single"===c?()=>u&&jsxRuntimeExports.jsx(y,{variant:"check"})||null:()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{onClick:e=>e.stopPropagation(),children:jsxRuntimeExports.jsx(ee,{label:"Publish",checked:o.write,onChange:()=>h({...o,isSelected:!(!o.read&&(o.write||o.read)),write:!o.write})})}),jsxRuntimeExports.jsx("div",{onClick:e=>e.stopPropagation(),children:jsxRuntimeExports.jsx(ee,{label:"Subscribe",checked:o.read,onChange:()=>h({...o,isSelected:!(!o.write&&(o.write||o.read)),read:!o.read})})})]}),{}),isSelected:u,onClick:()=>{h("single"===c?{...o,isSelected:!u}:{...o,isSelected:!u,read:!u,write:!u});},...l,children:o.name},o.name)}const Te=forwardRef((({className:n="io-list-channels",variant:i="single",variantToggle:o=!1,channels:a=[],onVariantChange:s,onChannelSelect:r,...l},c)=>{const d=v(n,{"io-bi-direction":"directionalSingle"===i}),u=a.filter((e=>e.isSelected));return jsxRuntimeExports.jsx(Ie.Provider,{value:{variant:i,selectedChannels:u,onVariantChange:s,onChannelSelect:r},children:jsxRuntimeExports.jsx("div",{className:d,ref:c,children:jsxRuntimeExports.jsxs(P,{variant:"single",...l,children:[jsxRuntimeExports.jsx(P.ItemTitle,{append:o&&jsxRuntimeExports.jsx(ee,{label:"Directional",align:"right",onChange:e=>s&&s(e.target.checked),checked:"directionalSingle"===i}),children:"single"===i?"Select Channel":"Select Directional Channel"}),a?.map((t=>jsxRuntimeExports.jsx($e,{channel:t,onChannelSelect:r},t.name)))]})})})}));Te.displayName="ChannelSelector";var Ae=Object.freeze({__proto__:null,Channel:$e,ChannelBadge:xe,ChannelSelector:Te,useIOCDChannels:function(e){const t="T42.ChannelSelector.Execute",n=useContext(IOConnectContext),[o,c]=useState(null),[u,h]=useState(""),[m,f]=useState(!1),[p,b]=useState(),[v,y]=useState("single"),w=useRef(),N=n?.windows.my(),S=useCallback(((e,t,i)=>{if("will-show"===e.command){(async()=>{w.current=i,c([]),f(!0);const t=e.windowId,o=e.channels,a=o.find((e=>e.isSelected));let s=a?.name;if(void 0===s){const e=n?.windows.findById(t);s=await(e?.getChannel());}y(e.variant),h(t),c(function(e,t){const n=Array.from({length:e.length},((e,t)=>String.fromCharCode(t+65)));return e.map(((e,i)=>{const o=e.meta;return {key:e.name,color:o.color,name:e.name,isSelected:e.name===t,label:n[i],write:e.write,read:e.read}}))}(o,s)),f(!1);})().catch((e=>{b(e),f(!1);}));}}),[n?.windows]),k=useCallback((({name:e,read:t,write:i,isSelected:a})=>{const s=()=>{if("directionalSingle"!==v)return N?.hide()},r=o?.find((e=>e.isSelected))?.name;("single"===v?r===e:r===e&&!t&&!i)?n?.channels.leave(u).finally((()=>{s();})):n?.channels.join(e,u).finally((()=>{s();}));const l=n?.channels;"directionalSingle"===v&&"function"==typeof l?.restrict&&l?.restrict({name:e,read:t,write:i,windowId:u}),c((n=>n?n.map((n=>n.name===e?{...n,isSelected:a,read:t,write:i}:{...n,isSelected:!1,read:!1,write:!1})):n));}),[n?.channels,o,v,N,u]);return ne((()=>{N?.hide();}),["Escape"]),useEffect((()=>{const e=N?.onClosing((async e=>(e({showDialog:!1}),Promise.resolve())));return e}),[N]),useLayoutEffect((()=>{if(e?.current&&o&&o.length>0){const{height:t,width:n,x:i,y:o}=e.current.getBoundingClientRect();w.current&&t>0&&w.current({height:t,width:n,x:i,y:o});}}),[o,e]),useEffect((()=>((async()=>{await(n?.interop.registerAsync(t,S));})(),()=>{n?.interop.unregister(t);})),[n?.interop,S]),{onChannelSelected:k,variant:v,isLoading:m,channels:o,error:p}}});createContext({config:{message:""},theme:"dark",setResult:()=>{}});function Ve({title:n="Downloads"}){const{ItemSearch:i,HeaderButtons:o}=ut();return jsxRuntimeExports.jsxs("div",{className:"io-dm-header",children:[jsxRuntimeExports.jsxs(_,{children:[jsxRuntimeExports.jsx(_.Title,{tag:"h1",text:n,size:"large"}),jsxRuntimeExports.jsx(o,{})]}),jsxRuntimeExports.jsx(i,{})]})}const Je=createContext({items:[],settings:{},removeItem:()=>{},pauseResumeItem:()=>{},cancelItem:()=>{},clearItems:()=>{},showItemInFolder:()=>{},isSettingsVisible:!1,showSettings:()=>{},hideSettings:()=>{},isSearchVisible:!1,showSearch:()=>{},hideSearch:()=>{},searchQuery:"",setSearch:()=>{},itemsCount:0,setCount:()=>{},chooseDownloadLocation:()=>{},sortItems:()=>[],downloadLocationConfig:{filePaths:[],canceled:!1},isDownloadLocationDialogVisible:!1}),Ue=()=>useContext(Je);function qe({className:n="io-header-search",icon:i="search",placeholder:o="Search",...a}){const s=useRef(null),{isSearchVisible:c,searchQuery:d,setSearch:u,itemsCount:h}=Ue();return useEffect((()=>{c?s.current?.focus():(s.current?.blur(),u(""));}),[c,u]),c?jsxRuntimeExports.jsxs("div",{className:n,children:[jsxRuntimeExports.jsx(K,{ref:s,value:d,iconPrepend:i,placeholder:o,onChange:e=>u(e.target.value),...a}),c&&d.length>0&&jsxRuntimeExports.jsx("p",{className:`${n}-count`,children:`${h} results`})]}):null}function Ge({className:n,...i}){const{SearchButton:o,SettingsButton:a,MoreButton:s}=ut();return jsxRuntimeExports.jsxs(z,{className:n,align:"right",...i,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})}function Qe({...t}){const{isSearchVisible:n,showSearch:i,hideSearch:o,items:a}=Ue();return jsxRuntimeExports.jsx(B,{icon:n?"search-filled":"search",variant:"circle",size:"32",onClick:n?o:i,disabled:0===a.length,...t})}function Ye({icon:t="cog",...n}){const{showSettings:i}=Ue();return jsxRuntimeExports.jsx(B,{icon:t,variant:"circle",size:"32",onClick:i,...n})}function Ke({icon:n="ellipsis",...i}){const{items:o,clearItems:a}=Ue(),s=0===o.length;return jsxRuntimeExports.jsxs(L,{variant:"outline",...i,children:[jsxRuntimeExports.jsx(L.ButtonIcon,{icon:n,variant:"circle",size:"32"}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{children:jsxRuntimeExports.jsx(L.Item,{disabled:s,onClick:e=>(e=>{s?e.stopPropagation():a();})(e),children:"Clear All"})})})]})}function We(e,t=!1,n=!1,i=!1){const o=e.getDate(),a=["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()],s=e.getFullYear(),r=e.getHours(),l=e.getMinutes();let c="";return c=l<10?`0${l}`:`${l}`,t?"Today"===t?n?"Today":`Today at ${r}:${c}`:"Yesterday"===t?n?"Yesterday":`Yesterday at ${r}:${c}`:`${r}:${c}`:i?n?`${a} ${o}`:`${a} ${o} at ${r}:${c}`:n?`${a} ${o}, ${s}`:`${a} ${o}, ${s} at ${r}:${c}`}function Xe(e,t={showTime:!0}){const n=new Date(1e3*e),i=new Date,o=Math.round((i-n)/1e3),a=Math.round(o/60),s=i.toDateString()===n.toDateString(),r=new Date(i.setDate(i.getDate()-1)).toDateString()===n.toDateString(),l=i.getFullYear()===n.getFullYear();return t.showTime?o<5?"Just Now":o<60?`${o} seconds ago`:o<90?"about a minute ago":a<60?`${a} minutes ago`:s?We(n,"Today",!1,!0):r?We(n,"Yesterday",!1,!0):l?We(n,!1,!1,!0):We(n):s?"Today":r?"Yesterday":l?We(n,!1,!0,!0):We(n,!1,!0)}function Ze({className:t="io-dm-body",...n}){const{DownloadListEmpty:i,ItemGroup:o,Item:a}=ut(),{items:s,searchQuery:l,setCount:c,sortItems:d}=Ue(),h=d(s),m=ae(l),g=useMemo((()=>h.filter((e=>e.displayInfo.filename.toLowerCase().includes(m.toLowerCase())||e.displayInfo.url.toLowerCase().includes(m.toLowerCase())))),[h,m]),f=useMemo((()=>g.map((e=>({...e,displayInfo:{...e.displayInfo,startTime:Xe(e.displayInfo.startTime,{showTime:!1})}})))),[g]),p=useMemo((()=>Object.values(f.reduce(((e={},t)=>(e[t.displayInfo.startTime]=e[t.displayInfo.startTime]?.concat([])??[],e[t.displayInfo.startTime].push(t),e)),{}))),[f]);return useEffect((()=>{c(g.length);}),[g,c]),jsxRuntimeExports.jsx("div",{className:t,...n,children:p&&0!==p.length?p.map((t=>jsxRuntimeExports.jsx(o,{title:String(t[0].displayInfo.startTime)??null,children:t.map((t=>jsxRuntimeExports.jsx(a,{item:t},t.id)))},t[0].id??""))):jsxRuntimeExports.jsx(i,{})})}function et({className:n="io-dm-no-items",icon:i="download",text:o="No downloads to display.",...a}){return jsxRuntimeExports.jsxs("div",{className:n,...a,children:[jsxRuntimeExports.jsx(y,{variant:i}),jsxRuntimeExports.jsx("p",{children:o})]})}function tt({className:n="io-dm-item-group",title:i,children:o,...a}){return jsxRuntimeExports.jsxs("div",{className:n,...a,children:[i&&jsxRuntimeExports.jsx("p",{children:i}),o]})}function nt({className:i="io-dm-item",item:o,...a}){const{ItemHeader:s,ItemBody:r,ItemFooter:l}=ut(),{state:c,url:d,filename:u,receivedBytes:h,totalBytes:m,speed:g,timeRemaining:f}=o.displayInfo;if(!o)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const p=v(i,{[c]:o.displayInfo.state});return jsxRuntimeExports.jsxs("div",{className:p,...a,children:[jsxRuntimeExports.jsx(s,{itemID:o.id,filename:u,state:c}),jsxRuntimeExports.jsx(r,{state:c,url:d,bytesReceived:h,bytesTotal:m,speed:g,timeRemaining:f}),jsxRuntimeExports.jsx(l,{itemID:o.id,state:c})]})}function it({bytesReceived:t=0,bytesTotal:n=0,...o}){const a=useCallback((()=>t&&n?Math.round(t/n*100):0),[t,n]);return jsxRuntimeExports.jsx(Q,{value:a(),...o})}function ot({className:n="io-dm-item-header",itemID:o,filename:a,state:s,cancel:r,remove:l,...c}){const{cancelItem:d,removeItem:u}=Ue(),h=useCallback((e=>{r?r(e):d(e);}),[r,d]),m=useCallback((e=>{l?l(e):u(e);}),[l,u]);return jsxRuntimeExports.jsxs("div",{className:n,...c,children:[jsxRuntimeExports.jsx(S,{text:a,style:{textDecoration:"interrupted"===s||"cancelled"===s?"line-through":"none"}}),jsxRuntimeExports.jsx(B,{icon:"close",onClick:()=>{"progressing"===s||"paused"===s?h(o):m(o);}})]})}function at({className:n="io-dm-item-body",state:i,url:o,bytesReceived:a=0,bytesTotal:s=0,speed:r=0,timeRemaining:l=0,...c}){const d=e=>{const t=["Bytes","KB","MB","GB","TB"];if(0===e)return "0";const n=Math.floor(Math.log(e)/Math.log(1024));return 0===n?`${e}${t[n]}`:`${(e/1024**n).toFixed(1)}${t[n]}`};return jsxRuntimeExports.jsxs("div",{className:n,...c,children:[jsxRuntimeExports.jsx("p",{className:"io-text-small",children:o}),(h=i,"cancelled"===h||"interrupted"===h||"completed"===h?null:jsxRuntimeExports.jsx(it,{variant:"paused"===h?"paused":"active",bytesReceived:a,bytesTotal:s})),jsxRuntimeExports.jsx("p",{className:"io-text-default-lh16",children:"completed"===i?`${d(a??0)} - Done`:"cancelled"===i||"interrupted"===i?`${d(a??0)}/${d(s??0)} - Failed`:`${d(a??0)}/${d(s??0)} (${u=r,(u?`${(u/1e6/8).toFixed(2)}MB/s`:0)??0}) - ${(e=>{const t=Math.floor(e/3600),n=Math.floor(e%3600/60);let i="";return t>0&&(i+=`${t} hour${t>1?"s":""}, `),n>0&&(i+=`${n} min${n>1?"s":""}, `),((e=Math.floor(e%60))>0||""===i)&&(i+=`${e} sec${1!==e?"s":""}`),`${i.trim()} left`})(l)??0}`})]});var u,h;}function st({className:o="io-dm-item-footer",itemID:a,state:s,pauseResume:r,showInFolder:l,cancel:c,...d}){const{pauseResumeItem:u,showItemInFolder:h,cancelItem:m}=Ue(),g=useCallback((e=>{r?r(e):u(e);}),[r,u]),f=useCallback((e=>{l?l(e):h(e);}),[l,h]),p=useCallback((e=>{c?c(e):m(e);}),[c,m]);return jsxRuntimeExports.jsx("div",{className:o,...d,children:(()=>{switch(s){case"progressing":return jsxRuntimeExports.jsxs(z,{align:"right",children:[jsxRuntimeExports.jsx(z.Button,{variant:"primary",text:"Pause",onClick:()=>g(a)}),jsxRuntimeExports.jsx(z.Button,{variant:"link",text:"Cancel",onClick:()=>p(a)})]});case"paused":return jsxRuntimeExports.jsx(z,{align:"right",children:jsxRuntimeExports.jsx(z.Button,{variant:"primary",text:"Resume",onClick:()=>g(a)})});case"completed":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(w,{variant:"medium",title:"Complete"}),jsxRuntimeExports.jsx(z,{align:"right",children:jsxRuntimeExports.jsx(z.Button,{variant:"primary",text:"Show in Folder",onClick:()=>f(a)})})]});case"cancelled":return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(w,{variant:"high",title:"Cancelled"})});case"interrupted":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(w,{variant:"critical",title:"Failed"}),jsxRuntimeExports.jsx(z,{align:"right",children:jsxRuntimeExports.jsx(z.Button,{variant:"primary",text:"Retry",onClick:()=>g(a)})})]});default:return null}})()})}function rt({className:n="io-panel io-settings",title:i="Settings",...o}){const{settings:a,hideSettings:s,chooseDownloadLocation:r,isDownloadLocationDialogVisible:l}=Ue(),c=a.downloadLocations?.find((e=>e.selected))?.path??"",d=()=>{r();};return jsxRuntimeExports.jsxs(U,{className:n,...o,children:[jsxRuntimeExports.jsxs(U.Header,{children:[jsxRuntimeExports.jsx(U.Header.Title,{size:"large",text:i,tag:"h1"}),jsxRuntimeExports.jsx(U.Header.ButtonGroup,{children:jsxRuntimeExports.jsx(B,{variant:"circle",icon:"close",size:"32",onClick:()=>{s();},disabled:l})})]}),jsxRuntimeExports.jsx(U.Body,{children:jsxRuntimeExports.jsxs("div",{className:"io-settings-form-group",children:[jsxRuntimeExports.jsx(K,{iconAppend:"expand",label:"Download location",placeholder:"Select a folder",value:c,readOnly:!0,onClick:d,disabled:l}),jsxRuntimeExports.jsx(C,{text:"Browse",onClick:d,disabled:l})]})})]})}const lt={Header:Ve,ItemSearch:qe,HeaderButtons:Ge,SearchButton:Qe,SettingsButton:Ye,MoreButton:Ke,Body:Ze,DownloadListEmpty:et,ItemGroup:tt,Item:nt,ItemProgress:it,ItemHeader:ot,ItemBody:at,ItemFooter:st,Settings:rt},ct=createContext(lt),dt=memo((({children:t,components:n})=>{const i=useMemo((()=>({...lt,...n})),[n]);return jsxRuntimeExports.jsx(ct.Provider,{value:i,children:t})}));dt.displayName="ComponentsStore";const ut=()=>useContext(ct);function gt(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,n={};function i(n,i){var o=n instanceof Error?n:new Error(n);if(t)t(o);else {var a='[ERROR] callback-registry: User callback for key "'+i+'" failed: '+o.stack;if(e)switch(e.errorHandling){case"log":return console.error(a);case"silent":return;case"throw":throw new Error(a)}console.error(a);}}return {add:function(e,t,o){var a=n[e];return a||(a=[],n[e]=a),a.push(t),o&&setTimeout((function(){o.forEach((function(o){var a;if(null===(a=n[e])||void 0===a?void 0:a.includes(t))try{Array.isArray(o)?t.apply(void 0,o):t.apply(void 0,[o]);}catch(t){i(t,e);}}));}),0),function(){var i=n[e];i&&(i=i.reduce((function(e,n,i){return n===t&&e.length===i||e.push(n),e}),[]),0===i.length?delete n[e]:n[e]=i);}},execute:function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];var a=n[e];if(!a||0===a.length)return [];var s=[];return a.forEach((function(n){try{var o=n.apply(void 0,t);s.push(o);}catch(t){s.push(void 0),i(t,e);}})),s},clear:function(){n={};},clearKey:function(e){n[e]&&delete n[e];}}}gt.default=gt;f(gt);const bt=createContext({config:{env:"",region:"",version:"",buildVersion:"",theme:"",isError:!1,mailingList:"",createJiraTicket:!0,sendEmail:!1,attachments:[],applicationTitle:"",allowEditRecipients:!0,attachmentsViewMode:"category",environmentInfo:"",selectedCategories:[],errorMessage:"",showEnvironmentInfo:!1,context:{},technicalInfo:"",sendEmailClient:"Outlook"},onThemeChanged:e=>{},openUrl:()=>{},submit:()=>Promise.resolve({}),setBounds:()=>{},close:e=>{},showMailingList:!0,setShowMailingList:()=>{},attachmentCategories:[],submitInProgress:!1,setSubmitInProgress:()=>{},submitStatus:{type:"success",title:"",text:""},setSubmitStatus:()=>{},submitCompleted:!1,setSubmitCompleted:()=>{},jiraTicketURL:"",setJiraTicketURL:()=>{},submitFeedback:()=>{}}),vt=()=>useContext(bt);function yt({...n}){const{config:i,close:o}=vt(),{applicationTitle:a}=i;return jsxRuntimeExports.jsxs(_,{draggable:!0,...n,children:[jsxRuntimeExports.jsx(_.Title,{tag:"h1",text:a?`Feedback Form - ${a}`:"Feedback Form",size:"large"}),jsxRuntimeExports.jsx(_.ButtonGroup,{className:"non-draggable",children:jsxRuntimeExports.jsx(_.ButtonIcon,{variant:"circle",icon:"close",size:"32",onClick:()=>o()})})]})}function wt({className:n="io-panel-body",handleSubmit:i,...o}){const{config:a,submitFeedback:s}=vt(),{IntroField:r,DescriptionField:l,TechInfoField:c,EnvInfoField:d,FileAttachmentsField:u,CategoryAttachmentsField:h,SettingsField:m,MailListField:g}=Ht(),f=i??s,p=`Your feedback will be submitted to the ${a.buildVersion} team and some additional information will be automatically included to help us examine your issue.`;return jsxRuntimeExports.jsxs("form",{className:n,id:"feedback",onSubmit:e=>f(e),...o,children:[jsxRuntimeExports.jsx(r,{children:jsxRuntimeExports.jsx("p",{children:p})}),jsxRuntimeExports.jsx(m,{}),jsxRuntimeExports.jsx(g,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(c,{readOnly:!0}),jsxRuntimeExports.jsx(d,{readOnly:!0}),"file"===a.attachmentsViewMode?jsxRuntimeExports.jsx(u,{}):jsxRuntimeExports.jsx(h,{})]})}function Nt({...n}){const{FooterButtons:i}=Ht(),{openUrl:o,submitInProgress:a,submitStatus:s,jiraTicketURL:r}=vt();return jsxRuntimeExports.jsx(H,{...n,children:jsxRuntimeExports.jsxs("div",a?{className:"flex ai-center jc-between",children:[jsxRuntimeExports.jsx(k,{children:jsxRuntimeExports.jsx("p",{children:s.title})}),jsxRuntimeExports.jsx(M,{align:"right",size:"small"})]}:{className:"flex ai-center jc-between",children:[jsxRuntimeExports.jsxs(k,{children:[jsxRuntimeExports.jsx("p",{className:"error"===s.type?"io-text-error":"",children:s.title}),r&&jsxRuntimeExports.jsx("a",{href:r,onClick:e=>{e.preventDefault(),o(r);},children:r})]}),jsxRuntimeExports.jsx(i,{})]})})}function St({className:t,...n}){const{CloseButton:i}=Ht(),{close:o}=vt();return jsxRuntimeExports.jsx(z,{className:t,...n,children:jsxRuntimeExports.jsx(i,{onClick:()=>o()})})}function kt({className:n,...i}){const{SubmitButton:o,CancelButton:a,CloseButton:s}=Ht(),{close:r,submitCompleted:l}=vt();return l?jsxRuntimeExports.jsx(z,{className:n,...i,children:jsxRuntimeExports.jsx(s,{text:"Close",onClick:()=>r()})}):jsxRuntimeExports.jsxs(z,{className:n,...i,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{onClick:()=>r()})]})}function Ct({text:t="Submit",...n}){return jsxRuntimeExports.jsx(C,{form:"feedback",type:"submit",variant:"primary",text:t,...n})}function Bt({text:t="Cancel",...n}){return jsxRuntimeExports.jsx(C,{variant:"outline",text:t,...n})}function xt({...t}){return jsxRuntimeExports.jsx(C,{variant:"primary",...t})}function It({showField:t=!0,className:n,title:i,hint:o,children:a,...s}){return t?jsxRuntimeExports.jsx(k,{className:n,title:i,hint:o,...s,children:a}):null}function $t({showField:t=!0,className:n,title:i="Description",hint:o,readOnly:a=!1,disabled:s,...r}){return t?jsxRuntimeExports.jsx(k,{className:n,hint:o,title:"",...r,children:jsxRuntimeExports.jsx(W,{id:"description",name:"description",label:i,readOnly:a,disabled:s})}):null}function Tt({showField:t,className:n,title:i="Technical Information",hint:o,fieldValue:a,readOnly:s=!1,disabled:r,...l}){const{config:c}=vt(),d=t??c.errorMessage,u=a??c.errorMessage;return d&&u?jsxRuntimeExports.jsx(k,{className:n,hint:o,...l,children:jsxRuntimeExports.jsx(W,{id:"errorMessage",name:"errorMessage",label:i,value:u,readOnly:s,disabled:r})}):null}function At({showField:t,className:n,title:i="Environment Information",hint:o,fieldValue:a,readOnly:s=!1,disabled:r,...l}){const{config:c}=vt(),d=t??c.showEnvironmentInfo,u=a??c.environmentInfo;return d&&u?jsxRuntimeExports.jsx(k,{className:n,hint:o,...l,children:jsxRuntimeExports.jsx(W,{id:"environmentInfo",name:"environmentInfo",label:i,value:u,readOnly:s,disabled:r})}):null}function Pt({showField:n=!0,className:o="io-block io-block-list-gap",title:a="Attachments",hint:s,readOnly:r=!1,disabled:l,attachments:c,selectedCategories:d,...u}){const{config:h}=vt(),m=c??h.attachments,g=d??h.selectedCategories,f=useCallback((e=>!!g&&-1!==g.indexOf(e)),[g]);return n?!m||m.length<=0?jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"io-title",children:"Attachments"}),jsxRuntimeExports.jsx("p",{children:"No Attachments"})]}):jsxRuntimeExports.jsx(k,{className:o,title:a,hint:s,...u,children:jsxRuntimeExports.jsx("div",{className:"file-attachments",children:m.map((t=>jsxRuntimeExports.jsx(X,{id:t.id,name:t.id,label:t.name,readOnly:r,disabled:l,defaultChecked:f(t.category)},t.id)))})}):null}function Ft({showField:t=!0,className:n,title:o="Attachments",hint:a,readOnly:s=!1,disabled:r,categories:l,selectedCategories:c,...d}){const{config:u,attachmentCategories:h}=vt(),m=l??h,g=c??u.selectedCategories,f=useCallback((e=>!!g&&-1!==g.indexOf(e)),[g]);return t?!m||m.length<=0?jsxRuntimeExports.jsx("p",{children:"No Attachments"}):jsxRuntimeExports.jsx(k,{className:n,title:o,hint:a,...d,children:jsxRuntimeExports.jsx("div",{className:"category-attachments",children:m.map((t=>jsxRuntimeExports.jsx(ee,{id:t,name:t,align:"right",label:t,readOnly:s,disabled:r,defaultChecked:f(t)},t)))})}):null}function Lt({className:n="io-block io-block-list-gap",title:i,hint:o,showField:a=!0,showJiraTicketField:s,jiraTicketLabel:r="Create Jira Ticket",showSendEmailField:l,sendEmailLabel:c="Send Email",readOnly:d=!1,disabled:u,...h}){const{config:m,showMailingList:g,setShowMailingList:f}=vt();if(!a)return null;const p=s??m.createJiraTicket,b=l??m.sendEmail;return jsxRuntimeExports.jsxs(k,{className:n,hint:o,title:i,...h,children:[p&&jsxRuntimeExports.jsx(ee,{id:"createJiraTicket",name:"createJiraTicket",label:r,align:"right",readOnly:d,disabled:u,defaultChecked:p}),b&&jsxRuntimeExports.jsx(ee,{onChange:()=>{f(!g);},id:"sendEmail",name:"sendEmail",label:c,align:"right",readOnly:d,disabled:u,defaultChecked:b})]})}function zt({showField:t=!0,className:n,title:i="Email List",hint:o="Separate with commas or semicolons.",placehodler:a="john.doe@somedomain.com; jane.doe@otherdomain.com",readOnly:s=!1,disabled:r,...l}){const{config:c,showMailingList:d}=vt();return (t??c.sendEmail)&&d?jsxRuntimeExports.jsx(k,{className:n,hint:o,...l,children:jsxRuntimeExports.jsx(K,{id:"mailingList",name:"mailingList",label:i,placeholder:a,readOnly:s,disabled:r,defaultValue:c.mailingList??""})}):null}const _t={Header:yt,Body:wt,Footer:Nt,HeaderButtons:St,FooterButtons:kt,SubmitButton:Ct,CancelButton:Bt,CloseButton:xt,IntroField:It,DescriptionField:$t,TechInfoField:Tt,EnvInfoField:At,FileAttachmentsField:Pt,CategoryAttachmentsField:Ft,SettingsField:Lt,MailListField:zt},Et=createContext(_t),Dt=memo((({children:t,components:n})=>{const i=useMemo((()=>({..._t,...n})),[n]);return jsxRuntimeExports.jsx(Et.Provider,{value:i,children:t})}));function Ht(e){return {...useContext(Et),...e}}Dt.displayName="ComponentsStore";function Mt({...n}){const{HeaderCaption:i,HeaderActions:o,HeaderSearch:a}=ai();return jsxRuntimeExports.jsxs(V,{...n,children:[jsxRuntimeExports.jsx(i,{}),jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{})]})}function Vt({className:n="io-panel-header-caption",...i}){const{HeaderCaptionTitle:o,HeaderCaptionCount:a,HeaderCaptionButtons:s}=ai();return jsxRuntimeExports.jsxs("div",{className:n,...i,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})}function Jt(e){const t=useContext(IOConnectContext),n=t?.appManager,[o,l]=useState([]),[c,d]=useState(0),u="*",h=useCallback((e=>[...e].sort(((e,t)=>{const n=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return n<i?-1:n>i?1:0}))),[]);return useEffect((()=>{if(!n)return;const e=n.onAppAdded((e=>{l((t=>[...t,{title:e.title,name:e.name,hidden:e.hidden}]));}));return ()=>{e();}}),[n]),useEffect((()=>{if(!n)return;const e=n.onAppRemoved((e=>{l((t=>t.filter((t=>t.name!==e.name))));}));return ()=>{e();}}),[n,o]),useEffect((()=>{if(!n)return;const e=n.onAppChanged((e=>{l((t=>{const n=t.find((t=>t.name===e.name));return [...t.filter((t=>t.name!==e.name)),{title:e.title,name:n?.name,hidden:n?.hidden,allowed:n?.allowed}]}));}));return ()=>{e();}}),[n]),useEffect((()=>{const n=e?.allApplications??t.appManager.applications().length;let i=0;const a=[...o],s=e?.sourceFilter;if(void 0===s||!Array.isArray(s.allowed)||!Array.isArray(s.blocked))return;const r=s.allowed,c=s.blocked;0===r.length||-1!==c.indexOf(u)||0===r.length&&0===c.length||-1!==r.indexOf(u)&&-1!==c.indexOf(u)?(i=n,a.forEach((e=>{e.allowed=!1;}))):-1!==r.indexOf(u)&&a.forEach((e=>{e.allowed=!0;})),-1===c.indexOf(u)&&c.length>0&&(i=s.blocked.length),r.forEach((e=>{const t=a.find((t=>t.name===e));t&&(t.allowed=!0);})),c.forEach((e=>{const t=a.find((t=>t.name===e));t&&(t.allowed=!1);})),d(n-i),l(a);}),[e]),{apps:o,allowedApps:c,sortAppsAlphabetically:h}}const qt=createContext({allApps:[],settings:{},configuration:{},notifications:[],onClose:()=>{},allApplications:0,clearAll:()=>{},showPanel:()=>{},hidePanel:()=>{},saveFilter:()=>{},clearAllOld:()=>{},notificationStacks:[],isPanelVisible:!1,saveSetting:()=>{},allowedApplications:0,saveAllFilter:()=>{}}),Gt=()=>useContext(qt);function Qt({className:n="io-panel-header-caption-filter",...i}){const{allApplications:o,allowedApplications:a}=Gt();return jsxRuntimeExports.jsxs("div",{className:n,...i,children:[jsxRuntimeExports.jsx(y,{variant:"filter"}),jsxRuntimeExports.jsx("span",{className:`${n}-allowed`,children:a}),"of ",jsxRuntimeExports.jsx("span",{className:`${n}-all`,children:o}),"apps"]})}function Yt({text:n="Notifications",counter:i,...o}){const{notifications:a}=Gt(),s=a.length;return jsxRuntimeExports.jsx(S,{text:n,size:"large",...o,children:(i??!0)&&jsxRuntimeExports.jsxs("span",{children:["(",s,")"]})})}const Kt=createContext({isSearchVisible:!1,showSearch:()=>{},hideSearch:()=>{},searchQuery:"",setSearch:()=>{},isSettingsVisible:!1,showSettings:()=>{},hideSettings:()=>{},sortNotificationsBy:"newest",setSortBy:()=>{},viewNotificationsBy:"unread",setViewBy:()=>{},notificationsCount:0,setCount:()=>{}}),Wt=()=>useContext(Kt);function Xt({...n}){const{HeaderCaptionButtonSearch:i,HeaderCaptionButtonSettings:o,HeaderCaptionButtonClose:a}=ai();return jsxRuntimeExports.jsxs(z,{...n,children:[jsxRuntimeExports.jsx(i,{}),jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{})]})}const Zt="newest",en="oldest",tn="severity",nn=["None","Low","Medium","High","Critical"],on={key:Zt,descending:!0},an=e=>[...e].sort(((e,t)=>(t.timestamp||0)-(e.timestamp||0))),sn=e=>[...e].sort(((e,t)=>(e.timestamp||0)-(t.timestamp||0))),rn=(e,t)=>{const n=nn[0];return [...e].sort(((e,i)=>{const o=nn.indexOf(e.severity||n),a=nn.indexOf(i.severity||n);return (t?-1:1)*(o-a)}))},ln={[Zt]:an,[en]:sn,[tn]:rn};function cn({...t}){const[n,i]=useState([]),{NotificationsList:o,Notification:a}=ai(),{sortNotificationsBy:c,viewNotificationsBy:d,setCount:h,searchQuery:m,notificationsCount:g}=Wt(),{notifications:f}=Gt(),p=useRef(null),b=ae(m),v=useMemo((()=>((e,t)=>{if(!e)return [];switch(t){case"all":default:return e;case"unread":return e.filter((e=>"Active"===e.state||"Stale"===e.state));case"read":return e.filter((e=>"Acknowledged"===e.state||"Seen"===e.state));case"snoozed":return e.filter((e=>"Snoozed"===e.state))}})(f,d)),[f,d]),y=useMemo((()=>v.filter((e=>e.title.toLowerCase().includes(b.toLowerCase())||e.body?.toLowerCase().includes(b.toLowerCase())))),[v,b]);return useEffect((()=>{switch(c){case"newest":i(an(y));break;case"oldest":i(sn(y));break;case"severity":i(rn(y,!0));break;default:i(y);}h(y.length);}),[y,c,h]),useEffect((()=>{p.current&&p.current?.scrollTo({top:0,behavior:"smooth"});}),[b,g,c,d]),jsxRuntimeExports.jsx(R,{ref:p,...t,children:jsxRuntimeExports.jsx(o,{notifications:n,Notification:a})})}function dn({...t}){const{FooterButtons:n}=ai();return jsxRuntimeExports.jsx(J,{...t,children:jsxRuntimeExports.jsx(n,{})})}function un({className:n,...i}){const{FooterButtonClearAll:o,FooterButtonClearAllOld:a}=ai(),{notifications:l}=Gt(),[c,d]=useState(!1);return useEffect((()=>{l.filter((e=>"Stale"===e.state||"Acknowledged"===e.state)).length>0?d(!0):d(!1);}),[l]),jsxRuntimeExports.jsxs(z,{className:n,align:"right",...i,children:[jsxRuntimeExports.jsx(a,{disabled:!c}),jsxRuntimeExports.jsx(o,{disabled:l.length<=0})]})}function hn({text:t="Clear All",...n}){const{clearAll:i}=Gt();return jsxRuntimeExports.jsx(C,{text:t,onClick:()=>{i();},...n})}function mn({text:t="Clear Old",...n}){const{clearAllOld:i}=Gt();return jsxRuntimeExports.jsx(C,{text:t,onClick:()=>{i();},...n})}function gn({className:n="io-panel io-settings",title:i="Settings",...o}){const{SettingsGeneral:a,SettingsPlacement:s,SettingsStacking:r,SettingsSnooze:l,SettingsSubscriptions:c}=ai(),{hideSettings:d}=Wt();return jsxRuntimeExports.jsxs(U,{className:n,...o,children:[jsxRuntimeExports.jsxs(U.Header,{children:[jsxRuntimeExports.jsx(U.Header.Title,{size:"large",text:i,tag:"h1"}),jsxRuntimeExports.jsx(U.Header.ButtonGroup,{children:jsxRuntimeExports.jsx(U.Header.ButtonIcon,{variant:"circle",icon:"close",size:"32",onClick:d})})]}),jsxRuntimeExports.jsxs(U.Body,{children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(c,{})]})]})}function fn({className:n="io-panel-settings-general",title:i="General",...o}){const{SettingsAllowNotifications:a,SettingsPanelAutoHide:s,SettingsHideToastsAfter:r}=ai();return jsxRuntimeExports.jsx("div",{className:n,...o,children:jsxRuntimeExports.jsxs(k,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(r,{})]})})}function pn({label:t="Allow notifications",align:n="right",...o}){const{settings:a,saveSetting:s}=Gt(),r=useCallback((e=>{s({enabledNotifications:e});}),[s]);return jsxRuntimeExports.jsx(ee,{label:t,align:n,onChange:e=>r(e.target.checked),checked:a.enabledNotifications,...o})}function bn({label:t="Auto hide panel",align:n="right",...o}){const{settings:a,saveSetting:s}=Gt(),r=useCallback((e=>{s({autoHidePanel:e});}),[s]);return jsxRuntimeExports.jsx(ee,{label:t,align:n,onChange:e=>r(e.target.checked),checked:a.autoHidePanel,...o})}function vn({label:t="Panel always on top",align:n="right",...o}){const{settings:a,saveSetting:s}=Gt(),r=useCallback((e=>{s({alwaysOnTop:e});}),[s]);return jsxRuntimeExports.jsx(ee,{label:t,align:n,onChange:e=>r(e.target.checked),checked:a.alwaysOnTop,...o})}function yn({className:n="flex jc-between ai-center",title:o="Hide toasts after",items:a=[15,30,45,60],...s}){const{settings:r,saveSetting:l}=Gt(),c=useCallback((e=>{e||(e=15e3),r.toastExpiry!==e&&l({toastExpiry:1e3*e});}),[r.toastExpiry,l]),d=e=>e<60?`${e} seconds`:60===e?"1 minute":e/60+" minutes";return jsxRuntimeExports.jsxs("div",{className:n,...s,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(r.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:o})}),jsxRuntimeExports.jsxs(L,{variant:"outline",disabled:!r.enabledNotifications,children:[jsxRuntimeExports.jsx(L.Button,{text:d(r.toastExpiry/1e3??0)}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:a.map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>{c(t);},children:d(t)},t)))})})]})]})}function wn({className:n="flex jc-between ai-center",title:i="Highlight new for",...o}){const{settings:a,saveSetting:s}=Gt(),r=["30 seconds","1 minute","5 minutes","Never"];return jsxRuntimeExports.jsxs("div",{className:n,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(a.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(L,{variant:"outline",disabled:!a.enabledNotifications,children:[jsxRuntimeExports.jsx(L.Button,{text:r[0]}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:r.map((t=>jsxRuntimeExports.jsx(L.Item,{children:t},t)))})})]})]})}function Nn({className:n="flex jc-between ai-center",title:i="Mark as read after",...o}){const{settings:a,saveSetting:s}=Gt(),r=["1 minute","5 minutes","Never"];return jsxRuntimeExports.jsxs("div",{className:n,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(a.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(L,{variant:"outline",disabled:!a.enabledNotifications,children:[jsxRuntimeExports.jsx(L.Button,{text:r[0]}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:r.map((t=>jsxRuntimeExports.jsx(L.Item,{children:t},t)))})})]})]})}function Sn({className:n="io-panel-settings-stacking",title:i="Stacking",...o}){const{SettingsToastStacking:a,SettingsToastStackBy:s}=ai();return jsxRuntimeExports.jsx("div",{className:n,...o,children:jsxRuntimeExports.jsxs(k,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})})}function kn({label:t="Allow toast stacking",align:n="right",...o}){const{settings:a,saveSetting:s}=Gt(),r=useCallback((e=>{s({toastStacking:e});}),[s]);return jsxRuntimeExports.jsx(ee,{label:t,align:n,onChange:e=>r(e.target.checked),checked:a.toastStacking,disabled:!a.enabledNotifications,...o})}const Cn=e=>e.replace(/(^|-)\w/g,(e=>e.toUpperCase().replace("-"," ")));function Bn({className:n="flex jc-between ai-center",title:o="Group by",...a}){const{settings:s,saveSetting:r}=Gt(),l=useCallback((e=>{e||(e="severity"),s.stackBy!==e&&r({stackBy:e.toLowerCase()});}),[s.stackBy,r]);return jsxRuntimeExports.jsxs("div",{className:n,...a,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(s.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:o})}),jsxRuntimeExports.jsxs(L,{variant:"outline",disabled:!s.enabledNotifications,children:[jsxRuntimeExports.jsx(L.Button,{text:s.stackBy?Cn(s.stackBy):"Severity"}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:["Severity","Application"].map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>{l(t);},children:t},t)))})})]})]})}function xn({className:n="io-panel-settings-placement",title:i="Placement",...o}){const{SettingsPlacementPanel:a,SettingsPlacementToasts:s}=ai();return jsxRuntimeExports.jsx("div",{className:n,...o,children:jsxRuntimeExports.jsxs(k,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})})}function In({className:n="flex jc-between ai-center",title:o="Panel position",...a}){const{settings:s,saveSetting:r}=Gt(),l=useCallback((e=>{e||(e="right"),s.placement?.panel!==e&&r({placement:{...s.placement,panel:e.toLowerCase()}});}),[s.placement,r]);return jsxRuntimeExports.jsxs("div",{className:n,...a,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper",children:jsxRuntimeExports.jsx("span",{children:o})}),jsxRuntimeExports.jsxs(L,{variant:"outline",children:[jsxRuntimeExports.jsx(L.Button,{text:s.placement?.panel?Cn(s.placement?.panel):"Right"}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:["Right","Left"].map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>{l(t);},children:t},t)))})})]})]})}function $n({className:n="flex jc-between ai-center",title:o="Toasts position",...a}){const{settings:s,saveSetting:r}=Gt(),l=useCallback((e=>{if(e||(e="bottom-right"),s.placement?.toasts===e)return;const t=e.replace(/\s+/g,"-").toLowerCase();r({placement:{...s.placement,toasts:t}});}),[s.placement,r]);return jsxRuntimeExports.jsxs("div",{className:n,...a,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper",children:jsxRuntimeExports.jsx("span",{children:o})}),jsxRuntimeExports.jsxs(L,{variant:"outline",children:[jsxRuntimeExports.jsx(L.Button,{text:s.placement?.toasts?Cn(s.placement?.toasts):"Bottom Right"}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:["Top Right","Top Left","Bottom Right","Bottom Left"].map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>{l(t);},children:t},t)))})})]})]})}function Tn({className:t="io-panel-settings-snooze",title:n="Snooze",...i}){const{SettingsSnoozeDuration:o}=ai(),{settings:a}=Gt();return a.snooze?.enabled?jsxRuntimeExports.jsx("div",{className:t,...i,children:jsxRuntimeExports.jsx(k,{title:n,children:jsxRuntimeExports.jsx(o,{})})}):null}function An({className:n="flex jc-between ai-center",title:o="Default duration",items:a=[60,120,180,300],...s}){const{settings:r,saveSetting:l}=Gt(),c=useCallback((e=>{e||(e=6e4),r.snooze&&r.snooze?.duration!==e&&l({snooze:{...r.snooze,duration:1e3*e}});}),[r.snooze,l]),d=e=>e<60?`${e} seconds`:60===e?"1 minute":e/60+" minutes";return r.snooze?.enabled?jsxRuntimeExports.jsxs("div",{className:n,...s,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(r.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:o})}),jsxRuntimeExports.jsxs(L,{variant:"outline",disabled:!r.enabledNotifications,children:[jsxRuntimeExports.jsx(L.Button,{text:d(r.snooze?.duration/1e3??0)}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:a.map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>{c(t);},children:d(t)},t)))})})]})]}):null}function Pn({className:n="io-panel-settings-subscriptions",title:i="Subscriptions",...o}){const{SettingsSubscriptionsToggleAll:a,SettingsSubscriptionsToggleApp:s}=ai(),{allApps:r}=Gt(),{sortAppsAlphabetically:l}=Jt(),c=l(r);return jsxRuntimeExports.jsx("div",{className:n,...o,children:jsxRuntimeExports.jsxs(k,{title:i,children:[jsxRuntimeExports.jsx("p",{className:"io-text-section",children:"Apps"}),jsxRuntimeExports.jsx(a,{}),c.map((t=>jsxRuntimeExports.jsx(s,{label:t.title??t.name,app:t},t.name)))]})})}function Fn({label:t="All apps",align:n="right",...o}){const{allApplications:a,allowedApplications:s,settings:r,saveAllFilter:l}=Gt(),c=useCallback((e=>{l(e);}),[l]);return jsxRuntimeExports.jsx(ee,{id:"*",align:n,label:t,onChange:e=>c(e.target.checked),checked:s===a,disabled:!r.enabledNotifications,...o})}function Ln({label:t="App",align:n="right",app:o,...a}){const{allApplications:s,allowedApplications:r,allApps:l,settings:c,saveAllFilter:d,saveFilter:u}=Gt(),h=r===s,m=useCallback(((e,t)=>{const n=l.map((n=>n.name===t.name?{...n,allowed:e}:n)),i=n.every((e=>!1===e.allowed));i?d(!1):u(n);}),[l,d,u]);return !o||o.hidden?null:jsxRuntimeExports.jsx(ee,{id:o.name,label:t,align:n,onChange:e=>m(e.target.checked,o),checked:h||o.allowed,disabled:!c.enabledNotifications,...a})}function zn({className:n="io-notification-header",notification:i,...o}){const{HeaderCount:a,HeaderBadge:s,HeaderTitle:r,HeaderTimestamp:l,HeaderButtonSnooze:c,HeaderButtonClose:d}=Wn();return jsxRuntimeExports.jsxs("div",{className:n,...o,children:[jsxRuntimeExports.jsx(s,{notification:i}),jsxRuntimeExports.jsx(a,{notification:i}),jsxRuntimeExports.jsx(r,{notification:i}),jsxRuntimeExports.jsx(l,{notification:i}),jsxRuntimeExports.jsxs(z,{children:[jsxRuntimeExports.jsx(c,{notification:i}),jsxRuntimeExports.jsx(d,{notification:i})]})]})}function _n({notification:t,...n}){const{settings:i,isPanelVisible:o,notificationStacks:a}=Gt(),{toastStacking:s,stackBy:r}=i,l="application"===r?"source":r??"source";let c;if(s){const e=a.find((e=>e.key===t[l]));c=e?.items.length??0;}return s&&!o&&c&&c>1?jsxRuntimeExports.jsx(N,{...n,children:c<10?c:"9+"}):null}function En({className:n="io-notification-header-badge",notification:i,...o}){return i&&i.severity&&"None"!==i.severity?jsxRuntimeExports.jsxs("div",{className:n,...o,children:[jsxRuntimeExports.jsx(y,{variant:(e=>{if(!e)return "circle-info";switch(e.toLowerCase()){case"info":case"low":case"medium":default:return "circle-info";case"high":return "triangle-exclamation";case"critical":return "ban"}})(i.severity),size:"12"}),i.severity]}):null}function Dn({className:n="io-notification-header-icon",state:i,severity:o="None",icon:a,...s}){const{isPanelVisible:r}=Gt();return jsxRuntimeExports.jsxs("div",{className:n,...s,children:[a&&jsxRuntimeExports.jsx("span",{className:`${n}-image`,children:jsxRuntimeExports.jsx("img",{src:a,alt:`${n}-${a}`})}),jsxRuntimeExports.jsx("span",{className:`${n}-badge color-${o.toLowerCase()}`,children:r&&"Acknowledged"!==i&&"New"})]})}function Hn({className:t="io-notification-header-title",notification:{appTitle:n},...i}){return jsxRuntimeExports.jsx("div",{className:t,...i,children:n})}function On({className:t="io-notification-timestamp",notification:{timestamp:n,state:i,snooze:o},...a}){return jsxRuntimeExports.jsx("small",o&&"Snoozed"===i?{className:t,...a,children:"Snoozed"}:{className:t,...a,children:Xe(n??0)??"Just Now"})}function jn({notification:{snooze:t,state:n},...o}){const{settings:a}=Gt(),s=useCallback((e=>{e.stopPropagation(),t&&t(a.snooze?.duration);}),[t,a.snooze?.duration]);return t&&"Snoozed"!==n&&a.snooze?.enabled?jsxRuntimeExports.jsx(C,{icon:"snooze",variant:"link",text:"Snooze",tabIndex:-1,onClick:s,...o}):null}function Mn({notification:{updateState:t,close:n},...i}){const{isPanelVisible:o}=Gt();return jsxRuntimeExports.jsx(B,{icon:"close",size:"24",tabIndex:-1,onClick:e=>{o?n().catch(console.error):(e.stopPropagation(),t("Acknowledged").catch(console.error));},...i})}function Vn({className:n="io-notification-body",notification:i,...o}){const{BodyIcon:a,BodyTitle:s,BodyDescription:r}=Wn(),{onClick:l}=i,{settings:c}=Gt();return jsxRuntimeExports.jsxs("div",{className:n,role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l({close:!1});},onClick:()=>{c.toastStacking?l({close:!1}):l();},...o,children:[jsxRuntimeExports.jsx(a,{icon:i.icon}),jsxRuntimeExports.jsxs("div",{className:`${n}-content`,children:[jsxRuntimeExports.jsx(s,{text:i.title}),jsxRuntimeExports.jsx(r,{text:i.body})]})]})}function Rn({className:t="io-notification-body-icon",icon:n,...i}){return n?jsxRuntimeExports.jsx("div",{className:t,...i,children:jsxRuntimeExports.jsx("img",{src:n,alt:"notification-icon"})}):null}function Jn({text:t,...n}){return jsxRuntimeExports.jsx(S,{text:t,...n})}function Un({className:t="io-notification-body-description",text:n,...i}){return jsxRuntimeExports.jsx("p",{className:t,...i,children:n})}function qn({className:t="io-notification-footer",notification:n}){const{FooterButton:i}=Wn();return jsxRuntimeExports.jsx("div",{className:t,children:jsxRuntimeExports.jsx(z,{align:"right",children:n.actions?.map(((t,n)=>jsxRuntimeExports.jsx(i,{notificationAction:t,variant:0===n?"primary":"link"},`${t.title+n.toString()}`)))})})}function Gn({notificationAction:t,...n}){return jsxRuntimeExports.jsx(C,{text:t.title,onClick:e=>{e.stopPropagation(),t.onClick();},...n})}const Qn={Header:zn,HeaderCount:_n,HeaderBadge:En,HeaderIcon:Dn,HeaderTitle:Hn,HeaderTimestamp:On,HeaderButtonSnooze:jn,HeaderButtonClose:Mn,Body:Vn,BodyIcon:Rn,BodyTitle:Jn,BodyDescription:Un,Footer:qn,FooterButton:Gn},Yn=createContext(Qn),Kn=memo((({children:t,components:n})=>{const i=useMemo((()=>({...Qn,...n})),[n]);return jsxRuntimeExports.jsx(Yn.Provider,{value:i,children:t})}));function Wn(e){return {...useContext(Yn),...e}}function Xn({className:n="io-notification",notification:i,...o}){const{Header:a,Body:s,Footer:r}=Wn(),{severity:l}=i,c=v(n,`severity-${l?.toLowerCase()??"none"}`,{"state-new":"Acknowledged"!==i.state});return jsxRuntimeExports.jsxs("div",{className:c,...o,children:[jsxRuntimeExports.jsx(a,{notification:i}),jsxRuntimeExports.jsx(s,{notification:i}),jsxRuntimeExports.jsx(r,{notification:i})]})}function Zn({components:t,notification:n,...i}){return jsxRuntimeExports.jsx(Kn,{components:t,children:jsxRuntimeExports.jsx(Xn,{notification:n,...i})})}function ei({className:n="io-notification-stack",notifications:o,...a}){const[r,l]=useState(!1),c=2===o.length?"small":o.length>=3?"large":"normal",d=o[0].severity,u=v(n,{[`${n}-open`]:r,[`${n}-${c}`]:"normal"!==c,[`${n}-${d}`]:d&&"None"!==d}),h=useCallback((()=>{l(!r);}),[r]),m=useCallback((e=>{e.stopPropagation(),o.forEach((e=>{e.close();}));}),[o]);return jsxRuntimeExports.jsxs("div",{className:u,onClick:h,...a,children:["normal"!==c&&jsxRuntimeExports.jsx("div",{className:`${n}-btn`,children:jsxRuntimeExports.jsx(C,{icon:"close",onClick:e=>m(e),children:jsxRuntimeExports.jsx("span",{className:"io-btn-text",children:"Clear All"})})}),o.map((t=>jsxRuntimeExports.jsx(Zn,{notification:t},t.id)))]})}function ti({className:t="io-notification-list",Notification:n,notifications:i,noNotificationText:o="No notifications to display",...a}){const{notifications:s,notificationStacks:r,settings:l,isPanelVisible:c}=Gt(),{toastStacking:d}=l,u=i??s;return jsxRuntimeExports.jsx("div",{className:t,...a,children:d&&!c?r.length>0?r.map((t=>jsxRuntimeExports.jsx(ei,{notifications:t.items},t.key))):jsxRuntimeExports.jsx("div",{className:"flex jc-center mt-8",children:o??""}):u.length>0?u.map((t=>jsxRuntimeExports.jsx(n,{notification:t},t.id))):jsxRuntimeExports.jsx("div",{className:"flex jc-center mt-8",children:o??""})})}Kn.displayName="ComponentsStoreProvider";const ni={Header:Mt,HeaderCaption:Vt,HeaderCaptionFilter:Qt,HeaderCaptionTitle:Yt,HeaderCaptionCount:function({...t}){const{notificationsCount:n}=Wt();return jsxRuntimeExports.jsx(N,{...t,children:(n||0).toString()})},HeaderCaptionButtons:Xt,HeaderCaptionButtonSearch:function({...t}){const{notifications:n}=Gt(),{isSearchVisible:i,showSearch:o,hideSearch:a}=Wt();return jsxRuntimeExports.jsx(B,{icon:i?"search-filled":"search",variant:"circle",size:"32",onClick:i?a:o,disabled:0===n.length,...t})},HeaderCaptionButtonSettings:function({icon:t="cog",...n}){const{showSettings:i}=Wt();return jsxRuntimeExports.jsx(B,{icon:t,size:"32",variant:"circle",onClick:i,...n})},HeaderCaptionButtonClose:function({icon:t="close",...n}){const{hidePanel:i}=Gt();return jsxRuntimeExports.jsx(B,{icon:t,size:"32",variant:"circle",onClick:i,...n})},HeaderActions:function({className:n="io-panel-header-actions",...i}){const{HeaderActionSort:o,HeaderActionView:a,HeaderActionClear:s,HeaderActionEdit:r}=ai();return jsxRuntimeExports.jsxs("div",{className:n,...i,children:[jsxRuntimeExports.jsxs(z,{children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{})]}),jsxRuntimeExports.jsx(z,{children:jsxRuntimeExports.jsx(s,{})})]})},HeaderActionSort:function({text:n="Sort by",...o}){const{sortNotificationsBy:a,setSortBy:r}=Wt(),{onNotificationsSort:l}=(()=>{const{notifications:e}=Gt(),[t,n]=useState(on),{key:o,descending:a}=t,r=useMemo((()=>ln[o](e,a)),[e,o,a]),l=useCallback((e=>{n((t=>({key:e,descending:t.key!==e?on.descending:!t.descending})));}),[]);return {onNotificationsSort:l,sortedNotifications:r}})();return jsxRuntimeExports.jsxs(L,{variant:"outline",...o,children:[jsxRuntimeExports.jsxs(L.Button,{variant:"link",children:[n," ",jsxRuntimeExports.jsx("strong",{children:a})]}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:["Newest","Oldest","Severity"].map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>{r(t.toLowerCase()),l(t.toLowerCase());},children:t},t)))})})]})},HeaderActionView:function({text:n="View",...i}){const{settings:o}=Gt(),{viewNotificationsBy:a,setViewBy:s}=Wt(),r=o.snooze?.enabled?["All","Read","Unread","Snoozed"]:["All","Read","Unread"];return jsxRuntimeExports.jsxs(L,{variant:"outline",...i,children:[jsxRuntimeExports.jsxs(L.Button,{variant:"link",children:[n," ",jsxRuntimeExports.jsx("strong",{children:a})]}),jsxRuntimeExports.jsx(L.Content,{children:jsxRuntimeExports.jsx(L.List,{variant:"single",children:r.map((t=>jsxRuntimeExports.jsx(L.Item,{onClick:()=>s(t.toLowerCase()),children:t},t)))})})]})},HeaderActionClear:function({text:t="Clear All",...n}){const{notifications:i,clearAll:o}=Gt();return jsxRuntimeExports.jsx(C,{variant:"link",text:t,onClick:o,disabled:0===i.length,...n})},HeaderActionEdit:function({...t}){return jsxRuntimeExports.jsx(B,{icon:"pen-to-square",size:"32",...t})},HeaderSearch:function({className:n="io-panel-header-search",icon:i="search",placeholder:o="Search",...a}){const{isSearchVisible:s,searchQuery:c,setSearch:d,notificationsCount:u}=Wt(),h=useRef(null);return useEffect((()=>{s?h.current?.focus():(h.current?.blur(),d(""));}),[s,d]),s?jsxRuntimeExports.jsxs("div",{className:n,children:[jsxRuntimeExports.jsx(K,{ref:h,value:c,iconPrepend:i,placeholder:o,onChange:e=>d(e.target.value),...a}),s&&c.length>0&&jsxRuntimeExports.jsx("p",{className:`${n}-count`,children:`${u} results`})]}):null},Body:cn,Footer:dn,FooterButtons:un,FooterButtonClearAll:hn,FooterButtonClearAllOld:mn,Notification:Zn,NotificationsList:ti,Settings:gn,SettingsGeneral:fn,SettingsAllowNotifications:pn,SettingsPanelAutoHide:bn,SettingsPanelAlwaysOnTop:vn,SettingsHideToastsAfter:yn,SettingsMarkAsNew:wn,SettingsMarkAsRead:Nn,SettingsStacking:Sn,SettingsToastStacking:kn,SettingsToastStackBy:Bn,SettingsPlacement:xn,SettingsPlacementPanel:In,SettingsPlacementToasts:$n,SettingsSnooze:Tn,SettingsSnoozeDuration:An,SettingsSubscriptions:Pn,SettingsSubscriptionsToggleAll:Fn,SettingsSubscriptionsToggleApp:Ln},ii=createContext(ni),oi=memo((({children:t,components:n})=>{const i=useMemo((()=>({...ni,...n})),[n]);return jsxRuntimeExports.jsx(ii.Provider,{value:i,children:t})}));function ai(e){return {...useContext(ii),...e}}oi.displayName="ComponentsStoreProvider";const li={Body:function({className:t="io-toasts-body",notifications:n,maxToasts:i=1,...o}){const{NotificationsList:a,Notification:l}=ui(),[c,d]=useState([]);return useEffect((()=>{const e=i<0?n.length:i,t=n.filter((e=>"Active"===e.state)).slice(0,e);for(const e of t)e.onShow();d(t);}),[n,i]),jsxRuntimeExports.jsx("div",{className:t,...o,children:jsxRuntimeExports.jsx(a,{Notification:l,notifications:c,noNotificationText:""})})},Notification:Zn,NotificationsList:ti},ci=createContext(li),di=memo((({children:t,components:n})=>{const i=useMemo((()=>({...li,...n})),[n]);return jsxRuntimeExports.jsx(ci.Provider,{value:i,children:t})}));function ui(e){return {...useContext(ci),...e}}di.displayName="ComponentsStoreProvider";
1170
+ */b=y,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var o=arguments[t];o&&(e=i(e,n(o)));}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return "";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var o="";for(var r in n)e.call(n,r)&&n[r]&&(o=i(o,r));return o}function i(e,t){return t?e?e+" "+t:e+t:e}b.exports?(t.default=t,b.exports=t):window.classNames=t;}();var w=v(y.exports);function k({className:t,size:n="16",variant:i="workspace",...o}){const r=w("icon",n&&[`icon-size-${n}`],t);return jsxRuntimeExports.jsx("span",{className:r,...o,children:jsxRuntimeExports.jsx("i",{className:`icon-${i}`})})}const S=forwardRef((({className:t,variant:n="default",icon:i="workspace",size:o="16",iconSize:a="16",onClick:s,disabled:c,children:l,...u},d)=>{const f=w("io-btn-icon","default"!==n&&[`io-btn-icon-${n}`],[`io-btn-icon-size-${o}`],t),h=useCallback((e=>{if(!c)return s?s(e):void 0;e.preventDefault();}),[s,c]);return jsxRuntimeExports.jsx("button",{className:f,type:"button",ref:d,"aria-label":"button",onClick:h,disabled:c,...u,children:l??(i&&jsxRuntimeExports.jsx(k,{variant:i,size:a}))})}));S.displayName="ButtonIcon";function x({className:t,variant:n="default",children:i,...o}){const r=w("io-badge",{[`io-badge-${n}`]:"default"!==n},t);return jsxRuntimeExports.jsx("div",{className:r,...o,children:i})}function I({className:t,tag:n="h2",size:i="normal",text:o="Title",...r}){const a=n,s=w("small"===i&&"io-title-semibold","normal"===i&&"io-title","large"===i&&"io-title-large",t);return jsxRuntimeExports.jsx(a,{className:s,...r,children:o})}function E({className:n,title:i,titleSize:o="normal",tag:r,hint:a,children:s,...c}){const l=w("io-block",n);return jsxRuntimeExports.jsxs("div",{className:l,...c,children:[i&&jsxRuntimeExports.jsx(I,{tag:r,text:i,size:o}),s,a&&jsxRuntimeExports.jsx("p",{className:"io-text-smaller",children:a})]})}const A=forwardRef((({className:n,variant:i="default",size:o="normal",icon:a,iconSize:s="12",iconRight:c=!1,text:l,onClick:u,disabled:d,children:f,...h},m)=>{const p=w("io-btn",("primary"===i||"critical"===i||"outline"===i||"link"===i)&&[`io-btn-${i}`],"large"===o&&"io-btn-lg",n),g=useCallback((e=>{if(!d)return u?u(e):void 0;e.preventDefault();}),[u,d]);return jsxRuntimeExports.jsxs("button",{className:p,ref:m,type:"button","aria-label":"button",onClick:g,disabled:d,tabIndex:0,...h,children:[a&&!c&&jsxRuntimeExports.jsx(k,{variant:a,size:s}),f??l,a&&c&&jsxRuntimeExports.jsx(k,{variant:a,size:s})]})}));A.displayName="Button";const B=createContext({});function T({className:t,...n}){const{handleOpen:i}=useContext(B),o=w("io-dropdown-content",t),a=useCallback((e=>{e.stopPropagation(),i&&i();}),[i]);return jsxRuntimeExports.jsx("div",{className:o,role:"button",onClick:a,...n})}const P=createContext({}),R=forwardRef(((n,i)=>{const{className:o,prepend:r,append:a,isSelected:c,onClick:l,description:u,disabled:d=!1,children:f,tooltip:h,...m}=n,{variant:p="default",selected:g,checkIcon:v="none",handleItemClick:b}=useContext(P),y=c??g?.some((e=>e.children===f)),S="default"!==p&&"none"!==v,N=S||r,C=w("io-list-item",N&&"io-list-item-left",a&&"io-list-item-right","default"!==p&&y&&"selected",u&&"io-list-item-description",d&&"io-list-item-disabled",o);return jsxRuntimeExports.jsxs("li",{className:C,ref:i,role:"menuitem","aria-roledescription":"menuitem",tabIndex:0,onClick:e=>{d?e.preventDefault():(b?.(e,{children:f}),l?.(e));},...m,children:[N&&jsxRuntimeExports.jsxs("div",{className:"io-list-left-column",children:[S&&jsxRuntimeExports.jsx(k,{variant:v}),r]}),jsxRuntimeExports.jsx("span",{className:"io-list-text",title:h,children:f}),a&&jsxRuntimeExports.jsx("div",{className:"io-list-right-column",children:a}),u&&jsxRuntimeExports.jsx("div",{className:"io-list-text-description",children:u})]})}));R.displayName="ListItem";const L=forwardRef((({className:n,prepend:i,append:o,children:r,tooltip:a,...s},c)=>{const l=w("io-list-item",i&&"io-list-item-left",o&&"io-list-item-right","io-list-item-title",n);return jsxRuntimeExports.jsxs("li",{className:l,ref:c,...s,children:[i&&jsxRuntimeExports.jsx("div",{className:"io-list-left-column",children:i}),jsxRuntimeExports.jsx("span",{className:"io-list-text",title:a,children:r}),o&&jsxRuntimeExports.jsx("div",{className:"io-list-right-column",children:o})]})}));L.displayName="ListItemTitle";const O=forwardRef((({className:n,prepend:i,append:o,children:r,tooltip:a,...s},c)=>{const l=w("io-list-item",i&&"io-list-item-left",o&&"io-list-item-right","io-list-item-section",n);return jsxRuntimeExports.jsxs("li",{className:l,ref:c,...s,children:[i&&jsxRuntimeExports.jsx("div",{className:"io-list-left-column",children:i}),jsxRuntimeExports.jsx("span",{className:"io-list-text",title:a,children:r}),o&&jsxRuntimeExports.jsx("div",{className:"io-list-right-column",children:o})]})}));O.displayName="ListItemSection";const F=forwardRef((({className:n,prepend:i,append:o,children:r,tooltip:a,...s},c)=>{const l=w("io-list-item-header",n);return jsxRuntimeExports.jsxs("div",{className:l,ref:c,...s,children:[i&&jsxRuntimeExports.jsx("div",{className:"io-list-left-column",children:i}),jsxRuntimeExports.jsx("span",{className:"io-list-text",title:a,children:r}),o&&jsxRuntimeExports.jsx("div",{className:"io-list-right-column",children:o})]})}));F.displayName="ListItemHeader";const D=forwardRef((({className:t,children:n,...i},o)=>{const r=w("io-list-item","io-list-with-sub-items",t);return jsxRuntimeExports.jsx("li",{className:r,ref:o,...i,children:n})}));D.displayName="ListItemWithSubItems";const M=forwardRef(((t,n)=>{const{className:i,variant:o="default",checkIcon:a="none",children:s,...u}=t,[d,f]=useState([]),h=w("io-list","default"!==o&&"io-list-selectable",i),m=useCallback(((e,t)=>{if("default"===o)return;const n=d.some((e=>e.children?.toString()===t.children?.toString()));"single"===o?f([t]):(()=>{const e=n?d.filter((e=>e.children!==t.children)):[...d,t];f(e);})();}),[d,o]),p=useMemo((()=>({variant:o,selected:d,checkIcon:a,handleItemClick:m})),[o,d,a,m]);return jsxRuntimeExports.jsx(P.Provider,{value:p,children:jsxRuntimeExports.jsx("ul",{className:h,ref:n,...u,children:s})})}));M.displayName="List";const z=M;function _(e,t){useEffect((()=>{const n=n=>{e.current&&!e.current.contains(n.target)&&t();};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n);}}),[e,t]);}function H({className:t,variant:n="outline",align:i="down",disabled:o,children:a,...s}){const[u,f]=useState(!1),h=useRef(null),m=w("io-dropdown",u&&"io-dropdown-open","default"!==n&&[`io-dropdown-${n}`],t),p=useCallback((()=>{f(!u);}),[u]);_(h,useCallback((()=>{f(!1);}),[]));const g=useMemo((()=>({isOpen:u,handleOpen:p,variant:n,align:i,disabled:o})),[u,p,n,i,o]);return jsxRuntimeExports.jsx(B.Provider,{value:g,children:jsxRuntimeExports.jsx("div",{className:m,ref:h,...s,children:a})})}function $({className:t,variant:n="default",align:i="left",children:o,...r}){const a=w("io-btn-group","sticky"===n&&"io-btn-group-sticky","append"===n&&"io-btn-group-append","fullwidth"===n&&"io-btn-group-fullwidth","right"===i&&"io-btn-group-right",t);return jsxRuntimeExports.jsx("div",{className:a,...r,children:o})}function j({className:t,draggable:n=!1,children:i,...o}){const r=w("io-header",n&&["draggable"],t);return jsxRuntimeExports.jsx("header",{className:r,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--spacing-8)"},...o,children:i})}function V({className:t,children:n,...i}){const o=w("io-dialog-header",t);return jsxRuntimeExports.jsx(j,{className:o,...i,children:n})}function U({className:t,children:n,...i}){const o=w("io-dialog-body",t);return jsxRuntimeExports.jsx("div",{className:o,...i,children:n})}function J({className:t,children:n,...i}){const o=w("io-footer",t);return jsxRuntimeExports.jsx("footer",{className:o,...i,children:n})}function W({className:t,...n}){const i=w("io-dialog-footer",t);return jsxRuntimeExports.jsx(J,{className:i,...n})}function K(){return "undefined"!=typeof window}function G(e){return X(e)?(e.nodeName||"").toLowerCase():"#document"}function Y(e){var t;return (null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Q(e){var t;return null==(t=(X(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function X(e){return !!K()&&(e instanceof Node||e instanceof Y(e).Node)}function Z(e){return !!K()&&(e instanceof Element||e instanceof Y(e).Element)}function ee(e){return !!K()&&(e instanceof HTMLElement||e instanceof Y(e).HTMLElement)}function te(e){return !(!K()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Y(e).ShadowRoot)}function ne(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=ce(e);return /auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function ie(e){return ["table","td","th"].includes(G(e))}function oe(e){return [":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return !1}}))}function re(e){const t=ae(),n=Z(e)?ce(e):e;return "none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function ae(){return !("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function se(e){return ["html","body","#document"].includes(G(e))}function ce(e){return Y(e).getComputedStyle(e)}function le(e){return Z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ue(e){if("html"===G(e))return e;const t=e.assignedSlot||e.parentNode||te(e)&&e.host||Q(e);return te(t)?t.host:t}function de(e){const t=ue(e);return se(t)?e.ownerDocument?e.ownerDocument.body:e.body:ee(t)&&ne(t)?t:de(t)}function fe(e,t,n){var i;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=de(e),r=o===(null==(i=e.ownerDocument)?void 0:i.body),a=Y(o);if(r){const e=he(a);return t.concat(a,a.visualViewport||[],ne(o)?o:[],e&&n?fe(e):[])}return t.concat(o,fe(o,[],n))}function he(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function me(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement;}return t}function pe(e,t){if(!e||!t)return !1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return !0;if(n&&te(n)){let n=t;for(;n;){if(e===n)return !0;n=n.parentNode||n.host;}}return !1}function ge(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function ve(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function be(e){return !(0!==e.mozInputSource||!e.isTrusted)||(ke()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function ye(e){return !ve().includes("jsdom/")&&(!ke()&&0===e.width&&0===e.height||ke()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function we(){return /apple/i.test(navigator.vendor)}function ke(){const e=/android/i;return e.test(ge())||e.test(ve())}function Se(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Ne(e){return (null==e?void 0:e.ownerDocument)||document}function Ce(e,t){if(null==t)return !1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function xe(e){return "composedPath"in e?e.composedPath()[0]:e.target}z.Item=R,z.ItemTitle=L,z.ItemSection=O,z.ItemHeader=F,z.ItemWithSubItems=D,H.Button=function({icon:t="chevron-down",...n}){const{handleOpen:i,disabled:o}=useContext(B),a=useCallback((e=>{e.stopPropagation(),i&&i();}),[i]);return jsxRuntimeExports.jsx(A,{icon:t,iconRight:!0,onClick:a,disabled:o,...n})},H.ButtonIcon=function({size:t="32",...n}){const{handleOpen:i,disabled:o}=useContext(B),a=useCallback((()=>{i&&i();}),[i]);return jsxRuntimeExports.jsx(S,{size:t,onClick:a,disabled:o,...n})},H.Content=T,H.List=z,H.Item=R,H.ItemTitle=L,H.ItemSection=O,$.Button=A,$.ButtonIcon=S,$.Dropdown=H,j.Title=I,j.ButtonGroup=$,j.Button=A,j.ButtonIcon=S,j.Dropdown=H,V.Title=I,V.ButtonGroup=$,V.Button=A,V.ButtonIcon=S,V.Dropdown=H,U.Content=function({className:t,children:n,...i}){const o=w("io-dialog-content",t);return jsxRuntimeExports.jsx("div",{className:o,...i,children:n})},J.ButtonGroup=$,J.Button=A,J.ButtonIcon=S,J.Dropdown=H,W.ButtonGroup=$,W.Button=A,W.ButtonIcon=S,W.Dropdown=H;function Ie(e){return ee(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function Ee(e){e.preventDefault(),e.stopPropagation();}function Ae(e){return !!e&&("combobox"===e.getAttribute("role")&&Ie(e))}const Be=Math.min,Te=Math.max,Pe=Math.round,Re=Math.floor,Le=e=>({x:e,y:e}),Oe={left:"right",right:"left",bottom:"top",top:"bottom"},Fe={start:"end",end:"start"};function De(e,t,n){return Te(e,Be(t,n))}function Me(e,t){return "function"==typeof e?e(t):e}function ze(e){return e.split("-")[0]}function _e(e){return e.split("-")[1]}function He(e){return "x"===e?"y":"x"}function $e(e){return "y"===e?"height":"width"}function je(e){return ["top","bottom"].includes(ze(e))?"y":"x"}function Ve(e){return He(je(e))}function Ue(e){return e.replace(/start|end/g,(e=>Fe[e]))}function Je(e){return e.replace(/left|right|bottom|top/g,(e=>Oe[e]))}function We(e){const{x:t,y:n,width:i,height:o}=e;return {width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}
1171
+ /*!
1172
+ * tabbable 6.2.0
1173
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1174
+ */var qe=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Ke="undefined"==typeof Element,Ge=Ke?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ye=!Ke&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Qe=function e(t,n){var i;void 0===n&&(n=!0);var o=null==t||null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"inert");return ""===o||"true"===o||n&&t&&e(t.parentNode)},Xe=function e(t,n,i){for(var o=[],r=Array.from(t);r.length;){var a=r.shift();if(!Qe(a,!1))if("SLOT"===a.tagName){var s=a.assignedElements(),c=e(s.length?s:a.children,!0,i);i.flatten?o.push.apply(o,c):o.push({scopeParent:a,candidates:c});}else {Ge.call(a,qe)&&i.filter(a)&&(n||!t.includes(a))&&o.push(a);var l=a.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(a),u=!Qe(l,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(l&&u){var d=e(!0===l?a.children:l.children,!0,i);i.flatten?o.push.apply(o,d):o.push({scopeParent:a,candidates:d});}else r.unshift.apply(r,a.children);}}return o},Ze=function(e){return !isNaN(parseInt(e.getAttribute("tabindex"),10))},et=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return ""===n||"true"===n}(e))&&!Ze(e)?0:e.tabIndex},tt=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},nt=function(e){return "INPUT"===e.tagName},it=function(e){return function(e){return nt(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return !0;var t,n=e.form||Ye(e),i=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=i(window.CSS.escape(e.name));else try{t=i(e.name);}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return !o||o===e}(e)},ot=function(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return 0===n&&0===i},rt=function(e,t){var n=t.displayCheck,i=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return !0;var o=Ge.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ge.call(o,"details:not([open]) *"))return !0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return ot(e)}else {if("function"==typeof i){for(var r=e;e;){var a=e.parentElement,s=Ye(e);if(a&&!a.shadowRoot&&!0===i(a))return ot(e);e=e.assignedSlot?e.assignedSlot:a||s===e.ownerDocument?a:s.host;}e=r;}if(function(e){var t,n,i,o,r=e&&Ye(e),a=null===(t=r)||void 0===t?void 0:t.host,s=!1;if(r&&r!==e)for(s=!!(null!==(n=a)&&void 0!==n&&null!==(i=n.ownerDocument)&&void 0!==i&&i.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!s&&a;){var c,l,u;s=!(null===(l=a=null===(c=r=Ye(a))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(a));}return s}(e))return !e.getClientRects().length;if("legacy-full"!==n)return !0}return !1},at=function(e,t){return !(t.disabled||Qe(t)||function(e){return nt(e)&&"hidden"===e.type}(t)||rt(t,e)||function(e){return "DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return "SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var i=t.children.item(n);if("LEGEND"===i.tagName)return !!Ge.call(t,"fieldset[disabled] *")||!i.contains(e)}return !0}t=t.parentElement;}return !1}(t))},st=function(e,t){return !(it(t)||et(t)<0||!at(e,t))},ct=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return !!(isNaN(t)||t>=0)},lt=function e(t){var n=[],i=[];return t.forEach((function(t,o){var r=!!t.scopeParent,a=r?t.scopeParent:t,s=function(e,t){var n=et(e);return n<0&&t&&!Ze(e)?0:n}(a,r),c=r?e(t.candidates):a;0===s?r?n.push.apply(n,c):n.push(a):i.push({documentOrder:o,tabIndex:s,item:t,isScope:r,content:c});})),i.sort(tt).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ut=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Xe([e],t.includeContainer,{filter:st.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ct}):function(e,t,n){if(Qe(e))return [];var i=Array.prototype.slice.apply(e.querySelectorAll(qe));return t&&Ge.call(e,qe)&&i.unshift(e),i.filter(n)}(e,t.includeContainer,st.bind(null,t)),lt(n)};function dt(e,t,n){let{reference:i,floating:o}=e;const r=je(t),a=Ve(t),s=$e(a),c=ze(t),l="y"===r,u=i.x+i.width/2-o.width/2,d=i.y+i.height/2-o.height/2,f=i[s]/2-o[s]/2;let h;switch(c){case"top":h={x:u,y:i.y-o.height};break;case"bottom":h={x:u,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:d};break;case"left":h={x:i.x-o.width,y:d};break;default:h={x:i.x,y:i.y};}switch(_e(t)){case"start":h[a]-=f*(n&&l?-1:1);break;case"end":h[a]+=f*(n&&l?-1:1);}return h}async function ft(e,t){var n;void 0===t&&(t={});const{x:i,y:o,platform:r,rects:a,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Me(t,e),m=function(e){return "number"!=typeof e?function(e){return {top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(h),p=s[f?"floating"===d?"reference":"floating":d],g=We(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(p)))||n?p:p.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),v="floating"===d?{x:i,y:o,width:a.floating.width,height:a.floating.height}:a.reference,b=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),y=await(null==r.isElement?void 0:r.isElement(b))&&await(null==r.getScale?void 0:r.getScale(b))||{x:1,y:1},w=We(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:b,strategy:c}):v);return {top:(g.top-w.top+m.top)/y.y,bottom:(w.bottom-g.bottom+m.bottom)/y.y,left:(g.left-w.left+m.left)/y.x,right:(w.right-g.right+m.right)/y.x}}function ht(e){const t=ce(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=ee(e),r=o?e.offsetWidth:n,a=o?e.offsetHeight:i,s=Pe(n)!==r||Pe(i)!==a;return s&&(n=r,i=a),{width:n,height:i,$:s}}function mt(e){return Z(e)?e:e.contextElement}function pt(e){const t=mt(e);if(!ee(t))return Le(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=ht(t);let a=(r?Pe(n.width):n.width)/i,s=(r?Pe(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const gt=Le(0);function vt(e){const t=Y(e);return ae()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gt}function bt(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),r=mt(e);let a=Le(1);t&&(i?Z(i)&&(a=pt(i)):a=pt(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Y(e))&&t}(r,n,i)?vt(r):Le(0);let c=(o.left+s.x)/a.x,l=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(r){const e=Y(r),t=i&&Z(i)?Y(i):i;let n=e,o=he(n);for(;o&&i&&t!==n;){const e=pt(o),t=o.getBoundingClientRect(),i=ce(o),r=t.left+(o.clientLeft+parseFloat(i.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(i.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=r,l+=a,n=Y(o),o=he(n);}}return We({width:u,height:d,x:c,y:l})}function yt(e,t){const n=le(e).scrollLeft;return t?t.left+n:bt(Q(e)).left+n}function wt(e,t,n){let i;if("viewport"===t)i=function(e,t){const n=Y(e),i=Q(e),o=n.visualViewport;let r=i.clientWidth,a=i.clientHeight,s=0,c=0;if(o){r=o.width,a=o.height;const e=ae();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,c=o.offsetTop);}return {width:r,height:a,x:s,y:c}}(e,n);else if("document"===t)i=function(e){const t=Q(e),n=le(e),i=e.ownerDocument.body,o=Te(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=Te(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let a=-n.scrollLeft+yt(e);const s=-n.scrollTop;return "rtl"===ce(i).direction&&(a+=Te(t.clientWidth,i.clientWidth)-o),{width:o,height:r,x:a,y:s}}(Q(e));else if(Z(t))i=function(e,t){const n=bt(e,!0,"fixed"===t),i=n.top+e.clientTop,o=n.left+e.clientLeft,r=ee(e)?pt(e):Le(1);return {width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:o*r.x,y:i*r.y}}(t,n);else {const n=vt(e);i={...t,x:t.x-n.x,y:t.y-n.y};}return We(i)}function kt(e,t){const n=ue(e);return !(n===t||!Z(n)||se(n))&&("fixed"===ce(n).position||kt(n,t))}function St(e,t,n){const i=ee(t),o=Q(t),r="fixed"===n,a=bt(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const c=Le(0);if(i||!i&&!r)if(("body"!==G(t)||ne(o))&&(s=le(t)),i){const e=bt(t,!0,r,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop;}else o&&(c.x=yt(o));let l=0,u=0;if(o&&!i&&!r){const e=o.getBoundingClientRect();u=e.top+s.scrollTop,l=e.left+s.scrollLeft-yt(o,e);}return {x:a.left+s.scrollLeft-c.x-l,y:a.top+s.scrollTop-c.y-u,width:a.width,height:a.height}}function Nt(e){return "static"===ce(e).position}function Ct(e,t){if(!ee(e)||"fixed"===ce(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Q(e)===n&&(n=n.ownerDocument.body),n}function xt(e,t){const n=Y(e);if(oe(e))return n;if(!ee(e)){let t=ue(e);for(;t&&!se(t);){if(Z(t)&&!Nt(t))return t;t=ue(t);}return n}let i=Ct(e,t);for(;i&&ie(i)&&Nt(i);)i=Ct(i,t);return i&&se(i)&&Nt(i)&&!re(i)?n:i||function(e){let t=ue(e);for(;ee(t)&&!se(t);){if(re(t))return t;if(oe(t))return null;t=ue(t);}return null}(e)||n}const It={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const r="fixed"===o,a=Q(i),s=!!t&&oe(t.floating);if(i===a||s&&r)return n;let c={scrollLeft:0,scrollTop:0},l=Le(1);const u=Le(0),d=ee(i);if((d||!d&&!r)&&(("body"!==G(i)||ne(a))&&(c=le(i)),ee(i))){const e=bt(i);l=pt(i),u.x=e.x+i.clientLeft,u.y=e.y+i.clientTop;}return {width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x,y:n.y*l.y-c.scrollTop*l.y+u.y}},getDocumentElement:Q,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const r=[..."clippingAncestors"===n?oe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let i=fe(e,[],!1).filter((e=>Z(e)&&"body"!==G(e))),o=null;const r="fixed"===ce(e).position;let a=r?ue(e):e;for(;Z(a)&&!se(a);){const t=ce(a),n=re(a);n||"fixed"!==t.position||(o=null),(r?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||ne(a)&&!n&&kt(e,a))?i=i.filter((e=>e!==a)):o=t,a=ue(a);}return t.set(e,i),i}(t,this._c):[].concat(n),i],a=r[0],s=r.reduce(((e,n)=>{const i=wt(t,n,o);return e.top=Te(i.top,e.top),e.right=Be(i.right,e.right),e.bottom=Be(i.bottom,e.bottom),e.left=Te(i.left,e.left),e}),wt(t,a,o));return {width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:xt,getElementRects:async function(e){const t=this.getOffsetParent||xt,n=this.getDimensions,i=await n(e.floating);return {reference:St(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ht(e);return {width:t,height:n}},getScale:pt,isElement:Z,isRTL:function(e){return "rtl"===ce(e).direction}};function Et(e,t,n,i){void 0===i&&(i={});const{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=i,l=mt(e),u=o||r?[...l?fe(l):[],...fe(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n);}));const d=l&&s?function(e,t){let n,i=null;const o=Q(e);function r(){var e;clearTimeout(n),null==(e=i)||e.disconnect(),i=null;}return function a(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),r();const{left:l,top:u,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;const h={rootMargin:-Re(u)+"px "+-Re(o.clientWidth-(l+d))+"px "+-Re(o.clientHeight-(u+f))+"px "+-Re(l)+"px",threshold:Te(0,Be(1,c))||1};let m=!0;function p(e){const t=e[0].intersectionRatio;if(t!==c){if(!m)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7);}),1e3);}m=!1;}try{i=new IntersectionObserver(p,{...h,root:o.ownerDocument});}catch(e){i=new IntersectionObserver(p,h);}i.observe(e);}(!0),r}(l,n):null;let f,h=-1,m=null;a&&(m=new ResizeObserver((e=>{let[i]=e;i&&i.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(t);}))),n();})),l&&!c&&m.observe(l),m.observe(t));let p=c?bt(e):null;return c&&function t(){const i=bt(e);!p||i.x===p.x&&i.y===p.y&&i.width===p.width&&i.height===p.height||n();p=i,f=requestAnimationFrame(t);}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n);})),null==d||d(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f);}}const At=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:o,y:r,placement:a,middlewareData:s}=t,c=await async function(e,t){const{placement:n,platform:i,elements:o}=e,r=await(null==i.isRTL?void 0:i.isRTL(o.floating)),a=ze(n),s=_e(n),c="y"===je(n),l=["left","top"].includes(a)?-1:1,u=r&&c?-1:1,d=Me(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof m&&(h="end"===s?-1*m:m),c?{x:h*u,y:f*l}:{x:f*l,y:h*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(i=s.arrow)&&i.alignmentOffset?{}:{x:o+c.x,y:r+c.y,data:{...c,placement:a}}}}},Bt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:o}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return {x:t,y:n}}},...c}=Me(e,t),l={x:n,y:i},u=await ft(t,c),d=je(ze(o)),f=He(d);let h=l[f],m=l[d];if(r){const e="y"===f?"bottom":"right";h=De(h+u["y"===f?"top":"left"],h,h-u[e]);}if(a){const e="y"===d?"bottom":"right";m=De(m+u["y"===d?"top":"left"],m,m-u[e]);}const p=s.fn({...t,[f]:h,[d]:m});return {...p,data:{x:p.x-n,y:p.y-i,enabled:{[f]:r,[d]:a}}}}}},Tt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:o,middlewareData:r,rects:a,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...g}=Me(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return {};const v=ze(o),b=je(s),y=ze(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),k=f||(y||!p?[Je(s)]:function(e){const t=Je(e);return [Ue(e),t,Ue(t)]}(s)),S="none"!==m;!f&&S&&k.push(...function(e,t,n,i){const o=_e(e);let r=function(e,t,n){const i=["left","right"],o=["right","left"],r=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:i:t?i:o;case"left":case"right":return t?r:a;default:return []}}(ze(e),"start"===n,i);return o&&(r=r.map((e=>e+"-"+o)),t&&(r=r.concat(r.map(Ue)))),r}(s,p,m,w));const N=[s,...k],C=await ft(t,g),x=[];let I=(null==(i=r.flip)?void 0:i.overflows)||[];if(u&&x.push(C[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const i=_e(e),o=Ve(e),r=$e(o);let a="x"===o?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=Je(a)),[a,Je(a)]}(o,a,w);x.push(C[e[0]],C[e[1]]);}if(I=[...I,{placement:o,overflows:x}],!x.every((e=>e<=0))){var E,A;const e=((null==(E=r.flip)?void 0:E.index)||0)+1,t=N[e];if(t)return {data:{index:e,overflows:I},reset:{placement:t}};let n=null==(A=I.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:A.placement;if(!n)switch(h){case"bestFit":{var B;const e=null==(B=I.filter((e=>{if(S){const t=je(e.placement);return t===b||"y"===t}return !0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:B[0];e&&(n=e);break}case"initialPlacement":n=s;}if(o!==n)return {reset:{placement:n}}}return {}}}},Pt=(e,t,n)=>{const i=new Map,o={platform:It,...n},r={...o.platform,_c:i};return (async(e,t,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:a}=n,s=r.filter(Boolean),c=await(null==a.isRTL?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=dt(l,i,c),f=i,h={},m=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:g,y:v,data:b,reset:y}=await p({x:u,y:d,initialPlacement:i,placement:f,strategy:o,middlewareData:h,rects:l,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,h={...h,[r]:{...h[r],...b}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(l=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:u,y:d}=dt(l,f,c))),n=-1);}return {x:u,y:d,placement:f,strategy:o,middlewareData:h}})(e,t,{...o,platform:r})};var Rt="undefined"!=typeof document?useLayoutEffect:useEffect;function Lt(e,t){if(e===t)return !0;if(typeof e!=typeof t)return !1;if("function"==typeof e&&e.toString()===t.toString())return !0;let n,i,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return !1;for(i=n;0!=i--;)if(!Lt(e[i],t[i]))return !1;return !0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return !1;for(i=n;0!=i--;)if(!{}.hasOwnProperty.call(t,o[i]))return !1;for(i=n;0!=i--;){const n=o[i];if(("_owner"!==n||!e.$$typeof)&&!Lt(e[n],t[n]))return !1}return !0}return e!=e&&t!=t}function Ot(e){if("undefined"==typeof window)return 1;return (e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ft(e,t){const n=Ot(e);return Math.round(t*n)/n}function Dt(e){const t=i.useRef(e);return Rt((()=>{t.current=e;})),t}const Mt=(e,t)=>({...Bt(e),options:[e,t]}),zt=(e,t)=>({...Tt(e),options:[e,t]});function _t(e){return i.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t);}));}),e)}const Ht={...i},$t=Ht.useInsertionEffect||(e=>e());function jt(e){const t=i.useRef((()=>{}));return $t((()=>{t.current=e;})),i.useCallback((function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return null==t.current?void 0:t.current(...n)}),[])}const Vt="ArrowUp",Ut="ArrowDown",Jt="ArrowLeft",Wt="ArrowRight";function qt(e,t,n){return Math.floor(e/t)!==n}function Kt(e,t){return t<0||t>=e.current.length}function Gt(e,t){return Qt(e,{disabledIndices:t})}function Yt(e,t){return Qt(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Qt(e,t){let{startingIndex:n=-1,decrement:i=!1,disabledIndices:o,amount:r=1}=void 0===t?{}:t;const a=e.current;let s=n;do{s+=i?-r:r;}while(s>=0&&s<=a.length-1&&en(a,s,o));return s}function Xt(e,t,n,i,o){if(-1===e)return -1;const r=n.indexOf(e),a=t[e];switch(o){case"tl":return r;case"tr":return a?r+a.width-1:r;case"bl":return a?r+(a.height-1)*i:r;case"br":return n.lastIndexOf(e)}}function Zt(e,t){return t.flatMap(((t,n)=>e.includes(t)?[n]:[]))}function en(e,t,n){if(n)return n.includes(t);const i=e[t];return null==i||i.hasAttribute("disabled")||"true"===i.getAttribute("aria-disabled")}let tn=0;function nn(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:i=!0,sync:o=!1}=t;i&&cancelAnimationFrame(tn);const r=()=>null==e?void 0:e.focus({preventScroll:n});o?r():tn=requestAnimationFrame(r);}var on="undefined"!=typeof document?useLayoutEffect:useEffect;function rn(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const an=i.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function sn(e){const{children:t,elementsRef:n,labelsRef:o}=e,[r,a]=i.useState((()=>new Map)),s=i.useCallback((e=>{a((t=>new Map(t).set(e,null)));}),[]),c=i.useCallback((e=>{a((t=>{const n=new Map(t);return n.delete(e),n}));}),[]);return on((()=>{const e=new Map(r);Array.from(e.keys()).sort(rn).forEach(((t,n)=>{e.set(t,n);})),function(e,t){if(e.size!==t.size)return !1;for(const[n,i]of e.entries())if(i!==t.get(n))return !1;return !0}(r,e)||a(e);}),[r]),i.createElement(an.Provider,{value:i.useMemo((()=>({register:s,unregister:c,map:r,elementsRef:n,labelsRef:o})),[s,c,r,n,o])},t)}function cn(e){void 0===e&&(e={});const{label:t}=e,{register:n,unregister:o,map:r,elementsRef:a,labelsRef:s}=i.useContext(an),[c,l]=i.useState(null),u=i.useRef(null),d=i.useCallback((e=>{if(u.current=e,null!==c&&(a.current[c]=e,s)){var n;const i=void 0!==t;s.current[c]=i?t:null!=(n=null==e?void 0:e.textContent)?n:null;}}),[c,a,s,t]);return on((()=>{const e=u.current;if(e)return n(e),()=>{o(e);}}),[n,o]),on((()=>{const e=u.current?r.get(u.current):null;null!=e&&l(e);}),[r]),i.useMemo((()=>({ref:d,index:null==c?-1:c})),[c,d])}function ln(){return ln=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);}return e},ln.apply(this,arguments)}let un=!1,dn=0;const fn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+dn++;const hn=Ht.useId||function(){const[e,t]=i.useState((()=>un?fn():void 0));return on((()=>{null==e&&t(fn());}),[]),i.useEffect((()=>{un=!0;}),[]),e};function gn(){const e=new Map;return {emit(t,n){var i;null==(i=e.get(t))||i.forEach((e=>e(n)));},on(t,n){e.set(t,[...e.get(t)||[],n]);},off(t,n){var i;e.set(t,(null==(i=e.get(t))?void 0:i.filter((e=>e!==n)))||[]);}}}const vn=i.createContext(null),bn=i.createContext(null),yn=()=>{var e;return (null==(e=i.useContext(vn))?void 0:e.id)||null},wn=()=>i.useContext(bn);function kn(e){const{children:t,id:n}=e,o=yn();return i.createElement(vn.Provider,{value:i.useMemo((()=>({id:n,parentId:o})),[n,o])},t)}function Sn(e){const{children:t}=e,n=i.useRef([]),o=i.useCallback((e=>{n.current=[...n.current,e];}),[]),r=i.useCallback((e=>{n.current=n.current.filter((t=>t!==e));}),[]),a=i.useState((()=>gn()))[0];return i.createElement(bn.Provider,{value:i.useMemo((()=>({nodesRef:n,addNode:o,removeNode:r,events:a})),[o,r,a])},t)}function Nn(e){return "data-floating-ui-"+e}function Cn(e){const t=useRef(e);return on((()=>{t.current=e;})),t}const xn=Nn("safe-polygon");function In(e,t,n){return n&&!Se(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function En(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),i=n;for(;i.length;)i=e.filter((e=>{var t;return null==(t=i)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(i);return n}let An=new WeakMap,Bn=new WeakSet,Tn={},Pn=0;const Rn=e=>e&&(e.host||Rn(e.parentNode));function Ln(e,t,n,i){const o="data-floating-ui-inert",r=i?"inert":n?"aria-hidden":null,a=(s=t,e.map((e=>{if(s.contains(e))return e;const t=Rn(e);return s.contains(t)?t:null})).filter((e=>null!=e)));var s;const c=new Set,l=new Set(a),u=[];Tn[o]||(Tn[o]=new WeakMap);const d=Tn[o];return a.forEach((function e(t){if(!t||c.has(t))return;c.add(t),t.parentNode&&e(t.parentNode);})),function e(t){if(!t||l.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==G(t))if(c.has(t))e(t);else {const e=r?t.getAttribute(r):null,n=null!==e&&"false"!==e,i=(An.get(t)||0)+1,a=(d.get(t)||0)+1;An.set(t,i),d.set(t,a),u.push(t),1===i&&n&&Bn.add(t),1===a&&t.setAttribute(o,""),!n&&r&&t.setAttribute(r,"true");}}));}(t),c.clear(),Pn++,()=>{u.forEach((e=>{const t=(An.get(e)||0)-1,n=(d.get(e)||0)-1;An.set(e,t),d.set(e,n),t||(!Bn.has(e)&&r&&e.removeAttribute(r),Bn.delete(e)),n||e.removeAttribute(o);})),Pn--,Pn||(An=new WeakMap,An=new WeakMap,Bn=new WeakSet,Tn={});}}function On(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=Ne(e[0]).body;return Ln(e.concat(Array.from(i.querySelectorAll("[aria-live]"))),i,t,n)}const Fn=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Dn(e,t){const n=ut(e,Fn());"prev"===t&&n.reverse();const i=n.indexOf(me(Ne(e)));return n.slice(i+1)[0]}function Mn(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return !i||!pe(n,i)}const zn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function _n(e){"Tab"===e.key&&(e.target,clearTimeout(undefined));}const Hn=i.forwardRef((function(e,t){const[n,o]=i.useState();on((()=>(we()&&o("button"),document.addEventListener("keydown",_n),()=>{document.removeEventListener("keydown",_n);})),[]);const r={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Nn("focus-guard")]:"",style:zn};return i.createElement("span",ln({},e,r))})),$n=i.createContext(null),jn="data-floating-ui-focusable";function Vn(e){return e?e.hasAttribute(jn)?e:e.querySelector("["+jn+"]")||e:null}let Un=[];function Jn(e){Un=Un.filter((e=>e.isConnected));let t=e;if(t&&"body"!==G(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return !1!==Ge.call(e,qe)&&st(t,e)}(t,Fn())){const e=ut(t,Fn())[0];e&&(t=e);}Un.push(t),Un.length>20&&(Un=Un.slice(-20));}}function Wn(){return Un.slice().reverse().find((e=>e.isConnected))}const qn=i.forwardRef((function(e,t){return i.createElement("button",ln({},e,{type:"button",ref:t,tabIndex:-1,style:zn}))}));function Kn(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],guards:a=!0,initialFocus:s=0,returnFocus:c=!0,restoreFocus:l=!1,modal:u=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:f=!0}=e,{open:h,refs:m,nodeId:p,onOpenChange:g,events:v,dataRef:b,floatingId:y,elements:{domReference:w,floating:k}}=t,S="number"==typeof s&&s<0,N=Ae(w)&&S,C="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||a,x=Cn(r),I=Cn(s),E=Cn(c),A=wn(),B=i.useContext($n),T=i.useRef(null),P=i.useRef(null),R=i.useRef(!1),L=i.useRef(!1),O=i.useRef(-1),F=null!=B,D=Vn(k),M=jt((function(e){return void 0===e&&(e=D),e?ut(e,Fn()):[]})),z=jt((e=>{const t=M(e);return x.current.map((e=>w&&"reference"===e?w:D&&"floating"===e?D:t)).filter(Boolean).flat()}));function _(e){return !o&&d&&u?i.createElement(qn,{ref:"start"===e?T:P,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}i.useEffect((()=>{R.current=!1;}),[o]),i.useEffect((()=>{if(o)return;if(!u)return;function e(e){if("Tab"===e.key){pe(D,me(Ne(D)))&&0===M().length&&!N&&Ee(e);const t=z(),n=xe(e);"reference"===x.current[0]&&n===w&&(Ee(e),e.shiftKey?nn(t[t.length-1]):nn(t[1])),"floating"===x.current[1]&&n===D&&e.shiftKey&&(Ee(e),nn(t[0]));}}const t=Ne(D);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e);}}),[o,w,D,u,x,N,M,z]),i.useEffect((()=>{if(!o&&k)return k.addEventListener("focusin",e),()=>{k.removeEventListener("focusin",e);};function e(e){const t=xe(e),n=M().indexOf(t);-1!==n&&(O.current=n);}}),[o,k,M]),i.useEffect((()=>{if(!o&&f)return k&&ee(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),k.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),k.removeEventListener("focusout",t);}):void 0;function e(){L.current=!0,setTimeout((()=>{L.current=!1;}));}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(pe(w,t)||pe(k,t)||pe(t,k)||pe(null==B?void 0:B.portalNode,t)||null!=t&&t.hasAttribute(Nn("focus-guard"))||A&&(En(A.nodesRef.current,p).find((e=>{var n,i;return pe(null==(n=e.context)?void 0:n.elements.floating,t)||pe(null==(i=e.context)?void 0:i.elements.domReference,t)}))||function(e,t){var n;let i=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(i=i.concat(t));}return i}(A.nodesRef.current,p).find((e=>{var n,i;return (null==(n=e.context)?void 0:n.elements.floating)===t||(null==(i=e.context)?void 0:i.elements.domReference)===t}))));if(l&&n&&me(Ne(D))===Ne(D).body){ee(D)&&D.focus();const e=O.current,t=M(),n=t[e]||t[t.length-1]||D;ee(n)&&n.focus();}!N&&u||!t||!n||L.current||t===Wn()||(R.current=!0,g(!1,e,"focus-out"));}));}}),[o,w,k,D,u,p,A,B,g,f,l,M,N]),i.useEffect((()=>{var e;if(o)return;const t=Array.from((null==B||null==(e=B.portalNode)?void 0:e.querySelectorAll("["+Nn("portal")+"]"))||[]);if(k){const e=[k,...t,T.current,P.current,x.current.includes("reference")||N?w:null].filter((e=>null!=e)),n=u||N?On(e,C,!C):On(e);return ()=>{n();}}}),[o,w,k,u,x,B,N,C]),on((()=>{if(o||!ee(D))return;const e=me(Ne(D));queueMicrotask((()=>{const t=z(D),n=I.current,i=("number"==typeof n?t[n]:n.current)||D,o=pe(D,e);S||o||!h||nn(i,{preventScroll:i===D});}));}),[o,h,D,S,z,I]),on((()=>{if(o||!D)return;let e=!1;const t=Ne(D),n=me(t);let i=b.current.openEvent;function r(t){let{open:n,reason:o,event:r,nested:a}=t;n&&(i=r),"escape-key"===o&&m.domReference.current&&Jn(m.domReference.current),"hover"===o&&"mouseleave"===r.type&&(R.current=!0),"outside-press"===o&&(a?(R.current=!1,e=!0):R.current=!(be(r)||ye(r)));}Jn(n),v.on("openchange",r);const a=t.createElement("span");return a.setAttribute("tabindex","-1"),a.setAttribute("aria-hidden","true"),Object.assign(a.style,zn),F&&w&&w.insertAdjacentElement("afterend",a),()=>{v.off("openchange",r);const n=me(t),o=pe(k,n)||A&&En(A.nodesRef.current,p).some((e=>{var t;return pe(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||i&&["click","mousedown"].includes(i.type))&&m.domReference.current&&Jn(m.domReference.current);const s=Wn()||a;queueMicrotask((()=>{E.current&&!R.current&&ee(s)&&(s===n||n===t.body||o)&&s.focus({preventScroll:e}),a.remove();}));}}),[o,k,D,E,b,m,v,A,p,F,w]),on((()=>{if(!o&&B)return B.setFocusManagerState({modal:u,closeOnFocusOut:f,open:h,onOpenChange:g,refs:m}),()=>{B.setFocusManagerState(null);}}),[o,B,u,h,g,m,f]),on((()=>{if(o)return;if(!D)return;if("function"!=typeof MutationObserver)return;if(S)return;const e=()=>{const e=D.getAttribute("tabindex"),t=M(),n=me(Ne(k)),i=t.indexOf(n);-1!==i&&(O.current=i),x.current.includes("floating")||n!==m.domReference.current&&0===t.length?"0"!==e&&D.setAttribute("tabindex","0"):"-1"!==e&&D.setAttribute("tabindex","-1");};e();const t=new MutationObserver(e);return t.observe(D,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect();}}),[o,k,D,m,x,M,S]);const H=!o&&C&&(!u||!N)&&(F||u);return i.createElement(i.Fragment,null,H&&i.createElement(Hn,{"data-type":"inside",ref:null==B?void 0:B.beforeInsideRef,onFocus:e=>{if(u){const e=z();nn("reference"===r[0]?e[0]:e[e.length-1]);}else if(null!=B&&B.preserveTabOrder&&B.portalNode)if(R.current=!1,Mn(e,B.portalNode)){const e=Dn(document.body,"next")||w;null==e||e.focus();}else {var t;null==(t=B.beforeOutsideRef.current)||t.focus();}}}),!N&&_("start"),n,_("end"),H&&i.createElement(Hn,{"data-type":"inside",ref:null==B?void 0:B.afterInsideRef,onFocus:e=>{if(u)nn(z()[0]);else if(null!=B&&B.preserveTabOrder&&B.portalNode)if(f&&(R.current=!0),Mn(e,B.portalNode)){const e=Dn(document.body,"prev")||w;null==e||e.focus();}else {var t;null==(t=B.afterOutsideRef.current)||t.focus();}}}))}function Gn(e){return ee(e.target)&&"BUTTON"===e.target.tagName}function Yn(e){return Ie(e)}const Qn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Xn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Zn=e=>{var t,n;return {escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function ei(e){const{open:t=!1,onOpenChange:n,elements:o}=e,r=hn(),a=i.useRef({}),[s]=i.useState((()=>gn())),c=null!=yn();const[l,u]=i.useState(o.reference),d=jt(((e,t,i)=>{a.current.openEvent=e?t:void 0,s.emit("openchange",{open:e,event:t,reason:i,nested:c}),null==n||n(e,t,i);})),f=i.useMemo((()=>({setPositionReference:u})),[]),h=i.useMemo((()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference})),[l,o.reference,o.floating]);return i.useMemo((()=>({dataRef:a,open:t,onOpenChange:d,elements:h,events:s,floatingId:r,refs:f})),[t,d,h,s,r,f])}function ti(e){void 0===e&&(e={});const{nodeId:t}=e,n=ei({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,r=o.elements,[a,s]=i.useState(null),[c,l]=i.useState(null),u=(null==r?void 0:r.reference)||a,d=i.useRef(null),f=wn();on((()=>{u&&(d.current=u);}),[u]);const h=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:a,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[d,f]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=i.useState(o);Lt(h,o)||p(o);const[g,v]=i.useState(null),[b,y]=i.useState(null),w=i.useCallback((e=>{e!==C.current&&(C.current=e,v(e));}),[]),k=i.useCallback((e=>{e!==x.current&&(x.current=e,y(e));}),[]),S=a||g,N=s||b,C=i.useRef(null),x=i.useRef(null),I=i.useRef(d),E=null!=l,A=Dt(l),B=Dt(r),T=Dt(u),P=i.useCallback((()=>{if(!C.current||!x.current)return;const e={placement:t,strategy:n,middleware:h};B.current&&(e.platform=B.current),Pt(C.current,x.current,e).then((e=>{const t={...e,isPositioned:!1!==T.current};R.current&&!Lt(I.current,t)&&(I.current=t,require$$0.flushSync((()=>{f(t);})));}));}),[h,t,n,B,T]);Rt((()=>{!1===u&&I.current.isPositioned&&(I.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))));}),[u]);const R=i.useRef(!1);Rt((()=>(R.current=!0,()=>{R.current=!1;})),[]),Rt((()=>{if(S&&(C.current=S),N&&(x.current=N),S&&N){if(A.current)return A.current(S,N,P);P();}}),[S,N,P,A,E]);const L=i.useMemo((()=>({reference:C,floating:x,setReference:w,setFloating:k})),[w,k]),O=i.useMemo((()=>({reference:S,floating:N})),[S,N]),F=i.useMemo((()=>{const e={position:n,left:0,top:0};if(!O.floating)return e;const t=Ft(O.floating,d.x),i=Ft(O.floating,d.y);return c?{...e,transform:"translate("+t+"px, "+i+"px)",...Ot(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:i}}),[n,c,O.floating,d.x,d.y]);return i.useMemo((()=>({...d,update:P,refs:L,elements:O,floatingStyles:F})),[d,P,L,O,F])}({...e,elements:{...r,...c&&{reference:c}}}),p=i.useCallback((e=>{const t=Z(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l(t),h.refs.setReference(t);}),[h.refs]),g=i.useCallback((e=>{(Z(e)||null===e)&&(d.current=e,s(e)),(Z(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!Z(e))&&h.refs.setReference(e);}),[h.refs]),v=i.useMemo((()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d})),[h.refs,g,p]),b=i.useMemo((()=>({...h.elements,domReference:u})),[h.elements,u]),y=i.useMemo((()=>({...h,...o,refs:v,elements:b,nodeId:t})),[h,v,b,t,o]);return on((()=>{o.dataRef.current.floatingContext=y;const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===t));e&&(e.context=y);})),i.useMemo((()=>({...h,context:y,refs:v,elements:b})),[h,v,b,y])}const ni="active",ii="selected";function oi(e,t,n){const i=new Map,o="item"===n;let r=e;if(o&&e){const{[ni]:t,[ii]:n,...i}=e;r=i;}return {..."floating"===n&&{tabIndex:-1,[jn]:""},...r,...t.map((t=>{const i=t?t[n]:null;return "function"==typeof i?e?i(e):null:i})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,r]=t;var a;o&&[ni,ii].includes(n)||(0===n.indexOf("on")?(i.has(n)||i.set(n,[]),"function"==typeof r&&(null==(a=i.get(n))||a.push(r),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return null==(e=i.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=r);})),e):e),{})}}let ri=!1;function ai(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function si(e,t){return ai(t,e===Vt||e===Ut,e===Jt||e===Wt)}function ci(e,t,n){return ai(t,e===Ut,n?e===Jt:e===Wt)||"Enter"===e||" "===e||""===e}function li(e,t,n){return ai(t,n?e===Wt:e===Jt,e===Vt)}function ui(e,t){const{open:n,onOpenChange:o,elements:r}=e,{listRef:a,activeIndex:s,onNavigate:c=()=>{},enabled:l=!0,selectedIndex:u=null,allowEscape:d=!1,loop:f=!1,nested:h=!1,rtl:m=!1,virtual:p=!1,focusItemOnOpen:g="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:b=!0,disabledIndices:y,orientation:w="vertical",cols:k=1,scrollItemIntoView:S=!0,virtualItemRef:N,itemSizes:C,dense:x=!1}=t;const I=Cn(Vn(r.floating)),E=yn(),A=wn(),B=jt(c),T=i.useRef(g),P=i.useRef(null!=u?u:-1),R=i.useRef(null),L=i.useRef(!0),O=i.useRef(B),F=i.useRef(!!r.floating),D=i.useRef(n),M=i.useRef(!1),z=i.useRef(!1),_=Cn(y),H=Cn(n),$=Cn(S),j=Cn(u),[V,U]=i.useState(),[J,W]=i.useState(),q=jt((function(e,t,n){function i(e){p?(U(e.id),null==A||A.events.emit("virtualfocus",e),N&&(N.current=e)):nn(e,{preventScroll:!0,sync:!(!ge().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!we())&&(ri||M.current)});}void 0===n&&(n=!1);const o=e.current[t.current];o&&i(o),requestAnimationFrame((()=>{const r=e.current[t.current]||o;if(!r)return;o||i(r);const a=$.current;a&&G&&(n||!L.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof a?{block:"nearest",inline:"nearest"}:a));}));}));on((()=>{document.createElement("div").focus({get preventScroll(){return ri=!0,!1}});}),[]),on((()=>{l&&(n&&r.floating?T.current&&null!=u&&(z.current=!0,P.current=u,B(u)):F.current&&(P.current=-1,O.current(null)));}),[l,n,r.floating,u,B]),on((()=>{if(l&&n&&r.floating)if(null==s){if(M.current=!1,null!=j.current)return;if(F.current&&(P.current=-1,q(a,P)),(!D.current||!F.current)&&T.current&&(null!=R.current||!0===T.current&&null==R.current)){let e=0;const t=()=>{if(null==a.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t);}e++;}else P.current=null==R.current||ci(R.current,w,m)||h?Gt(a,_.current):Yt(a,_.current),R.current=null,B(P.current);};t();}}else Kt(a,s)||(P.current=s,q(a,P,z.current),z.current=!1);}),[l,n,r.floating,s,j,h,a,w,m,B,q,_]),on((()=>{var e;if(!l||r.floating||!A||p||!F.current)return;const t=A.nodesRef.current,n=null==(e=t.find((e=>e.id===E)))||null==(e=e.context)?void 0:e.elements.floating,i=me(Ne(r.floating)),o=t.some((e=>e.context&&pe(e.context.elements.floating,i)));n&&!o&&L.current&&n.focus({preventScroll:!0});}),[l,r.floating,A,E,p]),on((()=>{if(l&&A&&p&&!E)return A.events.on("virtualfocus",e),()=>{A.events.off("virtualfocus",e);};function e(e){W(e.id),N&&(N.current=e);}}),[l,A,p,E,N]),on((()=>{O.current=B,F.current=!!r.floating;})),on((()=>{n||(R.current=null);}),[n]),on((()=>{D.current=n;}),[n]);const K=null!=s,G=i.useMemo((()=>{function e(e){if(!n)return;const t=a.current.indexOf(e);-1!==t&&B(t);}return {onFocus(t){let{currentTarget:n}=t;e(n);},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...v&&{onMouseMove(t){let{currentTarget:n}=t;e(n);},onPointerLeave(e){let{pointerType:t}=e;L.current&&"touch"!==t&&(P.current=-1,q(a,P),B(null),p||nn(I.current,{preventScroll:!0}));}}}}),[n,I,q,v,a,B,p]),Y=jt((e=>{if(L.current=!1,M.current=!0,229===e.which)return;if(!H.current&&e.currentTarget===I.current)return;if(h&&li(e.key,w,m))return Ee(e),o(!1,e.nativeEvent,"list-navigation"),void(ee(r.domReference)&&!p&&r.domReference.focus());const t=P.current,i=Gt(a,y),s=Yt(a,y);if("Home"===e.key&&(Ee(e),P.current=i,B(P.current)),"End"===e.key&&(Ee(e),P.current=s,B(P.current)),k>1){const t=C||Array.from({length:a.current.length},(()=>({width:1,height:1}))),n=function(e,t,n){const i=[];let o=0;return e.forEach(((e,r)=>{let{width:a,height:s}=e;if(a>t&&"production"!=="production")throw new Error("[Floating UI]: Invalid grid - item width at index "+r+" is greater than grid columns");let c=!1;for(n&&(o=0);!c;){const e=[];for(let n=0;n<a;n++)for(let i=0;i<s;i++)e.push(o+n+i*t);o%t+a<=t&&e.every((e=>null==i[e]))?(e.forEach((e=>{i[e]=r;})),c=!0):o++;}})),[...i]}(t,k,x),o=n.findIndex((e=>null!=e&&!en(a.current,e,y))),r=n.reduce(((e,t,n)=>null==t||en(a.current,t,y)?e:n),-1),c=n[function(e,t){let{event:n,orientation:i,loop:o,cols:r,disabledIndices:a,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}=t,d=l;if(n.key===Vt){if(u&&Ee(n),-1===l)d=c;else if(d=Qt(e,{startingIndex:d,amount:r,decrement:!0,disabledIndices:a}),o&&(l-r<s||d<0)){const e=l%r,t=c%r,n=c-(t-e);d=t===e?c:t>e?n:n-r;}Kt(e,d)&&(d=l);}if(n.key===Ut&&(u&&Ee(n),-1===l?d=s:(d=Qt(e,{startingIndex:l,amount:r,disabledIndices:a}),o&&l+r>c&&(d=Qt(e,{startingIndex:l%r-r,amount:r,disabledIndices:a}))),Kt(e,d)&&(d=l)),"both"===i){const t=Re(l/r);n.key===Wt&&(u&&Ee(n),l%r!=r-1?(d=Qt(e,{startingIndex:l,disabledIndices:a}),o&&qt(d,r,t)&&(d=Qt(e,{startingIndex:l-l%r-1,disabledIndices:a}))):o&&(d=Qt(e,{startingIndex:l-l%r-1,disabledIndices:a})),qt(d,r,t)&&(d=l)),n.key===Jt&&(u&&Ee(n),l%r!=0?(d=Qt(e,{startingIndex:l,decrement:!0,disabledIndices:a}),o&&qt(d,r,t)&&(d=Qt(e,{startingIndex:l+(r-l%r),decrement:!0,disabledIndices:a}))):o&&(d=Qt(e,{startingIndex:l+(r-l%r),decrement:!0,disabledIndices:a})),qt(d,r,t)&&(d=l));const i=Re(c/r)===t;Kt(e,d)&&(d=o&&i?n.key===Jt?c:Qt(e,{startingIndex:l-l%r-1,disabledIndices:a}):l);}return d}({current:n.map((e=>null!=e?a.current[e]:null))},{event:e,orientation:w,loop:f,cols:k,disabledIndices:Zt([...y||a.current.map(((e,t)=>en(a.current,t)?t:void 0)),void 0],n),minIndex:o,maxIndex:r,prevIndex:Xt(P.current>s?i:P.current,t,n,k,e.key===Ut?"bl":e.key===Wt?"tr":"tl"),stopEvent:!0})];if(null!=c&&(P.current=c,B(P.current)),"both"===w)return}if(si(e.key,w)){if(Ee(e),n&&!p&&me(e.currentTarget.ownerDocument)===e.currentTarget)return P.current=ci(e.key,w,m)?i:s,void B(P.current);ci(e.key,w,m)?P.current=f?t>=s?d&&t!==a.current.length?-1:i:Qt(a,{startingIndex:t,disabledIndices:y}):Math.min(s,Qt(a,{startingIndex:t,disabledIndices:y})):P.current=f?t<=i?d&&-1!==t?a.current.length:s:Qt(a,{startingIndex:t,decrement:!0,disabledIndices:y}):Math.max(i,Qt(a,{startingIndex:t,decrement:!0,disabledIndices:y})),Kt(a,P.current)?B(null):B(P.current);}})),Q=i.useMemo((()=>p&&n&&K&&{"aria-activedescendant":J||V}),[p,n,K,J,V]),X=i.useMemo((()=>({"aria-orientation":"both"===w?void 0:w,...!Ae(r.domReference)&&Q,onKeyDown:Y,onPointerMove(){L.current=!0;}})),[Q,Y,r.domReference,w]),Z=i.useMemo((()=>{function e(e){"auto"===g&&be(e.nativeEvent)&&(T.current=!0);}return {...Q,onKeyDown(e){L.current=!1;const t=e.key.startsWith("Arrow"),i=["Home","End"].includes(e.key),r=t||i,s=function(e,t,n){return ai(t,n?e===Jt:e===Wt,e===Ut)}(e.key,w,m),c=li(e.key,w,m),l=si(e.key,w),d=(h?s:l)||"Enter"===e.key||""===e.key.trim();if(p&&n){const t=null==A?void 0:A.nodesRef.current.find((e=>null==e.parentId)),n=A&&t?function(e,t){let n,i=-1;return function t(o,r){r>i&&(n=o,i=r),En(e,o).forEach((e=>{t(e.id,r+1);}));}(t,0),e.find((e=>e.id===n))}(A.nodesRef.current,t.id):null;if(r&&n&&N){const t=new KeyboardEvent("keydown",{key:e.key,bubbles:!0});if(s||c){var f,g;const i=(null==(f=n.context)?void 0:f.elements.domReference)===e.currentTarget,o=c&&!i?null==(g=n.context)?void 0:g.elements.domReference:s?a.current.find((e=>(null==e?void 0:e.id)===V)):null;o&&(Ee(e),o.dispatchEvent(t),W(void 0));}var v;if((l||i)&&n.context)if(n.context.open&&n.parentId&&e.currentTarget!==n.context.elements.domReference)return Ee(e),void(null==(v=n.context.elements.domReference)||v.dispatchEvent(t))}return Y(e)}(n||b||!t)&&(d&&(R.current=h&&l?null:e.key),h?s&&(Ee(e),n?(P.current=Gt(a,_.current),B(P.current)):o(!0,e.nativeEvent,"list-navigation")):l&&(null!=u&&(P.current=u),Ee(e),!n&&b?o(!0,e.nativeEvent,"list-navigation"):Y(e),n&&B(P.current)));},onFocus(){n&&!p&&B(null);},onPointerDown:function(e){T.current=g,"auto"===g&&ye(e.nativeEvent)&&(T.current=!0);},onMouseDown:e,onClick:e}}),[V,Q,Y,_,g,a,h,B,o,n,b,w,m,u,A,p,N]);return i.useMemo((()=>l?{reference:Z,floating:X,item:G}:{}),[l,Z,X,G])}const di=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function fi(e,t){const[n,i]=e;let o=!1;const r=t.length;for(let e=0,a=r-1;e<r;a=e++){const[r,s]=t[e]||[0,0],[c,l]=t[a]||[0,0];s>=i!=l>=i&&n<=(c-r)*(i-s)/(l-s)+r&&(o=!o);}return o}function hi(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:i=!0}=e;let o,r=!1,a=null,s=null,c=performance.now();const l=e=>{let{x:n,y:l,placement:u,elements:d,onClose:f,nodeId:h,tree:m}=e;return function(e){function p(){clearTimeout(o),f();}if(clearTimeout(o),!d.domReference||!d.floating||null==u||null==n||null==l)return;const{clientX:g,clientY:v}=e,b=[g,v],y=xe(e),w="mouseleave"===e.type,k=pe(d.floating,y),S=pe(d.domReference,y),N=d.domReference.getBoundingClientRect(),C=d.floating.getBoundingClientRect(),x=u.split("-")[0],I=n>C.right-C.width/2,E=l>C.bottom-C.height/2,A=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(b,N),B=C.width>N.width,T=C.height>N.height,P=(B?N:C).left,R=(B?N:C).right,L=(T?N:C).top,O=(T?N:C).bottom;if(k&&(r=!0,!w))return;if(S&&(r=!1),S&&!w)return void(r=!0);if(w&&Z(e.relatedTarget)&&pe(d.floating,e.relatedTarget))return;if(m&&En(m.nodesRef.current,h).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===x&&l>=N.bottom-1||"bottom"===x&&l<=N.top+1||"left"===x&&n>=N.right-1||"right"===x&&n<=N.left+1)return p();let F=[];switch(x){case"top":F=[[P,N.top+1],[P,C.bottom-1],[R,C.bottom-1],[R,N.top+1]];break;case"bottom":F=[[P,C.top+1],[P,N.bottom-1],[R,N.bottom-1],[R,C.top+1]];break;case"left":F=[[C.right-1,O],[C.right-1,L],[N.left+1,L],[N.left+1,O]];break;case"right":F=[[N.right-1,O],[N.right-1,L],[C.left+1,L],[C.left+1,O]];}if(!fi([g,v],F)){if(r&&!A)return p();if(!w&&i){const t=function(e,t){const n=performance.now(),i=n-c;if(null===a||null===s||0===i)return a=e,s=t,c=n,null;const o=e-a,r=t-s,l=Math.sqrt(o*o+r*r);return a=e,s=t,c=n,l/i}(e.clientX,e.clientY);if(null!==t&&t<.1)return p()}fi([g,v],function(e){let[n,i]=e;switch(x){case"top":return [[B?n+t/2:I?n+4*t:n-4*t,i+t+1],[B?n-t/2:I?n+4*t:n-4*t,i+t+1],...[[C.left,I||B?C.bottom-t:C.top],[C.right,I?B?C.bottom-t:C.top:C.bottom-t]]];case"bottom":return [[B?n+t/2:I?n+4*t:n-4*t,i-t],[B?n-t/2:I?n+4*t:n-4*t,i-t],...[[C.left,I||B?C.top+t:C.bottom],[C.right,I?B?C.top+t:C.bottom:C.top+t]]];case"left":{const e=[n+t+1,T?i+t/2:E?i+4*t:i-4*t],o=[n+t+1,T?i-t/2:E?i+4*t:i-4*t];return [...[[E||T?C.right-t:C.left,C.top],[E?T?C.right-t:C.left:C.right-t,C.bottom]],e,o]}case"right":return [[n-t,T?i+t/2:E?i+4*t:i-4*t],[n-t,T?i-t/2:E?i+4*t:i-4*t],...[[E||T?C.left+t:C.right,C.top],[E?T?C.left+t:C.right:C.left+t,C.bottom]]]}}([n,l]))?!r&&i&&(o=window.setTimeout(p,40)):p();}}};return l.__options={blockPointerEvents:n},l}const mi=createContext({getItemProps:()=>({}),activeIndex:null,setActiveIndex:()=>{},setHasFocusInside:()=>{},isOpen:!1}),pi=forwardRef((({className:t,disabled:n,children:i,...o},r)=>{const a=useContext(mi),c=cn(),l=wn(),u=c.index===a.activeIndex,d=w("io-dropdown-menu-item",n&&"io-dropdown-menu-item-disabled",t);return jsxRuntimeExports.jsx("div",{ref:_t([c.ref,r]),role:"menuitem",className:d,tabIndex:u?0:-1,...a.getItemProps({onClick(e){o.onClick?.(e),l?.events.emit("click");},onFocus(e){o.onFocus?.(e),a.setHasFocusInside(!0);}}),...o,children:i})}));pi.displayName="DropdownMenuItem";const gi=forwardRef((({className:n,variant:o="default",icon:r,iconRight:a,text:f="",disabled:h,children:m,...p},g)=>{const[v,b]=useState(!1),[y,k]=useState(!1),[S,N]=useState(null),C=useRef([]),x=useRef([]),I=useContext(mi),E=wn(),B=function(e){const t=hn(),n=wn(),i=yn(),o=i;return on((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e);}}),[n,t,o]),t}(),T=yn(),P=cn(),R=null!=T,{floatingStyles:L,refs:O,context:F}=ti({nodeId:B,open:v,onOpenChange:b,placement:R?"right-start":"bottom-start",middleware:[(D={mainAxis:R?0:4,alignmentAxis:R?-4:0},{...At(D),options:[D,M]}),zt(),Mt()],whileElementsMounted:Et});var D,M;const z=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:o,dataRef:r,events:a,elements:s}=e,{enabled:c=!0,delay:l=0,handleClose:u=null,mouseOnly:d=!1,restMs:f=0,move:h=!0}=t,m=wn(),p=yn(),g=Cn(u),v=Cn(l),b=Cn(n),y=i.useRef(),w=i.useRef(-1),k=i.useRef(),S=i.useRef(-1),N=i.useRef(!0),C=i.useRef(!1),x=i.useRef((()=>{})),I=i.useRef(!1),E=i.useCallback((()=>{var e;const t=null==(e=r.current.openEvent)?void 0:e.type;return (null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[r]);i.useEffect((()=>{if(c)return a.on("openchange",e),()=>{a.off("openchange",e);};function e(e){let{open:t}=e;t||(clearTimeout(w.current),clearTimeout(S.current),N.current=!0,I.current=!1);}}),[c,a]),i.useEffect((()=>{if(!c)return;if(!g.current)return;if(!n)return;function e(e){E()&&o(!1,e,"hover");}const t=Ne(s.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e);}}),[s.floating,n,o,c,g,E]);const A=i.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const i=In(v.current,"close",y.current);i&&!k.current?(clearTimeout(w.current),w.current=window.setTimeout((()=>o(!1,e,n)),i)):t&&(clearTimeout(w.current),o(!1,e,n));}),[v,o]),B=jt((()=>{x.current(),k.current=void 0;})),T=jt((()=>{if(C.current){const e=Ne(s.floating).body;e.style.pointerEvents="",e.removeAttribute(xn),C.current=!1;}}));i.useEffect((()=>{if(c&&Z(s.domReference)){var e;const t=s.domReference;return n&&t.addEventListener("mouseleave",l),null==(e=s.floating)||e.addEventListener("mouseleave",l),h&&t.addEventListener("mousemove",i,{once:!0}),t.addEventListener("mouseenter",i),t.addEventListener("mouseleave",a),()=>{var e;n&&t.removeEventListener("mouseleave",l),null==(e=s.floating)||e.removeEventListener("mouseleave",l),h&&t.removeEventListener("mousemove",i),t.removeEventListener("mouseenter",i),t.removeEventListener("mouseleave",a);}}function t(){return !!r.current.openEvent&&["click","mousedown"].includes(r.current.openEvent.type)}function i(e){if(clearTimeout(w.current),N.current=!1,d&&!Se(y.current)||f>0&&!In(v.current,"open"))return;const t=In(v.current,"open",y.current);t?w.current=window.setTimeout((()=>{b.current||o(!0,e,"hover");}),t):o(!0,e,"hover");}function a(e){if(t())return;x.current();const i=Ne(s.floating);if(clearTimeout(S.current),I.current=!1,g.current&&r.current.floatingContext){n||clearTimeout(w.current),k.current=g.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){T(),B(),A(e,!0,"safe-polygon");}});const t=k.current;return i.addEventListener("mousemove",t),void(x.current=()=>{i.removeEventListener("mousemove",t);})}("touch"!==y.current||!pe(s.floating,e.relatedTarget))&&A(e);}function l(e){t()||r.current.floatingContext&&(null==g.current||g.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){T(),B(),A(e);}})(e));}}),[s,c,e,d,f,h,A,B,T,o,n,b,m,v,g,r]),on((()=>{var e;if(c&&n&&null!=(e=g.current)&&e.__options.blockPointerEvents&&E()){C.current=!0;const e=s.floating;if(Z(s.domReference)&&e){var t;const n=Ne(s.floating).body;n.setAttribute(xn,"");const i=s.domReference,o=null==m||null==(t=m.nodesRef.current.find((e=>e.id===p)))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",i.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",i.style.pointerEvents="",e.style.pointerEvents="";}}}}),[c,n,p,s,m,g,E]),on((()=>{n||(y.current=void 0,I.current=!1,B(),T());}),[n,B,T]),i.useEffect((()=>()=>{B(),clearTimeout(w.current),clearTimeout(S.current),T();}),[c,s.domReference,B,T]);const P=i.useMemo((()=>{function e(e){y.current=e.pointerType;}return {onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function i(){N.current||b.current||o(!0,t,"hover");}d&&!Se(y.current)||n||0===f||I.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(S.current),"touch"===y.current?i():(I.current=!0,S.current=window.setTimeout(i,f)));}}}),[d,o,n,b,f]),R=i.useMemo((()=>({onMouseEnter(){clearTimeout(w.current);},onMouseLeave(e){A(e.nativeEvent,!1);}})),[A]);return i.useMemo((()=>c?{reference:P,floating:R}:{}),[c,P,R])}(F,{enabled:R,delay:{open:75},handleClose:hi({blockPointerEvents:!0})}),_=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:o,dataRef:r,elements:{domReference:a}}=e,{enabled:s=!0,event:c="click",toggle:l=!0,ignoreMouse:u=!1,keyboardHandlers:d=!0}=t,f=i.useRef(),h=i.useRef(!1),m=i.useMemo((()=>({onPointerDown(e){f.current=e.pointerType;},onMouseDown(e){const t=f.current;0===e.button&&"click"!==c&&(Se(t,!0)&&u||(!n||!l||r.current.openEvent&&"mousedown"!==r.current.openEvent.type?(e.preventDefault(),o(!0,e.nativeEvent,"click")):o(!1,e.nativeEvent,"click")));},onClick(e){const t=f.current;"mousedown"===c&&f.current?f.current=void 0:Se(t,!0)&&u||(!n||!l||r.current.openEvent&&"click"!==r.current.openEvent.type?o(!0,e.nativeEvent,"click"):o(!1,e.nativeEvent,"click"));},onKeyDown(e){f.current=void 0,e.defaultPrevented||!d||Gn(e)||(" "!==e.key||Yn(a)||(e.preventDefault(),h.current=!0),"Enter"===e.key&&o(!n||!l,e.nativeEvent,"click"));},onKeyUp(e){e.defaultPrevented||!d||Gn(e)||Yn(a)||" "===e.key&&h.current&&(h.current=!1,o(!n||!l,e.nativeEvent,"click"));}})),[r,a,c,u,d,o,n,l]);return i.useMemo((()=>s?{reference:m}:{}),[s,m])}(F,{event:"mousedown",toggle:!R,ignoreMouse:R}),H=function(e,t){var n;void 0===t&&(t={});const{open:o,floatingId:r}=e,{enabled:a=!0,role:s="dialog"}=t,c=null!=(n=di.get(s))?n:s,l=hn(),u=null!=yn(),d=i.useMemo((()=>"tooltip"===c||"label"===s?{["aria-"+("label"===s?"labelledby":"describedby")]:o?r:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===c?"dialog":c,"aria-controls":o?r:void 0,..."listbox"===c&&{role:"combobox"},..."menu"===c&&{id:l},..."menu"===c&&u&&{role:"menuitem"},..."select"===s&&{"aria-autocomplete":"none"},..."combobox"===s&&{"aria-autocomplete":"list"}}),[c,r,u,o,l,s]),f=i.useMemo((()=>{const e={id:r,...c&&{role:c}};return "tooltip"===c||"label"===s?e:{...e,..."menu"===c&&{"aria-labelledby":l}}}),[c,r,l,s]),h=i.useCallback((e=>{let{active:t,selected:n}=e;const i={role:"option",...t&&{id:r+"-option"}};switch(s){case"select":return {...i,"aria-selected":t&&n};case"combobox":return {...i,...t&&{"aria-selected":!0}}}return {}}),[r,s]);return i.useMemo((()=>a?{reference:d,floating:f,item:h}:{}),[a,d,f,h])}(F,{role:"menu"}),$=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:o,elements:r,dataRef:a}=e,{enabled:s=!0,escapeKey:c=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:d=!1,referencePressEvent:f="pointerdown",ancestorScroll:h=!1,bubbles:m,capture:p}=t,g=wn(),v=jt("function"==typeof l?l:()=>!1),b="function"==typeof l?v:l,y=i.useRef(!1),w=i.useRef(!1),{escapeKey:k,outsidePress:S}=Zn(m),{escapeKey:N,outsidePress:C}=Zn(p),x=i.useRef(!1),I=jt((e=>{var t;if(!n||!s||!c||"Escape"!==e.key)return;if(x.current)return;const i=null==(t=a.current.floatingContext)?void 0:t.nodeId,r=g?En(g.nodesRef.current,i):[];if(!k&&(e.stopPropagation(),r.length>0)){let e=!0;if(r.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1);})),!e)return}o(!1,function(e){return "nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key");})),E=jt((e=>{var t;const n=()=>{var t;I(e),null==(t=xe(e))||t.removeEventListener("keydown",n);};null==(t=xe(e))||t.addEventListener("keydown",n);})),A=jt((e=>{var t;const n=y.current;y.current=!1;const i=w.current;if(w.current=!1,"click"===u&&i)return;if(n)return;if("function"==typeof b&&!b(e))return;const s=xe(e),c="["+Nn("inert")+"]",l=Ne(r.floating).querySelectorAll(c);let d=Z(s)?s:null;for(;d&&!se(d);){const e=ue(d);if(se(e)||!Z(e))break;d=e;}if(l.length&&Z(s)&&!s.matches("html,body")&&!pe(s,r.floating)&&Array.from(l).every((e=>!pe(d,e))))return;if(ee(s)&&P){const t=s.clientWidth>0&&s.scrollWidth>s.clientWidth,n=s.clientHeight>0&&s.scrollHeight>s.clientHeight;let i=n&&e.offsetX>s.clientWidth;if(n&&"rtl"===ce(s).direction&&(i=e.offsetX<=s.offsetWidth-s.clientWidth),i||t&&e.offsetY>s.clientHeight)return}const f=null==(t=a.current.floatingContext)?void 0:t.nodeId,h=g&&En(g.nodesRef.current,f).some((t=>{var n;return Ce(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Ce(e,r.floating)||Ce(e,r.domReference)||h)return;const m=g?En(g.nodesRef.current,f):[];if(m.length>0){let e=!0;if(m.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1);})),!e)return}o(!1,e,"outside-press");})),B=jt((e=>{var t;const n=()=>{var t;A(e),null==(t=xe(e))||t.removeEventListener(u,n);};null==(t=xe(e))||t.addEventListener(u,n);}));i.useEffect((()=>{if(!n||!s)return;a.current.__escapeKeyBubbles=k,a.current.__outsidePressBubbles=S;let e=-1;function t(e){o(!1,e,"ancestor-scroll");}function i(){window.clearTimeout(e),x.current=!0;}function l(){e=window.setTimeout((()=>{x.current=!1;}),ae()?5:0);}const d=Ne(r.floating);c&&(d.addEventListener("keydown",N?E:I,N),d.addEventListener("compositionstart",i),d.addEventListener("compositionend",l)),b&&d.addEventListener(u,C?B:A,C);let f=[];return h&&(Z(r.domReference)&&(f=fe(r.domReference)),Z(r.floating)&&(f=f.concat(fe(r.floating))),!Z(r.reference)&&r.reference&&r.reference.contextElement&&(f=f.concat(fe(r.reference.contextElement)))),f=f.filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)})),f.forEach((e=>{e.addEventListener("scroll",t,{passive:!0});})),()=>{c&&(d.removeEventListener("keydown",N?E:I,N),d.removeEventListener("compositionstart",i),d.removeEventListener("compositionend",l)),b&&d.removeEventListener(u,C?B:A,C),f.forEach((e=>{e.removeEventListener("scroll",t);})),window.clearTimeout(e);}}),[a,r,c,b,u,n,o,h,s,k,S,I,N,E,A,C,B]),i.useEffect((()=>{y.current=!1;}),[b,u]);const T=i.useMemo((()=>({onKeyDown:I,[Qn[f]]:e=>{d&&o(!1,e.nativeEvent,"reference-press");}})),[I,o,d,f]),P=i.useMemo((()=>({onKeyDown:I,onMouseDown(){w.current=!0;},onMouseUp(){w.current=!0;},[Xn[u]]:()=>{y.current=!0;}})),[I,u]);return i.useMemo((()=>s?{reference:T,floating:P}:{}),[s,T,P])}(F,{bubbles:!0}),j=ui(F,{listRef:C,activeIndex:S,nested:R,onNavigate:N}),{getReferenceProps:V,getFloatingProps:U,getItemProps:J}=function(e){void 0===e&&(e=[]);const t=e.map((e=>null==e?void 0:e.reference)),n=e.map((e=>null==e?void 0:e.floating)),o=e.map((e=>null==e?void 0:e.item)),r=i.useCallback((t=>oi(t,e,"reference")),t),a=i.useCallback((t=>oi(t,e,"floating")),n),s=i.useCallback((t=>oi(t,e,"item")),o);return i.useMemo((()=>({getReferenceProps:r,getFloatingProps:a,getItemProps:s})),[r,a,s])}([z,_,H,$,j]);useEffect((()=>{if(E)return E.events.on("click",e),E.events.on("menuopen",t),()=>{E.events.off("click",e),E.events.off("menuopen",t);};function e(){b(!1);}function t(e){e.nodeId!==B&&e.parentId===T&&b(!1);}}),[E,B,T]),useEffect((()=>{v&&E&&E.events.emit("menuopen",{parentId:T,nodeId:B});}),[E,v,B,T]);const W={activeIndex:S,setActiveIndex:N,getItemProps:J,setHasFocusInside:k,isOpen:v},q=useMemo((()=>W),[S,N,J,k,v]),K=w("io-dropdown-menu-button",R&&"io-dropdown-menu-item",v&&!R&&"active",n),G=_t([O.setReference,P.ref,g]),Y=I.activeIndex===P.index?0:-1;return jsxRuntimeExports.jsxs(kn,{id:B,children:[jsxRuntimeExports.jsx(A,{className:K,ref:G,variant:R?"link":o,tabIndex:R?Y:void 0,role:R?"menuitem":void 0,"data-open":v?"":void 0,"data-nested":R?"":void 0,"data-focus-inside":y?"":void 0,text:f,icon:R?"chevron-right":r,iconSize:"10",iconRight:!!R||a,disabled:h,...V(I.getItemProps({onFocus(e){p.onFocus?.(e),k(!1),I.setHasFocusInside(!0);},...p}))}),jsxRuntimeExports.jsx(mi.Provider,{value:q,children:jsxRuntimeExports.jsx(sn,{elementsRef:C,labelsRef:x,children:v&&jsxRuntimeExports.jsx(Kn,{context:F,modal:!1,initialFocus:R?-1:0,returnFocus:!R,children:jsxRuntimeExports.jsx("div",{ref:O.setFloating,className:"io-dropdown-menu",style:L,...U(),children:m})})})})]})}));function vi({className:t,...n}){const i=w("io-separator",t);return jsxRuntimeExports.jsx("hr",{className:i,...n})}gi.displayName="DropdownMenu";const bi=forwardRef((({...t},n)=>null===yn()?jsxRuntimeExports.jsx(Sn,{children:jsxRuntimeExports.jsx(gi,{ref:n,...t})}):jsxRuntimeExports.jsx(gi,{ref:n,...t})));function wi({className:n,size:i="large",variant:o="default",align:r="up",text:a,...s}){const c=w("io-loader",{[`io-loader-${o}`]:"default"!==o},"normal"===i&&"io-loader-md","small"===i&&"io-loader-sm",r&&[`direction-${r}`],n);return jsxRuntimeExports.jsxs("div",{className:c,...s,children:[jsxRuntimeExports.jsx("div",{className:"io-loader-icon"}),a&&jsxRuntimeExports.jsx("div",{className:"io-loader-text",children:a})]})}function ki({className:t,children:n,...i}){const o=w("io-panel-header",t);return jsxRuntimeExports.jsx(j,{className:o,...i,children:n})}bi.displayName="DropdownMenu",bi.Item=pi,bi.Separator=vi,ki.Title=I,ki.ButtonGroup=$,ki.Button=A,ki.ButtonIcon=S,ki.Dropdown=H;const Si=forwardRef((({className:t,children:n,...i},o)=>{const r=w("io-panel-body",t);return jsxRuntimeExports.jsx("div",{className:r,ref:o,...i,children:n})}));function Ni({className:t,...n}){const i=w("io-panel-footer",t);return jsxRuntimeExports.jsx(J,{className:i,...n})}function Ci({className:t,children:n,...i}){const o=w("io-panel",t);return jsxRuntimeExports.jsx("div",{className:o,...i,children:n})}function Ei({className:t,variant:n="active",value:i=0,...o}){const r=w("io-progress",n,t);return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsx("div",{className:"io-progress-bar",style:{width:`${i<0?0:i>100?100:i}%`}})})}function Ai({text:t="Label",...n}){return jsxRuntimeExports.jsx("label",{...n,children:t})}Si.displayName="PanelBody",Ni.ButtonGroup=$,Ni.Button=A,Ni.ButtonIcon=S,Ni.Dropdown=H,Ci.Header=ki,Ci.Body=Si,Ci.Footer=Ni;const Bi=forwardRef((({id:n="input",className:i,type:o="text",name:a="input",align:s="up",label:c,iconPrepend:l,iconPrependOnClick:u,iconAppend:d,iconAppendOnClick:f,placeholder:h,disabled:m,readOnly:p,errorMessage:g,...v},b)=>{const y=w("io-control-input",l&&"io-control-leading-icon",d&&"io-control-trailing-icon",m&&"io-control-disabled",p&&"io-control-readonly",g&&"io-control-error",s&&[`direction-${s}`],i),S=useCallback((e=>{m?e.preventDefault():u&&u(e);}),[u,m]),N=useCallback((e=>{m?e.preventDefault():f&&f(e);}),[f,m]);return jsxRuntimeExports.jsxs("div",{className:y,children:[c&&jsxRuntimeExports.jsx(Ai,{htmlFor:n,text:c}),l&&jsxRuntimeExports.jsx(k,{variant:l,onClick:e=>S(e)}),jsxRuntimeExports.jsx("input",{id:n,className:"io-input",ref:b,type:o,name:a,tabIndex:0,placeholder:h??(()=>{switch(o){case"email":return "Enter your email here...";case"number":return "Enter number here...";case"password":return "Enter your password here...";case"tel":return "Enter your phone number here...";case"file":return "Select a file...";default:return "Enter text here..."}})(),disabled:m,readOnly:p,...v}),d&&jsxRuntimeExports.jsx(k,{variant:d,onClick:e=>N(e)}),g&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(k,{variant:"close"}),g]})]})}));Bi.displayName="Input";const Ti=forwardRef((({id:n="textarea",className:i,name:o="textarea",align:r="up",label:a,rows:s=4,placeholder:c="Enter text here...",disabled:l,readOnly:u,...d},f)=>{const h=w("io-control-textarea",l&&"io-control-disabled",u&&"io-control-readonly",r&&[`direction-${r}`],i);return jsxRuntimeExports.jsxs("div",{className:h,children:[a&&jsxRuntimeExports.jsx(Ai,{htmlFor:n,text:a}),jsxRuntimeExports.jsx("textarea",{id:n,className:"io-textarea",ref:f,name:o,tabIndex:0,placeholder:c,disabled:l,readOnly:u,rows:s,...d})]})}));Ti.displayName="Textarea";const Pi=forwardRef((({id:n="checkbox",className:i,name:o="checkbox",align:r="left",label:a,checked:s,disabled:c,...l},u)=>{const d=w("io-control-checkbox",s&&"io-control-checked",c&&"io-control-disabled",r&&[`direction-${r}`],i);return jsxRuntimeExports.jsxs("div",{className:d,children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:n,className:"io-checkbox",ref:u,name:o,tabIndex:0,checked:s,disabled:c,...l}),a&&jsxRuntimeExports.jsx(Ai,{htmlFor:n,text:a})]})}));Pi.displayName="Checkbox";const Ri=forwardRef((({id:n="radio",className:i,name:o="radio",align:r="left",label:a,checked:s,disabled:c,...l},u)=>{const d=w("io-control-radio",s&&"io-control-checked",c&&"io-control-disabled",r&&[`direction-${r}`],i);return jsxRuntimeExports.jsxs("div",{className:d,children:[jsxRuntimeExports.jsx("input",{type:"radio",id:n,className:"io-radio",ref:u,name:o,tabIndex:0,checked:s,disabled:c,...l}),a&&jsxRuntimeExports.jsx(Ai,{htmlFor:n,text:a})]})}));Ri.displayName="Radio";const Li=forwardRef((({id:n="toggle",className:i,name:o="toggle",align:r="left",label:a="Toggle",checked:s,disabled:c,...l},u)=>{const d=w("io-control-toggle",s&&"io-control-checked",c&&"io-control-disabled",r&&[`direction-${r}`],i);return jsxRuntimeExports.jsx("div",{className:d,children:jsxRuntimeExports.jsxs("label",{className:"io-toggle",children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:n,className:"io-checkbox",ref:u,name:o,checked:s,disabled:c,...l}),jsxRuntimeExports.jsx("span",{className:"slider"}),a]})})}));function Fi(e,t){const n=useCallback((n=>{t.some((e=>n.key===e))&&(n.preventDefault(),e());}),[e,t]);useEffect((()=>(document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n);})),[n]);}Li.displayName="Toggle";const Di=e=>"string"==typeof e?e:e?.message?"string"==typeof e.message?e.message:JSON.stringify(e.message):JSON.stringify(e);function Mi({app:e,prefKey:t,decoder:n}){const i=useContext(IOConnectContext),[o,a]=useState(),[l,f]=useState(!0),[h,m]=useState(),p=useRef(0),v=useCallback((e=>{if(null==e)return;return n.runWithException(e)}),[n]),b=useCallback((async()=>{if(!i)return;const n=await i.prefs.get(e);try{return v(n?.data[t])}catch(e){throw new Error(`The stored value for prefKey "${t}" is of an incorrect shape: ${Di(e)}`)}}),[e,i,t,v]),y=useCallback((async n=>{if(!i)return;const o=++p.current;f(!0),m(void 0);const r=e=>{o===p.current&&(f(!1),e&&(console.error(e),m({message:Di(e)})));};let a,s;if(n instanceof Function)try{a=n(await b());}catch(e){return r(e)}else a=n;try{s=v(a);}catch(e){return r(`The provided value for prefKey "${t}" is of an incorrect shape: ${Di(e)}`)}try{await i.prefs.updateFor(e,{[t]:s});}catch(e){return r(e)}r();}),[e,b,i,t,v]);return useEffect((()=>{if(!i)return;let n=!0;const o=i.prefs.subscribeFor(e,(e=>{try{const n=v(e.data[t]);a(n),m(void 0);}catch(e){const n=`The stored value for prefKey "${t}" is of an incorrect shape: ${Di(e)}`;console.error(n),m({message:n});}n&&(n=!1,f(!1));}));return o}),[e,t,i,v]),{error:h,isLoading:l,value:o,update:y}}function Hi(e,t=500){const[n,i]=useState(e);return useEffect((()=>{const n=setTimeout((()=>{i(e);}),t);return ()=>clearTimeout(n)}),[e,t]),n}createContext({theme:"dark"});function Wi(e,t,n){return Math.min(Math.max(e,n),t)}class qi extends Error{constructor(e){super(`Failed to parse color: "${e}"`);}}var Ki=qi;function Gi(e){if("string"!=typeof e)throw new Ki(e);if("transparent"===e.trim().toLowerCase())return [0,0,0,0];let t=e.trim();t=io.test(e)?function(e){const t=e.toLowerCase().trim(),n=Qi[function(e){let t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return (t>>>0)%2341}(t)];if(!n)throw new Ki(e);return `#${n}`}(e):e;const n=Zi.exec(t);if(n){const e=Array.from(n).slice(1);return [...e.slice(0,3).map((e=>parseInt(Xi(e,2),16))),parseInt(Xi(e[3]||"f",2),16)/255]}const i=eo.exec(t);if(i){const e=Array.from(i).slice(1);return [...e.slice(0,3).map((e=>parseInt(e,16))),parseInt(e[3]||"ff",16)/255]}const o=to.exec(t);if(o){const e=Array.from(o).slice(1);return [...e.slice(0,3).map((e=>parseInt(e,10))),parseFloat(e[3]||"1")]}const r=no.exec(t);if(r){const[t,n,i,o]=Array.from(r).slice(1).map(parseFloat);if(Wi(0,100,n)!==n)throw new Ki(e);if(Wi(0,100,i)!==i)throw new Ki(e);return [...ro(t,n,i),Number.isNaN(o)?1:o]}throw new Ki(e)}const Yi=e=>parseInt(e.replace(/_/g,""),36),Qi="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce(((e,t)=>{const n=Yi(t.substring(0,3)),i=Yi(t.substring(3)).toString(16);let o="";for(let e=0;e<6-i.length;e++)o+="0";return e[n]=`${o}${i}`,e}),{});const Xi=(e,t)=>Array.from(Array(t)).map((()=>e)).join(""),Zi=new RegExp(`^#${Xi("([a-f0-9])",3)}([a-f0-9])?$`,"i"),eo=new RegExp(`^#${Xi("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),to=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Xi(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),no=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,io=/^[a-z]+$/i,oo=e=>Math.round(255*e),ro=(e,t,n)=>{let i=n/100;if(0===t)return [i,i,i].map(oo);const o=(e%360+360)%360/60,r=(1-Math.abs(2*i-1))*(t/100),a=r*(1-Math.abs(o%2-1));let s=0,c=0,l=0;o>=0&&o<1?(s=r,c=a):o>=1&&o<2?(s=a,c=r):o>=2&&o<3?(c=r,l=a):o>=3&&o<4?(c=a,l=r):o>=4&&o<5?(s=a,l=r):o>=5&&o<6&&(s=r,l=a);const u=i-r/2;return [s+u,c+u,l+u].map(oo)};function ao(e){return function(e){if("transparent"===e)return 0;function t(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}const[n,i,o]=Gi(e);return .2126*t(n)+.7152*t(i)+.0722*t(o)}(e)>.179}function so({className:t,channel:n,...i}){const o=w("io-channel-badge",t);return jsxRuntimeExports.jsx("div",{className:o,style:{color:(r=n.color,ao(r)?"#000":"#fff"),backgroundColor:n.color},...i,children:jsxRuntimeExports.jsx("span",{className:"io-channel-badge-label",children:n.label})});var r;}function co(){return jsxRuntimeExports.jsx(k,{variant:"check"})}function lo({channel:i,handleChannelRestricted:o,restricted:r}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{children:i.isSelected&&jsxRuntimeExports.jsx("span",{children:"Active"})}),jsxRuntimeExports.jsx("div",{role:"button",onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||e.stopPropagation();},tabIndex:0,children:jsxRuntimeExports.jsx(Li,{label:"Publish",checked:i.write,onChange:()=>{o({...i,write:!i.write});},disabled:r?.write})}),jsxRuntimeExports.jsx("div",{role:"button",onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||e.stopPropagation();},tabIndex:0,children:jsxRuntimeExports.jsx(Li,{label:"Subscribe",checked:i.read,onChange:()=>{o({...i,read:!i.read});},disabled:r?.read})})]})}const uo=createContext({});function fo({channel:t,isSelected:n,onChannelSelect:i,onChannelRestrict:o,...a}){const{variant:c,selectedChannels:l,restrictedChannels:u}=useContext(uo),d=n||t.isSelected||l?.includes(t),f=u?.find((e=>e.name===t.name)),h=useCallback((()=>i?.({...t,isSelected:!d})),[t,i,d]),m=useCallback((e=>{o&&o(e);}),[o]);return jsxRuntimeExports.jsx(R,{prepend:jsxRuntimeExports.jsx(so,{channel:t}),append:"single"===c||"multi"===c?d&&jsxRuntimeExports.jsx(co,{}):jsxRuntimeExports.jsx(lo,{channel:t,handleChannelRestricted:m,restricted:f}),isSelected:d,onClick:h,...a,children:t.name},t.name)}const ho=forwardRef((({className:n,variant:i="single",variantToggle:o=!1,channels:r=[],restrictedChannels:a=[],onVariantChange:s,onChannelSelect:c,onChannelRestrict:u,...d},f)=>{const h=w("io-list-channels","directionalSingle"===i&&"io-bi-direction",n),m=r.filter((e=>e.isSelected)),p=useMemo((()=>({variant:i,selectedChannels:m,restrictedChannels:a,onVariantChange:s,onChannelSelect:c,onChannelRestrict:u})),[i,m,a,s,c,u]);let g="Select Channel";return "multi"===i?g="Select Channels":"directionalSingle"===i&&(g="Select Directional Channel"),jsxRuntimeExports.jsx(uo.Provider,{value:p,children:jsxRuntimeExports.jsx("div",{className:h,ref:f,children:jsxRuntimeExports.jsxs(z,{variant:"single",...d,children:[jsxRuntimeExports.jsx(z.ItemTitle,{append:o&&jsxRuntimeExports.jsx(Li,{label:"Directional",align:"right",onChange:e=>s&&s(e.target.checked),checked:"directionalSingle"===i}),children:g}),r?.map((t=>jsxRuntimeExports.jsx(fo,{channel:t,onChannelSelect:c,onChannelRestrict:u},t.name)))]})})})}));ho.displayName="ChannelSelector";var mo=Object.freeze({__proto__:null,Channel:fo,ChannelBadge:so,ChannelDirectionalAppend:lo,ChannelSelector:ho,ChannelSingleAppend:co,useIOCDChannels:function(e){const t="T42.ChannelSelector.Execute",n=useContext(IOConnectContext),[i,o]=useState(null),[a,l]=useState([]),[h,m]=useState(""),[p,v]=useState(!1),[b,y]=useState(),[w,k]=useState("single"),S=useRef(),N=n?.windows.my(),C=useCallback((async e=>{const t=n.windows.findById(e),i=await(t?.application?.getConfiguration());return t&&i?i.details?.channelSelector?.preventModifyingRestrictionsFor??[]:[]}),[n.windows]),x=useCallback(((e,t,i)=>{if("will-show"===e.command){const t=async()=>{S.current=i,v(!0);const{windowId:t,channels:r,variant:a}=e,s="function"==typeof n.channels.getRestrictions?await n.channels.getRestrictions(t):{channels:[]},c=r.map((e=>{const t=((e,t)=>e.channels.find((e=>e.name===t.name)))(s,e);return t?{...e,read:t.read??!0,write:t.write??!0}:{...e,read:!0,write:!0}}));let u=c.find((e=>e.isSelected))?.name;if(!u){const e=n?.windows.findById(t);u=await(e?.getChannel());}const d=await C(t);l(d),k(a),m(t),o(((e,t)=>{const n=Array.from({length:e.length},((e,t)=>String.fromCharCode(t+65)));return e.map(((e,i)=>{const o=e.meta;return {key:e.name,color:o.color,name:e.name,isSelected:e.isSelected??e.name===t,label:o?.label??n[i],write:e.write,read:e.read}}))})(c,u)),v(!1);};t().catch((e=>{y(e),v(!1);}));}}),[n?.windows,n?.channels,C]),I=useCallback((({name:e,read:t,write:r,isSelected:a})=>{const s=()=>{if("directionalSingle"!==w)return N?.hide()};o((n=>n?n?.map((n=>n.name===e?{...n,isSelected:a,read:t,write:r}:{...n,isSelected:!1})):n));let c=!0;const l=i?.find((e=>e.isSelected))?.name;"single"===w||"directionalSingle"===w?c=l===e:"multi"===w&&(c=i?.find((t=>t.name===e))?.isSelected??!1),c?(n?.channels.leave)(h,e).finally((()=>{s()?.catch(console.error);})):n?.channels.join(e,h).finally((()=>{s()?.catch(console.error);}));}),[n?.channels,i,w,N,h]),E=useCallback((({name:e,read:t,write:i})=>{const o=n?.channels;"directionalSingle"===w&&"function"==typeof o?.restrict&&o?.restrict({name:e,read:t,write:i,windowId:h}).catch(console.error);}),[n?.channels,w,h]),A=useCallback((e=>{o((t=>t?t.map((t=>{const n=((e,t)=>e.channels.find((e=>e.name===t.name)))(e,t);return n?{...t,read:n.read,write:n.write}:t})):t));}),[]);return Fi((()=>{N?.hide().catch(console.error);}),["Escape"]),useEffect((()=>{const e=N?.onClosing((async e=>(e({showDialog:!1}),Promise.resolve())));return e}),[N]),useEffect((()=>{const e=n.windows.findById(h);if(!e)return;if("function"!=typeof e?.onChannelRestrictionsChanged)return;return e.onChannelRestrictionsChanged(A)}),[n.windows,h,A]),useEffect((()=>((async()=>{await(n?.interop.registerAsync(t,x));})(),()=>{n?.interop.unregister(t);})),[n?.interop,x]),useLayoutEffect((()=>{if(e?.current&&i&&i.length>0){const{height:t,width:n,x:i,y:o}=e.current.getBoundingClientRect();S.current&&t>0&&S.current({height:t,width:n,x:i,y:o});}}),[i,e]),{onChannelSelected:I,onChannelRestricted:E,variant:w,isLoading:p,channels:i,restrictedChannels:a,error:b,windowId:h}}});createContext({config:{message:""},theme:"dark",setResult:()=>{}});function Io({title:n="Downloads"}){const{ItemSearch:i,HeaderButtons:o}=Qo();return jsxRuntimeExports.jsxs("div",{className:"io-dm-header",children:[jsxRuntimeExports.jsxs(j,{children:[jsxRuntimeExports.jsx(j.Title,{tag:"h1",text:n,size:"large"}),jsxRuntimeExports.jsx(o,{})]}),jsxRuntimeExports.jsx(i,{})]})}const Ao=createContext({configuration:{},items:[],removeItem:()=>{},pauseResumeItem:()=>{},cancelItem:()=>{},clearItems:()=>{},showItemInFolder:()=>{},isSettingsVisible:!1,showSettings:()=>{},hideSettings:()=>{},isSearchVisible:!1,showSearch:()=>{},hideSearch:()=>{},searchQuery:"",setSearch:()=>{},itemsCount:0,setCount:()=>{},setDownloadLocation:()=>{},setDownloadLocationWithDialog:()=>{},sortItems:()=>[],downloadLocationList:[],isDownloadLocationDialogVisible:!1}),Bo=()=>useContext(Ao);function To({className:n,icon:i="search",placeholder:o="Search",...r}){const a=w("io-header-search",n),s=useRef(null),{isSearchVisible:c,searchQuery:l,setSearch:f,itemsCount:h}=Bo();return useEffect((()=>{c?s.current?.focus():(s.current?.blur(),f(""));}),[c,f]),c?jsxRuntimeExports.jsxs("div",{className:a,children:[jsxRuntimeExports.jsx(Bi,{ref:s,value:l,iconPrepend:i,placeholder:o,onChange:e=>f(e.target.value),...r}),c&&l.length>0&&jsxRuntimeExports.jsx("p",{className:"io-header-search-count",children:`${h} results`})]}):null}function Po({className:n,...i}){const{SearchButton:o,SettingsButton:r,MoreButton:a}=Qo();return jsxRuntimeExports.jsxs($,{className:n,align:"right",...i,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{})]})}function Ro({...t}){const{isSearchVisible:n,showSearch:i,hideSearch:o,items:r}=Bo();return jsxRuntimeExports.jsx(S,{icon:n?"search-filled":"search",variant:"circle",size:"32",onClick:n?o:i,disabled:0===r.length,...t})}function Lo({icon:t="cog",...n}){const{showSettings:i}=Bo();return jsxRuntimeExports.jsx(S,{icon:t,variant:"circle",size:"32",onClick:i,...n})}function Oo({icon:n="ellipsis",...i}){const{items:o,clearItems:r}=Bo(),a=0===o.length;return jsxRuntimeExports.jsxs(H,{variant:"light",...i,children:[jsxRuntimeExports.jsx(H.ButtonIcon,{icon:n,variant:"circle",size:"32"}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{children:jsxRuntimeExports.jsx(H.Item,{disabled:a,onClick:e=>(e=>{a?e.stopPropagation():r();})(e),children:"Clear All"})})})]})}function Fo(e,t=!1,n=!1,i=!1){const o=e.getDate(),r=["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()],a=e.getFullYear(),s=e.getHours(),c=e.getMinutes();let l="";return l=c<10?`0${c}`:`${c}`,t?"Today"===t?n?"Today":`Today at ${s}:${l}`:"Yesterday"===t?n?"Yesterday":`Yesterday at ${s}:${l}`:`${s}:${l}`:i?n?`${r} ${o}`:`${r} ${o} at ${s}:${l}`:n?`${r} ${o}, ${a}`:`${r} ${o}, ${a} at ${s}:${l}`}function Do(e,t={showTime:!0}){const n=new Date(1e3*e),i=new Date,o=Math.round((i-n)/1e3),r=Math.round(o/60),a=i.toDateString()===n.toDateString(),s=new Date(i.setDate(i.getDate()-1)).toDateString()===n.toDateString(),c=i.getFullYear()===n.getFullYear();return t.showTime?o<5?"Just Now":o<60?`${o} seconds ago`:o<90?"about a minute ago":r<60?`${r} minutes ago`:a?Fo(n,"Today",!1,!0):s?Fo(n,"Yesterday",!1,!0):c?Fo(n,!1,!1,!0):Fo(n):a?"Today":s?"Yesterday":c?Fo(n,!1,!0,!0):Fo(n,!1,!0)}function Mo({className:t,...n}){const i=w("io-dm-body",t),{DownloadListEmpty:o,ItemGroup:r,Item:a}=Qo(),{items:s,searchQuery:c,setCount:d,sortItems:f}=Bo(),h=f(s),m=Hi(c),p=useMemo((()=>h.filter((e=>e.displayInfo.filename.toLowerCase().includes(m.toLowerCase())||e.displayInfo.url.toLowerCase().includes(m.toLowerCase())))),[h,m]),g=useMemo((()=>p.map((e=>({...e,displayInfo:{...e.displayInfo,startTime:Do(e.displayInfo.startTime,{showTime:!1})}})))),[p]),v=useMemo((()=>Object.values(g.reduce(((e={},t)=>(e[t.displayInfo.startTime]=e[t.displayInfo.startTime]?.concat([])??[],e[t.displayInfo.startTime].push(t),e)),{}))),[g]);return useEffect((()=>{d(p.length);}),[p,d]),jsxRuntimeExports.jsx("div",{className:i,...n,children:v&&0!==v.length?v.map((t=>jsxRuntimeExports.jsx(r,{title:String(t[0].displayInfo.startTime)??null,children:t.map((t=>jsxRuntimeExports.jsx(a,{item:t},t.id)))},t[0].id??""))):jsxRuntimeExports.jsx(o,{})})}function zo({className:n,icon:i="download",text:o="No downloads to display.",...r}){const a=w("io-dm-no-items",n);return jsxRuntimeExports.jsxs("div",{className:a,...r,children:[jsxRuntimeExports.jsx(k,{variant:i}),jsxRuntimeExports.jsx("p",{children:o})]})}function _o({className:n,title:i,children:o,...r}){const a=w("io-dm-item-group",n);return jsxRuntimeExports.jsxs("div",{className:a,...r,children:[i&&jsxRuntimeExports.jsx("p",{children:i}),o]})}function Ho({className:i,item:o,...r}){const{ItemHeader:a,ItemBody:s,ItemFooter:c}=Qo(),{state:l,url:u,filename:d,receivedBytes:f,totalBytes:h,speed:m,timeRemaining:p}=o.displayInfo;if(!o)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const g=w("io-dm-item",o.displayInfo.state&&[l],i);return jsxRuntimeExports.jsxs("div",{className:g,...r,children:[jsxRuntimeExports.jsx(a,{itemID:o.id,filename:d,state:l}),jsxRuntimeExports.jsx(s,{state:l,url:u,bytesReceived:f,bytesTotal:h,speed:m,timeRemaining:p}),jsxRuntimeExports.jsx(c,{itemID:o.id,state:l})]})}function $o({bytesReceived:t=0,bytesTotal:n=0,...i}){const o=useCallback((()=>t&&n?Math.round(t/n*100):0),[t,n]);return jsxRuntimeExports.jsx(Ei,{value:o(),...i})}function jo({className:n,itemID:i,filename:o,state:a,cancel:s,remove:c,...l}){const u=w("io-dm-item-header",n),{cancelItem:d,removeItem:f}=Bo(),h=useCallback((e=>{s?s(e):d(e);}),[s,d]),m=useCallback((e=>{c?c(e):f(e);}),[c,f]);return jsxRuntimeExports.jsxs("div",{className:u,...l,children:[jsxRuntimeExports.jsx(I,{text:o,style:{textDecoration:"interrupted"===a||"cancelled"===a?"line-through":"none"}}),jsxRuntimeExports.jsx(S,{icon:"close",onClick:()=>{"progressing"===a||"paused"===a?h(i):m(i);}})]})}function Vo({className:n,state:i,url:o,bytesReceived:r=0,bytesTotal:a=0,speed:s=0,timeRemaining:c=0,...l}){const u=w("io-dm-item-body",n),d=e=>{const t=["Bytes","KB","MB","GB","TB"];if(0===e)return "0";const n=Math.floor(Math.log(e)/Math.log(1024));return 0===n?`${e}${t[n]}`:`${(e/1024**n).toFixed(1)}${t[n]}`};return jsxRuntimeExports.jsxs("div",{className:u,...l,children:[jsxRuntimeExports.jsx("p",{className:"io-text-small",children:o}),(h=i,"cancelled"===h||"interrupted"===h||"completed"===h?null:jsxRuntimeExports.jsx($o,{variant:"paused"===h?"paused":"active",bytesReceived:r,bytesTotal:a})),jsxRuntimeExports.jsx("p",{className:"io-text-default-lh16",children:"completed"===i?`${d(r??0)} - Done`:"cancelled"===i||"interrupted"===i?`${d(r??0)}/${d(a??0)} - Failed`:`${d(r??0)}/${d(a??0)} (${f=s,(f?`${(f/1e6/8).toFixed(2)}MB/s`:0)??0}) - ${(e=>{const t=Math.floor(e/3600),n=Math.floor(e%3600/60);let i="";return t>0&&(i+=`${t} hour${t>1?"s":""}, `),n>0&&(i+=`${n} min${n>1?"s":""}, `),((e=Math.floor(e%60))>0||""===i)&&(i+=`${e} sec${1!==e?"s":""}`),`${i.trim()} left`})(c)??0}`})]});var f,h;}const Uo={success:"check-solid",warning:"exclamation-mark",critical:"exclamation-mark"};function Jo({className:n,variant:i,text:o}){const r=w("io-dm-item-status",`io-dm-item-status-${i}`,n);return jsxRuntimeExports.jsxs("div",{className:r,children:[i&&jsxRuntimeExports.jsx(k,{variant:Uo[i],className:"icon-severity"}),o&&jsxRuntimeExports.jsx("p",{className:"io-text-smaller",children:o})]})}function Wo({className:i,itemID:o,state:a,pauseResume:s,showInFolder:c,cancel:l,...u}){const d=w("io-dm-item-footer",i),{pauseResumeItem:f,showItemInFolder:h,cancelItem:m}=Bo(),p=useCallback((e=>{s?s(e):f(e);}),[s,f]),g=useCallback((e=>{c?c(e):h(e);}),[c,h]),v=useCallback((e=>{l?l(e):m(e);}),[l,m]);return jsxRuntimeExports.jsx("div",{className:d,...u,children:(()=>{switch(a){case"progressing":return jsxRuntimeExports.jsxs($,{align:"right",children:[jsxRuntimeExports.jsx($.Button,{variant:"primary",text:"Pause",onClick:()=>p(o)}),jsxRuntimeExports.jsx($.Button,{variant:"link",text:"Cancel",onClick:()=>v(o)})]});case"paused":return jsxRuntimeExports.jsx($,{align:"right",children:jsxRuntimeExports.jsx($.Button,{variant:"primary",text:"Resume",onClick:()=>p(o)})});case"completed":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Jo,{variant:"success",text:"Complete"}),jsxRuntimeExports.jsx($,{align:"right",children:jsxRuntimeExports.jsx($.Button,{variant:"primary",text:"Show in Folder",onClick:()=>g(o)})})]});case"cancelled":return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Jo,{variant:"warning",text:"Cancelled"})});case"interrupted":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Jo,{variant:"critical",text:"Failed"}),jsxRuntimeExports.jsx($,{align:"right",children:jsxRuntimeExports.jsx($.Button,{variant:"primary",text:"Retry",onClick:()=>p(o)})})]});default:return null}})()})}function qo({className:n,title:i="Settings",...o}){const r=w("io-settings-panel",n),{configuration:{downloadFolder:a},hideSettings:s,setDownloadLocation:c,setDownloadLocationWithDialog:l,isDownloadLocationDialogVisible:u,downloadLocationList:d}=Bo();return jsxRuntimeExports.jsxs(Ci,{className:r,...o,children:[jsxRuntimeExports.jsxs(Ci.Header,{children:[jsxRuntimeExports.jsx(Ci.Header.Title,{size:"large",text:i,tag:"h1"}),jsxRuntimeExports.jsx(Ci.Header.ButtonGroup,{children:jsxRuntimeExports.jsx(S,{variant:"circle",icon:"close",size:"32",onClick:()=>{s();},disabled:u})})]}),jsxRuntimeExports.jsx(Ci.Body,{children:jsxRuntimeExports.jsxs($,{children:[jsxRuntimeExports.jsxs(H,{variant:"outline",disabled:u,children:[jsxRuntimeExports.jsx(H.Button,{children:jsxRuntimeExports.jsx("span",{className:"io-settings-panel-download-location",children:a??d[0]})}),d.length>1&&jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{children:d.map(((t,n)=>!t||0===n||n>3?null:jsxRuntimeExports.jsx(H.Item,{onClick:()=>{c(t);},children:t},t)))})})]}),jsxRuntimeExports.jsx(A,{className:"io-btn io-settings-panel-download-location-btn",text:"Browse",onClick:()=>{l();},disabled:u})]})})]})}const Ko={Header:Io,ItemSearch:To,HeaderButtons:Po,SearchButton:Ro,SettingsButton:Lo,MoreButton:Oo,Body:Mo,DownloadListEmpty:zo,ItemGroup:_o,Item:Ho,ItemProgress:$o,ItemHeader:jo,ItemBody:Vo,ItemFooter:Wo,Settings:qo},Go=createContext(Ko),Yo=memo((({children:t,components:n})=>{const i=useMemo((()=>({...Ko,...n})),[n]);return jsxRuntimeExports.jsx(Go.Provider,{value:i,children:t})}));Yo.displayName="ComponentsStore";const Qo=()=>useContext(Go);function er(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,n={};function i(n,i){var o=n instanceof Error?n:new Error(n);if(t)t(o);else {var r='[ERROR] callback-registry: User callback for key "'+i+'" failed: '+o.stack;if(e)switch(e.errorHandling){case"log":return console.error(r);case"silent":return;case"throw":throw new Error(r)}console.error(r);}}return {add:function(e,t,o){var r=n[e];return r||(r=[],n[e]=r),r.push(t),o&&setTimeout((function(){o.forEach((function(o){var r;if(null===(r=n[e])||void 0===r?void 0:r.includes(t))try{Array.isArray(o)?t.apply(void 0,o):t.apply(void 0,[o]);}catch(t){i(t,e);}}));}),0),function(){var i=n[e];i&&(i=i.reduce((function(e,n,i){return n===t&&e.length===i||e.push(n),e}),[]),0===i.length?delete n[e]:n[e]=i);}},execute:function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];var r=n[e];if(!r||0===r.length)return [];var a=[];return r.forEach((function(n){try{var o=n.apply(void 0,t);a.push(o);}catch(t){a.push(void 0),i(t,e);}})),a},clear:function(){n={};},clearKey:function(e){n[e]&&delete n[e];}}}er.default=er;v(er);const ir=createContext({config:{env:"",region:"",version:"",buildVersion:"",theme:"",isError:!1,mailingList:"",createJiraTicket:!0,sendEmail:!1,attachments:[],applicationTitle:"",allowEditRecipients:!0,attachmentsViewMode:"category",environmentInfo:"",selectedCategories:[],errorMessage:"",showEnvironmentInfo:!1,context:{},technicalInfo:"",sendEmailClient:"Outlook"},onThemeChanged:e=>{},openUrl:()=>{},submit:()=>Promise.resolve({}),setBounds:()=>{},close:e=>{},showMailingList:!0,setShowMailingList:()=>{},attachmentCategories:[],submitInProgress:!1,setSubmitInProgress:()=>{},submitStatus:{type:"success",title:"",text:""},setSubmitStatus:()=>{},submitCompleted:!1,setSubmitCompleted:()=>{},jiraTicketURL:"",setJiraTicketURL:()=>{},submitFeedback:()=>{}}),or=()=>useContext(ir);function rr({...n}){const{config:i,close:o}=or(),{applicationTitle:r}=i;return jsxRuntimeExports.jsxs(j,{draggable:!0,...n,children:[jsxRuntimeExports.jsx(j.Title,{tag:"h1",text:r?`Feedback Form - ${r}`:"Feedback Form",size:"large"}),jsxRuntimeExports.jsx(j.ButtonGroup,{className:"non-draggable",children:jsxRuntimeExports.jsx(j.ButtonIcon,{variant:"circle",icon:"close",size:"32",onClick:()=>o()})})]})}function ar({className:n,handleSubmit:i,...o}){const r=w("io-panel-body",n),{config:a,submitFeedback:s}=or(),{IntroField:c,DescriptionField:l,TechInfoField:u,EnvInfoField:d,FileAttachmentsField:f,CategoryAttachmentsField:h,SettingsField:m,MailListField:p}=Cr(),g=i??s,v=`Your feedback will be submitted to the ${a.buildVersion} team and some additional information will be automatically included to help us examine your issue.`;return jsxRuntimeExports.jsxs("form",{className:r,id:"feedback",onSubmit:e=>g(e),...o,children:[jsxRuntimeExports.jsx(c,{children:jsxRuntimeExports.jsx("p",{children:v})}),jsxRuntimeExports.jsx(m,{}),jsxRuntimeExports.jsx(p,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(u,{readOnly:!0}),jsxRuntimeExports.jsx(d,{readOnly:!0}),"file"===a.attachmentsViewMode?jsxRuntimeExports.jsx(f,{}):jsxRuntimeExports.jsx(h,{})]})}function sr({...n}){const{FooterButtons:i}=Cr(),{openUrl:o,submitInProgress:r,submitStatus:a,jiraTicketURL:s}=or();return jsxRuntimeExports.jsx(J,{...n,children:jsxRuntimeExports.jsxs("div",r?{className:"flex ai-center jc-between",children:[jsxRuntimeExports.jsx(E,{children:jsxRuntimeExports.jsx("p",{children:a.title})}),jsxRuntimeExports.jsx(wi,{align:"right",size:"small"})]}:{className:"flex ai-center jc-between",children:[jsxRuntimeExports.jsxs(E,{children:[jsxRuntimeExports.jsx("p",{className:"error"===a.type?"io-text-error":"",children:a.title}),s&&jsxRuntimeExports.jsx("a",{href:s,onClick:e=>{e.preventDefault(),o(s);},children:s})]}),jsxRuntimeExports.jsx(i,{})]})})}function cr({className:t,...n}){const{CloseButton:i}=Cr(),{close:o}=or();return jsxRuntimeExports.jsx($,{className:t,...n,children:jsxRuntimeExports.jsx(i,{onClick:()=>o()})})}function lr({className:n,...i}){const{SubmitButton:o,CancelButton:r,CloseButton:a}=Cr(),{close:s,submitCompleted:c}=or();return c?jsxRuntimeExports.jsx($,{className:n,...i,children:jsxRuntimeExports.jsx(a,{text:"Close",onClick:()=>s()})}):jsxRuntimeExports.jsxs($,{className:n,...i,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{onClick:()=>s()})]})}function ur({text:t="Submit",...n}){return jsxRuntimeExports.jsx(A,{form:"feedback",type:"submit",variant:"primary",text:t,...n})}function dr({text:t="Cancel",...n}){return jsxRuntimeExports.jsx(A,{variant:"link",text:t,...n})}function fr({...t}){return jsxRuntimeExports.jsx(A,{variant:"primary",...t})}function hr({showField:t=!0,className:n,title:i,hint:o,children:r,...a}){return t?jsxRuntimeExports.jsx(E,{className:n,title:i,hint:o,...a,children:r}):null}function mr({showField:t=!0,className:n,title:i="Description",hint:o,readOnly:r=!1,disabled:a,...s}){return t?jsxRuntimeExports.jsx(E,{className:n,hint:o,title:"",...s,children:jsxRuntimeExports.jsx(Ti,{id:"description",name:"description",label:i,readOnly:r,disabled:a})}):null}function pr({showField:t,className:n,title:i="Technical Information",hint:o,fieldValue:r,readOnly:a=!1,disabled:s,...c}){const{config:l}=or(),u=t??l.errorMessage,d=r??l.errorMessage;return u&&d?jsxRuntimeExports.jsx(E,{className:n,hint:o,...c,children:jsxRuntimeExports.jsx(Ti,{id:"errorMessage",name:"errorMessage",label:i,value:d,readOnly:a,disabled:s})}):null}function gr({showField:t,className:n,title:i="Environment Information",hint:o,fieldValue:r,readOnly:a=!1,disabled:s,...c}){const{config:l}=or(),u=t??l.showEnvironmentInfo,d=r??l.environmentInfo;return u&&d?jsxRuntimeExports.jsx(E,{className:n,hint:o,...c,children:jsxRuntimeExports.jsx(Ti,{id:"environmentInfo",name:"environmentInfo",label:i,value:d,readOnly:a,disabled:s})}):null}function vr({showField:t=!0,className:n,title:i="Attachments",hint:o,readOnly:a=!1,disabled:s,attachments:c,selectedCategories:l,...u}){const d=w("io-block-list-gap",n),{config:f}=or(),h=c??f.attachments,m=l??f.selectedCategories,p=useCallback((e=>!!m&&-1!==m.indexOf(e)),[m]);return t?!h||h.length<=0?jsxRuntimeExports.jsx(E,{title:"Attachments",children:jsxRuntimeExports.jsx("p",{children:"No Attachments"})}):jsxRuntimeExports.jsx(E,{className:d,title:i,hint:o,...u,children:jsxRuntimeExports.jsx("div",{className:"file-attachments",children:h.map((t=>jsxRuntimeExports.jsx(Pi,{id:t.id,name:t.id,label:t.name,readOnly:a,disabled:s,defaultChecked:p(t.category)},t.id)))})}):null}function br({showField:t=!0,className:n,title:i="Attachments",hint:o,readOnly:a=!1,disabled:s,categories:c,selectedCategories:l,...u}){const{config:d,attachmentCategories:f}=or(),h=c??f,m=l??d.selectedCategories,p=useCallback((e=>!!m&&-1!==m.indexOf(e)),[m]);return t?!h||h.length<=0?jsxRuntimeExports.jsx("p",{children:"No Attachments"}):jsxRuntimeExports.jsx(E,{className:n,title:i,hint:o,...u,children:jsxRuntimeExports.jsx("div",{className:"category-attachments",children:h.map((t=>jsxRuntimeExports.jsx(Li,{id:t,name:t,align:"right",label:t,readOnly:a,disabled:s,defaultChecked:p(t)},t)))})}):null}function yr({className:n,title:i,hint:o,showField:r=!0,showJiraTicketField:a,jiraTicketLabel:s="Create Jira Ticket",showSendEmailField:c,sendEmailLabel:l="Send Email",readOnly:u=!1,disabled:d,...f}){const h=w("io-block-list-gap",n),{config:m,showMailingList:p,setShowMailingList:g}=or();if(!r)return null;const v=a??m.createJiraTicket,b=c??m.sendEmail;return jsxRuntimeExports.jsxs(E,{className:h,hint:o,title:i,...f,children:[v&&jsxRuntimeExports.jsx(Li,{id:"createJiraTicket",name:"createJiraTicket",label:s,align:"right",readOnly:u,disabled:d,defaultChecked:v}),b&&jsxRuntimeExports.jsx(Li,{onChange:()=>{g(!p);},id:"sendEmail",name:"sendEmail",label:l,align:"right",readOnly:u,disabled:d,defaultChecked:b})]})}function wr({showField:t=!0,className:n,title:i="Email List",hint:o="Separate with commas or semicolons.",placeholder:r="john.doe@somedomain.com; jane.doe@otherdomain.com",readOnly:a,disabled:s,...c}){const{config:l,showMailingList:u}=or(),d=t??l.sendEmail,f=a??!1===l.allowEditRecipients;return d&&u?jsxRuntimeExports.jsx(E,{className:n,hint:o,...c,children:jsxRuntimeExports.jsx(Bi,{id:"mailingList",name:"mailingList",label:i,placeholder:r,readOnly:f,disabled:s,defaultValue:l.mailingList??""})}):null}const kr={Header:rr,Body:ar,Footer:sr,HeaderButtons:cr,FooterButtons:lr,SubmitButton:ur,CancelButton:dr,CloseButton:fr,IntroField:hr,DescriptionField:mr,TechInfoField:pr,EnvInfoField:gr,FileAttachmentsField:vr,CategoryAttachmentsField:br,SettingsField:yr,MailListField:wr},Sr=createContext(kr),Nr=memo((({children:t,components:n})=>{const i=useMemo((()=>({...kr,...n})),[n]);return jsxRuntimeExports.jsx(Sr.Provider,{value:i,children:t})}));function Cr(e){return {...useContext(Sr),...e}}Nr.displayName="ComponentsStore";function Ar(e){const t=useContext(IOConnectContext),n=t?.appManager,[i,o]=useState([]),[a,l]=useState(0),d="*",f=useCallback((e=>[...e].sort(((e,t)=>{const n=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return n<i?-1:n>i?1:0}))),[]);return useEffect((()=>{if(!n)return;const e=n.onAppAdded((e=>{o((t=>[...t,{title:e.title,name:e.name,hidden:e.hidden}]));}));return ()=>{e();}}),[n]),useEffect((()=>{if(!n)return;const e=n.onAppRemoved((e=>{o((t=>t.filter((t=>t.name!==e.name))));}));return ()=>{e();}}),[n,i]),useEffect((()=>{if(!n)return;const e=n.onAppChanged((e=>{o((t=>{const n=t.find((t=>t.name===e.name));return [...t.filter((t=>t.name!==e.name)),{title:e.title,name:n?.name,hidden:n?.hidden,allowed:n?.allowed}]}));}));return ()=>{e();}}),[n]),useEffect((()=>{const n=e?.allApplications??t.appManager.applications().length;let r=0;const a=[...i],s=e?.sourceFilter;if(void 0===s||!Array.isArray(s.allowed)||!Array.isArray(s.blocked))return;const c=s.allowed,u=s.blocked;0===c.length||-1!==u.indexOf(d)||0===c.length&&0===u.length||-1!==c.indexOf(d)&&-1!==u.indexOf(d)?(r=n,a.forEach((e=>{e.allowed=!1;}))):-1!==c.indexOf(d)&&a.forEach((e=>{e.allowed=!0;})),-1===u.indexOf(d)&&u.length>0&&(r=s.blocked.length),c.forEach((e=>{const t=a.find((t=>t.name===e));t&&(t.allowed=!0);})),u.forEach((e=>{const t=a.find((t=>t.name===e));t&&(t.allowed=!1);})),l(n-r),o(a);}),[e]),{apps:i,allowedApps:a,sortAppsAlphabetically:f}}const Rr=createContext({allApps:[],settings:{},configuration:{},notifications:[],onClose:()=>{},allApplications:0,clearAll:()=>{},showPanel:()=>{},hidePanel:()=>{},saveFilter:()=>{},clearAllOld:()=>{},notificationStacks:[],isPanelVisible:!1,saveSetting:()=>{},allowedApplications:0,saveAllFilter:()=>{},isBulkActionsSupported:!1,selectedNotifications:[],selectNotification:()=>{},selectAllNotifications:()=>{},clearMany:()=>{},snooze:()=>{},snoozeMany:()=>{},setState:()=>{},setStates:()=>{}}),Lr=()=>useContext(Rr);const Or=createContext({isSearchVisible:!1,showSearch:()=>{},hideSearch:()=>{},searchQuery:"",setSearch:()=>{},isSettingsVisible:!1,showSettings:()=>{},hideSettings:()=>{},sortNotificationsBy:"newest",setSortBy:()=>{},viewNotificationsBy:"all",setViewBy:()=>{},notificationsCount:0,setCount:()=>{},isBulkActionsVisible:!1,showBulkActions:()=>{},hideBulkActions:()=>{}}),Fr=()=>useContext(Or);function Dr({...n}){const{HeaderCaption:i,HeaderActions:o,HeaderBulkActions:r,HeaderSearch:a}=Ya(),{isBulkActionsSupported:s}=Lr(),{isBulkActionsVisible:c,notificationsCount:l}=Fr();return jsxRuntimeExports.jsxs(ki,{...n,children:[jsxRuntimeExports.jsx(i,{}),s?jsxRuntimeExports.jsxs("div",{className:`io-panel-header-actions-wrapper ${c&&l>0?"io-panel-header-bulk-actions-opened":""} `,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{})]}):jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(a,{})]})}function Mr({className:n,...i}){const o=w("io-panel-header-caption",n),{HeaderCaptionTitle:r,HeaderCaptionCount:a,HeaderCaptionButtons:s}=Ya();return jsxRuntimeExports.jsxs("div",{className:o,...i,children:[jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})}function zr({className:n,...i}){const o=w("io-panel-header-caption-filter",n),{allApplications:r,allowedApplications:a}=Lr();return jsxRuntimeExports.jsxs("div",{className:o,...i,children:[jsxRuntimeExports.jsx(k,{variant:"filter"}),jsxRuntimeExports.jsx("span",{className:"io-panel-header-caption-filter-allowed",children:a}),"of"," ",jsxRuntimeExports.jsx("span",{className:"io-panel-header-caption-filter-all",children:r}),"apps"]})}function _r({text:n="Notifications",counter:i,...o}){const{notificationsCount:r}=Fr();return jsxRuntimeExports.jsx(I,{text:n,size:"large",...o,children:(i??!0)&&jsxRuntimeExports.jsxs("span",{children:["(",r,")"]})})}function Hr({...n}){const{HeaderCaptionButtonSearch:i,HeaderCaptionButtonSettings:o,HeaderCaptionButtonClose:r}=Ya();return jsxRuntimeExports.jsxs($,{...n,children:[jsxRuntimeExports.jsx(i,{}),jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{})]})}const $r="newest",jr="oldest",Vr="severity",Ur=["None","Low","Medium","High","Critical"],Jr={key:$r,descending:!0},Wr=e=>[...e].sort(((e,t)=>(t.timestamp||0)-(e.timestamp||0))),qr=e=>[...e].sort(((e,t)=>(e.timestamp||0)-(t.timestamp||0))),Kr=(e,t)=>{const n=Ur[0];return [...e].sort(((e,i)=>{const o=Ur.indexOf(e.severity||n),r=Ur.indexOf(i.severity||n);return (t?-1:1)*(o-r)}))},Gr={[$r]:Wr,[jr]:qr,[Vr]:Kr};function Yr({...t}){const[n,i]=useState([]),{NotificationsList:o,Notification:r}=Ya(),{sortNotificationsBy:a,viewNotificationsBy:s,setCount:f,searchQuery:h,notificationsCount:m}=Fr(),{notifications:p}=Lr(),g=useRef(null),v=Hi(h),b=useMemo((()=>((e,t)=>{if(!e)return [];switch(t){case"all":default:return e;case"unread":return e.filter((e=>"Active"===e.state||"Stale"===e.state));case"read":return e.filter((e=>"Acknowledged"===e.state||"Seen"===e.state));case"snoozed":return e.filter((e=>"Snoozed"===e.state))}})(p,s)),[p,s]),y=useMemo((()=>b.filter((e=>e.title.toLowerCase().includes(v.toLowerCase())||e.source?.toLowerCase().includes(v.toLowerCase())||e.body?.toLowerCase().includes(v.toLowerCase())))),[b,v]);return useEffect((()=>{switch(a){case"newest":i(Wr(y));break;case"oldest":i(qr(y));break;case"severity":i(Kr(y,!0));break;default:i(y);}f(y.length);}),[y,a,f]),useEffect((()=>{g.current&&g.current?.scrollTo({top:0,behavior:"smooth"});}),[v,m,a,s]),jsxRuntimeExports.jsx(Si,{ref:g,...t,children:jsxRuntimeExports.jsx(o,{notifications:n,Notification:r})})}function Qr({...t}){const{FooterButtons:n}=Ya();return jsxRuntimeExports.jsx(Ni,{...t,children:jsxRuntimeExports.jsx(n,{})})}function Xr({className:n,...i}){const{FooterButtonClearAll:o,FooterButtonClearAllOld:r}=Ya(),{notifications:a}=Lr(),[s,l]=useState(!1);return useEffect((()=>{a.filter((e=>"Stale"===e.state||"Acknowledged"===e.state)).length>0?l(!0):l(!1);}),[a]),jsxRuntimeExports.jsxs($,{className:n,align:"right",...i,children:[jsxRuntimeExports.jsx(r,{disabled:!s}),jsxRuntimeExports.jsx(o,{disabled:a.length<=0})]})}function Zr({text:t="Clear All",...n}){const{clearAll:i}=Lr();return jsxRuntimeExports.jsx(A,{text:t,onClick:()=>{i();},...n})}function ea({text:t="Clear Old",...n}){const{clearAllOld:i}=Lr();return jsxRuntimeExports.jsx(A,{text:t,onClick:()=>{i();},...n})}function ta({className:n,title:i="Settings",...o}){const r=w("io-settings-panel",n),{SettingsGeneral:a,SettingsPlacement:s,SettingsStacking:c,SettingsSnooze:l,SettingsSubscriptions:u}=Ya(),{hideSettings:d}=Fr();return jsxRuntimeExports.jsxs(Ci,{className:r,...o,children:[jsxRuntimeExports.jsxs(Ci.Header,{children:[jsxRuntimeExports.jsx(Ci.Header.Title,{size:"large",text:i,tag:"h1"}),jsxRuntimeExports.jsx(Ci.Header.ButtonGroup,{children:jsxRuntimeExports.jsx(Ci.Header.ButtonIcon,{variant:"circle",icon:"close",size:"32",onClick:d})})]}),jsxRuntimeExports.jsxs(Ci.Body,{children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(c,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(u,{})]})]})}function na({className:n,title:i="General",...o}){const r=w("io-panel-settings-general",n),{SettingsAllowNotifications:a,SettingsShowNotificationBadge:s,SettingsCloseNotificationOnClick:c,SettingsPanelAutoHide:l,SettingsHideToastsAfter:u}=Ya();return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(E,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(c,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(u,{})]})})}function ia({label:t="Allow notifications",align:n="right",...i}){const{settings:o,saveSetting:a}=Lr(),s=useCallback((e=>{a({enabledNotifications:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Li,{label:t,align:n,onChange:s,checked:o.enabledNotifications,...i})}function oa({label:t="Show notification badge",align:n="right",...i}){const{settings:o,saveSetting:a}=Lr(),s=useCallback((e=>{a({showNotificationBadge:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Li,{label:t,align:n,onChange:s,checked:o.showNotificationBadge,disabled:!o.enabledNotifications,...i})}function ra({label:t="Close notification on click",align:n="right",...i}){const{settings:o,saveSetting:a}=Lr(),s=useCallback((e=>{a({closeNotificationOnClick:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Li,{label:t,align:n,onChange:s,checked:o.closeNotificationOnClick,disabled:!o.enabledNotifications,...i})}function aa({label:t="Auto hide panel",align:n="right",...i}){const{settings:o,saveSetting:a}=Lr(),s=useCallback((e=>{a({autoHidePanel:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Li,{label:t,align:n,onChange:s,checked:o.autoHidePanel,...i})}function sa({label:t="Panel always on top",align:n="right",...i}){const{settings:o,saveSetting:a}=Lr(),s=useCallback((e=>{a({alwaysOnTop:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Li,{label:t,align:n,onChange:s,checked:o.alwaysOnTop,...i})}function ca({className:n,title:i="Hide toasts after",items:o=[15,30,45,60],...a}){const s=w("flex","jc-between","ai-center",n),{settings:c,saveSetting:l}=Lr(),u=useCallback((e=>{e||(e=15e3),c.toastExpiry!==e&&l({toastExpiry:1e3*e});}),[c.toastExpiry,l]),d=e=>e<60?`${e} seconds`:60===e?"1 minute":e/60+" minutes";return jsxRuntimeExports.jsxs("div",{className:s,...a,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(c.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"light",disabled:!c.enabledNotifications,children:[jsxRuntimeExports.jsx(H.Button,{text:d(c.toastExpiry/1e3)}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:o.map((t=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>{u(t);},children:d(t)},t)))})})]})]})}function la({className:n,title:i="Highlight new for",...o}){const r=w("flex","jc-between","ai-center",n),{settings:a}=Lr(),s=["30 seconds","1 minute","5 minutes","Never"];return jsxRuntimeExports.jsxs("div",{className:r,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(a.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"outline",disabled:!a.enabledNotifications,children:[jsxRuntimeExports.jsx(H.Button,{text:s[0]}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:s.map((t=>jsxRuntimeExports.jsx(H.Item,{children:t},t)))})})]})]})}function ua({className:n,title:i="Mark as read after",...o}){const r=w("flex","jc-between","ai-center",n),{settings:a}=Lr(),s=["1 minute","5 minutes","Never"];return jsxRuntimeExports.jsxs("div",{className:r,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(a.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"outline",disabled:!a.enabledNotifications,children:[jsxRuntimeExports.jsx(H.Button,{text:s[0]}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:s.map((t=>jsxRuntimeExports.jsx(H.Item,{children:t},t)))})})]})]})}function da({className:n,title:i="Stacking",...o}){const r=w("io-panel-settings-stacking",n),{SettingsToastStacking:a,SettingsToastStackBy:s}=Ya();return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(E,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})})}function fa({label:t="Allow toast stacking",align:n="right",...i}){const{settings:o,saveSetting:a}=Lr(),s=useCallback((e=>{a({toastStacking:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Li,{label:t,align:n,onChange:s,checked:o.toastStacking,disabled:!o.enabledNotifications,...i})}const ha=e=>e.replace(/(^|-)\w/g,(e=>e.toUpperCase().replace("-"," ")));function ma({className:n,title:i="Group by",...o}){const a=w("flex","jc-between","ai-center",n),{settings:s,saveSetting:c}=Lr(),l=useCallback((e=>{e||(e="severity"),s.stackBy!==e&&c({stackBy:e.toLowerCase()});}),[s.stackBy,c]);return jsxRuntimeExports.jsxs("div",{className:a,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(s.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"light",disabled:!s.enabledNotifications,children:[jsxRuntimeExports.jsx(H.Button,{text:s.stackBy?ha(s.stackBy):"Severity"}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:["Severity","Application"].map((t=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>{l(t);},children:t},t)))})})]})]})}function pa({className:n,title:i="Placement",...o}){const r=w("io-panel-settings-placement",n),{SettingsPlacementPanel:a,SettingsPlacementToasts:s}=Ya();return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(E,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})})}function ga({className:n,title:i="Panel position",...o}){const a=w("flex","jc-between","ai-center",n),{settings:s,saveSetting:c}=Lr(),l=useCallback((e=>{e||(e="right"),s.placement?.panel!==e&&c({placement:{...s.placement,panel:e.toLowerCase()}});}),[s.placement,c]);return jsxRuntimeExports.jsxs("div",{className:a,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper",children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"light",children:[jsxRuntimeExports.jsx(H.Button,{text:s.placement?.panel?ha(s.placement?.panel):"Right"}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:["Right","Left"].map((t=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>{l(t);},children:t},t)))})})]})]})}function va({className:n,title:i="Toasts position",...o}){const a=w("flex","jc-between","ai-center",n),{settings:s,saveSetting:c}=Lr(),l=useCallback((e=>{if(e||(e="bottom-right"),s.placement?.toasts===e)return;const t=e.replace(/\s+/g,"-").toLowerCase();c({placement:{...s.placement,toasts:t}});}),[s.placement,c]);return jsxRuntimeExports.jsxs("div",{className:a,...o,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper",children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"light",children:[jsxRuntimeExports.jsx(H.Button,{text:s.placement?.toasts?ha(s.placement?.toasts):"Bottom Right"}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:["Top Right","Top Left","Bottom Right","Bottom Left"].map((t=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>{l(t);},children:t},t)))})})]})]})}function ba({className:t,title:n="Snooze",...i}){const o=w("io-panel-settings-snooze",t),{SettingsSnoozeDuration:r}=Ya(),{settings:a}=Lr();return a.snooze?.enabled?jsxRuntimeExports.jsx("div",{className:o,...i,children:jsxRuntimeExports.jsx(E,{title:n,children:jsxRuntimeExports.jsx(r,{})})}):null}function ya({className:n,title:i="Default duration",items:o=[60,120,180,300],...a}){const s=w("flex","jc-between","ai-center",n),{settings:c,saveSetting:l}=Lr(),u=useCallback((e=>{e||(e=6e4),c.snooze&&c.snooze?.duration!==e&&l({snooze:{...c.snooze,duration:1e3*e}});}),[c.snooze,l]),d=e=>e<60?`${e} seconds`:60===e?"1 minute":e/60+" minutes";return c.snooze?.enabled?jsxRuntimeExports.jsxs("div",{className:s,...a,children:[jsxRuntimeExports.jsx("div",{className:"io-text-clipper "+(c.enabledNotifications?"":"io-text-disabled"),children:jsxRuntimeExports.jsx("span",{children:i})}),jsxRuntimeExports.jsxs(H,{variant:"outline",disabled:!c.enabledNotifications,children:[jsxRuntimeExports.jsx(H.Button,{text:d(c.snooze?.duration/1e3)}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:o.map((t=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>{u(t);},children:d(t)},t)))})})]})]}):null}function wa({className:n,title:i="Subscribe and Mute",...o}){const r=w("io-panel-settings-subscriptions",n),{SettingsSubscribeAll:a,SettingsSubscribeApp:s,SettingsSubscribeMuteAll:c,SettingsSubscribeMuteApp:l}=Ya(),{allApps:u}=Lr(),{sortAppsAlphabetically:d}=Ar(),f=d(u);return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(E,{title:i,children:[jsxRuntimeExports.jsxs("div",{className:"io-panel-settings-subscriptions-grid",children:[jsxRuntimeExports.jsx("p",{className:"io-text-section",children:"Sources"}),jsxRuntimeExports.jsx("p",{className:"io-text-section",children:"Subscribe"}),jsxRuntimeExports.jsx("p",{className:"io-text-section",children:"Mute"})]}),jsxRuntimeExports.jsxs("div",{className:"io-panel-settings-subscriptions-grid",children:[jsxRuntimeExports.jsx("p",{children:"All Sources"}),jsxRuntimeExports.jsx(a,{label:""}),jsxRuntimeExports.jsx(c,{label:""})]}),f.map((n=>!n||n.hidden?null:jsxRuntimeExports.jsxs("div",{className:"io-panel-settings-subscriptions-grid",children:[jsxRuntimeExports.jsx("p",{children:n.title??n.name}),jsxRuntimeExports.jsx(s,{app:n,label:""}),jsxRuntimeExports.jsx(l,{app:n,label:""})]},n.name)))]})})}function ka({label:t="All apps",align:n="right",...i}){const{settings:o,configuration:a,saveAllFilter:s}=Lr(),c=useCallback((e=>{s({subscribe:e.target.checked});}),[s]);return jsxRuntimeExports.jsx(Li,{align:n,label:t,onChange:c,checked:a.sourceFilter?.allowed?.includes("*"),disabled:!o.enabledNotifications,...i})}function Sa({label:t="App",align:n="right",app:i,...o}){const{allApps:a,settings:s,configuration:c,saveFilter:l}=Lr(),u=useCallback(((e,t)=>{const n={...c.sourceFilter},i=n.allowed?.indexOf("*");"number"==typeof i&&i>-1&&(n.allowed?.splice(i,1),a.forEach((e=>{e.name!==t.name&&n.allowed?.push(e.name);}))),e?(n.allowed?.push(t.name),n.blocked=n.blocked?.filter((e=>e!==t.name))):(n.allowed=n.allowed?.filter((e=>e!==t.name)),n.blocked?.push(t.name)),n.allowed?.length&&n.allowed?.length>0&&n.blocked?.includes("*")&&n.blocked.splice(n.blocked.indexOf("*"),1),l(n);}),[a,c.sourceFilter,l]);return jsxRuntimeExports.jsx(Li,{id:i.name,label:t,align:n,onChange:e=>u(e.target.checked,i),checked:c.sourceFilter?.allowed?.includes("*")||c.sourceFilter?.allowed?.includes(i.name),disabled:!s.enabledNotifications,...o})}function Na({label:t="Mute all",align:n="right",...i}){const{settings:o,configuration:a,saveAllFilter:s}=Lr(),c=useCallback((e=>{s({mute:e.target.checked});}),[s]);return jsxRuntimeExports.jsx(Li,{align:n,label:t,onChange:c,checked:a.sourceFilter?.muted?.includes("*"),disabled:!o.enabledNotifications||-1===a.sourceFilter?.allowed?.indexOf("*"),...i})}function Ca({label:t="App",align:n="right",app:i,...o}){const{allApps:a,settings:s,configuration:c,saveFilter:l}=Lr(),u=useCallback(((e,t)=>{const n={...c.sourceFilter},i=n?.muted?.indexOf("*");"number"==typeof i&&i>-1&&(n.muted?.splice(i,1),a.forEach((e=>{e.name===t.name||e.hidden||n.muted?.push(e.name);}))),e?n.muted?.push(t.name):n.muted=n.muted?.filter((e=>e!==t.name)),l(n);}),[a,c.sourceFilter,l]);return jsxRuntimeExports.jsx(Li,{id:i.name,label:t,align:n,onChange:e=>u(e.target.checked,i),checked:c.sourceFilter?.muted?.includes("*")||c.sourceFilter?.muted?.includes(i.name),disabled:!s.enabledNotifications||c.sourceFilter?.blocked?.includes("*")||c.sourceFilter?.blocked?.includes(i.name)||0===c.sourceFilter?.allowed?.length||-1===c.sourceFilter?.allowed?.indexOf(i.name)&&-1===c.sourceFilter?.allowed?.indexOf("*")&&0===c.sourceFilter?.blocked?.length,...o})}function xa({className:n,notification:i,...o}){const r=w("io-notification-header",n),{HeaderCount:a,HeaderBadge:s,HeaderTitle:c,HeaderTimestamp:l,HeaderButtonSnooze:u,HeaderButtonClose:d}=ja();return jsxRuntimeExports.jsxs("div",{className:r,...o,children:[jsxRuntimeExports.jsx(s,{notification:i}),jsxRuntimeExports.jsx(a,{notification:i}),jsxRuntimeExports.jsx(c,{notification:i}),jsxRuntimeExports.jsx(l,{notification:i}),jsxRuntimeExports.jsxs($,{children:[jsxRuntimeExports.jsx(u,{notification:i}),jsxRuntimeExports.jsx(d,{notification:i})]})]})}function Ia({notification:t,...n}){const{settings:i,isPanelVisible:o,notificationStacks:r}=Lr(),{toastStacking:a,stackBy:s}=i,c="application"===s?"source":s??"source";let l;if(a){const e=r.find((e=>e.key===t[c]));l=e?.items.length??0;}return a&&!o&&l&&l>1?jsxRuntimeExports.jsx(x,{...n,children:l<10?l:"9+"}):null}function Ea({className:n,notification:i,...o}){if(!i?.severity||"None"===i.severity)return null;const r=w("io-notification-header-badge",n);return jsxRuntimeExports.jsxs("div",{className:r,...o,children:[jsxRuntimeExports.jsx(k,{variant:((e="None")=>{switch(e.toLowerCase()){case"low":case"medium":case"none":default:return "circle-info";case"high":return "triangle-exclamation";case"critical":return "ban"}})(i.severity),size:"12"}),i.severity]})}function Aa({className:n,state:i,severity:o="None",icon:r,...a}){const s=w("io-notification-header-icon",n),{isPanelVisible:c}=Lr();return jsxRuntimeExports.jsxs("div",{className:s,...a,children:[r&&jsxRuntimeExports.jsx("span",{className:"io-notification-header-icon-image",children:jsxRuntimeExports.jsx("img",{src:r,alt:`io-notification-header-icon-${r}`})}),jsxRuntimeExports.jsx("span",{className:`io-notification-header-icon-badge color-${o.toLowerCase()}`,children:c&&"Acknowledged"!==i&&"New"})]})}function Ba({className:t,notification:{appTitle:n},...i}){const o=w("io-notification-header-title",t);return jsxRuntimeExports.jsx("div",{className:o,...i,children:n})}function Ta({className:t,notification:{timestamp:n,state:i,snooze:o},...r}){const a=w("io-notification-timestamp",t);return jsxRuntimeExports.jsx("small",o&&"Snoozed"===i?{className:a,...r,children:"Snoozed"}:{className:a,...r,children:Do(n??0)??"Just Now"})}function Pa({notification:{id:t,state:n},...i}){const{settings:o,snooze:a}=Lr(),s=useCallback((e=>{e.stopPropagation(),a&&a(t,o.snooze?.duration??0);}),[t,a,o.snooze?.duration]);return a&&"Snoozed"!==n&&o.snooze?.enabled?jsxRuntimeExports.jsx(A,{icon:"snooze",variant:"link",text:"Snooze",tabIndex:-1,onClick:s,...i}):null}function Ra({notification:{updateState:t,close:n},...i}){const{isPanelVisible:o}=Lr();return jsxRuntimeExports.jsx(S,{icon:"close",iconSize:"10",size:"24",tabIndex:-1,onClick:e=>{o?n().catch(console.error):(e.stopPropagation(),t("Acknowledged").catch(console.error));},...i})}function La({className:n,notification:i,...o}){const r=w("io-notification-body",n),{BodyIcon:a,BodyTitle:s,BodyDescription:c}=ja(),{onClick:l}=i,{settings:u,isPanelVisible:d}=Lr();return jsxRuntimeExports.jsxs("div",{className:r,role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l({close:!1});},onClick:()=>{if(u.toastStacking)l({close:!1});else {l({close:d||(u?.closeNotificationOnClick??!0)});}},...o,children:[jsxRuntimeExports.jsx(a,{icon:i.icon}),jsxRuntimeExports.jsxs("div",{className:"io-notification-body-content",children:[jsxRuntimeExports.jsx(s,{text:i.title}),jsxRuntimeExports.jsx(c,{text:i.body})]})]})}function Oa({className:t,icon:n,altText:i="notification icon",...o}){if(!n)return null;const r=w("io-notification-body-icon",t);return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsx("img",{src:n,alt:i})})}function Fa({text:t,...n}){return jsxRuntimeExports.jsx(I,{text:t,...n})}function Da({className:t,text:n,...i}){const o=w("io-notification-body-description",t);return jsxRuntimeExports.jsx("p",{className:o,...i,children:n})}function Ma({className:n,notification:i}){const o=w("io-notification-footer",n),{FooterButton:r}=ja(),a=useMemo((()=>function(e){const t=[],n={};e.forEach((e=>{const{displayId:i,displayPath:o}=e,r={...e,children:[]};if(o&&o.length>0){let e;o.forEach(((t,i)=>{0===i?e=n[t]:e&&(e=e.children?.find((e=>e.displayId===t)));})),e&&e.children?.push(r);}else i?(t.push(r),n[i]=r):t.push(r);i&&(n[i]=r);}));const i=e=>{e.forEach((e=>{e.children&&0===e.children.length?delete e.children:e.children&&i(e.children);}));};return i(t),t}(i.actions)),[i.actions]),s=(t,n)=>t.children?jsxRuntimeExports.jsx(bi,{text:t.title,children:t.children.map(s)},`${t.title}-${n}`):((t,n)=>jsxRuntimeExports.jsx(bi.Item,{children:jsxRuntimeExports.jsx(r,{variant:"link",className:"io-dropdown-menu-item io-dropdown-menu-button",notificationAction:t,notificationId:i.id})},`${t.title}-${n}`))(t,n);return jsxRuntimeExports.jsx("div",{className:o,children:jsxRuntimeExports.jsx($,{align:"right",children:a.map(((n,o)=>n.children?jsxRuntimeExports.jsxs($,{variant:"append",children:[jsxRuntimeExports.jsx(r,{notificationAction:n,variant:0===o?"primary":"default",notificationId:i.id}),jsxRuntimeExports.jsx(bi,{variant:0===o?"primary":"default",icon:"ellipsis",children:n.children.map(s)})]},`${n.title}-${o}`):jsxRuntimeExports.jsx(r,{notificationAction:n,variant:0===o?"primary":"link",notificationId:i.id},`${n.title}-${o}`)))})})}function za({notificationAction:t,notificationId:n,...i}){const{settings:o,setState:r,isPanelVisible:a}=Lr();return jsxRuntimeExports.jsx(A,{text:t.title,onClick:e=>{e.stopPropagation();const i="boolean"!=typeof o?.closeNotificationOnClick||o?.closeNotificationOnClick;a||i?t.onClick({close:i}):(t.onClick({close:!1}),r(n,"Acknowledged"));},...i})}const _a={Header:xa,HeaderCount:Ia,HeaderBadge:Ea,HeaderIcon:Aa,HeaderTitle:Ba,HeaderTimestamp:Ta,HeaderButtonSnooze:Pa,HeaderButtonClose:Ra,Body:La,BodyIcon:Oa,BodyTitle:Fa,BodyDescription:Da,Footer:Ma,FooterButton:za},Ha=createContext(_a),$a=memo((({children:t,components:n})=>{const i=useMemo((()=>({..._a,...n})),[n]);return jsxRuntimeExports.jsx(Ha.Provider,{value:i,children:t})}));function ja(e){return {...useContext(Ha),...e}}function Va({className:n,notification:i,...o}){const{Header:r,Body:a,Footer:s}=ja(),{severity:c}=i,l=w("io-notification",`severity-${c?.toLowerCase()??"none"}`,"Acknowledged"!==i.state&&"state-new",n);return jsxRuntimeExports.jsxs("div",{className:l,...o,children:[jsxRuntimeExports.jsx(r,{notification:i}),jsxRuntimeExports.jsx(a,{notification:i}),jsxRuntimeExports.jsx(s,{notification:i})]})}function Ua({components:t,notification:n,...i}){return jsxRuntimeExports.jsx($a,{components:t,children:jsxRuntimeExports.jsx(Va,{notification:n,...i})})}function Ja({className:n,notifications:i,...o}){const[a,s]=useState(!1),l=i.length>=3?"large":"normal",u=2===i.length?"small":l,d=i[0].severity,f=w("io-notification-stack",a&&"io-notification-stack-open","normal"!==u&&[`io-notification-stack-${u}`],d&&"None"!==d&&[`io-notification-stack-${d.toLowerCase()}`],n),h=useCallback((()=>{s(!0);}),[]),m=useCallback((e=>{e.stopPropagation(),i.forEach((e=>{e.close();}));}),[i]);return jsxRuntimeExports.jsxs("div",{className:f,onClick:h,...o,children:[a&&"normal"!==u&&jsxRuntimeExports.jsx("div",{className:"io-notification-stack-btn",children:jsxRuntimeExports.jsx(A,{icon:"close",onClick:e=>m(e),children:jsxRuntimeExports.jsx("span",{className:"io-btn-text",children:"Clear All"})})}),i.map((t=>jsxRuntimeExports.jsx(Ua,{notification:t},t.id)))]})}function Wa({className:n,Notification:i,notifications:o,noNotificationText:r="No notifications to display",...a}){const s=w("io-notification-list",n),{notifications:c,notificationStacks:l,settings:u,configuration:d,isPanelVisible:f,selectedNotifications:h,selectNotification:m,isBulkActionsSupported:p}=Lr(),{isBulkActionsVisible:g}=Fr(),{toastStacking:v}=u,b=o??c;return jsxRuntimeExports.jsx("div",{className:s,...a,children:v&&!f?l.length>0?l.map((t=>jsxRuntimeExports.jsx(Ja,{notifications:t.items},t.key))):jsxRuntimeExports.jsx("div",{className:"flex jc-center mt-8",children:r??""}):b.length>0?b.map((n=>{const o=d.sourceFilter?.muted?.includes(n.source)||d.sourceFilter?.muted?.includes("*");return !f&&o?null:f&&p&&g?jsxRuntimeExports.jsxs("div",{className:"io-notification-list-bulk-action-item "+(h.includes(n.id)?"selected":""),children:[jsxRuntimeExports.jsx(Pi,{checked:h.includes(n.id),onChange:e=>m(n.id,e.target.checked)}),jsxRuntimeExports.jsx(i,{notification:n})]},n.id):jsxRuntimeExports.jsx(i,{notification:n},n.id)})):jsxRuntimeExports.jsx("div",{className:"flex jc-center mt-8",children:r??""})})}$a.displayName="ComponentsStoreProvider";const qa={Header:Dr,HeaderCaption:Mr,HeaderCaptionFilter:zr,HeaderCaptionTitle:_r,HeaderCaptionCount:function({...t}){const{notificationsCount:n}=Fr();return jsxRuntimeExports.jsx(x,{...t,children:(n||0).toString()})},HeaderCaptionButtons:Hr,HeaderCaptionButtonSearch:function({...t}){const{isSearchVisible:n,showSearch:i,hideSearch:o,notificationsCount:r}=Fr();return jsxRuntimeExports.jsx(S,{icon:n?"search-filled":"search",variant:"circle",size:"32",onClick:n?o:i,disabled:0===r,...t})},HeaderCaptionButtonSettings:function({icon:t="cog",size:n="32",variant:i="circle",...o}){const{showSettings:r}=Fr();return jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i,onClick:r,...o})},HeaderCaptionButtonClose:function({icon:t="close",size:n="32",variant:i="circle",...o}){const{hidePanel:r}=Lr();return jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i,onClick:r,...o})},HeaderActions:function({className:n,...i}){const o=w("io-panel-header-actions",n),{HeaderActionSort:r,HeaderActionView:a,HeaderActionClear:s,HeaderActionEdit:c}=Ya();return jsxRuntimeExports.jsxs("div",{className:o,...i,children:[jsxRuntimeExports.jsxs($,{children:[jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{})]}),jsxRuntimeExports.jsxs($,{children:[jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(c,{})]})]})},HeaderActionSort:function({text:n="Sort by",...i}){const{sortNotificationsBy:o,setSortBy:a}=Fr(),{onNotificationsSort:s}=(()=>{const{notifications:e}=Lr(),[t,n]=useState(Jr),{key:i,descending:o}=t,a=useMemo((()=>Gr[i](e,o)),[e,i,o]),s=useCallback((e=>{n((t=>({key:e,descending:t.key!==e?Jr.descending:!t.descending})));}),[]);return {onNotificationsSort:s,sortedNotifications:a}})();return jsxRuntimeExports.jsxs(H,{variant:"light",...i,children:[jsxRuntimeExports.jsxs(H.Button,{variant:"link",children:[n," ",jsxRuntimeExports.jsx("strong",{children:o})]}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",checkIcon:"check",children:["Newest","Oldest","Severity"].map((t=>jsxRuntimeExports.jsx(H.Item,{isSelected:o===t.toLowerCase(),onClick:()=>{a(t.toLowerCase()),s(t.toLowerCase());},children:t},t)))})})]})},HeaderActionView:function({text:n="View",...i}){const{settings:o}=Lr(),{viewNotificationsBy:r,setViewBy:a}=Fr(),s=o.snooze?.enabled?["All","Read","Unread","Snoozed"]:["All","Read","Unread"];return jsxRuntimeExports.jsxs(H,{variant:"light",...i,children:[jsxRuntimeExports.jsxs(H.Button,{variant:"link",children:[n," ",jsxRuntimeExports.jsx("strong",{children:r})]}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",checkIcon:"check",children:s.map((t=>jsxRuntimeExports.jsx(H.Item,{isSelected:r===t.toLowerCase(),onClick:()=>a(t.toLowerCase()),children:t},t)))})})]})},HeaderActionClear:function({text:t="Clear All",...n}){const{clearAll:i}=Lr(),{notificationsCount:o}=Fr();return jsxRuntimeExports.jsx(A,{variant:"link",text:t,onClick:i,disabled:0===o,...n})},HeaderActionEdit:function({tooltip:t="Bulk Edit",...n}){const{isBulkActionsSupported:i}=Lr(),{showBulkActions:o,notificationsCount:r}=Fr();return i?jsxRuntimeExports.jsx(S,{icon:"pen-to-square",title:t,size:"32",onClick:o,disabled:0===r,...n}):null},HeaderBulkActions:function({className:n,...i}){const o=w("io-panel-header-bulk-actions",n),{HeaderBulkActionSelect:r,HeaderBulkActionSelectDropdown:a,HeaderBulkActionMarkAsRead:s,HeaderBulkActionMarkAsUnread:c,HeaderBulkActionSnooze:l,HeaderBulkActionClear:u,HeaderBulkActionClose:d}=Ya(),{isBulkActionsSupported:f}=Lr();return f?jsxRuntimeExports.jsx("div",{className:o,...i,children:jsxRuntimeExports.jsxs($,{children:[jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(c,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(u,{}),jsxRuntimeExports.jsx(d,{})]})}):null},HeaderBulkActionSelect:function({...t}){const{isBulkActionsSupported:n,selectedNotifications:i,selectAllNotifications:o}=Lr(),{notificationsCount:r}=Fr();return n?jsxRuntimeExports.jsx(Pi,{checked:r===i.length&&r>0,onChange:e=>o("all",e.target.checked),disabled:0===r,...t}):null},HeaderBulkActionSelectDropdown:function({...n}){const{isBulkActionsSupported:i,selectAllNotifications:o}=Lr(),{notificationsCount:r}=Fr();return i?jsxRuntimeExports.jsxs(H,{variant:"light",...n,children:[jsxRuntimeExports.jsx(H.ButtonIcon,{variant:"default",icon:"chevron-down",size:"16",iconSize:"10",disabled:0===r}),jsxRuntimeExports.jsx(T,{children:jsxRuntimeExports.jsxs(H.List,{variant:"single",checkIcon:"check",children:[jsxRuntimeExports.jsx(H.ItemSection,{children:"Select"}),["All","Read","Unread","Snoozed"].map((t=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>o(t.toLowerCase(),!0),children:t},t)))]})})]}):null},HeaderBulkActionMarkAsRead:function({icon:t="envelope-open",size:n="32",variant:i="circle",tooltip:o="Mark as read",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,setStates:l}=Lr(),{notificationsCount:u}=Fr(),d=useCallback((()=>{l(c,"Seen");}),[c,l]);return s?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i,title:o,onClick:d,disabled:0===u,...a}):null},HeaderBulkActionMarkAsUnread:function({icon:t="envelope",size:n="32",variant:i="circle",tooltip:o="Mark as unread",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,setStates:l}=Lr(),{notificationsCount:u}=Fr(),d=useCallback((()=>{l(c,"Active");}),[c,l]);return s?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i,title:o,onClick:d,disabled:0===u,...a}):null},HeaderBulkActionSnooze:function({icon:t="snooze",size:n="32",variant:i="circle",tooltip:o="Snooze",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,snoozeMany:l,settings:u}=Lr(),{notificationsCount:d}=Fr(),f=useCallback((()=>{l(c,u.snooze?.duration??0);}),[c,l,u.snooze?.duration]);return s&&u.snooze?.enabled?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i,title:o,onClick:f,disabled:0===d,...a}):null},HeaderBulkActionClear:function({icon:t="trash",size:n="32",variant:i="circle",tooltip:o="Clear",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,clearMany:l}=Lr(),{notificationsCount:u}=Fr(),d=useCallback((()=>{l(c);}),[c,l]);return s?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i,title:o,onClick:d,disabled:0===u,...a}):null},HeaderBulkActionClose:function({text:t="Done",variant:n="primary",...i}){const{isBulkActionsSupported:o}=Lr(),{hideBulkActions:r,notificationsCount:a}=Fr();return o?jsxRuntimeExports.jsx(A,{variant:n,text:t,onClick:r,disabled:0===a,...i}):null},HeaderSearch:function({className:n,icon:i="search",placeholder:o="Search",...r}){const a=w("io-panel-header-search",n),{isSearchVisible:s,searchQuery:c,setSearch:l,notificationsCount:f}=Fr(),h=useRef(null);return useEffect((()=>{s?h.current?.focus():(h.current?.blur(),l(""));}),[s,l]),s?jsxRuntimeExports.jsxs("div",{className:a,children:[jsxRuntimeExports.jsx(Bi,{ref:h,value:c,iconPrepend:i,placeholder:o,onChange:e=>l(e.target.value),...r}),s&&c.length>0&&jsxRuntimeExports.jsx("p",{className:"io-panel-header-search-count",children:`${f} results`})]}):null},Body:Yr,Footer:Qr,FooterButtons:Xr,FooterButtonClearAll:Zr,FooterButtonClearAllOld:ea,Notification:Ua,NotificationsList:Wa,Settings:ta,SettingsGeneral:na,SettingsAllowNotifications:ia,SettingsShowNotificationBadge:oa,SettingsCloseNotificationOnClick:ra,SettingsPanelAutoHide:aa,SettingsPanelAlwaysOnTop:sa,SettingsHideToastsAfter:ca,SettingsMarkAsNew:la,SettingsMarkAsRead:ua,SettingsStacking:da,SettingsToastStacking:fa,SettingsToastStackBy:ma,SettingsPlacement:pa,SettingsPlacementPanel:ga,SettingsPlacementToasts:va,SettingsSnooze:ba,SettingsSnoozeDuration:ya,SettingsSubscriptions:wa,SettingsSubscribeAll:ka,SettingsSubscribeApp:Sa,SettingsSubscribeMuteAll:Na,SettingsSubscribeMuteApp:Ca},Ka=createContext(qa),Ga=memo((({children:t,components:n})=>{const i=useMemo((()=>({...qa,...n})),[n]);return jsxRuntimeExports.jsx(Ka.Provider,{value:i,children:t})}));function Ya(e){return {...useContext(Ka),...e}}Ga.displayName="ComponentsStoreProvider";const Za={Body:function({className:t,notifications:n,maxToasts:i=1,...o}){const r=w("io-toasts-body",t),{NotificationsList:a,Notification:s}=ns(),[l,d]=useState([]);return useEffect((()=>{const e=i<0?n.length:i,t=n.filter((e=>"Active"===e.state)).slice(0,e);for(const e of t)e.onShow();d(t);}),[n,i]),jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsx(a,{Notification:s,notifications:l,noNotificationText:""})})},Notification:Ua,NotificationsList:Wa},es=createContext(Za),ts=memo((({children:t,components:n})=>{const i=useMemo((()=>({...Za,...n})),[n]);return jsxRuntimeExports.jsx(es.Provider,{value:i,children:t})}));function ns(e){return {...useContext(es),...e}}ts.displayName="ComponentsStoreProvider";const as=n=>{const{General:i,Layouts:o,Widget:r}=Fs();return jsxRuntimeExports.jsxs(Si,{...n,children:[jsxRuntimeExports.jsx(i,{}),jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{})]})},ss=({className:t,title:n="General",...i})=>{const{Theme:o}=Fs();return jsxRuntimeExports.jsx(E,{className:w("io-block io-block-list-gap",t),title:n,...i,children:jsxRuntimeExports.jsx(o,{})})},cs=({className:n,title:i="Layouts",...o})=>{const{LayoutsShowDeletePrompt:r,LayoutsShowUnsavedChangesPrompt:a}=Fs();return jsxRuntimeExports.jsxs(E,{className:w("io-block io-block-list-gap",n),title:i,...o,children:[jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{})]})},ls="layoutsShowDeletePrompt",us="layoutsShowUnsavedChangesPrompt",ds="widgetEnableForExternalApps";var fs=function(e){return {ok:!0,result:e}},hs=function(e){return {ok:!1,error:e}},ms=function(e,t,n){return !1===t.ok?t:!1===n.ok?n:fs(e(t.result,n.result))},ps=function(e,t){return !0===t.ok?t:hs(e(t.error))},gs=function(){return gs=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},gs.apply(this,arguments)};function vs(e,t){if(e===t)return !0;if(null===e&&null===t)return !0;if(typeof e!=typeof t)return !1;if("object"==typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return !1;if(e.length!==t.length)return !1;for(var n=0;n<e.length;n++)if(!vs(e[n],t[n]))return !1;return !0}var i=Object.keys(e);if(i.length!==Object.keys(t).length)return !1;for(n=0;n<i.length;n++){if(!t.hasOwnProperty(i[n]))return !1;if(!vs(e[i[n]],t[i[n]]))return !1}return !0}}var bs=function(e){return Array.isArray(e)},ys=function(e){return "object"==typeof e&&null!==e&&!bs(e)},ws=function(e,t){return "expected "+e+", got "+function(e){switch(typeof e){case"string":return "a string";case"number":return "a number";case"boolean":return "a boolean";case"undefined":return "undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},ks=function(e){return e.map((function(e){return "string"==typeof e?"."+e:"["+e+"]"})).join("")},Ss=function(e,t){var n=t.at,i=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]]);}return n}(t,["at"]);return gs({at:e+(n||"")},i)},Ns=function(){function e(t){var n=this;this.decode=t,this.run=function(e){return ps((function(t){return {kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}}),n.decode(e))},this.runPromise=function(e){return function(e){return !0===e.ok?Promise.resolve(e.result):Promise.reject(e.error)}(n.run(e))},this.runWithException=function(e){return function(e){if(!0===e.ok)return e.result;throw e.error}(n.run(e))},this.map=function(t){return new e((function(e){return function(e,t){return !0===t.ok?fs(e(t.result)):t}(t,n.decode(e))}))},this.andThen=function(t){return new e((function(e){return function(e,t){return !0===t.ok?e(t.result):t}((function(n){return t(n).decode(e)}),n.decode(e))}))},this.where=function(t,i){return n.andThen((function(n){return t(n)?e.succeed(n):e.fail(i)}))};}return e.string=function(){return new e((function(e){return "string"==typeof e?fs(e):hs({message:ws("a string",e)})}))},e.number=function(){return new e((function(e){return "number"==typeof e?fs(e):hs({message:ws("a number",e)})}))},e.boolean=function(){return new e((function(e){return "boolean"==typeof e?fs(e):hs({message:ws("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return vs(e,t)?fs(t):hs({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(ys(e)&&t){var n={};for(var i in t)if(t.hasOwnProperty(i)){var o=t[i].decode(e[i]);if(!0!==o.ok)return void 0===e[i]?hs({message:"the key '"+i+"' is required but was not present"}):hs(Ss("."+i,o.error));void 0!==o.result&&(n[i]=o.result);}return fs(n)}return ys(e)?fs(e):hs({message:ws("an object",e)})}))},e.array=function(t){return new e((function(e){if(bs(e)&&t){return e.reduce((function(e,n,i){return ms((function(e,t){return e.concat([t])}),e,function(e,n){return ps((function(e){return Ss("["+n+"]",e)}),t.decode(e))}(n,i))}),fs([]))}return bs(e)?fs(e):hs({message:ws("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(bs(e)){if(e.length!==t.length)return hs({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var n=[],i=0;i<t.length;i++){var o=t[i].decode(e[i]);if(!o.ok)return hs(Ss("["+i+"]",o.error));n[i]=o.result;}return fs(n)}return hs({message:ws("a tuple of length "+t.length,e)})}))},e.union=function(t,n){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.oneOf.apply(e,[t,n].concat(i))},e.intersection=function(t,n){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return new e((function(e){return [t,n].concat(i).reduce((function(t,n){return ms(Object.assign,t,n.decode(e))}),fs({}))}))},e.anyJson=function(){return new e((function(e){return fs(e)}))},e.unknownJson=function(){return new e((function(e){return fs(e)}))},e.dict=function(t){return new e((function(e){if(ys(e)){var n={};for(var i in e)if(e.hasOwnProperty(i)){var o=t.decode(e[i]);if(!0!==o.ok)return hs(Ss("."+i,o.error));n[i]=o.result;}return fs(n)}return hs({message:ws("an object",e)})}))},e.optional=function(t){return new e((function(e){return null==e?fs(void 0):t.decode(e)}))},e.oneOf=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new e((function(e){for(var n=[],i=0;i<t.length;i++){var o=t[i].decode(e);if(!0===o.ok)return o;n[i]=o.error;}var r=n.map((function(e){return "at error"+(e.at||"")+": "+e.message})).join('", "');return hs({message:'expected a value matching one of the decoders, got the errors ["'+r+'"]'})}))},e.withDefault=function(t,n){return new e((function(e){return fs(function(e,t){return !0===t.ok?t.result:e}(t,n.decode(e)))}))},e.valueAt=function(t,n){return new e((function(e){for(var i=e,o=0;o<t.length;o++){if(void 0===i)return hs({at:ks(t.slice(0,o+1)),message:"path does not exist"});if("string"==typeof t[o]&&!ys(i))return hs({at:ks(t.slice(0,o+1)),message:ws("an object",i)});if("number"==typeof t[o]&&!bs(i))return hs({at:ks(t.slice(0,o+1)),message:ws("an array",i)});i=i[t[o]];}return ps((function(e){return void 0===i?{at:ks(t),message:"path does not exist"}:Ss(ks(t),e)}),n.decode(i))}))},e.succeed=function(t){return new e((function(e){return fs(t)}))},e.fail=function(t){return new e((function(e){return hs({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}();Ns.string,Ns.number;var Cs=Ns.boolean;Ns.anyJson,Ns.unknownJson,Ns.constant,Ns.object,Ns.array,Ns.tuple,Ns.dict,Ns.optional,Ns.oneOf,Ns.union,Ns.intersection,Ns.withDefault,Ns.valueAt,Ns.succeed,Ns.fail,Ns.lazy;const xs=Cs(),Is=({prefKey:t,...n})=>{const{isLoading:i,value:o=!1,update:r}=Mi({app:"io-connect-platform",prefKey:t,decoder:xs});return jsxRuntimeExports.jsx(Li,{checked:o,disabled:i,onChange:e=>r(e.target.checked),...n})},Es=({align:t="right",label:n="Show prompt for deleting",...i})=>jsxRuntimeExports.jsx(Is,{align:t,label:n,prefKey:ls,...i}),As=({align:t="right",label:n="Show prompt for unsaved changes",...i})=>jsxRuntimeExports.jsx(Is,{align:t,label:n,prefKey:us,...i}),Bs=({className:n,title:i="Theme",...o})=>{const{currentTheme:a,selectTheme:l}=(()=>{const e=useContext(IOConnectContext),[t,n]=useState(null),i=useCallback((t=>e?.themes?.select(t)),[e]);return useEffect((()=>{if(!e)return;let t=!1;const i=e=>{t||n(e);};return e.themes?.onChanged(i),e.themes?.getCurrent().then(i).catch(console.warn),()=>{t=!0;}}),[e]),{currentTheme:t,selectTheme:i}})(),d=(()=>{const e=useContext(IOConnectContext),[t,n]=useState([]);return useEffect((()=>{e&&e.themes?.list().then(n).catch(console.warn);}),[e]),t})();return jsxRuntimeExports.jsxs("div",{className:w("flex jc-between ai-center",n),...o,children:[jsxRuntimeExports.jsx("label",{className:"io-text-clipper",children:i}),jsxRuntimeExports.jsxs(H,{variant:"light",children:[jsxRuntimeExports.jsx(H.Button,{text:a?.displayName}),jsxRuntimeExports.jsx(H.Content,{children:jsxRuntimeExports.jsx(H.List,{variant:"single",children:d.map((({name:t,displayName:n})=>jsxRuntimeExports.jsx(H.Item,{onClick:()=>l(t),children:n},t)))})})]})]})},Ts=({className:t,title:n="Widget",...i})=>{const{WidgetEnableForExternalApps:o}=Fs();return jsxRuntimeExports.jsx(E,{className:w("io-block io-block-list-gap",t),title:n,...i,children:jsxRuntimeExports.jsx(o,{})})},Ps=({align:t="right",label:n="Enable for external apps",...i})=>jsxRuntimeExports.jsx(Is,{align:t,label:n,prefKey:ds,...i}),Rs={Body:as,General:ss,Layouts:cs,LayoutsShowDeletePrompt:Es,LayoutsShowUnsavedChangesPrompt:As,Theme:Bs,Widget:Ts,WidgetEnableForExternalApps:Ps},Ls=createContext(Rs),Os=memo((({children:t,components:n})=>{const i=useMemo((()=>({...Rs,...n})),[n]);return jsxRuntimeExports.jsx(Ls.Provider,{value:i,children:t})}));Os.displayName="PreferencesPanelComponentsStoreProvider";const Fs=()=>useContext(Ls);
1131
1175
 
1132
1176
  const getInitialType = (glueController) => {
1133
1177
  const type = glueController.config.channelSelector?.type;
@@ -1144,64 +1188,54 @@ const getChannelRestrictions = async (glueController, name) => {
1144
1188
  return { read, write };
1145
1189
  };
1146
1190
 
1147
- const { ChannelSelector } = Ae;
1148
- const ChannelSelectorWrapper = ({ mode }) => {
1149
- const glueController = useContext(GlueControllerContext);
1191
+ const { ChannelSelector } = mo;
1192
+ const ChannelSelectorWrapper = ({ mode, channelsDisplayMode }) => {
1193
+ const glueController = useGlueController();
1150
1194
  const [variantToggle, setVariantToggle] = useState(true);
1151
1195
  const [channelsInfo, setChannelsInfo] = useState([]);
1152
1196
  const [type, setType] = useState(getInitialType(glueController));
1153
- const handleSingleChannelSelect = useCallback(async ({ name }) => {
1197
+ const handleOnChannelSelect = useCallback(async ({ name }) => {
1154
1198
  const channel = channelsInfo.find((ch) => ch.name === name);
1155
1199
  if (channel?.isSelected) {
1156
1200
  setChannelsInfo(channels => channels.map((ch) => ({ ...ch, isSelected: false, read: false, write: false })));
1157
1201
  return glueController.io.channels.leave();
1158
1202
  }
1203
+ const { read, write } = await getChannelRestrictions(glueController, name);
1204
+ setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected: true, read, write }) : ({ ...ch, isSelected: false, read: false, write: false })));
1159
1205
  await glueController.io.channels.join(name);
1160
- if (!variantToggle) {
1161
- setChannelsInfo(channels => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected: true }) : ({ ...ch, isSelected: false })));
1206
+ }, [channelsInfo, glueController]);
1207
+ const handleOnChannelRestrict = useCallback(async ({ name, read, write }) => {
1208
+ if (type === 'single' || typeof glueController.io.channels.restrict !== "function") {
1162
1209
  return;
1163
1210
  }
1164
- const { read, write } = await getChannelRestrictions(glueController, name);
1165
- setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected: true, read, write }) : ({ ...ch, isSelected: false, read: false, write: false })));
1166
- }, [glueController, channelsInfo, variantToggle]);
1167
- const handleDirectionalChannelSelect = useCallback(async ({ name, isSelected, read, write }) => {
1168
- if (isSelected && !read && !write) {
1211
+ if (!read && !write) {
1169
1212
  setChannelsInfo((channels) => channels.map((ch) => ({ ...ch, isSelected: false, read: false, write: false })));
1170
1213
  await glueController.io.channels.restrict({ name, read, write });
1171
1214
  return glueController.io.channels.leave();
1172
1215
  }
1173
- if (!isSelected && !read && !write) {
1174
- setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected, read, write }) : ({ ...ch, isSelected: false, write: false, read: false })));
1175
- return glueController.io.channels.leave();
1176
- }
1177
- const prevSelectedIsTheSame = channelsInfo.find((ch) => ch.isSelected && ch.name === name);
1178
- if (prevSelectedIsTheSame) {
1179
- await glueController.io.channels.restrict({ name, read, write });
1180
- setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected, read, write }) : ({ ...ch, isSelected: false, write: false, read: false })));
1181
- return;
1182
- }
1183
- await glueController.io.channels.join(name);
1184
- if (!read || !write) {
1185
- await glueController.io.channels.restrict({ name, read, write });
1186
- }
1187
- setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected: true, read, write }) : ({ ...ch, isSelected: false, write: false, read: false })));
1188
- }, [glueController, channelsInfo]);
1216
+ setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? { ...ch, isSelected: true, read, write } : { ...ch, isSelected: false, read: false, write: false }));
1217
+ await glueController.io.channels.restrict({ name, read, write });
1218
+ }, [glueController.io.channels, type]);
1189
1219
  const onTypeChange = (checked) => {
1190
1220
  setType(checked ? "directionalSingle" : "single");
1191
1221
  };
1192
1222
  const getChannels = useCallback(async () => {
1193
1223
  const allChannels = await glueController.io.channels.list();
1194
1224
  const myCurrentChannel = await glueController.io.channels.getMy();
1195
- const channelsInfo = await Promise.all(allChannels.map(async (ch) => {
1225
+ const channelsToParse = channelsDisplayMode === "all" ? allChannels : allChannels.filter((ch) => ch.meta?.fdc3);
1226
+ const channelsInfo = await Promise.all(channelsToParse.map(async (ch) => {
1196
1227
  const restrictions = typeof glueController.io.channels.getRestrictions === "function" ? await glueController.io.channels.getRestrictions() : { channels: [] };
1197
1228
  const channelRestrictions = restrictions.channels.find((restriction) => restriction.name === ch.name);
1229
+ const isSelected = ch.name === myCurrentChannel?.name;
1230
+ const read = typeof channelRestrictions?.read === "boolean" ? channelRestrictions.read : true;
1231
+ const write = typeof channelRestrictions?.write === "boolean" ? channelRestrictions.write : true;
1198
1232
  return {
1199
1233
  color: ch.meta.color,
1200
1234
  name: ch.name,
1201
- isSelected: ch.name === myCurrentChannel?.name,
1202
1235
  label: ch.name[0],
1203
- read: !!channelRestrictions?.read,
1204
- write: !!channelRestrictions?.write
1236
+ isSelected,
1237
+ read: isSelected ? read : false,
1238
+ write: isSelected ? write : false
1205
1239
  };
1206
1240
  }));
1207
1241
  setChannelsInfo(channelsInfo);
@@ -1239,57 +1273,58 @@ const ChannelSelectorWrapper = ({ mode }) => {
1239
1273
  };
1240
1274
  handleBtnBackgroundChange();
1241
1275
  }, [channelsInfo]);
1242
- return (React.createElement(L, { onClick: getChannels },
1243
- mode === "default" ? (React.createElement(L.ButtonIcon, { className: "io-btn-icon", icon: "link", iconSize: "16", size: "32", variant: "circle" })) : (React.createElement(L.Button, { icon: "link", text: "Select Channel", iconRight: false })),
1244
- React.createElement(L.Content, null,
1245
- React.createElement(ChannelSelector, { className: "io-list-channels", variant: type, channels: channelsInfo, onChannelSelect: type === "single" ? handleSingleChannelSelect : handleDirectionalChannelSelect, variantToggle: variantToggle, onVariantChange: onTypeChange }))));
1276
+ return (i__default.createElement(H, { onClick: getChannels, variant: "outline" },
1277
+ mode === "default" ? (i__default.createElement(H.ButtonIcon, { className: "io-btn-icon", icon: "link", iconSize: "16", size: "32", variant: "circle" })) : (i__default.createElement(H.Item, { append: i__default.createElement(k, { variant: "chevron-right", size: "10" }) },
1278
+ i__default.createElement(H.Button, { variant: "link", icon: "link", text: "Select Channel", iconRight: false }))),
1279
+ i__default.createElement(H.Content, null,
1280
+ i__default.createElement(ChannelSelector, { className: "io-list-channels", variant: type, channels: channelsInfo, onChannelSelect: handleOnChannelSelect, variantToggle: variantToggle, onVariantChange: onTypeChange, onChannelRestrict: handleOnChannelRestrict }))));
1246
1281
  };
1247
1282
 
1248
1283
  const PositionDropdown = ({ position, positionClickHandler }) => {
1249
1284
  const positions = ["bottom", "left", "right", "top"].map((p) => {
1250
- return (React.createElement(L.Item, { key: p, isSelected: p === position, onClick: () => positionClickHandler(p) }, p[0].toUpperCase() + p.slice(1)));
1285
+ return (i__default.createElement(H.Item, { key: p, isSelected: p === position, onClick: () => positionClickHandler(p) }, p[0].toUpperCase() + p.slice(1)));
1251
1286
  });
1252
- return (React.createElement(L.List, { variant: "single", checkIcon: "check" },
1253
- React.createElement(L.ItemSection, null, "Widget Position"),
1287
+ return (i__default.createElement(H.List, { variant: "single", checkIcon: "check" },
1288
+ i__default.createElement(H.ItemSection, null, "Widget Position"),
1254
1289
  positions));
1255
1290
  };
1256
1291
 
1257
1292
  const ModeDropdown = ({ mode, modeClickHandler }) => {
1258
- return (React.createElement(L.List, null,
1259
- React.createElement(L.ItemSection, null, "Widget Mode"),
1260
- React.createElement(L.Item, null,
1261
- React.createElement(ee, { label: "Compact", align: "right", checked: mode === "compact", onChange: () => modeClickHandler(mode === "compact" ? "default" : "compact") }))));
1293
+ return (i__default.createElement(H.List, null,
1294
+ i__default.createElement(H.ItemSection, null, "Widget Mode"),
1295
+ i__default.createElement(H.Item, null,
1296
+ i__default.createElement(Li, { label: "Compact", align: "right", checked: mode === "compact", onChange: () => modeClickHandler(mode === "compact" ? "default" : "compact") }))));
1262
1297
  };
1263
1298
 
1264
1299
  const Settings = ({ position, positionClickHandler, mode, modeClickHandler }) => {
1265
- return (React.createElement(L, { align: "up" },
1266
- React.createElement(L.ButtonIcon, { className: "io-btn-icon", icon: "cog", iconSize: "16", size: "32", variant: "circle" }),
1267
- React.createElement(L.Content, null,
1268
- React.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
1269
- React.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
1300
+ return (i__default.createElement(H, { align: "up", variant: "outline" },
1301
+ i__default.createElement(H.ButtonIcon, { className: "io-btn-icon", icon: "cog", iconSize: "16", size: "32", variant: "circle" }),
1302
+ i__default.createElement(H.Content, null,
1303
+ i__default.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
1304
+ i__default.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
1270
1305
  };
1271
1306
 
1272
- const DefaultWidget = ({ showBringBackToWspBtn, handleBringBackToWspClick, showChannelSelectorBtn, position, positionClickHandler, mode, modeClickHandler, }) => {
1273
- return (React.createElement(z, { align: "left", className: "io-btn-group", variant: "default" },
1274
- showChannelSelectorBtn ? React.createElement(ChannelSelectorWrapper, { mode: mode }) : null,
1275
- showBringBackToWspBtn ? (React.createElement(B, { className: "io-btn-icon", icon: "pop-in-widget", iconSize: "16", size: "32", variant: "circle", onClick: handleBringBackToWspClick })) : null,
1276
- React.createElement(Settings, { position: position, positionClickHandler: positionClickHandler, mode: mode, modeClickHandler: modeClickHandler })));
1307
+ const DefaultWidget = ({ showBringBackToWspBtn, handleBringBackToWspClick, showChannelSelectorBtn, position, positionClickHandler, mode, modeClickHandler, channelsDisplayMode }) => {
1308
+ return (i__default.createElement($, { align: "left", className: "io-btn-group", variant: "default" },
1309
+ showChannelSelectorBtn ? i__default.createElement(ChannelSelectorWrapper, { mode: mode, channelsDisplayMode: channelsDisplayMode }) : null,
1310
+ showBringBackToWspBtn ? (i__default.createElement(S, { className: "io-btn-icon", icon: "pop-in-widget", iconSize: "16", size: "32", variant: "circle", onClick: handleBringBackToWspClick })) : null,
1311
+ i__default.createElement(Settings, { position: position, positionClickHandler: positionClickHandler, mode: mode, modeClickHandler: modeClickHandler })));
1277
1312
  };
1278
1313
 
1279
- const CompactWidget = ({ position, positionClickHandler, mode, modeClickHandler, handleBringBackToWspClick, showBringBackToWspBtn, showChannelSelectorBtn, }) => {
1280
- return (React.createElement(L, null,
1281
- React.createElement(L.ButtonIcon, { className: "io-btn-icon", iconSize: "16", size: "32", variant: "circle" }),
1282
- React.createElement(L.Content, null,
1283
- React.createElement(L.ItemSection, null, "App"),
1284
- React.createElement(L.List, null,
1285
- showBringBackToWspBtn ? (React.createElement(L.Item, { onClick: handleBringBackToWspClick, prepend: React.createElement(y, { variant: "pop-in-widget" }) }, "Pop In")) : null,
1286
- showChannelSelectorBtn ? React.createElement(ChannelSelectorWrapper, { mode: mode }) : null),
1287
- React.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
1288
- React.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
1314
+ const CompactWidget = ({ position, positionClickHandler, mode, modeClickHandler, channelsDisplayMode, handleBringBackToWspClick, showBringBackToWspBtn, showChannelSelectorBtn, }) => {
1315
+ return (i__default.createElement(H, { variant: "outline" },
1316
+ i__default.createElement(H.ButtonIcon, { icon: "logo", className: "io-btn-icon", iconSize: "16", size: "32", variant: "circle" }),
1317
+ i__default.createElement(H.Content, null,
1318
+ i__default.createElement(H.ItemSection, null, "App"),
1319
+ i__default.createElement(H.List, null,
1320
+ showBringBackToWspBtn ? (i__default.createElement(H.Item, { onClick: handleBringBackToWspClick, prepend: i__default.createElement(k, { variant: "pop-in-widget" }) }, "Pop In")) : null,
1321
+ showChannelSelectorBtn ? i__default.createElement(ChannelSelectorWrapper, { mode: mode, channelsDisplayMode: channelsDisplayMode }) : null),
1322
+ i__default.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
1323
+ i__default.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
1289
1324
  };
1290
1325
 
1291
1326
  const Widget = () => {
1292
- const glueController = useContext(GlueControllerContext);
1327
+ const glueController = useGlueController();
1293
1328
  const [position, setPosition] = useState(glueController.config.position ?? "bottom");
1294
1329
  const [mode, setMode] = useState(glueController.config.mode ?? "default");
1295
1330
  const [showBringBackToWspBtn, setShowBringBackToWspBtn] = useState(false);
@@ -1332,13 +1367,14 @@ const Widget = () => {
1332
1367
  };
1333
1368
  const getWidgetProps = () => {
1334
1369
  return {
1335
- showChannelSelectorBtn: glueController.config.channelSelector?.enable ?? true,
1370
+ showChannelSelectorBtn: glueController.config.channels?.selector?.enable ?? true,
1336
1371
  position,
1337
1372
  positionClickHandler,
1338
1373
  mode,
1339
1374
  modeClickHandler,
1340
1375
  showBringBackToWspBtn,
1341
- handleBringBackToWspClick
1376
+ handleBringBackToWspClick,
1377
+ channelsDisplayMode: glueController.config.channels?.displayMode ?? "all",
1342
1378
  };
1343
1379
  };
1344
1380
  const handleBringBackToWspClick = useCallback(async () => {
@@ -1351,9 +1387,9 @@ const Widget = () => {
1351
1387
  setShowBringBackToWspBtn(false);
1352
1388
  }
1353
1389
  }, [glueController]);
1354
- return (React.createElement("div", { className: getWidgetClassName(), draggable: "true", onDragEnd: handleDragEnd, role: "button", tabIndex: 0 },
1355
- React.createElement(DragSection, null),
1356
- mode === "default" ? (React.createElement(DefaultWidget, { ...getWidgetProps() })) : (React.createElement(CompactWidget, { ...getWidgetProps() }))));
1390
+ return (i__default.createElement("div", { className: getWidgetClassName(), draggable: "true", onDragEnd: handleDragEnd, role: "button", tabIndex: 0 },
1391
+ i__default.createElement(DragSection, null),
1392
+ mode === "default" ? (i__default.createElement(DefaultWidget, { ...getWidgetProps() })) : (i__default.createElement(CompactWidget, { ...getWidgetProps() }))));
1357
1393
  };
1358
1394
 
1359
1395
  class DOMController {
@@ -1364,31 +1400,24 @@ class DOMController {
1364
1400
  async attachWidget() {
1365
1401
  const domNode = document.createElement("div");
1366
1402
  const root = createRoot(domNode);
1367
- const GlueControllerContext = createGlueControllerContext(this.glueController);
1368
- root.render(React.createElement(GlueControllerContext.Provider, { value: this.glueController },
1369
- React.createElement(Widget, null)));
1403
+ root.render(i__default.createElement(CustomGlueControllerProvider, { glueController: this.glueController },
1404
+ i__default.createElement(Widget, null)));
1370
1405
  document.body.appendChild(domNode);
1371
1406
  }
1372
1407
  }
1373
1408
 
1374
1409
  class GlueController {
1375
- _io;
1376
- _config;
1377
1410
  bridge;
1411
+ io;
1412
+ config;
1378
1413
  _windowId;
1379
1414
  _logger;
1380
- constructor(_io, _config, bridge) {
1381
- this._io = _io;
1382
- this._config = _config;
1415
+ constructor(bridge, io, config) {
1383
1416
  this.bridge = bridge;
1384
- this._windowId = this._io.windows.my().id;
1385
- this._logger = this._io.logger.subLogger(`widget-${this._windowId}`);
1386
- }
1387
- get io() {
1388
- return this._io;
1389
- }
1390
- get config() {
1391
- return this._config;
1417
+ this.io = io;
1418
+ this.config = config;
1419
+ this._windowId = io.windows.my().id;
1420
+ this._logger = this.io.logger.subLogger(`widget-${this._windowId}`);
1392
1421
  }
1393
1422
  get logger() {
1394
1423
  return this._logger;
@@ -1489,24 +1518,38 @@ class IoC {
1489
1518
  }
1490
1519
  get glueController() {
1491
1520
  if (!this._glueController) {
1492
- this._glueController = new GlueController(this.io, this.config, this.bridge);
1521
+ this._glueController = new GlueController(this.bridge, this.io, this.config);
1493
1522
  }
1494
1523
  return this._glueController;
1495
1524
  }
1496
1525
  }
1497
1526
 
1498
1527
  const IOBrowserWidgetFactory = async (io, config) => {
1499
- const widgetConfig = config?.widget ? configDecoder.runWithException(config.widget) : defaultConfig;
1500
- const ioc = new IoC(io, widgetConfig);
1501
- const logger = ioc.glueController.getLogger(`widget.factory-${io.windows.my().id}`);
1528
+ const validatedConfig = configDecoder.runWithException(config);
1529
+ const ioc = new IoC(io, validatedConfig);
1502
1530
  const baseErrorMessage = `Widget won't be shown. Reason:`;
1531
+ const windowId = io.windows.my().id;
1532
+ if (!windowId) {
1533
+ console.error(`${baseErrorMessage} There's no windowID associated with this client`);
1534
+ return;
1535
+ }
1536
+ const logger = ioc.glueController.getLogger(`widget.factory-${windowId}`);
1537
+ if (!validatedConfig.enable) {
1538
+ logger.warn(`${baseErrorMessage} It's disabled by config`);
1539
+ return;
1540
+ }
1541
+ const widgetElementExists = document.getElementsByClassName("io-window-widget").length;
1542
+ if (widgetElementExists) {
1543
+ logger.warn("Widget already appended to the DOM");
1544
+ return;
1545
+ }
1503
1546
  const initiateRes = await ioc.bridge.initiate();
1504
1547
  if (!initiateRes.success) {
1505
1548
  logger.error(`${baseErrorMessage} ${initiateRes.reason}`);
1506
1549
  return;
1507
1550
  }
1508
1551
  logger.trace(`Bridge initiated successfully`);
1509
- if (!widgetConfig.displayInWorkspace) {
1552
+ if (!validatedConfig.displayInWorkspace) {
1510
1553
  const showWidgetRes = await ioc.glueController.checkShowWidget();
1511
1554
  if (!showWidgetRes.show) {
1512
1555
  logger.error(`${baseErrorMessage} ${showWidgetRes.reason}`);
@@ -1517,6 +1560,9 @@ const IOBrowserWidgetFactory = async (io, config) => {
1517
1560
  await ioc.domController.attachWidget();
1518
1561
  };
1519
1562
 
1563
+ const eventController = new EventController();
1564
+ eventController.wireCustomEventListener();
1565
+ eventController.notifyStarted();
1520
1566
  if (typeof window !== "undefined") {
1521
1567
  window.IOBrowserWidget = IOBrowserWidgetFactory;
1522
1568
  }