@appius-fr/apx 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1612,7 +1612,6 @@ __webpack_require__.r(__webpack_exports__);
1612
1612
  /* harmony export */ toast: () => (/* binding */ toast)
1613
1613
  /* harmony export */ });
1614
1614
  /* harmony import */ var _css_toast_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./css/toast.css */ "./modules/toast/css/toast.css");
1615
- 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); }
1616
1615
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1617
1616
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1618
1617
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -1627,13 +1626,30 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
1627
1626
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1628
1627
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
1629
1628
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1629
+ 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); }
1630
1630
  // Minimal, framework-agnostic ToastManager for APX
1631
1631
  // ESM-first, no side effects on import. DOM only when used.
1632
1632
 
1633
1633
 
1634
+ /**
1635
+ * @typedef {Object} PositionObject
1636
+ * @property {'sticky'|'relative'|'anchored'} [type]
1637
+ * @property {string} [x]
1638
+ * @property {string} [y]
1639
+ * @property {HTMLElement} [element]
1640
+ * @property {'top'|'right'|'bottom'|'left'|'above'|'below'|'before'|'after'} [placement]
1641
+ * @property {string} [gap]
1642
+ * @property {boolean} [useNativeCSS]
1643
+ */
1644
+
1645
+ /**
1646
+ * @typedef {string|PositionObject} Position
1647
+ */
1648
+
1634
1649
  /**
1635
1650
  * @typedef {Object} ToastConfig
1636
- * @property {'bottom-right'|'bottom-left'|'top-right'|'top-left'} [position]
1651
+ * @property {Position} [position]
1652
+ * @property {'up'|'down'|'auto'} [flow] Flow direction for stacking toasts. 'auto' determines based on position. Default: 'auto'
1637
1653
  * @property {number} [maxToasts]
1638
1654
  * @property {number} [defaultDurationMs]
1639
1655
  * @property {number} [zIndex]
@@ -1642,6 +1658,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
1642
1658
  * @property {boolean} [dedupe]
1643
1659
  * @property {string} [containerClass]
1644
1660
  * @property {number} [offset]
1661
+ * @property {string} [id]
1645
1662
  */
1646
1663
 
1647
1664
  /**
@@ -1654,6 +1671,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
1654
1671
  * @property {(ref: ToastRef, ev: MouseEvent) => void} [onClick]
1655
1672
  * @property {(ref: ToastRef, reason: 'timeout'|'close'|'api'|'overflow') => void} [onClose]
1656
1673
  * @property {string} [className]
1674
+ * @property {Position} [position]
1675
+ * @property {'up'|'down'|'auto'} [flow] Flow direction for stacking toasts. 'auto' determines based on position. Default: 'auto'
1657
1676
  */
1658
1677
 
1659
1678
  /**
@@ -1668,6 +1687,40 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
1668
1687
  */
1669
1688
 
