powerpagestoolkit 1.3.103 → 1.3.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1236 @@
1
+ /******/ var __webpack_modules__ = ({
2
+
3
+ /***/ 672:
4
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
5
+
6
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7
+ /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
8
+ /* harmony export */ });
9
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(601);
10
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
11
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(314);
12
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
13
+ // Imports
14
+
15
+
16
+ var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
17
+ // Module
18
+ ___CSS_LOADER_EXPORT___.push([module.id, `.info-icon {
19
+ position: relative;
20
+ display: inline-block;
21
+ }
22
+
23
+ .info-icon .fa-info-circle {
24
+ cursor: pointer; /* Ensures the icon is recognized as interactive */
25
+ }
26
+
27
+ .info-icon .flyout-content {
28
+ max-width: calc(100vw - 20px); /* 20px margin on both sides */
29
+ display: none; /* Initially hidden */
30
+ position: absolute;
31
+ left: 50%; /* Center horizontally */
32
+ transform: translateX(-50%); /* Adjust positioning */
33
+ background-color: #f9f9f9;
34
+ padding: 10px;
35
+ border: 1px solid #ddd;
36
+ z-index: 1;
37
+ min-width: 200px; /* Minimum width for better readability */
38
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
39
+ border-radius: 4px; /* Rounded corners */
40
+ }
41
+
42
+ @media (max-width: 600px) {
43
+ .info-icon .flyout-content {
44
+ max-width: 95vw;
45
+ padding: 12px;
46
+ font-size: 0.9em;
47
+ display: block;
48
+ right: auto;
49
+ }
50
+ }
51
+
52
+ .required-field::after {
53
+ content: " *" !important;
54
+ color: #f00 !important;
55
+ }
56
+ `, ""]);
57
+ // Exports
58
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
59
+
60
+
61
+ /***/ }),
62
+
63
+ /***/ 314:
64
+ /***/ ((module) => {
65
+
66
+
67
+
68
+ /*
69
+ MIT License http://www.opensource.org/licenses/mit-license.php
70
+ Author Tobias Koppers @sokra
71
+ */
72
+ module.exports = function (cssWithMappingToString) {
73
+ var list = [];
74
+
75
+ // return the list of modules as css string
76
+ list.toString = function toString() {
77
+ return this.map(function (item) {
78
+ var content = "";
79
+ var needLayer = typeof item[5] !== "undefined";
80
+ if (item[4]) {
81
+ content += "@supports (".concat(item[4], ") {");
82
+ }
83
+ if (item[2]) {
84
+ content += "@media ".concat(item[2], " {");
85
+ }
86
+ if (needLayer) {
87
+ content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
88
+ }
89
+ content += cssWithMappingToString(item);
90
+ if (needLayer) {
91
+ content += "}";
92
+ }
93
+ if (item[2]) {
94
+ content += "}";
95
+ }
96
+ if (item[4]) {
97
+ content += "}";
98
+ }
99
+ return content;
100
+ }).join("");
101
+ };
102
+
103
+ // import a list of modules into the list
104
+ list.i = function i(modules, media, dedupe, supports, layer) {
105
+ if (typeof modules === "string") {
106
+ modules = [[null, modules, undefined]];
107
+ }
108
+ var alreadyImportedModules = {};
109
+ if (dedupe) {
110
+ for (var k = 0; k < this.length; k++) {
111
+ var id = this[k][0];
112
+ if (id != null) {
113
+ alreadyImportedModules[id] = true;
114
+ }
115
+ }
116
+ }
117
+ for (var _k = 0; _k < modules.length; _k++) {
118
+ var item = [].concat(modules[_k]);
119
+ if (dedupe && alreadyImportedModules[item[0]]) {
120
+ continue;
121
+ }
122
+ if (typeof layer !== "undefined") {
123
+ if (typeof item[5] === "undefined") {
124
+ item[5] = layer;
125
+ } else {
126
+ item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
127
+ item[5] = layer;
128
+ }
129
+ }
130
+ if (media) {
131
+ if (!item[2]) {
132
+ item[2] = media;
133
+ } else {
134
+ item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
135
+ item[2] = media;
136
+ }
137
+ }
138
+ if (supports) {
139
+ if (!item[4]) {
140
+ item[4] = "".concat(supports);
141
+ } else {
142
+ item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
143
+ item[4] = supports;
144
+ }
145
+ }
146
+ list.push(item);
147
+ }
148
+ };
149
+ return list;
150
+ };
151
+
152
+ /***/ }),
153
+
154
+ /***/ 601:
155
+ /***/ ((module) => {
156
+
157
+
158
+
159
+ module.exports = function (i) {
160
+ return i[1];
161
+ };
162
+
163
+ /***/ }),
164
+
165
+ /***/ 72:
166
+ /***/ ((module) => {
167
+
168
+
169
+
170
+ var stylesInDOM = [];
171
+ function getIndexByIdentifier(identifier) {
172
+ var result = -1;
173
+ for (var i = 0; i < stylesInDOM.length; i++) {
174
+ if (stylesInDOM[i].identifier === identifier) {
175
+ result = i;
176
+ break;
177
+ }
178
+ }
179
+ return result;
180
+ }
181
+ function modulesToDom(list, options) {
182
+ var idCountMap = {};
183
+ var identifiers = [];
184
+ for (var i = 0; i < list.length; i++) {
185
+ var item = list[i];
186
+ var id = options.base ? item[0] + options.base : item[0];
187
+ var count = idCountMap[id] || 0;
188
+ var identifier = "".concat(id, " ").concat(count);
189
+ idCountMap[id] = count + 1;
190
+ var indexByIdentifier = getIndexByIdentifier(identifier);
191
+ var obj = {
192
+ css: item[1],
193
+ media: item[2],
194
+ sourceMap: item[3],
195
+ supports: item[4],
196
+ layer: item[5]
197
+ };
198
+ if (indexByIdentifier !== -1) {
199
+ stylesInDOM[indexByIdentifier].references++;
200
+ stylesInDOM[indexByIdentifier].updater(obj);
201
+ } else {
202
+ var updater = addElementStyle(obj, options);
203
+ options.byIndex = i;
204
+ stylesInDOM.splice(i, 0, {
205
+ identifier: identifier,
206
+ updater: updater,
207
+ references: 1
208
+ });
209
+ }
210
+ identifiers.push(identifier);
211
+ }
212
+ return identifiers;
213
+ }
214
+ function addElementStyle(obj, options) {
215
+ var api = options.domAPI(options);
216
+ api.update(obj);
217
+ var updater = function updater(newObj) {
218
+ if (newObj) {
219
+ if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
220
+ return;
221
+ }
222
+ api.update(obj = newObj);
223
+ } else {
224
+ api.remove();
225
+ }
226
+ };
227
+ return updater;
228
+ }
229
+ module.exports = function (list, options) {
230
+ options = options || {};
231
+ list = list || [];
232
+ var lastIdentifiers = modulesToDom(list, options);
233
+ return function update(newList) {
234
+ newList = newList || [];
235
+ for (var i = 0; i < lastIdentifiers.length; i++) {
236
+ var identifier = lastIdentifiers[i];
237
+ var index = getIndexByIdentifier(identifier);
238
+ stylesInDOM[index].references--;
239
+ }
240
+ var newLastIdentifiers = modulesToDom(newList, options);
241
+ for (var _i = 0; _i < lastIdentifiers.length; _i++) {
242
+ var _identifier = lastIdentifiers[_i];
243
+ var _index = getIndexByIdentifier(_identifier);
244
+ if (stylesInDOM[_index].references === 0) {
245
+ stylesInDOM[_index].updater();
246
+ stylesInDOM.splice(_index, 1);
247
+ }
248
+ }
249
+ lastIdentifiers = newLastIdentifiers;
250
+ };
251
+ };
252
+
253
+ /***/ }),
254
+
255
+ /***/ 659:
256
+ /***/ ((module) => {
257
+
258
+
259
+
260
+ var memo = {};
261
+
262
+ /* istanbul ignore next */
263
+ function getTarget(target) {
264
+ if (typeof memo[target] === "undefined") {
265
+ var styleTarget = document.querySelector(target);
266
+
267
+ // Special case to return head of iframe instead of iframe itself
268
+ if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
269
+ try {
270
+ // This will throw an exception if access to iframe is blocked
271
+ // due to cross-origin restrictions
272
+ styleTarget = styleTarget.contentDocument.head;
273
+ } catch (e) {
274
+ // istanbul ignore next
275
+ styleTarget = null;
276
+ }
277
+ }
278
+ memo[target] = styleTarget;
279
+ }
280
+ return memo[target];
281
+ }
282
+
283
+ /* istanbul ignore next */
284
+ function insertBySelector(insert, style) {
285
+ var target = getTarget(insert);
286
+ if (!target) {
287
+ throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
288
+ }
289
+ target.appendChild(style);
290
+ }
291
+ module.exports = insertBySelector;
292
+
293
+ /***/ }),
294
+
295
+ /***/ 540:
296
+ /***/ ((module) => {
297
+
298
+
299
+
300
+ /* istanbul ignore next */
301
+ function insertStyleElement(options) {
302
+ var element = document.createElement("style");
303
+ options.setAttributes(element, options.attributes);
304
+ options.insert(element, options.options);
305
+ return element;
306
+ }
307
+ module.exports = insertStyleElement;
308
+
309
+ /***/ }),
310
+
311
+ /***/ 56:
312
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
313
+
314
+
315
+
316
+ /* istanbul ignore next */
317
+ function setAttributesWithoutAttributes(styleElement) {
318
+ var nonce = true ? __webpack_require__.nc : 0;
319
+ if (nonce) {
320
+ styleElement.setAttribute("nonce", nonce);
321
+ }
322
+ }
323
+ module.exports = setAttributesWithoutAttributes;
324
+
325
+ /***/ }),
326
+
327
+ /***/ 825:
328
+ /***/ ((module) => {
329
+
330
+
331
+
332
+ /* istanbul ignore next */
333
+ function apply(styleElement, options, obj) {
334
+ var css = "";
335
+ if (obj.supports) {
336
+ css += "@supports (".concat(obj.supports, ") {");
337
+ }
338
+ if (obj.media) {
339
+ css += "@media ".concat(obj.media, " {");
340
+ }
341
+ var needLayer = typeof obj.layer !== "undefined";
342
+ if (needLayer) {
343
+ css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
344
+ }
345
+ css += obj.css;
346
+ if (needLayer) {
347
+ css += "}";
348
+ }
349
+ if (obj.media) {
350
+ css += "}";
351
+ }
352
+ if (obj.supports) {
353
+ css += "}";
354
+ }
355
+ var sourceMap = obj.sourceMap;
356
+ if (sourceMap && typeof btoa !== "undefined") {
357
+ css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
358
+ }
359
+
360
+ // For old IE
361
+ /* istanbul ignore if */
362
+ options.styleTagTransform(css, styleElement, options.options);
363
+ }
364
+ function removeStyleElement(styleElement) {
365
+ // istanbul ignore if
366
+ if (styleElement.parentNode === null) {
367
+ return false;
368
+ }
369
+ styleElement.parentNode.removeChild(styleElement);
370
+ }
371
+
372
+ /* istanbul ignore next */
373
+ function domAPI(options) {
374
+ if (typeof document === "undefined") {
375
+ return {
376
+ update: function update() {},
377
+ remove: function remove() {}
378
+ };
379
+ }
380
+ var styleElement = options.insertStyleElement(options);
381
+ return {
382
+ update: function update(obj) {
383
+ apply(styleElement, options, obj);
384
+ },
385
+ remove: function remove() {
386
+ removeStyleElement(styleElement);
387
+ }
388
+ };
389
+ }
390
+ module.exports = domAPI;
391
+
392
+ /***/ }),
393
+
394
+ /***/ 113:
395
+ /***/ ((module) => {
396
+
397
+
398
+
399
+ /* istanbul ignore next */
400
+ function styleTagTransform(css, styleElement) {
401
+ if (styleElement.styleSheet) {
402
+ styleElement.styleSheet.cssText = css;
403
+ } else {
404
+ while (styleElement.firstChild) {
405
+ styleElement.removeChild(styleElement.firstChild);
406
+ }
407
+ styleElement.appendChild(document.createTextNode(css));
408
+ }
409
+ }
410
+ module.exports = styleTagTransform;
411
+
412
+ /***/ })
413
+
414
+ /******/ });
415
+ /************************************************************************/
416
+ /******/ // The module cache
417
+ /******/ var __webpack_module_cache__ = {};
418
+ /******/
419
+ /******/ // The require function
420
+ /******/ function __webpack_require__(moduleId) {
421
+ /******/ // Check if module is in cache
422
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
423
+ /******/ if (cachedModule !== undefined) {
424
+ /******/ return cachedModule.exports;
425
+ /******/ }
426
+ /******/ // Create a new module (and put it into the cache)
427
+ /******/ var module = __webpack_module_cache__[moduleId] = {
428
+ /******/ id: moduleId,
429
+ /******/ // no module.loaded needed
430
+ /******/ exports: {}
431
+ /******/ };
432
+ /******/
433
+ /******/ // Execute the module function
434
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
435
+ /******/
436
+ /******/ // Return the exports of the module
437
+ /******/ return module.exports;
438
+ /******/ }
439
+ /******/
440
+ /************************************************************************/
441
+ /******/ /* webpack/runtime/compat get default export */
442
+ /******/ (() => {
443
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
444
+ /******/ __webpack_require__.n = (module) => {
445
+ /******/ var getter = module && module.__esModule ?
446
+ /******/ () => (module['default']) :
447
+ /******/ () => (module);
448
+ /******/ __webpack_require__.d(getter, { a: getter });
449
+ /******/ return getter;
450
+ /******/ };
451
+ /******/ })();
452
+ /******/
453
+ /******/ /* webpack/runtime/define property getters */
454
+ /******/ (() => {
455
+ /******/ // define getter functions for harmony exports
456
+ /******/ __webpack_require__.d = (exports, definition) => {
457
+ /******/ for(var key in definition) {
458
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
459
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
460
+ /******/ }
461
+ /******/ }
462
+ /******/ };
463
+ /******/ })();
464
+ /******/
465
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
466
+ /******/ (() => {
467
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
468
+ /******/ })();
469
+ /******/
470
+ /******/ /* webpack/runtime/nonce */
471
+ /******/ (() => {
472
+ /******/ __webpack_require__.nc = undefined;
473
+ /******/ })();
474
+ /******/
475
+ /************************************************************************/
476
+ var __webpack_exports__ = {};
477
+
478
+ // EXPORTS
479
+ __webpack_require__.d(__webpack_exports__, {
480
+ nC: () => (/* reexport */ JS_API),
481
+ mI: () => (/* reexport */ createDOMNodeReference),
482
+ xq: () => (/* reexport */ createMultipleDOMNodeReferences)
483
+ });
484
+
485
+ ;// ./src/JS/safeAjax.js
486
+ function safeAjax(ajaxOptions) {
487
+ var deferredAjax = $.Deferred();
488
+
489
+ // shell is only available via runtime in a PowerPages portal
490
+ //eslint-disable-next-line
491
+ shell.getTokenDeferred().done(function (token) {
492
+ // add headers for AJAX
493
+ if (!ajaxOptions.headers) {
494
+ $.extend(ajaxOptions, {
495
+ headers: {
496
+ __RequestVerificationToken: token
497
+ }
498
+ });
499
+ } else {
500
+ ajaxOptions.headers["__RequestVerificationToken"] = token;
501
+ }
502
+ $.ajax(ajaxOptions).done(function (data, textStatus, jqXHR) {
503
+ //eslint-disable-next-line
504
+ validateLoginSession(data, textStatus, jqXHR, deferredAjax.resolve);
505
+ }).fail(deferredAjax.reject); //AJAX
506
+ }).fail(function () {
507
+ deferredAjax.rejectWith(this, arguments); // on token failure pass the token AJAX and args
508
+ });
509
+ return deferredAjax.promise();
510
+ }
511
+ ;// ./src/JS/API.js
512
+
513
+ var API = {
514
+ /**
515
+ *
516
+ * @param {Class} schema an instance of a schema class, containing the desired information for the POST request
517
+ * @returns a Promise resolving the successful results *[record id]* of the POST request, or rejecting the failed results *[error]* of the POST request.
518
+ */
519
+ createRecord: function createRecord(schema) {
520
+ return new Promise(function (resolve, reject) {
521
+ safeAjax({
522
+ type: "POST",
523
+ url: "/_api/".concat(schema.logicalName()),
524
+ data: schema.value(),
525
+ contentType: "application/json",
526
+ success: function success(response, status, xhr) {
527
+ resolve(xhr.getResponseHeader("entityid"));
528
+ },
529
+ error: function error(_error) {
530
+ reject(_error);
531
+ }
532
+ });
533
+ });
534
+ },
535
+ /**
536
+ *
537
+ * @param {string} tableSetName The DataVerse SET name of the table being queried
538
+ * @param {string} recordID the GUID of the records to be retrieved
539
+ * @param {string} selectColumns *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. Format = select=column1,column2,column3...
540
+ * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
541
+ */
542
+ getRecord: function getRecord(tableSetName, recordID, selectColumns) {
543
+ return new Promise(function (resolve, reject) {
544
+ var url = "/_api/".concat(tableSetName, "(").concat(recordID, ")").concat(selectColumns ? "?$".concat(selectColumns) : "");
545
+ safeAjax({
546
+ type: "GET",
547
+ url: url,
548
+ success: resolve,
549
+ error: reject
550
+ });
551
+ });
552
+ },
553
+ /**
554
+ *
555
+ * @param {String} tableSetName The DataVerse SET name of the table being queried
556
+ * @param {String} queryParameters *OPTIONAL* the OData query parameters for refining search results: *format = $filter=filters&$select=columns*
557
+ * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
558
+ */
559
+ getMultiple: function getMultiple(tableSetName, queryParameters) {
560
+ return new Promise(function (resolve, reject) {
561
+ // Construct the URL based on the presence of query parameters
562
+ var url = "/_api/".concat(tableSetName).concat(queryParameters ? "?".concat(queryParameters) : "");
563
+ safeAjax({
564
+ type: "GET",
565
+ url: url,
566
+ success: function success(response) {
567
+ resolve(response.value);
568
+ },
569
+ error: reject
570
+ });
571
+ });
572
+ }
573
+ };
574
+ /* harmony default export */ const JS_API = (API);
575
+ ;// ./src/JS/waitFor.js
576
+ function waitFor(target) {
577
+ return new Promise(function (resolve, reject) {
578
+ // Create observer to watch for target in DOM
579
+ var observer = new MutationObserver(function () {
580
+ var observedElement = document.querySelector(target);
581
+ if (observedElement) {
582
+ clearTimeout(timeout);
583
+ observer.disconnect();
584
+ resolve(observedElement);
585
+ }
586
+ });
587
+ var timeout = setTimeout(function () {
588
+ observer.disconnect();
589
+ reject(new Error("Element not found: ".concat(target, " within 5 seconds")));
590
+ }, 5000);
591
+
592
+ // Check if target is already in DOM
593
+ if (target instanceof HTMLElement) {
594
+ clearTimeout(timeout);
595
+ return resolve(target);
596
+ }
597
+ var element = document.querySelector(target);
598
+ if (element) {
599
+ clearTimeout(timeout);
600
+ return resolve(element);
601
+ }
602
+ observer.observe(document.body, {
603
+ subtree: true,
604
+ attributes: true,
605
+ childList: true // Detects added/removed child elements
606
+ });
607
+ });
608
+ }
609
+ ;// ./src/JS/createInfoElement.js
610
+ function CreateInfoEl(titleString) {
611
+ var span = document.createElement("span");
612
+ span.classList.add("info-icon");
613
+ var icon = document.createElement("i");
614
+ icon.classList.add("fa", "fa-solid", "fa-info-circle");
615
+ icon.setAttribute("aria-label", "Info");
616
+ icon.style.cursor = "pointer";
617
+ var flyoutContent = document.createElement("div");
618
+ flyoutContent.innerHTML = titleString;
619
+ flyoutContent.classList.add("flyout-content");
620
+ span.appendChild(icon);
621
+ span.appendChild(flyoutContent);
622
+
623
+ // Function to position flyout content
624
+ var positionFlyout = function positionFlyout() {
625
+ flyoutContent.style.display = "block"; // Show the flyout to calculate dimensions
626
+
627
+ var flyoutRect = flyoutContent.getBoundingClientRect();
628
+ var viewportWidth = window.innerWidth;
629
+
630
+ // Position the flyout
631
+
632
+ // Adjust if flyout is too far to the right
633
+ if (flyoutRect.right > viewportWidth) {
634
+ var overflowAmount = flyoutRect.right - viewportWidth;
635
+ flyoutContent.style.left = "calc(50% - ".concat(overflowAmount, "px)"); // Shift left
636
+ }
637
+
638
+ // Adjust if flyout is too far to the left
639
+ if (flyoutRect.left < 0) {
640
+ var _overflowAmount = Math.abs(flyoutRect.left);
641
+ flyoutContent.style.left = "calc(50% + ".concat(_overflowAmount, "px)"); // Shift right
642
+ }
643
+ };
644
+ icon.addEventListener("mouseenter", positionFlyout);
645
+ icon.addEventListener("mouseleave", function () {
646
+ flyoutContent.style.display = "none"; // Hide on mouse leave
647
+ });
648
+ icon.addEventListener("touchstart", function (event) {
649
+ event.preventDefault();
650
+ // Toggle flyout visibility on touch
651
+ flyoutContent.style.display = flyoutContent.style.display === "block" ? "none" : "block";
652
+ if (flyoutContent.style.display === "block") {
653
+ positionFlyout(); // Position the flyout when displayed
654
+ }
655
+ });
656
+ document.body.addEventListener("click", function (event) {
657
+ if (!span.contains(event.target)) {
658
+ flyoutContent.style.display = "none"; // Hide on body click
659
+ }
660
+ });
661
+ return span;
662
+ }
663
+ ;// ./src/JS/errors.js
664
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
665
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
666
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
667
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
668
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
669
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
670
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
671
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
672
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
673
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
674
+ function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
675
+ function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
676
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
677
+ function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
678
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
679
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
680
+ var DOMNodeInitializationError = /*#__PURE__*/function (_Error) {
681
+ function DOMNodeInitializationError(instance, error) {
682
+ var _this;
683
+ _classCallCheck(this, DOMNodeInitializationError);
684
+ _this = _callSuper(this, DOMNodeInitializationError, ["There was an error initializing a DOMNodeReference for target: ".concat(instance.target, ", :: ").concat(error)]);
685
+ _this.name = "DOMNodeInitializationError";
686
+ return _this;
687
+ }
688
+ _inherits(DOMNodeInitializationError, _Error);
689
+ return _createClass(DOMNodeInitializationError);
690
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
691
+ var DOMNodeNotFoundError = /*#__PURE__*/function (_Error2) {
692
+ function DOMNodeNotFoundError(instance) {
693
+ _classCallCheck(this, DOMNodeNotFoundError);
694
+ return _callSuper(this, DOMNodeNotFoundError, ["The targeted DOM element was not found: ".concat(instance.target)]);
695
+ }
696
+ _inherits(DOMNodeNotFoundError, _Error2);
697
+ return _createClass(DOMNodeNotFoundError);
698
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
699
+ var ConditionalRenderingError = /*#__PURE__*/function (_Error3) {
700
+ function ConditionalRenderingError(instance, error) {
701
+ _classCallCheck(this, ConditionalRenderingError);
702
+ return _callSuper(this, ConditionalRenderingError, ["There was an error condiguring conditional rendering for target: ".concat(instance.target, " :: ").concat(error)]);
703
+ }
704
+ _inherits(ConditionalRenderingError, _Error3);
705
+ return _createClass(ConditionalRenderingError);
706
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
707
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
708
+ var injectStylesIntoStyleTag = __webpack_require__(72);
709
+ var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
710
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js
711
+ var styleDomAPI = __webpack_require__(825);
712
+ var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
713
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js
714
+ var insertBySelector = __webpack_require__(659);
715
+ var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
716
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
717
+ var setAttributesWithoutAttributes = __webpack_require__(56);
718
+ var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
719
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js
720
+ var insertStyleElement = __webpack_require__(540);
721
+ var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
722
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js
723
+ var styleTagTransform = __webpack_require__(113);
724
+ var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
725
+ // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/CSS/style.css
726
+ var style = __webpack_require__(672);
727
+ ;// ./src/CSS/style.css
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+ var options = {};
740
+
741
+ options.styleTagTransform = (styleTagTransform_default());
742
+ options.setAttributes = (setAttributesWithoutAttributes_default());
743
+ options.insert = insertBySelector_default().bind(null, "head");
744
+ options.domAPI = (styleDomAPI_default());
745
+ options.insertStyleElement = (insertStyleElement_default());
746
+
747
+ var update = injectStylesIntoStyleTag_default()(style/* default */.A, options);
748
+
749
+
750
+
751
+
752
+ /* harmony default export */ const CSS_style = (style/* default */.A && style/* default */.A.locals ? style/* default */.A.locals : undefined);
753
+
754
+ ;// ./src/JS/DOMNodeReferences.js
755
+ function DOMNodeReferences_typeof(o) { "@babel/helpers - typeof"; return DOMNodeReferences_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, DOMNodeReferences_typeof(o); }
756
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == DOMNodeReferences_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(DOMNodeReferences_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
757
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
758
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
759
+ function DOMNodeReferences_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
760
+ function DOMNodeReferences_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, DOMNodeReferences_toPropertyKey(o.key), o); } }
761
+ function DOMNodeReferences_createClass(e, r, t) { return r && DOMNodeReferences_defineProperties(e.prototype, r), t && DOMNodeReferences_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
762
+ function DOMNodeReferences_toPropertyKey(t) { var i = DOMNodeReferences_toPrimitive(t, "string"); return "symbol" == DOMNodeReferences_typeof(i) ? i : i + ""; }
763
+ function DOMNodeReferences_toPrimitive(t, r) { if ("object" != DOMNodeReferences_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != DOMNodeReferences_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
764
+
765
+
766
+
767
+
768
+
769
+ /**
770
+ * Class representing a reference to a DOM node.
771
+ */
772
+ /******/ /******/ /******/
773
+ var DOMNodeReference = /*#__PURE__*/function () {
774
+ /**
775
+ * Creates an instance of DOMNodeReference.
776
+ * @param {string} target - The CSS selector to find the desired DOM element.
777
+ */
778
+ /******/ /******/
779
+ function DOMNodeReference(target) {
780
+ DOMNodeReferences_classCallCheck(this, DOMNodeReference);
781
+ this.target = target;
782
+ this.element = null;
783
+ this.isLoaded = false;
784
+ this.visibilityController = null;
785
+ this.defaultDisplay = "";
786
+ this.value = null;
787
+ // we defer the rest of initialization
788
+ }
789
+ return DOMNodeReferences_createClass(DOMNodeReference, [{
790
+ key: "_init",
791
+ value: function () {
792
+ var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
793
+ var element;
794
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
795
+ while (1) switch (_context.prev = _context.next) {
796
+ case 0:
797
+ _context.prev = 0;
798
+ _context.next = 3;
799
+ return waitFor(this.target);
800
+ case 3:
801
+ element = _context.sent;
802
+ this.element = element;
803
+ if (this.element) {
804
+ _context.next = 7;
805
+ break;
806
+ }
807
+ throw new DOMNodeNotFoundError(this);
808
+ case 7:
809
+ if (!this.element.classList.contains("boolean-radio")) {
810
+ _context.next = 10;
811
+ break;
812
+ }
813
+ _context.next = 10;
814
+ return this._attachRadioButtons();
815
+ case 10:
816
+ this._initValueSync();
817
+ this._attachVisibilityController();
818
+ this.defaultDisplay = this.visibilityController.style.display;
819
+ this.isLoaded = true;
820
+ _context.next = 19;
821
+ break;
822
+ case 16:
823
+ _context.prev = 16;
824
+ _context.t0 = _context["catch"](0);
825
+ throw new DOMNodeInitializationError(this, _context.t0);
826
+ case 19:
827
+ case "end":
828
+ return _context.stop();
829
+ }
830
+ }, _callee, this, [[0, 16]]);
831
+ }));
832
+ function _init() {
833
+ return _init2.apply(this, arguments);
834
+ }
835
+ return _init;
836
+ }()
837
+ }, {
838
+ key: "_initValueSync",
839
+ value: function _initValueSync() {
840
+ // Function to update this.value based on element type
841
+
842
+ // Initial sync
843
+ this.updateValue();
844
+
845
+ // Event listeners for real-time changes based on element type
846
+ var elementType = this.element.type;
847
+ if (elementType === "checkbox" || elementType === "radio") {
848
+ this.element.addEventListener("click", this.updateValue.bind(this));
849
+ } else if (elementType === "select-one" || elementType === "select-multiple") {
850
+ this.element.addEventListener("change", this.updateValue.bind(this));
851
+ } else {
852
+ this.element.addEventListener("input", this.updateValue.bind(this));
853
+ }
854
+ }
855
+ }, {
856
+ key: "updateValue",
857
+ value: function updateValue() {
858
+ switch (this.element.type) {
859
+ case "checkbox":
860
+ case "radio":
861
+ this.value = this.element.checked;
862
+ this.checked = this.element.checked;
863
+ break;
864
+ case "select-multiple":
865
+ this.value = Array.from(this.element.selectedOptions).map(function (option) {
866
+ return option.value;
867
+ });
868
+ break;
869
+ case "file":
870
+ this.value = this.element.files.length > 0 ? Array.from(this.element.files) : null;
871
+ break;
872
+ case "number":
873
+ this.value = this.element.value !== "" ? Number(this.element.value) : null;
874
+ break;
875
+ default:
876
+ this.value = this.element.value || null;
877
+ break;
878
+ }
879
+ if (this.element.classList.contains("boolean-radio")) {
880
+ this.yesRadio.updateValue();
881
+ this.noRadio.updateValue();
882
+ }
883
+ }
884
+ }, {
885
+ key: "_attachVisibilityController",
886
+ value: function _attachVisibilityController() {
887
+ // Set the default visibility controller to the element itself
888
+ this.visibilityController = this.element;
889
+
890
+ // If the element is a table, use its closest fieldset as the controller
891
+ if (this.element.tagName === "TABLE") {
892
+ var fieldset = this.element.closest("fieldset");
893
+ if (fieldset) {
894
+ this.visibilityController = fieldset;
895
+ }
896
+ return;
897
+ }
898
+
899
+ // For specific tag types, use the closest 'td' if available as the controller
900
+ var tagsRequiringTdParent = ["SPAN", "INPUT", "TEXTAREA", "SELECT", "TABLE"];
901
+ if (tagsRequiringTdParent.includes(this.element.tagName)) {
902
+ var tdParent = this.element.closest("td");
903
+ if (tdParent) {
904
+ this.visibilityController = tdParent;
905
+ }
906
+ }
907
+ }
908
+ }, {
909
+ key: "_attachRadioButtons",
910
+ value: function () {
911
+ var _attachRadioButtons2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
912
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
913
+ while (1) switch (_context2.prev = _context2.next) {
914
+ case 0:
915
+ _context2.next = 2;
916
+ return createDOMNodeReference("#".concat(this.element.id, "_1"));
917
+ case 2:
918
+ this.yesRadio = _context2.sent;
919
+ _context2.next = 5;
920
+ return createDOMNodeReference("#".concat(this.element.id, "_0"));
921
+ case 5:
922
+ this.noRadio = _context2.sent;
923
+ case 6:
924
+ case "end":
925
+ return _context2.stop();
926
+ }
927
+ }, _callee2, this);
928
+ }));
929
+ function _attachRadioButtons() {
930
+ return _attachRadioButtons2.apply(this, arguments);
931
+ }
932
+ return _attachRadioButtons;
933
+ }()
934
+ }, {
935
+ key: "on",
936
+ value: function on(eventType, eventHandler) {
937
+ this.element.addEventListener(eventType, eventHandler.bind(this));
938
+ }
939
+ }, {
940
+ key: "hide",
941
+ value: function hide() {
942
+ this.visibilityController.style.display = "none";
943
+ }
944
+ }, {
945
+ key: "show",
946
+ value: function show() {
947
+ this.visibilityController.style.display = this.defaultDisplay;
948
+ }
949
+ }, {
950
+ key: "toggleVisibility",
951
+ value: function toggleVisibility(shouldShow) {
952
+ if (shouldShow instanceof Function) {
953
+ shouldShow() ? this.show() : this.hide();
954
+ } else {
955
+ shouldShow ? this.show() : this.hide();
956
+ }
957
+ }
958
+ }, {
959
+ key: "setValue",
960
+ value: function setValue(value) {
961
+ if (this.element.classList.contains("boolean-radio")) {
962
+ this.yesRadio.element.checked = value;
963
+ this.noRadio.element.checked = !value;
964
+ } else {
965
+ this.element.value = value;
966
+ }
967
+ }
968
+ }, {
969
+ key: "disable",
970
+ value: function disable() {
971
+ try {
972
+ this.element.disabled = true;
973
+ } catch (e) {
974
+ throw new Error("There was an error trying to disable the target: ".concat(this.target));
975
+ }
976
+ }
977
+ }, {
978
+ key: "enable",
979
+ value: function enable() {
980
+ try {
981
+ this.element.disabled = false;
982
+ } catch (e) {
983
+ throw new Error("There was an error trying to disable the target: ".concat(this.target));
984
+ }
985
+ }
986
+ }, {
987
+ key: "append",
988
+ value: function append() {
989
+ var _this$element;
990
+ (_this$element = this.element).append.apply(_this$element, arguments);
991
+ }
992
+ }, {
993
+ key: "after",
994
+ value: function after() {
995
+ var _this$element2;
996
+ (_this$element2 = this.element).after.apply(_this$element2, arguments);
997
+ }
998
+ }, {
999
+ key: "getLabel",
1000
+ value: function getLabel() {
1001
+ return document.querySelector("#".concat(this.element.id, "_label")) || null;
1002
+ }
1003
+ }, {
1004
+ key: "appendToLabel",
1005
+ value: function appendToLabel() {
1006
+ var label = this.getLabel();
1007
+ if (label) {
1008
+ for (var _len = arguments.length, elements = new Array(_len), _key = 0; _key < _len; _key++) {
1009
+ elements[_key] = arguments[_key];
1010
+ }
1011
+ label.append.apply(label, [" "].concat(elements));
1012
+ }
1013
+ }
1014
+ }, {
1015
+ key: "addLabelTooltip",
1016
+ value: function addLabelTooltip(text) {
1017
+ this.appendToLabel(CreateInfoEl(text));
1018
+ }
1019
+ }, {
1020
+ key: "addToolTip",
1021
+ value: function addToolTip(text) {
1022
+ this.append(CreateInfoEl(text));
1023
+ }
1024
+ }, {
1025
+ key: "setTextContent",
1026
+ value: function setTextContent(text) {
1027
+ this.element.innerHTML = text;
1028
+ }
1029
+ }, {
1030
+ key: "uncheckRadios",
1031
+ value: function uncheckRadios() {
1032
+ if (this.yesRadio && this.noRadio) {
1033
+ this.yesRadio.element.checked = false;
1034
+ this.noRadio.element.checked = false;
1035
+ } else {
1036
+ console.error("[SYNACT] Attempted to uncheck radios for an element that has no radios");
1037
+ }
1038
+ }
1039
+ }, {
1040
+ key: "configureConditionalRendering",
1041
+ value: function configureConditionalRendering(condition, triggerNodes) {
1042
+ var _this = this;
1043
+ try {
1044
+ this.toggleVisibility(condition());
1045
+ if (triggerNodes) {
1046
+ var nodes = Array.isArray(triggerNodes) ? triggerNodes : [triggerNodes];
1047
+ nodes.forEach(function (node) {
1048
+ node.on("change", function () {
1049
+ return _this.toggleVisibility(condition());
1050
+ });
1051
+ var observer = new MutationObserver(function () {
1052
+ var display = window.getComputedStyle(node.visibilityController).display;
1053
+ _this.toggleVisibility(display !== "none" && condition());
1054
+ });
1055
+ observer.observe(node.visibilityController, {
1056
+ attributes: true,
1057
+ attributeFilter: ["style"]
1058
+ });
1059
+ });
1060
+ }
1061
+ } catch (e) {
1062
+ throw new ConditionalRenderingError(this, e);
1063
+ }
1064
+ }
1065
+ }, {
1066
+ key: "configureValidationAndRequirements",
1067
+ value: function configureValidationAndRequirements(_ref, fieldDisplayName) {
1068
+ var _this2 = this;
1069
+ var requirementLogic = _ref.requirementLogic,
1070
+ validationLogic = _ref.validationLogic;
1071
+ var dependencies = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1072
+ if (typeof Page_Validators !== "undefined") {
1073
+ var newValidator = document.createElement("span");
1074
+ newValidator.style.display = "none";
1075
+ newValidator.id = "".concat(this.id, "Validator");
1076
+ newValidator.controltovalidate = this.id;
1077
+ newValidator.errormessage = "<a href='#".concat(this.element.id, "_label'>").concat(fieldDisplayName, " is a required field</a>");
1078
+ newValidator.evaluationfunction = validationLogic.bind(this);
1079
+ //eslint-disable-next-line
1080
+ Page_Validators.push(newValidator);
1081
+ } else {
1082
+ throw new Error("Attempted to add to Validator where Page_Validators do not exist");
1083
+ }
1084
+ this.setRequiredLevel(requirementLogic(this));
1085
+ if (!dependencies) return;
1086
+ dependencies = Array.isArray(dependencies) ? dependencies : [dependencies];
1087
+ dependencies.forEach(function (dep) {
1088
+ dep.element.addEventListener("change", function () {
1089
+ return _this2.setRequiredLevel(requirementLogic(_this2));
1090
+ });
1091
+ });
1092
+ }
1093
+ }, {
1094
+ key: "setRequiredLevel",
1095
+ value: function setRequiredLevel(isRequired) {
1096
+ if (isRequired) {
1097
+ this.getLabel().classList.add("required-field");
1098
+ } else {
1099
+ this.getLabel().classList.remove("required-field");
1100
+ }
1101
+ }
1102
+ }, {
1103
+ key: "onceLoaded",
1104
+ value: function onceLoaded(callback) {
1105
+ var _this3 = this;
1106
+ if (this.isLoaded) {
1107
+ callback(this);
1108
+ } else {
1109
+ var observer = new MutationObserver(function () {
1110
+ if (document.querySelector(_this3.target)) {
1111
+ observer.disconnect(); // Stop observing once loaded
1112
+ _this3.isLoaded = true;
1113
+ callback(_this3); // Call the provided callback
1114
+ }
1115
+ });
1116
+ observer.observe(document.body, {
1117
+ subtree: true,
1118
+ childList: true
1119
+ });
1120
+ }
1121
+ }
1122
+ }]);
1123
+ }();
1124
+ /**
1125
+ * Creates and initializes a DOMNodeReference instance.
1126
+ * @async
1127
+ * @function createDOMNodeReference
1128
+ * @param {string | HTMLElement} target - The CSS selector for the desired DOM element.
1129
+ * @returns {Promise<DOMNodeReference>} A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
1130
+ */
1131
+ function createDOMNodeReference(_x) {
1132
+ return _createDOMNodeReference.apply(this, arguments);
1133
+ }
1134
+
1135
+ /**
1136
+ * Creates and initializes multiple DOMNodeReference instances.
1137
+ * @async
1138
+ * @function createMultipleDOMNodeReferences
1139
+ * @param {string} querySelector - The CSS selector for the desired DOM elements.
1140
+ * @returns {Promise<DOMNodeReference[]>} A promise that resolves to an array of Proxies of initialized DOMNodeReference instances.
1141
+ */
1142
+ function _createDOMNodeReference() {
1143
+ _createDOMNodeReference = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(target) {
1144
+ var instance;
1145
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1146
+ while (1) switch (_context3.prev = _context3.next) {
1147
+ case 0:
1148
+ _context3.prev = 0;
1149
+ instance = new DOMNodeReference(target);
1150
+ _context3.next = 4;
1151
+ return instance._init();
1152
+ case 4:
1153
+ return _context3.abrupt("return", new Proxy(instance, {
1154
+ get: function get(target, prop) {
1155
+ // do not proxy the initialization method
1156
+ // init() is only needed in this factory function
1157
+ if (prop.toString().startsWith("_")) return undefined;
1158
+
1159
+ // proxy the class to wrap all methods in the 'onceLoaded' method, to make sure the
1160
+ // element is always available before executing method
1161
+ var value = target[prop];
1162
+ if (typeof value === "function" && prop !== "onceLoaded") {
1163
+ return function () {
1164
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1165
+ args[_key2] = arguments[_key2];
1166
+ }
1167
+ return target.onceLoaded(function () {
1168
+ return value.apply(target, args);
1169
+ });
1170
+ };
1171
+ }
1172
+ return value;
1173
+ }
1174
+ }));
1175
+ case 7:
1176
+ _context3.prev = 7;
1177
+ _context3.t0 = _context3["catch"](0);
1178
+ console.error("There was an error creating a DOMNodeReference: ".concat(_context3.t0));
1179
+ throw new Error(_context3.t0);
1180
+ case 11:
1181
+ case "end":
1182
+ return _context3.stop();
1183
+ }
1184
+ }, _callee3, null, [[0, 7]]);
1185
+ }));
1186
+ return _createDOMNodeReference.apply(this, arguments);
1187
+ }
1188
+ function createMultipleDOMNodeReferences(_x2) {
1189
+ return _createMultipleDOMNodeReferences.apply(this, arguments);
1190
+ }
1191
+ function _createMultipleDOMNodeReferences() {
1192
+ _createMultipleDOMNodeReferences = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(querySelector) {
1193
+ var elements;
1194
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1195
+ while (1) switch (_context4.prev = _context4.next) {
1196
+ case 0:
1197
+ _context4.prev = 0;
1198
+ elements = Array.from(document.querySelectorAll(querySelector));
1199
+ _context4.next = 4;
1200
+ return Promise.all(elements.map(function (element) {
1201
+ return createDOMNodeReference(element);
1202
+ }));
1203
+ case 4:
1204
+ elements = _context4.sent;
1205
+ elements.hideAll = function () {
1206
+ return elements.forEach(function (instance) {
1207
+ return instance.hide();
1208
+ });
1209
+ };
1210
+ elements.showAll = function () {
1211
+ return elements.forEach(function (instance) {
1212
+ return instance.show();
1213
+ });
1214
+ };
1215
+ return _context4.abrupt("return", elements);
1216
+ case 10:
1217
+ _context4.prev = 10;
1218
+ _context4.t0 = _context4["catch"](0);
1219
+ console.error("There was an error creating multiple DOMNodeReferences: ".concat(_context4.t0));
1220
+ throw new Error(_context4.t0);
1221
+ case 14:
1222
+ case "end":
1223
+ return _context4.stop();
1224
+ }
1225
+ }, _callee4, null, [[0, 10]]);
1226
+ }));
1227
+ return _createMultipleDOMNodeReferences.apply(this, arguments);
1228
+ }
1229
+ ;// ./src/index.js
1230
+
1231
+
1232
+
1233
+ var __webpack_exports__API = __webpack_exports__.nC;
1234
+ var __webpack_exports__createDOMNodeReference = __webpack_exports__.mI;
1235
+ var __webpack_exports__createMultipleDOMNodeReferences = __webpack_exports__.xq;
1236
+ export { __webpack_exports__API as API, __webpack_exports__createDOMNodeReference as createDOMNodeReference, __webpack_exports__createMultipleDOMNodeReferences as createMultipleDOMNodeReferences };