@apia/util 0.1.0 → 0.1.3

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/dist/index.js CHANGED
@@ -1,2104 +1,7 @@
1
- import { isFunction, clone, cloneDeep } from 'lodash';
2
- import CryptoJS from 'crypto-js';
3
- import dayjs from 'dayjs';
4
- import customParseFormat from 'dayjs/plugin/customParseFormat';
5
- import axios from 'axios';
6
- import FileSaver from 'file-saver';
7
- import * as React from 'react';
8
- import React__default, { useRef, useState, useEffect, useMemo, useCallback, createContext, useContext } from 'react';
9
- import { jsx } from 'react/jsx-runtime';
10
- import { Box } from 'theme-ui';
11
- import { isFunction as isFunction$1, uniqueId } from 'lodash-es';
12
- import { persistentStorage as persistentStorage$1, debugDispatcher as debugDispatcher$1 } from '@apia/util';
13
- import xml2js from 'xml2js';
14
- import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
15
-
16
- function arrayOrArray(o) {
17
- if (o === void 0)
18
- return [];
19
- return Array.isArray(o) ? o : [o];
20
- }
21
-
22
- function getIndex(arr, conditions, defaultIndex) {
23
- for (let i = 0; i < conditions.length; i++) {
24
- if (typeof conditions[i] === "boolean" && conditions[i] || isFunction(conditions[i]) && conditions[i]())
25
- return arr[i];
26
- }
27
- return arr[defaultIndex != null ? defaultIndex : -1];
28
- }
29
-
30
- const generateKey = (salt, passPhrase, keySize, iterationCount) => {
31
- const key = CryptoJS.PBKDF2(passPhrase, CryptoJS.enc.Hex.parse(salt), {
32
- keySize: keySize / 32,
33
- iterations: iterationCount
34
- });
35
- return key;
36
- };
37
-
38
- const decrypt = (salt, iv, passPhrase, cipherText, keySize, iterationCount) => {
39
- const key = generateKey(salt, passPhrase, keySize, iterationCount);
40
- const cipherParams = CryptoJS.lib.CipherParams.create({
41
- ciphertext: CryptoJS.enc.Base64.parse(cipherText)
42
- });
43
- const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {
44
- iv: CryptoJS.enc.Hex.parse(iv)
45
- });
46
- return decrypted.toString(CryptoJS.enc.Utf8);
47
- };
48
-
49
- const encrypt = (salt, iv, passPhrase, plainText, keySize, iterationCount) => {
50
- const key = generateKey(salt, passPhrase, keySize, iterationCount);
51
- const encrypted = CryptoJS.AES.encrypt(plainText, key, {
52
- iv: CryptoJS.enc.Hex.parse(iv)
53
- });
54
- return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
55
- };
56
-
57
- dayjs.extend(customParseFormat);
58
- const DEFAULT_DATE_FORMAT = "DD/MM/YYYY";
59
- const getDateFormat = () => {
60
- switch (window.DATE_FORMAT) {
61
- case "m/d/Y":
62
- return "MM/DD/YYYY";
63
- case "d/m/Y":
64
- return DEFAULT_DATE_FORMAT;
65
- case "Y/m/d":
66
- return "YYYY/MM/DD";
67
- default:
68
- return "DD/MM/YYYY";
69
- }
70
- };
71
-
72
- function apiaDateToStandarFormat(date) {
73
- const newDate = dayjs(date, getDateFormat());
74
- if (!newDate.isValid())
75
- return "";
76
- return newDate.format("YYYY-MM-DD");
77
- }
78
-
79
- function dateToApiaFormat(date) {
80
- return dayjs(date).format(getDateFormat());
81
- }
82
-
83
- let isEnabled = true;
84
- function isDebugDispatcherEnabled() {
85
- return isEnabled;
86
- }
87
- function enableDebugDispatcher() {
88
- isEnabled = true;
89
- }
90
- const debugDispatcher = new class DDispatcher {
91
- constructor() {
92
- this.callbacks = {};
93
- this.actions = {
94
- shout: () => {
95
- console.log(Object.keys(this.callbacks));
96
- }
97
- };
98
- this.emit = (action, ...parameters) => {
99
- var _a, _b, _c, _d;
100
- if (this.actions[action])
101
- this.actions[action]();
102
- else {
103
- if (((_a = this.callbacks[action]) != null ? _a : []).length === 1)
104
- return (_c = (_b = this.callbacks[action]) == null ? void 0 : _b[0]) == null ? void 0 : _c.call(_b, parameters);
105
- ((_d = this.callbacks[action]) != null ? _d : []).forEach((cb) => {
106
- return cb(parameters);
107
- });
108
- }
109
- return null;
110
- };
111
- }
112
- on(action, cb, help, onlyDevelop = false) {
113
- if (!isEnabled && onlyDevelop)
114
- return () => {
115
- };
116
- if (Object.keys(this.actions).includes(action))
117
- throw new Error(
118
- `The action ${action} is a reserved word for the dispatcher.`
119
- );
120
- if (!this.callbacks[action])
121
- this.callbacks[action] = [];
122
- const actionMethod = Object.assign(cb, {
123
- help: () => {
124
- if (typeof help === "string")
125
- console.info(help);
126
- }
127
- });
128
- this.callbacks[action].push(actionMethod);
129
- this[action] = Object.assign(
130
- (...props) => {
131
- this.emit(action, ...props);
132
- },
133
- {
134
- help: () => {
135
- if (typeof help === "string")
136
- console.info(help);
137
- }
138
- }
139
- );
140
- return () => {
141
- this.off(action, cb);
142
- };
143
- }
144
- off(action, cb) {
145
- this.callbacks[action] = this.callbacks[action].filter((current) => {
146
- return current !== cb;
147
- });
148
- }
149
- }();
150
- window.dd = debugDispatcher;
151
- window.adt = debugDispatcher;
152
-
153
- const shortcutController = new class ShortcutController {
154
- constructor() {
155
- this.history = [];
156
- this.candidates = [];
157
- this.shortcuts = {
158
- callbacks: [],
159
- children: [],
160
- key: { key: "" }
161
- };
162
- this.shortcutsStrings = [];
163
- this.categories = {
164
- dev: ["shift&D"]
165
- };
166
- document.addEventListener("keydown", (ev) => {
167
- var _a;
168
- if (((_a = ev.key) == null ? void 0 : _a.length) !== 1 && ev.key !== "Escape")
169
- return;
170
- this.candidates = [
171
- ...this.candidates.reduce(
172
- (accumulated, current) => [
173
- ...accumulated,
174
- ...current.children.filter(
175
- (child) => child.key.key === ev.key && child.key.altKey === ev.altKey && child.key.ctrlKey === ev.ctrlKey && child.key.shiftKey === ev.shiftKey
176
- )
177
- ],
178
- []
179
- ),
180
- ...this.shortcuts.children.filter(
181
- (current) => current.key.key === ev.key && current.key.altKey === ev.altKey && current.key.ctrlKey === ev.ctrlKey && current.key.shiftKey === ev.shiftKey
182
- )
183
- ];
184
- this.candidates.forEach((current) => {
185
- var _a2;
186
- if (current.fireEvenFromInputs || !(!ev.key || ev.key.length > 1 || ["input", "textarea", "select"].includes(
187
- (_a2 = ev.target.tagName) == null ? void 0 : _a2.toLowerCase()
188
- ))) {
189
- if (current.callbacks)
190
- current.callbacks.forEach((cb) => cb(ev));
191
- }
192
- });
193
- });
194
- debugDispatcher.on(
195
- "shortcuts",
196
- () => {
197
- console.info(this.shortcutsStrings);
198
- console.info(this.shortcuts, this.history);
199
- },
200
- "Muestra los shortcuts registrados"
201
- );
202
- this.on(
203
- "short".split(""),
204
- () => {
205
- this.shortcutsStrings.forEach((shortcut) => console.info(shortcut));
206
- },
207
- "dev"
208
- );
209
- }
210
- parseKeyToString(key) {
211
- if (typeof key === "string")
212
- return key;
213
- return `${key.altKey ? "alt&" : ""}${key.ctrlKey ? "ctrl&" : ""}${key.shiftKey ? "shift&" : ""}${key.key}`;
214
- }
215
- parseKey(keyString) {
216
- const elements = keyString.split("&");
217
- const altKey = elements.includes("alt");
218
- const ctrlKey = elements.includes("ctrl");
219
- const shiftKey = elements.includes("shift");
220
- const key = elements.find(
221
- (current) => current !== "shift" && current !== "alt" && current !== "ctrl"
222
- );
223
- if (!key)
224
- throw new Error(`parseKey "${keyString}" does not have key.`);
225
- return {
226
- key,
227
- altKey,
228
- ctrlKey,
229
- shiftKey
230
- };
231
- }
232
- /**
233
- * Para setear un shorcut se puede pasar un string representativo con la
234
- * forma:
235
- *
236
- * **alt**?&**ctrl**?&**shift**?&**(\w)**
237
- *
238
- * Donde: alt? ctrl? shift? implica que cualquiera de esas palabras pueden o
239
- * no aparecer y (\w) es una letra, símbolo o número.
240
- *
241
- * Puede aparecer cualquier tecla de control o no, pero el símbolo o letra
242
- * debe aparecer.
243
- *
244
- * @param category
245
- * Agrega un prefijo de teclas que se deben presionar antes del shortcut para
246
- * que funcione, de forma que por ejemplo, todos los shortcuts de la categoría
247
- * dev serán ejecutados solamente si antes se presionó shift&D
248
- *
249
- * @example
250
- *
251
- shortcutController.on(['shift&A', 'b', 'ctrl&c', 'alt&d'], (ev) => {
252
- ev.preventDefault();
253
- console.log('Abctrl+cd'),
254
- }); // Este shortcut se ejecuta en desarrollo y producción
255
-
256
- shortcutController.on('unshortcut'.split(''), (ev) => {
257
- ev.preventDefault();
258
- console.log('Abctrl+cd'),
259
- }, 'dev'); // Este shortcut solo se ejecuta en desarrollo
260
- */
261
- on(keys, callback, category, fireEvenFromInputs) {
262
- if (category === "dev" && isDebugDispatcherEnabled())
263
- return;
264
- let container = this.shortcuts;
265
- const actualKeys = category ? [...this.categories[category], ...keys] : keys;
266
- if (this.shortcutsStrings.includes(
267
- actualKeys.map((current) => this.parseKeyToString(current)).join("")
268
- )) {
269
- console.warn(
270
- `The shortcut ${actualKeys.map((current) => this.parseKeyToString(current)).join(
271
- ""
272
- )} is being setted twice. The controller wont register more than one instance but this could be a hint if some unexpected behavior.`
273
- );
274
- return;
275
- }
276
- for (const key of actualKeys) {
277
- const actualKey = typeof key === "string" ? this.parseKey(key) : key;
278
- if (actualKey.key === "")
279
- throw new Error(`Empty key ('') is not allowed`);
280
- const keyContainer = container.children.find(
281
- (current) => current.key.key === actualKey.key || current.key.key === "" && current.key.altKey === actualKey.altKey && current.key.ctrlKey === actualKey.ctrlKey && current.key.shiftKey === actualKey.shiftKey && current.fireEvenFromInputs === fireEvenFromInputs
282
- );
283
- if (keyContainer)
284
- container = keyContainer;
285
- else {
286
- const newContainer = {
287
- callbacks: [],
288
- children: [],
289
- key: actualKey,
290
- fireEvenFromInputs
291
- };
292
- container.children.push(newContainer);
293
- container = newContainer;
294
- }
295
- }
296
- this.shortcutsStrings.push(
297
- actualKeys.map((current) => this.parseKeyToString(current)).join("")
298
- );
299
- container.callbacks.push(callback);
300
- }
301
- }();
302
-
303
- function autoDisconnectMutationObserver(element, callback, conf) {
304
- var _a;
305
- let timeoutRegister = -1;
306
- let isConnected = false;
307
- function disconnect() {
308
- if (isConnected) {
309
- isConnected = false;
310
- observer.disconnect();
311
- clearTimeout(timeoutRegister);
312
- }
313
- }
314
- let shoutCallback;
315
- const observer = new MutationObserver((...props) => {
316
- var _a2, _b;
317
- if (((_a2 = props[0]) == null ? void 0 : _a2[0]) && (props[0][0].removedNodes || props[0][0].addedNodes)) {
318
- clearTimeout(shoutCallback);
319
- shoutCallback = setTimeout(callback, 100);
320
- clearTimeout(timeoutRegister);
321
- timeoutRegister = setTimeout(
322
- disconnect,
323
- (_b = conf == null ? void 0 : conf.timeout) != null ? _b : 100
324
- );
325
- }
326
- });
327
- isConnected = true;
328
- observer.observe(element, { subtree: true, childList: true });
329
- timeoutRegister = setTimeout(
330
- disconnect,
331
- (_a = conf == null ? void 0 : conf.timeout) != null ? _a : 100
332
- );
333
- if ((conf == null ? void 0 : conf.runCallbackOnInit) !== false)
334
- shoutCallback = setTimeout(callback, 100);
335
- return disconnect;
336
- }
337
-
338
- var __async$2 = (__this, __arguments, generator) => {
339
- return new Promise((resolve, reject) => {
340
- var fulfilled = (value) => {
341
- try {
342
- step(generator.next(value));
343
- } catch (e) {
344
- reject(e);
345
- }
346
- };
347
- var rejected = (value) => {
348
- try {
349
- step(generator.throw(value));
350
- } catch (e) {
351
- reject(e);
352
- }
353
- };
354
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
355
- step((generator = generator.apply(__this, __arguments)).next());
356
- });
357
- };
358
- function defaultGetNameFromResponse(blob) {
359
- var _a, _b, _c, _d;
360
- return (_d = (_c = (_b = (_a = blob.headers["content-disposition"]) == null ? void 0 : _a.match) == null ? void 0 : _b.call(
361
- _a,
362
- /filename=(?:\\?")?([\w,\s-() ]+(?:\.[A-Za-z]+)?)(?:\\?")?;?/
363
- )) == null ? void 0 : _c[1]) != null ? _d : "noFileName";
364
- }
365
- function downloadUrl(_0) {
366
- return __async$2(this, arguments, function* (url, secondParameter = defaultGetNameFromResponse) {
367
- const blob = yield axios.get(url, {
368
- responseType: "blob"
369
- });
370
- const actualFileName = typeof secondParameter === "string" ? secondParameter : secondParameter(blob);
371
- FileSaver.saveAs(new Blob([blob.data]), actualFileName);
372
- });
373
- }
374
-
375
- const REGEXP_SCROLL_PARENT = /^(visible|hidden)/;
376
- function findScrollContainer(el) {
377
- return !(el instanceof HTMLElement) || typeof window.getComputedStyle !== "function" ? null : el.scrollHeight >= el.clientHeight && !REGEXP_SCROLL_PARENT.test(
378
- window.getComputedStyle(el).overflowY || "visible"
379
- ) ? el : findScrollContainer(el.parentElement) || document.body;
380
- }
381
-
382
- function findOffsetRelativeToScrollParent(element, which = "Top") {
383
- const scrollParent = findScrollContainer(element);
384
- let currentElement = element;
385
- let offset = 0;
386
- let offsetParent = currentElement;
387
- while (currentElement && currentElement !== scrollParent && currentElement !== document.body && offsetParent !== scrollParent) {
388
- if (offsetParent !== currentElement.offsetParent) {
389
- offset += currentElement[`offset${which}`];
390
- offsetParent = currentElement.offsetParent;
391
- }
392
- currentElement = currentElement.parentElement;
393
- }
394
- return offset;
395
- }
396
-
397
- const scrollIntervals = {};
398
- function scrollParentIntoElement(element, fixedOffsetTop = 0, tries = 2, timeout = 100, scrollId = void 0) {
399
- var _a;
400
- if (scrollId) {
401
- clearTimeout(scrollIntervals[scrollId]);
402
- }
403
- const scrollParent = findScrollContainer(element);
404
- const offsetTop = findOffsetRelativeToScrollParent(element);
405
- if (scrollParent && (scrollParent.scrollTop + fixedOffsetTop > offsetTop || ((_a = scrollParent == null ? void 0 : scrollParent.clientHeight) != null ? _a : Infinity) - fixedOffsetTop < element.getBoundingClientRect().height)) {
406
- scrollParent.scrollTop = offsetTop - fixedOffsetTop;
407
- } else if (scrollParent && scrollParent.scrollTop + scrollParent.clientHeight < offsetTop + element.getBoundingClientRect().height) {
408
- scrollParent.scrollTop = offsetTop;
409
- }
410
- if (tries > 0)
411
- scrollIntervals[scrollId != null ? scrollId : "noId"] = setTimeout(
412
- () => scrollParentIntoElement(element, fixedOffsetTop, tries - 1, timeout),
413
- timeout
414
- );
415
- }
416
-
417
- function usePanAndZoom(effectiveMargin = { left: 0, bottom: 0, right: 0, top: 0 }, blockZoom = true) {
418
- const boxRef = useRef(null);
419
- const elementRef = useRef(null);
420
- const [isPanning, setIsPanning] = React__default.useState(false);
421
- const [panningPosition, setPanningPosition] = React__default.useState({ x: 0, y: 0 });
422
- React__default.useEffect(() => {
423
- if (blockZoom)
424
- return;
425
- const container = boxRef.current;
426
- const innerElement = elementRef.current;
427
- const handlePanStart = (ev) => {
428
- ev.preventDefault();
429
- setIsPanning(true);
430
- setPanningPosition({ x: ev.clientX, y: ev.clientY });
431
- };
432
- const handlePanEnd = (ev) => {
433
- ev.preventDefault();
434
- setIsPanning(false);
435
- };
436
- const handlePan = (ev) => {
437
- if (!innerElement || !container) {
438
- return;
439
- }
440
- if (isPanning) {
441
- ev.preventDefault();
442
- ev.stopPropagation();
443
- const dx = ev.clientX - panningPosition.x;
444
- const dy = ev.clientY - panningPosition.y;
445
- container.scrollLeft -= dx;
446
- container.scrollTop -= dy;
447
- setPanningPosition({ x: ev.clientX, y: ev.clientY });
448
- }
449
- };
450
- if (container) {
451
- container.addEventListener("mousedown", handlePanStart);
452
- container.addEventListener("mouseup", handlePanEnd);
453
- container.addEventListener("mouseleave", handlePanEnd);
454
- container.addEventListener("mousemove", handlePan);
455
- return () => {
456
- container.removeEventListener("mousedown", handlePanStart);
457
- container.removeEventListener("mousemove", handlePan);
458
- container.removeEventListener("mouseup", handlePanEnd);
459
- container.removeEventListener("mouseleave", handlePanEnd);
460
- };
461
- }
462
- }, [isPanning, panningPosition]);
463
- React__default.useEffect(() => {
464
- if (blockZoom)
465
- return;
466
- const container = boxRef.current;
467
- const innerElement = elementRef.current;
468
- let newScale = 1;
469
- const handleZoom = (ev) => {
470
- ev.preventDefault();
471
- const newDelta = ev.deltaY;
472
- const scaleIncrement = 0.1;
473
- if (newDelta < 0) {
474
- if (newScale + scaleIncrement >= 2) {
475
- return;
476
- }
477
- newScale += scaleIncrement;
478
- } else {
479
- if (newScale - scaleIncrement <= 0.9) {
480
- return;
481
- }
482
- newScale -= scaleIncrement;
483
- }
484
- if (!innerElement || !container) {
485
- return;
486
- }
487
- const containerRect = container.getBoundingClientRect();
488
- const cursorX = ev.clientX - containerRect.left - effectiveMargin.left;
489
- const cursorY = ev.clientY - containerRect.top - effectiveMargin.top;
490
- const cursorXFromCenter = cursorX - containerRect.width / 2;
491
- const cursorYFromCenter = cursorY - containerRect.height / 2;
492
- if (newScale <= 1) {
493
- if (boxRef.current) {
494
- boxRef.current.style.overflow = "hidden";
495
- }
496
- } else {
497
- if (boxRef.current) {
498
- boxRef.current.style.overflow = "hidden";
499
- }
500
- }
501
- innerElement.style.transform = `scale(${newScale})`;
502
- innerElement.style.transformOrigin = "0px 0px";
503
- if (newDelta < 0) {
504
- container.scrollLeft += cursorXFromCenter / (newScale * 2);
505
- container.scrollTop += cursorYFromCenter / (newScale * 2);
506
- } else {
507
- container.scrollLeft -= cursorXFromCenter / (newScale * 2);
508
- container.scrollTop -= cursorYFromCenter / (newScale * 2);
509
- }
510
- };
511
- if (container) {
512
- container.addEventListener("wheel", handleZoom);
513
- return () => {
514
- container.removeEventListener("wheel", handleZoom);
515
- };
516
- }
517
- }, []);
518
- return {
519
- boxRef,
520
- elementRef
521
- };
522
- }
523
-
524
- var __accessCheck$5 = (obj, member, msg) => {
525
- if (!member.has(obj))
526
- throw TypeError("Cannot " + msg);
527
- };
528
- var __privateGet$5 = (obj, member, getter) => {
529
- __accessCheck$5(obj, member, "read from private field");
530
- return getter ? getter.call(obj) : member.get(obj);
531
- };
532
- var __privateAdd$5 = (obj, member, value) => {
533
- if (member.has(obj))
534
- throw TypeError("Cannot add the same private member more than once");
535
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
536
- };
537
- var _emitter;
538
- function eventEmitter() {
539
- const listeners = {};
540
- return {
541
- on(key, fn) {
542
- var _a;
543
- if (!Array.isArray(listeners[key]))
544
- listeners[key] = [];
545
- (_a = listeners[key]) == null ? void 0 : _a.push(fn);
546
- return () => {
547
- this.off(key, fn);
548
- };
549
- },
550
- off(key, fn) {
551
- var _a;
552
- listeners[key] = ((_a = listeners[key]) != null ? _a : []).filter((cb) => {
553
- return cb !== fn;
554
- });
555
- },
556
- emit(key, data) {
557
- var _a;
558
- ((_a = listeners[key]) != null ? _a : []).forEach((fn) => {
559
- return fn(data);
560
- });
561
- }
562
- };
563
- }
564
- class EventEmitter {
565
- constructor() {
566
- __privateAdd$5(this, _emitter, eventEmitter());
567
- }
568
- on(eventName, fn) {
569
- __privateGet$5(this, _emitter).on(eventName, fn);
570
- return () => {
571
- __privateGet$5(this, _emitter).off(eventName, fn);
572
- };
573
- }
574
- off(eventName, fn) {
575
- __privateGet$5(this, _emitter).off(eventName, fn);
576
- }
577
- emit(eventName, params) {
578
- __privateGet$5(this, _emitter).emit(eventName, params);
579
- }
580
- }
581
- _emitter = new WeakMap();
582
-
583
- var __accessCheck$4 = (obj, member, msg) => {
584
- if (!member.has(obj))
585
- throw TypeError("Cannot " + msg);
586
- };
587
- var __privateGet$4 = (obj, member, getter) => {
588
- __accessCheck$4(obj, member, "read from private field");
589
- return getter ? getter.call(obj) : member.get(obj);
590
- };
591
- var __privateAdd$4 = (obj, member, value) => {
592
- if (member.has(obj))
593
- throw TypeError("Cannot add the same private member more than once");
594
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
595
- };
596
- var __privateSet$3 = (obj, member, value, setter) => {
597
- __accessCheck$4(obj, member, "write to private field");
598
- setter ? setter.call(obj, value) : member.set(obj, value);
599
- return value;
600
- };
601
- var _value;
602
- class WithEventsValue extends EventEmitter {
603
- constructor(value) {
604
- super();
605
- __privateAdd$4(this, _value, void 0);
606
- __privateSet$3(this, _value, value);
607
- }
608
- get value() {
609
- return __privateGet$4(this, _value);
610
- }
611
- set value(value) {
612
- __privateSet$3(this, _value, value);
613
- this.emit("update", value);
614
- }
615
- }
616
- _value = new WeakMap();
617
-
618
- const AriaLiveEmitter = new class AriaLiveEmitterClass extends EventEmitter {
619
- }();
620
- const LiveRegion = () => {
621
- const [live, setLive] = useState({
622
- type: "assertive",
623
- message: ""
624
- });
625
- useEffect(() => {
626
- return AriaLiveEmitter.on("live", (ev) => {
627
- if (ev.type === "reset") {
628
- setLive({ type: "assertive", message: "" });
629
- return;
630
- }
631
- if (ev.message === live.message)
632
- return;
633
- setTimeout(() => setLive(ev), 0);
634
- });
635
- }, [live.message]);
636
- return /* @__PURE__ */ jsx(
637
- Box,
638
- {
639
- role: "region",
640
- sx: { transform: "translate(-50000px, -50000px)" },
641
- "aria-live": live.type,
642
- children: live.message
643
- }
644
- );
645
- };
646
-
647
- const customEvents = {
648
- /**
649
- * Indica que un elemento necesita recibir el foco,
650
- * de esta forma, elementos que no se están mostrando
651
- * en pantalla (por display:none por ejemplo), pueden
652
- * indicar a sus ancestros que deben expandirse.
653
- */
654
- focus: "customFocus",
655
- /**
656
- * Indica que debe cambiarse el título del modal
657
- */
658
- iframeModalChangeTitle: "iframeModalChangeTitle",
659
- /**
660
- * Indica que un iframe modal debe cerrarse
661
- */
662
- iframeModalClose: "iframeModalClose",
663
- /**
664
- * Indica que un iframe modal debe cerrarse
665
- */
666
- iframeModalNotify: "iframeModalNotify",
667
- /**
668
- * Indica que un modal debe cerrarse
669
- */
670
- modalClose: "modalClose",
671
- /**
672
- * Indica que el panel contenedor debe cerrarse porque
673
- * está vacío
674
- */
675
- hidePanel: "hidePanel",
676
- showPanel: "showPanel"
677
- };
678
-
679
- const cantFocusSelector = [
680
- "[disabled]",
681
- '[tabIndex="-1"]',
682
- '[aria-hidden="true"]',
683
- "[readonly]",
684
- "[data-focus-guard]",
685
- ".modal__closeButton"
686
- ].map((current) => `:not(${current})`).join("");
687
- const focusSelector = [
688
- "input",
689
- "textarea",
690
- "select",
691
- "a",
692
- "button:not(.toggleAccordionElement)",
693
- "[contenteditable]",
694
- "[tabIndex]",
695
- '[role="button"]'
696
- ].map((current) => `${current}${cantFocusSelector}`).join(",");
697
- function getFocusSelector(not) {
698
- return `input${not != null ? not : ""},
699
- textarea${not != null ? not : ""},
700
- select${not != null ? not : ""},
701
- a${not != null ? not : ""},
702
- button:not(.toggleAccordionElement)${not != null ? not : ""},
703
- [contenteditable]${not != null ? not : ""},
704
- [tabIndex]${not != null ? not : ""}`;
705
- }
706
-
707
- function getSpecificParent(element, checkParent) {
708
- let currentElement = element;
709
- while (element !== document.documentElement && currentElement) {
710
- const hasFoundTheParent = checkParent(currentElement);
711
- if (hasFoundTheParent === null)
712
- return null;
713
- if (hasFoundTheParent)
714
- return currentElement;
715
- const parent = currentElement.parentElement;
716
- if (parent)
717
- currentElement = parent;
718
- else
719
- return null;
720
- }
721
- return null;
722
- }
723
-
724
- function isChild(element, checkParent) {
725
- return !!getSpecificParent(element, checkParent);
726
- }
727
-
728
- var __accessCheck$3 = (obj, member, msg) => {
729
- if (!member.has(obj))
730
- throw TypeError("Cannot " + msg);
731
- };
732
- var __privateGet$3 = (obj, member, getter) => {
733
- __accessCheck$3(obj, member, "read from private field");
734
- return getter ? getter.call(obj) : member.get(obj);
735
- };
736
- var __privateAdd$3 = (obj, member, value) => {
737
- if (member.has(obj))
738
- throw TypeError("Cannot add the same private member more than once");
739
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
740
- };
741
- var _parameters;
742
- class Url {
743
- constructor(baseUrl, defaultAllowMultiple = true) {
744
- this.defaultAllowMultiple = defaultAllowMultiple;
745
- __privateAdd$3(this, _parameters, {});
746
- const [base, query] = baseUrl.split("?");
747
- this.base = base;
748
- query == null ? void 0 : query.split("&").forEach((current) => {
749
- const [name, ...value] = current.split("=");
750
- this.addParameter(name, value.join("="));
751
- });
752
- }
753
- addParameter(name, value, allowMultiple) {
754
- if (allowMultiple === void 0 && !this.defaultAllowMultiple || allowMultiple === false)
755
- __privateGet$3(this, _parameters)[name] = String(value);
756
- else
757
- __privateGet$3(this, _parameters)[name] = __privateGet$3(this, _parameters)[name] ? [...arrayOrArray(__privateGet$3(this, _parameters)[name]), String(value)] : [String(value)];
758
- }
759
- addParameters(parameters) {
760
- parameters.forEach(
761
- (current) => this.addParameter(current.name, current.value, current.allowMultiple)
762
- );
763
- }
764
- getParameter(name) {
765
- return __privateGet$3(this, _parameters)[name];
766
- }
767
- toString() {
768
- const parametersArray = Object.entries(__privateGet$3(this, _parameters));
769
- return `${this.base}${parametersArray.length > 0 ? `?${parametersArray.map(
770
- ([name, value]) => Array.isArray(value) ? value.map((current) => `${name}=${current}`).join("&") : `${name}=${String(value)}`
771
- ).join("&")}` : ""}`;
772
- }
773
- }
774
- _parameters = new WeakMap();
775
-
776
- const previousTabIndexLabel = "data-previous-tabindex";
777
- function disableChildrenFocus(parent) {
778
- const focusElement = parent.querySelectorAll(focusSelector);
779
- focusElement.forEach((element) => {
780
- var _a;
781
- element.setAttribute(
782
- previousTabIndexLabel,
783
- (_a = element.getAttribute("tabindex")) != null ? _a : ""
784
- );
785
- element.setAttribute("tabindex", "-1");
786
- });
787
- }
788
- function enableChildrenFocus(parent) {
789
- const focusElement = parent.querySelectorAll(`[${previousTabIndexLabel}]`);
790
- focusElement.forEach((element) => {
791
- var _a;
792
- element.setAttribute(
793
- "tabindex",
794
- (_a = element.getAttribute(previousTabIndexLabel)) != null ? _a : "0"
795
- );
796
- element.removeAttribute(previousTabIndexLabel);
797
- });
798
- }
799
-
800
- var __accessCheck$2 = (obj, member, msg) => {
801
- if (!member.has(obj))
802
- throw TypeError("Cannot " + msg);
803
- };
804
- var __privateGet$2 = (obj, member, getter) => {
805
- __accessCheck$2(obj, member, "read from private field");
806
- return getter ? getter.call(obj) : member.get(obj);
807
- };
808
- var __privateAdd$2 = (obj, member, value) => {
809
- if (member.has(obj))
810
- throw TypeError("Cannot add the same private member more than once");
811
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
812
- };
813
- var __privateSet$2 = (obj, member, value, setter) => {
814
- __accessCheck$2(obj, member, "write to private field");
815
- setter ? setter.call(obj, value) : member.set(obj, value);
816
- return value;
817
- };
818
- var _onFocusCallbacks, _a$2;
819
- const historySize = 50;
820
- const globalFocus = new (_a$2 = class {
821
- constructor() {
822
- this.focused = [];
823
- __privateAdd$2(this, _onFocusCallbacks, []);
824
- debugDispatcher.on(
825
- "focusHistory",
826
- () => {
827
- console.info(this.focused);
828
- },
829
- "Muestra el historial de elementos que recibieron foco."
830
- );
831
- }
832
- offFocus(cb) {
833
- __privateSet$2(this, _onFocusCallbacks, __privateGet$2(this, _onFocusCallbacks).filter(
834
- (current) => current !== cb
835
- ));
836
- }
837
- onFocus(cb) {
838
- __privateGet$2(this, _onFocusCallbacks).push(cb);
839
- return () => {
840
- this.offFocus(cb);
841
- };
842
- }
843
- inDocument(el) {
844
- return el instanceof Function || el instanceof HTMLElement && el.offsetParent !== null;
845
- }
846
- set focus(element) {
847
- this.focused = this.focused.filter((el) => {
848
- const existsInDocument = this.inDocument(el) && element !== el;
849
- return existsInDocument;
850
- });
851
- this.focused.unshift(element);
852
- if (this.focused.length > historySize) {
853
- this.focused = this.focused.splice(0, historySize);
854
- }
855
- __privateGet$2(this, _onFocusCallbacks).forEach((cb) => cb());
856
- }
857
- get list() {
858
- return [...this.focused];
859
- }
860
- /**
861
- * @param querySelector A query selector against which the element should match
862
- * @returns The last HTMLElement if no querySelector argument provided or else, the last which matches
863
- * against that query selector.
864
- * */
865
- last(querySelector, omit = 0) {
866
- if (querySelector)
867
- for (let i = omit; i <= this.focused.length; i++) {
868
- const storedElement = this.focused[i];
869
- const element = (
870
- // eslint-disable-next-line no-nested-ternary
871
- (storedElement == null ? void 0 : storedElement.id) !== void 0 ? storedElement : isFunction$1(storedElement) ? storedElement(false) : null
872
- );
873
- if (element && this.inDocument(element) && element.matches && element.matches(querySelector))
874
- return element;
875
- }
876
- else
877
- return this.focused[this.focused.length - 1];
878
- return null;
879
- }
880
- }, _onFocusCallbacks = new WeakMap(), _a$2)();
881
-
882
- var __accessCheck$1 = (obj, member, msg) => {
883
- if (!member.has(obj))
884
- throw TypeError("Cannot " + msg);
885
- };
886
- var __privateGet$1 = (obj, member, getter) => {
887
- __accessCheck$1(obj, member, "read from private field");
888
- return getter ? getter.call(obj) : member.get(obj);
889
- };
890
- var __privateAdd$1 = (obj, member, value) => {
891
- if (member.has(obj))
892
- throw TypeError("Cannot add the same private member more than once");
893
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
894
- };
895
- var __privateSet$1 = (obj, member, value, setter) => {
896
- __accessCheck$1(obj, member, "write to private field");
897
- setter ? setter.call(obj, value) : member.set(obj, value);
898
- return value;
899
- };
900
- var __privateMethod$1 = (obj, member, method) => {
901
- __accessCheck$1(obj, member, "access private method");
902
- return method;
903
- };
904
- var _hasReleasedFirstTime, _wasReleasedFirstTime, _isForced, _locks, _shoutLockState, shoutLockState_fn, _a$1;
905
- const screenLocker = new (_a$1 = class extends EventEmitter {
906
- constructor() {
907
- super();
908
- __privateAdd$1(this, _shoutLockState);
909
- __privateAdd$1(this, _hasReleasedFirstTime, false);
910
- __privateAdd$1(this, _wasReleasedFirstTime, false);
911
- __privateAdd$1(this, _isForced, false);
912
- __privateAdd$1(this, _locks, {
913
- common: false
914
- });
915
- this.emit("ready");
916
- }
917
- get hasReleasedFirstTime() {
918
- return __privateGet$1(this, _hasReleasedFirstTime);
919
- }
920
- get isForced() {
921
- return __privateGet$1(this, _isForced);
922
- }
923
- /**
924
- * Permite saber si un bloqueo determinado está activo o si la clase tiene
925
- * forceLock activo.
926
- */
927
- isLocked(lockName = "common") {
928
- return __privateGet$1(this, _locks)[lockName] || __privateGet$1(this, _isForced);
929
- }
930
- lock(lockName = "common") {
931
- __privateGet$1(this, _locks)[lockName] = true;
932
- __privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this, lockName);
933
- }
934
- unlock(lockName = "common") {
935
- if (lockName === "common")
936
- __privateSet$1(this, _hasReleasedFirstTime, true);
937
- __privateGet$1(this, _locks)[lockName] = false;
938
- __privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this, lockName);
939
- }
940
- force() {
941
- __privateSet$1(this, _isForced, true);
942
- __privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this);
943
- }
944
- releaseForced() {
945
- __privateSet$1(this, _isForced, false);
946
- __privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this);
947
- }
948
- }, _hasReleasedFirstTime = new WeakMap(), _wasReleasedFirstTime = new WeakMap(), _isForced = new WeakMap(), _locks = new WeakMap(), _shoutLockState = new WeakSet(), shoutLockState_fn = function(lockName) {
949
- if (__privateGet$1(this, _isForced) || lockName === void 0) {
950
- this.emit("forcedStateChange", {
951
- isForced: __privateGet$1(this, _isForced),
952
- hasReleasedFirstTime: __privateGet$1(this, _hasReleasedFirstTime)
953
- });
954
- } else {
955
- if (lockName === "common" && !__privateGet$1(this, _wasReleasedFirstTime) && __privateGet$1(this, _hasReleasedFirstTime)) {
956
- this.emit("releaseForFirstTime");
957
- }
958
- this.emit("lockStateChange", {
959
- lockName,
960
- hasReleasedFirstTime: __privateGet$1(this, _hasReleasedFirstTime),
961
- isLocked: __privateGet$1(this, _locks)[lockName]
962
- });
963
- }
964
- }, _a$1)();
965
-
966
- const persistentStorage = new Proxy(
967
- {
968
- remove(prop) {
969
- localStorage.removeItem(prop);
970
- }
971
- },
972
- {
973
- get(_, prop) {
974
- try {
975
- const value = localStorage.getItem(String(prop));
976
- if (!value)
977
- return void 0;
978
- return JSON.parse(value);
979
- } catch (e) {
980
- return void 0;
981
- }
982
- },
983
- set(_, prop, value) {
984
- localStorage.setItem(String(prop), JSON.stringify(value));
985
- return true;
986
- }
987
- }
988
- );
989
- window.persistentStorage = persistentStorage;
990
-
991
- const localStorageController = new class LocalSctorageController extends EventEmitter {
992
- }();
993
- function useLocalStorage(prop, defaultValue) {
994
- const actualProp = useMemo(() => prop, []);
995
- const storageValue = useMemo(
996
- () => localStorage.getItem(actualProp),
997
- // eslint-disable-next-line react-hooks/exhaustive-deps
998
- []
999
- );
1000
- const [value, setValue] = useState(
1001
- storageValue ? JSON.parse(storageValue) : defaultValue
1002
- );
1003
- useEffect(() => {
1004
- setValue(JSON.parse(storageValue));
1005
- return localStorageController.on("update", (ev) => {
1006
- if (ev.prop === actualProp) {
1007
- setValue(ev.value);
1008
- localStorage.setItem(actualProp, JSON.stringify(ev.value));
1009
- }
1010
- });
1011
- }, []);
1012
- return [
1013
- value,
1014
- useCallback(
1015
- (newValue) => {
1016
- localStorageController.emit("update", {
1017
- prop: actualProp,
1018
- value: newValue
1019
- });
1020
- },
1021
- [actualProp]
1022
- )
1023
- ];
1024
- }
1025
-
1026
- function addBoundary(definition, min, max, loop) {
1027
- const actualNumber = typeof definition === "number" ? definition : definition.number;
1028
- const actualMin = typeof definition === "number" ? min : definition.min;
1029
- const actualMax = typeof definition === "number" ? max : definition.max;
1030
- const isActualLoop = typeof definition === "number" ? loop : definition.loop;
1031
- let newNumber = Number(actualNumber != null ? actualNumber : 0);
1032
- if (actualMin !== void 0 && newNumber < actualMin) {
1033
- if (actualMax !== void 0 && isActualLoop) {
1034
- newNumber = actualMax;
1035
- } else {
1036
- newNumber = actualMin;
1037
- }
1038
- }
1039
- if (actualMax !== void 0 && newNumber > actualMax) {
1040
- if (actualMin !== void 0 && isActualLoop) {
1041
- newNumber = actualMin;
1042
- } else {
1043
- newNumber = actualMax;
1044
- }
1045
- }
1046
- return newNumber;
1047
- }
1048
- const sizeUnits = ["b", "kb", "mb", "gb", "tb"];
1049
- function parseAsSize(num) {
1050
- let index = 0;
1051
- let finalSize = num;
1052
- if (finalSize === Infinity)
1053
- return "1000GB";
1054
- while (finalSize > 1024) {
1055
- finalSize /= 1024;
1056
- index++;
1057
- }
1058
- return `${Math.round(finalSize * 10) / 10}${sizeUnits[index]}`;
1059
- }
1060
- function noNaN(number, defaultReturn = 0) {
1061
- const returnNumber = Number(number);
1062
- if (number === null || Number.isNaN(returnNumber))
1063
- return defaultReturn;
1064
- return returnNumber;
1065
- }
1066
-
1067
- var __accessCheck = (obj, member, msg) => {
1068
- if (!member.has(obj))
1069
- throw TypeError("Cannot " + msg);
1070
- };
1071
- var __privateGet = (obj, member, getter) => {
1072
- __accessCheck(obj, member, "read from private field");
1073
- return getter ? getter.call(obj) : member.get(obj);
1074
- };
1075
- var __privateAdd = (obj, member, value) => {
1076
- if (member.has(obj))
1077
- throw TypeError("Cannot add the same private member more than once");
1078
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1079
- };
1080
- var __privateSet = (obj, member, value, setter) => {
1081
- __accessCheck(obj, member, "write to private field");
1082
- setter ? setter.call(obj, value) : member.set(obj, value);
1083
- return value;
1084
- };
1085
- var __privateWrapper = (obj, member, setter, getter) => ({
1086
- set _(value) {
1087
- __privateSet(obj, member, value, setter);
1088
- },
1089
- get _() {
1090
- return __privateGet(obj, member, getter);
1091
- }
1092
- });
1093
- var __privateMethod = (obj, member, method) => {
1094
- __accessCheck(obj, member, "access private method");
1095
- return method;
1096
- };
1097
- var __async$1 = (__this, __arguments, generator) => {
1098
- return new Promise((resolve, reject) => {
1099
- var fulfilled = (value) => {
1100
- try {
1101
- step(generator.next(value));
1102
- } catch (e) {
1103
- reject(e);
1104
- }
1105
- };
1106
- var rejected = (value) => {
1107
- try {
1108
- step(generator.throw(value));
1109
- } catch (e) {
1110
- reject(e);
1111
- }
1112
- };
1113
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1114
- step((generator = generator.apply(__this, __arguments)).next());
1115
- });
1116
- };
1117
- var _root, _props, _actualFocusQuery, _currentInstruction, _focusDelay, _focusRetries, _focusTimeout, _isIntervalRunning, _focusQuery, focusQuery_get, _checkInstruction, checkInstruction_fn, _doFocus, doFocus_fn, _resetInterval, resetInterval_fn, _runFocusInterval, runFocusInterval_fn, _a;
1118
- const notificationsSelector = ".notification";
1119
- const focus = new (_a = class {
1120
- constructor(root, props) {
1121
- __privateAdd(this, _focusQuery);
1122
- __privateAdd(this, _checkInstruction);
1123
- __privateAdd(this, _doFocus);
1124
- __privateAdd(this, _resetInterval);
1125
- __privateAdd(this, _runFocusInterval);
1126
- __privateAdd(this, _root, void 0);
1127
- __privateAdd(this, _props, void 0);
1128
- this.afterNotificationFocus = void 0;
1129
- __privateAdd(this, _actualFocusQuery, []);
1130
- __privateAdd(this, _currentInstruction, 0);
1131
- __privateAdd(this, _focusDelay, 300);
1132
- __privateAdd(this, _focusRetries, 3);
1133
- __privateAdd(this, _focusTimeout, -1);
1134
- __privateAdd(this, _isIntervalRunning, false);
1135
- this.focusOnReload = null;
1136
- __privateSet(this, _root, root);
1137
- __privateSet(this, _props, props);
1138
- window.focusStatus = {};
1139
- globalFocus.onFocus(() => {
1140
- __privateMethod(this, _resetInterval, resetInterval_fn).call(this);
1141
- });
1142
- }
1143
- /**
1144
- * Da la instrucción de colocar el foco en el elemento provisto como
1145
- * parámetro una vez que todas las notificaciones se hayan cerrado. En caso
1146
- * de no existir notificaciones abiertas, hace foco en el elemento
1147
- * directamente.
1148
- */
1149
- afterNotifications(element, configuration) {
1150
- if (!element)
1151
- return;
1152
- void this.on(element, configuration);
1153
- }
1154
- /**
1155
- * Da la instrucción de colocar el foco en el elemento provisto como
1156
- * parámetro luego de recargar la página.
1157
- *
1158
- * Los parámetros pasados serán ordenados en orden de importancia priorizando
1159
- * en el siguiente orden:
1160
- * - id
1161
- * - name
1162
- * - className
1163
- * - selector
1164
- */
1165
- afterReload({
1166
- className,
1167
- id,
1168
- name,
1169
- selector
1170
- }) {
1171
- persistentStorage.focusOnReload = [
1172
- id ? `#${id}` : void 0,
1173
- name ? `[name="${name}"]` : void 0,
1174
- className ? `.${className}` : void 0,
1175
- selector
1176
- ].filter((el) => el !== void 0).join(",");
1177
- }
1178
- /**
1179
- * Da la instrucción de colocar el foco el elemento pasado como parámetro.
1180
- * Se puede pasar también una función que devuelva HTMLElement | false | null.
1181
- *
1182
- * El segundo parámetro del método on es un objeto de tipo
1183
- * ScrollIntoViewOptions, que permite modificar el comportamiento del scroll
1184
- * a en el elemento.
1185
- *
1186
- * @see TFocusRetriever para más detalles sobre la función como parámetro.
1187
- */
1188
- on(element, configuration) {
1189
- return __async$1(this, null, function* () {
1190
- if (element) {
1191
- const focusElement = {
1192
- element,
1193
- configuration
1194
- };
1195
- for (let i = 0; i < __privateGet(this, _focusRetries); i++)
1196
- __privateGet(this, _focusQuery, focusQuery_get).unshift(focusElement);
1197
- __privateMethod(this, _resetInterval, resetInterval_fn).call(this);
1198
- return __privateMethod(this, _runFocusInterval, runFocusInterval_fn).call(this, focusElement);
1199
- }
1200
- return false;
1201
- });
1202
- }
1203
- restore() {
1204
- void this.on(
1205
- globalFocus.last(":not(body), body#tinymce") || document.querySelector(focusSelector)
1206
- );
1207
- }
1208
- init() {
1209
- var _a2, _b;
1210
- const modalsObserver = new MutationObserver((mutation) => {
1211
- if (mutation[0].removedNodes.length === 0)
1212
- return;
1213
- this.afterNotifications(
1214
- globalFocus.last(
1215
- ":not(body):not(.notificationsView *), body#tinymce"
1216
- )
1217
- );
1218
- });
1219
- const appModalsBox = ((_b = (_a2 = __privateGet(this, _props)) == null ? void 0 : _a2.modalsContainerRetriever) != null ? _b : () => __privateGet(this, _root).querySelector("#AppModals"))();
1220
- if (appModalsBox)
1221
- modalsObserver.observe(appModalsBox, { childList: true });
1222
- screenLocker.on("releaseForFirstTime", () => {
1223
- if (persistentStorage.focusOnReload)
1224
- this.focusOnReload = persistentStorage.focusOnReload;
1225
- persistentStorage.focusOnReload = null;
1226
- this.afterNotifications(() => {
1227
- var _a3;
1228
- if (this.focusOnReload) {
1229
- const initialFocusElement = document.querySelector(
1230
- this.focusOnReload
1231
- );
1232
- const scrollTop = noNaN((_a3 = window.CURRENT_TAB) == null ? void 0 : _a3.split("~")[1]);
1233
- if (document.scrollingElement)
1234
- document.scrollingElement.scrollTop = scrollTop;
1235
- return initialFocusElement;
1236
- }
1237
- return false;
1238
- });
1239
- });
1240
- }
1241
- }, _root = new WeakMap(), _props = new WeakMap(), _actualFocusQuery = new WeakMap(), _currentInstruction = new WeakMap(), _focusDelay = new WeakMap(), _focusRetries = new WeakMap(), _focusTimeout = new WeakMap(), _isIntervalRunning = new WeakMap(), _focusQuery = new WeakSet(), focusQuery_get = function() {
1242
- return new Proxy(__privateGet(this, _actualFocusQuery), {
1243
- get: (target, key) => {
1244
- if (key in target) {
1245
- const prop = target[key];
1246
- if (isFunction$1(prop))
1247
- return (...props) => {
1248
- const result = target[key].bind(target, ...props)();
1249
- return result;
1250
- };
1251
- return prop;
1252
- }
1253
- return void 0;
1254
- }
1255
- });
1256
- }, _checkInstruction = new WeakSet(), checkInstruction_fn = function(focusCheck) {
1257
- return focusCheck.currentInstruction === __privateGet(this, _currentInstruction);
1258
- }, _doFocus = new WeakSet(), doFocus_fn = function(HTMLElement, focusCheck, isLastTry, configuration) {
1259
- return __async$1(this, null, function* () {
1260
- if (screenLocker.isLocked("common") && !(configuration == null ? void 0 : configuration.focusEvenWhenScreenLocked)) {
1261
- return null;
1262
- }
1263
- const actualHTMLElement = isFunction$1(HTMLElement) ? HTMLElement(isLastTry) : HTMLElement;
1264
- if (actualHTMLElement) {
1265
- if (actualHTMLElement.disabled)
1266
- return false;
1267
- actualHTMLElement.focus();
1268
- return new Promise((resolve) => {
1269
- if ((configuration == null ? void 0 : configuration.dispatchCustomEvent) !== false) {
1270
- const customFocusEvent = new CustomEvent(customEvents.focus, {
1271
- bubbles: true
1272
- });
1273
- actualHTMLElement.dispatchEvent(customFocusEvent);
1274
- }
1275
- setTimeout(() => {
1276
- if (!__privateMethod(this, _checkInstruction, checkInstruction_fn).call(this, focusCheck)) {
1277
- resolve(false);
1278
- return;
1279
- }
1280
- try {
1281
- if (configuration == null ? void 0 : configuration.scrollIntoViewOptions)
1282
- actualHTMLElement == null ? void 0 : actualHTMLElement.scrollIntoView(
1283
- configuration.scrollIntoViewOptions
1284
- );
1285
- } catch (e) {
1286
- console.error(e);
1287
- }
1288
- setTimeout(() => {
1289
- var _a2, _b;
1290
- if (!__privateMethod(this, _checkInstruction, checkInstruction_fn).call(this, focusCheck)) {
1291
- resolve(false);
1292
- } else if (((_a2 = document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME") {
1293
- resolve(
1294
- ((_b = document.activeElement.contentDocument) == null ? void 0 : _b.contains(actualHTMLElement)) ? actualHTMLElement : null
1295
- );
1296
- } else
1297
- resolve(
1298
- document.activeElement === actualHTMLElement ? actualHTMLElement : null
1299
- );
1300
- }, 0);
1301
- }, 0);
1302
- });
1303
- }
1304
- return actualHTMLElement;
1305
- });
1306
- }, _resetInterval = new WeakSet(), resetInterval_fn = function() {
1307
- clearTimeout(__privateGet(this, _focusTimeout));
1308
- __privateSet(this, _focusTimeout, -1);
1309
- __privateSet(this, _isIntervalRunning, false);
1310
- __privateWrapper(this, _currentInstruction)._++;
1311
- }, _runFocusInterval = new WeakSet(), runFocusInterval_fn = function(focusElement, internalCall) {
1312
- return __async$1(this, null, function* () {
1313
- if (!internalCall && (__privateGet(this, _focusTimeout) !== -1 || __privateGet(this, _isIntervalRunning)))
1314
- return false;
1315
- const currentInstruction = {
1316
- currentInstruction: __privateGet(this, _currentInstruction)
1317
- };
1318
- __privateSet(this, _isIntervalRunning, true);
1319
- return new Promise((resolve) => {
1320
- const resolvePromise = () => __async$1(this, null, function* () {
1321
- const element = focusElement != null ? focusElement : __privateGet(this, _focusQuery, focusQuery_get).shift();
1322
- if (element) {
1323
- const hasFocused = yield __privateMethod(this, _doFocus, doFocus_fn).call(this, element.element, currentInstruction, element !== __privateGet(this, _focusQuery, focusQuery_get)[0], element.configuration);
1324
- if (!__privateMethod(this, _checkInstruction, checkInstruction_fn).call(this, currentInstruction)) {
1325
- resolve(false);
1326
- return;
1327
- }
1328
- if (hasFocused !== null && hasFocused !== false) {
1329
- __privateSet(this, _actualFocusQuery, []);
1330
- resolve(hasFocused);
1331
- __privateSet(this, _isIntervalRunning, false);
1332
- return;
1333
- }
1334
- if (hasFocused === false) {
1335
- __privateSet(this, _actualFocusQuery, __privateGet(this, _actualFocusQuery).filter(
1336
- (current) => current !== element
1337
- ));
1338
- }
1339
- }
1340
- if (!__privateMethod(this, _checkInstruction, checkInstruction_fn).call(this, currentInstruction)) {
1341
- resolve(false);
1342
- return;
1343
- }
1344
- if (__privateGet(this, _actualFocusQuery).length > 0) {
1345
- __privateSet(this, _focusTimeout, setTimeout(() => {
1346
- const runInterval = () => __async$1(this, null, function* () {
1347
- const result = yield __privateMethod(this, _runFocusInterval, runFocusInterval_fn).call(this, void 0, true);
1348
- resolve(result);
1349
- __privateSet(this, _isIntervalRunning, true);
1350
- });
1351
- void runInterval();
1352
- }, __privateGet(this, _focusDelay)));
1353
- } else {
1354
- const lastFocused = globalFocus.last(":not(body)");
1355
- if (lastFocused) {
1356
- const result = yield __privateMethod(this, _doFocus, doFocus_fn).call(this, lastFocused, currentInstruction, element !== __privateGet(this, _focusQuery, focusQuery_get)[0], element == null ? void 0 : element.configuration);
1357
- if (!__privateMethod(this, _checkInstruction, checkInstruction_fn).call(this, currentInstruction)) {
1358
- resolve(false);
1359
- return;
1360
- }
1361
- if (result)
1362
- resolve(result);
1363
- else
1364
- resolve(false);
1365
- __privateSet(this, _isIntervalRunning, true);
1366
- }
1367
- resolve(false);
1368
- __privateSet(this, _isIntervalRunning, true);
1369
- }
1370
- });
1371
- void resolvePromise();
1372
- });
1373
- });
1374
- }, _a)(document.getElementById("root"));
1375
-
1376
- function useCombinedRefs(...refs) {
1377
- const [targetRef, setTargetRef] = React.useState();
1378
- React.useEffect(() => {
1379
- refs.forEach((ref) => {
1380
- if (!ref)
1381
- return;
1382
- if (typeof ref === "function") {
1383
- ref(targetRef);
1384
- } else {
1385
- ref.current = targetRef;
1386
- }
1387
- });
1388
- }, [refs, targetRef]);
1389
- return setTargetRef;
1390
- }
1391
-
1392
- const useDebouncedCallback = (callback, { runWhenTriggered, timeout } = { runWhenTriggered: false, timeout: 200 }) => {
1393
- const timeoutRef = useRef(-1);
1394
- return useCallback(
1395
- (...params) => {
1396
- if (runWhenTriggered)
1397
- callback(...params);
1398
- clearTimeout(timeoutRef.current);
1399
- timeoutRef.current = setTimeout(
1400
- () => callback(...params),
1401
- timeout
1402
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1403
- );
1404
- },
1405
- [callback, runWhenTriggered, timeout]
1406
- );
1407
- };
1408
-
1409
- function useLatest(value) {
1410
- const ref = useRef(value);
1411
- ref.current = value;
1412
- return ref;
1413
- }
1414
-
1415
- function useMount(effect) {
1416
- useEffect(effect, []);
1417
- }
1418
-
1419
- function useUnmount(unmountCallback) {
1420
- useEffect(() => {
1421
- return unmountCallback;
1422
- }, []);
1423
- }
1424
-
1425
- function usePrevious(value) {
1426
- const previousValue = useRef(void 0);
1427
- const currentValue = useRef(void 0);
1428
- previousValue.current = currentValue.current;
1429
- currentValue.current = value;
1430
- return previousValue;
1431
- }
1432
-
1433
- function useStateRef(initialState) {
1434
- const [state, setState] = useState(initialState);
1435
- const stateRef = useRef(state);
1436
- stateRef.current = state;
1437
- return [state, setState, stateRef];
1438
- }
1439
-
1440
- function useUpdateEffect(effect, deps) {
1441
- const hasRunnedForFirstTime = useRef(false);
1442
- useEffect(() => {
1443
- if (hasRunnedForFirstTime.current) {
1444
- return effect();
1445
- }
1446
- hasRunnedForFirstTime.current = true;
1447
- return () => {
1448
- };
1449
- }, deps);
1450
- }
1451
-
1452
- const ImperativeComponentContext = createContext(
1453
- {}
1454
- );
1455
-
1456
- var __defProp$3 = Object.defineProperty;
1457
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1458
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1459
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1460
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1461
- var __spreadValues$3 = (a, b) => {
1462
- for (var prop in b || (b = {}))
1463
- if (__hasOwnProp$3.call(b, prop))
1464
- __defNormalProp$3(a, prop, b[prop]);
1465
- if (__getOwnPropSymbols$3)
1466
- for (var prop of __getOwnPropSymbols$3(b)) {
1467
- if (__propIsEnum$3.call(b, prop))
1468
- __defNormalProp$3(a, prop, b[prop]);
1469
- }
1470
- return a;
1471
- };
1472
- var __objRest$1 = (source, exclude) => {
1473
- var target = {};
1474
- for (var prop in source)
1475
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1476
- target[prop] = source[prop];
1477
- if (source != null && __getOwnPropSymbols$3)
1478
- for (var prop of __getOwnPropSymbols$3(source)) {
1479
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1480
- target[prop] = source[prop];
1481
- }
1482
- return target;
1483
- };
1484
- function makeImperativeComponent() {
1485
- return function ImperativeComponent({
1486
- Component,
1487
- initialState,
1488
- methods
1489
- }) {
1490
- const setStates = {};
1491
- const actualMethods = {};
1492
- Object.entries(methods != null ? methods : {}).forEach(([key, method]) => {
1493
- actualMethods[key] = (id, ...args) => {
1494
- if (setStates[id])
1495
- method(setStates[id], ...args);
1496
- else {
1497
- console.warn(`The requested id does not exist: ${id}`);
1498
- }
1499
- };
1500
- });
1501
- const eventsHandlers = {};
1502
- const fireEvent = (id, ev, args) => {
1503
- var _a, _b;
1504
- if (eventsHandlers[id])
1505
- (_b = (_a = eventsHandlers[id]) == null ? void 0 : _a[ev]) == null ? void 0 : _b.forEach((current) => current(args));
1506
- else
1507
- console.warn(`The requested id does not exist: ${id}`);
1508
- };
1509
- const ActualComponent = (_a) => {
1510
- var _b = _a, {
1511
- id
1512
- } = _b, props = __objRest$1(_b, [
1513
- "id"
1514
- ]);
1515
- const [state, innerSetState] = useState(initialState);
1516
- setStates[id] = (newState) => innerSetState((current) => __spreadValues$3(__spreadValues$3({}, current), newState));
1517
- return /* @__PURE__ */ jsx(
1518
- ImperativeComponentContext.Provider,
1519
- {
1520
- value: useMemo(() => ({ id, eventsStore: eventsHandlers }), [id]),
1521
- children: /* @__PURE__ */ jsx(Component, __spreadValues$3(__spreadValues$3({}, props), state))
1522
- }
1523
- );
1524
- };
1525
- return [actualMethods, fireEvent, ActualComponent];
1526
- };
1527
- }
1528
-
1529
- var __defProp$2 = Object.defineProperty;
1530
- var __defProps$2 = Object.defineProperties;
1531
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
1532
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1533
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1534
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1535
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1536
- var __spreadValues$2 = (a, b) => {
1537
- for (var prop in b || (b = {}))
1538
- if (__hasOwnProp$2.call(b, prop))
1539
- __defNormalProp$2(a, prop, b[prop]);
1540
- if (__getOwnPropSymbols$2)
1541
- for (var prop of __getOwnPropSymbols$2(b)) {
1542
- if (__propIsEnum$2.call(b, prop))
1543
- __defNormalProp$2(a, prop, b[prop]);
1544
- }
1545
- return a;
1546
- };
1547
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1548
- function makeSingleImperativeComponent() {
1549
- return function SingleImperativeComponent({
1550
- initialState,
1551
- methods,
1552
- Component
1553
- }) {
1554
- const id = uniqueId();
1555
- const [actualMethods, originalFireEvent, ImperativeComponent] = makeImperativeComponent()({
1556
- initialState,
1557
- methods,
1558
- Component
1559
- });
1560
- const fireEvent = (ev, args) => originalFireEvent(id, ev, args);
1561
- const newMethods = {};
1562
- Object.entries(actualMethods).forEach(([name, method]) => {
1563
- newMethods[name] = (...args) => method(id, ...args);
1564
- });
1565
- return [
1566
- newMethods,
1567
- fireEvent,
1568
- (props) => /* @__PURE__ */ jsx(ImperativeComponent, __spreadProps$2(__spreadValues$2({}, props), { id }))
1569
- ];
1570
- };
1571
- }
1572
-
1573
- function useImperativeComponentContext() {
1574
- const context = useContext(ImperativeComponentContext);
1575
- return context;
1576
- }
1577
-
1578
- const useImperativeComponentEvents = (handlers) => {
1579
- const { id, eventsStore } = useImperativeComponentContext();
1580
- useEffect(() => {
1581
- Object.entries(handlers).forEach(([name, callback]) => {
1582
- var _a;
1583
- if (!eventsStore[id])
1584
- eventsStore[id] = {};
1585
- if (!eventsStore[id][name])
1586
- eventsStore[id][name] = [];
1587
- (_a = eventsStore[id][name]) == null ? void 0 : _a.push(
1588
- callback
1589
- );
1590
- });
1591
- return () => Object.entries(handlers).forEach(([name, callback]) => {
1592
- var _a;
1593
- eventsStore[id][name] = ((_a = eventsStore[id][name]) != null ? _a : []).filter((current) => current !== callback);
1594
- });
1595
- });
1596
- };
1597
-
1598
- const formatMessage = (str, obj) => {
1599
- let newStr = str;
1600
- Object.entries(obj).forEach(([key, value]) => {
1601
- let placeHolder;
1602
- if (value !== "") {
1603
- placeHolder = `<${key}>`;
1604
- } else {
1605
- placeHolder = `"<${key}>"`;
1606
- }
1607
- if (newStr == null ? void 0 : newStr.includes(placeHolder)) {
1608
- newStr = newStr.replace(placeHolder, value || " ");
1609
- }
1610
- });
1611
- return newStr;
1612
- };
1613
-
1614
- function getLabel(name, replaceTokens) {
1615
- var _a;
1616
- const label = (_a = window.labels[name]) != null ? _a : {
1617
- text: `Not preloaded: ${name}`,
1618
- tooltip: `Not preloaded: ${name}`
1619
- };
1620
- if (replaceTokens == null ? void 0 : replaceTokens.text)
1621
- label.text = formatMessage(label.text, replaceTokens.text);
1622
- if (replaceTokens == null ? void 0 : replaceTokens.title)
1623
- label.tooltip = formatMessage(label.tooltip, replaceTokens.title);
1624
- return label;
1625
- }
1626
-
1627
- function getValueByPath(obj, path, separator = ".") {
1628
- const actualPath = typeof path === "string" ? path.split(separator) : path;
1629
- if (typeof obj !== "object" || !obj) {
1630
- if (actualPath.length === 0)
1631
- return obj;
1632
- return void 0;
1633
- }
1634
- const currentStep = actualPath.shift();
1635
- if (actualPath.length === 0)
1636
- return obj[currentStep];
1637
- return getValueByPath(
1638
- obj[currentStep],
1639
- actualPath,
1640
- separator
1641
- );
1642
- }
1643
-
1644
- function setValueByPath(obj, path, value) {
1645
- if (path === "")
1646
- return value;
1647
- const steps = path.split(".");
1648
- if (steps.length === 0) {
1649
- console.warn(`An empty path was provoided ${path}`);
1650
- return null;
1651
- }
1652
- const originalClonedObject = clone(obj != null ? obj : {});
1653
- let currentObj = originalClonedObject;
1654
- for (let i = 0; i < steps.length - 1; i++) {
1655
- if (!currentObj[steps[i]])
1656
- currentObj[steps[i]] = {};
1657
- if (typeof currentObj[steps[i]] === "object") {
1658
- currentObj = currentObj[steps[i]];
1659
- } else {
1660
- console.info({
1661
- originalObject: obj,
1662
- originalPath: path,
1663
- currentObj,
1664
- currentStep: steps[i]
1665
- });
1666
- throw new Error(
1667
- `The provided path ${path} cannot be applied due to it is not an object's path.`
1668
- );
1669
- }
1670
- }
1671
- currentObj[steps.pop()] = value;
1672
- return originalClonedObject;
1673
- }
1674
-
1675
- const PropsSelectorUndefinedObject = {};
1676
- const defaultComparator = (a, b) => {
1677
- return a === b;
1678
- };
1679
- function getDefaultSelector() {
1680
- return (current) => {
1681
- return current;
1682
- };
1683
- }
1684
- function isPropsConfigurationObject(value) {
1685
- return typeof value === "object" && value && ("selector" in value || "comparator" in value || "initialValue" in value);
1686
- }
1687
- function usePropsSelector(fieldId, par1, par2, par3) {
1688
- var _a;
1689
- const selector = React__default.useMemo(
1690
- () => {
1691
- return isPropsConfigurationObject(par1) ? par1.selector : par1;
1692
- },
1693
- // eslint-disable-next-line react-hooks/exhaustive-deps
1694
- []
1695
- );
1696
- const comparator = React__default.useMemo(
1697
- () => {
1698
- return isPropsConfigurationObject(par1) ? par1.comparator : par2;
1699
- },
1700
- // eslint-disable-next-line react-hooks/exhaustive-deps
1701
- []
1702
- );
1703
- const initialValue = React__default.useMemo(
1704
- () => {
1705
- return isPropsConfigurationObject(par1) ? par1.initialValue : void 0;
1706
- },
1707
- // eslint-disable-next-line react-hooks/exhaustive-deps
1708
- []
1709
- );
1710
- const actualPropsStore = React__default.useMemo(
1711
- () => {
1712
- var _a2;
1713
- return (_a2 = par3 != null ? par3 : isPropsConfigurationObject(par1) ? par1.propsStore : propsStore) != null ? _a2 : propsStore;
1714
- },
1715
- // eslint-disable-next-line react-hooks/exhaustive-deps
1716
- [
1717
- // eslint-disable-next-line react-hooks/exhaustive-deps
1718
- (_a = par3 != null ? par3 : isPropsConfigurationObject(par1) ? par1.propsStore : propsStore) != null ? _a : propsStore
1719
- ]
1720
- );
1721
- const getCurrentProps = React__default.useCallback(() => {
1722
- const currentProps = actualPropsStore.getFieldProps(fieldId);
1723
- const willSetInitialValue = currentProps !== void 0 && initialValue !== void 0;
1724
- if (willSetInitialValue) {
1725
- actualPropsStore.updateField(
1726
- fieldId,
1727
- initialValue
1728
- );
1729
- }
1730
- return (selector != null ? selector : getDefaultSelector())(
1731
- currentProps != null ? currentProps : PropsSelectorUndefinedObject
1732
- );
1733
- }, []);
1734
- const [props, setProps] = React__default.useState(getCurrentProps);
1735
- const prevProps = useRef(props);
1736
- const prevFieldId = useRef(fieldId);
1737
- React__default.useEffect(() => {
1738
- const unsuscribe = actualPropsStore.suscribe(
1739
- fieldId,
1740
- (newProps, isUrgent) => {
1741
- const newSelectedProps = (selector != null ? selector : getDefaultSelector())(
1742
- newProps
1743
- );
1744
- if (!(comparator != null ? comparator : defaultComparator)(
1745
- prevProps.current,
1746
- newSelectedProps
1747
- ) || prevFieldId.current !== fieldId) {
1748
- if (isUrgent)
1749
- setProps(newSelectedProps);
1750
- else
1751
- React__default.startTransition(() => {
1752
- setProps(newSelectedProps);
1753
- });
1754
- }
1755
- prevProps.current = newSelectedProps;
1756
- }
1757
- );
1758
- return () => {
1759
- unsuscribe();
1760
- };
1761
- }, [fieldId, actualPropsStore]);
1762
- return props;
1763
- }
1764
-
1765
- var __defProp$1 = Object.defineProperty;
1766
- var __defProps$1 = Object.defineProperties;
1767
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
1768
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
1769
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
1770
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
1771
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1772
- var __spreadValues$1 = (a, b) => {
1773
- for (var prop in b || (b = {}))
1774
- if (__hasOwnProp$1.call(b, prop))
1775
- __defNormalProp$1(a, prop, b[prop]);
1776
- if (__getOwnPropSymbols$1)
1777
- for (var prop of __getOwnPropSymbols$1(b)) {
1778
- if (__propIsEnum$1.call(b, prop))
1779
- __defNormalProp$1(a, prop, b[prop]);
1780
- }
1781
- return a;
1782
- };
1783
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1784
- const propsLog = "propsLog";
1785
- class PropsStore {
1786
- constructor(configuration) {
1787
- this.configuration = configuration;
1788
- this.log = persistentStorage$1[propsLog];
1789
- this.fields = {};
1790
- this.suscriptors = {};
1791
- this.loggers = {
1792
- propsLog: ([log]) => {
1793
- this.log = log;
1794
- persistentStorage$1[propsLog] = log;
1795
- },
1796
- propsStore: ([fieldId]) => {
1797
- if (fieldId)
1798
- console.info(this.fields[fieldId]);
1799
- else
1800
- console.info(this.fields);
1801
- },
1802
- propsSuscriptors: ([fieldId]) => {
1803
- if (fieldId)
1804
- console.info(this.suscriptors[fieldId]);
1805
- else
1806
- console.info(this.suscriptors);
1807
- },
1808
- updateProp: ([fieldId, newProps]) => {
1809
- this.updateField(fieldId, newProps);
1810
- }
1811
- };
1812
- if (this.configuration) {
1813
- if (this.configuration.logCommands.propsStore)
1814
- debugDispatcher$1.on(
1815
- this.configuration.logCommands.propsStore,
1816
- this.loggers.propsStore,
1817
- "Muestra el contenido actual del propsStore"
1818
- );
1819
- if (this.configuration.logCommands.updateProp)
1820
- debugDispatcher$1.on(
1821
- this.configuration.logCommands.updateProp,
1822
- this.loggers.updateProp,
1823
- "dd.updateProp(fieldId, newProps). El objeto newProps ser\xE1 mergeado sobre las props actuales"
1824
- );
1825
- if (this.configuration.logCommands.propsSuscriptors)
1826
- debugDispatcher$1.on(
1827
- this.configuration.logCommands.propsSuscriptors,
1828
- this.loggers.propsSuscriptors,
1829
- "Muestra los suscriptores actuales del propsStore"
1830
- );
1831
- if (this.configuration.logCommands.propsLog)
1832
- debugDispatcher$1.on(
1833
- this.configuration.logCommands.propsLog,
1834
- this.loggers.propsLog,
1835
- "Si se pasa como true, hace log de las acciones. Si se pasa como trace(fieldId), se hace log de todas las acciones y trace del campo especificado. Si se pasa trace(), hace log y trace de todas las acciones."
1836
- );
1837
- }
1838
- }
1839
- destructor() {
1840
- if (this.configuration) {
1841
- if (this.configuration.logCommands.propsStore)
1842
- debugDispatcher$1.off(
1843
- this.configuration.logCommands.propsStore,
1844
- this.loggers.propsStore
1845
- );
1846
- if (this.configuration.logCommands.updateProp)
1847
- debugDispatcher$1.off(
1848
- this.configuration.logCommands.updateProp,
1849
- this.loggers.updateProp
1850
- );
1851
- if (this.configuration.logCommands.propsSuscriptors)
1852
- debugDispatcher$1.off(
1853
- this.configuration.logCommands.propsSuscriptors,
1854
- this.loggers.propsSuscriptors
1855
- );
1856
- if (this.configuration.logCommands.propsLog)
1857
- debugDispatcher$1.off(
1858
- this.configuration.logCommands.propsLog,
1859
- this.loggers.propsLog
1860
- );
1861
- }
1862
- }
1863
- getAllFields() {
1864
- return cloneDeep(this.fields);
1865
- }
1866
- /**
1867
- * Devuelve los props actuales de un campo.
1868
- */
1869
- getFieldProps(fieldId) {
1870
- return this.fields[fieldId];
1871
- }
1872
- removeField(fieldId) {
1873
- this.suscriptors[fieldId] = [];
1874
- delete this.fields[fieldId];
1875
- if (this.log)
1876
- console.info(`propsStore: removeNode ${fieldId}`);
1877
- }
1878
- /**
1879
- * Permite establecer un suscriptor que será llamado
1880
- * cada vez que las props del campo especificado cambien.
1881
- */
1882
- suscribe(fieldId, callback) {
1883
- var _a;
1884
- if (!this.suscriptors[fieldId])
1885
- this.suscriptors[fieldId] = [];
1886
- this.suscriptors[fieldId].push(callback);
1887
- callback((_a = this.fields[fieldId]) != null ? _a : PropsSelectorUndefinedObject);
1888
- return () => {
1889
- this.suscriptors[fieldId] = this.suscriptors[fieldId].filter(
1890
- (current) => {
1891
- return current !== callback;
1892
- }
1893
- );
1894
- };
1895
- }
1896
- /**
1897
- * Actualiza o crea las props de un campo.
1898
- *
1899
- * La tercera prop está relacionada
1900
- */
1901
- updateField(fieldId, props, conf) {
1902
- var _a, _b, _c;
1903
- if (fieldId === void 0)
1904
- return;
1905
- const { noEmit, isUrgent } = conf != null ? conf : {};
1906
- const newProps = __spreadValues$1(__spreadValues$1({}, this.fields[fieldId]), props);
1907
- this.fields[fieldId] = newProps;
1908
- if (this.log === true || this.log === fieldId)
1909
- console.info({ fieldId, props });
1910
- if (this.log === "trace")
1911
- console.trace();
1912
- else {
1913
- const logId = typeof this.log === "string" && ((_a = this.log.match(/trace\(([^)]+)\)/)) != null ? _a : [])[1];
1914
- if (fieldId === logId)
1915
- console.trace();
1916
- }
1917
- if (!noEmit) {
1918
- (_b = this.suscriptors[fieldId]) == null ? void 0 : _b.forEach((current) => {
1919
- return current(newProps, isUrgent);
1920
- });
1921
- (_c = this.suscriptors.any) == null ? void 0 : _c.forEach((current) => {
1922
- return current(__spreadProps$1(__spreadValues$1({}, newProps), { fieldId }), isUrgent);
1923
- });
1924
- }
1925
- }
1926
- }
1927
- const propsStore = new PropsStore({
1928
- logCommands: {
1929
- propsLog: "propsLog",
1930
- propsStore: "propsStore",
1931
- propsSuscriptors: "propsSuscriptors",
1932
- updateProp: "updateProp"
1933
- }
1934
- });
1935
-
1936
- var __defProp = Object.defineProperty;
1937
- var __defProps = Object.defineProperties;
1938
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1939
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1940
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1941
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
1942
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1943
- var __spreadValues = (a, b) => {
1944
- for (var prop in b || (b = {}))
1945
- if (__hasOwnProp.call(b, prop))
1946
- __defNormalProp(a, prop, b[prop]);
1947
- if (__getOwnPropSymbols)
1948
- for (var prop of __getOwnPropSymbols(b)) {
1949
- if (__propIsEnum.call(b, prop))
1950
- __defNormalProp(a, prop, b[prop]);
1951
- }
1952
- return a;
1953
- };
1954
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1955
- var __objRest = (source, exclude) => {
1956
- var target = {};
1957
- for (var prop in source)
1958
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
1959
- target[prop] = source[prop];
1960
- if (source != null && __getOwnPropSymbols)
1961
- for (var prop of __getOwnPropSymbols(source)) {
1962
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
1963
- target[prop] = source[prop];
1964
- }
1965
- return target;
1966
- };
1967
- function assignProps(el, _a) {
1968
- var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
1969
- if (style) {
1970
- Object.entries(style).forEach(([name, value]) => {
1971
- el.style[name] = value;
1972
- });
1973
- }
1974
- Object.assign(el, props);
1975
- }
1976
- function useDomState(initialDomProps) {
1977
- const domProps = React__default.useRef(__spreadProps(__spreadValues({}, initialDomProps != null ? initialDomProps : {}), {
1978
- ref: React__default.useCallback((el) => {
1979
- ref.current = el;
1980
- assignProps(ref.current, domProps.current);
1981
- }, [])
1982
- }));
1983
- const ref = React__default.useRef(null);
1984
- return {
1985
- domProps: domProps.current,
1986
- setDomProps: React__default.useCallback((_a) => {
1987
- var _b = _a, { style } = _b, newDomProps = __objRest(_b, ["style"]);
1988
- if (style) {
1989
- const newStyles = __spreadValues(__spreadValues({}, domProps.current.style), style);
1990
- domProps.current.style = newStyles;
1991
- }
1992
- Object.assign(domProps.current, newDomProps);
1993
- if (ref.current)
1994
- assignProps(ref.current, domProps.current);
1995
- }, [])
1996
- };
1997
- }
1998
-
1999
- function useDebouncedState(timeout, initialState) {
2000
- const [state, innerSetState] = useState(initialState);
2001
- const t = useRef(-1);
2002
- const setState = useCallback(
2003
- (newState, immediate) => {
2004
- clearTimeout(t.current);
2005
- if (immediate)
2006
- innerSetState(newState);
2007
- else
2008
- t.current = setTimeout(() => {
2009
- innerSetState(newState);
2010
- }, timeout);
2011
- },
2012
- [timeout]
2013
- );
2014
- return [state, setState];
2015
- }
2016
-
2017
- function ucfirst(word) {
2018
- return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
2019
- }
2020
-
2021
- function toBoolean(value) {
2022
- if (typeof value === "string") {
2023
- return !["false", ""].includes(value.toLowerCase());
2024
- }
2025
- if (Array.isArray(value))
2026
- return value.length > 0;
2027
- return !!value;
2028
- }
2029
-
2030
- var __async = (__this, __arguments, generator) => {
2031
- return new Promise((resolve, reject) => {
2032
- var fulfilled = (value) => {
2033
- try {
2034
- step(generator.next(value));
2035
- } catch (e) {
2036
- reject(e);
2037
- }
2038
- };
2039
- var rejected = (value) => {
2040
- try {
2041
- step(generator.throw(value));
2042
- } catch (e) {
2043
- reject(e);
2044
- }
2045
- };
2046
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
2047
- step((generator = generator.apply(__this, __arguments)).next());
2048
- });
2049
- };
2050
- const processAjaxEventTagNames = (name) => {
2051
- return name;
2052
- };
2053
- const processAjaxEventAttrNames = (name) => {
2054
- return name;
2055
- };
2056
- const processAjaxEventResponse = (value, name) => {
2057
- if (name === "v" && value === "T")
2058
- return true;
2059
- if (name === "v" && value === "F")
2060
- return false;
2061
- return value;
2062
- };
2063
- const processStringObj = (value, key) => {
2064
- if (key === "value" && typeof value === "number" && Number.isNaN(value)) {
2065
- return "";
2066
- }
2067
- if (key === "valueType" && typeof value === "string" && value === "null") {
2068
- return "";
2069
- }
2070
- if ((key === "cols" || key === "rows" || key === "x" || key === "y" || key === "length") && typeof value === "string") {
2071
- return parseNumbers(value);
2072
- }
2073
- return value;
2074
- };
2075
- const parseXmlAsync = (xml) => __async(void 0, null, function* () {
2076
- const parser = new xml2js.Parser({
2077
- trim: true,
2078
- normalize: true,
2079
- explicitRoot: false,
2080
- mergeAttrs: true,
2081
- explicitArray: false,
2082
- charkey: "content",
2083
- attrValueProcessors: [
2084
- parseBooleans,
2085
- processStringObj,
2086
- processAjaxEventResponse
2087
- ],
2088
- tagNameProcessors: [processAjaxEventTagNames],
2089
- attrNameProcessors: [processAjaxEventAttrNames]
2090
- });
2091
- const result = yield new Promise((resolve, reject) => {
2092
- parser.parseString(xml, (err, innerResult) => {
2093
- if (err)
2094
- reject(err);
2095
- else {
2096
- resolve(innerResult);
2097
- }
2098
- });
2099
- });
2100
- return result;
2101
- });
2102
-
2103
- export { AriaLiveEmitter, EventEmitter, LiveRegion, PropsSelectorUndefinedObject, PropsStore, Url, WithEventsValue, addBoundary, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, customEvents, dateToApiaFormat, debugDispatcher, decrypt, disableChildrenFocus, downloadUrl, enableChildrenFocus, enableDebugDispatcher, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, getDateFormat, getFocusSelector, getIndex, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, makeImperativeComponent, makeSingleImperativeComponent, noNaN, notificationsSelector, parseAsSize, parseXmlAsync, persistentStorage, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useLatest, useLocalStorage, useMount, usePanAndZoom, usePrevious, usePropsSelector, useStateRef, useUnmount, useUpdateEffect };
2104
- //# sourceMappingURL=index.js.map
1
+ import{isFunction as Ot,uniqueId as Tt,clone as Pt,cloneDeep as Ct}from"lodash";import E from"crypto-js";import pe from"dayjs";import xt from"dayjs/plugin/customParseFormat";import jt from"axios";import Mt from"file-saver";import*as De from"react";import p,{useRef as $,useState as q,useEffect as F,useMemo as Q,useCallback as me,createContext as At,useContext as Ft}from"react";import{jsx as ee}from"react/jsx-runtime";import{Box as Lt}from"theme-ui";import{isFunction as ve,uniqueId as It}from"lodash-es";import Nt from"xml2js";import{parseBooleans as Dt,parseNumbers as Kt}from"xml2js/lib/processors";function Ke(e,t,r,o){const n=typeof e=="number"?e:e.number,i=typeof e=="number"?t:e.min,s=typeof e=="number"?r:e.max,l=typeof e=="number"?o:e.loop;let a=Number(n??0);return i!==void 0&&a<i&&(s!==void 0&&l?a=s:a=i),s!==void 0&&a>s&&(i!==void 0&&l?a=i:a=s),a}const Rt=["b","kb","mb","gb","tb"];function Wt(e){let t=0,r=e;if(r===1/0)return"1000GB";for(;r>1024;)r/=1024,t++;return`${Math.round(r*10)/10}${Rt[t]}`}function Re(e,t=0){const r=Number(e);return e===null||Number.isNaN(r)?t:r}function Yt(e,t,r){let o,n;function i(s){o===void 0&&(o=s);const l=(s-o)/e;t(Ke(l,0,1)),l<1?n=window.requestAnimationFrame(i):r?.()}return n=window.requestAnimationFrame(i),()=>{window.cancelAnimationFrame(n)}}function We(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function Bt(e,t,r){for(let o=0;o<t.length;o++)if(typeof t[o]=="boolean"&&t[o]||Ot(t[o])&&t[o]())return e[o];return e[r??-1]}const Ye=(e,t,r,o)=>E.PBKDF2(t,E.enc.Hex.parse(e),{keySize:r/32,iterations:o}),qt=(e,t,r,o,n,i)=>{const s=Ye(e,r,n,i),l=E.lib.CipherParams.create({ciphertext:E.enc.Base64.parse(o)});return E.AES.decrypt(l,s,{iv:E.enc.Hex.parse(t)}).toString(E.enc.Utf8)},Ht=(e,t,r,o,n,i)=>{const s=Ye(e,r,n,i);return E.AES.encrypt(o,s,{iv:E.enc.Hex.parse(t)}).ciphertext.toString(E.enc.Base64)};pe.extend(xt);const Vt="DD/MM/YYYY",ge=()=>{switch(window.DATE_FORMAT){case"m/d/Y":return"MM/DD/YYYY";case"d/m/Y":return Vt;case"Y/m/d":return"YYYY/MM/DD";default:return"DD/MM/YYYY"}};function _t(e){const t=pe(e,ge());return t.isValid()?t.format("YYYY-MM-DD"):""}function Ut(e){return pe(e).format(ge())}let ye=!0;function Be(){return ye}function Jt(){ye=!0}const v=new class{constructor(){this.callbacks={},this.actions={shout:()=>{console.log(Object.keys(this.callbacks))}},this.emit=(e,...t)=>{var r,o,n,i;if(this.actions[e])this.actions[e]();else{if(((r=this.callbacks[e])!=null?r:[]).length===1)return(n=(o=this.callbacks[e])==null?void 0:o[0])==null?void 0:n.call(o,t);((i=this.callbacks[e])!=null?i:[]).forEach(s=>s(t))}return null}}on(e,t,r,o=!1){if(!ye&&o)return()=>{};if(Object.keys(this.actions).includes(e))throw new Error(`The action ${e} is a reserved word for the dispatcher.`);this.callbacks[e]||(this.callbacks[e]=[]);const n=Object.assign(t,{help:()=>{typeof r=="string"&&console.info(r)}});return this.callbacks[e].push(n),this[e]=Object.assign((...i)=>{this.emit(e,...i)},{help:()=>{typeof r=="string"&&console.info(r)}}),()=>{this.off(e,t)}}off(e,t){this.callbacks[e]=this.callbacks[e].filter(r=>r!==t)}};window.dd=v,window.adt=v;const Xt=new class{constructor(){this.history=[],this.candidates=[],this.shortcuts={callbacks:[],children:[],key:{key:""}},this.shortcutsStrings=[],this.categories={dev:["shift&D"]},document.addEventListener("keydown",e=>{var t;((t=e.key)==null?void 0:t.length)!==1&&e.key!=="Escape"||(this.candidates=[...this.candidates.reduce((r,o)=>[...r,...o.children.filter(n=>n.key.key===e.key&&n.key.altKey===e.altKey&&n.key.ctrlKey===e.ctrlKey&&n.key.shiftKey===e.shiftKey)],[]),...this.shortcuts.children.filter(r=>r.key.key===e.key&&r.key.altKey===e.altKey&&r.key.ctrlKey===e.ctrlKey&&r.key.shiftKey===e.shiftKey)],this.candidates.forEach(r=>{var o;(r.fireEvenFromInputs||!(!e.key||e.key.length>1||["input","textarea","select"].includes((o=e.target.tagName)==null?void 0:o.toLowerCase())))&&r.callbacks&&r.callbacks.forEach(n=>n(e))}))}),v.on("shortcuts",()=>{console.info(this.shortcutsStrings),console.info(this.shortcuts,this.history)},"Muestra los shortcuts registrados"),this.on("short".split(""),()=>{this.shortcutsStrings.forEach(e=>console.info(e))},"dev")}parseKeyToString(e){return typeof e=="string"?e:`${e.altKey?"alt&":""}${e.ctrlKey?"ctrl&":""}${e.shiftKey?"shift&":""}${e.key}`}parseKey(e){const t=e.split("&"),r=t.includes("alt"),o=t.includes("ctrl"),n=t.includes("shift"),i=t.find(s=>s!=="shift"&&s!=="alt"&&s!=="ctrl");if(!i)throw new Error(`parseKey "${e}" does not have key.`);return{key:i,altKey:r,ctrlKey:o,shiftKey:n}}on(e,t,r,o){if(r==="dev"&&Be())return;let n=this.shortcuts;const i=r?[...this.categories[r],...e]:e;if(this.shortcutsStrings.includes(i.map(s=>this.parseKeyToString(s)).join(""))){console.warn(`The shortcut ${i.map(s=>this.parseKeyToString(s)).join("")} is being setted twice. The controller wont register more than one instance but this could be a hint if some unexpected behavior.`);return}for(const s of i){const l=typeof s=="string"?this.parseKey(s):s;if(l.key==="")throw new Error("Empty key ('') is not allowed");const a=n.children.find(c=>c.key.key===l.key||c.key.key===""&&c.key.altKey===l.altKey&&c.key.ctrlKey===l.ctrlKey&&c.key.shiftKey===l.shiftKey&&c.fireEvenFromInputs===o);if(a)n=a;else{const c={callbacks:[],children:[],key:l,fireEvenFromInputs:o};n.children.push(c),n=c}}this.shortcutsStrings.push(i.map(s=>this.parseKeyToString(s)).join("")),n.callbacks.push(t)}};function zt(e,t,r){var o;let n=-1,i=!1;function s(){i&&(i=!1,a.disconnect(),clearTimeout(n))}let l;const a=new MutationObserver((...c)=>{var u,h;(u=c[0])!=null&&u[0]&&(c[0][0].removedNodes||c[0][0].addedNodes)&&(clearTimeout(l),l=setTimeout(t,100),clearTimeout(n),n=setTimeout(s,(h=r?.timeout)!=null?h:100))});return i=!0,a.observe(e,{subtree:!0,childList:!0}),n=setTimeout(s,(o=r?.timeout)!=null?o:100),r?.runCallbackOnInit!==!1&&(l=setTimeout(t,100)),s}var Gt=(e,t,r)=>new Promise((o,n)=>{var i=a=>{try{l(r.next(a))}catch(c){n(c)}},s=a=>{try{l(r.throw(a))}catch(c){n(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(e,t)).next())});function Zt(e){var t,r,o,n;return(n=(o=(r=(t=e.headers["content-disposition"])==null?void 0:t.match)==null?void 0:r.call(t,/filename=(?:\\?")?([\w,\s-() ]+(?:\.[A-Za-z]+)?)(?:\\?")?;?/))==null?void 0:o[1])!=null?n:"noFileName"}function Qt(e){return Gt(this,arguments,function*(t,r=Zt){const o=yield jt.get(t,{responseType:"blob"}),n=typeof r=="string"?r:r(o);Mt.saveAs(new Blob([o.data]),n)})}const er=/^(visible|hidden)/;function te(e){return!(e instanceof HTMLElement)||typeof window.getComputedStyle!="function"?null:e.scrollHeight>=e.clientHeight&&!er.test(window.getComputedStyle(e).overflowY||"visible")?e:te(e.parentElement)||document.body}function qe(e,t="Top"){const r=te(e);let o=e,n=0,i=o;for(;o&&o!==r&&o!==document.body&&i!==r;)i!==o.offsetParent&&(n+=o[`offset${t}`],i=o.offsetParent),o=o.parentElement;return n}const He={};function Ve(e,t=0,r=2,o=100,n=void 0){var i;n&&clearTimeout(He[n]);const s=te(e),l=qe(e);s&&(s.scrollTop+t>l||((i=s?.clientHeight)!=null?i:1/0)-t<e.getBoundingClientRect().height)?s.scrollTop=l-t:s&&s.scrollTop+s.clientHeight<l+e.getBoundingClientRect().height&&(s.scrollTop=l),r>0&&(He[n??"noId"]=setTimeout(()=>Ve(e,t,r-1,o),o))}function tr(e={left:0,bottom:0,right:0,top:0},t=!0){const r=$(null),o=$(null),[n,i]=p.useState(!1),[s,l]=p.useState({x:0,y:0});return p.useEffect(()=>{if(t)return;const a=r.current,c=o.current,u=f=>{f.preventDefault(),i(!0),l({x:f.clientX,y:f.clientY})},h=f=>{f.preventDefault(),i(!1)},w=f=>{if(!(!c||!a)&&n){f.preventDefault(),f.stopPropagation();const m=f.clientX-s.x,O=f.clientY-s.y;a.scrollLeft-=m,a.scrollTop-=O,l({x:f.clientX,y:f.clientY})}};if(a)return a.addEventListener("mousedown",u),a.addEventListener("mouseup",h),a.addEventListener("mouseleave",h),a.addEventListener("mousemove",w),()=>{a.removeEventListener("mousedown",u),a.removeEventListener("mousemove",w),a.removeEventListener("mouseup",h),a.removeEventListener("mouseleave",h)}},[n,s]),p.useEffect(()=>{if(t)return;const a=r.current,c=o.current;let u=1;const h=w=>{w.preventDefault();const f=w.deltaY,m=.1;if(f<0){if(u+m>=2)return;u+=m}else{if(u-m<=.9)return;u-=m}if(!c||!a)return;const O=a.getBoundingClientRect(),de=w.clientX-O.left-e.left,A=w.clientY-O.top-e.top,Ie=de-O.width/2,Ne=A-O.height/2;r.current&&(r.current.style.overflow="hidden"),c.style.transform=`scale(${u})`,c.style.transformOrigin="0px 0px",f<0?(a.scrollLeft+=Ie/(u*2),a.scrollTop+=Ne/(u*2)):(a.scrollLeft-=Ie/(u*2),a.scrollTop-=Ne/(u*2))};if(a)return a.addEventListener("wheel",h),()=>{a.removeEventListener("wheel",h)}},[]),{boxRef:r,elementRef:o}}var rr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},re=(e,t,r)=>(rr(e,t,"read from private field"),r?r.call(e):t.get(e)),or=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},L;function nr(){const e={};return{on(t,r){var o;return Array.isArray(e[t])||(e[t]=[]),(o=e[t])==null||o.push(r),()=>{this.off(t,r)}},off(t,r){var o;e[t]=((o=e[t])!=null?o:[]).filter(n=>n!==r)},emit(t,r){var o;((o=e[t])!=null?o:[]).forEach(n=>n(r))}}}class H{constructor(){or(this,L,nr())}on(t,r){return re(this,L).on(t,r),()=>{re(this,L).off(t,r)}}off(t,r){re(this,L).off(t,r)}emit(t,r){re(this,L).emit(t,r)}}L=new WeakMap;var _e=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},sr=(e,t,r)=>(_e(e,t,"read from private field"),r?r.call(e):t.get(e)),ir=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ue=(e,t,r,o)=>(_e(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),V;class ar extends H{constructor(t){super(),ir(this,V,void 0),Ue(this,V,t)}get value(){return sr(this,V)}set value(t){Ue(this,V,t),this.emit("update",t)}}V=new WeakMap;const Je=new class extends H{},lr=()=>{const[e,t]=q({type:"assertive",message:""});return F(()=>Je.on("live",r=>{if(r.type==="reset"){t({type:"assertive",message:""});return}r.message!==e.message&&setTimeout(()=>t(r),0)}),[e.message]),ee(Lt,{role:"region",sx:{transform:"translate(-50000px, -50000px)"},"aria-live":e.type,children:e.message})},Xe={focus:"customFocus",iframeModalChangeTitle:"iframeModalChangeTitle",iframeModalClose:"iframeModalClose",iframeModalNotify:"iframeModalNotify",modalClose:"modalClose",hidePanel:"hidePanel",showPanel:"showPanel"},ze=["[disabled]",'[tabIndex="-1"]','[aria-hidden="true"]',"[readonly]","[data-focus-guard]",".modal__closeButton"].map(e=>`:not(${e})`).join(""),be=["input","textarea","select","a","button:not(.toggleAccordionElement)","[contenteditable]","[tabIndex]",'[role="button"]'].map(e=>`${e}${ze}`).join(",");function cr(e){return`input${e??""},
2
+ textarea${e??""},
3
+ select${e??""},
4
+ a${e??""},
5
+ button:not(.toggleAccordionElement)${e??""},
6
+ [contenteditable]${e??""},
7
+ [tabIndex]${e??""}`}function Ge(e,t){let r=e;for(;e!==document.documentElement&&r;){const o=t(r);if(o===null)return null;if(o)return r;const n=r.parentElement;if(n)r=n;else return null}return null}function ur(e,t){return!!Ge(e,t)}var hr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},I=(e,t,r)=>(hr(e,t,"read from private field"),r?r.call(e):t.get(e)),fr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},T;class dr{constructor(t,r=!0){this.defaultAllowMultiple=r,fr(this,T,{});const[o,n]=t.split("?");this.base=o,n?.split("&").forEach(i=>{const[s,...l]=i.split("=");this.addParameter(s,l.join("="))})}addParameter(t,r,o){o===void 0&&!this.defaultAllowMultiple||o===!1?I(this,T)[t]=String(r):I(this,T)[t]=I(this,T)[t]?[...We(I(this,T)[t]),String(r)]:[String(r)]}addParameters(t){t.forEach(r=>this.addParameter(r.name,r.value,r.allowMultiple))}getParameter(t){return I(this,T)[t]}toString(){const t=Object.entries(I(this,T));return`${this.base}${t.length>0?`?${t.map(([r,o])=>Array.isArray(o)?o.map(n=>`${r}=${n}`).join("&"):`${r}=${String(o)}`).join("&")}`:""}`}}T=new WeakMap;const oe="data-previous-tabindex";function pr(e){e.querySelectorAll(be).forEach(t=>{var r;t.setAttribute(oe,(r=t.getAttribute("tabindex"))!=null?r:""),t.setAttribute("tabindex","-1")})}function mr(e){e.querySelectorAll(`[${oe}]`).forEach(t=>{var r;t.setAttribute("tabindex",(r=t.getAttribute(oe))!=null?r:"0"),t.removeAttribute(oe)})}var Ze=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},we=(e,t,r)=>(Ze(e,t,"read from private field"),r?r.call(e):t.get(e)),vr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},gr=(e,t,r,o)=>(Ze(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),N,Qe;const et=50,_=new(Qe=class{constructor(){this.focused=[],vr(this,N,[]),v.on("focusHistory",()=>{console.info(this.focused)},"Muestra el historial de elementos que recibieron foco.")}offFocus(e){gr(this,N,we(this,N).filter(t=>t!==e))}onFocus(e){return we(this,N).push(e),()=>{this.offFocus(e)}}inDocument(e){return e instanceof Function||e instanceof HTMLElement&&e.offsetParent!==null}set focus(e){this.focused=this.focused.filter(t=>this.inDocument(t)&&e!==t),this.focused.unshift(e),this.focused.length>et&&(this.focused=this.focused.splice(0,et)),we(this,N).forEach(t=>t())}get list(){return[...this.focused]}last(e,t=0){if(e)for(let r=t;r<=this.focused.length;r++){const o=this.focused[r],n=o?.id!==void 0?o:ve(o)?o(!1):null;if(n&&this.inDocument(n)&&n.matches&&n.matches(e))return n}else return this.focused[this.focused.length-1];return null}},N=new WeakMap,Qe);var $e=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},g=(e,t,r)=>($e(e,t,"read from private field"),r?r.call(e):t.get(e)),U=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Se=(e,t,r,o)=>($e(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),ne=(e,t,r)=>($e(e,t,"access private method"),r),x,Ee,P,D,K,J,tt;const ke=new(tt=class extends H{constructor(){super(),U(this,K),U(this,x,!1),U(this,Ee,!1),U(this,P,!1),U(this,D,{common:!1}),this.emit("ready")}get hasReleasedFirstTime(){return g(this,x)}get isForced(){return g(this,P)}isLocked(e="common"){return g(this,D)[e]||g(this,P)}lock(e="common"){g(this,D)[e]=!0,ne(this,K,J).call(this,e)}unlock(e="common"){e==="common"&&Se(this,x,!0),g(this,D)[e]=!1,ne(this,K,J).call(this,e)}force(){Se(this,P,!0),ne(this,K,J).call(this)}releaseForced(){Se(this,P,!1),ne(this,K,J).call(this)}},x=new WeakMap,Ee=new WeakMap,P=new WeakMap,D=new WeakMap,K=new WeakSet,J=function(e){g(this,P)||e===void 0?this.emit("forcedStateChange",{isForced:g(this,P),hasReleasedFirstTime:g(this,x)}):(e==="common"&&!g(this,Ee)&&g(this,x)&&this.emit("releaseForFirstTime"),this.emit("lockStateChange",{lockName:e,hasReleasedFirstTime:g(this,x),isLocked:g(this,D)[e]}))},tt),C=new Proxy({remove(e){localStorage.removeItem(e)}},{get(e,t){try{const r=localStorage.getItem(String(t));return r?JSON.parse(r):void 0}catch{return}},set(e,t,r){return localStorage.setItem(String(t),JSON.stringify(r)),!0}});window.persistentStorage=C;const rt=new class extends H{};function yr(e,t){const r=Q(()=>e,[]),o=Q(()=>localStorage.getItem(r),[]),[n,i]=q(o?JSON.parse(o):t);return F(()=>(i(JSON.parse(o)),rt.on("update",s=>{s.prop===r&&(i(s.value),localStorage.setItem(r,JSON.stringify(s.value)))})),[]),[n,me(s=>{rt.emit("update",{prop:r,value:s})},[r])]}var Oe=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},d=(e,t,r)=>(Oe(e,t,"read from private field"),r?r.call(e):t.get(e)),y=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},b=(e,t,r,o)=>(Oe(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),br=(e,t,r,o)=>({set _(n){b(e,t,n,r)},get _(){return d(e,t,o)}}),S=(e,t,r)=>(Oe(e,t,"access private method"),r),X=(e,t,r)=>new Promise((o,n)=>{var i=a=>{try{l(r.next(a))}catch(c){n(c)}},s=a=>{try{l(r.throw(a))}catch(c){n(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(e,t)).next())}),se,ie,j,z,Te,Pe,R,k,W,G,M,Y,ae,Ce,le,xe,ce,je,ot;const wr=".notification",$r=new(ot=class{constructor(e,t){y(this,W),y(this,M),y(this,ae),y(this,le),y(this,ce),y(this,se,void 0),y(this,ie,void 0),this.afterNotificationFocus=void 0,y(this,j,[]),y(this,z,0),y(this,Te,300),y(this,Pe,3),y(this,R,-1),y(this,k,!1),this.focusOnReload=null,b(this,se,e),b(this,ie,t),window.focusStatus={},_.onFocus(()=>{S(this,le,xe).call(this)})}afterNotifications(e,t){e&&this.on(e,t)}afterReload({className:e,id:t,name:r,selector:o}){C.focusOnReload=[t?`#${t}`:void 0,r?`[name="${r}"]`:void 0,e?`.${e}`:void 0,o].filter(n=>n!==void 0).join(",")}on(e,t){return X(this,null,function*(){if(e){const r={element:e,configuration:t};for(let o=0;o<d(this,Pe);o++)d(this,W,G).unshift(r);return S(this,le,xe).call(this),S(this,ce,je).call(this,r)}return!1})}restore(){this.on(_.last(":not(body), body#tinymce")||document.querySelector(be))}init(){var e,t;const r=new MutationObserver(n=>{n[0].removedNodes.length!==0&&this.afterNotifications(_.last(":not(body):not(.notificationsView *), body#tinymce"))}),o=((t=(e=d(this,ie))==null?void 0:e.modalsContainerRetriever)!=null?t:()=>d(this,se).querySelector("#AppModals"))();o&&r.observe(o,{childList:!0}),ke.on("releaseForFirstTime",()=>{C.focusOnReload&&(this.focusOnReload=C.focusOnReload),C.focusOnReload=null,this.afterNotifications(()=>{var n;if(this.focusOnReload){const i=document.querySelector(this.focusOnReload),s=Re((n=window.CURRENT_TAB)==null?void 0:n.split("~")[1]);return document.scrollingElement&&(document.scrollingElement.scrollTop=s),i}return!1})})}},se=new WeakMap,ie=new WeakMap,j=new WeakMap,z=new WeakMap,Te=new WeakMap,Pe=new WeakMap,R=new WeakMap,k=new WeakMap,W=new WeakSet,G=function(){return new Proxy(d(this,j),{get:(e,t)=>{if(t in e){const r=e[t];return ve(r)?(...o)=>e[t].bind(e,...o)():r}}})},M=new WeakSet,Y=function(e){return e.currentInstruction===d(this,z)},ae=new WeakSet,Ce=function(e,t,r,o){return X(this,null,function*(){if(ke.isLocked("common")&&!(o!=null&&o.focusEvenWhenScreenLocked))return null;const n=ve(e)?e(r):e;return n&&(n.disabled?!1:(n.focus(),new Promise(i=>{if(o?.dispatchCustomEvent!==!1){const s=new CustomEvent(Xe.focus,{bubbles:!0});n.dispatchEvent(s)}setTimeout(()=>{if(!S(this,M,Y).call(this,t)){i(!1);return}try{o!=null&&o.scrollIntoViewOptions&&n?.scrollIntoView(o.scrollIntoViewOptions)}catch(s){console.error(s)}setTimeout(()=>{var s,l;S(this,M,Y).call(this,t)?((s=document.activeElement)==null?void 0:s.tagName)==="IFRAME"?i((l=document.activeElement.contentDocument)!=null&&l.contains(n)?n:null):i(document.activeElement===n?n:null):i(!1)},0)},0)})))})},le=new WeakSet,xe=function(){clearTimeout(d(this,R)),b(this,R,-1),b(this,k,!1),br(this,z)._++},ce=new WeakSet,je=function(e,t){return X(this,null,function*(){if(!t&&(d(this,R)!==-1||d(this,k)))return!1;const r={currentInstruction:d(this,z)};return b(this,k,!0),new Promise(o=>{X(this,null,function*(){const n=e??d(this,W,G).shift();if(n){const i=yield S(this,ae,Ce).call(this,n.element,r,n!==d(this,W,G)[0],n.configuration);if(!S(this,M,Y).call(this,r)){o(!1);return}if(i!==null&&i!==!1){b(this,j,[]),o(i),b(this,k,!1);return}i===!1&&b(this,j,d(this,j).filter(s=>s!==n))}if(!S(this,M,Y).call(this,r)){o(!1);return}if(d(this,j).length>0)b(this,R,setTimeout(()=>{X(this,null,function*(){const i=yield S(this,ce,je).call(this,void 0,!0);o(i),b(this,k,!0)})},d(this,Te)));else{const i=_.last(":not(body)");if(i){const s=yield S(this,ae,Ce).call(this,i,r,n!==d(this,W,G)[0],n?.configuration);if(!S(this,M,Y).call(this,r)){o(!1);return}o(s||!1),b(this,k,!0)}o(!1),b(this,k,!0)}})})})},ot)(document.getElementById("root"));function Sr(...e){const[t,r]=De.useState();return De.useEffect(()=>{e.forEach(o=>{o&&(typeof o=="function"?o(t):o.current=t)})},[e,t]),r}const Er=(e,{runWhenTriggered:t,timeout:r}={runWhenTriggered:!1,timeout:200})=>{const o=$(-1);return me((...n)=>{t&&e(...n),clearTimeout(o.current),o.current=setTimeout(()=>e(...n),r)},[e,t,r])};function kr(e){const t=$(e);return t.current=e,t}function Or(e){F(e,[])}function Tr(e){F(()=>e,[])}function Pr(e){const t=$(void 0),r=$(void 0);return t.current=r.current,r.current=e,t}function Cr(e){const[t,r]=q(e),o=$(t);return o.current=t,[t,r,o]}function xr(e,t){const r=$(!1);F(()=>r.current?e():(r.current=!0,()=>{}),t)}const nt=At({});var jr=Object.defineProperty,ue=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,at=(e,t,r)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,he=(e,t)=>{for(var r in t||(t={}))st.call(t,r)&&at(e,r,t[r]);if(ue)for(var r of ue(t))it.call(t,r)&&at(e,r,t[r]);return e},Mr=(e,t)=>{var r={};for(var o in e)st.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&ue)for(var o of ue(e))t.indexOf(o)<0&&it.call(e,o)&&(r[o]=e[o]);return r};function lt(){return function({Component:e,initialState:t,methods:r}){const o={},n={};Object.entries(r??{}).forEach(([s,l])=>{n[s]=(a,...c)=>{o[a]?l(o[a],...c):console.warn(`The requested id does not exist: ${a}`)}});const i={};return[n,(s,l,a)=>{var c,u;i[s]?(u=(c=i[s])==null?void 0:c[l])==null||u.forEach(h=>h.cb(a)):console.warn(`The requested id does not exist: ${s}`)},s=>{var l=s,{id:a}=l,c=Mr(l,["id"]);const[u,h]=q(t);return o[a]=w=>h(f=>he(he({},f),w)),ee(nt.Provider,{value:Q(()=>({id:a,eventsStore:i}),[a]),children:ee(e,he(he({},c),u))})}]}}var Ar=Object.defineProperty,Fr=Object.defineProperties,Lr=Object.getOwnPropertyDescriptors,ct=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable,ut=(e,t,r)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dr=(e,t)=>{for(var r in t||(t={}))Ir.call(t,r)&&ut(e,r,t[r]);if(ct)for(var r of ct(t))Nr.call(t,r)&&ut(e,r,t[r]);return e},Kr=(e,t)=>Fr(e,Lr(t));function Rr(){return function({initialState:e,methods:t,Component:r}){const o=It(),[n,i,s]=lt()({initialState:e,methods:t,Component:r}),l=(c,u)=>i(o,c,u),a={};return Object.entries(n).forEach(([c,u])=>{a[c]=(...h)=>u(o,...h)}),[a,l,c=>ee(s,Kr(Dr({},c),{id:o}))]}}function ht(){return Ft(nt)}const Wr=e=>{const t=Q(()=>Tt("hook"),[]),{id:r,eventsStore:o}=ht(),n=$(!1);function i(){Object.entries(e).forEach(([s,l])=>{var a;o[r]||(o[r]={}),o[r][s]||(o[r][s]=[]),(a=o[r][s])==null||a.push({cb:l,uniqueHookId:t})})}return F(()=>(i(),()=>{n.current=!1,Object.entries(e).forEach(([s])=>{var l;o[r][s]=((l=o[r][s])!=null?l:[]).filter(a=>a.uniqueHookId!==t)})}),[]),t},Me=(e,t)=>{let r=e;return Object.entries(t).forEach(([o,n])=>{const i=`<${o}>`;r!=null&&r.includes(i)&&(r=r.replace(i,n??""))}),r};var Yr=Object.defineProperty,ft=Object.getOwnPropertySymbols,Br=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,dt=(e,t,r)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Hr=(e,t)=>{for(var r in t||(t={}))Br.call(t,r)&&dt(e,r,t[r]);if(ft)for(var r of ft(t))qr.call(t,r)&&dt(e,r,t[r]);return e};function Vr(e,t){var r;const o=Hr({},(r=window.labels[e])!=null?r:{text:`Not preloaded: ${e}`,tooltip:`Not preloaded: ${e}`});return t?.text!==void 0&&(o.text=Me(o.text,t.text)),t?.title!==void 0&&(o.tooltip=Me(o.tooltip,t.title)),o}function pt(e,t,r="."){const o=typeof t=="string"?t.split(r):t;if(typeof e!="object"||!e)return o.length===0?e:void 0;const n=o.shift();return o.length===0?e[n]:pt(e[n],o,r)}function _r(e,t,r){if(t==="")return r;const o=t.split(".");if(o.length===0)return console.warn(`An empty path was provoided ${t}`),null;const n=Pt(e??{});let i=n;for(let s=0;s<o.length-1;s++)if(i[o[s]]||(i[o[s]]={}),typeof i[o[s]]=="object")i=i[o[s]];else throw console.info({originalObject:e,originalPath:t,currentObj:i,currentStep:o[s]}),new Error(`The provided path ${t} cannot be applied due to it is not an object's path.`);return i[o.pop()]=r,n}const Ae={},Ur=(e,t)=>e===t;function mt(){return e=>e}function B(e){return typeof e=="object"&&e&&("selector"in e||"comparator"in e||"initialValue"in e)}function Jr(e,t,r,o){var n;const i=p.useMemo(()=>B(t)?t.selector:t,[]),s=p.useMemo(()=>B(t)?t.comparator:r,[]),l=p.useMemo(()=>B(t)?t.initialValue:void 0,[]),a=p.useMemo(()=>{var m;return(m=o??(B(t)?t.propsStore:Z))!=null?m:Z},[(n=o??(B(t)?t.propsStore:Z))!=null?n:Z]),c=p.useCallback(()=>{const m=a.getFieldProps(e);return m!==void 0&&l!==void 0&&a.updateField(e,l),(i??mt())(m??Ae)},[]),[u,h]=p.useState(c),w=$(u),f=$(e);return p.useEffect(()=>{const m=a.suscribe(e,(O,de)=>{const A=(i??mt())(O);(!(s??Ur)(w.current,A)||f.current!==e)&&(de?h(A):p.startTransition(()=>{h(A)})),w.current=A});return()=>{m()}},[e,a]),u}var Xr=Object.defineProperty,zr=Object.defineProperties,Gr=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,Qr=Object.prototype.propertyIsEnumerable,gt=(e,t,r)=>t in e?Xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fe=(e,t)=>{for(var r in t||(t={}))Zr.call(t,r)&&gt(e,r,t[r]);if(vt)for(var r of vt(t))Qr.call(t,r)&&gt(e,r,t[r]);return e},eo=(e,t)=>zr(e,Gr(t));const yt="propsLog";class bt{constructor(t){this.configuration=t,this.log=C[yt],this.fields={},this.suscriptors={},this.loggers={propsLog:([r])=>{this.log=r,C[yt]=r},propsStore:([r])=>{console.info(r?this.fields[r]:this.fields)},propsSuscriptors:([r])=>{console.info(r?this.suscriptors[r]:this.suscriptors)},updateProp:([r,o])=>{this.updateField(r,o)}},this.configuration&&(this.configuration.logCommands.propsStore&&v.on(this.configuration.logCommands.propsStore,this.loggers.propsStore,"Muestra el contenido actual del propsStore"),this.configuration.logCommands.updateProp&&v.on(this.configuration.logCommands.updateProp,this.loggers.updateProp,"dd.updateProp(fieldId, newProps). El objeto newProps ser\xE1 mergeado sobre las props actuales"),this.configuration.logCommands.propsSuscriptors&&v.on(this.configuration.logCommands.propsSuscriptors,this.loggers.propsSuscriptors,"Muestra los suscriptores actuales del propsStore"),this.configuration.logCommands.propsLog&&v.on(this.configuration.logCommands.propsLog,this.loggers.propsLog,"Si se pasa como true, hace log de las acciones. Si se pasa como trace(fieldId), se hace log de todas las acciones y trace del campo especificado. Si se pasa trace(), hace log y trace de todas las acciones."))}destructor(){this.configuration&&(this.configuration.logCommands.propsStore&&v.off(this.configuration.logCommands.propsStore,this.loggers.propsStore),this.configuration.logCommands.updateProp&&v.off(this.configuration.logCommands.updateProp,this.loggers.updateProp),this.configuration.logCommands.propsSuscriptors&&v.off(this.configuration.logCommands.propsSuscriptors,this.loggers.propsSuscriptors),this.configuration.logCommands.propsLog&&v.off(this.configuration.logCommands.propsLog,this.loggers.propsLog))}getAllFields(){return Ct(this.fields)}getFieldProps(t){return this.fields[t]}removeField(t){this.suscriptors[t]=[],delete this.fields[t],this.log&&console.info(`propsStore: removeNode ${t}`)}suscribe(t,r){var o;return this.suscriptors[t]||(this.suscriptors[t]=[]),this.suscriptors[t].push(r),r((o=this.fields[t])!=null?o:Ae),()=>{this.suscriptors[t]=this.suscriptors[t].filter(n=>n!==r)}}updateField(t,r,o){var n,i,s;if(t===void 0)return;const{noEmit:l,isUrgent:a}=o??{},c=Fe(Fe({},this.fields[t]),r);if(this.fields[t]=c,(this.log===!0||this.log===t)&&console.info({fieldId:t,props:r}),this.log==="trace")console.trace();else{const u=typeof this.log=="string"&&((n=this.log.match(/trace\(([^)]+)\)/))!=null?n:[])[1];t===u&&console.trace()}l||((i=this.suscriptors[t])==null||i.forEach(u=>u(c,a)),(s=this.suscriptors.any)==null||s.forEach(u=>u(eo(Fe({},c),{fieldId:t}),a)))}}const Z=new bt({logCommands:{propsLog:"propsLog",propsStore:"propsStore",propsSuscriptors:"propsSuscriptors",updateProp:"updateProp"}});var to=Object.defineProperty,ro=Object.defineProperties,oo=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,wt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,St=(e,t,r)=>t in e?to(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Le=(e,t)=>{for(var r in t||(t={}))wt.call(t,r)&&St(e,r,t[r]);if(fe)for(var r of fe(t))$t.call(t,r)&&St(e,r,t[r]);return e},no=(e,t)=>ro(e,oo(t)),Et=(e,t)=>{var r={};for(var o in e)wt.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&fe)for(var o of fe(e))t.indexOf(o)<0&&$t.call(e,o)&&(r[o]=e[o]);return r};function kt(e,t){var r=t,{style:o}=r,n=Et(r,["style"]);o&&Object.entries(o).forEach(([i,s])=>{e.style[i]=s}),Object.assign(e,n)}function so(e){const t=p.useRef(no(Le({},e??{}),{ref:p.useCallback(o=>{r.current=o,kt(r.current,t.current)},[])})),r=p.useRef(null);return{domProps:t.current,setDomProps:p.useCallback(o=>{var n=o,{style:i}=n,s=Et(n,["style"]);if(i){const l=Le(Le({},t.current.style),i);t.current.style=l}Object.assign(t.current,s),r.current&&kt(r.current,t.current)},[])}}function io(e,t){const[r,o]=q(t),n=$(-1),i=me((s,l)=>{clearTimeout(n.current),l?o(s):n.current=setTimeout(()=>{o(s)},e)},[e]);return[r,i]}function ao(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function lo(e){return typeof e=="string"?!["false",""].includes(e.toLowerCase()):Array.isArray(e)?e.length>0:!!e}var co=(e,t,r)=>new Promise((o,n)=>{var i=a=>{try{l(r.next(a))}catch(c){n(c)}},s=a=>{try{l(r.throw(a))}catch(c){n(c)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(e,t)).next())});const uo=e=>e,ho=e=>e,fo=(e,t)=>t==="v"&&e==="T"?!0:t==="v"&&e==="F"?!1:e,po=(e,t)=>t==="value"&&typeof e=="number"&&Number.isNaN(e)||t==="valueType"&&typeof e=="string"&&e==="null"?"":(t==="cols"||t==="rows"||t==="x"||t==="y"||t==="length")&&typeof e=="string"?Kt(e):e,mo=e=>co(void 0,null,function*(){const t=new Nt.Parser({trim:!0,normalize:!0,explicitRoot:!1,mergeAttrs:!0,explicitArray:!1,charkey:"content",attrValueProcessors:[Dt,po,fo],tagNameProcessors:[uo],attrNameProcessors:[ho]});return yield new Promise((r,o)=>{t.parseString(e,(n,i)=>{n?o(n):r(i)})})});export{Je as AriaLiveEmitter,H as EventEmitter,lr as LiveRegion,Ae as PropsSelectorUndefinedObject,bt as PropsStore,dr as Url,ar as WithEventsValue,Ke as addBoundary,Yt as animate,_t as apiaDateToStandarFormat,We as arrayOrArray,zt as autoDisconnectMutationObserver,ze as cantFocusSelector,Xe as customEvents,Ut as dateToApiaFormat,v as debugDispatcher,qt as decrypt,pr as disableChildrenFocus,Qt as downloadUrl,mr as enableChildrenFocus,Jt as enableDebugDispatcher,Ht as encrypt,qe as findOffsetRelativeToScrollParent,te as findScrollContainer,$r as focus,be as focusSelector,Me as formatMessage,ge as getDateFormat,cr as getFocusSelector,Bt as getIndex,Vr as getLabel,Ge as getSpecificParent,pt as getValueByPath,_ as globalFocus,ur as isChild,Be as isDebugDispatcherEnabled,B as isPropsConfigurationObject,lt as makeImperativeComponent,Rr as makeSingleImperativeComponent,Re as noNaN,wr as notificationsSelector,Wt as parseAsSize,mo as parseXmlAsync,C as persistentStorage,Z as propsStore,ke as screenLocker,Ve as scrollParentIntoElement,_r as setValueByPath,Xt as shortcutController,lo as toBoolean,ao as ucfirst,Sr as useCombinedRefs,Er as useDebouncedCallback,io as useDebouncedState,so as useDomState,ht as useImperativeComponentContext,Wr as useImperativeComponentEvents,kr as useLatest,yr as useLocalStorage,Or as useMount,tr as usePanAndZoom,Pr as usePrevious,Jr as usePropsSelector,Cr as useStateRef,Tr as useUnmount,xr as useUpdateEffect};