1670
1689
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1690
+
1691
+ // Shared container cache: Map<position, HTMLElement>
1692
+ // Containers are shared between managers with the same position
1693
+ var _containerCache = new Map();
1694
+
1695
+ // Garbage collection: cleanup empty unmanaged containers after a delay
1696
+ var GC_DELAY_MS = 20000; // 20 seconds
1697
+ var _gcTimeoutId = null;
1698
+
1699
+ // Wrapper for all toast containers (keeps DOM clean)
1700
+ var _toastWrapper = null;
1701
+
1702
+ /**
1703
+ * Get or create the toast containers wrapper
1704
+ * @returns {HTMLElement|null}
1705
+ */
1706
+ function getToastWrapper() {
1707
+ if (!isBrowser) return null;
1708
+ if (!_toastWrapper) {
1709
+ _toastWrapper = document.querySelector('.APX-toast-wrapper');
1710
+ if (!_toastWrapper) {
1711
+ _toastWrapper = createEl('div', 'APX-toast-wrapper');
1712
+ _toastWrapper.style.position = 'fixed';
1713
+ _toastWrapper.style.top = '0';
1714
+ _toastWrapper.style.left = '0';
1715
+ _toastWrapper.style.width = '0';
1716
+ _toastWrapper.style.height = '0';
1717
+ _toastWrapper.style.pointerEvents = 'none';
1718
+ _toastWrapper.style.zIndex = '10000'; // Below containers but above most content
1719
+ document.body.appendChild(_toastWrapper);
1720
+ }
1721
+ }
1722
+ return _toastWrapper;
1723
+ }
1671
1724
  var DEFAULT_CONFIG = {
1672
1725
  position: 'bottom-right',
1673
1726
  maxToasts: 5,
@@ -1693,6 +1746,194 @@ function createEl(tag, classNames) {
1693
1746
  return el;
1694
1747
  }
1695
1748
 
1749
+ /**
1750
+ * Normalize placement synonyms to CSS values
1751
+ * @param {string} placement
1752
+ * @returns {'top'|'right'|'bottom'|'left'}
1753
+ */
1754
+ function normalizePlacement(placement) {
1755
+ var synonyms = {
1756
+ 'above': 'top',
1757
+ 'below': 'bottom',
1758
+ 'before': 'left',
1759
+ 'after': 'right'
1760
+ };
1761
+ return synonyms[placement] || placement;
1762
+ }
1763
+
1764
+ /**
1765
+ * Determine flow direction based on position
1766
+ * @param {Position} position
1767
+ * @returns {'up'|'down'}
1768
+ */
1769
+ function determineFlow(position) {
1770
+ if (typeof position === 'string') {
1771
+ // String positions: top = up, bottom = down
1772
+ if (position.includes('top')) return 'up';
1773
+ if (position.includes('bottom')) return 'down';
1774
+ return 'down'; // default
1775
+ }
1776
+
1777
+ if (_typeof(position) === 'object' && position !== null) {
1778
+ var type = position.type || (position.x || position.y ? 'sticky' : null);
1779
+ if (type === 'sticky' || !type && (position.x || position.y)) {
1780
+ // Sticky: determine based on y coordinate
1781
+ if (position.y !== undefined) {
1782
+ // If y starts with '-' or is a small value, likely top (up)
1783
+ // If y is a large value or percentage, likely bottom (down)
1784
+ if (position.y.startsWith('-')) {
1785
+ // Negative = from bottom, so flow down
1786
+ return 'down';
1787
+ }
1788
+ var num = parseFloat(position.y);
1789
+ if (!isNaN(num)) {
1790
+ // If y < 50% of viewport height, likely top (up)
1791
+ // Otherwise likely bottom (down)
1792
+ if (position.y.includes('%')) {
1793
+ return num < 50 ? 'up' : 'down';
1794
+ }
1795
+ // For px values, assume < 400px is top (up)
1796
+ return num < 400 ? 'up' : 'down';
1797
+ }
1798
+ }
1799
+ return 'down'; // default
1800
+ }
1801
+
1802
+ if (type === 'anchored' && position.placement) {
1803
+ // Anchored: placement determines flow
1804
+ var placement = normalizePlacement(position.placement);
1805
+ if (placement === 'top' || placement === 'above') return 'up';
1806
+ if (placement === 'bottom' || placement === 'below') return 'down';
1807
+ // For left/right, default to down
1808
+ return 'down';
1809
+ }
1810
+ if (type === 'relative') {
1811
+ // Relative: determine based on y offset
1812
+ if (position.y !== undefined) {
1813
+ var _num = parseFloat(position.y);
1814
+ if (!isNaN(_num)) {
1815
+ // Negative y = above element = flow up
1816
+ // Positive y = below element = flow down
1817
+ return _num < 0 ? 'up' : 'down';
1818
+ }
1819
+ }
1820
+ return 'down'; // default
1821
+ }
1822
+ }
1823
+
1824
+ return 'down'; // default
1825
+ }
1826
+
1827
+ /**
1828
+ * Garbage collection: remove empty unmanaged containers
1829
+ */
1830
+ function cleanupEmptyContainers() {
1831
+ if (!isBrowser) return;
1832
+ var containers = document.querySelectorAll('.APX-toast-container:not([data-apx-toast-managed="true"])');
1833
+ containers.forEach(function (container) {
1834
+ // Check if container is empty (no toasts)
1835
+ if (container.children.length === 0) {
1836
+ var positionKey = container.getAttribute('data-apx-toast-position');
1837
+ if (positionKey) {
1838
+ _containerCache["delete"](positionKey);
1839
+ }
1840
+ container.remove();
1841
+ }
1842
+ });
1843
+
1844
+ // Clean up wrapper if it's empty (all containers removed)
1845
+ if (_toastWrapper && _toastWrapper.children.length === 0) {
1846
+ _toastWrapper.remove();
1847
+ _toastWrapper = null;
1848
+ }
1849
+ _gcTimeoutId = null;
1850
+ }
1851
+
1852
+ /**
1853
+ * Schedule garbage collection for empty unmanaged containers
1854
+ */
1855
+ function scheduleGarbageCollection() {
1856
+ if (_gcTimeoutId) {
1857
+ clearTimeout(_gcTimeoutId);
1858
+ }
1859
+ _gcTimeoutId = setTimeout(cleanupEmptyContainers, GC_DELAY_MS);
1860
+ }
1861
+
1862
+ /**
1863
+ * Find all scrollable parent elements
1864
+ * @param {HTMLElement} element
1865
+ * @returns {HTMLElement[]}
1866
+ */
1867
+ function findScrollableParents(element) {
1868
+ var scrollables = [];
1869
+ var current = element.parentElement;
1870
+ while (current && current !== document.body && current !== document.documentElement) {
1871
+ var style = window.getComputedStyle(current);
1872
+ var overflow = style.overflow + style.overflowY + style.overflowX;
1873
+ if (overflow.includes('scroll') || overflow.includes('auto')) {
1874
+ scrollables.push(current);
1875
+ }
1876
+ current = current.parentElement;
1877
+ }
1878
+ return scrollables;
1879
+ }
1880
+
1881
+ /**
1882
+ * Hash an element to create a unique identifier
1883
+ * @param {HTMLElement} el
1884
+ * @returns {string}
1885
+ */
1886
+ function hashElement(el) {
1887
+ var rect = el.getBoundingClientRect();
1888
+ var str = "".concat(el.tagName, "_").concat(rect.left, "_").concat(rect.top, "_").concat(rect.width, "_").concat(rect.height);
1889
+ var hash = 0;
1890
+ for (var i = 0; i < str.length; i++) {
1891
+ var _char = str.charCodeAt(i);
1892
+ hash = (hash << 5) - hash + _char;
1893
+ hash = hash & hash; // Convert to 32bit integer
1894
+ }
1895
+
1896
+ return Math.abs(hash).toString(36);
1897
+ }
1898
+
1899
+ /**
1900
+ * Serialize position options into a unique key
1901
+ * @param {Position} position
1902
+ * @returns {string}
1903
+ */
1904
+ function serializePosition(position) {
1905
+ if (typeof position === 'string') {
1906
+ return "s:".concat(position);
1907
+ }
1908
+ if (_typeof(position) === 'object' && position !== null) {
1909
+ var parts = [];
1910
+
1911
+ // Type (default: sticky if x/y provided)
1912
+ var type = position.type || (position.x || position.y ? 'sticky' : null);
1913
+ if (type) parts.push("t:".concat(type));
1914
+
1915
+ // Coordinates
1916
+ if (position.x !== undefined) parts.push("x:".concat(position.x));
1917
+ if (position.y !== undefined) parts.push("y:".concat(position.y));
1918
+
1919
+ // For relative/anchored: use element ID or hash
1920
+ if (position.element) {
1921
+ var _position$element$dat;
1922
+ var elementId = position.element.id || ((_position$element$dat = position.element.dataset) === null || _position$element$dat === void 0 ? void 0 : _position$element$dat.apxToastAnchorId) || "el_".concat(hashElement(position.element));
1923
+ parts.push("el:".concat(elementId));
1924
+ }
1925
+ if (position.placement) {
1926
+ // Normalize placement for serialization (use CSS values)
1927
+ var normalized = normalizePlacement(position.placement);
1928
+ parts.push("p:".concat(normalized));
1929
+ }
1930
+ if (position.gap !== undefined) parts.push("g:".concat(position.gap));
1931
+ if (position.useNativeCSS) parts.push("native:true");
1932
+ return "o:".concat(parts.join('|'));
1933
+ }
1934
+ return 's:bottom-right';
1935
+ }
1936
+
1696
1937
  /**
1697
1938
  * ToastManager class
1698
1939
  */
@@ -1747,9 +1988,17 @@ var ToastManager = /*#__PURE__*/function () {
1747
1988
  _ref.update(options);
1748
1989
  return _ref;
1749
1990
  }
1991
+
1992
+ // Determine position and flow for this toast (options take precedence over config)
1993
+ var position = options.position || this.config.position || 'bottom-right';
1994
+ var flow = options.flow !== undefined ? options.flow : this.config.flow !== undefined ? this.config.flow : 'auto';
1995
+ var finalFlow = flow === 'auto' ? determineFlow(position) : flow;
1996
+
1997
+ // Ensure default container is set (for backward compatibility)
1750
1998
  this.ensureContainer();
1751
1999
  var toastEl = createEl('div', "APX-toast APX-toast--".concat(options.type));
1752
2000
  toastEl.setAttribute('role', 'status');
2001
+ // Priority: options.id > config.id > auto-generated
1753
2002
  var toastId = options.id || "t_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 8));
1754
2003
  toastEl.dataset.toastId = toastId;
1755
2004
  if (options.className) toastEl.className += " ".concat(options.className);
@@ -1767,7 +2016,172 @@ var ToastManager = /*#__PURE__*/function () {
1767
2016
  closeBtn.type = 'button';
1768
2017
  toastEl.appendChild(closeBtn);
1769
2018
  }
1770
- this.container.appendChild(toastEl);
2019
+
2020
+ // Get or create container for this specific position
2021
+ var container = null;
2022
+ var positionUpdateFn = null;
2023
+ var positionCleanup = null;
2024
+ var originalElementStyle = null;
2025
+ if (position && _typeof(position) === 'object' && position !== null) {
2026
+ var type = position.type || (position.x || position.y ? 'sticky' : null);
2027
+ if (position.useNativeCSS && (type === 'relative' || type === 'anchored') && position.element) {
2028
+ // useNativeCSS: true - create container in target element using native CSS
2029
+ var targetEl = position.element;
2030
+ originalElementStyle = targetEl.style.position;
2031
+ targetEl.style.position = 'relative';
2032
+
2033
+ // Create a container for stacking toasts (reuse if exists)
2034
+ var positionKey = serializePosition(position);
2035
+ var nativeContainer = targetEl.querySelector("[data-apx-toast-position=\"".concat(positionKey, "\"]"));
2036
+ if (!nativeContainer) {
2037
+ nativeContainer = createEl('div', 'APX-toast-container APX-toast-container-native');
2038
+ nativeContainer.setAttribute('data-apx-toast-position', positionKey);
2039
+ nativeContainer.style.position = 'absolute';
2040
+ nativeContainer.style.zIndex = String(this.config.zIndex);
2041
+ nativeContainer.style.gap = "".concat(this.config.gap, "px");
2042
+ nativeContainer.setAttribute('aria-live', String(this.config.ariaLive));
2043
+ nativeContainer.style.flexDirection = finalFlow === 'up' ? 'column-reverse' : 'column';
2044
+
2045
+ // Apply positioning to container
2046
+ if (type === 'relative') {
2047
+ // Relative: use x/y directly
2048
+ if (position.x !== undefined) {
2049
+ if (position.x.startsWith('-')) {
2050
+ nativeContainer.style.right = position.x.substring(1);
2051
+ } else {
2052
+ nativeContainer.style.left = position.x;
2053
+ }
2054
+ }
2055
+ if (position.y !== undefined) {
2056
+ if (position.y.startsWith('-')) {
2057
+ nativeContainer.style.bottom = position.y.substring(1);
2058
+ } else {
2059
+ nativeContainer.style.top = position.y;
2060
+ }
2061
+ }
2062
+ } else if (type === 'anchored') {
2063
+ // Anchored: position outside the element using 100% (element size) + gap
2064
+ var placement = normalizePlacement(position.placement);
2065
+ var gap = position.gap || '1em';
2066
+ switch (placement) {
2067
+ case 'top':
2068
+ nativeContainer.style.bottom = "calc(100% + ".concat(gap, ")");
2069
+ nativeContainer.style.left = '0';
2070
+ break;
2071
+ case 'bottom':
2072
+ nativeContainer.style.top = "calc(100% + ".concat(gap, ")");
2073
+ nativeContainer.style.left = '0';
2074
+ break;
2075
+ case 'left':
2076
+ nativeContainer.style.right = "calc(100% + ".concat(gap, ")");
2077
+ nativeContainer.style.top = '0';
2078
+ break;
2079
+ case 'right':
2080
+ nativeContainer.style.left = "calc(100% + ".concat(gap, ")");
2081
+ nativeContainer.style.top = '0';
2082
+ break;
2083
+ }
2084
+ }
2085
+ targetEl.appendChild(nativeContainer);
2086
+ } else {
2087
+ // Update flow direction if container exists
2088
+ nativeContainer.style.flexDirection = finalFlow === 'up' ? 'column-reverse' : 'column';
2089
+ }
2090
+ container = nativeContainer;
2091
+ positionCleanup = function positionCleanup() {
2092
+ if (targetEl && targetEl.parentElement) {
2093
+ targetEl.style.position = originalElementStyle || '';
2094
+ // Remove native container if empty
2095
+ if (nativeContainer && nativeContainer.children.length === 0) {
2096
+ var _positionKey = nativeContainer.getAttribute('data-apx-toast-position');
2097
+ if (_positionKey) {
2098
+ _containerCache["delete"](_positionKey);
2099
+ }
2100
+ nativeContainer.remove();
2101
+ }
2102
+ }
2103
+ };
2104
+ } else {
2105
+ // Default: get or create container for this position
2106
+ container = this.getContainerForPosition(position, finalFlow);
2107
+ var updateContainerPosition = function updateContainerPosition() {
2108
+ var styles = _this.calculatePosition(position, container);
2109
+ Object.assign(container.style, styles);
2110
+ };
2111
+ updateContainerPosition();
2112
+
2113
+ // For relative/anchored, listen to scroll/resize
2114
+ if ((type === 'relative' || type === 'anchored') && position.element) {
2115
+ var rafId = null;
2116
+ var lastUpdate = 0;
2117
+ var throttleMs = 16; // ~60fps
2118
+
2119
+ var throttledUpdate = function throttledUpdate() {
2120
+ var now = Date.now();
2121
+ if (now - lastUpdate < throttleMs) {
2122
+ if (rafId) cancelAnimationFrame(rafId);
2123
+ rafId = requestAnimationFrame(function () {
2124
+ updateContainerPosition();
2125
+ lastUpdate = Date.now();
2126
+ });
2127
+ } else {
2128
+ updateContainerPosition();
2129
+ lastUpdate = now;
2130
+ }
2131
+ };
2132
+
2133
+ // Find all scrollable parents
2134
+ var scrollableParents = findScrollableParents(position.element);
2135
+
2136
+ // Listen to scroll on window and all scrollable parents
2137
+ window.addEventListener('scroll', throttledUpdate, {
2138
+ passive: true
2139
+ });
2140
+ window.addEventListener('resize', throttledUpdate, {
2141
+ passive: true
2142
+ });
2143
+
2144
+ // Listen to scroll on all scrollable parent elements
2145
+ scrollableParents.forEach(function (parent) {
2146
+ parent.addEventListener('scroll', throttledUpdate, {
2147
+ passive: true
2148
+ });
2149
+ });
2150
+
2151
+ // Watch for element removal
2152
+ var observer = new MutationObserver(function () {
2153
+ if (!position.element.parentElement) {
2154
+ ref.close('api');
2155
+ }
2156
+ });
2157
+ observer.observe(document.body, {
2158
+ childList: true,
2159
+ subtree: true
2160
+ });
2161
+ positionUpdateFn = updateContainerPosition;
2162
+ positionCleanup = function positionCleanup() {
2163
+ window.removeEventListener('scroll', throttledUpdate);
2164
+ window.removeEventListener('resize', throttledUpdate);
2165
+ scrollableParents.forEach(function (parent) {
2166
+ parent.removeEventListener('scroll', throttledUpdate);
2167
+ });
2168
+ observer.disconnect();
2169
+ if (rafId) cancelAnimationFrame(rafId);
2170
+ };
2171
+ }
2172
+ }
2173
+ } else {
2174
+ // String position - get or create container for this position
2175
+ container = this.getContainerForPosition(position, finalFlow);
2176
+ }
2177
+
2178
+ // Append toast to the appropriate container
2179
+ if (container) {
2180
+ container.appendChild(toastEl);
2181
+ } else {
2182
+ // Fallback to default container
2183
+ this.container.appendChild(toastEl);
2184
+ }
1771
2185
 
1772
2186
  // Enter animation
1773
2187
  toastEl.classList.add('APX-toast--enter');
@@ -1864,6 +2278,13 @@ var ToastManager = /*#__PURE__*/function () {
1864
2278
  var cleanup = function cleanup(reason) {
1865
2279
  if (!toastEl) return;
1866
2280
  pauseTimer();
2281
+
2282
+ // Cleanup position listeners and restore styles
2283
+ if (positionCleanup) {
2284
+ positionCleanup();
2285
+ positionCleanup = null;
2286
+ }
2287
+
1867
2288
  // If overflow, remove immediately to enforce hard cap
1868
2289
  if (reason === 'overflow') {
1869
2290
  if (toastEl.parentElement) toastEl.parentElement.removeChild(toastEl);
@@ -1885,6 +2306,9 @@ var ToastManager = /*#__PURE__*/function () {
1885
2306
  var idx = _this.open.indexOf(ref);
1886
2307
  if (idx >= 0) _this.open.splice(idx, 1);
1887
2308
  _this.idToRef["delete"](toastId);
2309
+
2310
+ // Schedule garbage collection for unmanaged containers
2311
+ scheduleGarbageCollection();
1888
2312
  finish(reason);
1889
2313
  };
1890
2314
  toastEl.addEventListener('transitionend', removeEl);
@@ -1984,42 +2408,245 @@ var ToastManager = /*#__PURE__*/function () {
1984
2408
  if (!o.type) o.type = 'info';
1985
2409
  if (typeof o.dismissible !== 'boolean') o.dismissible = true;
1986
2410
  if (typeof o.durationMs !== 'number') o.durationMs = this.config.defaultDurationMs;
2411
+ // Use id from options if provided, otherwise use id from config, otherwise undefined (will be auto-generated)
2412
+ if (!o.id && this.config.id) o.id = this.config.id;
1987
2413
  return o;
1988
2414
  }
2415
+
2416
+ /**
2417
+ * Find or create a container for a specific position
2418
+ * @param {Position} position
2419
+ * @param {'up'|'down'} [flow] Flow direction (already determined, not 'auto')
2420
+ * @param {boolean} [managed] Whether this container is managed by a manager (default: false)
2421
+ * @returns {HTMLElement|null}
2422
+ */
2423
+ }, {
2424
+ key: "getContainerForPosition",
2425
+ value: function getContainerForPosition(position, flow) {
2426
+ var managed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2427
+ if (!isBrowser) return null;
2428
+ var positionKey = serializePosition(position);
2429
+
2430
+ // Flow should already be determined ('up' or 'down'), but fallback to auto if needed
2431
+ var finalFlow = flow && flow !== 'auto' ? flow : determineFlow(position);
2432
+
2433
+ // 1. Check memory cache
2434
+ var c = _containerCache.get(positionKey);
2435
+
2436
+ // 2. If not in cache, search in DOM by data attribute
2437
+ if (!c && isBrowser) {
2438
+ c = document.querySelector("[data-apx-toast-position=\"".concat(positionKey, "\"]"));
2439
+ if (c) {
2440
+ _containerCache.set(positionKey, c);
2441
+ }
2442
+ }
2443
+
2444
+ // 3. If still not found, create new container
2445
+ if (!c) {
2446
+ c = createEl('div', 'APX-toast-container');
2447
+ c.setAttribute('data-apx-toast-position', positionKey);
2448
+
2449
+ // Mark as managed if created by a manager
2450
+ if (managed) {
2451
+ c.setAttribute('data-apx-toast-managed', 'true');
2452
+ }
2453
+
2454
+ // Determine position class (for CSS)
2455
+ var posClass = typeof position === 'string' ? position : position.type || 'bottom-right';
2456
+ c.classList.add("APX-toast-container--".concat(posClass));
2457
+ c.setAttribute('aria-live', String(this.config.ariaLive));
2458
+ c.style.zIndex = String(this.config.zIndex);
2459
+ c.style.gap = "".concat(this.config.gap, "px");
2460
+
2461
+ // Apply flow direction
2462
+ c.style.flexDirection = finalFlow === 'up' ? 'column-reverse' : 'column';
2463
+
2464
+ // Apply position styles if object position
2465
+ if (_typeof(position) === 'object' && position !== null) {
2466
+ c.style.position = 'fixed';
2467
+ var styles = this.calculatePosition(position, c);
2468
+ Object.assign(c.style, styles);
2469
+ }
2470
+
2471
+ // Append to wrapper for clean DOM organization
2472
+ var wrapper = getToastWrapper();
2473
+ if (wrapper) {
2474
+ wrapper.appendChild(c);
2475
+ } else {
2476
+ document.body.appendChild(c);
2477
+ }
2478
+ _containerCache.set(positionKey, c);
2479
+ } else {
2480
+ // Update flow direction if container exists (may be shared)
2481
+ c.style.flexDirection = finalFlow === 'up' ? 'column-reverse' : 'column';
2482
+
2483
+ // If container exists and is now managed, mark it
2484
+ if (managed && !c.hasAttribute('data-apx-toast-managed')) {
2485
+ c.setAttribute('data-apx-toast-managed', 'true');
2486
+ }
2487
+ }
2488
+ return c;
2489
+ }
1989
2490
  }, {
1990
2491
  key: "ensureContainer",
1991
2492
  value: function ensureContainer() {
1992
2493
  if (this.container || !isBrowser) return;
1993
- var c = createEl('div', 'APX-toast-container');
1994
- var pos = this.config.position || 'bottom-right';
1995
- c.classList.add("APX-toast-container--".concat(pos));
1996
- if (this.config.containerClass) c.classList.add(this.config.containerClass);
1997
- c.style.zIndex = String(this.config.zIndex);
1998
- c.style.gap = "".concat(this.config.gap, "px");
1999
- if (this.config.offset) {
2000
- var offset = "".concat(this.config.offset, "px");
2001
- if (pos.includes('bottom')) c.style.bottom = offset;else c.style.top = offset;
2002
- if (pos.includes('right')) c.style.right = offset;else c.style.left = offset;
2003
- }
2004
- c.setAttribute('aria-live', String(this.config.ariaLive));
2005
- document.body.appendChild(c);
2006
- this.container = c;
2494
+ var position = this.config.position || 'bottom-right';
2495
+ var flow = this.config.flow !== undefined ? this.config.flow : 'auto';
2496
+ // Containers created by ensureContainer are managed
2497
+ this.container = this.getContainerForPosition(position, flow, true);
2007
2498
  this.applyContainerConfig();
2008
2499
  }
2009
2500
  }, {
2010
2501
  key: "applyContainerConfig",
2011
2502
  value: function applyContainerConfig() {
2012
- var _this$container$class;
2503
+ var _this2 = this;
2013
2504
  if (!this.container) return;
2505
+ var position = this.config.position || 'bottom-right';
2506
+ var pos = typeof position === 'string' ? position : position.type || 'bottom-right';
2507
+
2508
+ // Apply styles (these may be overridden by other managers sharing the container)
2014
2509
  this.container.style.zIndex = String(this.config.zIndex);
2015
2510
  this.container.style.gap = "".concat(this.config.gap, "px");
2016
2511
  this.container.setAttribute('aria-live', String(this.config.ariaLive));
2017
- // Update position class
2018
- var posClasses = ['bottom-right', 'bottom-left', 'top-right', 'top-left'].map(function (p) {
2019
- return "APX-toast-container--".concat(p);
2020
- });
2021
- (_this$container$class = this.container.classList).remove.apply(_this$container$class, _toConsumableArray(posClasses));
2022
- this.container.classList.add("APX-toast-container--".concat(this.config.position));
2512
+
2513
+ // Update position class (only for string positions)
2514
+ if (typeof position === 'string') {
2515
+ var _this$container$class;
2516
+ var posClasses = ['bottom-right', 'bottom-left', 'top-right', 'top-left'].map(function (p) {
2517
+ return "APX-toast-container--".concat(p);
2518
+ });
2519
+ (_this$container$class = this.container.classList).remove.apply(_this$container$class, _toConsumableArray(posClasses));
2520
+ this.container.classList.add("APX-toast-container--".concat(pos));
2521
+ }
2522
+
2523
+ // Apply container class if specified
2524
+ if (this.config.containerClass) {
2525
+ this.config.containerClass.split(' ').filter(Boolean).forEach(function (cls) {
2526
+ _this2.container.classList.add(cls);
2527
+ });
2528
+ }
2529
+
2530
+ // Apply offset (only for string positions)
2531
+ if (typeof position === 'string') {
2532
+ if (this.config.offset) {
2533
+ var offset = "".concat(this.config.offset, "px");
2534
+ if (pos.includes('bottom')) this.container.style.bottom = offset;else this.container.style.top = offset;
2535
+ if (pos.includes('right')) this.container.style.right = offset;else this.container.style.left = offset;
2536
+ } else {
2537
+ // Reset offset if not specified
2538
+ if (pos.includes('bottom')) this.container.style.bottom = '';else this.container.style.top = '';
2539
+ if (pos.includes('right')) this.container.style.right = '';else this.container.style.left = '';
2540
+ }
2541
+ } else if (_typeof(position) === 'object' && position !== null) {
2542
+ // For object positions, ensure container has position: fixed
2543
+ this.container.style.position = 'fixed';
2544
+ }
2545
+ }
2546
+
2547
+ /**
2548
+ * Calculate position for a container based on position config
2549
+ * @param {Position} position
2550
+ * @param {HTMLElement} containerEl
2551
+ * @returns {{left?: string, top?: string, right?: string, bottom?: string}}
2552
+ */
2553
+ }, {
2554
+ key: "calculatePosition",
2555
+ value: function calculatePosition(position, containerEl) {
2556
+ if (typeof position === 'string') {
2557
+ // String positions are handled by container CSS
2558
+ return {};
2559
+ }
2560
+ if (_typeof(position) === 'object' && position !== null) {
2561
+ var type = position.type || (position.x || position.y ? 'sticky' : null);
2562
+ if (type === 'sticky' || !type && (position.x || position.y)) {
2563
+ // Sticky: fixed position relative to viewport
2564
+ var styles = {};
2565
+ if (position.x !== undefined) {
2566
+ if (position.x.startsWith('-')) {
2567
+ styles.right = position.x.substring(1);
2568
+ } else {
2569
+ styles.left = position.x;
2570
+ }
2571
+ }
2572
+ if (position.y !== undefined) {
2573
+ if (position.y.startsWith('-')) {
2574
+ styles.bottom = position.y.substring(1);
2575
+ } else {
2576
+ styles.top = position.y;
2577
+ }
2578
+ }
2579
+ return styles;
2580
+ }
2581
+ if (type === 'relative' && position.element) {
2582
+ // Relative: position relative to element with x/y offset
2583
+ // Use fixed positioning, so getBoundingClientRect() is relative to viewport
2584
+ var rect = position.element.getBoundingClientRect();
2585
+
2586
+ // Parse x/y offsets (can be px, em, etc.)
2587
+ var parseOffset = function parseOffset(val) {
2588
+ if (!val) return 0;
2589
+ var num = parseFloat(val);
2590
+ if (val.includes('em')) {
2591
+ // Convert em to px (approximate: 1em = 16px)
2592
+ return num * 16;
2593
+ }
2594
+ return num;
2595
+ };
2596
+ var offsetX = parseOffset(position.x || '0');
2597
+ var offsetY = parseOffset(position.y || '0');
2598
+ var _styles = {
2599
+ left: "".concat(rect.left + offsetX, "px"),
2600
+ top: "".concat(rect.top + offsetY, "px")
2601
+ };
2602
+ return _styles;
2603
+ }
2604
+ if (type === 'anchored' && position.element) {
2605
+ // Anchored: position relative to element with placement
2606
+ var _rect = position.element.getBoundingClientRect();
2607
+ var gap = position.gap || '1em';
2608
+
2609
+ // Parse gap (can be px, em, etc.)
2610
+ var parseGap = function parseGap(val) {
2611
+ var num = parseFloat(val);
2612
+ if (val.includes('em')) {
2613
+ return num * 16; // Approximate: 1em = 16px
2614
+ }
2615
+
2616
+ return num;
2617
+ };
2618
+ var gapPx = parseGap(gap);
2619
+ var _styles2 = {};
2620
+
2621
+ // Normalize placement synonyms (above/below/before/after) to CSS values
2622
+ var placement = normalizePlacement(position.placement);
2623
+ switch (placement) {
2624
+ case 'top':
2625
+ // Toast above element: bottom of toast = top of element - gap
2626
+ // bottom = viewport height - (element top - gap) = viewport height - element top + gap
2627
+ _styles2.bottom = "".concat(window.innerHeight - _rect.top + gapPx, "px");
2628
+ _styles2.left = "".concat(_rect.left, "px");
2629
+ break;
2630
+ case 'bottom':
2631
+ // Toast below element: top of toast = bottom of element + gap
2632
+ _styles2.top = "".concat(_rect.bottom + gapPx, "px");
2633
+ _styles2.left = "".concat(_rect.left, "px");
2634
+ break;
2635
+ case 'left':
2636
+ // Toast to the left: right of toast = left of element - gap
2637
+ _styles2.right = "".concat(window.innerWidth - _rect.left + gapPx, "px");
2638
+ _styles2.top = "".concat(_rect.top, "px");
2639
+ break;
2640
+ case 'right':
2641
+ // Toast to the right: left of toast = right of element + gap
2642
+ _styles2.left = "".concat(_rect.right + gapPx, "px");
2643
+ _styles2.top = "".concat(_rect.top, "px");
2644
+ break;
2645
+ }
2646
+ return _styles2;
2647
+ }
2648
+ }
2649
+ return {};
2023
2650
  }
2024
2651
  }]);
2025
2652
  return ToastManager;
@@ -2101,6 +2728,698 @@ Object.assign(toast, {
2101
2728
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (toast);
2102
2729
 
2103
2730
 
2731
+ /***/ }),
2732
+
2733
+ /***/ "./modules/tools/exports.mjs":
2734
+ /*!***********************************!*\
2735
+ !*** ./modules/tools/exports.mjs ***!
2736
+ \***********************************/
2737
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2738
+
2739
+ "use strict";
2740
+ __webpack_require__.r(__webpack_exports__);
2741
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2742
+ /* harmony export */ augmentWithPack: () => (/* reexport safe */ _form_packer_augment_apx_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
2743
+ /* harmony export */ packFormToJSON: () => (/* reexport safe */ _form_packer_packToJson_mjs__WEBPACK_IMPORTED_MODULE_1__.packFormToJSON),
2744
+ /* harmony export */ tools: () => (/* binding */ tools)
2745
+ /* harmony export */ });
2746
+ /* harmony import */ var _form_packer_augment_apx_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form-packer/augment-apx.mjs */ "./modules/tools/form-packer/augment-apx.mjs");
2747
+ /* harmony import */ var _form_packer_packToJson_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./form-packer/packToJson.mjs */ "./modules/tools/form-packer/packToJson.mjs");
2748
+ // Import des fonctions et modules des sous-modules
2749
+
2750
+
2751
+
2752
+ // Export de la fonction d'augmentation
2753
+
2754
+
2755
+ // Export des fonctions utilitaires
2756
+
2757
+
2758
+ // Export d'un objet tools pour faciliter l'utilisation
2759
+ var tools = {
2760
+ packFormToJSON: _form_packer_packToJson_mjs__WEBPACK_IMPORTED_MODULE_1__.packFormToJSON
2761
+ };
2762
+
2763
+ /***/ }),
2764
+
2765
+ /***/ "./modules/tools/form-packer/augment-apx.mjs":
2766
+ /*!***************************************************!*\
2767
+ !*** ./modules/tools/form-packer/augment-apx.mjs ***!
2768
+ \***************************************************/
2769
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2770
+
2771
+ "use strict";
2772
+ __webpack_require__.r(__webpack_exports__);
2773
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2774
+ /* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
2775
+ /* harmony export */ });
2776
+ /* harmony import */ var _packToJson_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./packToJson.mjs */ "./modules/tools/form-packer/packToJson.mjs");
2777
+
2778
+
2779
+ /**
2780
+ * Ajoute la méthode pack() aux objets APX pour convertir les formulaires en JSON
2781
+ * @param {Object} apx - L'objet APX à augmenter
2782
+ * @returns {Object} L'objet APX augmenté
2783
+ */
2784
+ /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(apx) {
2785
+ /**
2786
+ * Convertit le premier formulaire sélectionné en objet JSON
2787
+ * @returns {Object} L'objet JSON résultant
2788
+ * @throws {Error} Si aucun formulaire n'est trouvé ou si le premier élément n'est pas un formulaire
2789
+ * @example
2790
+ * const data = APX('form.myformclass').pack();
2791
+ */
2792
+ apx.pack = function () {
2793
+ var firstElement = this.first();
2794
+ if (!firstElement) {
2795
+ throw new Error('No element found');
2796
+ }
2797
+ if (firstElement.tagName !== 'FORM') {
2798
+ throw new Error('Element is not a form');
2799
+ }
2800
+ return (0,_packToJson_mjs__WEBPACK_IMPORTED_MODULE_0__.packFormToJSON)(firstElement);
2801
+ };
2802
+ return apx;
2803
+ }
2804
+
2805
+ /***/ }),
2806
+
2807
+ /***/ "./modules/tools/form-packer/packToJson.mjs":
2808
+ /*!**************************************************!*\
2809
+ !*** ./modules/tools/form-packer/packToJson.mjs ***!
2810
+ \**************************************************/
2811
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2812
+
2813
+ "use strict";
2814
+ __webpack_require__.r(__webpack_exports__);
2815
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2816
+ /* harmony export */ packFormToJSON: () => (/* binding */ packFormToJSON)
2817
+ /* harmony export */ });
2818
+ 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); }
2819
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2820
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2821
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
2822
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2823
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
2824
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
2825
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2826
+ /**
2827
+ * Convertit un formulaire HTML en objet JSON
2828
+ * @param {HTMLFormElement} form - Le formulaire à convertir
2829
+ * @returns {Object} L'objet JSON résultant
2830
+ * @throws {TypeError} Si form n'est pas un HTMLFormElement
2831
+ */
2832
+ var packFormToJSON = function packFormToJSON(form) {
2833
+ // Validation de l'entrée
2834
+ if (!form || !(form instanceof HTMLFormElement)) {
2835
+ throw new TypeError('packFormToJSON expects an HTMLFormElement');
2836
+ }
2837
+ var formData = new FormData(form);
2838
+ var jsonData = {};
2839
+
2840
+ /**
2841
+ * Construit une représentation string du chemin pour les messages d'erreur
2842
+ * @param {Array} parts - Les parties du chemin
2843
+ * @returns {string} Le chemin formaté
2844
+ */
2845
+ var buildPathString = function buildPathString(parts) {
2846
+ return parts.reduce(function (path, part) {
2847
+ if (part.type === 'key') {
2848
+ return path ? "".concat(path, "[").concat(part.name, "]") : part.name;
2849
+ }
2850
+ if (part.type === 'numeric') {
2851
+ return "".concat(path, "[").concat(part.index, "]");
2852
+ }
2853
+ if (part.type === 'array') {
2854
+ return "".concat(path, "[]");
2855
+ }
2856
+ return path;
2857
+ }, '');
2858
+ };
2859
+
2860
+ // ============================================================================
2861
+ // PHASE 1 : ANALYSE ET DÉTECTION DES CONFLITS
2862
+ // ============================================================================
2863
+
2864
+ /**
2865
+ * Structure pour stocker l'utilisation d'un chemin
2866
+ * @typedef {Object} PathUsage
2867
+ * @property {boolean} isFinal - Le chemin est utilisé comme valeur finale
2868
+ * @property {boolean} isIntermediate - Le chemin est utilisé comme chemin intermédiaire
2869
+ * @property {boolean} hasArraySuffix - Le chemin se termine par [] (crée des valeurs primitives)
2870
+ * @property {string} key - La clé du formulaire qui utilise ce chemin
2871
+ */
2872
+
2873
+ var pathUsage = new Map(); // Map<pathString, PathUsage>
2874
+ var keyAnalysis = new Map(); // Map<basePath, {hasNumeric: boolean, hasString: boolean}>
2875
+ var allEntries = [];
2876
+
2877
+ /**
2878
+ * Enregistre l'utilisation d'un chemin dans pathUsage
2879
+ * @param {string} currentPath - Le chemin à enregistrer
2880
+ * @param {boolean} isFinal - Si c'est une valeur finale
2881
+ * @param {boolean} isArraySuffix - Si le chemin se termine par []
2882
+ * @param {string} key - La clé du formulaire
2883
+ */
2884
+ var recordPathUsage = function recordPathUsage(currentPath, isFinal, isArraySuffix, key) {
2885
+ var _pathUsage$get;
2886
+ var usage = (_pathUsage$get = pathUsage.get(currentPath)) !== null && _pathUsage$get !== void 0 ? _pathUsage$get : {
2887
+ isFinal: false,
2888
+ isIntermediate: false,
2889
+ hasArraySuffix: false,
2890
+ key: key
2891
+ };
2892
+ if (!pathUsage.has(currentPath)) {
2893
+ pathUsage.set(currentPath, usage);
2894
+ }
2895
+ if (isFinal) {
2896
+ usage.isFinal = true;
2897
+ usage.key = key;
2898
+ if (isArraySuffix) {
2899
+ usage.hasArraySuffix = true;
2900
+ }
2901
+ } else {
2902
+ var _usage$key;
2903
+ usage.isIntermediate = true;
2904
+ (_usage$key = usage.key) !== null && _usage$key !== void 0 ? _usage$key : usage.key = key;
2905
+ }
2906
+ };
2907
+
2908
+ // Première passe : analyser toutes les clés et enregistrer les chemins
2909
+ var _iterator = _createForOfIteratorHelper(formData.entries()),
2910
+ _step;
2911
+ try {
2912
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2913
+ var _step$value = _slicedToArray(_step.value, 2),
2914
+ _key = _step$value[0],
2915
+ _value = _step$value[1];
2916
+ if (!_key) continue;
2917
+ allEntries.push({
2918
+ key: _key,
2919
+ value: _value
2920
+ });
2921
+ var _parts = parseKey(_key);
2922
+
2923
+ // Construire tous les chemins intermédiaires et le chemin final
2924
+ var currentPath = '';
2925
+ for (var _i4 = 0; _i4 < _parts.length; _i4++) {
2926
+ var _part = _parts[_i4];
2927
+ var _isLast = _i4 === _parts.length - 1;
2928
+ var isArraySuffix = _part.type === 'array';
2929
+
2930
+ // Construire le chemin jusqu'à ce niveau
2931
+ if (_part.type === 'key') {
2932
+ currentPath = currentPath ? "".concat(currentPath, "[").concat(_part.name, "]") : _part.name;
2933
+ } else if (_part.type === 'numeric') {
2934
+ currentPath = "".concat(currentPath, "[").concat(_part.index, "]");
2935
+ } else if (_part.type === 'array') {
2936
+ currentPath = "".concat(currentPath, "[]");
2937
+ }
2938
+
2939
+ // Enregistrer l'utilisation du chemin
2940
+ recordPathUsage(currentPath, _isLast, isArraySuffix && _isLast, _key);
2941
+ }
2942
+
2943
+ // Analyser chaque niveau de la hiérarchie pour détecter les conflits (indices numériques vs clés de chaîne)
2944
+ for (var _i5 = 0; _i5 < _parts.length - 1; _i5++) {
2945
+ var _part2 = _parts[_i5];
2946
+ var _nextPart = _parts[_i5 + 1];
2947
+
2948
+ // Analyser seulement les clés (pas les indices numériques)
2949
+ if (_part2.type === 'key') {
2950
+ var _keyAnalysis$get;
2951
+ var _basePath = _part2.name; // Le nom de la première clé dans le chemin
2952
+
2953
+ var analysis = (_keyAnalysis$get = keyAnalysis.get(_basePath)) !== null && _keyAnalysis$get !== void 0 ? _keyAnalysis$get : {
2954
+ hasNumeric: false,
2955
+ hasString: false
2956
+ };
2957
+ if (!keyAnalysis.has(_basePath)) {
2958
+ keyAnalysis.set(_basePath, analysis);
2959
+ }
2960
+ if (_nextPart) {
2961
+ if (_nextPart.type === 'numeric') {
2962
+ analysis.hasNumeric = true;
2963
+ } else if (_nextPart.type === 'key' || _nextPart.type === 'array') {
2964
+ analysis.hasString = true;
2965
+ }
2966
+ }
2967
+ }
2968
+ }
2969
+ }
2970
+
2971
+ /**
2972
+ * Détecte et lève une exception pour tous les conflits de chemins
2973
+ *
2974
+ * Principe simple : pour chaque chemin final (valeur primitive), vérifier si un chemin
2975
+ * intermédiaire commence par ce chemin suivi de '['. Si c'est le cas, c'est un conflit.
2976
+ *
2977
+ * Cette approche unifiée couvre tous les cas :
2978
+ * - items[] (final) vs items[0][name] (intermédiaire)
2979
+ * - array[3] (final) vs array[3][nested] (intermédiaire)
2980
+ * - data[key] (final) vs data[key][sub] (intermédiaire)
2981
+ */
2982
+ } catch (err) {
2983
+ _iterator.e(err);
2984
+ } finally {
2985
+ _iterator.f();
2986
+ }
2987
+ var detectPathConflicts = function detectPathConflicts() {
2988
+ // 1. Collecter tous les chemins finaux (valeurs primitives)
2989
+ var finalPaths = new Set();
2990
+ var finalPathKeys = new Map(); // Pour les messages d'erreur
2991
+ var _iterator2 = _createForOfIteratorHelper(pathUsage.entries()),
2992
+ _step2;
2993
+ try {
2994
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2995
+ var _step2$value = _slicedToArray(_step2.value, 2),
2996
+ path = _step2$value[0],
2997
+ usage = _step2$value[1];
2998
+ if (usage.isFinal) {
2999
+ finalPaths.add(path);
3000
+ finalPathKeys.set(path, usage.key);
3001
+ }
3002
+ }
3003
+
3004
+ // 2. Pour chaque chemin intermédiaire, vérifier s'il commence par un chemin final
3005
+ } catch (err) {
3006
+ _iterator2.e(err);
3007
+ } finally {
3008
+ _iterator2.f();
3009
+ }
3010
+ var _iterator3 = _createForOfIteratorHelper(pathUsage.entries()),
3011
+ _step3;
3012
+ try {
3013
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3014
+ var _step3$value = _slicedToArray(_step3.value, 2),
3015
+ _path = _step3$value[0],
3016
+ _usage = _step3$value[1];
3017
+ if (_usage.isIntermediate) {
3018
+ var _iterator4 = _createForOfIteratorHelper(finalPaths),
3019
+ _step4;
3020
+ try {
3021
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3022
+ var finalPath = _step4.value;
3023
+ // Vérifier si ce chemin intermédiaire commence par un chemin final suivi de '['
3024
+ // Exemple: finalPath = "array[3]", path = "array[3][nested]" → conflit
3025
+ if (_path.startsWith("".concat(finalPath, "["))) {
3026
+ throw new Error("Path conflict: \"".concat(finalPath, "\" is used as a final value (in field \"").concat(finalPathKeys.get(finalPath), "\"), ") + "but \"".concat(_path, "\" tries to use it as an intermediate path (in field \"").concat(_usage.key, "\"). ") + "This creates incompatible data structures. " + "You cannot use \"".concat(finalPath, "\" as a primitive value and then access it as an object."));
3027
+ }
3028
+ }
3029
+ } catch (err) {
3030
+ _iterator4.e(err);
3031
+ } finally {
3032
+ _iterator4.f();
3033
+ }
3034
+ }
3035
+ }
3036
+ } catch (err) {
3037
+ _iterator3.e(err);
3038
+ } finally {
3039
+ _iterator3.f();
3040
+ }
3041
+ };
3042
+
3043
+ // Exécuter la détection des conflits
3044
+ detectPathConflicts();
3045
+
3046
+ /**
3047
+ * Vérifie si un chemin de base a un conflit (indices numériques ET clés de chaîne)
3048
+ * @param {string} basePath - Le chemin de base à vérifier
3049
+ * @returns {boolean}
3050
+ */
3051
+ var hasConflict = function hasConflict(basePath) {
3052
+ if (!basePath) return false;
3053
+ var analysis = keyAnalysis.get(basePath);
3054
+ return (analysis === null || analysis === void 0 ? void 0 : analysis.hasNumeric) && (analysis === null || analysis === void 0 ? void 0 : analysis.hasString);
3055
+ };
3056
+
3057
+ /**
3058
+ * Convertit un tableau en objet en préservant les indices numériques comme propriétés
3059
+ * @param {Array} arr - Le tableau à convertir
3060
+ * @returns {Object} L'objet résultant
3061
+ */
3062
+ var arrayToObject = function arrayToObject(arr) {
3063
+ var obj = {};
3064
+ // Copier les indices numériques
3065
+ for (var idx = 0; idx < arr.length; idx++) {
3066
+ obj[idx] = arr[idx];
3067
+ }
3068
+ // Copier les propriétés non-numériques
3069
+ for (var _i = 0, _Object$entries = Object.entries(arr); _i < _Object$entries.length; _i++) {
3070
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
3071
+ k = _Object$entries$_i[0],
3072
+ v = _Object$entries$_i[1];
3073
+ var numKey = Number.parseInt(k, 10);
3074
+ if (Number.isNaN(numKey) || k !== String(numKey)) {
3075
+ obj[k] = v;
3076
+ }
3077
+ }
3078
+ return obj;
3079
+ };
3080
+
3081
+ /**
3082
+ * Convertit un objet en tableau en préservant les indices numériques
3083
+ * @param {Object} obj - L'objet à convertir
3084
+ * @returns {Array} Le tableau résultant
3085
+ */
3086
+ var objectToArray = function objectToArray(obj) {
3087
+ if (Array.isArray(obj)) return obj;
3088
+ var arr = [];
3089
+ if (_typeof(obj) === 'object' && obj !== null) {
3090
+ for (var _i2 = 0, _Object$entries2 = Object.entries(obj); _i2 < _Object$entries2.length; _i2++) {
3091
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
3092
+ k = _Object$entries2$_i[0],
3093
+ v = _Object$entries2$_i[1];
3094
+ var numKey = Number.parseInt(k, 10);
3095
+ if (!Number.isNaN(numKey)) {
3096
+ arr[numKey] = v;
3097
+ }
3098
+ }
3099
+ }
3100
+ return arr;
3101
+ };
3102
+
3103
+ /**
3104
+ * Assure qu'un conteneur est un objet, en convertissant si nécessaire
3105
+ * @param {*} container - Le conteneur à vérifier
3106
+ * @param {string|null} key - La clé dans le conteneur parent
3107
+ * @param {Object|null} parent - Le conteneur parent
3108
+ * @param {boolean} forceObject - Forcer la conversion en objet même s'il n'y a pas de conflit
3109
+ * @returns {Object} Le conteneur (converti en objet si nécessaire)
3110
+ */
3111
+ var ensureObject = function ensureObject(container, key, parent) {
3112
+ var forceObject = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
3113
+ if (Array.isArray(container)) {
3114
+ var obj = arrayToObject(container);
3115
+ if (parent && key !== null) {
3116
+ parent[key] = obj;
3117
+ }
3118
+ return obj;
3119
+ }
3120
+ if (_typeof(container) !== 'object' || container === null) {
3121
+ var _obj = {};
3122
+ if (parent && key !== null) {
3123
+ parent[key] = _obj;
3124
+ }
3125
+ return _obj;
3126
+ }
3127
+ return container;
3128
+ };
3129
+
3130
+ /**
3131
+ * Assure qu'un conteneur est un tableau, en convertissant si nécessaire
3132
+ * @param {*} container - Le conteneur à vérifier
3133
+ * @param {string|null} key - La clé dans le conteneur parent
3134
+ * @param {Object|null} parent - Le conteneur parent
3135
+ * @returns {Array} Le conteneur (converti en tableau si nécessaire)
3136
+ */
3137
+ var ensureArray = function ensureArray(container, key, parent) {
3138
+ if (!Array.isArray(container)) {
3139
+ var arr = objectToArray(container);
3140
+ if (parent && key !== null) {
3141
+ parent[key] = arr;
3142
+ }
3143
+ return arr;
3144
+ }
3145
+ return container;
3146
+ };
3147
+
3148
+ // ============================================================================
3149
+ // PHASE 2 : TRAITEMENT DES VALEURS
3150
+ // ============================================================================
3151
+
3152
+ /**
3153
+ * Traite une valeur finale (dernière partie du chemin)
3154
+ * @param {*} container - Le conteneur actuel
3155
+ * @param {Object} part - La partie à traiter
3156
+ * @param {*} value - La valeur à assigner
3157
+ * @param {Object} parent - Le conteneur parent
3158
+ * @param {string} basePath - Le chemin de base pour la détection de conflit
3159
+ */
3160
+ var processFinalValue = function processFinalValue(container, part, value, parent, basePath) {
3161
+ if (part.type === 'array') {
3162
+ var _container, _part$name, _container$_part$name;
3163
+ // Tableau explicite avec []
3164
+ (_container$_part$name = (_container = container)[_part$name = part.name]) !== null && _container$_part$name !== void 0 ? _container$_part$name : _container[_part$name] = [];
3165
+ if (Array.isArray(container[part.name])) {
3166
+ container[part.name].push(value);
3167
+ } else {
3168
+ container[part.name] = [container[part.name], value];
3169
+ }
3170
+ } else if (part.type === 'numeric') {
3171
+ // Indice numérique final
3172
+ var index = part.index;
3173
+ container = ensureArray(container, parent.key, parent.container);
3174
+ while (container.length <= index) {
3175
+ container.push(undefined);
3176
+ }
3177
+ container[index] = value;
3178
+ } else {
3179
+ // Clé simple finale
3180
+ var conflict = hasConflict(basePath);
3181
+ if (conflict) {
3182
+ container = ensureObject(container, parent.key, parent.container, true);
3183
+ if (Array.isArray(container[part.name])) {
3184
+ container[part.name] = arrayToObject(container[part.name]);
3185
+ }
3186
+ if (container[part.name] !== undefined && (_typeof(container[part.name]) !== 'object' || container[part.name] === null)) {
3187
+ container[part.name] = value;
3188
+ } else if (container[part.name] === undefined) {
3189
+ container[part.name] = value;
3190
+ } else if (Array.isArray(container[part.name])) {
3191
+ container[part.name].push(value);
3192
+ } else {
3193
+ container[part.name] = [container[part.name], value];
3194
+ }
3195
+ } else {
3196
+ if (container[part.name] === undefined) {
3197
+ container[part.name] = value;
3198
+ } else if (Array.isArray(container[part.name])) {
3199
+ container[part.name].push(value);
3200
+ } else {
3201
+ container[part.name] = [container[part.name], value];
3202
+ }
3203
+ }
3204
+ }
3205
+ };
3206
+
3207
+ /**
3208
+ * Traite une partie intermédiaire (crée la structure)
3209
+ * @param {*} container - Le conteneur actuel
3210
+ * @param {Object} part - La partie à traiter
3211
+ * @param {Object|null} nextPart - La partie suivante (peut être null)
3212
+ * @param {Object} parent - Le conteneur parent
3213
+ * @param {string} basePath - Le chemin de base pour la détection de conflit
3214
+ * @param {Array} parts - Toutes les parties du chemin (pour construire le chemin complet dans les erreurs)
3215
+ * @param {number} i - L'index de la partie actuelle (pour construire le chemin complet dans les erreurs)
3216
+ * @param {string} key - La clé du formulaire (pour les messages d'erreur)
3217
+ * @returns {*} Le nouveau conteneur après traitement
3218
+ */
3219
+ var processIntermediatePart = function processIntermediatePart(container, part, nextPart, parent, basePath, parts, i, key) {
3220
+ if (part.type === 'numeric') {
3221
+ // Indice numérique : le container doit être un tableau ou un objet (selon conflit)
3222
+ var index = part.index;
3223
+ var _conflict = hasConflict(basePath);
3224
+ if (_conflict) {
3225
+ var _container2, _container2$index;
3226
+ // Conflit : utiliser un objet (les indices seront des propriétés)
3227
+ container = ensureObject(container, parent.key, parent.container, true);
3228
+ (_container2$index = (_container2 = container)[index]) !== null && _container2$index !== void 0 ? _container2$index : _container2[index] = {};
3229
+ if (_typeof(container[index]) !== 'object' || container[index] === null) {
3230
+ // Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
3231
+ var pathParts = parts.slice(0, i + 1);
3232
+ var currentPath = buildPathString(pathParts);
3233
+ throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(currentPath, "\" but it is already a ").concat(_typeof(container[index]), " value: ").concat(JSON.stringify(container[index]), ". ") + "This should have been detected during conflict detection phase.");
3234
+ }
3235
+ } else {
3236
+ var _container3, _container3$index;
3237
+ // Pas de conflit : utiliser un tableau
3238
+ container = ensureArray(container, parent.key, parent.container);
3239
+ while (container.length <= index) {
3240
+ container.push(undefined);
3241
+ }
3242
+ (_container3$index = (_container3 = container)[index]) !== null && _container3$index !== void 0 ? _container3$index : _container3[index] = {};
3243
+ if (_typeof(container[index]) !== 'object' || container[index] === null) {
3244
+ // Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
3245
+ var _pathParts = parts.slice(0, i + 1);
3246
+ var _currentPath = buildPathString(_pathParts);
3247
+ throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(_currentPath, "\" but it is already a ").concat(_typeof(container[index]), " value: ").concat(JSON.stringify(container[index]), ". ") + "This should have been detected during conflict detection phase.");
3248
+ }
3249
+ }
3250
+ return container[index];
3251
+ }
3252
+
3253
+ // Clé normale : créer objet ou tableau selon la partie suivante
3254
+ var nextIsNumeric = (nextPart === null || nextPart === void 0 ? void 0 : nextPart.type) === 'numeric';
3255
+ var conflict = hasConflict(basePath);
3256
+ if (conflict) {
3257
+ var _container4, _part$name2, _container4$_part$nam;
3258
+ // Conflit : toujours utiliser un objet
3259
+ container = ensureObject(container, parent.key, parent.container, true);
3260
+ (_container4$_part$nam = (_container4 = container)[_part$name2 = part.name]) !== null && _container4$_part$nam !== void 0 ? _container4$_part$nam : _container4[_part$name2] = {};
3261
+ if (Array.isArray(container[part.name])) {
3262
+ container[part.name] = arrayToObject(container[part.name]);
3263
+ } else if (_typeof(container[part.name]) !== 'object' || container[part.name] === null) {
3264
+ // Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
3265
+ var _pathParts2 = parts.slice(0, i + 1);
3266
+ var _currentPath2 = buildPathString(_pathParts2);
3267
+ throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(_currentPath2, "\" but it is already a ").concat(_typeof(container[part.name]), " value: ").concat(JSON.stringify(container[part.name]), ". ") + "This should have been detected during conflict detection phase.");
3268
+ }
3269
+ } else if (container[part.name] === undefined) {
3270
+ // Pas de conflit, créer selon la partie suivante
3271
+ container[part.name] = nextIsNumeric ? [] : {};
3272
+ } else if (nextIsNumeric && !Array.isArray(container[part.name])) {
3273
+ // On a besoin d'un tableau mais c'est un objet
3274
+ var hasStringKeys = Object.keys(container[part.name]).some(function (k) {
3275
+ var numKey = Number.parseInt(k, 10);
3276
+ return Number.isNaN(numKey) || k !== String(numKey);
3277
+ });
3278
+ if (!hasStringKeys) {
3279
+ container[part.name] = objectToArray(container[part.name]);
3280
+ }
3281
+ } else if (!nextIsNumeric && !isPlainObject(container[part.name])) {
3282
+ // On a besoin d'un objet mais c'est un tableau
3283
+ if (Array.isArray(container[part.name])) {
3284
+ container[part.name] = arrayToObject(container[part.name]);
3285
+ } else {
3286
+ container[part.name] = {};
3287
+ }
3288
+ }
3289
+
3290
+ // S'assurer que container[part.name] est bien un objet après toutes les conversions
3291
+ if (container[part.name] !== undefined && (_typeof(container[part.name]) !== 'object' || container[part.name] === null)) {
3292
+ // Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
3293
+ var _pathParts3 = parts.slice(0, i + 1);
3294
+ var _currentPath3 = buildPathString(_pathParts3);
3295
+ throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(_currentPath3, "\" but it is already a ").concat(_typeof(container[part.name]), " value: ").concat(JSON.stringify(container[part.name]), ". ") + "This should have been detected during conflict detection phase.");
3296
+ }
3297
+ return container[part.name];
3298
+ };
3299
+
3300
+ // Traiter toutes les entrées
3301
+ for (var _i3 = 0, _allEntries = allEntries; _i3 < _allEntries.length; _i3++) {
3302
+ var _parts$;
3303
+ var _allEntries$_i = _allEntries[_i3],
3304
+ value = _allEntries$_i.value,
3305
+ key = _allEntries$_i.key;
3306
+ if (!key) continue;
3307
+ var parts = parseKey(key);
3308
+ var path = [{
3309
+ container: jsonData,
3310
+ key: null
3311
+ }];
3312
+ var container = jsonData;
3313
+ var basePath = ((_parts$ = parts[0]) === null || _parts$ === void 0 ? void 0 : _parts$.type) === 'key' ? parts[0].name : '';
3314
+ for (var i = 0; i < parts.length; i++) {
3315
+ var part = parts[i];
3316
+ var isLast = i === parts.length - 1;
3317
+ var nextPart = i + 1 < parts.length ? parts[i + 1] : null;
3318
+ var parent = path[path.length - 1];
3319
+ if (isLast) {
3320
+ // Dernière partie : assigner la valeur
3321
+ processFinalValue(container, part, value, parent, basePath);
3322
+ } else {
3323
+ // Partie intermédiaire : créer la structure
3324
+ var newContainer = processIntermediatePart(container, part, nextPart, parent, basePath, parts, i, key);
3325
+ path.push({
3326
+ container: container,
3327
+ key: part.type === 'numeric' ? part.index : part.name
3328
+ });
3329
+ container = newContainer;
3330
+ }
3331
+ }
3332
+ }
3333
+ return jsonData;
3334
+ };
3335
+
3336
+ /**
3337
+ * Parse une clé de formulaire pour extraire les parties (nom, indices, etc.)
3338
+ * @param {string} key - La clé à parser (ex: "user[email]", "tags[]", "items[0][name]")
3339
+ * @returns {Array<{name: string, type: string, index?: number}>} Tableau des parties parsées
3340
+ * @private
3341
+ */
3342
+ var parseKey = function parseKey(key) {
3343
+ var parts = [];
3344
+ var current = '';
3345
+ var i = 0;
3346
+ var len = key.length;
3347
+ while (i < len) {
3348
+ var _char = key[i];
3349
+ if (_char === '[') {
3350
+ // Sauvegarder la partie précédente si elle existe
3351
+ if (current) {
3352
+ parts.push({
3353
+ name: current,
3354
+ type: 'key'
3355
+ });
3356
+ current = '';
3357
+ }
3358
+
3359
+ // Trouver la fin du crochet
3360
+ i++;
3361
+ var bracketContent = '';
3362
+ while (i < len && key[i] !== ']') {
3363
+ bracketContent += key[i];
3364
+ i++;
3365
+ }
3366
+ if (bracketContent === '') {
3367
+ // [] vide = tableau
3368
+ var lastPart = parts[parts.length - 1];
3369
+ if (lastPart) {
3370
+ lastPart.type = 'array';
3371
+ } else {
3372
+ // [] au début, créer une partie spéciale
3373
+ parts.push({
3374
+ name: '',
3375
+ type: 'array'
3376
+ });
3377
+ }
3378
+ } else {
3379
+ // Contenu dans les crochets
3380
+ var numIndex = Number.parseInt(bracketContent, 10);
3381
+ if (!Number.isNaN(numIndex) && bracketContent === String(numIndex)) {
3382
+ // Indice numérique
3383
+ parts.push({
3384
+ name: String(numIndex),
3385
+ type: 'numeric',
3386
+ index: numIndex
3387
+ });
3388
+ } else {
3389
+ // Nom de propriété
3390
+ parts.push({
3391
+ name: bracketContent,
3392
+ type: 'key'
3393
+ });
3394
+ }
3395
+ }
3396
+ i++; // Passer le ']'
3397
+ } else {
3398
+ current += _char;
3399
+ i++;
3400
+ }
3401
+ }
3402
+
3403
+ // Ajouter la dernière partie si elle existe
3404
+ if (current) {
3405
+ parts.push({
3406
+ name: current,
3407
+ type: 'key'
3408
+ });
3409
+ }
3410
+ return parts;
3411
+ };
3412
+
3413
+ /**
3414
+ * Vérifie si une valeur est un objet simple (pas un tableau, pas null)
3415
+ * @param {*} obj - La valeur à vérifier
3416
+ * @returns {boolean}
3417
+ * @private
3418
+ */
3419
+ var isPlainObject = function isPlainObject(obj) {
3420
+ return _typeof(obj) === 'object' && obj !== null && !Array.isArray(obj);
3421
+ };
3422
+
2104
3423
  /***/ }),
