@interopio/widget 3.3.0 → 3.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +2 -0
- package/dist/fonts.css +1 -1
- package/dist/io-browser-widget.es.js +214 -212
- package/dist/io-browser-widget.es.js.map +1 -1
- package/dist/io-browser-widget.umd.js +214 -212
- package/dist/io-browser-widget.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/io-browser-widget-react.es.js +0 -1585
- package/dist/io-browser-widget-react.es.js.map +0 -1
- package/dist/io-browser-widget-react.umd.js +0 -1608
- package/dist/io-browser-widget-react.umd.js.map +0 -1
|
@@ -1,1608 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('react-dom')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react', 'react-dom'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["io-browser-widget-react"] = factory(global.React, global.ReactDOM));
|
|
5
|
-
})(this, (function (i, require$$0) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopNamespaceDefault(e) {
|
|
8
|
-
var n = Object.create(null);
|
|
9
|
-
if (e) {
|
|
10
|
-
Object.keys(e).forEach(function (k) {
|
|
11
|
-
if (k !== 'default') {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return e[k]; }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var i__namespace = /*#__PURE__*/_interopNamespaceDefault(i);
|
|
25
|
-
var require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0);
|
|
26
|
-
|
|
27
|
-
const GLUE42_EVENT_NAME = "Glue42";
|
|
28
|
-
const WIDGET_READY = "widgetFactoryReady";
|
|
29
|
-
const REQUEST_WIDGET_READY = "requestWidgetFactoryReady";
|
|
30
|
-
|
|
31
|
-
class EventController {
|
|
32
|
-
events = {
|
|
33
|
-
[REQUEST_WIDGET_READY]: { name: REQUEST_WIDGET_READY, handle: this.handleWidgetReadyRequest.bind(this) },
|
|
34
|
-
};
|
|
35
|
-
wireCustomEventListener = () => {
|
|
36
|
-
window.addEventListener(GLUE42_EVENT_NAME, this.handleMessage.bind(this));
|
|
37
|
-
};
|
|
38
|
-
notifyStarted() {
|
|
39
|
-
this.send(WIDGET_READY);
|
|
40
|
-
}
|
|
41
|
-
handleMessage(event) {
|
|
42
|
-
const data = event.detail;
|
|
43
|
-
if (!data?.glue42) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const eventName = data.glue42.event;
|
|
47
|
-
const foundHandler = this.events[eventName];
|
|
48
|
-
if (!foundHandler) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
foundHandler.handle(data.glue42.message);
|
|
52
|
-
}
|
|
53
|
-
handleWidgetReadyRequest() {
|
|
54
|
-
this.send(WIDGET_READY);
|
|
55
|
-
}
|
|
56
|
-
send(eventName, message) {
|
|
57
|
-
const payload = { glue42: { event: eventName, message } };
|
|
58
|
-
const event = new CustomEvent(GLUE42_EVENT_NAME, { detail: payload });
|
|
59
|
-
window.dispatchEvent(event);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Wraps values in an `Ok` type.
|
|
65
|
-
*
|
|
66
|
-
* Example: `ok(5) // => {ok: true, result: 5}`
|
|
67
|
-
*/
|
|
68
|
-
var ok = function (result) { return ({ ok: true, result: result }); };
|
|
69
|
-
/**
|
|
70
|
-
* Wraps errors in an `Err` type.
|
|
71
|
-
*
|
|
72
|
-
* Example: `err('on fire') // => {ok: false, error: 'on fire'}`
|
|
73
|
-
*/
|
|
74
|
-
var err = function (error) { return ({ ok: false, error: error }); };
|
|
75
|
-
/**
|
|
76
|
-
* Create a `Promise` that either resolves with the result of `Ok` or rejects
|
|
77
|
-
* with the error of `Err`.
|
|
78
|
-
*/
|
|
79
|
-
var asPromise = function (r) {
|
|
80
|
-
return r.ok === true ? Promise.resolve(r.result) : Promise.reject(r.error);
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Unwraps a `Result` and returns either the result of an `Ok`, or
|
|
84
|
-
* `defaultValue`.
|
|
85
|
-
*
|
|
86
|
-
* Example:
|
|
87
|
-
* ```
|
|
88
|
-
* Result.withDefault(5, number().run(json))
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* It would be nice if `Decoder` had an instance method that mirrored this
|
|
92
|
-
* function. Such a method would look something like this:
|
|
93
|
-
* ```
|
|
94
|
-
* class Decoder<A> {
|
|
95
|
-
* runWithDefault = (defaultValue: A, json: any): A =>
|
|
96
|
-
* Result.withDefault(defaultValue, this.run(json));
|
|
97
|
-
* }
|
|
98
|
-
*
|
|
99
|
-
* number().runWithDefault(5, json)
|
|
100
|
-
* ```
|
|
101
|
-
* Unfortunately, the type of `defaultValue: A` on the method causes issues
|
|
102
|
-
* with type inference on the `object` decoder in some situations. While these
|
|
103
|
-
* inference issues can be solved by providing the optional type argument for
|
|
104
|
-
* `object`s, the extra trouble and confusion doesn't seem worth it.
|
|
105
|
-
*/
|
|
106
|
-
var withDefault = function (defaultValue, r) {
|
|
107
|
-
return r.ok === true ? r.result : defaultValue;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Return the successful result, or throw an error.
|
|
111
|
-
*/
|
|
112
|
-
var withException = function (r) {
|
|
113
|
-
if (r.ok === true) {
|
|
114
|
-
return r.result;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
throw r.error;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Apply `f` to the result of an `Ok`, or pass the error through.
|
|
122
|
-
*/
|
|
123
|
-
var map = function (f, r) {
|
|
124
|
-
return r.ok === true ? ok(f(r.result)) : r;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Apply `f` to the result of two `Ok`s, or pass an error through. If both
|
|
128
|
-
* `Result`s are errors then the first one is returned.
|
|
129
|
-
*/
|
|
130
|
-
var map2 = function (f, ar, br) {
|
|
131
|
-
return ar.ok === false ? ar :
|
|
132
|
-
br.ok === false ? br :
|
|
133
|
-
ok(f(ar.result, br.result));
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Apply `f` to the error of an `Err`, or pass the success through.
|
|
137
|
-
*/
|
|
138
|
-
var mapError = function (f, r) {
|
|
139
|
-
return r.ok === true ? r : err(f(r.error));
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Chain together a sequence of computations that may fail, similar to a
|
|
143
|
-
* `Promise`. If the first computation fails then the error will propagate
|
|
144
|
-
* through. If it succeeds, then `f` will be applied to the value, returning a
|
|
145
|
-
* new `Result`.
|
|
146
|
-
*/
|
|
147
|
-
var andThen = function (f, r) {
|
|
148
|
-
return r.ok === true ? f(r.result) : r;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
/*! *****************************************************************************
|
|
152
|
-
Copyright (c) Microsoft Corporation.
|
|
153
|
-
|
|
154
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
155
|
-
purpose with or without fee is hereby granted.
|
|
156
|
-
|
|
157
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
158
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
159
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
160
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
161
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
162
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
163
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
164
|
-
***************************************************************************** */
|
|
165
|
-
/* global Reflect, Promise */
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var __assign = function() {
|
|
170
|
-
__assign = Object.assign || function __assign(t) {
|
|
171
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
172
|
-
s = arguments[i];
|
|
173
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
174
|
-
}
|
|
175
|
-
return t;
|
|
176
|
-
};
|
|
177
|
-
return __assign.apply(this, arguments);
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
function __rest(s, e) {
|
|
181
|
-
var t = {};
|
|
182
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
183
|
-
t[p] = s[p];
|
|
184
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
185
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
186
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
187
|
-
t[p[i]] = s[p[i]];
|
|
188
|
-
}
|
|
189
|
-
return t;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function isEqual(a, b) {
|
|
193
|
-
if (a === b) {
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
if (a === null && b === null) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
if (typeof (a) !== typeof (b)) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
if (typeof (a) === 'object') {
|
|
203
|
-
// Array
|
|
204
|
-
if (Array.isArray(a)) {
|
|
205
|
-
if (!Array.isArray(b)) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
if (a.length !== b.length) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
for (var i = 0; i < a.length; i++) {
|
|
212
|
-
if (!isEqual(a[i], b[i])) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
// Hash table
|
|
219
|
-
var keys = Object.keys(a);
|
|
220
|
-
if (keys.length !== Object.keys(b).length) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
for (var i = 0; i < keys.length; i++) {
|
|
224
|
-
if (!b.hasOwnProperty(keys[i])) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
if (!isEqual(a[keys[i]], b[keys[i]])) {
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/*
|
|
235
|
-
* Helpers
|
|
236
|
-
*/
|
|
237
|
-
var isJsonArray = function (json) { return Array.isArray(json); };
|
|
238
|
-
var isJsonObject = function (json) {
|
|
239
|
-
return typeof json === 'object' && json !== null && !isJsonArray(json);
|
|
240
|
-
};
|
|
241
|
-
var typeString = function (json) {
|
|
242
|
-
switch (typeof json) {
|
|
243
|
-
case 'string':
|
|
244
|
-
return 'a string';
|
|
245
|
-
case 'number':
|
|
246
|
-
return 'a number';
|
|
247
|
-
case 'boolean':
|
|
248
|
-
return 'a boolean';
|
|
249
|
-
case 'undefined':
|
|
250
|
-
return 'undefined';
|
|
251
|
-
case 'object':
|
|
252
|
-
if (json instanceof Array) {
|
|
253
|
-
return 'an array';
|
|
254
|
-
}
|
|
255
|
-
else if (json === null) {
|
|
256
|
-
return 'null';
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
return 'an object';
|
|
260
|
-
}
|
|
261
|
-
default:
|
|
262
|
-
return JSON.stringify(json);
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
var expectedGot = function (expected, got) {
|
|
266
|
-
return "expected " + expected + ", got " + typeString(got);
|
|
267
|
-
};
|
|
268
|
-
var printPath = function (paths) {
|
|
269
|
-
return paths.map(function (path) { return (typeof path === 'string' ? "." + path : "[" + path + "]"); }).join('');
|
|
270
|
-
};
|
|
271
|
-
var prependAt = function (newAt, _a) {
|
|
272
|
-
var at = _a.at, rest = __rest(_a, ["at"]);
|
|
273
|
-
return (__assign({ at: newAt + (at || '') }, rest));
|
|
274
|
-
};
|
|
275
|
-
/**
|
|
276
|
-
* Decoders transform json objects with unknown structure into known and
|
|
277
|
-
* verified forms. You can create objects of type `Decoder<A>` with either the
|
|
278
|
-
* primitive decoder functions, such as `boolean()` and `string()`, or by
|
|
279
|
-
* applying higher-order decoders to the primitives, such as `array(boolean())`
|
|
280
|
-
* or `dict(string())`.
|
|
281
|
-
*
|
|
282
|
-
* Each of the decoder functions are available both as a static method on
|
|
283
|
-
* `Decoder` and as a function alias -- for example the string decoder is
|
|
284
|
-
* defined at `Decoder.string()`, but is also aliased to `string()`. Using the
|
|
285
|
-
* function aliases exported with the library is recommended.
|
|
286
|
-
*
|
|
287
|
-
* `Decoder` exposes a number of 'run' methods, which all decode json in the
|
|
288
|
-
* same way, but communicate success and failure in different ways. The `map`
|
|
289
|
-
* and `andThen` methods modify decoders without having to call a 'run' method.
|
|
290
|
-
*
|
|
291
|
-
* Alternatively, the main decoder `run()` method returns an object of type
|
|
292
|
-
* `Result<A, DecoderError>`. This library provides a number of helper
|
|
293
|
-
* functions for dealing with the `Result` type, so you can do all the same
|
|
294
|
-
* things with a `Result` as with the decoder methods.
|
|
295
|
-
*/
|
|
296
|
-
var Decoder = /** @class */ (function () {
|
|
297
|
-
/**
|
|
298
|
-
* The Decoder class constructor is kept private to separate the internal
|
|
299
|
-
* `decode` function from the external `run` function. The distinction
|
|
300
|
-
* between the two functions is that `decode` returns a
|
|
301
|
-
* `Partial<DecoderError>` on failure, which contains an unfinished error
|
|
302
|
-
* report. When `run` is called on a decoder, the relevant series of `decode`
|
|
303
|
-
* calls is made, and then on failure the resulting `Partial<DecoderError>`
|
|
304
|
-
* is turned into a `DecoderError` by filling in the missing information.
|
|
305
|
-
*
|
|
306
|
-
* While hiding the constructor may seem restrictive, leveraging the
|
|
307
|
-
* provided decoder combinators and helper functions such as
|
|
308
|
-
* `andThen` and `map` should be enough to build specialized decoders as
|
|
309
|
-
* needed.
|
|
310
|
-
*/
|
|
311
|
-
function Decoder(decode) {
|
|
312
|
-
var _this = this;
|
|
313
|
-
this.decode = decode;
|
|
314
|
-
/**
|
|
315
|
-
* Run the decoder and return a `Result` with either the decoded value or a
|
|
316
|
-
* `DecoderError` containing the json input, the location of the error, and
|
|
317
|
-
* the error message.
|
|
318
|
-
*
|
|
319
|
-
* Examples:
|
|
320
|
-
* ```
|
|
321
|
-
* number().run(12)
|
|
322
|
-
* // => {ok: true, result: 12}
|
|
323
|
-
*
|
|
324
|
-
* string().run(9001)
|
|
325
|
-
* // =>
|
|
326
|
-
* // {
|
|
327
|
-
* // ok: false,
|
|
328
|
-
* // error: {
|
|
329
|
-
* // kind: 'DecoderError',
|
|
330
|
-
* // input: 9001,
|
|
331
|
-
* // at: 'input',
|
|
332
|
-
* // message: 'expected a string, got 9001'
|
|
333
|
-
* // }
|
|
334
|
-
* // }
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
this.run = function (json) {
|
|
338
|
-
return mapError(function (error) { return ({
|
|
339
|
-
kind: 'DecoderError',
|
|
340
|
-
input: json,
|
|
341
|
-
at: 'input' + (error.at || ''),
|
|
342
|
-
message: error.message || ''
|
|
343
|
-
}); }, _this.decode(json));
|
|
344
|
-
};
|
|
345
|
-
/**
|
|
346
|
-
* Run the decoder as a `Promise`.
|
|
347
|
-
*/
|
|
348
|
-
this.runPromise = function (json) { return asPromise(_this.run(json)); };
|
|
349
|
-
/**
|
|
350
|
-
* Run the decoder and return the value on success, or throw an exception
|
|
351
|
-
* with a formatted error string.
|
|
352
|
-
*/
|
|
353
|
-
this.runWithException = function (json) { return withException(_this.run(json)); };
|
|
354
|
-
/**
|
|
355
|
-
* Construct a new decoder that applies a transformation to the decoded
|
|
356
|
-
* result. If the decoder succeeds then `f` will be applied to the value. If
|
|
357
|
-
* it fails the error will propagated through.
|
|
358
|
-
*
|
|
359
|
-
* Example:
|
|
360
|
-
* ```
|
|
361
|
-
* number().map(x => x * 5).run(10)
|
|
362
|
-
* // => {ok: true, result: 50}
|
|
363
|
-
* ```
|
|
364
|
-
*/
|
|
365
|
-
this.map = function (f) {
|
|
366
|
-
return new Decoder(function (json) { return map(f, _this.decode(json)); });
|
|
367
|
-
};
|
|
368
|
-
/**
|
|
369
|
-
* Chain together a sequence of decoders. The first decoder will run, and
|
|
370
|
-
* then the function will determine what decoder to run second. If the result
|
|
371
|
-
* of the first decoder succeeds then `f` will be applied to the decoded
|
|
372
|
-
* value. If it fails the error will propagate through.
|
|
373
|
-
*
|
|
374
|
-
* This is a very powerful method -- it can act as both the `map` and `where`
|
|
375
|
-
* methods, can improve error messages for edge cases, and can be used to
|
|
376
|
-
* make a decoder for custom types.
|
|
377
|
-
*
|
|
378
|
-
* Example of adding an error message:
|
|
379
|
-
* ```
|
|
380
|
-
* const versionDecoder = valueAt(['version'], number());
|
|
381
|
-
* const infoDecoder3 = object({a: boolean()});
|
|
382
|
-
*
|
|
383
|
-
* const decoder = versionDecoder.andThen(version => {
|
|
384
|
-
* switch (version) {
|
|
385
|
-
* case 3:
|
|
386
|
-
* return infoDecoder3;
|
|
387
|
-
* default:
|
|
388
|
-
* return fail(`Unable to decode info, version ${version} is not supported.`);
|
|
389
|
-
* }
|
|
390
|
-
* });
|
|
391
|
-
*
|
|
392
|
-
* decoder.run({version: 3, a: true})
|
|
393
|
-
* // => {ok: true, result: {a: true}}
|
|
394
|
-
*
|
|
395
|
-
* decoder.run({version: 5, x: 'abc'})
|
|
396
|
-
* // =>
|
|
397
|
-
* // {
|
|
398
|
-
* // ok: false,
|
|
399
|
-
* // error: {... message: 'Unable to decode info, version 5 is not supported.'}
|
|
400
|
-
* // }
|
|
401
|
-
* ```
|
|
402
|
-
*
|
|
403
|
-
* Example of decoding a custom type:
|
|
404
|
-
* ```
|
|
405
|
-
* // nominal type for arrays with a length of at least one
|
|
406
|
-
* type NonEmptyArray<T> = T[] & { __nonEmptyArrayBrand__: void };
|
|
407
|
-
*
|
|
408
|
-
* const nonEmptyArrayDecoder = <T>(values: Decoder<T>): Decoder<NonEmptyArray<T>> =>
|
|
409
|
-
* array(values).andThen(arr =>
|
|
410
|
-
* arr.length > 0
|
|
411
|
-
* ? succeed(createNonEmptyArray(arr))
|
|
412
|
-
* : fail(`expected a non-empty array, got an empty array`)
|
|
413
|
-
* );
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
this.andThen = function (f) {
|
|
417
|
-
return new Decoder(function (json) {
|
|
418
|
-
return andThen(function (value) { return f(value).decode(json); }, _this.decode(json));
|
|
419
|
-
});
|
|
420
|
-
};
|
|
421
|
-
/**
|
|
422
|
-
* Add constraints to a decoder _without_ changing the resulting type. The
|
|
423
|
-
* `test` argument is a predicate function which returns true for valid
|
|
424
|
-
* inputs. When `test` fails on an input, the decoder fails with the given
|
|
425
|
-
* `errorMessage`.
|
|
426
|
-
*
|
|
427
|
-
* ```
|
|
428
|
-
* const chars = (length: number): Decoder<string> =>
|
|
429
|
-
* string().where(
|
|
430
|
-
* (s: string) => s.length === length,
|
|
431
|
-
* `expected a string of length ${length}`
|
|
432
|
-
* );
|
|
433
|
-
*
|
|
434
|
-
* chars(5).run('12345')
|
|
435
|
-
* // => {ok: true, result: '12345'}
|
|
436
|
-
*
|
|
437
|
-
* chars(2).run('HELLO')
|
|
438
|
-
* // => {ok: false, error: {... message: 'expected a string of length 2'}}
|
|
439
|
-
*
|
|
440
|
-
* chars(12).run(true)
|
|
441
|
-
* // => {ok: false, error: {... message: 'expected a string, got a boolean'}}
|
|
442
|
-
* ```
|
|
443
|
-
*/
|
|
444
|
-
this.where = function (test, errorMessage) {
|
|
445
|
-
return _this.andThen(function (value) { return (test(value) ? Decoder.succeed(value) : Decoder.fail(errorMessage)); });
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Decoder primitive that validates strings, and fails on all other input.
|
|
450
|
-
*/
|
|
451
|
-
Decoder.string = function () {
|
|
452
|
-
return new Decoder(function (json) {
|
|
453
|
-
return typeof json === 'string'
|
|
454
|
-
? ok(json)
|
|
455
|
-
: err({ message: expectedGot('a string', json) });
|
|
456
|
-
});
|
|
457
|
-
};
|
|
458
|
-
/**
|
|
459
|
-
* Decoder primitive that validates numbers, and fails on all other input.
|
|
460
|
-
*/
|
|
461
|
-
Decoder.number = function () {
|
|
462
|
-
return new Decoder(function (json) {
|
|
463
|
-
return typeof json === 'number'
|
|
464
|
-
? ok(json)
|
|
465
|
-
: err({ message: expectedGot('a number', json) });
|
|
466
|
-
});
|
|
467
|
-
};
|
|
468
|
-
/**
|
|
469
|
-
* Decoder primitive that validates booleans, and fails on all other input.
|
|
470
|
-
*/
|
|
471
|
-
Decoder.boolean = function () {
|
|
472
|
-
return new Decoder(function (json) {
|
|
473
|
-
return typeof json === 'boolean'
|
|
474
|
-
? ok(json)
|
|
475
|
-
: err({ message: expectedGot('a boolean', json) });
|
|
476
|
-
});
|
|
477
|
-
};
|
|
478
|
-
Decoder.constant = function (value) {
|
|
479
|
-
return new Decoder(function (json) {
|
|
480
|
-
return isEqual(json, value)
|
|
481
|
-
? ok(value)
|
|
482
|
-
: err({ message: "expected " + JSON.stringify(value) + ", got " + JSON.stringify(json) });
|
|
483
|
-
});
|
|
484
|
-
};
|
|
485
|
-
Decoder.object = function (decoders) {
|
|
486
|
-
return new Decoder(function (json) {
|
|
487
|
-
if (isJsonObject(json) && decoders) {
|
|
488
|
-
var obj = {};
|
|
489
|
-
for (var key in decoders) {
|
|
490
|
-
if (decoders.hasOwnProperty(key)) {
|
|
491
|
-
var r = decoders[key].decode(json[key]);
|
|
492
|
-
if (r.ok === true) {
|
|
493
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
494
|
-
if (r.result !== undefined) {
|
|
495
|
-
obj[key] = r.result;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
else if (json[key] === undefined) {
|
|
499
|
-
return err({ message: "the key '" + key + "' is required but was not present" });
|
|
500
|
-
}
|
|
501
|
-
else {
|
|
502
|
-
return err(prependAt("." + key, r.error));
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return ok(obj);
|
|
507
|
-
}
|
|
508
|
-
else if (isJsonObject(json)) {
|
|
509
|
-
return ok(json);
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
return err({ message: expectedGot('an object', json) });
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
Decoder.array = function (decoder) {
|
|
517
|
-
return new Decoder(function (json) {
|
|
518
|
-
if (isJsonArray(json) && decoder) {
|
|
519
|
-
var decodeValue_1 = function (v, i) {
|
|
520
|
-
return mapError(function (err$$1) { return prependAt("[" + i + "]", err$$1); }, decoder.decode(v));
|
|
521
|
-
};
|
|
522
|
-
return json.reduce(function (acc, v, i) {
|
|
523
|
-
return map2(function (arr, result) { return arr.concat([result]); }, acc, decodeValue_1(v, i));
|
|
524
|
-
}, ok([]));
|
|
525
|
-
}
|
|
526
|
-
else if (isJsonArray(json)) {
|
|
527
|
-
return ok(json);
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
return err({ message: expectedGot('an array', json) });
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
};
|
|
534
|
-
Decoder.tuple = function (decoders) {
|
|
535
|
-
return new Decoder(function (json) {
|
|
536
|
-
if (isJsonArray(json)) {
|
|
537
|
-
if (json.length !== decoders.length) {
|
|
538
|
-
return err({
|
|
539
|
-
message: "expected a tuple of length " + decoders.length + ", got one of length " + json.length
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
var result = [];
|
|
543
|
-
for (var i = 0; i < decoders.length; i++) {
|
|
544
|
-
var nth = decoders[i].decode(json[i]);
|
|
545
|
-
if (nth.ok) {
|
|
546
|
-
result[i] = nth.result;
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
return err(prependAt("[" + i + "]", nth.error));
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
return ok(result);
|
|
553
|
-
}
|
|
554
|
-
else {
|
|
555
|
-
return err({ message: expectedGot("a tuple of length " + decoders.length, json) });
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
};
|
|
559
|
-
Decoder.union = function (ad, bd) {
|
|
560
|
-
var decoders = [];
|
|
561
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
562
|
-
decoders[_i - 2] = arguments[_i];
|
|
563
|
-
}
|
|
564
|
-
return Decoder.oneOf.apply(Decoder, [ad, bd].concat(decoders));
|
|
565
|
-
};
|
|
566
|
-
Decoder.intersection = function (ad, bd) {
|
|
567
|
-
var ds = [];
|
|
568
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
569
|
-
ds[_i - 2] = arguments[_i];
|
|
570
|
-
}
|
|
571
|
-
return new Decoder(function (json) {
|
|
572
|
-
return [ad, bd].concat(ds).reduce(function (acc, decoder) { return map2(Object.assign, acc, decoder.decode(json)); }, ok({}));
|
|
573
|
-
});
|
|
574
|
-
};
|
|
575
|
-
/**
|
|
576
|
-
* Escape hatch to bypass validation. Always succeeds and types the result as
|
|
577
|
-
* `any`. Useful for defining decoders incrementally, particularly for
|
|
578
|
-
* complex objects.
|
|
579
|
-
*
|
|
580
|
-
* Example:
|
|
581
|
-
* ```
|
|
582
|
-
* interface User {
|
|
583
|
-
* name: string;
|
|
584
|
-
* complexUserData: ComplexType;
|
|
585
|
-
* }
|
|
586
|
-
*
|
|
587
|
-
* const userDecoder: Decoder<User> = object({
|
|
588
|
-
* name: string(),
|
|
589
|
-
* complexUserData: anyJson()
|
|
590
|
-
* });
|
|
591
|
-
* ```
|
|
592
|
-
*/
|
|
593
|
-
Decoder.anyJson = function () { return new Decoder(function (json) { return ok(json); }); };
|
|
594
|
-
/**
|
|
595
|
-
* Decoder identity function which always succeeds and types the result as
|
|
596
|
-
* `unknown`.
|
|
597
|
-
*/
|
|
598
|
-
Decoder.unknownJson = function () {
|
|
599
|
-
return new Decoder(function (json) { return ok(json); });
|
|
600
|
-
};
|
|
601
|
-
/**
|
|
602
|
-
* Decoder for json objects where the keys are unknown strings, but the values
|
|
603
|
-
* should all be of the same type.
|
|
604
|
-
*
|
|
605
|
-
* Example:
|
|
606
|
-
* ```
|
|
607
|
-
* dict(number()).run({chocolate: 12, vanilla: 10, mint: 37});
|
|
608
|
-
* // => {ok: true, result: {chocolate: 12, vanilla: 10, mint: 37}}
|
|
609
|
-
* ```
|
|
610
|
-
*/
|
|
611
|
-
Decoder.dict = function (decoder) {
|
|
612
|
-
return new Decoder(function (json) {
|
|
613
|
-
if (isJsonObject(json)) {
|
|
614
|
-
var obj = {};
|
|
615
|
-
for (var key in json) {
|
|
616
|
-
if (json.hasOwnProperty(key)) {
|
|
617
|
-
var r = decoder.decode(json[key]);
|
|
618
|
-
if (r.ok === true) {
|
|
619
|
-
obj[key] = r.result;
|
|
620
|
-
}
|
|
621
|
-
else {
|
|
622
|
-
return err(prependAt("." + key, r.error));
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
return ok(obj);
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
return err({ message: expectedGot('an object', json) });
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
};
|
|
633
|
-
/**
|
|
634
|
-
* Decoder for values that may be `undefined`. This is primarily helpful for
|
|
635
|
-
* decoding interfaces with optional fields.
|
|
636
|
-
*
|
|
637
|
-
* Example:
|
|
638
|
-
* ```
|
|
639
|
-
* interface User {
|
|
640
|
-
* id: number;
|
|
641
|
-
* isOwner?: boolean;
|
|
642
|
-
* }
|
|
643
|
-
*
|
|
644
|
-
* const decoder: Decoder<User> = object({
|
|
645
|
-
* id: number(),
|
|
646
|
-
* isOwner: optional(boolean())
|
|
647
|
-
* });
|
|
648
|
-
* ```
|
|
649
|
-
*/
|
|
650
|
-
Decoder.optional = function (decoder) {
|
|
651
|
-
return new Decoder(function (json) { return (json === undefined || json === null ? ok(undefined) : decoder.decode(json)); });
|
|
652
|
-
};
|
|
653
|
-
/**
|
|
654
|
-
* Decoder that attempts to run each decoder in `decoders` and either succeeds
|
|
655
|
-
* with the first successful decoder, or fails after all decoders have failed.
|
|
656
|
-
*
|
|
657
|
-
* Note that `oneOf` expects the decoders to all have the same return type,
|
|
658
|
-
* while `union` creates a decoder for the union type of all the input
|
|
659
|
-
* decoders.
|
|
660
|
-
*
|
|
661
|
-
* Examples:
|
|
662
|
-
* ```
|
|
663
|
-
* oneOf(string(), number().map(String))
|
|
664
|
-
* oneOf(constant('start'), constant('stop'), succeed('unknown'))
|
|
665
|
-
* ```
|
|
666
|
-
*/
|
|
667
|
-
Decoder.oneOf = function () {
|
|
668
|
-
var decoders = [];
|
|
669
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
670
|
-
decoders[_i] = arguments[_i];
|
|
671
|
-
}
|
|
672
|
-
return new Decoder(function (json) {
|
|
673
|
-
var errors = [];
|
|
674
|
-
for (var i = 0; i < decoders.length; i++) {
|
|
675
|
-
var r = decoders[i].decode(json);
|
|
676
|
-
if (r.ok === true) {
|
|
677
|
-
return r;
|
|
678
|
-
}
|
|
679
|
-
else {
|
|
680
|
-
errors[i] = r.error;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
var errorsList = errors
|
|
684
|
-
.map(function (error) { return "at error" + (error.at || '') + ": " + error.message; })
|
|
685
|
-
.join('", "');
|
|
686
|
-
return err({
|
|
687
|
-
message: "expected a value matching one of the decoders, got the errors [\"" + errorsList + "\"]"
|
|
688
|
-
});
|
|
689
|
-
});
|
|
690
|
-
};
|
|
691
|
-
/**
|
|
692
|
-
* Decoder that always succeeds with either the decoded value, or a fallback
|
|
693
|
-
* default value.
|
|
694
|
-
*/
|
|
695
|
-
Decoder.withDefault = function (defaultValue, decoder) {
|
|
696
|
-
return new Decoder(function (json) {
|
|
697
|
-
return ok(withDefault(defaultValue, decoder.decode(json)));
|
|
698
|
-
});
|
|
699
|
-
};
|
|
700
|
-
/**
|
|
701
|
-
* Decoder that pulls a specific field out of a json structure, instead of
|
|
702
|
-
* decoding and returning the full structure. The `paths` array describes the
|
|
703
|
-
* object keys and array indices to traverse, so that values can be pulled out
|
|
704
|
-
* of a nested structure.
|
|
705
|
-
*
|
|
706
|
-
* Example:
|
|
707
|
-
* ```
|
|
708
|
-
* const decoder = valueAt(['a', 'b', 0], string());
|
|
709
|
-
*
|
|
710
|
-
* decoder.run({a: {b: ['surprise!']}})
|
|
711
|
-
* // => {ok: true, result: 'surprise!'}
|
|
712
|
-
*
|
|
713
|
-
* decoder.run({a: {x: 'cats'}})
|
|
714
|
-
* // => {ok: false, error: {... at: 'input.a.b[0]' message: 'path does not exist'}}
|
|
715
|
-
* ```
|
|
716
|
-
*
|
|
717
|
-
* Note that the `decoder` is ran on the value found at the last key in the
|
|
718
|
-
* path, even if the last key is not found. This allows the `optional`
|
|
719
|
-
* decoder to succeed when appropriate.
|
|
720
|
-
* ```
|
|
721
|
-
* const optionalDecoder = valueAt(['a', 'b', 'c'], optional(string()));
|
|
722
|
-
*
|
|
723
|
-
* optionalDecoder.run({a: {b: {c: 'surprise!'}}})
|
|
724
|
-
* // => {ok: true, result: 'surprise!'}
|
|
725
|
-
*
|
|
726
|
-
* optionalDecoder.run({a: {b: 'cats'}})
|
|
727
|
-
* // => {ok: false, error: {... at: 'input.a.b.c' message: 'expected an object, got "cats"'}
|
|
728
|
-
*
|
|
729
|
-
* optionalDecoder.run({a: {b: {z: 1}}})
|
|
730
|
-
* // => {ok: true, result: undefined}
|
|
731
|
-
* ```
|
|
732
|
-
*/
|
|
733
|
-
Decoder.valueAt = function (paths, decoder) {
|
|
734
|
-
return new Decoder(function (json) {
|
|
735
|
-
var jsonAtPath = json;
|
|
736
|
-
for (var i = 0; i < paths.length; i++) {
|
|
737
|
-
if (jsonAtPath === undefined) {
|
|
738
|
-
return err({
|
|
739
|
-
at: printPath(paths.slice(0, i + 1)),
|
|
740
|
-
message: 'path does not exist'
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
else if (typeof paths[i] === 'string' && !isJsonObject(jsonAtPath)) {
|
|
744
|
-
return err({
|
|
745
|
-
at: printPath(paths.slice(0, i + 1)),
|
|
746
|
-
message: expectedGot('an object', jsonAtPath)
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
else if (typeof paths[i] === 'number' && !isJsonArray(jsonAtPath)) {
|
|
750
|
-
return err({
|
|
751
|
-
at: printPath(paths.slice(0, i + 1)),
|
|
752
|
-
message: expectedGot('an array', jsonAtPath)
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
jsonAtPath = jsonAtPath[paths[i]];
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
return mapError(function (error) {
|
|
760
|
-
return jsonAtPath === undefined
|
|
761
|
-
? { at: printPath(paths), message: 'path does not exist' }
|
|
762
|
-
: prependAt(printPath(paths), error);
|
|
763
|
-
}, decoder.decode(jsonAtPath));
|
|
764
|
-
});
|
|
765
|
-
};
|
|
766
|
-
/**
|
|
767
|
-
* Decoder that ignores the input json and always succeeds with `fixedValue`.
|
|
768
|
-
*/
|
|
769
|
-
Decoder.succeed = function (fixedValue) {
|
|
770
|
-
return new Decoder(function (json) { return ok(fixedValue); });
|
|
771
|
-
};
|
|
772
|
-
/**
|
|
773
|
-
* Decoder that ignores the input json and always fails with `errorMessage`.
|
|
774
|
-
*/
|
|
775
|
-
Decoder.fail = function (errorMessage) {
|
|
776
|
-
return new Decoder(function (json) { return err({ message: errorMessage }); });
|
|
777
|
-
};
|
|
778
|
-
/**
|
|
779
|
-
* Decoder that allows for validating recursive data structures. Unlike with
|
|
780
|
-
* functions, decoders assigned to variables can't reference themselves
|
|
781
|
-
* before they are fully defined. We can avoid prematurely referencing the
|
|
782
|
-
* decoder by wrapping it in a function that won't be called until use, at
|
|
783
|
-
* which point the decoder has been defined.
|
|
784
|
-
*
|
|
785
|
-
* Example:
|
|
786
|
-
* ```
|
|
787
|
-
* interface Comment {
|
|
788
|
-
* msg: string;
|
|
789
|
-
* replies: Comment[];
|
|
790
|
-
* }
|
|
791
|
-
*
|
|
792
|
-
* const decoder: Decoder<Comment> = object({
|
|
793
|
-
* msg: string(),
|
|
794
|
-
* replies: lazy(() => array(decoder))
|
|
795
|
-
* });
|
|
796
|
-
* ```
|
|
797
|
-
*/
|
|
798
|
-
Decoder.lazy = function (mkDecoder) {
|
|
799
|
-
return new Decoder(function (json) { return mkDecoder().decode(json); });
|
|
800
|
-
};
|
|
801
|
-
return Decoder;
|
|
802
|
-
}());
|
|
803
|
-
|
|
804
|
-
/* tslint:disable:variable-name */
|
|
805
|
-
/** See `Decoder.string` */
|
|
806
|
-
Decoder.string;
|
|
807
|
-
/** See `Decoder.number` */
|
|
808
|
-
Decoder.number;
|
|
809
|
-
/** See `Decoder.boolean` */
|
|
810
|
-
var boolean = Decoder.boolean;
|
|
811
|
-
/** See `Decoder.anyJson` */
|
|
812
|
-
Decoder.anyJson;
|
|
813
|
-
/** See `Decoder.unknownJson` */
|
|
814
|
-
Decoder.unknownJson;
|
|
815
|
-
/** See `Decoder.constant` */
|
|
816
|
-
var constant = Decoder.constant;
|
|
817
|
-
/** See `Decoder.object` */
|
|
818
|
-
var object = Decoder.object;
|
|
819
|
-
/** See `Decoder.array` */
|
|
820
|
-
Decoder.array;
|
|
821
|
-
/** See `Decoder.tuple` */
|
|
822
|
-
Decoder.tuple;
|
|
823
|
-
/** See `Decoder.dict` */
|
|
824
|
-
Decoder.dict;
|
|
825
|
-
/** See `Decoder.optional` */
|
|
826
|
-
var optional = Decoder.optional;
|
|
827
|
-
/** See `Decoder.oneOf` */
|
|
828
|
-
var oneOf = Decoder.oneOf;
|
|
829
|
-
/** See `Decoder.union` */
|
|
830
|
-
Decoder.union;
|
|
831
|
-
/** See `Decoder.intersection` */
|
|
832
|
-
Decoder.intersection;
|
|
833
|
-
/** See `Decoder.withDefault` */
|
|
834
|
-
Decoder.withDefault;
|
|
835
|
-
/** See `Decoder.valueAt` */
|
|
836
|
-
Decoder.valueAt;
|
|
837
|
-
/** See `Decoder.succeed` */
|
|
838
|
-
Decoder.succeed;
|
|
839
|
-
/** See `Decoder.fail` */
|
|
840
|
-
Decoder.fail;
|
|
841
|
-
/** See `Decoder.lazy` */
|
|
842
|
-
Decoder.lazy;
|
|
843
|
-
|
|
844
|
-
const channelSelectorTypeDecoder = oneOf(constant("directional"), constant("default"));
|
|
845
|
-
const channelSelectorDecoder = object({
|
|
846
|
-
type: optional(channelSelectorTypeDecoder),
|
|
847
|
-
enable: optional(boolean())
|
|
848
|
-
});
|
|
849
|
-
const positionDecoder = oneOf(constant("top"), constant("bottom"), constant("left"), constant("right"));
|
|
850
|
-
const modeDecoder = oneOf(constant("default"), constant("compact"));
|
|
851
|
-
const displayModeDecoder = oneOf(constant("all"), constant("fdc3"));
|
|
852
|
-
const channelsDecoder = object({
|
|
853
|
-
selector: optional(channelSelectorDecoder),
|
|
854
|
-
displayMode: optional(displayModeDecoder)
|
|
855
|
-
});
|
|
856
|
-
const configDecoder = object({
|
|
857
|
-
enable: boolean(),
|
|
858
|
-
channels: optional(channelsDecoder),
|
|
859
|
-
position: optional(positionDecoder),
|
|
860
|
-
mode: optional(modeDecoder),
|
|
861
|
-
displayInWorkspace: optional(boolean())
|
|
862
|
-
});
|
|
863
|
-
|
|
864
|
-
const browserPlatformMethodName = "T42.Web.Platform.Control";
|
|
865
|
-
|
|
866
|
-
class Bridge {
|
|
867
|
-
io;
|
|
868
|
-
defaultTransportTimeout = 30000;
|
|
869
|
-
logger;
|
|
870
|
-
constructor(io) {
|
|
871
|
-
this.io = io;
|
|
872
|
-
const windowId = io.windows.my().id;
|
|
873
|
-
this.logger = io.logger.subLogger(`widget.bridge-${windowId}`);
|
|
874
|
-
}
|
|
875
|
-
async initiate() {
|
|
876
|
-
const browserGlobal = window.glue42core || window.iobrowser;
|
|
877
|
-
if (!browserGlobal) {
|
|
878
|
-
const errorMsg = "App is not running in IO.Connect.Browser environment";
|
|
879
|
-
this.logger.trace(errorMsg);
|
|
880
|
-
return { success: false, reason: errorMsg };
|
|
881
|
-
}
|
|
882
|
-
const res = await this.checkPlatformMethodsExist();
|
|
883
|
-
this.logger.trace(`Bridge initiated successfully`);
|
|
884
|
-
return res;
|
|
885
|
-
}
|
|
886
|
-
async send(operation, domain, operationArguments, options) {
|
|
887
|
-
const browserGlobal = window.glue42core || window.iobrowser;
|
|
888
|
-
const platformTarget = browserGlobal.communicationId;
|
|
889
|
-
const invocationArguments = { operation, domain, data: operationArguments };
|
|
890
|
-
const operationSupported = options?.includeOperationCheck ? (await this.checkOperationSupported(operation, domain)).isSupported : true;
|
|
891
|
-
if (!operationSupported) {
|
|
892
|
-
throw new Error(`Cannot complete operation: ${operation} for domain: ${domain} because this client is connected to a platform which does not support it`);
|
|
893
|
-
}
|
|
894
|
-
let invocationResult;
|
|
895
|
-
const baseErrorMessage = `Internal Widget Communication Error. Attempted operation: ${JSON.stringify(invocationArguments)}. `;
|
|
896
|
-
try {
|
|
897
|
-
invocationResult = await this.io.interop.invoke(browserPlatformMethodName, invocationArguments, platformTarget ? { instance: platformTarget } : "best", { methodResponseTimeoutMs: this.defaultTransportTimeout });
|
|
898
|
-
if (!invocationResult) {
|
|
899
|
-
throw new Error("Received unsupported result from Platform - empty result");
|
|
900
|
-
}
|
|
901
|
-
if (!Array.isArray(invocationResult.all_return_values) || invocationResult.all_return_values.length === 0) {
|
|
902
|
-
throw new Error("Received unsupported result from Platform - empty values collection");
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
catch (error) {
|
|
906
|
-
if (error?.all_errors?.length) {
|
|
907
|
-
const invocationErrorMessage = error.all_errors[0].message;
|
|
908
|
-
throw new Error(`${baseErrorMessage} -> Inner message: ${invocationErrorMessage}`);
|
|
909
|
-
}
|
|
910
|
-
throw new Error(`${baseErrorMessage} -> Inner message: ${error.message}`);
|
|
911
|
-
}
|
|
912
|
-
return invocationResult.all_return_values[0].returned;
|
|
913
|
-
}
|
|
914
|
-
async checkOperationSupported(operation, domain) {
|
|
915
|
-
try {
|
|
916
|
-
const result = await this.send("operationCheck", domain, { operation });
|
|
917
|
-
return result;
|
|
918
|
-
}
|
|
919
|
-
catch (error) {
|
|
920
|
-
return { isSupported: false };
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
async checkPlatformMethodsExist() {
|
|
924
|
-
const workspacesInitCheckSupported = await this.checkOperationSupported("workspacesInitCheck", "system");
|
|
925
|
-
if (!workspacesInitCheckSupported.isSupported) {
|
|
926
|
-
const errorMsg = `IO.Connect Browser Platform is an older version and does not support 'workspacesInitCheck' operation for 'system' domain`;
|
|
927
|
-
this.logger.trace(errorMsg);
|
|
928
|
-
return { success: false, reason: errorMsg };
|
|
929
|
-
}
|
|
930
|
-
return { success: true };
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
var createRoot;
|
|
935
|
-
|
|
936
|
-
var m$1 = require$$0;
|
|
937
|
-
{
|
|
938
|
-
createRoot = m$1.createRoot;
|
|
939
|
-
m$1.hydrateRoot;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
const GlueControllerContext = i.createContext(null);
|
|
943
|
-
const useGlueController = () => {
|
|
944
|
-
const context = i.useContext(GlueControllerContext);
|
|
945
|
-
if (!context) {
|
|
946
|
-
throw new Error(`useGlueController must be used within a GlueControllerContextProvider`);
|
|
947
|
-
}
|
|
948
|
-
return context;
|
|
949
|
-
};
|
|
950
|
-
const CustomGlueControllerProvider = ({ glueController, children }) => {
|
|
951
|
-
return i.createElement(GlueControllerContext.Provider, { value: glueController }, children);
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
const useThemeSync = () => {
|
|
955
|
-
const glueController = useGlueController();
|
|
956
|
-
i.useEffect(() => {
|
|
957
|
-
let isUnsubscribed = false;
|
|
958
|
-
const themesApi = glueController.io?.themes;
|
|
959
|
-
if (!themesApi) {
|
|
960
|
-
return;
|
|
961
|
-
}
|
|
962
|
-
const changeTheme = async (theme) => {
|
|
963
|
-
if (isUnsubscribed) {
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
const htmlElement = document.documentElement;
|
|
967
|
-
if (htmlElement.classList.contains(theme.name)) {
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
const allThemes = await themesApi.list();
|
|
971
|
-
htmlElement.classList.remove(...allThemes.map(({ name }) => name));
|
|
972
|
-
htmlElement.classList.add(theme.name);
|
|
973
|
-
};
|
|
974
|
-
themesApi.onChanged(changeTheme);
|
|
975
|
-
themesApi.getCurrent().then(changeTheme);
|
|
976
|
-
return () => {
|
|
977
|
-
isUnsubscribed = true;
|
|
978
|
-
};
|
|
979
|
-
}, [glueController]);
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
const drop = (e, setSelectedPosition) => {
|
|
983
|
-
e.preventDefault();
|
|
984
|
-
const x = e.clientX;
|
|
985
|
-
const y = e.clientY;
|
|
986
|
-
const screenWidth = window.innerWidth;
|
|
987
|
-
const screenHeight = window.innerHeight;
|
|
988
|
-
const centerX = screenWidth / 2;
|
|
989
|
-
const centerY = screenHeight / 2;
|
|
990
|
-
const widgetElem = Array.from(document.getElementsByClassName('io-window-widget'))[0];
|
|
991
|
-
let widgetClassName = "";
|
|
992
|
-
let position = "bottom";
|
|
993
|
-
if (x < centerX && y < centerY) {
|
|
994
|
-
position = centerX - x < centerY - y ? "top" : "left";
|
|
995
|
-
widgetClassName = `io-window-widget io-window-widget-${position}`;
|
|
996
|
-
}
|
|
997
|
-
else if (x < centerX && y > centerY) {
|
|
998
|
-
position = Math.abs(centerY - y) < x ? "bottom" : "left";
|
|
999
|
-
widgetClassName = `io-window-widget ${position === "left" ? "io-window-widget-left" : ""}`;
|
|
1000
|
-
}
|
|
1001
|
-
else if (x > centerX && y < centerY) {
|
|
1002
|
-
position = screenWidth - x < y ? "right" : "top";
|
|
1003
|
-
widgetClassName = `io-window-widget io-window-widget-${position}`;
|
|
1004
|
-
}
|
|
1005
|
-
else {
|
|
1006
|
-
position = screenWidth - x < screenHeight - y ? "right" : "bottom";
|
|
1007
|
-
widgetClassName = `io-window-widget ${position === "right" ? "io-window-widget-right" : ""}`;
|
|
1008
|
-
}
|
|
1009
|
-
widgetElem.className = widgetClassName;
|
|
1010
|
-
setSelectedPosition(position);
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
const DragSection = () => {
|
|
1014
|
-
return (i.createElement("div", { className: "drag-element" },
|
|
1015
|
-
i.createElement("div", null),
|
|
1016
|
-
i.createElement("div", null),
|
|
1017
|
-
i.createElement("div", null),
|
|
1018
|
-
i.createElement("div", null),
|
|
1019
|
-
i.createElement("div", null),
|
|
1020
|
-
i.createElement("div", null),
|
|
1021
|
-
i.createElement("div", null),
|
|
1022
|
-
i.createElement("div", null)));
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
var jsxRuntime = {exports: {}};
|
|
1026
|
-
|
|
1027
|
-
var reactJsxRuntime_production_min = {};
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* @license React
|
|
1031
|
-
* react-jsx-runtime.production.min.js
|
|
1032
|
-
*
|
|
1033
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1034
|
-
*
|
|
1035
|
-
* This source code is licensed under the MIT license found in the
|
|
1036
|
-
* LICENSE file in the root directory of this source tree.
|
|
1037
|
-
*/
|
|
1038
|
-
var f=i,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};
|
|
1039
|
-
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;
|
|
1040
|
-
|
|
1041
|
-
{
|
|
1042
|
-
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
1046
|
-
|
|
1047
|
-
var propTypes = {exports: {}};
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1051
|
-
*
|
|
1052
|
-
* This source code is licensed under the MIT license found in the
|
|
1053
|
-
* LICENSE file in the root directory of this source tree.
|
|
1054
|
-
*/
|
|
1055
|
-
|
|
1056
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1057
|
-
|
|
1058
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1062
|
-
*
|
|
1063
|
-
* This source code is licensed under the MIT license found in the
|
|
1064
|
-
* LICENSE file in the root directory of this source tree.
|
|
1065
|
-
*/
|
|
1066
|
-
|
|
1067
|
-
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1068
|
-
|
|
1069
|
-
function emptyFunction() {}
|
|
1070
|
-
function emptyFunctionWithReset() {}
|
|
1071
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1072
|
-
|
|
1073
|
-
var factoryWithThrowingShims = function() {
|
|
1074
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1075
|
-
if (secret === ReactPropTypesSecret) {
|
|
1076
|
-
// It is still safe when called from React.
|
|
1077
|
-
return;
|
|
1078
|
-
}
|
|
1079
|
-
var err = new Error(
|
|
1080
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1081
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1082
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
1083
|
-
);
|
|
1084
|
-
err.name = 'Invariant Violation';
|
|
1085
|
-
throw err;
|
|
1086
|
-
} shim.isRequired = shim;
|
|
1087
|
-
function getShim() {
|
|
1088
|
-
return shim;
|
|
1089
|
-
} // Important!
|
|
1090
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1091
|
-
var ReactPropTypes = {
|
|
1092
|
-
array: shim,
|
|
1093
|
-
bigint: shim,
|
|
1094
|
-
bool: shim,
|
|
1095
|
-
func: shim,
|
|
1096
|
-
number: shim,
|
|
1097
|
-
object: shim,
|
|
1098
|
-
string: shim,
|
|
1099
|
-
symbol: shim,
|
|
1100
|
-
|
|
1101
|
-
any: shim,
|
|
1102
|
-
arrayOf: getShim,
|
|
1103
|
-
element: shim,
|
|
1104
|
-
elementType: shim,
|
|
1105
|
-
instanceOf: getShim,
|
|
1106
|
-
node: shim,
|
|
1107
|
-
objectOf: getShim,
|
|
1108
|
-
oneOf: getShim,
|
|
1109
|
-
oneOfType: getShim,
|
|
1110
|
-
shape: getShim,
|
|
1111
|
-
exact: getShim,
|
|
1112
|
-
|
|
1113
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
1114
|
-
resetWarningCache: emptyFunction
|
|
1115
|
-
};
|
|
1116
|
-
|
|
1117
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1118
|
-
|
|
1119
|
-
return ReactPropTypes;
|
|
1120
|
-
};
|
|
1121
|
-
|
|
1122
|
-
/**
|
|
1123
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1124
|
-
*
|
|
1125
|
-
* This source code is licensed under the MIT license found in the
|
|
1126
|
-
* LICENSE file in the root directory of this source tree.
|
|
1127
|
-
*/
|
|
1128
|
-
|
|
1129
|
-
{
|
|
1130
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1131
|
-
// http://fb.me/prop-types-in-prod
|
|
1132
|
-
propTypes.exports = factoryWithThrowingShims();
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
var propTypesExports = propTypes.exports;
|
|
1136
|
-
|
|
1137
|
-
const extractErrorMsg = (error) => {
|
|
1138
|
-
const errorMessage = error.message ? JSON.stringify(error.message) : JSON.stringify(error);
|
|
1139
|
-
const stringError = typeof error === "string" ? error : errorMessage;
|
|
1140
|
-
return stringError;
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
|
-
const useIOConnectInit = (settings, onInitError) => {
|
|
1144
|
-
const [io, setIOConnect] = i.useState(null);
|
|
1145
|
-
i.useEffect(() => {
|
|
1146
|
-
const initialize = async () => {
|
|
1147
|
-
try {
|
|
1148
|
-
if (settings.browser && settings.browserPlatform) {
|
|
1149
|
-
throw new Error("Cannot initialize, because the settings are over-specified: defined are both browser and browserPlatform. Please set one or the other");
|
|
1150
|
-
}
|
|
1151
|
-
const isDesktop = (typeof window.glue42gd !== "undefined") || (typeof window.iodesktop !== "undefined");
|
|
1152
|
-
if (isDesktop) {
|
|
1153
|
-
const factory = settings.desktop?.factory || settings.browser?.factory || settings.browserPlatform?.factory || window.Glue;
|
|
1154
|
-
const config = settings.desktop?.config || settings.browser?.config || settings.browserPlatform?.config;
|
|
1155
|
-
const factoryResult = await factory(config);
|
|
1156
|
-
setIOConnect(factoryResult.io || factoryResult.glue || factoryResult);
|
|
1157
|
-
return;
|
|
1158
|
-
}
|
|
1159
|
-
const config = settings.browser?.config || settings.browserPlatform?.config;
|
|
1160
|
-
const factory = settings.browser?.factory || settings.browserPlatform?.factory || window.IOBrowser || window.IOBrowserPlatform;
|
|
1161
|
-
const factoryResult = await factory(config);
|
|
1162
|
-
setIOConnect(factoryResult.io || factoryResult.glue || factoryResult);
|
|
1163
|
-
}
|
|
1164
|
-
catch (error) {
|
|
1165
|
-
console.error(error);
|
|
1166
|
-
onInitError?.(error instanceof Error ? error : new Error(extractErrorMsg(error)));
|
|
1167
|
-
}
|
|
1168
|
-
};
|
|
1169
|
-
initialize();
|
|
1170
|
-
}, []);
|
|
1171
|
-
return io;
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
const IOConnectContext = i.createContext(null);
|
|
1175
|
-
const IOConnectProvider = i.memo(({ children, fallback = null, settings = {}, onInitError }) => {
|
|
1176
|
-
const glue = useIOConnectInit(settings, onInitError);
|
|
1177
|
-
return glue ? (i.createElement(IOConnectContext.Provider, { value: glue }, children)) : (i.createElement(i.Fragment, null, fallback));
|
|
1178
|
-
});
|
|
1179
|
-
IOConnectProvider.propTypes = {
|
|
1180
|
-
children: propTypesExports.node,
|
|
1181
|
-
settings: propTypesExports.object,
|
|
1182
|
-
fallback: propTypesExports.node,
|
|
1183
|
-
};
|
|
1184
|
-
IOConnectProvider.displayName = 'IOConnectProvider';
|
|
1185
|
-
|
|
1186
|
-
function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b,y={exports:{}};
|
|
1187
|
-
/*!
|
|
1188
|
-
Copyright (c) 2018 Jed Watson.
|
|
1189
|
-
Licensed under the MIT License (MIT), see
|
|
1190
|
-
http://jedwatson.github.io/classnames
|
|
1191
|
-
*/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=i.forwardRef((({className:t,variant:n="default",icon:i$1="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=i.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$1&&jsxRuntimeExports.jsx(k,{variant:i$1,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 E({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 I({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(E,{tag:r,text:i,size:o}),s,a&&jsxRuntimeExports.jsx("p",{className:"io-text-smaller",children:a})]})}const A=i.forwardRef((({className:n,variant:i$1="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$1||"critical"===i$1||"outline"===i$1||"link"===i$1)&&[`io-btn-${i$1}`],"large"===o&&"io-btn-lg",n),g=i.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=i.createContext({});function T({className:t,...n}){const{handleOpen:i$1}=i.useContext(B),o=w("io-dropdown-content",t),a=i.useCallback((e=>{e.stopPropagation(),i$1&&i$1();}),[i$1]);return jsxRuntimeExports.jsx("div",{className:o,role:"button",onClick:a,...n})}const P=i.createContext({}),R=i.forwardRef(((n,i$1)=>{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}=i.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$1,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=i.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=i.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=i.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=i.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=i.forwardRef(((t,n)=>{const{className:i$1,variant:o="default",checkIcon:a="none",children:s,...u}=t,[d,f]=i.useState([]),h=w("io-list","default"!==o&&"io-list-selectable",i$1),m=i.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=i.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){i.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$1="down",disabled:o,children:a,...s}){const[u,f]=i.useState(!1),h=i.useRef(null),m=w("io-dropdown",u&&"io-dropdown-open","default"!==n&&[`io-dropdown-${n}`],t),p=i.useCallback((()=>{f(!u);}),[u]);_(h,i.useCallback((()=>{f(!1);}),[]));const g=i.useMemo((()=>({isOpen:u,handleOpen:p,variant:n,align:i$1,disabled:o})),[u,p,n,i$1,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=function(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}(a);return t.concat(a,a.visualViewport||[],ne(o)?o:[],e&&n?fe(e):[])}return t.concat(o,fe(o,[],n))}function he(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 me(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 pe(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function ge(){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 ve(e){return !(0!==e.mozInputSource||!e.isTrusted)||(we()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function be(e){return !ge().includes("jsdom/")&&(!we()&&0===e.width&&0===e.height||we()&&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 ye(){return /apple/i.test(navigator.vendor)}function we(){const e=/android/i;return e.test(pe())||e.test(ge())}function ke(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Se(e){return (null==e?void 0:e.ownerDocument)||document}function Ne(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 Ce(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$1,disabled:o}=i.useContext(B),a=i.useCallback((e=>{e.stopPropagation(),i$1&&i$1();}),[i$1]);return jsxRuntimeExports.jsx(A,{icon:t,iconRight:!0,onClick:a,disabled:o,...n})},H.ButtonIcon=function({size:t="32",...n}){const{handleOpen:i$1,disabled:o}=i.useContext(B),a=i.useCallback((()=>{i$1&&i$1();}),[i$1]);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=E,j.ButtonGroup=$,j.Button=A,j.ButtonIcon=S,j.Dropdown=H,V.Title=E,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;const xe="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Ee(e){return ee(e)&&e.matches(xe)}function Ie(e){e.preventDefault(),e.stopPropagation();}function Ae(e){return !!e&&("combobox"===e.getAttribute("role")&&Ee(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}}
|
|
1192
|
-
/*!
|
|
1193
|
-
* tabbable 6.2.0
|
|
1194
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
1195
|
-
*/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)},dt=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return !1!==Ge.call(e,qe)&&st(t,e)};function ft(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 ht(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 mt(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 pt(e){return Z(e)?e:e.contextElement}function gt(e){const t=pt(e);if(!ee(t))return Le(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=mt(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 vt=Le(0);function bt(e){const t=Y(e);return ae()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:vt}function yt(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),r=pt(e);let a=Le(1);t&&(i?Z(i)&&(a=gt(i)):a=gt(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Y(e))&&t}(r,n,i)?bt(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=n.frameElement;for(;o&&i&&t!==n;){const e=gt(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=n.frameElement;}}return We({width:u,height:d,x:c,y:l})}const wt=[":popover-open",":modal"];function kt(e){return wt.some((t=>{try{return e.matches(t)}catch(e){return !1}}))}function St(e){return yt(Q(e)).left+le(e).scrollLeft}function Nt(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+St(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=yt(e,!0,"fixed"===t),i=n.top+e.clientTop,o=n.left+e.clientLeft,r=ee(e)?gt(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=bt(e);i={...t,x:t.x-n.x,y:t.y-n.y};}return We(i)}function Ct(e,t){const n=ue(e);return !(n===t||!Z(n)||se(n))&&("fixed"===ce(n).position||Ct(n,t))}function xt(e,t,n){const i=ee(t),o=Q(t),r="fixed"===n,a=yt(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=yt(t,!0,r,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop;}else o&&(c.x=St(o));return {x:a.left+s.scrollLeft-c.x,y:a.top+s.scrollTop-c.y,width:a.width,height:a.height}}function Et(e){return "static"===ce(e).position}function It(e,t){return ee(e)&&"fixed"!==ce(e).position?t?t(e):e.offsetParent:null}function At(e,t){const n=Y(e);if(kt(e))return n;if(!ee(e)){let t=ue(e);for(;t&&!se(t);){if(Z(t)&&!Et(t))return t;t=ue(t);}return n}let i=It(e,t);for(;i&&ie(i)&&Et(i);)i=It(i,t);return i&&se(i)&&Et(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 Bt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const r="fixed"===o,a=Q(i),s=!!t&&kt(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=yt(i);l=gt(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?kt(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&&Ct(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=Nt(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}),Nt(t,a,o));return {width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:At,getElementRects:async function(e){const t=this.getOffsetParent||At,n=this.getDimensions,i=await n(e.floating);return {reference:xt(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}=mt(e);return {width:t,height:n}},getScale:gt,isElement:Z,isRTL:function(e){return "rtl"===ce(e).direction}};function Tt(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=pt(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?yt(e):null;return c&&function t(){const i=yt(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 Pt=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:0,crossAxis:0,alignmentAxis:null,...d};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}}}}},Rt=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 ht(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}}}}},Lt=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=ze(s)===s,y=await(null==c.isRTL?void 0:c.isRTL(l.floating)),w=f||(b||!p?[Je(s)]:function(e){const t=Je(e);return [Ue(e),t,Ue(t)]}(s));f||"none"===m||w.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,y));const k=[s,...w],S=await ht(t,g),N=[];let C=(null==(i=r.flip)?void 0:i.overflows)||[];if(u&&N.push(S[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,y);N.push(S[e[0]],S[e[1]]);}if(C=[...C,{placement:o,overflows:N}],!N.every((e=>e<=0))){var x,E;const e=((null==(x=r.flip)?void 0:x.index)||0)+1,t=k[e];if(t)return {data:{index:e,overflows:C},reset:{placement:t}};let n=null==(E=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:E.placement;if(!n)switch(h){case"bestFit":{var I;const e=null==(I=C.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:I[0];e&&(n=e);break}case"initialPlacement":n=s;}if(o!==n)return {reset:{placement:n}}}return {}}}},Ot=(e,t,n)=>{const i=new Map,o={platform:Bt,...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}=ft(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}=ft(l,f,c))),n=-1);}return {x:u,y:d,placement:f,strategy:o,middlewareData:h}})(e,t,{...o,platform:r})};var Ft="undefined"!=typeof document?i.useLayoutEffect:i.useEffect;function Dt(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(!Dt(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)&&!Dt(e[n],t[n]))return !1}return !0}return e!=e&&t!=t}function Mt(e){if("undefined"==typeof window)return 1;return (e.ownerDocument.defaultView||window).devicePixelRatio||1}function zt(e,t){const n=Mt(e);return Math.round(t*n)/n}function _t(e){const t=i__namespace.useRef(e);return Ft((()=>{t.current=e;})),t}const Ht=(e,t)=>({...Rt(e),options:[e,t]}),$t=(e,t)=>({...Lt(e),options:[e,t]});function jt(e){return i__namespace.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t);}));}),e)}const Vt={...i__namespace},Ut=Vt.useInsertionEffect||(e=>e());function Jt(e){const t=i__namespace.useRef((()=>{}));return Ut((()=>{t.current=e;})),i__namespace.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 Wt="ArrowUp",qt="ArrowDown",Kt="ArrowLeft",Gt="ArrowRight";function Yt(e,t,n){return Math.floor(e/t)!==n}function Qt(e,t){return t<0||t>=e.current.length}function Xt(e,t){return en(e,{disabledIndices:t})}function Zt(e,t){return en(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function en(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&&on(a,s,o));return s}function tn(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 nn(e,t){return t.flatMap(((t,n)=>e.includes(t)?[n]:[]))}function on(e,t,n){if(n)return n.includes(t);const i=e[t];return null==i||i.hasAttribute("disabled")||"true"===i.getAttribute("aria-disabled")}var rn="undefined"!=typeof document?i.useLayoutEffect:i.useEffect;function an(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 sn=i__namespace.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function cn(e){const{children:t,elementsRef:n,labelsRef:o}=e,[r,a]=i__namespace.useState((()=>new Map)),s=i__namespace.useCallback((e=>{a((t=>new Map(t).set(e,null)));}),[]),c=i__namespace.useCallback((e=>{a((t=>{const n=new Map(t);return n.delete(e),n}));}),[]);return rn((()=>{const e=new Map(r);Array.from(e.keys()).sort(an).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__namespace.createElement(sn.Provider,{value:i__namespace.useMemo((()=>({register:s,unregister:c,map:r,elementsRef:n,labelsRef:o})),[s,c,r,n,o])},t)}function ln(e){void 0===e&&(e={});const{label:t}=e,{register:n,unregister:o,map:r,elementsRef:a,labelsRef:s}=i__namespace.useContext(sn),[c,l]=i__namespace.useState(null),u=i__namespace.useRef(null),d=i__namespace.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 rn((()=>{const e=u.current;if(e)return n(e),()=>{o(e);}}),[n,o]),rn((()=>{const e=u.current?r.get(u.current):null;null!=e&&l(e);}),[r]),i__namespace.useMemo((()=>({ref:d,index:null==c?-1:c})),[c,d])}function un(){return un=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},un.apply(this,arguments)}let dn=!1,fn=0;const hn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+fn++;const mn=Vt.useId||function(){const[e,t]=i__namespace.useState((()=>dn?hn():void 0));return rn((()=>{null==e&&t(hn());}),[]),i__namespace.useEffect((()=>{dn=!0;}),[]),e};function vn(){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 bn=i__namespace.createContext(null),yn=i__namespace.createContext(null),wn=()=>{var e;return (null==(e=i__namespace.useContext(bn))?void 0:e.id)||null},kn=()=>i__namespace.useContext(yn);function Sn(e){const{children:t,id:n}=e,o=wn();return i__namespace.createElement(bn.Provider,{value:i__namespace.useMemo((()=>({id:n,parentId:o})),[n,o])},t)}function Nn(e){const{children:t}=e,n=i__namespace.useRef([]),o=i__namespace.useCallback((e=>{n.current=[...n.current,e];}),[]),r=i__namespace.useCallback((e=>{n.current=n.current.filter((t=>t!==e));}),[]),a=i__namespace.useState((()=>vn()))[0];return i__namespace.createElement(yn.Provider,{value:i__namespace.useMemo((()=>({nodesRef:n,addNode:o,removeNode:r,events:a})),[o,r,a])},t)}function Cn(e){return "data-floating-ui-"+e}function xn(e){const t=i.useRef(e);return rn((()=>{t.current=e;})),t}const En=Cn("safe-polygon");function In(e,t,n){return n&&!ke(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let An=0;function Bn(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:i=!0,sync:o=!1}=t;i&&cancelAnimationFrame(An);const r=()=>null==e?void 0:e.focus({preventScroll:n});o?r():An=requestAnimationFrame(r);}function Tn(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 Pn=new WeakMap,Rn=new WeakSet,Ln={},On=0;const Fn=e=>e&&(e.host||Fn(e.parentNode)),Dn=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=Fn(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Mn(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=Se(e[0]).body;return function(e,t,n,i){const o="data-floating-ui-inert",r=i?"inert":n?"aria-hidden":null,a=Dn(t,e),s=new Set,c=new Set(a),l=[];Ln[o]||(Ln[o]=new WeakMap);const u=Ln[o];return a.forEach((function e(t){t&&!s.has(t)&&(s.add(t),t.parentNode&&e(t.parentNode));})),function e(t){t&&!c.has(t)&&[].forEach.call(t.children,(t=>{if("script"!==G(t))if(s.has(t))e(t);else {const e=r?t.getAttribute(r):null,n=null!==e&&"false"!==e,i=(Pn.get(t)||0)+1,a=(u.get(t)||0)+1;Pn.set(t,i),u.set(t,a),l.push(t),1===i&&n&&Rn.add(t),1===a&&t.setAttribute(o,""),!n&&r&&t.setAttribute(r,"true");}}));}(t),s.clear(),On++,()=>{l.forEach((e=>{const t=(Pn.get(e)||0)-1,n=(u.get(e)||0)-1;Pn.set(e,t),u.set(e,n),t||(!Rn.has(e)&&r&&e.removeAttribute(r),Rn.delete(e)),n||e.removeAttribute(o);})),On--,On||(Pn=new WeakMap,Pn=new WeakMap,Rn=new WeakSet,Ln={});}}(e.concat(Array.from(i.querySelectorAll("[aria-live]"))),i,t,n)}const zn=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function _n(e,t){const n=ut(e,zn());"prev"===t&&n.reverse();const i=n.indexOf(he(Se(e)));return n.slice(i+1)[0]}function Hn(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return !i||!me(n,i)}const $n={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 jn(e){"Tab"===e.key&&(e.target,clearTimeout(undefined));}const Vn=i__namespace.forwardRef((function(e,t){const[n,o]=i__namespace.useState();rn((()=>(ye()&&o("button"),document.addEventListener("keydown",jn),()=>{document.removeEventListener("keydown",jn);})),[]);const r={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Cn("focus-guard")]:"",style:$n};return i__namespace.createElement("span",un({},e,r))})),Un=i__namespace.createContext(null),Jn="data-floating-ui-focusable";function Wn(e){return e?e.hasAttribute(Jn)?e:e.querySelector("["+Jn+"]")||e:null}const qn=20;let Kn=[];function Gn(e){Kn=Kn.filter((e=>e.isConnected));let t=e;if(t&&"body"!==G(t)){if(!dt(t,zn())){const e=ut(t,zn())[0];e&&(t=e);}Kn.push(t),Kn.length>qn&&(Kn=Kn.slice(-qn));}}function Yn(){return Kn.slice().reverse().find((e=>e.isConnected))}const Qn=i__namespace.forwardRef((function(e,t){return i__namespace.createElement("button",un({},e,{type:"button",ref:t,tabIndex:-1,style:$n}))}));function Xn(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=xn(r),E=xn(s),I=xn(c),A=kn(),B=i__namespace.useContext(Un),T=i__namespace.useRef(null),P=i__namespace.useRef(null),R=i__namespace.useRef(!1),L=i__namespace.useRef(!1),O=i__namespace.useRef(-1),F=null!=B,D=Wn(k),M=Jt((function(e){return void 0===e&&(e=D),e?ut(e,zn()):[]})),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__namespace.createElement(Qn,{ref:"start"===e?T:P,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}i__namespace.useEffect((()=>{if(o)return;if(!u)return;function e(e){if("Tab"===e.key){me(D,he(Se(D)))&&0===M().length&&!N&&Ie(e);const t=z(),n=Ce(e);"reference"===x.current[0]&&n===w&&(Ie(e),e.shiftKey?Bn(t[t.length-1]):Bn(t[1])),"floating"===x.current[1]&&n===D&&e.shiftKey&&(Ie(e),Bn(t[0]));}}const t=Se(D);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e);}}),[o,w,D,u,x,N,M,z]),i__namespace.useEffect((()=>{if(!o&&k)return k.addEventListener("focusin",e),()=>{k.removeEventListener("focusin",e);};function e(e){const t=Ce(e),n=M().indexOf(t);-1!==n&&(O.current=n);}}),[o,k,M]),i__namespace.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=!(me(w,t)||me(k,t)||me(t,k)||me(null==B?void 0:B.portalNode,t)||null!=t&&t.hasAttribute(Cn("focus-guard"))||A&&(Tn(A.nodesRef.current,p).find((e=>{var n,i;return me(null==(n=e.context)?void 0:n.elements.floating,t)||me(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&&he(Se(D))===Se(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===Yn()||(R.current=!0,g(!1,e,"focus-out"));}));}}),[o,w,k,D,u,p,A,B,g,f,l,M,N]),i__namespace.useEffect((()=>{var e;if(o)return;const t=Array.from((null==B||null==(e=B.portalNode)?void 0:e.querySelectorAll("["+Cn("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?Mn(e,C,!C):Mn(e);return ()=>{n();}}}),[o,w,k,u,x,B,N,C]),rn((()=>{if(o||!ee(D))return;const e=he(Se(D));queueMicrotask((()=>{const t=z(D),n=E.current,i=("number"==typeof n?t[n]:n.current)||D,o=me(D,e);S||o||!h||Bn(i,{preventScroll:i===D});}));}),[o,h,D,S,z,E]),rn((()=>{if(o||!D)return;let e=!1;const t=Se(D),n=he(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&&Gn(m.domReference.current),"hover"===o&&"mouseleave"===r.type&&(R.current=!0),"outside-press"===o&&(a?(R.current=!1,e=!0):R.current=!(ve(r)||be(r)));}Gn(n),v.on("openchange",r);const a=t.createElement("span");return a.setAttribute("tabindex","-1"),a.setAttribute("aria-hidden","true"),Object.assign(a.style,$n),F&&w&&w.insertAdjacentElement("afterend",a),()=>{v.off("openchange",r);const n=he(t),o=me(k,n)||A&&Tn(A.nodesRef.current,p).some((e=>{var t;return me(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||i&&["click","mousedown"].includes(i.type))&&m.domReference.current&&Gn(m.domReference.current);const s="boolean"==typeof I.current?Yn()||a:I.current.current||a;queueMicrotask((()=>{I.current&&!R.current&&ee(s)&&(s===n||n===t.body||o)&&s.focus({preventScroll:e}),a.remove();}));}}),[o,k,D,I,b,m,v,A,p,F,w]),i__namespace.useEffect((()=>{queueMicrotask((()=>{R.current=!1;}));}),[o]),rn((()=>{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]),rn((()=>{if(o)return;if(!D)return;if("function"!=typeof MutationObserver)return;if(S)return;const e=()=>{const e=D.getAttribute("tabindex"),t=M(),n=he(Se(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__namespace.createElement(i__namespace.Fragment,null,H&&i__namespace.createElement(Vn,{"data-type":"inside",ref:null==B?void 0:B.beforeInsideRef,onFocus:e=>{if(u){const e=z();Bn("reference"===r[0]?e[0]:e[e.length-1]);}else if(null!=B&&B.preserveTabOrder&&B.portalNode)if(R.current=!1,Hn(e,B.portalNode)){const e=_n(document.body,"next")||w;null==e||e.focus();}else {var t;null==(t=B.beforeOutsideRef.current)||t.focus();}}}),!N&&_("start"),n,_("end"),H&&i__namespace.createElement(Vn,{"data-type":"inside",ref:null==B?void 0:B.afterInsideRef,onFocus:e=>{if(u)Bn(z()[0]);else if(null!=B&&B.preserveTabOrder&&B.portalNode)if(f&&(R.current=!0),Hn(e,B.portalNode)){const e=_n(document.body,"prev")||w;null==e||e.focus();}else {var t;null==(t=B.afterOutsideRef.current)||t.focus();}}}))}function Zn(e){return ee(e.target)&&"BUTTON"===e.target.tagName}function ei(e){return Ee(e)}const ti={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ni={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ii=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 oi(e){const{open:t=!1,onOpenChange:n,elements:o}=e,r=mn(),a=i__namespace.useRef({}),[s]=i__namespace.useState((()=>vn())),c=null!=wn();const[l,u]=i__namespace.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__namespace.useMemo((()=>({setPositionReference:u})),[]),h=i__namespace.useMemo((()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference})),[l,o.reference,o.floating]);return i__namespace.useMemo((()=>({dataRef:a,open:t,onOpenChange:d,elements:h,events:s,floatingId:r,refs:f})),[t,d,h,s,r,f])}function ri(e){void 0===e&&(e={});const{nodeId:t}=e,n=oi({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,r=o.elements,[a,s]=i__namespace.useState(null),[c,l]=i__namespace.useState(null),u=(null==r?void 0:r.domReference)||a,d=i__namespace.useRef(null),f=kn();rn((()=>{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__namespace.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=i__namespace.useState(o);Dt(h,o)||p(o);const[g,v]=i__namespace.useState(null),[b,y]=i__namespace.useState(null),w=i__namespace.useCallback((e=>{e!==C.current&&(C.current=e,v(e));}),[]),k=i__namespace.useCallback((e=>{e!==x.current&&(x.current=e,y(e));}),[]),S=a||g,N=s||b,C=i__namespace.useRef(null),x=i__namespace.useRef(null),E=i__namespace.useRef(d),I=null!=l,A=_t(l),B=_t(r),T=_t(u),P=i__namespace.useCallback((()=>{if(!C.current||!x.current)return;const e={placement:t,strategy:n,middleware:h};B.current&&(e.platform=B.current),Ot(C.current,x.current,e).then((e=>{const t={...e,isPositioned:!1!==T.current};R.current&&!Dt(E.current,t)&&(E.current=t,require$$0__namespace.flushSync((()=>{f(t);})));}));}),[h,t,n,B,T]);Ft((()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))));}),[u]);const R=i__namespace.useRef(!1);Ft((()=>(R.current=!0,()=>{R.current=!1;})),[]),Ft((()=>{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,I]);const L=i__namespace.useMemo((()=>({reference:C,floating:x,setReference:w,setFloating:k})),[w,k]),O=i__namespace.useMemo((()=>({reference:S,floating:N})),[S,N]),F=i__namespace.useMemo((()=>{const e={position:n,left:0,top:0};if(!O.floating)return e;const t=zt(O.floating,d.x),i=zt(O.floating,d.y);return c?{...e,transform:"translate("+t+"px, "+i+"px)",...Mt(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:i}}),[n,c,O.floating,d.x,d.y]);return i__namespace.useMemo((()=>({...d,update:P,refs:L,elements:O,floatingStyles:F})),[d,P,L,O,F])}({...e,elements:{...r,...c&&{reference:c}}}),p=i__namespace.useCallback((e=>{const t=Z(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l(t),h.refs.setReference(t);}),[h.refs]),g=i__namespace.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__namespace.useMemo((()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d})),[h.refs,g,p]),b=i__namespace.useMemo((()=>({...h.elements,domReference:u})),[h.elements,u]),y=i__namespace.useMemo((()=>({...h,...o,refs:v,elements:b,nodeId:t})),[h,v,b,t,o]);return rn((()=>{o.dataRef.current.floatingContext=y;const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===t));e&&(e.context=y);})),i__namespace.useMemo((()=>({...h,context:y,refs:v,elements:b})),[h,v,b,y])}const ai="active",si="selected";function ci(e,t,n){const i=new Map,o="item"===n;let r=e;if(o&&e){const{[ai]:t,[si]: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&&[ai,si].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 li=!1;function ui(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function di(e,t){return ui(t,e===Wt||e===qt,e===Kt||e===Gt)}function fi(e,t,n){return ui(t,e===qt,n?e===Kt:e===Gt)||"Enter"===e||" "===e||""===e}function hi(e,t,n){return ui(t,n?e===Gt:e===Kt,e===Wt)}function mi(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 E=xn(Wn(r.floating)),I=wn(),A=kn(),B=Jt(c),T=Ae(r.domReference),P=i__namespace.useRef(g),R=i__namespace.useRef(null!=u?u:-1),L=i__namespace.useRef(null),O=i__namespace.useRef(!0),F=i__namespace.useRef(B),D=i__namespace.useRef(!!r.floating),M=i__namespace.useRef(n),z=i__namespace.useRef(!1),_=i__namespace.useRef(!1),H=xn(y),$=xn(n),j=xn(S),V=xn(u),[U,J]=i__namespace.useState(),[W,q]=i__namespace.useState(),K=Jt((function(e,t,n){function i(e){p?(J(e.id),null==A||A.events.emit("virtualfocus",e),N&&(N.current=e)):Bn(e,{preventScroll:!0,sync:!(!pe().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!ye())&&(li||z.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=j.current;a&&Y&&(n||!O.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof a?{block:"nearest",inline:"nearest"}:a));}));}));rn((()=>{document.createElement("div").focus({get preventScroll(){return li=!0,!1}});}),[]),rn((()=>{l&&(n&&r.floating?P.current&&null!=u&&(_.current=!0,R.current=u,B(u)):D.current&&(R.current=-1,F.current(null)));}),[l,n,r.floating,u,B]),rn((()=>{if(l&&n&&r.floating)if(null==s){if(z.current=!1,null!=V.current)return;if(D.current&&(R.current=-1,K(a,R)),(!M.current||!D.current)&&P.current&&(null!=L.current||!0===P.current&&null==L.current)){let e=0;const t=()=>{if(null==a.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t);}e++;}else R.current=null==L.current||fi(L.current,w,m)||h?Xt(a,H.current):Zt(a,H.current),L.current=null,B(R.current);};t();}}else Qt(a,s)||(R.current=s,K(a,R,_.current),_.current=!1);}),[l,n,r.floating,s,V,h,a,w,m,B,K,H]),rn((()=>{var e;if(!l||r.floating||!A||p||!D.current)return;const t=A.nodesRef.current,n=null==(e=t.find((e=>e.id===I)))||null==(e=e.context)?void 0:e.elements.floating,i=he(Se(r.floating)),o=t.some((e=>e.context&&me(e.context.elements.floating,i)));n&&!o&&O.current&&n.focus({preventScroll:!0});}),[l,r.floating,A,I,p]),rn((()=>{if(l&&A&&p&&!I)return A.events.on("virtualfocus",e),()=>{A.events.off("virtualfocus",e);};function e(e){q(e.id),N&&(N.current=e);}}),[l,A,p,I,N]),rn((()=>{F.current=B,D.current=!!r.floating;})),rn((()=>{n||(L.current=null);}),[n]),rn((()=>{M.current=n;}),[n]);const G=null!=s,Y=i__namespace.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;O.current&&"touch"!==t&&(R.current=-1,K(a,R),B(null),p||Bn(E.current,{preventScroll:!0}));}}}}),[n,E,K,v,a,B,p]),Q=Jt((e=>{if(O.current=!1,z.current=!0,229===e.which)return;if(!$.current&&e.currentTarget===E.current)return;if(h&&hi(e.key,w,m))return Ie(e),o(!1,e.nativeEvent,"list-navigation"),void(ee(r.domReference)&&(p?null==A||A.events.emit("virtualfocus",r.domReference):r.domReference.focus()));const t=R.current,i=Xt(a,y),s=Zt(a,y);if(T||("Home"===e.key&&(Ie(e),R.current=i,B(R.current)),"End"===e.key&&(Ie(e),R.current=s,B(R.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&&!on(a.current,e,y))),r=n.reduce(((e,t,n)=>null==t||on(a.current,t,y)?e:n),-1),c=n[function(e,t){let{event:n,orientation:i,loop:o,rtl:r,cols:a,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}=t,f=u;if(n.key===Wt){if(d&&Ie(n),-1===u)f=l;else if(f=en(e,{startingIndex:f,amount:a,decrement:!0,disabledIndices:s}),o&&(u-a<c||f<0)){const e=u%a,t=l%a,n=l-(t-e);f=t===e?l:t>e?n:n-a;}Qt(e,f)&&(f=u);}if(n.key===qt&&(d&&Ie(n),-1===u?f=c:(f=en(e,{startingIndex:u,amount:a,disabledIndices:s}),o&&u+a>l&&(f=en(e,{startingIndex:u%a-a,amount:a,disabledIndices:s}))),Qt(e,f)&&(f=u)),"both"===i){const t=Re(u/a);n.key===(r?Kt:Gt)&&(d&&Ie(n),u%a!=a-1?(f=en(e,{startingIndex:u,disabledIndices:s}),o&&Yt(f,a,t)&&(f=en(e,{startingIndex:u-u%a-1,disabledIndices:s}))):o&&(f=en(e,{startingIndex:u-u%a-1,disabledIndices:s})),Yt(f,a,t)&&(f=u)),n.key===(r?Gt:Kt)&&(d&&Ie(n),u%a!=0?(f=en(e,{startingIndex:u,decrement:!0,disabledIndices:s}),o&&Yt(f,a,t)&&(f=en(e,{startingIndex:u+(a-u%a),decrement:!0,disabledIndices:s}))):o&&(f=en(e,{startingIndex:u+(a-u%a),decrement:!0,disabledIndices:s})),Yt(f,a,t)&&(f=u));const i=Re(l/a)===t;Qt(e,f)&&(f=o&&i?n.key===(r?Gt:Kt)?l:en(e,{startingIndex:u-u%a-1,disabledIndices:s}):u);}return f}({current:n.map((e=>null!=e?a.current[e]:null))},{event:e,orientation:w,loop:f,rtl:m,cols:k,disabledIndices:nn([...y||a.current.map(((e,t)=>on(a.current,t)?t:void 0)),void 0],n),minIndex:o,maxIndex:r,prevIndex:tn(R.current>s?i:R.current,t,n,k,e.key===qt?"bl":e.key===(m?Kt:Gt)?"tr":"tl"),stopEvent:!0})];if(null!=c&&(R.current=c,B(R.current)),"both"===w)return}if(di(e.key,w)){if(Ie(e),n&&!p&&he(e.currentTarget.ownerDocument)===e.currentTarget)return R.current=fi(e.key,w,m)?i:s,void B(R.current);fi(e.key,w,m)?R.current=f?t>=s?d&&t!==a.current.length?-1:i:en(a,{startingIndex:t,disabledIndices:y}):Math.min(s,en(a,{startingIndex:t,disabledIndices:y})):R.current=f?t<=i?d&&-1!==t?a.current.length:s:en(a,{startingIndex:t,decrement:!0,disabledIndices:y}):Math.max(i,en(a,{startingIndex:t,decrement:!0,disabledIndices:y})),Qt(a,R.current)?B(null):B(R.current);}})),X=i__namespace.useMemo((()=>p&&n&&G&&{"aria-activedescendant":W||U}),[p,n,G,W,U]),Z=i__namespace.useMemo((()=>({"aria-orientation":"both"===w?void 0:w,...!Ae(r.domReference)&&X,onKeyDown:Q,onPointerMove(){O.current=!0;}})),[X,Q,r.domReference,w]),te=i__namespace.useMemo((()=>{function e(e){"auto"===g&&ve(e.nativeEvent)&&(P.current=!0);}return {...X,onKeyDown(e){O.current=!1;const t=e.key.startsWith("Arrow"),i=["Home","End"].includes(e.key),r=t||i,s=function(e,t,n){return ui(t,n?e===Kt:e===Gt,e===qt)}(e.key,w,m),c=hi(e.key,w,m),l=di(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),Tn(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)===U)):null;o&&(Ie(e),o.dispatchEvent(t),q(void 0));}var v;if((l||i)&&n.context)if(n.context.open&&n.parentId&&e.currentTarget!==n.context.elements.domReference)return Ie(e),void(null==(v=n.context.elements.domReference)||v.dispatchEvent(t))}return Q(e)}(n||b||!t)&&(d&&(L.current=h&&l?null:e.key),h?s&&(Ie(e),n?(R.current=Xt(a,H.current),B(R.current)):o(!0,e.nativeEvent,"list-navigation")):l&&(null!=u&&(R.current=u),Ie(e),!n&&b?o(!0,e.nativeEvent,"list-navigation"):Q(e),n&&B(R.current)));},onFocus(){n&&!p&&B(null);},onPointerDown:function(e){P.current=g,"auto"===g&&be(e.nativeEvent)&&(P.current=!0);},onMouseDown:e,onClick:e}}),[U,X,Q,H,g,a,h,B,o,n,b,w,m,u,A,p,N]);return i__namespace.useMemo((()=>l?{reference:te,floating:Z,item:Y}:{}),[l,te,Z,Y])}const pi=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function gi(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 vi(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=Ce(e),w="mouseleave"===e.type,k=me(d.floating,y),S=me(d.domReference,y),N=d.domReference.getBoundingClientRect(),C=d.floating.getBoundingClientRect(),x=u.split("-")[0],E=n>C.right-C.width/2,I=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)&&me(d.floating,e.relatedTarget))return;if(m&&Tn(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(!gi([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()}gi([g,v],function(e){let[n,i]=e;switch(x){case"top":return [[B?n+t/2:E?n+4*t:n-4*t,i+t+1],[B?n-t/2:E?n+4*t:n-4*t,i+t+1],...[[C.left,E||B?C.bottom-t:C.top],[C.right,E?B?C.bottom-t:C.top:C.bottom-t]]];case"bottom":return [[B?n+t/2:E?n+4*t:n-4*t,i-t],[B?n-t/2:E?n+4*t:n-4*t,i-t],...[[C.left,E||B?C.top+t:C.bottom],[C.right,E?B?C.top+t:C.bottom:C.top+t]]];case"left":{const e=[n+t+1,T?i+t/2:I?i+4*t:i-4*t],o=[n+t+1,T?i-t/2:I?i+4*t:i-4*t];return [...[[I||T?C.right-t:C.left,C.top],[I?T?C.right-t:C.left:C.right-t,C.bottom]],e,o]}case"right":return [[n-t,T?i+t/2:I?i+4*t:i-4*t],[n-t,T?i-t/2:I?i+4*t:i-4*t],...[[I||T?C.left+t:C.right,C.top],[I?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 bi=i.createContext({getItemProps:()=>({}),activeIndex:null,setActiveIndex:()=>{},setHasFocusInside:()=>{},isOpen:!1}),yi=i.forwardRef((({className:t,disabled:n,children:i$1,...o},r)=>{const a=i.useContext(bi),c=ln(),l=kn(),u=c.index===a.activeIndex,d=w("io-dropdown-menu-item",n&&"io-dropdown-menu-item-disabled",t);return jsxRuntimeExports.jsx("div",{ref:jt([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$1})}));yi.displayName="DropdownMenuItem";const wi=i.forwardRef((({className:n,variant:o="default",icon:r,iconRight:a,text:f="",disabled:h,children:m,...p},g)=>{const[v,b]=i.useState(!1),[y,k]=i.useState(!1),[S,N]=i.useState(null),C=i.useRef([]),x=i.useRef([]),E=i.useContext(bi),I=kn(),B=function(e){const t=mn(),n=kn(),i=wn();return rn((()=>{const e={id:t,parentId:i};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e);}}),[n,t,i]),t}(),T=wn(),P=ln(),R=null!=T,{floatingStyles:L,refs:O,context:F}=ri({nodeId:B,open:v,onOpenChange:b,placement:R?"right-start":"bottom-start",middleware:[(D={mainAxis:R?0:4,alignmentAxis:R?-4:0},{...Pt(D),options:[D,M]}),$t(),Ht()],whileElementsMounted:Tt});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=kn(),p=wn(),g=xn(u),v=xn(l),b=xn(n),y=i__namespace.useRef(),w=i__namespace.useRef(-1),k=i__namespace.useRef(),S=i__namespace.useRef(-1),N=i__namespace.useRef(!0),C=i__namespace.useRef(!1),x=i__namespace.useRef((()=>{})),E=i__namespace.useRef(!1),I=i__namespace.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__namespace.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,E.current=!1);}}),[c,a]),i__namespace.useEffect((()=>{if(!c)return;if(!g.current)return;if(!n)return;function e(e){I()&&o(!1,e,"hover");}const t=Se(s.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e);}}),[s.floating,n,o,c,g,I]);const A=i__namespace.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=Se(s.floating).body;e.style.pointerEvents="",e.removeAttribute(En),C.current=!1;}})),P=Jt((()=>!!r.current.openEvent&&["click","mousedown"].includes(r.current.openEvent.type)));i__namespace.useEffect((()=>{if(c&&Z(s.domReference)){var e;const o=s.domReference;return n&&o.addEventListener("mouseleave",a),null==(e=s.floating)||e.addEventListener("mouseleave",a),h&&o.addEventListener("mousemove",t,{once:!0}),o.addEventListener("mouseenter",t),o.addEventListener("mouseleave",i),()=>{var e;n&&o.removeEventListener("mouseleave",a),null==(e=s.floating)||e.removeEventListener("mouseleave",a),h&&o.removeEventListener("mousemove",t),o.removeEventListener("mouseenter",t),o.removeEventListener("mouseleave",i);}}function t(e){if(clearTimeout(w.current),N.current=!1,d&&!ke(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):n||o(!0,e,"hover");}function i(e){if(P())return;x.current();const t=Se(s.floating);if(clearTimeout(S.current),E.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(),P()||A(e,!0,"safe-polygon");}});const i=k.current;return t.addEventListener("mousemove",i),void(x.current=()=>{t.removeEventListener("mousemove",i);})}("touch"!==y.current||!me(s.floating,e.relatedTarget))&&A(e);}function a(e){P()||r.current.floatingContext&&(null==g.current||g.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){T(),B(),P()||A(e);}})(e));}}),[s,c,e,d,f,h,A,B,T,o,n,b,m,v,g,r,P]),rn((()=>{var e;if(c&&n&&null!=(e=g.current)&&e.__options.blockPointerEvents&&I()){C.current=!0;const e=s.floating;if(Z(s.domReference)&&e){var t;const n=Se(s.floating).body;n.setAttribute(En,"");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,I]),rn((()=>{n||(y.current=void 0,E.current=!1,B(),T());}),[n,B,T]),i__namespace.useEffect((()=>()=>{B(),clearTimeout(w.current),clearTimeout(S.current),T();}),[c,s.domReference,B,T]);const R=i__namespace.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&&!ke(y.current)||n||0===f||E.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(S.current),"touch"===y.current?i():(E.current=!0,S.current=window.setTimeout(i,f)));}}}),[d,o,n,b,f]),L=i__namespace.useMemo((()=>({onMouseEnter(){clearTimeout(w.current);},onMouseLeave(e){P()||A(e.nativeEvent,!1);}})),[A,P]);return i__namespace.useMemo((()=>c?{reference:R,floating:L}:{}),[c,R,L])}(F,{enabled:R,delay:{open:75},handleClose:vi({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,stickIfOpen:f=!0}=t,h=i__namespace.useRef(),m=i__namespace.useRef(!1),p=i__namespace.useMemo((()=>({onPointerDown(e){h.current=e.pointerType;},onMouseDown(e){const t=h.current;0===e.button&&"click"!==c&&(ke(t,!0)&&u||(!n||!l||r.current.openEvent&&f&&"mousedown"!==r.current.openEvent.type?(e.preventDefault(),o(!0,e.nativeEvent,"click")):o(!1,e.nativeEvent,"click")));},onClick(e){const t=h.current;"mousedown"===c&&h.current?h.current=void 0:ke(t,!0)&&u||(!n||!l||r.current.openEvent&&f&&"click"!==r.current.openEvent.type?o(!0,e.nativeEvent,"click"):o(!1,e.nativeEvent,"click"));},onKeyDown(e){h.current=void 0,e.defaultPrevented||!d||Zn(e)||(" "!==e.key||ei(a)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&o(!n||!l,e.nativeEvent,"click"));},onKeyUp(e){e.defaultPrevented||!d||Zn(e)||ei(a)||" "===e.key&&m.current&&(m.current=!1,o(!n||!l,e.nativeEvent,"click"));}})),[r,a,c,u,d,o,n,f,l]);return i__namespace.useMemo((()=>s?{reference:p}:{}),[s,p])}(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=pi.get(s))?n:s,l=mn(),u=null!=wn(),d=i__namespace.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__namespace.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__namespace.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__namespace.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=kn(),v=Jt("function"==typeof l?l:()=>!1),b="function"==typeof l?v:l,y=i__namespace.useRef(!1),w=i__namespace.useRef(!1),{escapeKey:k,outsidePress:S}=ii(m),{escapeKey:N,outsidePress:C}=ii(p),x=i__namespace.useRef(!1),E=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?Tn(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");})),I=Jt((e=>{var t;const n=()=>{var t;E(e),null==(t=Ce(e))||t.removeEventListener("keydown",n);};null==(t=Ce(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=Ce(e),c="["+Cn("inert")+"]",l=Se(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")&&!me(s,r.floating)&&Array.from(l).every((e=>!me(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&&Tn(g.nodesRef.current,f).some((t=>{var n;return Ne(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Ne(e,r.floating)||Ne(e,r.domReference)||h)return;const m=g?Tn(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=Ce(e))||t.removeEventListener(u,n);};null==(t=Ce(e))||t.addEventListener(u,n);}));i__namespace.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=Se(r.floating);c&&(d.addEventListener("keydown",N?I:E,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?I:E,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,E,N,I,A,C,B]),i__namespace.useEffect((()=>{y.current=!1;}),[b,u]);const T=i__namespace.useMemo((()=>({onKeyDown:E,[ti[f]]:e=>{d&&o(!1,e.nativeEvent,"reference-press");}})),[E,o,d,f]),P=i__namespace.useMemo((()=>({onKeyDown:E,onMouseDown(){w.current=!0;},onMouseUp(){w.current=!0;},[ni[u]]:()=>{y.current=!0;}})),[E,u]);return i__namespace.useMemo((()=>s?{reference:T,floating:P}:{}),[s,T,P])}(F,{bubbles:!0}),j=mi(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__namespace.useCallback((t=>ci(t,e,"reference")),t),a=i__namespace.useCallback((t=>ci(t,e,"floating")),n),s=i__namespace.useCallback((t=>ci(t,e,"item")),o);return i__namespace.useMemo((()=>({getReferenceProps:r,getFloatingProps:a,getItemProps:s})),[r,a,s])}([z,_,H,$,j]);i.useEffect((()=>{if(I)return I.events.on("click",e),I.events.on("menuopen",t),()=>{I.events.off("click",e),I.events.off("menuopen",t);};function e(){b(!1);}function t(e){e.nodeId!==B&&e.parentId===T&&b(!1);}}),[I,B,T]),i.useEffect((()=>{v&&I&&I.events.emit("menuopen",{parentId:T,nodeId:B});}),[I,v,B,T]);const W={activeIndex:S,setActiveIndex:N,getItemProps:J,setHasFocusInside:k,isOpen:v},q=i.useMemo((()=>W),[S,N,J,k,v]),K=w("io-dropdown-menu-button",R&&"io-dropdown-menu-item",v&&!R&&"active",n),G=jt([O.setReference,P.ref,g]),Y=E.activeIndex===P.index?0:-1;return jsxRuntimeExports.jsxs(Sn,{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(E.getItemProps({onFocus(e){p.onFocus?.(e),k(!1),E.setHasFocusInside(!0);},...p}))}),jsxRuntimeExports.jsx(bi.Provider,{value:q,children:jsxRuntimeExports.jsx(cn,{elementsRef:C,labelsRef:x,children:v&&jsxRuntimeExports.jsx(Xn,{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 ki({className:t,...n}){const i=w("io-separator",t);return jsxRuntimeExports.jsx("hr",{className:i,...n})}wi.displayName="DropdownMenu";const Si=i.forwardRef((({...t},n)=>null===wn()?jsxRuntimeExports.jsx(Nn,{children:jsxRuntimeExports.jsx(wi,{ref:n,...t})}):jsxRuntimeExports.jsx(wi,{ref:n,...t})));function Ci({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 xi({className:t,children:n,...i}){const o=w("io-panel-header",t);return jsxRuntimeExports.jsx(j,{className:o,...i,children:n})}Si.displayName="DropdownMenu",Si.Item=yi,Si.Separator=ki,xi.Title=E,xi.ButtonGroup=$,xi.Button=A,xi.ButtonIcon=S,xi.Dropdown=H;const Ei=i.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 Ii({className:t,...n}){const i=w("io-panel-footer",t);return jsxRuntimeExports.jsx(J,{className:i,...n})}function Ai({className:t,children:n,...i}){const o=w("io-panel",t);return jsxRuntimeExports.jsx("div",{className:o,...i,children:n})}function Pi({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 Ri({text:t="Label",...n}){return jsxRuntimeExports.jsx("label",{...n,children:t})}Ei.displayName="PanelBody",Ii.ButtonGroup=$,Ii.Button=A,Ii.ButtonIcon=S,Ii.Dropdown=H,Ai.Header=xi,Ai.Body=Ei,Ai.Footer=Ii;const Li=i.forwardRef((({id:n="input",className:i$1,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$1),S=i.useCallback((e=>{m?e.preventDefault():u&&u(e);}),[u,m]),N=i.useCallback((e=>{m?e.preventDefault():f&&f(e);}),[f,m]);return jsxRuntimeExports.jsxs("div",{className:y,children:[c&&jsxRuntimeExports.jsx(Ri,{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]})]})}));Li.displayName="Input";const Oi=i.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(Ri,{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})]})}));Oi.displayName="Textarea";const Fi=i.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(Ri,{htmlFor:n,text:a})]})}));Fi.displayName="Checkbox";const Di=i.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(Ri,{htmlFor:n,text:a})]})}));Di.displayName="Radio";const Mi=i.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 _i(e,t){const n=i.useCallback((n=>{t.some((e=>n.key===e))&&(n.preventDefault(),e());}),[e,t]);i.useEffect((()=>(document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n);})),[n]);}Mi.displayName="Toggle";const Hi=e=>"string"==typeof e?e:e?.message?"string"==typeof e.message?e.message:JSON.stringify(e.message):JSON.stringify(e);function $i({app:e,prefKey:t,decoder:n}){const i$1=i.useContext(IOConnectContext),[o,a]=i.useState(),[l,f]=i.useState(!0),[h,m]=i.useState(),p=i.useRef(0),v=i.useCallback((e=>{if(null==e)return;return n.runWithException(e)}),[n]),b=i.useCallback((async()=>{if(!i$1)return;const n=await i$1.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: ${Hi(e)}`)}}),[e,i$1,t,v]),y=i.useCallback((async n=>{if(!i$1)return;const o=++p.current;f(!0),m(void 0);const r=e=>{o===p.current&&(f(!1),e&&(console.error(e),m({message:Hi(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: ${Hi(e)}`)}try{await i$1.prefs.updateFor(e,{[t]:s});}catch(e){return r(e)}r();}),[e,b,i$1,t,v]);return i.useEffect((()=>{if(!i$1)return;let n=!0;const o=i$1.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: ${Hi(e)}`;console.error(n),m({message:n});}n&&(n=!1,f(!1));}));return o}),[e,t,i$1,v]),{error:h,isLoading:l,value:o,update:y}}function Ui(e,t=500){const[n,i$1]=i.useState(e);return i.useEffect((()=>{const n=setTimeout((()=>{i$1(e);}),t);return ()=>clearTimeout(n)}),[e,t]),n}i.createContext({theme:"dark"});function Yi(e,t,n){return Math.min(Math.max(e,n),t)}class Qi extends Error{constructor(e){super(`Failed to parse color: "${e}"`);}}var Xi=Qi;function Zi(e){if("string"!=typeof e)throw new Xi(e);if("transparent"===e.trim().toLowerCase())return [0,0,0,0];let t=e.trim();t=so.test(e)?function(e){const t=e.toLowerCase().trim(),n=to[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 Xi(e);return `#${n}`}(e):e;const n=io.exec(t);if(n){const e=Array.from(n).slice(1);return [...e.slice(0,3).map((e=>parseInt(no(e,2),16))),parseInt(no(e[3]||"f",2),16)/255]}const i=oo.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=ro.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=ao.exec(t);if(r){const[t,n,i,o]=Array.from(r).slice(1).map(parseFloat);if(Yi(0,100,n)!==n)throw new Xi(e);if(Yi(0,100,i)!==i)throw new Xi(e);return [...lo(t,n,i),Number.isNaN(o)?1:o]}throw new Xi(e)}const eo=e=>parseInt(e.replace(/_/g,""),36),to="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=eo(t.substring(0,3)),i=eo(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 no=(e,t)=>Array.from(Array(t)).map((()=>e)).join(""),io=new RegExp(`^#${no("([a-f0-9])",3)}([a-f0-9])?$`,"i"),oo=new RegExp(`^#${no("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),ro=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${no(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),ao=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,so=/^[a-z]+$/i,co=e=>Math.round(255*e),lo=(e,t,n)=>{let i=n/100;if(0===t)return [i,i,i].map(co);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(co)};function uo(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]=Zi(e);return .2126*t(n)+.7152*t(i)+.0722*t(o)}(e)>.179}function fo({className:t,channel:n,...i}){const o=w("io-channel-badge",t);return jsxRuntimeExports.jsx("div",{className:o,style:{color:(r=n.color,uo(r)?"#000":"#fff"),backgroundColor:n.color},...i,children:jsxRuntimeExports.jsx("span",{className:"io-channel-badge-label",children:n.label})});var r;}function ho(){return jsxRuntimeExports.jsx(k,{variant:"check"})}function mo({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(Mi,{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(Mi,{label:"Subscribe",checked:i.read,onChange:()=>{o({...i,read:!i.read});},disabled:r?.read})})]})}const po=i.createContext({});function go({channel:t,isSelected:n,onChannelSelect:i$1,onChannelRestrict:o,...a}){const{variant:c,selectedChannels:l,restrictedChannels:u}=i.useContext(po),d=n||t.isSelected||l?.includes(t),f=u?.find((e=>e.name===t.name)),h=i.useCallback((()=>i$1?.({...t,isSelected:!d})),[t,i$1,d]),m=i.useCallback((e=>{o&&o(e);}),[o]);return jsxRuntimeExports.jsx(R,{prepend:jsxRuntimeExports.jsx(fo,{channel:t}),append:"single"===c||"multi"===c?d&&jsxRuntimeExports.jsx(ho,{}):jsxRuntimeExports.jsx(mo,{channel:t,handleChannelRestricted:m,restricted:f}),isSelected:d,onClick:h,...a,children:t.name},t.name)}const vo=i.forwardRef((({className:n,variant:i$1="single",variantToggle:o=!1,channels:r=[],restrictedChannels:a=[],onVariantChange:s,onChannelSelect:c,onChannelRestrict:u,...d},f)=>{const h=w("io-list-channels","directionalSingle"===i$1&&"io-bi-direction",n),m=r.filter((e=>e.isSelected)),p=i.useMemo((()=>({variant:i$1,selectedChannels:m,restrictedChannels:a,onVariantChange:s,onChannelSelect:c,onChannelRestrict:u})),[i$1,m,a,s,c,u]);let g="Select Channel";return "multi"===i$1?g="Select Channels":"directionalSingle"===i$1&&(g="Select Directional Channel"),jsxRuntimeExports.jsx(po.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(Mi,{label:"Directional",align:"right",onChange:e=>s&&s(e.target.checked),checked:"directionalSingle"===i$1}),children:g}),r?.map((t=>jsxRuntimeExports.jsx(go,{channel:t,onChannelSelect:c,onChannelRestrict:u},t.name)))]})})})}));vo.displayName="ChannelSelector";var bo=Object.freeze({__proto__:null,Channel:go,ChannelBadge:fo,ChannelDirectionalAppend:mo,ChannelSelector:vo,ChannelSingleAppend:ho,useIOCDChannels:function(e){const t="T42.ChannelSelector.Execute",n=i.useContext(IOConnectContext),[i$1,o]=i.useState(null),[a,l]=i.useState([]),[h,m]=i.useState(""),[p,v]=i.useState(!1),[b,y]=i.useState(),[w,k]=i.useState("single"),S=i.useRef(),N=n?.windows.my(),C=i.useCallback((async e=>{const t=n.windows.findById(e),i=await(t?.application?.getConfiguration());return t&&i?i.details?.channelSelector?.preventModifyingRestrictionsFor??[]:[]}),[n.windows]),x=i.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]),E=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$1?.find((e=>e.isSelected))?.name;"single"===w||"directionalSingle"===w?c=l===e:"multi"===w&&(c=i$1?.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$1,w,N,h]),I=i.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=i.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 _i((()=>{N?.hide().catch(console.error);}),["Escape"]),i.useEffect((()=>{const e=N?.onClosing((async e=>(e({showDialog:!1}),Promise.resolve())));return e}),[N]),i.useEffect((()=>{const e=n.windows.findById(h);if(!e)return;if("function"!=typeof e?.onChannelRestrictionsChanged)return;return e.onChannelRestrictionsChanged(A)}),[n.windows,h,A]),i.useEffect((()=>((async()=>{await(n?.interop.registerAsync(t,x));})(),()=>{n?.interop.unregister(t);})),[n?.interop,x]),i.useLayoutEffect((()=>{if(e?.current&&i$1&&i$1.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$1,e]),{onChannelSelected:E,onChannelRestricted:I,variant:w,isLoading:p,channels:i$1,restrictedChannels:a,error:b,windowId:h}}});i.createContext({config:{message:""},theme:"dark",setResult:()=>{}});function To({title:n="Downloads"}){const{ItemSearch:i,HeaderButtons:o}=tr();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 Ro=i.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}),Lo=()=>i.useContext(Ro);function Oo({className:n,icon:i$1="search",placeholder:o="Search",...r}){const a=w("io-header-search",n),s=i.useRef(null),{isSearchVisible:c,searchQuery:l,setSearch:f,itemsCount:h}=Lo();return i.useEffect((()=>{c?s.current?.focus():(s.current?.blur(),f(""));}),[c,f]),c?jsxRuntimeExports.jsxs("div",{className:a,children:[jsxRuntimeExports.jsx(Li,{ref:s,value:l,iconPrepend:i$1,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 Fo({className:n,...i}){const{SearchButton:o,SettingsButton:r,MoreButton:a}=tr();return jsxRuntimeExports.jsxs($,{className:n,align:"right",...i,children:[jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{})]})}function Do({...t}){const{isSearchVisible:n,showSearch:i,hideSearch:o,items:r}=Lo();return jsxRuntimeExports.jsx(S,{icon:n?"search-filled":"search",variant:"circle",size:"32",onClick:n?o:i,disabled:0===r.length,...t})}function Mo({icon:t="cog",...n}){const{showSettings:i}=Lo();return jsxRuntimeExports.jsx(S,{icon:t,variant:"circle",size:"32",onClick:i,...n})}function zo({icon:n="ellipsis",...i}){const{items:o,clearItems:r}=Lo(),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 _o(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 Ho(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?_o(n,"Today",!1,!0):s?_o(n,"Yesterday",!1,!0):c?_o(n,!1,!1,!0):_o(n):a?"Today":s?"Yesterday":c?_o(n,!1,!0,!0):_o(n,!1,!0)}function $o({className:t,...n}){const i$1=w("io-dm-body",t),{DownloadListEmpty:o,ItemGroup:r,Item:a}=tr(),{items:s,searchQuery:c,setCount:d,sortItems:f}=Lo(),h=f(s),m=Ui(c),p=i.useMemo((()=>h.filter((e=>e.displayInfo.filename.toLowerCase().includes(m.toLowerCase())||e.displayInfo.url.toLowerCase().includes(m.toLowerCase())))),[h,m]),g=i.useMemo((()=>p.map((e=>({...e,displayInfo:{...e.displayInfo,startTime:Ho(e.displayInfo.startTime,{showTime:!1})}})))),[p]),v=i.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 i.useEffect((()=>{d(p.length);}),[p,d]),jsxRuntimeExports.jsx("div",{className:i$1,...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 jo({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 Vo({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 Uo({className:i,item:o,...r}){const{ItemHeader:a,ItemBody:s,ItemFooter:c}=tr(),{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 Jo({bytesReceived:t=0,bytesTotal:n=0,...i$1}){const o=i.useCallback((()=>t&&n?Math.round(t/n*100):0),[t,n]);return jsxRuntimeExports.jsx(Pi,{value:o(),...i$1})}function Wo({className:n,itemID:i$1,filename:o,state:a,cancel:s,remove:c,...l}){const u=w("io-dm-item-header",n),{cancelItem:d,removeItem:f}=Lo(),h=i.useCallback((e=>{s?s(e):d(e);}),[s,d]),m=i.useCallback((e=>{c?c(e):f(e);}),[c,f]);return jsxRuntimeExports.jsxs("div",{className:u,...l,children:[jsxRuntimeExports.jsx(E,{text:o,style:{textDecoration:"interrupted"===a||"cancelled"===a?"line-through":"none"}}),jsxRuntimeExports.jsx(S,{icon:"close",onClick:()=>{"progressing"===a||"paused"===a?h(i$1):m(i$1);}})]})}function qo({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(Jo,{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 Ko={success:"check-solid",warning:"exclamation-mark",critical:"exclamation-mark"};function Go({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:Ko[i],className:"icon-severity"}),o&&jsxRuntimeExports.jsx("p",{className:"io-text-smaller",children:o})]})}function Yo({className:i$1,itemID:o,state:a,pauseResume:s,showInFolder:c,cancel:l,...u}){const d=w("io-dm-item-footer",i$1),{pauseResumeItem:f,showItemInFolder:h,cancelItem:m}=Lo(),p=i.useCallback((e=>{s?s(e):f(e);}),[s,f]),g=i.useCallback((e=>{c?c(e):h(e);}),[c,h]),v=i.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(Go,{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(Go,{variant:"warning",text:"Cancelled"})});case"interrupted":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Go,{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}=Lo();return jsxRuntimeExports.jsxs(Ai,{className:r,...o,children:[jsxRuntimeExports.jsxs(Ai.Header,{children:[jsxRuntimeExports.jsx(Ai.Header.Title,{size:"large",text:i,tag:"h1"}),jsxRuntimeExports.jsx(Ai.Header.ButtonGroup,{children:jsxRuntimeExports.jsx(S,{variant:"circle",icon:"close",size:"32",onClick:()=>{s();},disabled:u})})]}),jsxRuntimeExports.jsx(Ai.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 Xo={Header:To,ItemSearch:Oo,HeaderButtons:Fo,SearchButton:Do,SettingsButton:Mo,MoreButton:zo,Body:$o,DownloadListEmpty:jo,ItemGroup:Vo,Item:Uo,ItemProgress:Jo,ItemHeader:Wo,ItemBody:qo,ItemFooter:Yo,Settings:Qo},Zo=i.createContext(Xo),er=i.memo((({children:t,components:n})=>{const i$1=i.useMemo((()=>({...Xo,...n})),[n]);return jsxRuntimeExports.jsx(Zo.Provider,{value:i$1,children:t})}));er.displayName="ComponentsStore";const tr=()=>i.useContext(Zo);function or(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];}}}or.default=or;v(or);const sr=i.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:()=>{}}),cr=()=>i.useContext(sr);function lr({...n}){const{config:i,close:o}=cr(),{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 ur({className:n,handleSubmit:i,...o}){const r=w("io-panel-body",n),{config:a,submitFeedback:s}=cr(),{IntroField:c,DescriptionField:l,TechInfoField:u,EnvInfoField:d,FileAttachmentsField:f,CategoryAttachmentsField:h,SettingsField:m,MailListField:p}=Ar(),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 dr({...n}){const{FooterButtons:i}=Ar(),{openUrl:o,submitInProgress:r,submitStatus:a,jiraTicketURL:s}=cr();return jsxRuntimeExports.jsx(J,{...n,children:jsxRuntimeExports.jsxs("div",r?{className:"flex ai-center jc-between",children:[jsxRuntimeExports.jsx(I,{children:jsxRuntimeExports.jsx("p",{children:a.title})}),jsxRuntimeExports.jsx(Ci,{align:"right",size:"small"})]}:{className:"flex ai-center jc-between",children:[jsxRuntimeExports.jsxs(I,{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 fr({className:t,...n}){const{CloseButton:i}=Ar(),{close:o}=cr();return jsxRuntimeExports.jsx($,{className:t,...n,children:jsxRuntimeExports.jsx(i,{onClick:()=>o()})})}function hr({className:n,...i}){const{SubmitButton:o,CancelButton:r,CloseButton:a}=Ar(),{close:s,submitCompleted:c}=cr();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 mr({text:t="Submit",...n}){return jsxRuntimeExports.jsx(A,{form:"feedback",type:"submit",variant:"primary",text:t,...n})}function pr({text:t="Cancel",...n}){return jsxRuntimeExports.jsx(A,{variant:"link",text:t,...n})}function gr({...t}){return jsxRuntimeExports.jsx(A,{variant:"primary",...t})}function vr({showField:t=!0,className:n,title:i,hint:o,children:r,...a}){return t?jsxRuntimeExports.jsx(I,{className:n,title:i,hint:o,...a,children:r}):null}function br({showField:t=!0,className:n,title:i="Description",hint:o,readOnly:r=!1,disabled:a,...s}){return t?jsxRuntimeExports.jsx(I,{className:n,hint:o,title:"",...s,children:jsxRuntimeExports.jsx(Oi,{id:"description",name:"description",label:i,readOnly:r,disabled:a})}):null}function yr({showField:t,className:n,title:i="Technical Information",hint:o,fieldValue:r,readOnly:a=!1,disabled:s,...c}){const{config:l}=cr(),u=t??l.errorMessage,d=r??l.errorMessage;return u&&d?jsxRuntimeExports.jsx(I,{className:n,hint:o,...c,children:jsxRuntimeExports.jsx(Oi,{id:"errorMessage",name:"errorMessage",label:i,value:d,readOnly:a,disabled:s})}):null}function wr({showField:t,className:n,title:i="Environment Information",hint:o,fieldValue:r,readOnly:a=!1,disabled:s,...c}){const{config:l}=cr(),u=t??l.showEnvironmentInfo,d=r??l.environmentInfo;return u&&d?jsxRuntimeExports.jsx(I,{className:n,hint:o,...c,children:jsxRuntimeExports.jsx(Oi,{id:"environmentInfo",name:"environmentInfo",label:i,value:d,readOnly:a,disabled:s})}):null}function kr({showField:t=!0,className:n,title:i$1="Attachments",hint:o,readOnly:a=!1,disabled:s,attachments:c,selectedCategories:l,...u}){const d=w("io-block-list-gap",n),{config:f}=cr(),h=c??f.attachments,m=l??f.selectedCategories,p=i.useCallback((e=>!!m&&-1!==m.indexOf(e)),[m]);return t?!h||h.length<=0?jsxRuntimeExports.jsx(I,{title:"Attachments",children:jsxRuntimeExports.jsx("p",{children:"No Attachments"})}):jsxRuntimeExports.jsx(I,{className:d,title:i$1,hint:o,...u,children:jsxRuntimeExports.jsx("div",{className:"file-attachments",children:h.map((t=>jsxRuntimeExports.jsx(Fi,{id:t.id,name:t.id,label:t.name,readOnly:a,disabled:s,defaultChecked:p(t.category)},t.id)))})}):null}function Sr({showField:t=!0,className:n,title:i$1="Attachments",hint:o,readOnly:a=!1,disabled:s,categories:c,selectedCategories:l,...u}){const{config:d,attachmentCategories:f}=cr(),h=c??f,m=l??d.selectedCategories,p=i.useCallback((e=>!!m&&-1!==m.indexOf(e)),[m]);return t?!h||h.length<=0?jsxRuntimeExports.jsx("p",{children:"No Attachments"}):jsxRuntimeExports.jsx(I,{className:n,title:i$1,hint:o,...u,children:jsxRuntimeExports.jsx("div",{className:"category-attachments",children:h.map((t=>jsxRuntimeExports.jsx(Mi,{id:t,name:t,align:"right",label:t,readOnly:a,disabled:s,defaultChecked:p(t)},t)))})}):null}function Nr({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}=cr();if(!r)return null;const v=a??m.createJiraTicket,b=c??m.sendEmail;return jsxRuntimeExports.jsxs(I,{className:h,hint:o,title:i,...f,children:[v&&jsxRuntimeExports.jsx(Mi,{id:"createJiraTicket",name:"createJiraTicket",label:s,align:"right",readOnly:u,disabled:d,defaultChecked:v}),b&&jsxRuntimeExports.jsx(Mi,{onChange:()=>{g(!p);},id:"sendEmail",name:"sendEmail",label:l,align:"right",readOnly:u,disabled:d,defaultChecked:b})]})}function Cr({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}=cr(),d=t??l.sendEmail,f=a??!1===l.allowEditRecipients;return d&&u?jsxRuntimeExports.jsx(I,{className:n,hint:o,...c,children:jsxRuntimeExports.jsx(Li,{id:"mailingList",name:"mailingList",label:i,placeholder:r,readOnly:f,disabled:s,defaultValue:l.mailingList??""})}):null}const xr={Header:lr,Body:ur,Footer:dr,HeaderButtons:fr,FooterButtons:hr,SubmitButton:mr,CancelButton:pr,CloseButton:gr,IntroField:vr,DescriptionField:br,TechInfoField:yr,EnvInfoField:wr,FileAttachmentsField:kr,CategoryAttachmentsField:Sr,SettingsField:Nr,MailListField:Cr},Er=i.createContext(xr),Ir=i.memo((({children:t,components:n})=>{const i$1=i.useMemo((()=>({...xr,...n})),[n]);return jsxRuntimeExports.jsx(Er.Provider,{value:i$1,children:t})}));function Ar(e){return {...i.useContext(Er),...e}}Ir.displayName="ComponentsStore";function Rr(e){const t=i.useContext(IOConnectContext),n=t?.appManager,[i$1,o]=i.useState([]),[a,l]=i.useState(0),d="*",f=i.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 i.useEffect((()=>{if(!n)return;const e=n.onAppAdded((e=>{o((t=>[...t,{title:e.title,name:e.name,hidden:e.hidden}]));}));return ()=>{e();}}),[n]),i.useEffect((()=>{if(!n)return;const e=n.onAppRemoved((e=>{o((t=>t.filter((t=>t.name!==e.name))));}));return ()=>{e();}}),[n,i$1]),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]),i.useEffect((()=>{const n=e?.allApplications??t.appManager.applications().length;let r=0;const a=[...i$1],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$1,allowedApps:a,sortAppsAlphabetically:f}}const Dr=i.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:()=>{}}),Mr=()=>i.useContext(Dr);const zr=i.createContext({isSearchVisible:!1,showSearch:()=>{},hideSearch:()=>{},searchQuery:"",setSearch:()=>{},isSettingsVisible:!1,showSettings:()=>{},hideSettings:()=>{},sortNotificationsBy:"newest",setSortBy:()=>{},viewNotificationsBy:"all",setViewBy:()=>{},notificationsCount:0,setCount:()=>{},isBulkActionsVisible:!1,showBulkActions:()=>{},hideBulkActions:()=>{}}),_r=()=>i.useContext(zr);function Hr({...n}){const{HeaderCaption:i,HeaderActions:o,HeaderBulkActions:r,HeaderSearch:a}=Xa(),{isBulkActionsSupported:s}=Mr(),{isBulkActionsVisible:c,notificationsCount:l}=_r();return jsxRuntimeExports.jsxs(xi,{...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 $r({className:n,...i}){const o=w("io-panel-header-caption",n),{HeaderCaptionTitle:r,HeaderCaptionCount:a,HeaderCaptionButtons:s}=Xa();return jsxRuntimeExports.jsxs("div",{className:o,...i,children:[jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})}function jr({className:n,...i}){const o=w("io-panel-header-caption-filter",n),{allApplications:r,allowedApplications:a}=Mr();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 Vr({text:n="Notifications",counter:i,...o}){const{notificationsCount:r}=_r();return jsxRuntimeExports.jsx(E,{text:n,size:"large",...o,children:(i??!0)&&jsxRuntimeExports.jsxs("span",{children:["(",r,")"]})})}function Ur({...n}){const{HeaderCaptionButtonSearch:i,HeaderCaptionButtonSettings:o,HeaderCaptionButtonClose:r}=Xa();return jsxRuntimeExports.jsxs($,{...n,children:[jsxRuntimeExports.jsx(i,{}),jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{})]})}const Jr="newest",Wr=["None","Low","Medium","High","Critical"],qr={key:Jr,descending:!0},Kr=e=>[...e].sort(((e,t)=>(t.timestamp||0)-(e.timestamp||0))),Gr=e=>[...e].sort(((e,t)=>(e.timestamp||0)-(t.timestamp||0))),Yr=(e,t)=>{const n=Wr[0];return [...e].sort(((e,i)=>{const o=Wr.indexOf(e.severity||n),r=Wr.indexOf(i.severity||n);return (t?-1:1)*(o-r)}))},Qr={[Jr]:Kr,["oldest"]:Gr,["severity"]:Yr};function Xr({...t}){const[n,i$1]=i.useState([]),{NotificationsList:o,Notification:r}=Xa(),{sortNotificationsBy:a,viewNotificationsBy:s,setCount:f,searchQuery:h,notificationsCount:m}=_r(),{notifications:p}=Mr(),g=i.useRef(null),v=Ui(h),b=i.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=i.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 i.useEffect((()=>{switch(a){case"newest":i$1(Kr(y));break;case"oldest":i$1(Gr(y));break;case"severity":i$1(Yr(y,!0));break;default:i$1(y);}f(y.length);}),[y,a,f]),i.useEffect((()=>{g.current&&g.current?.scrollTo({top:0,behavior:"smooth"});}),[v,m,a,s]),jsxRuntimeExports.jsx(Ei,{ref:g,...t,children:jsxRuntimeExports.jsx(o,{notifications:n,Notification:r})})}function Zr({...t}){const{FooterButtons:n}=Xa();return jsxRuntimeExports.jsx(Ii,{...t,children:jsxRuntimeExports.jsx(n,{})})}function ea({className:n,...i$1}){const{FooterButtonClearAll:o,FooterButtonClearAllOld:r}=Xa(),{notifications:a}=Mr(),[s,l]=i.useState(!1);return i.useEffect((()=>{a.filter((e=>"Stale"===e.state||"Acknowledged"===e.state)).length>0?l(!0):l(!1);}),[a]),jsxRuntimeExports.jsxs($,{className:n,align:"right",...i$1,children:[jsxRuntimeExports.jsx(r,{disabled:!s}),jsxRuntimeExports.jsx(o,{disabled:a.length<=0})]})}function ta({text:t="Clear All",...n}){const{clearAll:i}=Mr();return jsxRuntimeExports.jsx(A,{text:t,onClick:()=>{i();},...n})}function na({text:t="Clear Old",...n}){const{clearAllOld:i}=Mr();return jsxRuntimeExports.jsx(A,{text:t,onClick:()=>{i();},...n})}function ia({className:n,title:i="Settings",...o}){const r=w("io-settings-panel",n),{SettingsGeneral:a,SettingsPlacement:s,SettingsStacking:c,SettingsSnooze:l,SettingsSubscriptions:u}=Xa(),{hideSettings:d}=_r();return jsxRuntimeExports.jsxs(Ai,{className:r,...o,children:[jsxRuntimeExports.jsxs(Ai.Header,{children:[jsxRuntimeExports.jsx(Ai.Header.Title,{size:"large",text:i,tag:"h1"}),jsxRuntimeExports.jsx(Ai.Header.ButtonGroup,{children:jsxRuntimeExports.jsx(Ai.Header.ButtonIcon,{variant:"circle",icon:"close",size:"32",onClick:d})})]}),jsxRuntimeExports.jsxs(Ai.Body,{children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(c,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(u,{})]})]})}function oa({className:n,title:i="General",...o}){const r=w("io-panel-settings-general",n),{SettingsAllowNotifications:a,SettingsShowNotificationBadge:s,SettingsCloseNotificationOnClick:c,SettingsPanelAutoHide:l,SettingsHideToastsAfter:u}=Xa();return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(I,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{}),jsxRuntimeExports.jsx(c,{}),jsxRuntimeExports.jsx(l,{}),jsxRuntimeExports.jsx(u,{})]})})}function ra({label:t="Allow notifications",align:n="right",...i$1}){const{settings:o,saveSetting:a}=Mr(),s=i.useCallback((e=>{a({enabledNotifications:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Mi,{label:t,align:n,onChange:s,checked:o.enabledNotifications,...i$1})}function aa({label:t="Show notification badge",align:n="right",...i$1}){const{settings:o,saveSetting:a}=Mr(),s=i.useCallback((e=>{a({showNotificationBadge:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Mi,{label:t,align:n,onChange:s,checked:o.showNotificationBadge,disabled:!o.enabledNotifications,...i$1})}function sa({label:t="Close notification on click",align:n="right",...i$1}){const{settings:o,saveSetting:a}=Mr(),s=i.useCallback((e=>{a({closeNotificationOnClick:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Mi,{label:t,align:n,onChange:s,checked:o.closeNotificationOnClick,disabled:!o.enabledNotifications,...i$1})}function ca({label:t="Auto hide panel",align:n="right",...i$1}){const{settings:o,saveSetting:a}=Mr(),s=i.useCallback((e=>{a({autoHidePanel:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Mi,{label:t,align:n,onChange:s,checked:o.autoHidePanel,...i$1})}function la({label:t="Panel always on top",align:n="right",...i$1}){const{settings:o,saveSetting:a}=Mr(),s=i.useCallback((e=>{a({alwaysOnTop:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Mi,{label:t,align:n,onChange:s,checked:o.alwaysOnTop,...i$1})}function ua({className:n,title:i$1="Hide toasts after",items:o=[15,30,45,60],...a}){const s=w("flex","jc-between","ai-center",n),{settings:c,saveSetting:l}=Mr(),u=i.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$1})}),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 da({className:n,title:i="Highlight new for",...o}){const r=w("flex","jc-between","ai-center",n),{settings:a}=Mr(),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 fa({className:n,title:i="Mark as read after",...o}){const r=w("flex","jc-between","ai-center",n),{settings:a}=Mr(),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 ha({className:n,title:i="Stacking",...o}){const r=w("io-panel-settings-stacking",n),{SettingsToastStacking:a,SettingsToastStackBy:s}=Xa();return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(I,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})})}function ma({label:t="Allow toast stacking",align:n="right",...i$1}){const{settings:o,saveSetting:a}=Mr(),s=i.useCallback((e=>{a({toastStacking:e.target.checked});}),[a]);return jsxRuntimeExports.jsx(Mi,{label:t,align:n,onChange:s,checked:o.toastStacking,disabled:!o.enabledNotifications,...i$1})}const pa=e=>e.replace(/(^|-)\w/g,(e=>e.toUpperCase().replace("-"," ")));function ga({className:n,title:i$1="Group by",...o}){const a=w("flex","jc-between","ai-center",n),{settings:s,saveSetting:c}=Mr(),l=i.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$1})}),jsxRuntimeExports.jsxs(H,{variant:"light",disabled:!s.enabledNotifications,children:[jsxRuntimeExports.jsx(H.Button,{text:s.stackBy?pa(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 va({className:n,title:i="Placement",...o}){const r=w("io-panel-settings-placement",n),{SettingsPlacementPanel:a,SettingsPlacementToasts:s}=Xa();return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(I,{title:i,children:[jsxRuntimeExports.jsx(a,{}),jsxRuntimeExports.jsx(s,{})]})})}function ba({className:n,title:i$1="Panel position",...o}){const a=w("flex","jc-between","ai-center",n),{settings:s,saveSetting:c}=Mr(),l=i.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$1})}),jsxRuntimeExports.jsxs(H,{variant:"light",children:[jsxRuntimeExports.jsx(H.Button,{text:s.placement?.panel?pa(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 ya({className:n,title:i$1="Toasts position",...o}){const a=w("flex","jc-between","ai-center",n),{settings:s,saveSetting:c}=Mr(),l=i.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$1})}),jsxRuntimeExports.jsxs(H,{variant:"light",children:[jsxRuntimeExports.jsx(H.Button,{text:s.placement?.toasts?pa(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 wa({className:t,title:n="Snooze",...i}){const o=w("io-panel-settings-snooze",t),{SettingsSnoozeDuration:r}=Xa(),{settings:a}=Mr();return a.snooze?.enabled?jsxRuntimeExports.jsx("div",{className:o,...i,children:jsxRuntimeExports.jsx(I,{title:n,children:jsxRuntimeExports.jsx(r,{})})}):null}function ka({className:n,title:i$1="Default duration",items:o=[60,120,180,300],...a}){const s=w("flex","jc-between","ai-center",n),{settings:c,saveSetting:l}=Mr(),u=i.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$1})}),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 Sa({className:n,title:i="Subscribe and Mute",...o}){const r=w("io-panel-settings-subscriptions",n),{SettingsSubscribeAll:a,SettingsSubscribeApp:s,SettingsSubscribeMuteAll:c,SettingsSubscribeMuteApp:l}=Xa(),{allApps:u}=Mr(),{sortAppsAlphabetically:d}=Rr(),f=d(u);return jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsxs(I,{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 Na({label:t="All apps",align:n="right",...i$1}){const{settings:o,configuration:a,saveAllFilter:s}=Mr(),c=i.useCallback((e=>{s({subscribe:e.target.checked});}),[s]);return jsxRuntimeExports.jsx(Mi,{align:n,label:t,onChange:c,checked:a.sourceFilter?.allowed?.includes("*"),disabled:!o.enabledNotifications,...i$1})}function Ca({label:t="App",align:n="right",app:i$1,...o}){const{allApps:a,settings:s,configuration:c,saveFilter:l}=Mr(),u=i.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(Mi,{id:i$1.name,label:t,align:n,onChange:e=>u(e.target.checked,i$1),checked:c.sourceFilter?.allowed?.includes("*")||c.sourceFilter?.allowed?.includes(i$1.name),disabled:!s.enabledNotifications,...o})}function xa({label:t="Mute all",align:n="right",...i$1}){const{settings:o,configuration:a,saveAllFilter:s}=Mr(),c=i.useCallback((e=>{s({mute:e.target.checked});}),[s]);return jsxRuntimeExports.jsx(Mi,{align:n,label:t,onChange:c,checked:a.sourceFilter?.muted?.includes("*"),disabled:!o.enabledNotifications||-1===a.sourceFilter?.allowed?.indexOf("*"),...i$1})}function Ea({label:t="App",align:n="right",app:i$1,...o}){const{allApps:a,settings:s,configuration:c,saveFilter:l}=Mr(),u=i.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(Mi,{id:i$1.name,label:t,align:n,onChange:e=>u(e.target.checked,i$1),checked:c.sourceFilter?.muted?.includes("*")||c.sourceFilter?.muted?.includes(i$1.name),disabled:!s.enabledNotifications||c.sourceFilter?.blocked?.includes("*")||c.sourceFilter?.blocked?.includes(i$1.name)||0===c.sourceFilter?.allowed?.length||-1===c.sourceFilter?.allowed?.indexOf(i$1.name)&&-1===c.sourceFilter?.allowed?.indexOf("*")&&0===c.sourceFilter?.blocked?.length,...o})}function Ia({className:n,notification:i,...o}){const r=w("io-notification-header",n),{HeaderCount:a,HeaderBadge:s,HeaderTitle:c,HeaderTimestamp:l,HeaderButtonSnooze:u,HeaderButtonClose:d}=Ua();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 Aa({notification:t,...n}){const{settings:i,isPanelVisible:o,notificationStacks:r}=Mr(),{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 Ba({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 Ta({className:n,state:i,severity:o="None",icon:r,...a}){const s=w("io-notification-header-icon",n),{isPanelVisible:c}=Mr();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 Pa({className:t,notification:{appTitle:n},...i}){const o=w("io-notification-header-title",t);return jsxRuntimeExports.jsx("div",{className:o,...i,children:n})}function Ra({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:Ho(n??0)??"Just Now"})}function La({notification:{id:t,state:n},...i$1}){const{settings:o,snooze:a}=Mr(),s=i.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$1}):null}function Oa({notification:{updateState:t,close:n},...i}){const{isPanelVisible:o}=Mr();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 Fa({className:n,notification:i,...o}){const r=w("io-notification-body",n),{BodyIcon:a,BodyTitle:s,BodyDescription:c}=Ua(),{onClick:l}=i,{settings:u,isPanelVisible:d}=Mr();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 Da({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 Ma({text:t,...n}){return jsxRuntimeExports.jsx(E,{text:t,...n})}function za({className:t,text:n,...i}){const o=w("io-notification-body-description",t);return jsxRuntimeExports.jsx("p",{className:o,...i,children:n})}function _a({className:n,notification:i$1}){const o=w("io-notification-footer",n),{FooterButton:r}=Ua(),a=i.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$1.actions)),[i$1.actions]),s=(t,n)=>t.children?jsxRuntimeExports.jsx(Si,{text:t.title,children:t.children.map(s)},`${t.title}-${n}`):((t,n)=>jsxRuntimeExports.jsx(Si.Item,{children:jsxRuntimeExports.jsx(r,{variant:"link",className:"io-dropdown-menu-item io-dropdown-menu-button",notificationAction:t,notificationId:i$1.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$1.id}),jsxRuntimeExports.jsx(Si,{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$1.id},`${n.title}-${o}`)))})})}function Ha({notificationAction:t,notificationId:n,...i}){const{settings:o,setState:r,isPanelVisible:a}=Mr();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:Ia,HeaderCount:Aa,HeaderBadge:Ba,HeaderIcon:Ta,HeaderTitle:Pa,HeaderTimestamp:Ra,HeaderButtonSnooze:La,HeaderButtonClose:Oa,Body:Fa,BodyIcon:Da,BodyTitle:Ma,BodyDescription:za,Footer:_a,FooterButton:Ha},ja=i.createContext($a),Va=i.memo((({children:t,components:n})=>{const i$1=i.useMemo((()=>({...$a,...n})),[n]);return jsxRuntimeExports.jsx(ja.Provider,{value:i$1,children:t})}));function Ua(e){return {...i.useContext(ja),...e}}function Ja({className:n,notification:i,...o}){const{Header:r,Body:a,Footer:s}=Ua(),{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 Wa({components:t,notification:n,...i}){return jsxRuntimeExports.jsx(Va,{components:t,children:jsxRuntimeExports.jsx(Ja,{notification:n,...i})})}function qa({className:n,notifications:i$1,...o}){const[a,s]=i.useState(!1),l=i$1.length>=3?"large":"normal",u=2===i$1.length?"small":l,d=i$1[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=i.useCallback((()=>{s(!0);}),[]),m=i.useCallback((e=>{e.stopPropagation(),i$1.forEach((e=>{e.close();}));}),[i$1]);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$1.map((t=>jsxRuntimeExports.jsx(Wa,{notification:t},t.id)))]})}function Ka({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}=Mr(),{isBulkActionsVisible:g}=_r(),{toastStacking:v}=u,b=o??c;return jsxRuntimeExports.jsx("div",{className:s,...a,children:v&&!f?l.length>0?l.map((t=>jsxRuntimeExports.jsx(qa,{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(Fi,{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??""})})}Va.displayName="ComponentsStoreProvider";const Ga={Header:Hr,HeaderCaption:$r,HeaderCaptionFilter:jr,HeaderCaptionTitle:Vr,HeaderCaptionCount:function({...t}){const{notificationsCount:n}=_r();return jsxRuntimeExports.jsx(x,{...t,children:(n||0).toString()})},HeaderCaptionButtons:Ur,HeaderCaptionButtonSearch:function({...t}){const{isSearchVisible:n,showSearch:i,hideSearch:o,notificationsCount:r}=_r();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}=_r();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}=Mr();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}=Xa();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$1}){const{sortNotificationsBy:o,setSortBy:a}=_r(),{onNotificationsSort:s}=(()=>{const{notifications:e}=Mr(),[t,n]=i.useState(qr),{key:i$1,descending:o}=t,a=i.useMemo((()=>Qr[i$1](e,o)),[e,i$1,o]),s=i.useCallback((e=>{n((t=>({key:e,descending:t.key!==e?qr.descending:!t.descending})));}),[]);return {onNotificationsSort:s,sortedNotifications:a}})();return jsxRuntimeExports.jsxs(H,{variant:"light",...i$1,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}=Mr(),{viewNotificationsBy:r,setViewBy:a}=_r(),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}=Mr(),{notificationsCount:o}=_r();return jsxRuntimeExports.jsx(A,{variant:"link",text:t,onClick:i,disabled:0===o,...n})},HeaderActionEdit:function({tooltip:t="Bulk Edit",...n}){const{isBulkActionsSupported:i}=Mr(),{showBulkActions:o,notificationsCount:r}=_r();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}=Xa(),{isBulkActionsSupported:f}=Mr();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}=Mr(),{notificationsCount:r}=_r();return n?jsxRuntimeExports.jsx(Fi,{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}=Mr(),{notificationsCount:r}=_r();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$1="circle",tooltip:o="Mark as read",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,setStates:l}=Mr(),{notificationsCount:u}=_r(),d=i.useCallback((()=>{l(c,"Seen");}),[c,l]);return s?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i$1,title:o,onClick:d,disabled:0===u,...a}):null},HeaderBulkActionMarkAsUnread:function({icon:t="envelope",size:n="32",variant:i$1="circle",tooltip:o="Mark as unread",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,setStates:l}=Mr(),{notificationsCount:u}=_r(),d=i.useCallback((()=>{l(c,"Active");}),[c,l]);return s?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i$1,title:o,onClick:d,disabled:0===u,...a}):null},HeaderBulkActionSnooze:function({icon:t="snooze",size:n="32",variant:i$1="circle",tooltip:o="Snooze",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,snoozeMany:l,settings:u}=Mr(),{notificationsCount:d}=_r(),f=i.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$1,title:o,onClick:f,disabled:0===d,...a}):null},HeaderBulkActionClear:function({icon:t="trash",size:n="32",variant:i$1="circle",tooltip:o="Clear",...a}){const{isBulkActionsSupported:s,selectedNotifications:c,clearMany:l}=Mr(),{notificationsCount:u}=_r(),d=i.useCallback((()=>{l(c);}),[c,l]);return s?jsxRuntimeExports.jsx(S,{icon:t,size:n,variant:i$1,title:o,onClick:d,disabled:0===u,...a}):null},HeaderBulkActionClose:function({text:t="Done",variant:n="primary",...i}){const{isBulkActionsSupported:o}=Mr(),{hideBulkActions:r,notificationsCount:a}=_r();return o?jsxRuntimeExports.jsx(A,{variant:n,text:t,onClick:r,disabled:0===a,...i}):null},HeaderSearch:function({className:n,icon:i$1="search",placeholder:o="Search",...r}){const a=w("io-panel-header-search",n),{isSearchVisible:s,searchQuery:c,setSearch:l,notificationsCount:f}=_r(),h=i.useRef(null);return i.useEffect((()=>{s?h.current?.focus():(h.current?.blur(),l(""));}),[s,l]),s?jsxRuntimeExports.jsxs("div",{className:a,children:[jsxRuntimeExports.jsx(Li,{ref:h,value:c,iconPrepend:i$1,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:Xr,Footer:Zr,FooterButtons:ea,FooterButtonClearAll:ta,FooterButtonClearAllOld:na,Notification:Wa,NotificationsList:Ka,Settings:ia,SettingsGeneral:oa,SettingsAllowNotifications:ra,SettingsShowNotificationBadge:aa,SettingsCloseNotificationOnClick:sa,SettingsPanelAutoHide:ca,SettingsPanelAlwaysOnTop:la,SettingsHideToastsAfter:ua,SettingsMarkAsNew:da,SettingsMarkAsRead:fa,SettingsStacking:ha,SettingsToastStacking:ma,SettingsToastStackBy:ga,SettingsPlacement:va,SettingsPlacementPanel:ba,SettingsPlacementToasts:ya,SettingsSnooze:wa,SettingsSnoozeDuration:ka,SettingsSubscriptions:Sa,SettingsSubscribeAll:Na,SettingsSubscribeApp:Ca,SettingsSubscribeMuteAll:xa,SettingsSubscribeMuteApp:Ea},Ya=i.createContext(Ga),Qa=i.memo((({children:t,components:n})=>{const i$1=i.useMemo((()=>({...Ga,...n})),[n]);return jsxRuntimeExports.jsx(Ya.Provider,{value:i$1,children:t})}));function Xa(e){return {...i.useContext(Ya),...e}}Qa.displayName="ComponentsStoreProvider";const ts={Body:function({className:t,notifications:n,maxToasts:i$1=1,...o}){const r=w("io-toasts-body",t),{NotificationsList:a,Notification:s}=os(),[l,d]=i.useState([]);return i.useEffect((()=>{const e=i$1<0?n.length:i$1,t=n.filter((e=>"Active"===e.state)).slice(0,e);for(const e of t)e.onShow();d(t);}),[n,i$1]),jsxRuntimeExports.jsx("div",{className:r,...o,children:jsxRuntimeExports.jsx(a,{Notification:s,notifications:l,noNotificationText:""})})},Notification:Wa,NotificationsList:Ka},ns=i.createContext(ts),is=i.memo((({children:t,components:n})=>{const i$1=i.useMemo((()=>({...ts,...n})),[n]);return jsxRuntimeExports.jsx(ns.Provider,{value:i$1,children:t})}));function os(e){return {...i.useContext(ns),...e}}is.displayName="ComponentsStoreProvider";const cs=n=>{const{General:i,Layouts:o,Widget:r}=Ms();return jsxRuntimeExports.jsxs(Ei,{...n,children:[jsxRuntimeExports.jsx(i,{}),jsxRuntimeExports.jsx(o,{}),jsxRuntimeExports.jsx(r,{})]})},ls=({className:t,title:n="General",...i})=>{const{Theme:o}=Ms();return jsxRuntimeExports.jsx(I,{className:w("io-block io-block-list-gap",t),title:n,...i,children:jsxRuntimeExports.jsx(o,{})})},us=({className:n,title:i="Layouts",...o})=>{const{LayoutsShowDeletePrompt:r,LayoutsShowUnsavedChangesPrompt:a}=Ms();return jsxRuntimeExports.jsxs(I,{className:w("io-block io-block-list-gap",n),title:i,...o,children:[jsxRuntimeExports.jsx(r,{}),jsxRuntimeExports.jsx(a,{})]})},ds="layoutsShowDeletePrompt",fs="layoutsShowUnsavedChangesPrompt",hs="widgetEnableForExternalApps";var ms=function(e){return {ok:!0,result:e}},ps=function(e){return {ok:!1,error:e}},gs=function(e,t,n){return !1===t.ok?t:!1===n.ok?n:ms(e(t.result,n.result))},vs=function(e,t){return !0===t.ok?t:ps(e(t.error))},bs=function(){return bs=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},bs.apply(this,arguments)};function ys(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(!ys(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(!ys(e[i[n]],t[i[n]]))return !1}return !0}}var ws=function(e){return Array.isArray(e)},ks=function(e){return "object"==typeof e&&null!==e&&!ws(e)},Ss=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)},Ns=function(e){return e.map((function(e){return "string"==typeof e?"."+e:"["+e+"]"})).join("")},Cs=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 bs({at:e+(n||"")},i)},xs=function(){function e(t){var n=this;this.decode=t,this.run=function(e){return vs((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?ms(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?ms(e):ps({message:Ss("a string",e)})}))},e.number=function(){return new e((function(e){return "number"==typeof e?ms(e):ps({message:Ss("a number",e)})}))},e.boolean=function(){return new e((function(e){return "boolean"==typeof e?ms(e):ps({message:Ss("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return ys(e,t)?ms(t):ps({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(ks(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]?ps({message:"the key '"+i+"' is required but was not present"}):ps(Cs("."+i,o.error));void 0!==o.result&&(n[i]=o.result);}return ms(n)}return ks(e)?ms(e):ps({message:Ss("an object",e)})}))},e.array=function(t){return new e((function(e){if(ws(e)&&t){return e.reduce((function(e,n,i){return gs((function(e,t){return e.concat([t])}),e,function(e,n){return vs((function(e){return Cs("["+n+"]",e)}),t.decode(e))}(n,i))}),ms([]))}return ws(e)?ms(e):ps({message:Ss("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(ws(e)){if(e.length!==t.length)return ps({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 ps(Cs("["+i+"]",o.error));n[i]=o.result;}return ms(n)}return ps({message:Ss("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 gs(Object.assign,t,n.decode(e))}),ms({}))}))},e.anyJson=function(){return new e((function(e){return ms(e)}))},e.unknownJson=function(){return new e((function(e){return ms(e)}))},e.dict=function(t){return new e((function(e){if(ks(e)){var n={};for(var i in e)if(e.hasOwnProperty(i)){var o=t.decode(e[i]);if(!0!==o.ok)return ps(Cs("."+i,o.error));n[i]=o.result;}return ms(n)}return ps({message:Ss("an object",e)})}))},e.optional=function(t){return new e((function(e){return null==e?ms(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 ps({message:'expected a value matching one of the decoders, got the errors ["'+r+'"]'})}))},e.withDefault=function(t,n){return new e((function(e){return ms(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 ps({at:Ns(t.slice(0,o+1)),message:"path does not exist"});if("string"==typeof t[o]&&!ks(i))return ps({at:Ns(t.slice(0,o+1)),message:Ss("an object",i)});if("number"==typeof t[o]&&!ws(i))return ps({at:Ns(t.slice(0,o+1)),message:Ss("an array",i)});i=i[t[o]];}return vs((function(e){return void 0===i?{at:Ns(t),message:"path does not exist"}:Cs(Ns(t),e)}),n.decode(i))}))},e.succeed=function(t){return new e((function(e){return ms(t)}))},e.fail=function(t){return new e((function(e){return ps({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}();xs.string,xs.number;var Es=xs.boolean;xs.anyJson,xs.unknownJson,xs.constant,xs.object,xs.array,xs.tuple,xs.dict,xs.optional,xs.oneOf,xs.union,xs.intersection,xs.withDefault,xs.valueAt,xs.succeed,xs.fail,xs.lazy;const Is=Es(),As=({prefKey:t,...n})=>{const{isLoading:i,value:o=!1,update:r}=$i({app:"io-connect-platform",prefKey:t,decoder:Is});return jsxRuntimeExports.jsx(Mi,{checked:o,disabled:i,onChange:e=>r(e.target.checked),...n})},Bs=({align:t="right",label:n="Show prompt for deleting",...i})=>jsxRuntimeExports.jsx(As,{align:t,label:n,prefKey:ds,...i}),Ts=({align:t="right",label:n="Show prompt for unsaved changes",...i})=>jsxRuntimeExports.jsx(As,{align:t,label:n,prefKey:fs,...i}),Ps=({className:n,title:i$1="Theme",...o})=>{const{currentTheme:a,selectTheme:l}=(()=>{const e=i.useContext(IOConnectContext),[t,n]=i.useState(null),i$1=i.useCallback((t=>e?.themes?.select(t)),[e]);return i.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$1}})(),d=(()=>{const e=i.useContext(IOConnectContext),[t,n]=i.useState([]);return i.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$1}),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)))})})]})]})},Rs=({className:t,title:n="Widget",...i})=>{const{WidgetEnableForExternalApps:o}=Ms();return jsxRuntimeExports.jsx(I,{className:w("io-block io-block-list-gap",t),title:n,...i,children:jsxRuntimeExports.jsx(o,{})})},Ls=({align:t="right",label:n="Enable for external apps",...i})=>jsxRuntimeExports.jsx(As,{align:t,label:n,prefKey:hs,...i}),Os={Body:cs,General:ls,Layouts:us,LayoutsShowDeletePrompt:Bs,LayoutsShowUnsavedChangesPrompt:Ts,Theme:Ps,Widget:Rs,WidgetEnableForExternalApps:Ls},Fs=i.createContext(Os),Ds=i.memo((({children:t,components:n})=>{const i$1=i.useMemo((()=>({...Os,...n})),[n]);return jsxRuntimeExports.jsx(Fs.Provider,{value:i$1,children:t})}));Ds.displayName="PreferencesPanelComponentsStoreProvider";const Ms=()=>i.useContext(Fs);
|
|
1196
|
-
|
|
1197
|
-
const getInitialType = (glueController) => {
|
|
1198
|
-
const type = glueController.config.channels?.selector?.type;
|
|
1199
|
-
if (!type) {
|
|
1200
|
-
return "single";
|
|
1201
|
-
}
|
|
1202
|
-
return type === "default" ? "single" : "directionalSingle";
|
|
1203
|
-
};
|
|
1204
|
-
const getChannelRestrictions = async (glueController, name) => {
|
|
1205
|
-
const restrictions = typeof glueController.io.channels.getRestrictions === "function" ? await glueController.io.channels.getRestrictions() : { channels: [] };
|
|
1206
|
-
const channelRestriction = restrictions.channels.find((restriction) => restriction.name === name);
|
|
1207
|
-
const read = typeof channelRestriction?.read === "boolean" ? channelRestriction.read : true;
|
|
1208
|
-
const write = typeof channelRestriction?.write === "boolean" ? channelRestriction.write : true;
|
|
1209
|
-
return { read, write };
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
const { ChannelSelector } = bo;
|
|
1213
|
-
const ChannelSelectorWrapper = ({ mode, channelsDisplayMode }) => {
|
|
1214
|
-
const glueController = useGlueController();
|
|
1215
|
-
const channelsMode = glueController.io.channels.mode;
|
|
1216
|
-
const [variantToggle, setVariantToggle] = i.useState(true);
|
|
1217
|
-
const [channelsInfo, setChannelsInfo] = i.useState([]);
|
|
1218
|
-
const [type, setType] = i.useState(getInitialType(glueController));
|
|
1219
|
-
const handleOnChannelSelect = i.useCallback(async ({ name }) => {
|
|
1220
|
-
const channel = channelsInfo.find((ch) => ch.name === name);
|
|
1221
|
-
if (channel?.isSelected) {
|
|
1222
|
-
const singleModeCb = (ch) => ({ ...ch, isSelected: false, read: false, write: false });
|
|
1223
|
-
const multiModeCb = (ch) => ch.name === name ? ({ ...ch, isSelected: false, read: false, write: false }) : ch;
|
|
1224
|
-
setChannelsInfo((channels) => channels.map(channelsMode === "single" ? singleModeCb : multiModeCb));
|
|
1225
|
-
return glueController.io.channels.leave({ channel: name });
|
|
1226
|
-
}
|
|
1227
|
-
const { read, write } = await getChannelRestrictions(glueController, name);
|
|
1228
|
-
const singleModeCb = (ch) => ch.name === name ? ({ ...ch, isSelected: true, read, write }) : ({ ...ch, isSelected: false, read: false, write: false });
|
|
1229
|
-
const multiModeCb = (ch) => ch.name === name ? ({ ...ch, isSelected: true, read, write }) : ch;
|
|
1230
|
-
setChannelsInfo((channels) => channels.map(channelsMode === "single" ? singleModeCb : multiModeCb));
|
|
1231
|
-
return glueController.io.channels.join(name);
|
|
1232
|
-
}, [channelsInfo, glueController, channelsMode]);
|
|
1233
|
-
const handleOnChannelRestrict = i.useCallback(async ({ name, read, write }) => {
|
|
1234
|
-
if (type === 'single' || typeof glueController.io.channels.restrict !== "function") {
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
if (!read && !write) {
|
|
1238
|
-
setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? ({ ...ch, isSelected: false, read: false, write: false }) : ch));
|
|
1239
|
-
await glueController.io.channels.restrict({ name, read, write });
|
|
1240
|
-
return glueController.io.channels.leave({ channel: name });
|
|
1241
|
-
}
|
|
1242
|
-
await glueController.io.channels.restrict({ name, read, write });
|
|
1243
|
-
const singleModeCb = (ch) => ch.name === name ? { ...ch, isSelected: true, read, write } : { ...ch, isSelected: false, read: false, write: false };
|
|
1244
|
-
const multiModeCb = (ch) => ch.name === name ? { ...ch, isSelected: true, read, write } : ch;
|
|
1245
|
-
setChannelsInfo((channels) => channels.map(channelsMode === "single" ? singleModeCb : multiModeCb));
|
|
1246
|
-
}, [glueController.io.channels, type, channelsMode]);
|
|
1247
|
-
const onTypeChange = (checked) => {
|
|
1248
|
-
setType(checked ? "directionalSingle" : "single");
|
|
1249
|
-
};
|
|
1250
|
-
const getChannels = i.useCallback(async () => {
|
|
1251
|
-
const allChannels = await glueController.io.channels.list();
|
|
1252
|
-
const myChannels = channelsMode === "single" ? [await glueController.io.channels.getMy()] : await glueController.io.channels.getMyChannels();
|
|
1253
|
-
const channelsToParse = channelsDisplayMode === "all" ? allChannels : allChannels.filter((ch) => ch.meta?.fdc3);
|
|
1254
|
-
const channelsInfo = await Promise.all(channelsToParse.map(async (ch) => {
|
|
1255
|
-
const restrictions = typeof glueController.io.channels.getRestrictions === "function" ? await glueController.io.channels.getRestrictions() : { channels: [] };
|
|
1256
|
-
const channelRestrictions = restrictions.channels.find((restriction) => restriction.name === ch.name);
|
|
1257
|
-
const isSelected = myChannels?.some(myChannel => myChannel?.name === ch.name);
|
|
1258
|
-
const read = typeof channelRestrictions?.read === "boolean" ? channelRestrictions.read : true;
|
|
1259
|
-
const write = typeof channelRestrictions?.write === "boolean" ? channelRestrictions.write : true;
|
|
1260
|
-
return {
|
|
1261
|
-
color: ch.meta.color,
|
|
1262
|
-
name: ch.name,
|
|
1263
|
-
label: ch.name[0],
|
|
1264
|
-
isSelected,
|
|
1265
|
-
read: isSelected ? read : false,
|
|
1266
|
-
write: isSelected ? write : false
|
|
1267
|
-
};
|
|
1268
|
-
}));
|
|
1269
|
-
setChannelsInfo(channelsInfo);
|
|
1270
|
-
}, [glueController, channelsDisplayMode, channelsMode]);
|
|
1271
|
-
i.useEffect(() => {
|
|
1272
|
-
getChannels();
|
|
1273
|
-
}, [getChannels]);
|
|
1274
|
-
i.useEffect(() => {
|
|
1275
|
-
const subscribeForChannelChanged = () => {
|
|
1276
|
-
glueController.io.channels.onChanged(async (name) => {
|
|
1277
|
-
if (!name) {
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
|
-
const { read, write } = await getChannelRestrictions(glueController, name);
|
|
1281
|
-
if (channelsMode === "multi") {
|
|
1282
|
-
setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? { ...ch, isSelected: true, read, write } : { ...ch, read: false, write: false }));
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
setChannelsInfo((channels) => channels.map((ch) => ch.name === name ? { ...ch, isSelected: true, read, write } : { ...ch, isSelected: false, read: false, write: false }));
|
|
1286
|
-
});
|
|
1287
|
-
};
|
|
1288
|
-
const checkSetVariantToggle = async () => {
|
|
1289
|
-
const clientRestrictionsMethodsExist = typeof glueController.io.channels.restrict === "function" && typeof glueController.io.channels.restrictAll === "function" && typeof glueController.io.channels.getRestrictions === "function";
|
|
1290
|
-
if (!clientRestrictionsMethodsExist) {
|
|
1291
|
-
setVariantToggle(false);
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
const platformRestrictionsMethodsExist = await glueController.checkChannelRestrictionsExistInPlatform();
|
|
1295
|
-
setVariantToggle(platformRestrictionsMethodsExist);
|
|
1296
|
-
};
|
|
1297
|
-
const initialSetup = async () => {
|
|
1298
|
-
subscribeForChannelChanged();
|
|
1299
|
-
await checkSetVariantToggle();
|
|
1300
|
-
};
|
|
1301
|
-
initialSetup();
|
|
1302
|
-
}, [glueController, channelsMode]);
|
|
1303
|
-
i.useEffect(() => {
|
|
1304
|
-
const handleBtnBackgroundChange = () => {
|
|
1305
|
-
const selectorBtn = Array.from(document.getElementsByClassName("io-btn-icon"))[0];
|
|
1306
|
-
const selectedChannels = channelsInfo.filter((channelInfo) => channelInfo.isSelected);
|
|
1307
|
-
selectorBtn.style.backgroundColor = selectedChannels[selectedChannels.length - 1]?.color ?? "";
|
|
1308
|
-
};
|
|
1309
|
-
handleBtnBackgroundChange();
|
|
1310
|
-
}, [channelsInfo]);
|
|
1311
|
-
return (i.createElement(H, { onClick: getChannels, variant: "outline" },
|
|
1312
|
-
mode === "default" ? (i.createElement(H.ButtonIcon, { className: "io-btn-icon", icon: "link", iconSize: "16", size: "32", variant: "circle" })) : (i.createElement(H.Item, { append: i.createElement(k, { variant: "chevron-right", size: "10" }) },
|
|
1313
|
-
i.createElement(H.Button, { variant: "link", icon: "link", text: "Select Channel", iconRight: false }))),
|
|
1314
|
-
i.createElement(H.Content, null,
|
|
1315
|
-
i.createElement(ChannelSelector, { className: "io-list-channels", variant: type, channels: channelsInfo, onChannelSelect: handleOnChannelSelect, variantToggle: variantToggle, onVariantChange: onTypeChange, onChannelRestrict: handleOnChannelRestrict }))));
|
|
1316
|
-
};
|
|
1317
|
-
|
|
1318
|
-
const PositionDropdown = ({ position, positionClickHandler }) => {
|
|
1319
|
-
const positions = ["bottom", "left", "right", "top"].map((p) => {
|
|
1320
|
-
return (i.createElement(H.Item, { key: p, isSelected: p === position, onClick: () => positionClickHandler(p) }, p[0].toUpperCase() + p.slice(1)));
|
|
1321
|
-
});
|
|
1322
|
-
return (i.createElement(H.List, { variant: "single", checkIcon: "check" },
|
|
1323
|
-
i.createElement(H.ItemSection, null, "Widget Position"),
|
|
1324
|
-
positions));
|
|
1325
|
-
};
|
|
1326
|
-
|
|
1327
|
-
const ModeDropdown = ({ mode, modeClickHandler }) => {
|
|
1328
|
-
return (i.createElement(H.List, null,
|
|
1329
|
-
i.createElement(H.ItemSection, null, "Widget Mode"),
|
|
1330
|
-
i.createElement(H.Item, null,
|
|
1331
|
-
i.createElement(Mi, { label: "Compact", align: "right", checked: mode === "compact", onChange: () => modeClickHandler(mode === "compact" ? "default" : "compact") }))));
|
|
1332
|
-
};
|
|
1333
|
-
|
|
1334
|
-
const Settings = ({ position, positionClickHandler, mode, modeClickHandler }) => {
|
|
1335
|
-
return (i.createElement(H, { align: "up", variant: "outline" },
|
|
1336
|
-
i.createElement(H.ButtonIcon, { className: "io-btn-icon", icon: "cog", iconSize: "16", size: "32", variant: "circle" }),
|
|
1337
|
-
i.createElement(H.Content, null,
|
|
1338
|
-
i.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
|
|
1339
|
-
i.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
|
|
1340
|
-
};
|
|
1341
|
-
|
|
1342
|
-
const DefaultWidget = ({ showBringBackToWspBtn, handleBringBackToWspClick, showChannelSelectorBtn, position, positionClickHandler, mode, modeClickHandler, channelsDisplayMode }) => {
|
|
1343
|
-
return (i.createElement($, { align: "left", className: "io-btn-group", variant: "default" },
|
|
1344
|
-
showChannelSelectorBtn ? i.createElement(ChannelSelectorWrapper, { mode: mode, channelsDisplayMode: channelsDisplayMode }) : null,
|
|
1345
|
-
showBringBackToWspBtn ? (i.createElement(S, { className: "io-btn-icon", icon: "pop-in-widget", iconSize: "16", size: "32", variant: "circle", onClick: handleBringBackToWspClick })) : null,
|
|
1346
|
-
i.createElement(Settings, { position: position, positionClickHandler: positionClickHandler, mode: mode, modeClickHandler: modeClickHandler })));
|
|
1347
|
-
};
|
|
1348
|
-
|
|
1349
|
-
const CompactWidget = ({ position, positionClickHandler, mode, modeClickHandler, channelsDisplayMode, handleBringBackToWspClick, showBringBackToWspBtn, showChannelSelectorBtn, }) => {
|
|
1350
|
-
return (i.createElement(H, { variant: "outline" },
|
|
1351
|
-
i.createElement(H.ButtonIcon, { icon: "logo", className: "io-btn-icon", iconSize: "16", size: "32", variant: "circle" }),
|
|
1352
|
-
i.createElement(H.Content, null,
|
|
1353
|
-
i.createElement(H.ItemSection, null, "App"),
|
|
1354
|
-
i.createElement(H.List, null,
|
|
1355
|
-
showBringBackToWspBtn ? (i.createElement(H.Item, { onClick: handleBringBackToWspClick, prepend: i.createElement(k, { variant: "pop-in-widget" }) }, "Pop In")) : null,
|
|
1356
|
-
showChannelSelectorBtn ? i.createElement(ChannelSelectorWrapper, { mode: mode, channelsDisplayMode: channelsDisplayMode }) : null),
|
|
1357
|
-
i.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
|
|
1358
|
-
i.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
|
|
1359
|
-
};
|
|
1360
|
-
|
|
1361
|
-
const Widget = () => {
|
|
1362
|
-
const glueController = useGlueController();
|
|
1363
|
-
const [position, setPosition] = i.useState(glueController.config.position ?? "bottom");
|
|
1364
|
-
const [mode, setMode] = i.useState(glueController.config.mode ?? "default");
|
|
1365
|
-
const [showBringBackToWspBtn, setShowBringBackToWspBtn] = i.useState(false);
|
|
1366
|
-
useThemeSync();
|
|
1367
|
-
i.useEffect(() => {
|
|
1368
|
-
const checkIsEjectedWindow = async () => {
|
|
1369
|
-
const { isEjected, ejectData } = await glueController.checkIsEjected();
|
|
1370
|
-
if (!isEjected || !glueController.io.workspaces) {
|
|
1371
|
-
setShowBringBackToWspBtn(isEjected);
|
|
1372
|
-
return;
|
|
1373
|
-
}
|
|
1374
|
-
const unOnWorkspaceClosed = await glueController.io.workspaces.onWorkspaceClosed((closed) => {
|
|
1375
|
-
if (closed.workspaceId !== ejectData?.workspaceId) {
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
unOnWorkspaceClosed();
|
|
1379
|
-
setShowBringBackToWspBtn(false);
|
|
1380
|
-
});
|
|
1381
|
-
setShowBringBackToWspBtn(isEjected);
|
|
1382
|
-
};
|
|
1383
|
-
checkIsEjectedWindow();
|
|
1384
|
-
}, [glueController]);
|
|
1385
|
-
const positionClickHandler = i.useCallback((position) => {
|
|
1386
|
-
const widgetElem = Array.from(document.getElementsByClassName("io-window-widget"))[0];
|
|
1387
|
-
widgetElem.className =
|
|
1388
|
-
position !== "bottom" ? `io-window-widget io-window-widget-${position}` : "io-window-widget";
|
|
1389
|
-
setPosition(position);
|
|
1390
|
-
}, []);
|
|
1391
|
-
const modeClickHandler = i.useCallback((mode) => {
|
|
1392
|
-
const widgetElem = Array.from(document.getElementsByClassName("io-window-widget"))[0];
|
|
1393
|
-
widgetElem.className = mode !== "default" ? `io-window-widget io-window-widget-${mode}` : "io-window-widget";
|
|
1394
|
-
setMode(mode);
|
|
1395
|
-
}, []);
|
|
1396
|
-
const handleDragEnd = (e) => drop(e, setPosition);
|
|
1397
|
-
const getWidgetClassName = () => {
|
|
1398
|
-
if (position === "bottom" && mode === "default") {
|
|
1399
|
-
return "io-window-widget";
|
|
1400
|
-
}
|
|
1401
|
-
return `io-window-widget io-window-widget-${position} io-window-widget-${mode}`;
|
|
1402
|
-
};
|
|
1403
|
-
const getWidgetProps = () => {
|
|
1404
|
-
return {
|
|
1405
|
-
showChannelSelectorBtn: glueController.config.channels?.selector?.enable ?? true,
|
|
1406
|
-
position,
|
|
1407
|
-
positionClickHandler,
|
|
1408
|
-
mode,
|
|
1409
|
-
modeClickHandler,
|
|
1410
|
-
showBringBackToWspBtn,
|
|
1411
|
-
handleBringBackToWspClick,
|
|
1412
|
-
channelsDisplayMode: glueController.config.channels?.displayMode ?? "all",
|
|
1413
|
-
};
|
|
1414
|
-
};
|
|
1415
|
-
const handleBringBackToWspClick = i.useCallback(async () => {
|
|
1416
|
-
try {
|
|
1417
|
-
await glueController.bringBackToWsp();
|
|
1418
|
-
}
|
|
1419
|
-
catch (error) {
|
|
1420
|
-
glueController.getLogger(`widget-component-${glueController.windowId}`).error(error);
|
|
1421
|
-
await glueController.removeEjectedWindowContext();
|
|
1422
|
-
setShowBringBackToWspBtn(false);
|
|
1423
|
-
}
|
|
1424
|
-
}, [glueController]);
|
|
1425
|
-
return (i.createElement("div", { className: getWidgetClassName(), draggable: "true", onDragEnd: handleDragEnd, role: "button", tabIndex: 0 },
|
|
1426
|
-
i.createElement(DragSection, null),
|
|
1427
|
-
mode === "default" ? (i.createElement(DefaultWidget, { ...getWidgetProps() })) : (i.createElement(CompactWidget, { ...getWidgetProps() }))));
|
|
1428
|
-
};
|
|
1429
|
-
|
|
1430
|
-
class DOMController {
|
|
1431
|
-
glueController;
|
|
1432
|
-
constructor(glueController) {
|
|
1433
|
-
this.glueController = glueController;
|
|
1434
|
-
}
|
|
1435
|
-
async attachWidget() {
|
|
1436
|
-
const domNode = document.createElement("div");
|
|
1437
|
-
const root = createRoot(domNode);
|
|
1438
|
-
root.render(i.createElement(CustomGlueControllerProvider, { glueController: this.glueController },
|
|
1439
|
-
i.createElement(Widget, null)));
|
|
1440
|
-
document.body.appendChild(domNode);
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
class GlueController {
|
|
1445
|
-
bridge;
|
|
1446
|
-
io;
|
|
1447
|
-
config;
|
|
1448
|
-
_windowId;
|
|
1449
|
-
_logger;
|
|
1450
|
-
constructor(bridge, io, config) {
|
|
1451
|
-
this.bridge = bridge;
|
|
1452
|
-
this.io = io;
|
|
1453
|
-
this.config = config;
|
|
1454
|
-
this._windowId = io.windows.my().id;
|
|
1455
|
-
this._logger = this.io.logger.subLogger(`widget-${this._windowId}`);
|
|
1456
|
-
}
|
|
1457
|
-
get logger() {
|
|
1458
|
-
return this._logger;
|
|
1459
|
-
}
|
|
1460
|
-
get windowId() {
|
|
1461
|
-
return this._windowId;
|
|
1462
|
-
}
|
|
1463
|
-
getLogger(name) {
|
|
1464
|
-
return this.io.logger.subLogger(name);
|
|
1465
|
-
}
|
|
1466
|
-
async checkShowWidget() {
|
|
1467
|
-
const errorMsg = `Current window is in workspace`;
|
|
1468
|
-
if (window.iobrowser?.isPlatformFrame) {
|
|
1469
|
-
return { show: false, reason: `Current window is a Platform in a Workspaces Frame` };
|
|
1470
|
-
}
|
|
1471
|
-
if (this.io.workspaces && await this.io.workspaces.inWorkspace()) {
|
|
1472
|
-
return { show: false, reason: errorMsg };
|
|
1473
|
-
}
|
|
1474
|
-
const isWorkspacesLibInitialized = await this.checkWorkspacesLibInitialized();
|
|
1475
|
-
if (!isWorkspacesLibInitialized) {
|
|
1476
|
-
return { show: true };
|
|
1477
|
-
}
|
|
1478
|
-
const isWindowInWorkspace = await this.checkWindowInWorkspace();
|
|
1479
|
-
return isWindowInWorkspace ? { show: false, reason: errorMsg } : { show: true };
|
|
1480
|
-
}
|
|
1481
|
-
async checkChannelRestrictionsExistInPlatform() {
|
|
1482
|
-
const restrictExist = await this.bridge.checkOperationSupported("restrict", "channels");
|
|
1483
|
-
if (!restrictExist.isSupported) {
|
|
1484
|
-
return false;
|
|
1485
|
-
}
|
|
1486
|
-
const getRestrictionsExist = await this.bridge.checkOperationSupported("getRestrictions", "channels");
|
|
1487
|
-
if (!getRestrictionsExist.isSupported) {
|
|
1488
|
-
return false;
|
|
1489
|
-
}
|
|
1490
|
-
const restrictAll = await this.bridge.checkOperationSupported("restrictAll", "channels");
|
|
1491
|
-
return restrictAll.isSupported;
|
|
1492
|
-
}
|
|
1493
|
-
async checkIsEjected() {
|
|
1494
|
-
const context = await this.io.contexts.get(`___window___${this.windowId}`);
|
|
1495
|
-
const frameId = context?.___io___?.ejectedWindow?.frameId;
|
|
1496
|
-
const workspaceId = context?.___io___?.ejectedWindow?.workspaceId;
|
|
1497
|
-
return frameId && workspaceId
|
|
1498
|
-
? { isEjected: true, ejectData: { frameId, workspaceId } }
|
|
1499
|
-
: { isEjected: false };
|
|
1500
|
-
}
|
|
1501
|
-
async removeEjectedWindowContext() {
|
|
1502
|
-
await this.io.contexts.setPath(`___window___${this.windowId}`, "___io___.ejectedWindow", null);
|
|
1503
|
-
const appInstance = this.io.appManager.myInstance;
|
|
1504
|
-
if (!appInstance) {
|
|
1505
|
-
return;
|
|
1506
|
-
}
|
|
1507
|
-
await this.io.contexts.setPath(`___instance___${this.windowId}`, "___io___.ejectedWindow", null);
|
|
1508
|
-
}
|
|
1509
|
-
async bringBackToWsp() {
|
|
1510
|
-
await this.bridge.send("bringBackToWorkspace", "workspaces", { windowId: this.windowId }, { includeOperationCheck: true });
|
|
1511
|
-
}
|
|
1512
|
-
async checkWindowInWorkspace() {
|
|
1513
|
-
try {
|
|
1514
|
-
const res = await this.bridge.send("isWindowInWorkspace", "workspaces", { itemId: this.windowId });
|
|
1515
|
-
return res.inWorkspace;
|
|
1516
|
-
}
|
|
1517
|
-
catch (error) {
|
|
1518
|
-
this.logger.trace(typeof error === "string" ? error : JSON.stringify(error));
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
async checkWorkspacesLibInitialized() {
|
|
1522
|
-
try {
|
|
1523
|
-
const res = await this.bridge.send("workspacesInitCheck", "system", {}, { includeOperationCheck: true });
|
|
1524
|
-
return res.initialized;
|
|
1525
|
-
}
|
|
1526
|
-
catch (error) {
|
|
1527
|
-
this.logger.trace(typeof error === "string" ? error : JSON.stringify(error));
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
class IoC {
|
|
1533
|
-
io;
|
|
1534
|
-
config;
|
|
1535
|
-
_domController;
|
|
1536
|
-
_bridge;
|
|
1537
|
-
_glueController;
|
|
1538
|
-
constructor(io, config) {
|
|
1539
|
-
this.io = io;
|
|
1540
|
-
this.config = config;
|
|
1541
|
-
}
|
|
1542
|
-
get domController() {
|
|
1543
|
-
if (!this._domController) {
|
|
1544
|
-
this._domController = new DOMController(this.glueController);
|
|
1545
|
-
}
|
|
1546
|
-
return this._domController;
|
|
1547
|
-
}
|
|
1548
|
-
get bridge() {
|
|
1549
|
-
if (!this._bridge) {
|
|
1550
|
-
this._bridge = new Bridge(this.io);
|
|
1551
|
-
}
|
|
1552
|
-
return this._bridge;
|
|
1553
|
-
}
|
|
1554
|
-
get glueController() {
|
|
1555
|
-
if (!this._glueController) {
|
|
1556
|
-
this._glueController = new GlueController(this.bridge, this.io, this.config);
|
|
1557
|
-
}
|
|
1558
|
-
return this._glueController;
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
const IOBrowserWidgetFactory = async (io, config) => {
|
|
1563
|
-
const validatedConfig = configDecoder.runWithException(config);
|
|
1564
|
-
const ioc = new IoC(io, validatedConfig);
|
|
1565
|
-
const baseErrorMessage = `Widget won't be shown. Reason:`;
|
|
1566
|
-
const windowId = io.windows.my().id;
|
|
1567
|
-
if (!windowId) {
|
|
1568
|
-
console.error(`${baseErrorMessage} There's no windowID associated with this client`);
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
const logger = ioc.glueController.getLogger(`widget.factory-${windowId}`);
|
|
1572
|
-
if (!validatedConfig.enable) {
|
|
1573
|
-
logger.warn(`${baseErrorMessage} It's disabled by config`);
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
const widgetElementExists = document.getElementsByClassName("io-window-widget").length;
|
|
1577
|
-
if (widgetElementExists) {
|
|
1578
|
-
logger.warn("Widget already appended to the DOM");
|
|
1579
|
-
return;
|
|
1580
|
-
}
|
|
1581
|
-
const initiateRes = await ioc.bridge.initiate();
|
|
1582
|
-
if (!initiateRes.success) {
|
|
1583
|
-
logger.error(`${baseErrorMessage} ${initiateRes.reason}`);
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
logger.trace(`Bridge initiated successfully`);
|
|
1587
|
-
if (!validatedConfig.displayInWorkspace) {
|
|
1588
|
-
const showWidgetRes = await ioc.glueController.checkShowWidget();
|
|
1589
|
-
if (!showWidgetRes.show) {
|
|
1590
|
-
logger.error(`${baseErrorMessage} ${showWidgetRes.reason}`);
|
|
1591
|
-
return;
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
logger.trace(`Widget will be attached to DOM`);
|
|
1595
|
-
await ioc.domController.attachWidget();
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
const eventController = new EventController();
|
|
1599
|
-
eventController.wireCustomEventListener();
|
|
1600
|
-
eventController.notifyStarted();
|
|
1601
|
-
if (typeof window !== "undefined") {
|
|
1602
|
-
window.IOBrowserWidget = IOBrowserWidgetFactory;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
return IOBrowserWidgetFactory;
|
|
1606
|
-
|
|
1607
|
-
}));
|
|
1608
|
-
//# sourceMappingURL=io-browser-widget-react.umd.js.map
|