2105
3424
 
2106
3425
  /***/ "./modules/tristate/tristate.mjs":
@@ -2412,42 +3731,44 @@ __webpack_require__.r(__webpack_exports__);
2412
3731
  /* harmony import */ var _modules_dialog_dialog_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/dialog/dialog.mjs */ "./modules/dialog/dialog.mjs");
2413
3732
  /* harmony import */ var _modules_toast_toast_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/toast/toast.mjs */ "./modules/toast/toast.mjs");
2414
3733
  /* harmony import */ var _modules_common_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/common.mjs */ "./modules/common.mjs");
2415
-
2416
-
2417
-
2418
-
2419
-
2420
-
2421
- /**
2422
- * Creates an APX object that wraps one or more HTML elements.
2423
- * @param {string|HTMLElement|NodeList|HTMLCollection|Array<HTMLElement>|jQuery|Function} input - The input to create the APX object from.
2424
- * @returns {Object} The APX object.
2425
- * @throws {Error} If the input type is invalid.
2426
- * @example
2427
- * // XPath
2428
- * const apx1 = APX('//div[@class="example"]');
2429
- *
2430
- * // CSS selector
2431
- * const apx2 = APX('.example');
2432
- *
2433
- * // Single element
2434
- * const element = document.querySelector('.example');
2435
- * const apx3 = APX(element);
2436
- *
2437
- * // NodeList or HTMLCollection
2438
- * const nodeList = document.querySelectorAll('.example');
2439
- * const apx4 = APX(nodeList);
2440
- *
2441
- * // Array of elements
2442
- * const elements = [document.querySelector('.example1'), document.querySelector('.example2')];
2443
- * const apx5 = APX(elements);
2444
- *
2445
- * // jQuery object
2446
- * const $example = $('.example');
2447
- * const apx6 = APX($example);
2448
- *
2449
- * // Function returning an APX object
2450
- * const apx7 = APX(() => APX('.example'));
3734
+ /* harmony import */ var _modules_tools_exports_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/tools/exports.mjs */ "./modules/tools/exports.mjs");
3735
+
3736
+
3737
+
3738
+
3739
+
3740
+
3741
+
3742
+ /**
3743
+ * Creates an APX object that wraps one or more HTML elements.
3744
+ * @param {string|HTMLElement|NodeList|HTMLCollection|Array<HTMLElement>|jQuery|Function} input - The input to create the APX object from.
3745
+ * @returns {Object} The APX object.
3746
+ * @throws {Error} If the input type is invalid.
3747
+ * @example
3748
+ * // XPath
3749
+ * const apx1 = APX('//div[@class="example"]');
3750
+ *
3751
+ * // CSS selector
3752
+ * const apx2 = APX('.example');
3753
+ *
3754
+ * // Single element
3755
+ * const element = document.querySelector('.example');
3756
+ * const apx3 = APX(element);
3757
+ *
3758
+ * // NodeList or HTMLCollection
3759
+ * const nodeList = document.querySelectorAll('.example');
3760
+ * const apx4 = APX(nodeList);
3761
+ *
3762
+ * // Array of elements
3763
+ * const elements = [document.querySelector('.example1'), document.querySelector('.example2')];
3764
+ * const apx5 = APX(elements);
3765
+ *
3766
+ * // jQuery object
3767
+ * const $example = $('.example');
3768
+ * const apx6 = APX($example);
3769
+ *
3770
+ * // Function returning an APX object
3771
+ * const apx7 = APX(() => APX('.example'));
2451
3772
  */
2452
3773
  var APX = function APX(input) {
2453
3774
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
@@ -2523,11 +3844,13 @@ var APX = function APX(input) {
2523
3844
  };
2524
3845
  (0,_modules_listen_listen_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(apx);
2525
3846
  (0,_modules_tristate_tristate_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(apx);
3847
+ (0,_modules_tools_exports_mjs__WEBPACK_IMPORTED_MODULE_5__.augmentWithPack)(apx);
2526
3848
  return apx;
2527
3849
  };
2528
3850
  APX.loadCss = _modules_common_mjs__WEBPACK_IMPORTED_MODULE_4__.loadCss;
2529
3851
  APX.dialog = _modules_dialog_dialog_mjs__WEBPACK_IMPORTED_MODULE_2__["default"];
2530
3852
  APX.toast = _modules_toast_toast_mjs__WEBPACK_IMPORTED_MODULE_3__["default"];
3853
+ APX.tools = _modules_tools_exports_mjs__WEBPACK_IMPORTED_MODULE_5__.tools;
2531
3854
  APX.isAPXObject = function (obj) {
2532
3855
  return obj && obj._isAPXObject === true;
2533
3856
  };