build/modules/interactivity
index.js
102.0 KB
3 months ago
index.js.map
348.4 KB
3 months ago
index.min.asset.php
83 B
3 months ago
index.min.js
39.2 KB
3 months ago
index.min.js.map
311.1 KB
3 months ago
index.js in Gutenberg 23.2.0, at build/modules/interactivity/index.js
| 1 | var __defProp = Object.defineProperty; |
| 2 | var __getOwnPropNames = Object.getOwnPropertyNames; |
| 3 | var __esm = (fn, res) => function __init() { |
| 4 | return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; |
| 5 | }; |
| 6 | var __export = (target, all) => { |
| 7 | for (var name in all) |
| 8 | __defProp(target, name, { get: all[name], enumerable: true }); |
| 9 | }; |
| 10 | |
| 11 | // node_modules/preact/dist/preact.module.js |
| 12 | function m(n3, l6) { |
| 13 | for (var u5 in l6) n3[u5] = l6[u5]; |
| 14 | return n3; |
| 15 | } |
| 16 | function b(n3) { |
| 17 | n3 && n3.parentNode && n3.parentNode.removeChild(n3); |
| 18 | } |
| 19 | function k(l6, u5, t5) { |
| 20 | var i6, r5, o4, e4 = {}; |
| 21 | for (o4 in u5) "key" == o4 ? i6 = u5[o4] : "ref" == o4 ? r5 = u5[o4] : e4[o4] = u5[o4]; |
| 22 | if (arguments.length > 2 && (e4.children = arguments.length > 3 ? n.call(arguments, 2) : t5), "function" == typeof l6 && null != l6.defaultProps) for (o4 in l6.defaultProps) void 0 === e4[o4] && (e4[o4] = l6.defaultProps[o4]); |
| 23 | return x(l6, e4, i6, r5, null); |
| 24 | } |
| 25 | function x(n3, t5, i6, r5, o4) { |
| 26 | var e4 = { type: n3, props: t5, key: i6, ref: r5, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o4 ? ++u : o4, __i: -1, __u: 0 }; |
| 27 | return null == o4 && null != l.vnode && l.vnode(e4), e4; |
| 28 | } |
| 29 | function S(n3) { |
| 30 | return n3.children; |
| 31 | } |
| 32 | function C(n3, l6) { |
| 33 | this.props = n3, this.context = l6; |
| 34 | } |
| 35 | function $(n3, l6) { |
| 36 | if (null == l6) return n3.__ ? $(n3.__, n3.__i + 1) : null; |
| 37 | for (var u5; l6 < n3.__k.length; l6++) if (null != (u5 = n3.__k[l6]) && null != u5.__e) return u5.__e; |
| 38 | return "function" == typeof n3.type ? $(n3) : null; |
| 39 | } |
| 40 | function I(n3) { |
| 41 | if (n3.__P && n3.__d) { |
| 42 | var u5 = n3.__v, t5 = u5.__e, i6 = [], r5 = [], o4 = m({}, u5); |
| 43 | o4.__v = u5.__v + 1, l.vnode && l.vnode(o4), q(n3.__P, o4, u5, n3.__n, n3.__P.namespaceURI, 32 & u5.__u ? [t5] : null, i6, null == t5 ? $(u5) : t5, !!(32 & u5.__u), r5), o4.__v = u5.__v, o4.__.__k[o4.__i] = o4, D(i6, o4, r5), u5.__e = u5.__ = null, o4.__e != t5 && P(o4); |
| 44 | } |
| 45 | } |
| 46 | function P(n3) { |
| 47 | if (null != (n3 = n3.__) && null != n3.__c) return n3.__e = n3.__c.base = null, n3.__k.some(function(l6) { |
| 48 | if (null != l6 && null != l6.__e) return n3.__e = n3.__c.base = l6.__e; |
| 49 | }), P(n3); |
| 50 | } |
| 51 | function A(n3) { |
| 52 | (!n3.__d && (n3.__d = true) && i.push(n3) && !H.__r++ || r != l.debounceRendering) && ((r = l.debounceRendering) || o)(H); |
| 53 | } |
| 54 | function H() { |
| 55 | try { |
| 56 | for (var n3, l6 = 1; i.length; ) i.length > l6 && i.sort(e), n3 = i.shift(), l6 = i.length, I(n3); |
| 57 | } finally { |
| 58 | i.length = H.__r = 0; |
| 59 | } |
| 60 | } |
| 61 | function L(n3, l6, u5, t5, i6, r5, o4, e4, f5, c5, s6) { |
| 62 | var a5, h5, p6, v6, y5, _5, g3, m4 = t5 && t5.__k || w, b4 = l6.length; |
| 63 | for (f5 = T(u5, l6, m4, f5, b4), a5 = 0; a5 < b4; a5++) null != (p6 = u5.__k[a5]) && (h5 = -1 != p6.__i && m4[p6.__i] || d, p6.__i = a5, _5 = q(n3, p6, h5, i6, r5, o4, e4, f5, c5, s6), v6 = p6.__e, p6.ref && h5.ref != p6.ref && (h5.ref && J(h5.ref, null, p6), s6.push(p6.ref, p6.__c || v6, p6)), null == y5 && null != v6 && (y5 = v6), (g3 = !!(4 & p6.__u)) || h5.__k === p6.__k ? (f5 = j(p6, f5, n3, g3), g3 && h5.__e && (h5.__e = null)) : "function" == typeof p6.type && void 0 !== _5 ? f5 = _5 : v6 && (f5 = v6.nextSibling), p6.__u &= -7); |
| 64 | return u5.__e = y5, f5; |
| 65 | } |
| 66 | function T(n3, l6, u5, t5, i6) { |
| 67 | var r5, o4, e4, f5, c5, s6 = u5.length, a5 = s6, h5 = 0; |
| 68 | for (n3.__k = new Array(i6), r5 = 0; r5 < i6; r5++) null != (o4 = l6[r5]) && "boolean" != typeof o4 && "function" != typeof o4 ? ("string" == typeof o4 || "number" == typeof o4 || "bigint" == typeof o4 || o4.constructor == String ? o4 = n3.__k[r5] = x(null, o4, null, null, null) : g(o4) ? o4 = n3.__k[r5] = x(S, { children: o4 }, null, null, null) : void 0 === o4.constructor && o4.__b > 0 ? o4 = n3.__k[r5] = x(o4.type, o4.props, o4.key, o4.ref ? o4.ref : null, o4.__v) : n3.__k[r5] = o4, f5 = r5 + h5, o4.__ = n3, o4.__b = n3.__b + 1, e4 = null, -1 != (c5 = o4.__i = O(o4, u5, f5, a5)) && (a5--, (e4 = u5[c5]) && (e4.__u |= 2)), null == e4 || null == e4.__v ? (-1 == c5 && (i6 > s6 ? h5-- : i6 < s6 && h5++), "function" != typeof o4.type && (o4.__u |= 4)) : c5 != f5 && (c5 == f5 - 1 ? h5-- : c5 == f5 + 1 ? h5++ : (c5 > f5 ? h5-- : h5++, o4.__u |= 4))) : n3.__k[r5] = null; |
| 69 | if (a5) for (r5 = 0; r5 < s6; r5++) null != (e4 = u5[r5]) && 0 == (2 & e4.__u) && (e4.__e == t5 && (t5 = $(e4)), K(e4, e4)); |
| 70 | return t5; |
| 71 | } |
| 72 | function j(n3, l6, u5, t5) { |
| 73 | var i6, r5; |
| 74 | if ("function" == typeof n3.type) { |
| 75 | for (i6 = n3.__k, r5 = 0; i6 && r5 < i6.length; r5++) i6[r5] && (i6[r5].__ = n3, l6 = j(i6[r5], l6, u5, t5)); |
| 76 | return l6; |
| 77 | } |
| 78 | n3.__e != l6 && (t5 && (l6 && n3.type && !l6.parentNode && (l6 = $(n3)), u5.insertBefore(n3.__e, l6 || null)), l6 = n3.__e); |
| 79 | do { |
| 80 | l6 = l6 && l6.nextSibling; |
| 81 | } while (null != l6 && 8 == l6.nodeType); |
| 82 | return l6; |
| 83 | } |
| 84 | function O(n3, l6, u5, t5) { |
| 85 | var i6, r5, o4, e4 = n3.key, f5 = n3.type, c5 = l6[u5], s6 = null != c5 && 0 == (2 & c5.__u); |
| 86 | if (null === c5 && null == e4 || s6 && e4 == c5.key && f5 == c5.type) return u5; |
| 87 | if (t5 > (s6 ? 1 : 0)) { |
| 88 | for (i6 = u5 - 1, r5 = u5 + 1; i6 >= 0 || r5 < l6.length; ) if (null != (c5 = l6[o4 = i6 >= 0 ? i6-- : r5++]) && 0 == (2 & c5.__u) && e4 == c5.key && f5 == c5.type) return o4; |
| 89 | } |
| 90 | return -1; |
| 91 | } |
| 92 | function z(n3, l6, u5) { |
| 93 | "-" == l6[0] ? n3.setProperty(l6, null == u5 ? "" : u5) : n3[l6] = null == u5 ? "" : "number" != typeof u5 || _.test(l6) ? u5 : u5 + "px"; |
| 94 | } |
| 95 | function N(n3, l6, u5, t5, i6) { |
| 96 | var r5, o4; |
| 97 | n: if ("style" == l6) if ("string" == typeof u5) n3.style.cssText = u5; |
| 98 | else { |
| 99 | if ("string" == typeof t5 && (n3.style.cssText = t5 = ""), t5) for (l6 in t5) u5 && l6 in u5 || z(n3.style, l6, ""); |
| 100 | if (u5) for (l6 in u5) t5 && u5[l6] == t5[l6] || z(n3.style, l6, u5[l6]); |
| 101 | } |
| 102 | else if ("o" == l6[0] && "n" == l6[1]) r5 = l6 != (l6 = l6.replace(a, "$1")), o4 = l6.toLowerCase(), l6 = o4 in n3 || "onFocusOut" == l6 || "onFocusIn" == l6 ? o4.slice(2) : l6.slice(2), n3.l || (n3.l = {}), n3.l[l6 + r5] = u5, u5 ? t5 ? u5[s] = t5[s] : (u5[s] = h, n3.addEventListener(l6, r5 ? v : p, r5)) : n3.removeEventListener(l6, r5 ? v : p, r5); |
| 103 | else { |
| 104 | if ("http://www.w3.org/2000/svg" == i6) l6 = l6.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); |
| 105 | else if ("width" != l6 && "height" != l6 && "href" != l6 && "list" != l6 && "form" != l6 && "tabIndex" != l6 && "download" != l6 && "rowSpan" != l6 && "colSpan" != l6 && "role" != l6 && "popover" != l6 && l6 in n3) try { |
| 106 | n3[l6] = null == u5 ? "" : u5; |
| 107 | break n; |
| 108 | } catch (n4) { |
| 109 | } |
| 110 | "function" == typeof u5 || (null == u5 || false === u5 && "-" != l6[4] ? n3.removeAttribute(l6) : n3.setAttribute(l6, "popover" == l6 && 1 == u5 ? "" : u5)); |
| 111 | } |
| 112 | } |
| 113 | function V(n3) { |
| 114 | return function(u5) { |
| 115 | if (this.l) { |
| 116 | var t5 = this.l[u5.type + n3]; |
| 117 | if (null == u5[c]) u5[c] = h++; |
| 118 | else if (u5[c] < t5[s]) return; |
| 119 | return t5(l.event ? l.event(u5) : u5); |
| 120 | } |
| 121 | }; |
| 122 | } |
| 123 | function q(n3, u5, t5, i6, r5, o4, e4, f5, c5, s6) { |
| 124 | var a5, h5, p6, v6, y5, d6, _5, k3, x3, M, $2, I2, P2, A3, H2, T3 = u5.type; |
| 125 | if (void 0 !== u5.constructor) return null; |
| 126 | 128 & t5.__u && (c5 = !!(32 & t5.__u), o4 = [f5 = u5.__e = t5.__e]), (a5 = l.__b) && a5(u5); |
| 127 | n: if ("function" == typeof T3) try { |
| 128 | if (k3 = u5.props, x3 = T3.prototype && T3.prototype.render, M = (a5 = T3.contextType) && i6[a5.__c], $2 = a5 ? M ? M.props.value : a5.__ : i6, t5.__c ? _5 = (h5 = u5.__c = t5.__c).__ = h5.__E : (x3 ? u5.__c = h5 = new T3(k3, $2) : (u5.__c = h5 = new C(k3, $2), h5.constructor = T3, h5.render = Q), M && M.sub(h5), h5.state || (h5.state = {}), h5.__n = i6, p6 = h5.__d = true, h5.__h = [], h5._sb = []), x3 && null == h5.__s && (h5.__s = h5.state), x3 && null != T3.getDerivedStateFromProps && (h5.__s == h5.state && (h5.__s = m({}, h5.__s)), m(h5.__s, T3.getDerivedStateFromProps(k3, h5.__s))), v6 = h5.props, y5 = h5.state, h5.__v = u5, p6) x3 && null == T3.getDerivedStateFromProps && null != h5.componentWillMount && h5.componentWillMount(), x3 && null != h5.componentDidMount && h5.__h.push(h5.componentDidMount); |
| 129 | else { |
| 130 | if (x3 && null == T3.getDerivedStateFromProps && k3 !== v6 && null != h5.componentWillReceiveProps && h5.componentWillReceiveProps(k3, $2), u5.__v == t5.__v || !h5.__e && null != h5.shouldComponentUpdate && false === h5.shouldComponentUpdate(k3, h5.__s, $2)) { |
| 131 | u5.__v != t5.__v && (h5.props = k3, h5.state = h5.__s, h5.__d = false), u5.__e = t5.__e, u5.__k = t5.__k, u5.__k.some(function(n4) { |
| 132 | n4 && (n4.__ = u5); |
| 133 | }), w.push.apply(h5.__h, h5._sb), h5._sb = [], h5.__h.length && e4.push(h5); |
| 134 | break n; |
| 135 | } |
| 136 | null != h5.componentWillUpdate && h5.componentWillUpdate(k3, h5.__s, $2), x3 && null != h5.componentDidUpdate && h5.__h.push(function() { |
| 137 | h5.componentDidUpdate(v6, y5, d6); |
| 138 | }); |
| 139 | } |
| 140 | if (h5.context = $2, h5.props = k3, h5.__P = n3, h5.__e = false, I2 = l.__r, P2 = 0, x3) h5.state = h5.__s, h5.__d = false, I2 && I2(u5), a5 = h5.render(h5.props, h5.state, h5.context), w.push.apply(h5.__h, h5._sb), h5._sb = []; |
| 141 | else do { |
| 142 | h5.__d = false, I2 && I2(u5), a5 = h5.render(h5.props, h5.state, h5.context), h5.state = h5.__s; |
| 143 | } while (h5.__d && ++P2 < 25); |
| 144 | h5.state = h5.__s, null != h5.getChildContext && (i6 = m(m({}, i6), h5.getChildContext())), x3 && !p6 && null != h5.getSnapshotBeforeUpdate && (d6 = h5.getSnapshotBeforeUpdate(v6, y5)), A3 = null != a5 && a5.type === S && null == a5.key ? E(a5.props.children) : a5, f5 = L(n3, g(A3) ? A3 : [A3], u5, t5, i6, r5, o4, e4, f5, c5, s6), h5.base = u5.__e, u5.__u &= -161, h5.__h.length && e4.push(h5), _5 && (h5.__E = h5.__ = null); |
| 145 | } catch (n4) { |
| 146 | if (u5.__v = null, c5 || null != o4) if (n4.then) { |
| 147 | for (u5.__u |= c5 ? 160 : 128; f5 && 8 == f5.nodeType && f5.nextSibling; ) f5 = f5.nextSibling; |
| 148 | o4[o4.indexOf(f5)] = null, u5.__e = f5; |
| 149 | } else { |
| 150 | for (H2 = o4.length; H2--; ) b(o4[H2]); |
| 151 | B(u5); |
| 152 | } |
| 153 | else u5.__e = t5.__e, u5.__k = t5.__k, n4.then || B(u5); |
| 154 | l.__e(n4, u5, t5); |
| 155 | } |
| 156 | else null == o4 && u5.__v == t5.__v ? (u5.__k = t5.__k, u5.__e = t5.__e) : f5 = u5.__e = G(t5.__e, u5, t5, i6, r5, o4, e4, c5, s6); |
| 157 | return (a5 = l.diffed) && a5(u5), 128 & u5.__u ? void 0 : f5; |
| 158 | } |
| 159 | function B(n3) { |
| 160 | n3 && (n3.__c && (n3.__c.__e = true), n3.__k && n3.__k.some(B)); |
| 161 | } |
| 162 | function D(n3, u5, t5) { |
| 163 | for (var i6 = 0; i6 < t5.length; i6++) J(t5[i6], t5[++i6], t5[++i6]); |
| 164 | l.__c && l.__c(u5, n3), n3.some(function(u6) { |
| 165 | try { |
| 166 | n3 = u6.__h, u6.__h = [], n3.some(function(n4) { |
| 167 | n4.call(u6); |
| 168 | }); |
| 169 | } catch (n4) { |
| 170 | l.__e(n4, u6.__v); |
| 171 | } |
| 172 | }); |
| 173 | } |
| 174 | function E(n3) { |
| 175 | return "object" != typeof n3 || null == n3 || n3.__b > 0 ? n3 : g(n3) ? n3.map(E) : m({}, n3); |
| 176 | } |
| 177 | function G(u5, t5, i6, r5, o4, e4, f5, c5, s6) { |
| 178 | var a5, h5, p6, v6, y5, w5, _5, m4 = i6.props || d, k3 = t5.props, x3 = t5.type; |
| 179 | if ("svg" == x3 ? o4 = "http://www.w3.org/2000/svg" : "math" == x3 ? o4 = "http://www.w3.org/1998/Math/MathML" : o4 || (o4 = "http://www.w3.org/1999/xhtml"), null != e4) { |
| 180 | for (a5 = 0; a5 < e4.length; a5++) if ((y5 = e4[a5]) && "setAttribute" in y5 == !!x3 && (x3 ? y5.localName == x3 : 3 == y5.nodeType)) { |
| 181 | u5 = y5, e4[a5] = null; |
| 182 | break; |
| 183 | } |
| 184 | } |
| 185 | if (null == u5) { |
| 186 | if (null == x3) return document.createTextNode(k3); |
| 187 | u5 = document.createElementNS(o4, x3, k3.is && k3), c5 && (l.__m && l.__m(t5, e4), c5 = false), e4 = null; |
| 188 | } |
| 189 | if (null == x3) m4 === k3 || c5 && u5.data == k3 || (u5.data = k3); |
| 190 | else { |
| 191 | if (e4 = e4 && n.call(u5.childNodes), !c5 && null != e4) for (m4 = {}, a5 = 0; a5 < u5.attributes.length; a5++) m4[(y5 = u5.attributes[a5]).name] = y5.value; |
| 192 | for (a5 in m4) y5 = m4[a5], "dangerouslySetInnerHTML" == a5 ? p6 = y5 : "children" == a5 || a5 in k3 || "value" == a5 && "defaultValue" in k3 || "checked" == a5 && "defaultChecked" in k3 || N(u5, a5, null, y5, o4); |
| 193 | for (a5 in k3) y5 = k3[a5], "children" == a5 ? v6 = y5 : "dangerouslySetInnerHTML" == a5 ? h5 = y5 : "value" == a5 ? w5 = y5 : "checked" == a5 ? _5 = y5 : c5 && "function" != typeof y5 || m4[a5] === y5 || N(u5, a5, y5, m4[a5], o4); |
| 194 | if (h5) c5 || p6 && (h5.__html == p6.__html || h5.__html == u5.innerHTML) || (u5.innerHTML = h5.__html), t5.__k = []; |
| 195 | else if (p6 && (u5.innerHTML = ""), L("template" == t5.type ? u5.content : u5, g(v6) ? v6 : [v6], t5, i6, r5, "foreignObject" == x3 ? "http://www.w3.org/1999/xhtml" : o4, e4, f5, e4 ? e4[0] : i6.__k && $(i6, 0), c5, s6), null != e4) for (a5 = e4.length; a5--; ) b(e4[a5]); |
| 196 | c5 || (a5 = "value", "progress" == x3 && null == w5 ? u5.removeAttribute("value") : null != w5 && (w5 !== u5[a5] || "progress" == x3 && !w5 || "option" == x3 && w5 != m4[a5]) && N(u5, a5, w5, m4[a5], o4), a5 = "checked", null != _5 && _5 != u5[a5] && N(u5, a5, _5, m4[a5], o4)); |
| 197 | } |
| 198 | return u5; |
| 199 | } |
| 200 | function J(n3, u5, t5) { |
| 201 | try { |
| 202 | if ("function" == typeof n3) { |
| 203 | var i6 = "function" == typeof n3.__u; |
| 204 | i6 && n3.__u(), i6 && null == u5 || (n3.__u = n3(u5)); |
| 205 | } else n3.current = u5; |
| 206 | } catch (n4) { |
| 207 | l.__e(n4, t5); |
| 208 | } |
| 209 | } |
| 210 | function K(n3, u5, t5) { |
| 211 | var i6, r5; |
| 212 | if (l.unmount && l.unmount(n3), (i6 = n3.ref) && (i6.current && i6.current != n3.__e || J(i6, null, u5)), null != (i6 = n3.__c)) { |
| 213 | if (i6.componentWillUnmount) try { |
| 214 | i6.componentWillUnmount(); |
| 215 | } catch (n4) { |
| 216 | l.__e(n4, u5); |
| 217 | } |
| 218 | i6.base = i6.__P = null; |
| 219 | } |
| 220 | if (i6 = n3.__k) for (r5 = 0; r5 < i6.length; r5++) i6[r5] && K(i6[r5], u5, t5 || "function" != typeof n3.type); |
| 221 | t5 || b(n3.__e), n3.__c = n3.__ = n3.__e = void 0; |
| 222 | } |
| 223 | function Q(n3, l6, u5) { |
| 224 | return this.constructor(n3, u5); |
| 225 | } |
| 226 | function R(u5, t5, i6) { |
| 227 | var r5, o4, e4, f5; |
| 228 | t5 == document && (t5 = document.documentElement), l.__ && l.__(u5, t5), o4 = (r5 = "function" == typeof i6) ? null : i6 && i6.__k || t5.__k, e4 = [], f5 = [], q(t5, u5 = (!r5 && i6 || t5).__k = k(S, null, [u5]), o4 || d, d, t5.namespaceURI, !r5 && i6 ? [i6] : o4 ? null : t5.firstChild ? n.call(t5.childNodes) : null, e4, !r5 && i6 ? i6 : o4 ? o4.__e : t5.firstChild, r5, f5), D(e4, u5, f5); |
| 229 | } |
| 230 | function U(n3, l6) { |
| 231 | R(n3, l6, U); |
| 232 | } |
| 233 | function W(l6, u5, t5) { |
| 234 | var i6, r5, o4, e4, f5 = m({}, l6.props); |
| 235 | for (o4 in l6.type && l6.type.defaultProps && (e4 = l6.type.defaultProps), u5) "key" == o4 ? i6 = u5[o4] : "ref" == o4 ? r5 = u5[o4] : f5[o4] = void 0 === u5[o4] && null != e4 ? e4[o4] : u5[o4]; |
| 236 | return arguments.length > 2 && (f5.children = arguments.length > 3 ? n.call(arguments, 2) : t5), x(l6.type, f5, i6 || l6.key, r5 || l6.ref, null); |
| 237 | } |
| 238 | function X(n3) { |
| 239 | function l6(n4) { |
| 240 | var u5, t5; |
| 241 | return this.getChildContext || (u5 = /* @__PURE__ */ new Set(), (t5 = {})[l6.__c] = this, this.getChildContext = function() { |
| 242 | return t5; |
| 243 | }, this.componentWillUnmount = function() { |
| 244 | u5 = null; |
| 245 | }, this.shouldComponentUpdate = function(n5) { |
| 246 | this.props.value != n5.value && u5.forEach(function(n6) { |
| 247 | n6.__e = true, A(n6); |
| 248 | }); |
| 249 | }, this.sub = function(n5) { |
| 250 | u5.add(n5); |
| 251 | var l7 = n5.componentWillUnmount; |
| 252 | n5.componentWillUnmount = function() { |
| 253 | u5 && u5.delete(n5), l7 && l7.call(n5); |
| 254 | }; |
| 255 | }), n4.children; |
| 256 | } |
| 257 | return l6.__c = "__cC" + y++, l6.__ = n3, l6.Provider = l6.__l = (l6.Consumer = function(n4, l7) { |
| 258 | return n4.children(l7); |
| 259 | }).contextType = l6, l6; |
| 260 | } |
| 261 | var n, l, u, t, i, r, o, e, f, c, s, a, h, p, v, y, d, w, _, g; |
| 262 | var init_preact_module = __esm({ |
| 263 | "node_modules/preact/dist/preact.module.js"() { |
| 264 | d = {}; |
| 265 | w = []; |
| 266 | _ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; |
| 267 | g = Array.isArray; |
| 268 | n = w.slice, l = { __e: function(n3, l6, u5, t5) { |
| 269 | for (var i6, r5, o4; l6 = l6.__; ) if ((i6 = l6.__c) && !i6.__) try { |
| 270 | if ((r5 = i6.constructor) && null != r5.getDerivedStateFromError && (i6.setState(r5.getDerivedStateFromError(n3)), o4 = i6.__d), null != i6.componentDidCatch && (i6.componentDidCatch(n3, t5 || {}), o4 = i6.__d), o4) return i6.__E = i6; |
| 271 | } catch (l7) { |
| 272 | n3 = l7; |
| 273 | } |
| 274 | throw n3; |
| 275 | } }, u = 0, t = function(n3) { |
| 276 | return null != n3 && void 0 === n3.constructor; |
| 277 | }, C.prototype.setState = function(n3, l6) { |
| 278 | var u5; |
| 279 | u5 = null != this.__s && this.__s != this.state ? this.__s : this.__s = m({}, this.state), "function" == typeof n3 && (n3 = n3(m({}, u5), this.props)), n3 && m(u5, n3), null != n3 && this.__v && (l6 && this._sb.push(l6), A(this)); |
| 280 | }, C.prototype.forceUpdate = function(n3) { |
| 281 | this.__v && (this.__e = true, n3 && this.__h.push(n3), A(this)); |
| 282 | }, C.prototype.render = S, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n3, l6) { |
| 283 | return n3.__v.__b - l6.__v.__b; |
| 284 | }, H.__r = 0, f = Math.random().toString(8), c = "__d" + f, s = "__a" + f, a = /(PointerCapture)$|Capture$/i, h = 0, p = V(false), v = V(true), y = 0; |
| 285 | } |
| 286 | }); |
| 287 | |
| 288 | // node_modules/preact/devtools/dist/devtools.module.js |
| 289 | var i4; |
| 290 | var init_devtools_module = __esm({ |
| 291 | "node_modules/preact/devtools/dist/devtools.module.js"() { |
| 292 | init_preact_module(); |
| 293 | null != (i4 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : void 0) && i4.__PREACT_DEVTOOLS__ && i4.__PREACT_DEVTOOLS__.attachPreact("10.29.1", l, { Fragment: S, Component: C }); |
| 294 | } |
| 295 | }); |
| 296 | |
| 297 | // node_modules/preact/debug/dist/debug.module.js |
| 298 | var debug_module_exports = {}; |
| 299 | __export(debug_module_exports, { |
| 300 | getCurrentVNode: () => c4, |
| 301 | getDisplayName: () => a4, |
| 302 | getOwnerStack: () => f4, |
| 303 | resetPropWarnings: () => r4 |
| 304 | }); |
| 305 | function r4() { |
| 306 | t4 = {}; |
| 307 | } |
| 308 | function a4(e4) { |
| 309 | return e4.type === S ? "Fragment" : "function" == typeof e4.type ? e4.type.displayName || e4.type.name : "string" == typeof e4.type ? e4.type : "#text"; |
| 310 | } |
| 311 | function c4() { |
| 312 | return i5.length > 0 ? i5[i5.length - 1] : null; |
| 313 | } |
| 314 | function u4(e4) { |
| 315 | return "function" == typeof e4.type && e4.type != S; |
| 316 | } |
| 317 | function f4(n3) { |
| 318 | for (var e4 = [n3], o4 = n3; null != o4.__o; ) e4.push(o4.__o), o4 = o4.__o; |
| 319 | return e4.reduce(function(n4, e5) { |
| 320 | n4 += " in " + a4(e5); |
| 321 | var o5 = e5.__source; |
| 322 | return o5 ? n4 += " (at " + o5.fileName + ":" + o5.lineNumber + ")" : l5 && console.warn("Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons."), l5 = false, n4 + "\n"; |
| 323 | }, ""); |
| 324 | } |
| 325 | function p5(n3) { |
| 326 | var e4 = []; |
| 327 | return n3.__k ? (n3.__k.forEach(function(n4) { |
| 328 | n4 && "function" == typeof n4.type ? e4.push.apply(e4, p5(n4)) : n4 && "string" == typeof n4.type && e4.push(n4.type); |
| 329 | }), e4) : e4; |
| 330 | } |
| 331 | function h4(n3) { |
| 332 | return n3 ? "function" == typeof n3.type ? null == n3.__ ? null != n3.__e && null != n3.__e.parentNode ? n3.__e.parentNode.localName : "" : h4(n3.__) : n3.type : ""; |
| 333 | } |
| 334 | function y4(n3) { |
| 335 | return "table" === n3 || "tfoot" === n3 || "tbody" === n3 || "thead" === n3 || "td" === n3 || "tr" === n3 || "th" === n3; |
| 336 | } |
| 337 | function w4(n3) { |
| 338 | var e4 = n3.props, o4 = a4(n3), t5 = ""; |
| 339 | for (var r5 in e4) if (e4.hasOwnProperty(r5) && "children" !== r5) { |
| 340 | var i6 = e4[r5]; |
| 341 | "function" == typeof i6 && (i6 = "function " + (i6.displayName || i6.name) + "() {}"), i6 = Object(i6) !== i6 || i6.toString ? i6 + "" : Object.prototype.toString.call(i6), t5 += " " + r5 + "=" + JSON.stringify(i6); |
| 342 | } |
| 343 | var s6 = e4.children; |
| 344 | return "<" + o4 + t5 + (s6 && s6.length ? ">..</" + o4 + ">" : " />"); |
| 345 | } |
| 346 | var t4, i5, s5, l5, d5, v5, m3, b3; |
| 347 | var init_debug_module = __esm({ |
| 348 | "node_modules/preact/debug/dist/debug.module.js"() { |
| 349 | init_preact_module(); |
| 350 | init_devtools_module(); |
| 351 | t4 = {}; |
| 352 | i5 = []; |
| 353 | s5 = []; |
| 354 | l5 = true; |
| 355 | d5 = "function" == typeof WeakMap; |
| 356 | v5 = C.prototype.setState; |
| 357 | C.prototype.setState = function(n3, e4) { |
| 358 | return null == this.__v && null == this.state && console.warn('Calling "this.setState" inside the constructor of a component is a no-op and might be a bug in your application. Instead, set "this.state = {}" directly.\n\n' + f4(c4())), v5.call(this, n3, e4); |
| 359 | }; |
| 360 | m3 = /^(address|article|aside|blockquote|details|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|main|menu|nav|ol|p|pre|search|section|table|ul)$/; |
| 361 | b3 = C.prototype.forceUpdate; |
| 362 | C.prototype.forceUpdate = function(n3) { |
| 363 | return null == this.__v ? console.warn('Calling "this.forceUpdate" inside the constructor of a component is a no-op and might be a bug in your application.\n\n' + f4(c4())) : null == this.__P && console.warn(`Can't call "this.forceUpdate" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. |
| 364 | |
| 365 | ` + f4(this.__v)), b3.call(this, n3); |
| 366 | }, l.__m = function(n3, e4) { |
| 367 | var o4 = n3.type, t5 = e4.map(function(n4) { |
| 368 | return n4 && n4.localName; |
| 369 | }).filter(Boolean); |
| 370 | console.error('Expected a DOM node of type "' + o4 + '" but found "' + t5.join(", ") + `" as available DOM-node(s), this is caused by the SSR'd HTML containing different DOM-nodes compared to the hydrated one. |
| 371 | |
| 372 | ` + f4(n3)); |
| 373 | }, (function() { |
| 374 | !(function() { |
| 375 | var n4 = l.__b, o5 = l.diffed, t5 = l.__, r6 = l.vnode, a5 = l.__r; |
| 376 | l.diffed = function(n5) { |
| 377 | u4(n5) && s5.pop(), i5.pop(), o5 && o5(n5); |
| 378 | }, l.__b = function(e4) { |
| 379 | u4(e4) && i5.push(e4), n4 && n4(e4); |
| 380 | }, l.__ = function(n5, e4) { |
| 381 | s5 = [], t5 && t5(n5, e4); |
| 382 | }, l.vnode = function(n5) { |
| 383 | n5.__o = s5.length > 0 ? s5[s5.length - 1] : null, r6 && r6(n5); |
| 384 | }, l.__r = function(n5) { |
| 385 | u4(n5) && s5.push(n5), a5 && a5(n5); |
| 386 | }; |
| 387 | })(); |
| 388 | var n3 = false, o4 = l.__b, r5 = l.diffed, c5 = l.vnode, l6 = l.__r, v6 = l.__e, b4 = l.__, g3 = l.__h, E3 = d5 ? { useEffect: /* @__PURE__ */ new WeakMap(), useLayoutEffect: /* @__PURE__ */ new WeakMap(), lazyPropTypes: /* @__PURE__ */ new WeakMap() } : null, k3 = []; |
| 389 | l.__e = function(n4, e4, o5, t5) { |
| 390 | if (e4 && e4.__c && "function" == typeof n4.then) { |
| 391 | var r6 = n4; |
| 392 | n4 = new Error("Missing Suspense. The throwing component was: " + a4(e4)); |
| 393 | for (var i6 = e4; i6; i6 = i6.__) if (i6.__c && i6.__c.__c) { |
| 394 | n4 = r6; |
| 395 | break; |
| 396 | } |
| 397 | if (n4 instanceof Error) throw n4; |
| 398 | } |
| 399 | try { |
| 400 | (t5 = t5 || {}).componentStack = f4(e4), v6(n4, e4, o5, t5), "function" != typeof n4.then && setTimeout(function() { |
| 401 | throw n4; |
| 402 | }); |
| 403 | } catch (n5) { |
| 404 | throw n5; |
| 405 | } |
| 406 | }, l.__ = function(n4, e4) { |
| 407 | if (!e4) throw new Error("Undefined parent passed to render(), this is the second argument.\nCheck if the element is available in the DOM/has the correct id."); |
| 408 | var o5; |
| 409 | switch (e4.nodeType) { |
| 410 | case 1: |
| 411 | case 11: |
| 412 | case 9: |
| 413 | o5 = true; |
| 414 | break; |
| 415 | default: |
| 416 | o5 = false; |
| 417 | } |
| 418 | if (!o5) { |
| 419 | var t5 = a4(n4); |
| 420 | throw new Error("Expected a valid HTML node as a second argument to render. Received " + e4 + " instead: render(<" + t5 + " />, " + e4 + ");"); |
| 421 | } |
| 422 | b4 && b4(n4, e4); |
| 423 | }, l.__b = function(e4) { |
| 424 | var r6 = e4.type; |
| 425 | if (n3 = true, void 0 === r6) throw new Error("Undefined component passed to createElement()\n\nYou likely forgot to export your component or might have mixed up default and named imports" + w4(e4) + "\n\n" + f4(e4)); |
| 426 | if (null != r6 && "object" == typeof r6) { |
| 427 | if (void 0 !== r6.__k && void 0 !== r6.__e) throw new Error("Invalid type passed to createElement(): " + r6 + "\n\nDid you accidentally pass a JSX literal as JSX twice?\n\n let My" + a4(e4) + " = " + w4(r6) + ";\n let vnode = <My" + a4(e4) + " />;\n\nThis usually happens when you export a JSX literal and not the component.\n\n" + f4(e4)); |
| 428 | throw new Error("Invalid type passed to createElement(): " + (Array.isArray(r6) ? "array" : r6)); |
| 429 | } |
| 430 | if (void 0 !== e4.ref && "function" != typeof e4.ref && "object" != typeof e4.ref && !("$$typeof" in e4)) throw new Error(`Component's "ref" property should be a function, or an object created by createRef(), but got [` + typeof e4.ref + "] instead\n" + w4(e4) + "\n\n" + f4(e4)); |
| 431 | if ("string" == typeof e4.type) { |
| 432 | for (var i6 in e4.props) if ("o" === i6[0] && "n" === i6[1] && "function" != typeof e4.props[i6] && null != e4.props[i6]) throw new Error(`Component's "` + i6 + '" property should be a function, but got [' + typeof e4.props[i6] + "] instead\n" + w4(e4) + "\n\n" + f4(e4)); |
| 433 | } |
| 434 | if ("function" == typeof e4.type && e4.type.propTypes) { |
| 435 | if ("Lazy" === e4.type.displayName && E3 && !E3.lazyPropTypes.has(e4.type)) { |
| 436 | var s6 = "PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. "; |
| 437 | try { |
| 438 | var c6 = e4.type(); |
| 439 | E3.lazyPropTypes.set(e4.type, true), console.warn(s6 + "Component wrapped in lazy() is " + a4(c6)); |
| 440 | } catch (n4) { |
| 441 | console.warn(s6 + "We will log the wrapped component's name once it is loaded."); |
| 442 | } |
| 443 | } |
| 444 | var l7 = e4.props; |
| 445 | e4.type.__f && delete (l7 = (function(n4, e5) { |
| 446 | for (var o5 in e5) n4[o5] = e5[o5]; |
| 447 | return n4; |
| 448 | })({}, l7)).ref, (function(n4, e5, o5, r7, a5) { |
| 449 | Object.keys(n4).forEach(function(o6) { |
| 450 | var i7; |
| 451 | try { |
| 452 | i7 = n4[o6](e5, o6, r7, "prop", null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); |
| 453 | } catch (n5) { |
| 454 | i7 = n5; |
| 455 | } |
| 456 | i7 && !(i7.message in t4) && (t4[i7.message] = true, console.error("Failed prop type: " + i7.message + (a5 && "\n" + a5() || ""))); |
| 457 | }); |
| 458 | })(e4.type.propTypes, l7, 0, a4(e4), function() { |
| 459 | return f4(e4); |
| 460 | }); |
| 461 | } |
| 462 | o4 && o4(e4); |
| 463 | }; |
| 464 | var T3, _5 = 0; |
| 465 | l.__r = function(e4) { |
| 466 | l6 && l6(e4), n3 = true; |
| 467 | var o5 = e4.__c; |
| 468 | if (o5 === T3 ? _5++ : _5 = 1, _5 >= 25) throw new Error("Too many re-renders. This is limited to prevent an infinite loop which may lock up your browser. The component causing this is: " + a4(e4)); |
| 469 | T3 = o5; |
| 470 | }, l.__h = function(e4, o5, t5) { |
| 471 | if (!e4 || !n3) throw new Error("Hook can only be invoked from render methods."); |
| 472 | g3 && g3(e4, o5, t5); |
| 473 | }; |
| 474 | var O2 = function(n4, e4) { |
| 475 | return { get: function() { |
| 476 | var o5 = "get" + n4 + e4; |
| 477 | k3 && k3.indexOf(o5) < 0 && (k3.push(o5), console.warn("getting vnode." + n4 + " is deprecated, " + e4)); |
| 478 | }, set: function() { |
| 479 | var o5 = "set" + n4 + e4; |
| 480 | k3 && k3.indexOf(o5) < 0 && (k3.push(o5), console.warn("setting vnode." + n4 + " is not allowed, " + e4)); |
| 481 | } }; |
| 482 | }, I2 = { nodeName: O2("nodeName", "use vnode.type"), attributes: O2("attributes", "use vnode.props"), children: O2("children", "use vnode.props.children") }, M = Object.create({}, I2); |
| 483 | l.vnode = function(n4) { |
| 484 | var e4 = n4.props; |
| 485 | if (null !== n4.type && null != e4 && ("__source" in e4 || "__self" in e4)) { |
| 486 | var o5 = n4.props = {}; |
| 487 | for (var t5 in e4) { |
| 488 | var r6 = e4[t5]; |
| 489 | "__source" === t5 ? n4.__source = r6 : "__self" === t5 ? n4.__self = r6 : o5[t5] = r6; |
| 490 | } |
| 491 | } |
| 492 | n4.__proto__ = M, c5 && c5(n4); |
| 493 | }, l.diffed = function(e4) { |
| 494 | var o5, t5 = e4.type, i6 = e4.__; |
| 495 | if (e4.__k && e4.__k.forEach(function(n4) { |
| 496 | if ("object" == typeof n4 && n4 && void 0 === n4.type) { |
| 497 | var o6 = Object.keys(n4).join(","); |
| 498 | throw new Error("Objects are not valid as a child. Encountered an object with the keys {" + o6 + "}.\n\n" + f4(e4)); |
| 499 | } |
| 500 | }), e4.__c === T3 && (_5 = 0), "string" == typeof t5 && (y4(t5) || "p" === t5 || "a" === t5 || "button" === t5)) { |
| 501 | var s6 = h4(i6); |
| 502 | if ("" !== s6 && y4(t5)) "table" === t5 && "td" !== s6 && y4(s6) ? console.error("Improper nesting of table. Your <table> should not have a table-node parent." + w4(e4) + "\n\n" + f4(e4)) : "thead" !== t5 && "tfoot" !== t5 && "tbody" !== t5 || "table" === s6 ? "tr" === t5 && "thead" !== s6 && "tfoot" !== s6 && "tbody" !== s6 ? console.error("Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot> parent." + w4(e4) + "\n\n" + f4(e4)) : "td" === t5 && "tr" !== s6 ? console.error("Improper nesting of table. Your <td> should have a <tr> parent." + w4(e4) + "\n\n" + f4(e4)) : "th" === t5 && "tr" !== s6 && console.error("Improper nesting of table. Your <th> should have a <tr>." + w4(e4) + "\n\n" + f4(e4)) : console.error("Improper nesting of table. Your <thead/tbody/tfoot> should have a <table> parent." + w4(e4) + "\n\n" + f4(e4)); |
| 503 | else if ("p" === t5) { |
| 504 | var c6 = p5(e4).filter(function(n4) { |
| 505 | return m3.test(n4); |
| 506 | }); |
| 507 | c6.length && console.error("Improper nesting of paragraph. Your <p> should not have " + c6.join(", ") + " as child-elements." + w4(e4) + "\n\n" + f4(e4)); |
| 508 | } else "a" !== t5 && "button" !== t5 || -1 !== p5(e4).indexOf(t5) && console.error("Improper nesting of interactive content. Your <" + t5 + "> should not have other " + ("a" === t5 ? "anchor" : "button") + " tags as child-elements." + w4(e4) + "\n\n" + f4(e4)); |
| 509 | } |
| 510 | if (n3 = false, r5 && r5(e4), null != e4.__k) for (var l7 = [], u5 = 0; u5 < e4.__k.length; u5++) { |
| 511 | var d6 = e4.__k[u5]; |
| 512 | if (d6 && null != d6.key) { |
| 513 | var v7 = d6.key; |
| 514 | if (-1 !== l7.indexOf(v7)) { |
| 515 | console.error('Following component has two or more children with the same key attribute: "' + v7 + '". This may cause glitches and misbehavior in rendering process. Component: \n\n' + w4(e4) + "\n\n" + f4(e4)); |
| 516 | break; |
| 517 | } |
| 518 | l7.push(v7); |
| 519 | } |
| 520 | } |
| 521 | if (null != e4.__c && null != e4.__c.__H) { |
| 522 | var b5 = e4.__c.__H.__; |
| 523 | if (b5) for (var g4 = 0; g4 < b5.length; g4 += 1) { |
| 524 | var E4 = b5[g4]; |
| 525 | if (E4.__H) { |
| 526 | for (var k4 = 0; k4 < E4.__H.length; k4++) if ((o5 = E4.__H[k4]) != o5) { |
| 527 | var O3 = a4(e4); |
| 528 | console.warn("Invalid argument passed to hook. Hooks should not be called with NaN in the dependency array. Hook index " + g4 + " in component " + O3 + " was called with NaN."); |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | } |
| 533 | }; |
| 534 | })(); |
| 535 | } |
| 536 | }); |
| 537 | |
| 538 | // packages/interactivity/build-module/index.mjs |
| 539 | init_preact_module(); |
| 540 | |
| 541 | // node_modules/@preact/signals/dist/signals.module.js |
| 542 | init_preact_module(); |
| 543 | |
| 544 | // node_modules/preact/hooks/dist/hooks.module.js |
| 545 | init_preact_module(); |
| 546 | var t2; |
| 547 | var r2; |
| 548 | var u2; |
| 549 | var i2; |
| 550 | var o2 = 0; |
| 551 | var f2 = []; |
| 552 | var c2 = l; |
| 553 | var e2 = c2.__b; |
| 554 | var a2 = c2.__r; |
| 555 | var v2 = c2.diffed; |
| 556 | var l2 = c2.__c; |
| 557 | var m2 = c2.unmount; |
| 558 | var s2 = c2.__; |
| 559 | function p2(n3, t5) { |
| 560 | c2.__h && c2.__h(r2, n3, o2 || t5), o2 = 0; |
| 561 | var u5 = r2.__H || (r2.__H = { __: [], __h: [] }); |
| 562 | return n3 >= u5.__.length && u5.__.push({}), u5.__[n3]; |
| 563 | } |
| 564 | function d2(n3) { |
| 565 | return o2 = 1, h2(D2, n3); |
| 566 | } |
| 567 | function h2(n3, u5, i6) { |
| 568 | var o4 = p2(t2++, 2); |
| 569 | if (o4.t = n3, !o4.__c && (o4.__ = [i6 ? i6(u5) : D2(void 0, u5), function(n4) { |
| 570 | var t5 = o4.__N ? o4.__N[0] : o4.__[0], r5 = o4.t(t5, n4); |
| 571 | t5 !== r5 && (o4.__N = [r5, o4.__[1]], o4.__c.setState({})); |
| 572 | }], o4.__c = r2, !r2.__f)) { |
| 573 | var f5 = function(n4, t5, r5) { |
| 574 | if (!o4.__c.__H) return true; |
| 575 | var u6 = o4.__c.__H.__.filter(function(n5) { |
| 576 | return n5.__c; |
| 577 | }); |
| 578 | if (u6.every(function(n5) { |
| 579 | return !n5.__N; |
| 580 | })) return !c5 || c5.call(this, n4, t5, r5); |
| 581 | var i7 = o4.__c.props !== n4; |
| 582 | return u6.some(function(n5) { |
| 583 | if (n5.__N) { |
| 584 | var t6 = n5.__[0]; |
| 585 | n5.__ = n5.__N, n5.__N = void 0, t6 !== n5.__[0] && (i7 = true); |
| 586 | } |
| 587 | }), c5 && c5.call(this, n4, t5, r5) || i7; |
| 588 | }; |
| 589 | r2.__f = true; |
| 590 | var c5 = r2.shouldComponentUpdate, e4 = r2.componentWillUpdate; |
| 591 | r2.componentWillUpdate = function(n4, t5, r5) { |
| 592 | if (this.__e) { |
| 593 | var u6 = c5; |
| 594 | c5 = void 0, f5(n4, t5, r5), c5 = u6; |
| 595 | } |
| 596 | e4 && e4.call(this, n4, t5, r5); |
| 597 | }, r2.shouldComponentUpdate = f5; |
| 598 | } |
| 599 | return o4.__N || o4.__; |
| 600 | } |
| 601 | function y2(n3, u5) { |
| 602 | var i6 = p2(t2++, 3); |
| 603 | !c2.__s && C2(i6.__H, u5) && (i6.__ = n3, i6.u = u5, r2.__H.__h.push(i6)); |
| 604 | } |
| 605 | function _2(n3, u5) { |
| 606 | var i6 = p2(t2++, 4); |
| 607 | !c2.__s && C2(i6.__H, u5) && (i6.__ = n3, i6.u = u5, r2.__h.push(i6)); |
| 608 | } |
| 609 | function A2(n3) { |
| 610 | return o2 = 5, T2(function() { |
| 611 | return { current: n3 }; |
| 612 | }, []); |
| 613 | } |
| 614 | function T2(n3, r5) { |
| 615 | var u5 = p2(t2++, 7); |
| 616 | return C2(u5.__H, r5) && (u5.__ = n3(), u5.__H = r5, u5.__h = n3), u5.__; |
| 617 | } |
| 618 | function q2(n3, t5) { |
| 619 | return o2 = 8, T2(function() { |
| 620 | return n3; |
| 621 | }, t5); |
| 622 | } |
| 623 | function x2(n3) { |
| 624 | var u5 = r2.context[n3.__c], i6 = p2(t2++, 9); |
| 625 | return i6.c = n3, u5 ? (null == i6.__ && (i6.__ = true, u5.sub(r2)), u5.props.value) : n3.__; |
| 626 | } |
| 627 | function j2() { |
| 628 | for (var n3; n3 = f2.shift(); ) { |
| 629 | var t5 = n3.__H; |
| 630 | if (n3.__P && t5) try { |
| 631 | t5.__h.some(z2), t5.__h.some(B2), t5.__h = []; |
| 632 | } catch (r5) { |
| 633 | t5.__h = [], c2.__e(r5, n3.__v); |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | c2.__b = function(n3) { |
| 638 | r2 = null, e2 && e2(n3); |
| 639 | }, c2.__ = function(n3, t5) { |
| 640 | n3 && t5.__k && t5.__k.__m && (n3.__m = t5.__k.__m), s2 && s2(n3, t5); |
| 641 | }, c2.__r = function(n3) { |
| 642 | a2 && a2(n3), t2 = 0; |
| 643 | var i6 = (r2 = n3.__c).__H; |
| 644 | i6 && (u2 === r2 ? (i6.__h = [], r2.__h = [], i6.__.some(function(n4) { |
| 645 | n4.__N && (n4.__ = n4.__N), n4.u = n4.__N = void 0; |
| 646 | })) : (i6.__h.some(z2), i6.__h.some(B2), i6.__h = [], t2 = 0)), u2 = r2; |
| 647 | }, c2.diffed = function(n3) { |
| 648 | v2 && v2(n3); |
| 649 | var t5 = n3.__c; |
| 650 | t5 && t5.__H && (t5.__H.__h.length && (1 !== f2.push(t5) && i2 === c2.requestAnimationFrame || ((i2 = c2.requestAnimationFrame) || w2)(j2)), t5.__H.__.some(function(n4) { |
| 651 | n4.u && (n4.__H = n4.u), n4.u = void 0; |
| 652 | })), u2 = r2 = null; |
| 653 | }, c2.__c = function(n3, t5) { |
| 654 | t5.some(function(n4) { |
| 655 | try { |
| 656 | n4.__h.some(z2), n4.__h = n4.__h.filter(function(n5) { |
| 657 | return !n5.__ || B2(n5); |
| 658 | }); |
| 659 | } catch (r5) { |
| 660 | t5.some(function(n5) { |
| 661 | n5.__h && (n5.__h = []); |
| 662 | }), t5 = [], c2.__e(r5, n4.__v); |
| 663 | } |
| 664 | }), l2 && l2(n3, t5); |
| 665 | }, c2.unmount = function(n3) { |
| 666 | m2 && m2(n3); |
| 667 | var t5, r5 = n3.__c; |
| 668 | r5 && r5.__H && (r5.__H.__.some(function(n4) { |
| 669 | try { |
| 670 | z2(n4); |
| 671 | } catch (n5) { |
| 672 | t5 = n5; |
| 673 | } |
| 674 | }), r5.__H = void 0, t5 && c2.__e(t5, r5.__v)); |
| 675 | }; |
| 676 | var k2 = "function" == typeof requestAnimationFrame; |
| 677 | function w2(n3) { |
| 678 | var t5, r5 = function() { |
| 679 | clearTimeout(u5), k2 && cancelAnimationFrame(t5), setTimeout(n3); |
| 680 | }, u5 = setTimeout(r5, 35); |
| 681 | k2 && (t5 = requestAnimationFrame(r5)); |
| 682 | } |
| 683 | function z2(n3) { |
| 684 | var t5 = r2, u5 = n3.__c; |
| 685 | "function" == typeof u5 && (n3.__c = void 0, u5()), r2 = t5; |
| 686 | } |
| 687 | function B2(n3) { |
| 688 | var t5 = r2; |
| 689 | n3.__c = n3.__(), r2 = t5; |
| 690 | } |
| 691 | function C2(n3, t5) { |
| 692 | return !n3 || n3.length !== t5.length || t5.some(function(t6, r5) { |
| 693 | return t6 !== n3[r5]; |
| 694 | }); |
| 695 | } |
| 696 | function D2(n3, t5) { |
| 697 | return "function" == typeof t5 ? t5(n3) : t5; |
| 698 | } |
| 699 | |
| 700 | // node_modules/@preact/signals-core/dist/signals-core.module.js |
| 701 | var i3 = /* @__PURE__ */ Symbol.for("preact-signals"); |
| 702 | function t3() { |
| 703 | if (!(s3 > 1)) { |
| 704 | var i6, t5 = false; |
| 705 | while (void 0 !== h3) { |
| 706 | var r5 = h3; |
| 707 | h3 = void 0; |
| 708 | f3++; |
| 709 | while (void 0 !== r5) { |
| 710 | var o4 = r5.o; |
| 711 | r5.o = void 0; |
| 712 | r5.f &= -3; |
| 713 | if (!(8 & r5.f) && c3(r5)) try { |
| 714 | r5.c(); |
| 715 | } catch (r6) { |
| 716 | if (!t5) { |
| 717 | i6 = r6; |
| 718 | t5 = true; |
| 719 | } |
| 720 | } |
| 721 | r5 = o4; |
| 722 | } |
| 723 | } |
| 724 | f3 = 0; |
| 725 | s3--; |
| 726 | if (t5) throw i6; |
| 727 | } else s3--; |
| 728 | } |
| 729 | function r3(i6) { |
| 730 | if (s3 > 0) return i6(); |
| 731 | s3++; |
| 732 | try { |
| 733 | return i6(); |
| 734 | } finally { |
| 735 | t3(); |
| 736 | } |
| 737 | } |
| 738 | var o3 = void 0; |
| 739 | var h3 = void 0; |
| 740 | var s3 = 0; |
| 741 | var f3 = 0; |
| 742 | var v3 = 0; |
| 743 | function e3(i6) { |
| 744 | if (void 0 !== o3) { |
| 745 | var t5 = i6.n; |
| 746 | if (void 0 === t5 || t5.t !== o3) { |
| 747 | t5 = { i: 0, S: i6, p: o3.s, n: void 0, t: o3, e: void 0, x: void 0, r: t5 }; |
| 748 | if (void 0 !== o3.s) o3.s.n = t5; |
| 749 | o3.s = t5; |
| 750 | i6.n = t5; |
| 751 | if (32 & o3.f) i6.S(t5); |
| 752 | return t5; |
| 753 | } else if (-1 === t5.i) { |
| 754 | t5.i = 0; |
| 755 | if (void 0 !== t5.n) { |
| 756 | t5.n.p = t5.p; |
| 757 | if (void 0 !== t5.p) t5.p.n = t5.n; |
| 758 | t5.p = o3.s; |
| 759 | t5.n = void 0; |
| 760 | o3.s.n = t5; |
| 761 | o3.s = t5; |
| 762 | } |
| 763 | return t5; |
| 764 | } |
| 765 | } |
| 766 | } |
| 767 | function u3(i6) { |
| 768 | this.v = i6; |
| 769 | this.i = 0; |
| 770 | this.n = void 0; |
| 771 | this.t = void 0; |
| 772 | } |
| 773 | u3.prototype.brand = i3; |
| 774 | u3.prototype.h = function() { |
| 775 | return true; |
| 776 | }; |
| 777 | u3.prototype.S = function(i6) { |
| 778 | if (this.t !== i6 && void 0 === i6.e) { |
| 779 | i6.x = this.t; |
| 780 | if (void 0 !== this.t) this.t.e = i6; |
| 781 | this.t = i6; |
| 782 | } |
| 783 | }; |
| 784 | u3.prototype.U = function(i6) { |
| 785 | if (void 0 !== this.t) { |
| 786 | var t5 = i6.e, r5 = i6.x; |
| 787 | if (void 0 !== t5) { |
| 788 | t5.x = r5; |
| 789 | i6.e = void 0; |
| 790 | } |
| 791 | if (void 0 !== r5) { |
| 792 | r5.e = t5; |
| 793 | i6.x = void 0; |
| 794 | } |
| 795 | if (i6 === this.t) this.t = r5; |
| 796 | } |
| 797 | }; |
| 798 | u3.prototype.subscribe = function(i6) { |
| 799 | var t5 = this; |
| 800 | return E2(function() { |
| 801 | var r5 = t5.value, n3 = o3; |
| 802 | o3 = void 0; |
| 803 | try { |
| 804 | i6(r5); |
| 805 | } finally { |
| 806 | o3 = n3; |
| 807 | } |
| 808 | }); |
| 809 | }; |
| 810 | u3.prototype.valueOf = function() { |
| 811 | return this.value; |
| 812 | }; |
| 813 | u3.prototype.toString = function() { |
| 814 | return this.value + ""; |
| 815 | }; |
| 816 | u3.prototype.toJSON = function() { |
| 817 | return this.value; |
| 818 | }; |
| 819 | u3.prototype.peek = function() { |
| 820 | var i6 = o3; |
| 821 | o3 = void 0; |
| 822 | try { |
| 823 | return this.value; |
| 824 | } finally { |
| 825 | o3 = i6; |
| 826 | } |
| 827 | }; |
| 828 | Object.defineProperty(u3.prototype, "value", { get: function() { |
| 829 | var i6 = e3(this); |
| 830 | if (void 0 !== i6) i6.i = this.i; |
| 831 | return this.v; |
| 832 | }, set: function(i6) { |
| 833 | if (i6 !== this.v) { |
| 834 | if (f3 > 100) throw new Error("Cycle detected"); |
| 835 | this.v = i6; |
| 836 | this.i++; |
| 837 | v3++; |
| 838 | s3++; |
| 839 | try { |
| 840 | for (var r5 = this.t; void 0 !== r5; r5 = r5.x) r5.t.N(); |
| 841 | } finally { |
| 842 | t3(); |
| 843 | } |
| 844 | } |
| 845 | } }); |
| 846 | function d3(i6) { |
| 847 | return new u3(i6); |
| 848 | } |
| 849 | function c3(i6) { |
| 850 | for (var t5 = i6.s; void 0 !== t5; t5 = t5.n) if (t5.S.i !== t5.i || !t5.S.h() || t5.S.i !== t5.i) return true; |
| 851 | return false; |
| 852 | } |
| 853 | function a3(i6) { |
| 854 | for (var t5 = i6.s; void 0 !== t5; t5 = t5.n) { |
| 855 | var r5 = t5.S.n; |
| 856 | if (void 0 !== r5) t5.r = r5; |
| 857 | t5.S.n = t5; |
| 858 | t5.i = -1; |
| 859 | if (void 0 === t5.n) { |
| 860 | i6.s = t5; |
| 861 | break; |
| 862 | } |
| 863 | } |
| 864 | } |
| 865 | function l3(i6) { |
| 866 | var t5 = i6.s, r5 = void 0; |
| 867 | while (void 0 !== t5) { |
| 868 | var o4 = t5.p; |
| 869 | if (-1 === t5.i) { |
| 870 | t5.S.U(t5); |
| 871 | if (void 0 !== o4) o4.n = t5.n; |
| 872 | if (void 0 !== t5.n) t5.n.p = o4; |
| 873 | } else r5 = t5; |
| 874 | t5.S.n = t5.r; |
| 875 | if (void 0 !== t5.r) t5.r = void 0; |
| 876 | t5 = o4; |
| 877 | } |
| 878 | i6.s = r5; |
| 879 | } |
| 880 | function y3(i6) { |
| 881 | u3.call(this, void 0); |
| 882 | this.x = i6; |
| 883 | this.s = void 0; |
| 884 | this.g = v3 - 1; |
| 885 | this.f = 4; |
| 886 | } |
| 887 | (y3.prototype = new u3()).h = function() { |
| 888 | this.f &= -3; |
| 889 | if (1 & this.f) return false; |
| 890 | if (32 == (36 & this.f)) return true; |
| 891 | this.f &= -5; |
| 892 | if (this.g === v3) return true; |
| 893 | this.g = v3; |
| 894 | this.f |= 1; |
| 895 | if (this.i > 0 && !c3(this)) { |
| 896 | this.f &= -2; |
| 897 | return true; |
| 898 | } |
| 899 | var i6 = o3; |
| 900 | try { |
| 901 | a3(this); |
| 902 | o3 = this; |
| 903 | var t5 = this.x(); |
| 904 | if (16 & this.f || this.v !== t5 || 0 === this.i) { |
| 905 | this.v = t5; |
| 906 | this.f &= -17; |
| 907 | this.i++; |
| 908 | } |
| 909 | } catch (i7) { |
| 910 | this.v = i7; |
| 911 | this.f |= 16; |
| 912 | this.i++; |
| 913 | } |
| 914 | o3 = i6; |
| 915 | l3(this); |
| 916 | this.f &= -2; |
| 917 | return true; |
| 918 | }; |
| 919 | y3.prototype.S = function(i6) { |
| 920 | if (void 0 === this.t) { |
| 921 | this.f |= 36; |
| 922 | for (var t5 = this.s; void 0 !== t5; t5 = t5.n) t5.S.S(t5); |
| 923 | } |
| 924 | u3.prototype.S.call(this, i6); |
| 925 | }; |
| 926 | y3.prototype.U = function(i6) { |
| 927 | if (void 0 !== this.t) { |
| 928 | u3.prototype.U.call(this, i6); |
| 929 | if (void 0 === this.t) { |
| 930 | this.f &= -33; |
| 931 | for (var t5 = this.s; void 0 !== t5; t5 = t5.n) t5.S.U(t5); |
| 932 | } |
| 933 | } |
| 934 | }; |
| 935 | y3.prototype.N = function() { |
| 936 | if (!(2 & this.f)) { |
| 937 | this.f |= 6; |
| 938 | for (var i6 = this.t; void 0 !== i6; i6 = i6.x) i6.t.N(); |
| 939 | } |
| 940 | }; |
| 941 | Object.defineProperty(y3.prototype, "value", { get: function() { |
| 942 | if (1 & this.f) throw new Error("Cycle detected"); |
| 943 | var i6 = e3(this); |
| 944 | this.h(); |
| 945 | if (void 0 !== i6) i6.i = this.i; |
| 946 | if (16 & this.f) throw this.v; |
| 947 | return this.v; |
| 948 | } }); |
| 949 | function w3(i6) { |
| 950 | return new y3(i6); |
| 951 | } |
| 952 | function _3(i6) { |
| 953 | var r5 = i6.u; |
| 954 | i6.u = void 0; |
| 955 | if ("function" == typeof r5) { |
| 956 | s3++; |
| 957 | var n3 = o3; |
| 958 | o3 = void 0; |
| 959 | try { |
| 960 | r5(); |
| 961 | } catch (t5) { |
| 962 | i6.f &= -2; |
| 963 | i6.f |= 8; |
| 964 | g2(i6); |
| 965 | throw t5; |
| 966 | } finally { |
| 967 | o3 = n3; |
| 968 | t3(); |
| 969 | } |
| 970 | } |
| 971 | } |
| 972 | function g2(i6) { |
| 973 | for (var t5 = i6.s; void 0 !== t5; t5 = t5.n) t5.S.U(t5); |
| 974 | i6.x = void 0; |
| 975 | i6.s = void 0; |
| 976 | _3(i6); |
| 977 | } |
| 978 | function p3(i6) { |
| 979 | if (o3 !== this) throw new Error("Out-of-order effect"); |
| 980 | l3(this); |
| 981 | o3 = i6; |
| 982 | this.f &= -2; |
| 983 | if (8 & this.f) g2(this); |
| 984 | t3(); |
| 985 | } |
| 986 | function b2(i6) { |
| 987 | this.x = i6; |
| 988 | this.u = void 0; |
| 989 | this.s = void 0; |
| 990 | this.o = void 0; |
| 991 | this.f = 32; |
| 992 | } |
| 993 | b2.prototype.c = function() { |
| 994 | var i6 = this.S(); |
| 995 | try { |
| 996 | if (8 & this.f) return; |
| 997 | if (void 0 === this.x) return; |
| 998 | var t5 = this.x(); |
| 999 | if ("function" == typeof t5) this.u = t5; |
| 1000 | } finally { |
| 1001 | i6(); |
| 1002 | } |
| 1003 | }; |
| 1004 | b2.prototype.S = function() { |
| 1005 | if (1 & this.f) throw new Error("Cycle detected"); |
| 1006 | this.f |= 1; |
| 1007 | this.f &= -9; |
| 1008 | _3(this); |
| 1009 | a3(this); |
| 1010 | s3++; |
| 1011 | var i6 = o3; |
| 1012 | o3 = this; |
| 1013 | return p3.bind(this, i6); |
| 1014 | }; |
| 1015 | b2.prototype.N = function() { |
| 1016 | if (!(2 & this.f)) { |
| 1017 | this.f |= 2; |
| 1018 | this.o = h3; |
| 1019 | h3 = this; |
| 1020 | } |
| 1021 | }; |
| 1022 | b2.prototype.d = function() { |
| 1023 | this.f |= 8; |
| 1024 | if (!(1 & this.f)) g2(this); |
| 1025 | }; |
| 1026 | function E2(i6) { |
| 1027 | var t5 = new b2(i6); |
| 1028 | try { |
| 1029 | t5.c(); |
| 1030 | } catch (i7) { |
| 1031 | t5.d(); |
| 1032 | throw i7; |
| 1033 | } |
| 1034 | return t5.d.bind(t5); |
| 1035 | } |
| 1036 | |
| 1037 | // node_modules/@preact/signals/dist/signals.module.js |
| 1038 | var v4; |
| 1039 | var s4; |
| 1040 | function l4(n3, i6) { |
| 1041 | l[n3] = i6.bind(null, l[n3] || function() { |
| 1042 | }); |
| 1043 | } |
| 1044 | function d4(n3) { |
| 1045 | if (s4) s4(); |
| 1046 | s4 = n3 && n3.S(); |
| 1047 | } |
| 1048 | function p4(n3) { |
| 1049 | var r5 = this, f5 = n3.data, o4 = useSignal(f5); |
| 1050 | o4.value = f5; |
| 1051 | var e4 = T2(function() { |
| 1052 | var n4 = r5.__v; |
| 1053 | while (n4 = n4.__) if (n4.__c) { |
| 1054 | n4.__c.__$f |= 4; |
| 1055 | break; |
| 1056 | } |
| 1057 | r5.__$u.c = function() { |
| 1058 | var n5; |
| 1059 | if (!t(e4.peek()) && 3 === (null == (n5 = r5.base) ? void 0 : n5.nodeType)) r5.base.data = e4.peek(); |
| 1060 | else { |
| 1061 | r5.__$f |= 1; |
| 1062 | r5.setState({}); |
| 1063 | } |
| 1064 | }; |
| 1065 | return w3(function() { |
| 1066 | var n5 = o4.value.value; |
| 1067 | return 0 === n5 ? 0 : true === n5 ? "" : n5 || ""; |
| 1068 | }); |
| 1069 | }, []); |
| 1070 | return e4.value; |
| 1071 | } |
| 1072 | p4.displayName = "_st"; |
| 1073 | Object.defineProperties(u3.prototype, { constructor: { configurable: true, value: void 0 }, type: { configurable: true, value: p4 }, props: { configurable: true, get: function() { |
| 1074 | return { data: this }; |
| 1075 | } }, __b: { configurable: true, value: 1 } }); |
| 1076 | l4("__b", function(n3, r5) { |
| 1077 | if ("string" == typeof r5.type) { |
| 1078 | var i6, t5 = r5.props; |
| 1079 | for (var f5 in t5) if ("children" !== f5) { |
| 1080 | var o4 = t5[f5]; |
| 1081 | if (o4 instanceof u3) { |
| 1082 | if (!i6) r5.__np = i6 = {}; |
| 1083 | i6[f5] = o4; |
| 1084 | t5[f5] = o4.peek(); |
| 1085 | } |
| 1086 | } |
| 1087 | } |
| 1088 | n3(r5); |
| 1089 | }); |
| 1090 | l4("__r", function(n3, r5) { |
| 1091 | d4(); |
| 1092 | var i6, t5 = r5.__c; |
| 1093 | if (t5) { |
| 1094 | t5.__$f &= -2; |
| 1095 | if (void 0 === (i6 = t5.__$u)) t5.__$u = i6 = (function(n4) { |
| 1096 | var r6; |
| 1097 | E2(function() { |
| 1098 | r6 = this; |
| 1099 | }); |
| 1100 | r6.c = function() { |
| 1101 | t5.__$f |= 1; |
| 1102 | t5.setState({}); |
| 1103 | }; |
| 1104 | return r6; |
| 1105 | })(); |
| 1106 | } |
| 1107 | v4 = t5; |
| 1108 | d4(i6); |
| 1109 | n3(r5); |
| 1110 | }); |
| 1111 | l4("__e", function(n3, r5, i6, t5) { |
| 1112 | d4(); |
| 1113 | v4 = void 0; |
| 1114 | n3(r5, i6, t5); |
| 1115 | }); |
| 1116 | l4("diffed", function(n3, r5) { |
| 1117 | d4(); |
| 1118 | v4 = void 0; |
| 1119 | var i6; |
| 1120 | if ("string" == typeof r5.type && (i6 = r5.__e)) { |
| 1121 | var t5 = r5.__np, f5 = r5.props; |
| 1122 | if (t5) { |
| 1123 | var o4 = i6.U; |
| 1124 | if (o4) for (var e4 in o4) { |
| 1125 | var u5 = o4[e4]; |
| 1126 | if (void 0 !== u5 && !(e4 in t5)) { |
| 1127 | u5.d(); |
| 1128 | o4[e4] = void 0; |
| 1129 | } |
| 1130 | } |
| 1131 | else i6.U = o4 = {}; |
| 1132 | for (var a5 in t5) { |
| 1133 | var c5 = o4[a5], s6 = t5[a5]; |
| 1134 | if (void 0 === c5) { |
| 1135 | c5 = _4(i6, a5, s6, f5); |
| 1136 | o4[a5] = c5; |
| 1137 | } else c5.o(s6, f5); |
| 1138 | } |
| 1139 | } |
| 1140 | } |
| 1141 | n3(r5); |
| 1142 | }); |
| 1143 | function _4(n3, r5, i6, t5) { |
| 1144 | var f5 = r5 in n3 && void 0 === n3.ownerSVGElement, o4 = d3(i6); |
| 1145 | return { o: function(n4, r6) { |
| 1146 | o4.value = n4; |
| 1147 | t5 = r6; |
| 1148 | }, d: E2(function() { |
| 1149 | var i7 = o4.value.value; |
| 1150 | if (t5[r5] !== i7) { |
| 1151 | t5[r5] = i7; |
| 1152 | if (f5) n3[r5] = i7; |
| 1153 | else if (i7) n3.setAttribute(r5, i7); |
| 1154 | else n3.removeAttribute(r5); |
| 1155 | } |
| 1156 | }) }; |
| 1157 | } |
| 1158 | l4("unmount", function(n3, r5) { |
| 1159 | if ("string" == typeof r5.type) { |
| 1160 | var i6 = r5.__e; |
| 1161 | if (i6) { |
| 1162 | var t5 = i6.U; |
| 1163 | if (t5) { |
| 1164 | i6.U = void 0; |
| 1165 | for (var f5 in t5) { |
| 1166 | var o4 = t5[f5]; |
| 1167 | if (o4) o4.d(); |
| 1168 | } |
| 1169 | } |
| 1170 | } |
| 1171 | } else { |
| 1172 | var e4 = r5.__c; |
| 1173 | if (e4) { |
| 1174 | var u5 = e4.__$u; |
| 1175 | if (u5) { |
| 1176 | e4.__$u = void 0; |
| 1177 | u5.d(); |
| 1178 | } |
| 1179 | } |
| 1180 | } |
| 1181 | n3(r5); |
| 1182 | }); |
| 1183 | l4("__h", function(n3, r5, i6, t5) { |
| 1184 | if (t5 < 3 || 9 === t5) r5.__$f |= 2; |
| 1185 | n3(r5, i6, t5); |
| 1186 | }); |
| 1187 | C.prototype.shouldComponentUpdate = function(n3, r5) { |
| 1188 | var i6 = this.__$u; |
| 1189 | if (!(i6 && void 0 !== i6.s || 4 & this.__$f)) return true; |
| 1190 | if (3 & this.__$f) return true; |
| 1191 | for (var t5 in r5) return true; |
| 1192 | for (var f5 in n3) if ("__source" !== f5 && n3[f5] !== this.props[f5]) return true; |
| 1193 | for (var o4 in this.props) if (!(o4 in n3)) return true; |
| 1194 | return false; |
| 1195 | }; |
| 1196 | function useSignal(n3) { |
| 1197 | return T2(function() { |
| 1198 | return d3(n3); |
| 1199 | }, []); |
| 1200 | } |
| 1201 | |
| 1202 | // packages/interactivity/build-module/directives.mjs |
| 1203 | init_preact_module(); |
| 1204 | |
| 1205 | // packages/interactivity/build-module/namespaces.mjs |
| 1206 | var namespaceStack = []; |
| 1207 | var getNamespace = () => namespaceStack.slice(-1)[0]; |
| 1208 | var setNamespace = (namespace) => { |
| 1209 | namespaceStack.push(namespace); |
| 1210 | }; |
| 1211 | var resetNamespace = () => { |
| 1212 | namespaceStack.pop(); |
| 1213 | }; |
| 1214 | |
| 1215 | // packages/interactivity/build-module/scopes.mjs |
| 1216 | var scopeStack = []; |
| 1217 | var getScope = () => scopeStack.slice(-1)[0]; |
| 1218 | var setScope = (scope) => { |
| 1219 | scopeStack.push(scope); |
| 1220 | }; |
| 1221 | var resetScope = () => { |
| 1222 | scopeStack.pop(); |
| 1223 | }; |
| 1224 | var throwNotInScope = (method) => { |
| 1225 | throw Error( |
| 1226 | `Cannot call \`${method}()\` when there is no scope. If you are using an async function, please consider using a generator instead. If you are using some sort of async callbacks, like \`setTimeout\`, please wrap the callback with \`withScope(callback)\`.` |
| 1227 | ); |
| 1228 | }; |
| 1229 | var getContext = (namespace) => { |
| 1230 | const scope = getScope(); |
| 1231 | if (true) { |
| 1232 | if (!scope) { |
| 1233 | throwNotInScope("getContext"); |
| 1234 | } |
| 1235 | } |
| 1236 | return scope.context[namespace || getNamespace()]; |
| 1237 | }; |
| 1238 | var getElement = () => { |
| 1239 | const scope = getScope(); |
| 1240 | let deepReadOnlyOptions = {}; |
| 1241 | if (true) { |
| 1242 | if (!scope) { |
| 1243 | throwNotInScope("getElement"); |
| 1244 | } |
| 1245 | deepReadOnlyOptions = { |
| 1246 | errorMessage: "Don't mutate the attributes from `getElement`, use `data-wp-bind` to modify the attributes of an element instead." |
| 1247 | }; |
| 1248 | } |
| 1249 | const { ref, attributes } = scope; |
| 1250 | return Object.freeze({ |
| 1251 | ref: ref.current, |
| 1252 | attributes: deepReadOnly(attributes, deepReadOnlyOptions) |
| 1253 | }); |
| 1254 | }; |
| 1255 | var navigationContextSignal = d3(0); |
| 1256 | function getServerContext(namespace) { |
| 1257 | const scope = getScope(); |
| 1258 | if (true) { |
| 1259 | if (!scope) { |
| 1260 | throwNotInScope("getServerContext"); |
| 1261 | } |
| 1262 | } |
| 1263 | getServerContext.subscribe = navigationContextSignal.value; |
| 1264 | return deepClone(scope.serverContext[namespace || getNamespace()]); |
| 1265 | } |
| 1266 | getServerContext.subscribe = 0; |
| 1267 | |
| 1268 | // packages/interactivity/build-module/utils.mjs |
| 1269 | var afterNextFrame = (callback) => { |
| 1270 | return new Promise((resolve2) => { |
| 1271 | const done = () => { |
| 1272 | clearTimeout(timeout); |
| 1273 | window.cancelAnimationFrame(raf); |
| 1274 | setTimeout(() => { |
| 1275 | callback(); |
| 1276 | resolve2(); |
| 1277 | }); |
| 1278 | }; |
| 1279 | const timeout = setTimeout(done, 100); |
| 1280 | const raf = window.requestAnimationFrame(done); |
| 1281 | }); |
| 1282 | }; |
| 1283 | var splitTask = typeof window.scheduler?.yield === "function" ? window.scheduler.yield.bind(window.scheduler) : () => { |
| 1284 | return new Promise((resolve2) => { |
| 1285 | setTimeout(resolve2, 0); |
| 1286 | }); |
| 1287 | }; |
| 1288 | var onDOMReady = (callback) => { |
| 1289 | const [navigation] = performance.getEntriesByType("navigation"); |
| 1290 | if (navigation.domContentLoadedEventStart > 0) { |
| 1291 | callback(); |
| 1292 | } else { |
| 1293 | document.addEventListener("DOMContentLoaded", callback); |
| 1294 | } |
| 1295 | }; |
| 1296 | function createFlusher(compute, notify) { |
| 1297 | let flush = () => void 0; |
| 1298 | const dispose = E2(function() { |
| 1299 | flush = this.c.bind(this); |
| 1300 | this.x = compute; |
| 1301 | this.c = notify; |
| 1302 | return compute(); |
| 1303 | }); |
| 1304 | return { flush, dispose }; |
| 1305 | } |
| 1306 | function useSignalEffect(callback) { |
| 1307 | y2(() => { |
| 1308 | let eff = null; |
| 1309 | let isExecuting = false; |
| 1310 | const notify = async () => { |
| 1311 | if (eff && !isExecuting) { |
| 1312 | isExecuting = true; |
| 1313 | await afterNextFrame(eff.flush); |
| 1314 | isExecuting = false; |
| 1315 | } |
| 1316 | }; |
| 1317 | eff = createFlusher(callback, notify); |
| 1318 | return eff.dispose; |
| 1319 | }, []); |
| 1320 | } |
| 1321 | function withScope(func) { |
| 1322 | const scope = getScope(); |
| 1323 | const ns = getNamespace(); |
| 1324 | let wrapped; |
| 1325 | if (func?.constructor?.name === "GeneratorFunction") { |
| 1326 | wrapped = async (...args) => { |
| 1327 | const gen = func(...args); |
| 1328 | let value; |
| 1329 | let it; |
| 1330 | let error; |
| 1331 | while (true) { |
| 1332 | setNamespace(ns); |
| 1333 | setScope(scope); |
| 1334 | try { |
| 1335 | it = error ? gen.throw(error) : gen.next(value); |
| 1336 | error = void 0; |
| 1337 | } catch (e4) { |
| 1338 | throw e4; |
| 1339 | } finally { |
| 1340 | resetScope(); |
| 1341 | resetNamespace(); |
| 1342 | } |
| 1343 | try { |
| 1344 | value = await it.value; |
| 1345 | } catch (e4) { |
| 1346 | error = e4; |
| 1347 | } |
| 1348 | if (it.done) { |
| 1349 | if (error) { |
| 1350 | throw error; |
| 1351 | } else { |
| 1352 | break; |
| 1353 | } |
| 1354 | } |
| 1355 | } |
| 1356 | return value; |
| 1357 | }; |
| 1358 | } else { |
| 1359 | wrapped = (...args) => { |
| 1360 | setNamespace(ns); |
| 1361 | setScope(scope); |
| 1362 | try { |
| 1363 | return func(...args); |
| 1364 | } finally { |
| 1365 | resetNamespace(); |
| 1366 | resetScope(); |
| 1367 | } |
| 1368 | }; |
| 1369 | } |
| 1370 | const syncAware = func; |
| 1371 | if (syncAware.sync) { |
| 1372 | const syncAwareWrapped = wrapped; |
| 1373 | syncAwareWrapped.sync = true; |
| 1374 | return syncAwareWrapped; |
| 1375 | } |
| 1376 | return wrapped; |
| 1377 | } |
| 1378 | function useWatch(callback) { |
| 1379 | useSignalEffect(withScope(callback)); |
| 1380 | } |
| 1381 | function useInit(callback) { |
| 1382 | y2(withScope(callback), []); |
| 1383 | } |
| 1384 | function useEffect(callback, inputs) { |
| 1385 | y2(withScope(callback), inputs); |
| 1386 | } |
| 1387 | function useLayoutEffect(callback, inputs) { |
| 1388 | _2(withScope(callback), inputs); |
| 1389 | } |
| 1390 | function useCallback(callback, inputs) { |
| 1391 | return q2(withScope(callback), inputs); |
| 1392 | } |
| 1393 | function useMemo(factory, inputs) { |
| 1394 | return T2(withScope(factory), inputs); |
| 1395 | } |
| 1396 | var createRootFragment = (parent, replaceNode) => { |
| 1397 | replaceNode = [].concat(replaceNode); |
| 1398 | const sibling = replaceNode[replaceNode.length - 1].nextSibling; |
| 1399 | function insert(child, root) { |
| 1400 | parent.insertBefore(child, root || sibling); |
| 1401 | } |
| 1402 | return parent.__k = { |
| 1403 | nodeType: 1, |
| 1404 | parentNode: parent, |
| 1405 | firstChild: replaceNode[0], |
| 1406 | childNodes: replaceNode, |
| 1407 | insertBefore: insert, |
| 1408 | appendChild: insert, |
| 1409 | removeChild(c5) { |
| 1410 | parent.removeChild(c5); |
| 1411 | }, |
| 1412 | contains(c5) { |
| 1413 | parent.contains(c5); |
| 1414 | } |
| 1415 | }; |
| 1416 | }; |
| 1417 | function kebabToCamelCase(str) { |
| 1418 | return str.replace(/^-+|-+$/g, "").toLowerCase().replace(/-([a-z])/g, function(_match, group1) { |
| 1419 | return group1.toUpperCase(); |
| 1420 | }); |
| 1421 | } |
| 1422 | var logged = /* @__PURE__ */ new Set(); |
| 1423 | var warn = (message) => { |
| 1424 | if (true) { |
| 1425 | if (logged.has(message)) { |
| 1426 | return; |
| 1427 | } |
| 1428 | console.warn(message); |
| 1429 | try { |
| 1430 | throw Error(message); |
| 1431 | } catch { |
| 1432 | } |
| 1433 | logged.add(message); |
| 1434 | } |
| 1435 | }; |
| 1436 | var isPlainObject = (candidate) => Boolean( |
| 1437 | candidate && typeof candidate === "object" && candidate.constructor === Object |
| 1438 | ); |
| 1439 | function withSyncEvent(callback) { |
| 1440 | const syncAware = callback; |
| 1441 | syncAware.sync = true; |
| 1442 | return syncAware; |
| 1443 | } |
| 1444 | var readOnlyMap = /* @__PURE__ */ new WeakMap(); |
| 1445 | var createDeepReadOnlyHandlers = (errorMessage) => { |
| 1446 | const handleError = () => { |
| 1447 | if (true) { |
| 1448 | warn(errorMessage); |
| 1449 | } |
| 1450 | return false; |
| 1451 | }; |
| 1452 | return { |
| 1453 | get(target, prop) { |
| 1454 | const value = target[prop]; |
| 1455 | if (value && typeof value === "object") { |
| 1456 | return deepReadOnly(value, { errorMessage }); |
| 1457 | } |
| 1458 | return value; |
| 1459 | }, |
| 1460 | set: handleError, |
| 1461 | deleteProperty: handleError, |
| 1462 | defineProperty: handleError |
| 1463 | }; |
| 1464 | }; |
| 1465 | function deepReadOnly(obj, options) { |
| 1466 | const errorMessage = options?.errorMessage ?? "Cannot modify read-only object"; |
| 1467 | if (!readOnlyMap.has(obj)) { |
| 1468 | const handlers = createDeepReadOnlyHandlers(errorMessage); |
| 1469 | readOnlyMap.set(obj, new Proxy(obj, handlers)); |
| 1470 | } |
| 1471 | return readOnlyMap.get(obj); |
| 1472 | } |
| 1473 | var navigationSignal = d3(0); |
| 1474 | var sessionId = Math.random().toString(36).slice(2); |
| 1475 | function deepClone(source) { |
| 1476 | if (isPlainObject(source)) { |
| 1477 | return Object.fromEntries( |
| 1478 | Object.entries(source).map(([key, value]) => [ |
| 1479 | key, |
| 1480 | deepClone(value) |
| 1481 | ]) |
| 1482 | ); |
| 1483 | } |
| 1484 | if (Array.isArray(source)) { |
| 1485 | return source.map((i6) => deepClone(i6)); |
| 1486 | } |
| 1487 | return source; |
| 1488 | } |
| 1489 | |
| 1490 | // packages/interactivity/build-module/hooks.mjs |
| 1491 | init_preact_module(); |
| 1492 | |
| 1493 | // packages/interactivity/build-module/proxies/registry.mjs |
| 1494 | var objToProxy = /* @__PURE__ */ new WeakMap(); |
| 1495 | var proxyToObj = /* @__PURE__ */ new WeakMap(); |
| 1496 | var proxyToNs = /* @__PURE__ */ new WeakMap(); |
| 1497 | var supported = /* @__PURE__ */ new Set([Object, Array]); |
| 1498 | var createProxy = (namespace, obj, handlers) => { |
| 1499 | if (!shouldProxy(obj)) { |
| 1500 | throw Error("This object cannot be proxified."); |
| 1501 | } |
| 1502 | if (!objToProxy.has(obj)) { |
| 1503 | const proxy = new Proxy(obj, handlers); |
| 1504 | objToProxy.set(obj, proxy); |
| 1505 | proxyToObj.set(proxy, obj); |
| 1506 | proxyToNs.set(proxy, namespace); |
| 1507 | } |
| 1508 | return objToProxy.get(obj); |
| 1509 | }; |
| 1510 | var getProxyFromObject = (obj) => objToProxy.get(obj); |
| 1511 | var getNamespaceFromProxy = (proxy) => proxyToNs.get(proxy); |
| 1512 | var shouldProxy = (candidate) => { |
| 1513 | if (typeof candidate !== "object" || candidate === null) { |
| 1514 | return false; |
| 1515 | } |
| 1516 | return !proxyToNs.has(candidate) && supported.has(candidate.constructor); |
| 1517 | }; |
| 1518 | var getObjectFromProxy = (proxy) => proxyToObj.get(proxy); |
| 1519 | |
| 1520 | // packages/interactivity/build-module/proxies/signals.mjs |
| 1521 | var NO_SCOPE = {}; |
| 1522 | var PropSignal = class { |
| 1523 | /** |
| 1524 | * Proxy that holds the property this PropSignal is associated with. |
| 1525 | */ |
| 1526 | owner; |
| 1527 | /** |
| 1528 | * Relation of computeds by scope. These computeds are read-only signals |
| 1529 | * that depend on whether the property is a value or a getter and, |
| 1530 | * therefore, can return different values depending on the scope in which |
| 1531 | * the getter is accessed. |
| 1532 | */ |
| 1533 | computedsByScope; |
| 1534 | /** |
| 1535 | * Signal with the value assigned to the related property. |
| 1536 | */ |
| 1537 | valueSignal; |
| 1538 | /** |
| 1539 | * Signal with the getter assigned to the related property. |
| 1540 | */ |
| 1541 | getterSignal; |
| 1542 | /** |
| 1543 | * Pending getter to be consolidated. |
| 1544 | */ |
| 1545 | pendingGetter; |
| 1546 | /** |
| 1547 | * Structure that manages reactivity for a property in a state object, using |
| 1548 | * signals to keep track of property value or getter modifications. |
| 1549 | * |
| 1550 | * @param owner Proxy that holds the property this instance is associated |
| 1551 | * with. |
| 1552 | */ |
| 1553 | constructor(owner) { |
| 1554 | this.owner = owner; |
| 1555 | this.computedsByScope = /* @__PURE__ */ new WeakMap(); |
| 1556 | } |
| 1557 | /** |
| 1558 | * Changes the internal value. If a getter was set before, it is set to |
| 1559 | * `undefined`. |
| 1560 | * |
| 1561 | * @param value New value. |
| 1562 | */ |
| 1563 | setValue(value) { |
| 1564 | this.update({ value }); |
| 1565 | } |
| 1566 | /** |
| 1567 | * Changes the internal getter. If a value was set before, it is set to |
| 1568 | * `undefined`. |
| 1569 | * |
| 1570 | * @param getter New getter. |
| 1571 | */ |
| 1572 | setGetter(getter) { |
| 1573 | this.update({ get: getter }); |
| 1574 | } |
| 1575 | /** |
| 1576 | * Changes the internal getter asynchronously. |
| 1577 | * |
| 1578 | * The update is made in a microtask, which prevents issues with getters |
| 1579 | * accessing the state, and ensures the update occurs before any render. |
| 1580 | * |
| 1581 | * @param getter New getter. |
| 1582 | */ |
| 1583 | setPendingGetter(getter) { |
| 1584 | this.pendingGetter = getter; |
| 1585 | queueMicrotask(() => this.consolidateGetter()); |
| 1586 | } |
| 1587 | /** |
| 1588 | * Consolidate the pending value of the getter. |
| 1589 | */ |
| 1590 | consolidateGetter() { |
| 1591 | const getter = this.pendingGetter; |
| 1592 | if (getter) { |
| 1593 | this.pendingGetter = void 0; |
| 1594 | this.update({ get: getter }); |
| 1595 | } |
| 1596 | } |
| 1597 | /** |
| 1598 | * Returns the computed that holds the result of evaluating the prop in the |
| 1599 | * current scope. |
| 1600 | * |
| 1601 | * These computeds are read-only signals that depend on whether the property |
| 1602 | * is a value or a getter and, therefore, can return different values |
| 1603 | * depending on the scope in which the getter is accessed. |
| 1604 | * |
| 1605 | * @return Computed that depends on the scope. |
| 1606 | */ |
| 1607 | getComputed() { |
| 1608 | const scope = getScope() || NO_SCOPE; |
| 1609 | if (!this.valueSignal && !this.getterSignal) { |
| 1610 | this.update({}); |
| 1611 | } |
| 1612 | if (this.pendingGetter) { |
| 1613 | this.consolidateGetter(); |
| 1614 | } |
| 1615 | if (!this.computedsByScope.has(scope)) { |
| 1616 | const callback = () => { |
| 1617 | const getter = this.getterSignal?.value; |
| 1618 | return getter ? getter.call(this.owner) : this.valueSignal?.value; |
| 1619 | }; |
| 1620 | setNamespace(getNamespaceFromProxy(this.owner)); |
| 1621 | this.computedsByScope.set( |
| 1622 | scope, |
| 1623 | w3(withScope(callback)) |
| 1624 | ); |
| 1625 | resetNamespace(); |
| 1626 | } |
| 1627 | return this.computedsByScope.get(scope); |
| 1628 | } |
| 1629 | /** |
| 1630 | * Updates the internal signals for the value and the getter of the |
| 1631 | * corresponding prop. |
| 1632 | * |
| 1633 | * @param param0 |
| 1634 | * @param param0.get New getter. |
| 1635 | * @param param0.value New value. |
| 1636 | */ |
| 1637 | update({ get, value }) { |
| 1638 | if (!this.valueSignal) { |
| 1639 | this.valueSignal = d3(value); |
| 1640 | this.getterSignal = d3(get); |
| 1641 | } else if (value !== this.valueSignal.peek() || get !== this.getterSignal.peek()) { |
| 1642 | r3(() => { |
| 1643 | this.valueSignal.value = value; |
| 1644 | this.getterSignal.value = get; |
| 1645 | }); |
| 1646 | } |
| 1647 | } |
| 1648 | }; |
| 1649 | |
| 1650 | // packages/interactivity/build-module/proxies/state.mjs |
| 1651 | var wellKnownSymbols = new Set( |
| 1652 | Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter((value) => typeof value === "symbol") |
| 1653 | ); |
| 1654 | var proxyToProps = /* @__PURE__ */ new WeakMap(); |
| 1655 | var hasPropSignal = (proxy, key) => proxyToProps.has(proxy) && proxyToProps.get(proxy).has(key); |
| 1656 | var getPropSignal = (proxy, key, initial) => { |
| 1657 | if (!proxyToProps.has(proxy)) { |
| 1658 | proxyToProps.set(proxy, /* @__PURE__ */ new Map()); |
| 1659 | } |
| 1660 | key = typeof key === "number" ? `${key}` : key; |
| 1661 | const props = proxyToProps.get(proxy); |
| 1662 | if (!props.has(key)) { |
| 1663 | const ns = getNamespaceFromProxy(proxy); |
| 1664 | const prop = new PropSignal(proxy); |
| 1665 | props.set(key, prop); |
| 1666 | if (initial) { |
| 1667 | const { get, value } = initial; |
| 1668 | if (get) { |
| 1669 | prop.setGetter(get); |
| 1670 | } else { |
| 1671 | prop.setValue( |
| 1672 | shouldProxy(value) ? proxifyState(ns, value) : value |
| 1673 | ); |
| 1674 | } |
| 1675 | } |
| 1676 | } |
| 1677 | return props.get(key); |
| 1678 | }; |
| 1679 | var objToIterable = /* @__PURE__ */ new WeakMap(); |
| 1680 | var peeking = false; |
| 1681 | var PENDING_GETTER = /* @__PURE__ */ Symbol("PENDING_GETTER"); |
| 1682 | var stateHandlers = { |
| 1683 | get(target, key, receiver) { |
| 1684 | if (peeking || !target.hasOwnProperty(key) && key in target || typeof key === "symbol" && wellKnownSymbols.has(key)) { |
| 1685 | return Reflect.get(target, key, receiver); |
| 1686 | } |
| 1687 | const desc = Object.getOwnPropertyDescriptor(target, key); |
| 1688 | const prop = getPropSignal(receiver, key, desc); |
| 1689 | const result = prop.getComputed().value; |
| 1690 | if (result === PENDING_GETTER) { |
| 1691 | throw PENDING_GETTER; |
| 1692 | } |
| 1693 | if (typeof result === "function") { |
| 1694 | const ns = getNamespaceFromProxy(receiver); |
| 1695 | return (...args) => { |
| 1696 | setNamespace(ns); |
| 1697 | try { |
| 1698 | return result.call(receiver, ...args); |
| 1699 | } finally { |
| 1700 | resetNamespace(); |
| 1701 | } |
| 1702 | }; |
| 1703 | } |
| 1704 | return result; |
| 1705 | }, |
| 1706 | set(target, key, value, receiver) { |
| 1707 | setNamespace(getNamespaceFromProxy(receiver)); |
| 1708 | try { |
| 1709 | return Reflect.set(target, key, value, receiver); |
| 1710 | } finally { |
| 1711 | resetNamespace(); |
| 1712 | } |
| 1713 | }, |
| 1714 | defineProperty(target, key, desc) { |
| 1715 | const isNew = !(key in target); |
| 1716 | const result = Reflect.defineProperty(target, key, desc); |
| 1717 | if (result) { |
| 1718 | const receiver = getProxyFromObject(target); |
| 1719 | const prop = getPropSignal(receiver, key); |
| 1720 | const { get, value } = desc; |
| 1721 | if (get) { |
| 1722 | prop.setGetter(get); |
| 1723 | } else { |
| 1724 | const ns = getNamespaceFromProxy(receiver); |
| 1725 | prop.setValue( |
| 1726 | shouldProxy(value) ? proxifyState(ns, value) : value |
| 1727 | ); |
| 1728 | } |
| 1729 | if (isNew && objToIterable.has(target)) { |
| 1730 | objToIterable.get(target).value++; |
| 1731 | } |
| 1732 | if (Array.isArray(target) && proxyToProps.get(receiver)?.has("length")) { |
| 1733 | const length = getPropSignal(receiver, "length"); |
| 1734 | length.setValue(target.length); |
| 1735 | } |
| 1736 | } |
| 1737 | return result; |
| 1738 | }, |
| 1739 | deleteProperty(target, key) { |
| 1740 | const result = Reflect.deleteProperty(target, key); |
| 1741 | if (result) { |
| 1742 | const prop = getPropSignal(getProxyFromObject(target), key); |
| 1743 | prop.setValue(void 0); |
| 1744 | if (objToIterable.has(target)) { |
| 1745 | objToIterable.get(target).value++; |
| 1746 | } |
| 1747 | } |
| 1748 | return result; |
| 1749 | }, |
| 1750 | ownKeys(target) { |
| 1751 | if (!objToIterable.has(target)) { |
| 1752 | objToIterable.set(target, d3(0)); |
| 1753 | } |
| 1754 | objToIterable._ = objToIterable.get(target).value; |
| 1755 | return Reflect.ownKeys(target); |
| 1756 | } |
| 1757 | }; |
| 1758 | var proxifyState = (namespace, obj) => { |
| 1759 | return createProxy(namespace, obj, stateHandlers); |
| 1760 | }; |
| 1761 | var peek = (obj, key) => { |
| 1762 | peeking = true; |
| 1763 | try { |
| 1764 | return obj[key]; |
| 1765 | } finally { |
| 1766 | peeking = false; |
| 1767 | } |
| 1768 | }; |
| 1769 | var deepMergeRecursive = (target, source, override = true) => { |
| 1770 | if (!(isPlainObject(target) && isPlainObject(source))) { |
| 1771 | return; |
| 1772 | } |
| 1773 | let hasNewKeys = false; |
| 1774 | for (const key in source) { |
| 1775 | const isNew = !(key in target); |
| 1776 | hasNewKeys = hasNewKeys || isNew; |
| 1777 | const desc = Object.getOwnPropertyDescriptor(source, key); |
| 1778 | const proxy = getProxyFromObject(target); |
| 1779 | const propSignal = !!proxy && hasPropSignal(proxy, key) && getPropSignal(proxy, key); |
| 1780 | if (typeof desc.get === "function" || typeof desc.set === "function") { |
| 1781 | if (override || isNew) { |
| 1782 | Object.defineProperty(target, key, { |
| 1783 | ...desc, |
| 1784 | configurable: true, |
| 1785 | enumerable: true |
| 1786 | }); |
| 1787 | if (desc.get && propSignal) { |
| 1788 | propSignal.setPendingGetter(desc.get); |
| 1789 | } |
| 1790 | } |
| 1791 | } else if (isPlainObject(source[key])) { |
| 1792 | const targetValue = Object.getOwnPropertyDescriptor(target, key)?.value; |
| 1793 | if (isNew || override && !isPlainObject(targetValue)) { |
| 1794 | target[key] = {}; |
| 1795 | if (propSignal) { |
| 1796 | const ns = getNamespaceFromProxy(proxy); |
| 1797 | propSignal.setValue( |
| 1798 | proxifyState(ns, target[key]) |
| 1799 | ); |
| 1800 | } |
| 1801 | deepMergeRecursive(target[key], source[key], override); |
| 1802 | } else if (isPlainObject(targetValue)) { |
| 1803 | deepMergeRecursive(target[key], source[key], override); |
| 1804 | } |
| 1805 | } else if (override || isNew) { |
| 1806 | Object.defineProperty(target, key, desc); |
| 1807 | if (propSignal) { |
| 1808 | const { value } = desc; |
| 1809 | const ns = getNamespaceFromProxy(proxy); |
| 1810 | propSignal.setValue( |
| 1811 | shouldProxy(value) ? proxifyState(ns, value) : value |
| 1812 | ); |
| 1813 | } |
| 1814 | } |
| 1815 | } |
| 1816 | if (hasNewKeys && objToIterable.has(target)) { |
| 1817 | objToIterable.get(target).value++; |
| 1818 | } |
| 1819 | }; |
| 1820 | var deepMerge = (target, source, override = true) => r3( |
| 1821 | () => deepMergeRecursive( |
| 1822 | getObjectFromProxy(target) || target, |
| 1823 | source, |
| 1824 | override |
| 1825 | ) |
| 1826 | ); |
| 1827 | |
| 1828 | // packages/interactivity/build-module/proxies/store.mjs |
| 1829 | var storeRoots = /* @__PURE__ */ new WeakSet(); |
| 1830 | var storeHandlers = { |
| 1831 | get: (target, key, receiver) => { |
| 1832 | const result = Reflect.get(target, key); |
| 1833 | const ns = getNamespaceFromProxy(receiver); |
| 1834 | if (typeof result === "undefined" && storeRoots.has(receiver)) { |
| 1835 | const obj = {}; |
| 1836 | Reflect.set(target, key, obj); |
| 1837 | return proxifyStore(ns, obj, false); |
| 1838 | } |
| 1839 | if (typeof result === "function") { |
| 1840 | setNamespace(ns); |
| 1841 | const scoped = withScope(result); |
| 1842 | resetNamespace(); |
| 1843 | return scoped; |
| 1844 | } |
| 1845 | if (isPlainObject(result) && shouldProxy(result)) { |
| 1846 | return proxifyStore(ns, result, false); |
| 1847 | } |
| 1848 | return result; |
| 1849 | } |
| 1850 | }; |
| 1851 | var proxifyStore = (namespace, obj, isRoot = true) => { |
| 1852 | const proxy = createProxy(namespace, obj, storeHandlers); |
| 1853 | if (proxy && isRoot) { |
| 1854 | storeRoots.add(proxy); |
| 1855 | } |
| 1856 | return proxy; |
| 1857 | }; |
| 1858 | |
| 1859 | // packages/interactivity/build-module/proxies/context.mjs |
| 1860 | var contextObjectToProxy = /* @__PURE__ */ new WeakMap(); |
| 1861 | var contextObjectToFallback = /* @__PURE__ */ new WeakMap(); |
| 1862 | var contextProxies = /* @__PURE__ */ new WeakSet(); |
| 1863 | var descriptor = Reflect.getOwnPropertyDescriptor; |
| 1864 | var contextHandlers = { |
| 1865 | get: (target, key) => { |
| 1866 | const fallback = contextObjectToFallback.get(target); |
| 1867 | const currentProp = target[key]; |
| 1868 | return key in target ? currentProp : fallback[key]; |
| 1869 | }, |
| 1870 | set: (target, key, value) => { |
| 1871 | const fallback = contextObjectToFallback.get(target); |
| 1872 | const obj = key in target || !(key in fallback) ? target : fallback; |
| 1873 | obj[key] = value; |
| 1874 | return true; |
| 1875 | }, |
| 1876 | ownKeys: (target) => [ |
| 1877 | .../* @__PURE__ */ new Set([ |
| 1878 | ...Object.keys(contextObjectToFallback.get(target)), |
| 1879 | ...Object.keys(target) |
| 1880 | ]) |
| 1881 | ], |
| 1882 | getOwnPropertyDescriptor: (target, key) => descriptor(target, key) || descriptor(contextObjectToFallback.get(target), key), |
| 1883 | has: (target, key) => Reflect.has(target, key) || Reflect.has(contextObjectToFallback.get(target), key) |
| 1884 | }; |
| 1885 | var proxifyContext = (current, inherited = {}) => { |
| 1886 | if (contextProxies.has(current)) { |
| 1887 | throw Error("This object cannot be proxified."); |
| 1888 | } |
| 1889 | contextObjectToFallback.set(current, inherited); |
| 1890 | if (!contextObjectToProxy.has(current)) { |
| 1891 | const proxy = new Proxy(current, contextHandlers); |
| 1892 | contextObjectToProxy.set(current, proxy); |
| 1893 | contextProxies.add(proxy); |
| 1894 | } |
| 1895 | return contextObjectToProxy.get(current); |
| 1896 | }; |
| 1897 | |
| 1898 | // packages/interactivity/build-module/store.mjs |
| 1899 | var stores = /* @__PURE__ */ new Map(); |
| 1900 | var rawStores = /* @__PURE__ */ new Map(); |
| 1901 | var storeLocks = /* @__PURE__ */ new Map(); |
| 1902 | var storeConfigs = /* @__PURE__ */ new Map(); |
| 1903 | var serverStates = /* @__PURE__ */ new Map(); |
| 1904 | var getConfig = (namespace) => storeConfigs.get(namespace || getNamespace()) || {}; |
| 1905 | function getServerState(namespace) { |
| 1906 | const ns = namespace || getNamespace(); |
| 1907 | if (!serverStates.has(ns)) { |
| 1908 | serverStates.set(ns, {}); |
| 1909 | } |
| 1910 | getServerState.subscribe = navigationSignal.value; |
| 1911 | return deepClone(serverStates.get(ns)); |
| 1912 | } |
| 1913 | getServerState.subscribe = 0; |
| 1914 | var universalUnlock = "I acknowledge that using a private store means my plugin will inevitably break on the next store release."; |
| 1915 | function store(namespace, { state = {}, ...block } = {}, { lock = false } = {}) { |
| 1916 | if (!stores.has(namespace)) { |
| 1917 | if (lock !== universalUnlock) { |
| 1918 | storeLocks.set(namespace, lock); |
| 1919 | } |
| 1920 | const rawStore = { |
| 1921 | state: proxifyState( |
| 1922 | namespace, |
| 1923 | isPlainObject(state) ? state : {} |
| 1924 | ), |
| 1925 | ...block |
| 1926 | }; |
| 1927 | const proxifiedStore = proxifyStore(namespace, rawStore); |
| 1928 | rawStores.set(namespace, rawStore); |
| 1929 | stores.set(namespace, proxifiedStore); |
| 1930 | } else { |
| 1931 | if (lock !== universalUnlock && !storeLocks.has(namespace)) { |
| 1932 | storeLocks.set(namespace, lock); |
| 1933 | } else { |
| 1934 | const storeLock = storeLocks.get(namespace); |
| 1935 | const isLockValid = lock === universalUnlock || lock !== true && lock === storeLock; |
| 1936 | if (!isLockValid) { |
| 1937 | if (!storeLock) { |
| 1938 | throw Error("Cannot lock a public store"); |
| 1939 | } else { |
| 1940 | throw Error( |
| 1941 | "Cannot unlock a private store with an invalid lock code" |
| 1942 | ); |
| 1943 | } |
| 1944 | } |
| 1945 | } |
| 1946 | const target = rawStores.get(namespace); |
| 1947 | deepMerge(target, block); |
| 1948 | deepMerge(target.state, state); |
| 1949 | } |
| 1950 | return stores.get(namespace); |
| 1951 | } |
| 1952 | var parseServerData = (dom = document) => { |
| 1953 | const jsonDataScriptTag = ( |
| 1954 | // Preferred Script Module data passing form |
| 1955 | dom.getElementById( |
| 1956 | "wp-script-module-data-@wordpress/interactivity" |
| 1957 | ) ?? // Legacy form |
| 1958 | dom.getElementById("wp-interactivity-data") |
| 1959 | ); |
| 1960 | if (jsonDataScriptTag?.textContent) { |
| 1961 | try { |
| 1962 | return JSON.parse(jsonDataScriptTag.textContent); |
| 1963 | } catch { |
| 1964 | } |
| 1965 | } |
| 1966 | return {}; |
| 1967 | }; |
| 1968 | var populateServerData = (data) => { |
| 1969 | serverStates.clear(); |
| 1970 | storeConfigs.clear(); |
| 1971 | if (isPlainObject(data?.state)) { |
| 1972 | Object.entries(data.state).forEach(([namespace, state]) => { |
| 1973 | const st = store(namespace, {}, { lock: universalUnlock }); |
| 1974 | deepMerge(st.state, state, false); |
| 1975 | serverStates.set(namespace, state); |
| 1976 | }); |
| 1977 | } |
| 1978 | if (isPlainObject(data?.config)) { |
| 1979 | Object.entries(data.config).forEach(([namespace, config]) => { |
| 1980 | storeConfigs.set(namespace, config); |
| 1981 | }); |
| 1982 | } |
| 1983 | if (isPlainObject(data?.derivedStateClosures)) { |
| 1984 | Object.entries(data.derivedStateClosures).forEach( |
| 1985 | ([namespace, paths]) => { |
| 1986 | const st = store( |
| 1987 | namespace, |
| 1988 | {}, |
| 1989 | { lock: universalUnlock } |
| 1990 | ); |
| 1991 | paths.forEach((path) => { |
| 1992 | const pathParts = path.split("."); |
| 1993 | const prop = pathParts.splice(-1, 1)[0]; |
| 1994 | const parent = pathParts.reduce( |
| 1995 | (prev, key) => peek(prev, key), |
| 1996 | st |
| 1997 | ); |
| 1998 | const desc = Object.getOwnPropertyDescriptor( |
| 1999 | parent, |
| 2000 | prop |
| 2001 | ); |
| 2002 | if (isPlainObject(desc?.value)) { |
| 2003 | parent[prop] = PENDING_GETTER; |
| 2004 | } |
| 2005 | }); |
| 2006 | } |
| 2007 | ); |
| 2008 | } |
| 2009 | }; |
| 2010 | |
| 2011 | // packages/interactivity/build-module/hooks.mjs |
| 2012 | function isNonDefaultDirectiveSuffix(entry) { |
| 2013 | return entry.suffix !== null; |
| 2014 | } |
| 2015 | function isDefaultDirectiveSuffix(entry) { |
| 2016 | return entry.suffix === null; |
| 2017 | } |
| 2018 | var context = X({ client: {}, server: {} }); |
| 2019 | var directiveCallbacks = {}; |
| 2020 | var directivePriorities = {}; |
| 2021 | var directive = (name, callback, { priority = 10 } = {}) => { |
| 2022 | directiveCallbacks[name] = callback; |
| 2023 | directivePriorities[name] = priority; |
| 2024 | }; |
| 2025 | var resolve = (path, namespace) => { |
| 2026 | if (!namespace) { |
| 2027 | warn( |
| 2028 | `Namespace missing for "${path}". The value for that path won't be resolved.` |
| 2029 | ); |
| 2030 | return; |
| 2031 | } |
| 2032 | let resolvedStore = stores.get(namespace); |
| 2033 | if (typeof resolvedStore === "undefined") { |
| 2034 | resolvedStore = store( |
| 2035 | namespace, |
| 2036 | {}, |
| 2037 | { |
| 2038 | lock: universalUnlock |
| 2039 | } |
| 2040 | ); |
| 2041 | } |
| 2042 | const current = { |
| 2043 | ...resolvedStore, |
| 2044 | context: getScope().context[namespace] |
| 2045 | }; |
| 2046 | try { |
| 2047 | const pathParts = path.split("."); |
| 2048 | return pathParts.reduce((acc, key) => acc[key], current); |
| 2049 | } catch (e4) { |
| 2050 | if (e4 === PENDING_GETTER) { |
| 2051 | return PENDING_GETTER; |
| 2052 | } |
| 2053 | } |
| 2054 | }; |
| 2055 | var getEvaluate = ({ scope }) => ( |
| 2056 | // TODO: When removing the temporarily remaining `value( ...args )` call below, remove the `...args` parameter too. |
| 2057 | ((entry, ...args) => { |
| 2058 | let { value: path, namespace } = entry; |
| 2059 | if (typeof path !== "string") { |
| 2060 | throw new Error("The `value` prop should be a string path"); |
| 2061 | } |
| 2062 | const hasNegationOperator = path[0] === "!" && !!(path = path.slice(1)); |
| 2063 | setScope(scope); |
| 2064 | const value = resolve(path, namespace); |
| 2065 | if (typeof value === "function") { |
| 2066 | if (hasNegationOperator) { |
| 2067 | warn( |
| 2068 | "Using a function with a negation operator is deprecated and will stop working in WordPress 6.9. Please use derived state instead." |
| 2069 | ); |
| 2070 | const functionResult = !value(...args); |
| 2071 | resetScope(); |
| 2072 | return functionResult; |
| 2073 | } |
| 2074 | resetScope(); |
| 2075 | const wrappedFunction = (...functionArgs) => { |
| 2076 | setScope(scope); |
| 2077 | const functionResult = value(...functionArgs); |
| 2078 | resetScope(); |
| 2079 | return functionResult; |
| 2080 | }; |
| 2081 | if (value.sync) { |
| 2082 | const syncAwareFunction = wrappedFunction; |
| 2083 | syncAwareFunction.sync = true; |
| 2084 | } |
| 2085 | return wrappedFunction; |
| 2086 | } |
| 2087 | const result = value; |
| 2088 | resetScope(); |
| 2089 | return hasNegationOperator && value !== PENDING_GETTER ? !result : result; |
| 2090 | }) |
| 2091 | ); |
| 2092 | var getPriorityLevels = (directives) => { |
| 2093 | const byPriority = Object.keys(directives).reduce((obj, name) => { |
| 2094 | if (directiveCallbacks[name]) { |
| 2095 | const priority = directivePriorities[name]; |
| 2096 | (obj[priority] = obj[priority] || []).push(name); |
| 2097 | } |
| 2098 | return obj; |
| 2099 | }, {}); |
| 2100 | return Object.entries(byPriority).sort(([p1], [p22]) => parseInt(p1) - parseInt(p22)).map(([, arr]) => arr); |
| 2101 | }; |
| 2102 | var Directives = ({ |
| 2103 | directives, |
| 2104 | priorityLevels: [currentPriorityLevel, ...nextPriorityLevels], |
| 2105 | element, |
| 2106 | originalProps, |
| 2107 | previousScope |
| 2108 | }) => { |
| 2109 | const scope = A2({}).current; |
| 2110 | scope.evaluate = q2(getEvaluate({ scope }), []); |
| 2111 | const { client, server } = x2(context); |
| 2112 | scope.context = client; |
| 2113 | scope.serverContext = server; |
| 2114 | scope.ref = previousScope?.ref || A2(null); |
| 2115 | element = W(element, { ref: scope.ref }); |
| 2116 | scope.attributes = element.props; |
| 2117 | const children = nextPriorityLevels.length > 0 ? k(Directives, { |
| 2118 | directives, |
| 2119 | priorityLevels: nextPriorityLevels, |
| 2120 | element, |
| 2121 | originalProps, |
| 2122 | previousScope: scope |
| 2123 | }) : element; |
| 2124 | const props = { ...originalProps, children }; |
| 2125 | const directiveArgs = { |
| 2126 | directives, |
| 2127 | props, |
| 2128 | element, |
| 2129 | context, |
| 2130 | evaluate: scope.evaluate |
| 2131 | }; |
| 2132 | setScope(scope); |
| 2133 | for (const directiveName of currentPriorityLevel) { |
| 2134 | const wrapper = directiveCallbacks[directiveName]?.(directiveArgs); |
| 2135 | if (wrapper !== void 0) { |
| 2136 | props.children = wrapper; |
| 2137 | } |
| 2138 | } |
| 2139 | resetScope(); |
| 2140 | return props.children; |
| 2141 | }; |
| 2142 | var old = l.vnode; |
| 2143 | l.vnode = (vnode) => { |
| 2144 | if (vnode.props.__directives) { |
| 2145 | const props = vnode.props; |
| 2146 | const directives = props.__directives; |
| 2147 | if (directives.key) { |
| 2148 | vnode.key = directives.key.find(isDefaultDirectiveSuffix).value; |
| 2149 | } |
| 2150 | delete props.__directives; |
| 2151 | const priorityLevels = getPriorityLevels(directives); |
| 2152 | if (priorityLevels.length > 0) { |
| 2153 | vnode.props = { |
| 2154 | directives, |
| 2155 | priorityLevels, |
| 2156 | originalProps: props, |
| 2157 | type: vnode.type, |
| 2158 | element: k(vnode.type, props), |
| 2159 | top: true |
| 2160 | }; |
| 2161 | vnode.type = Directives; |
| 2162 | } |
| 2163 | } |
| 2164 | if (old) { |
| 2165 | old(vnode); |
| 2166 | } |
| 2167 | }; |
| 2168 | |
| 2169 | // packages/interactivity/build-module/directives.mjs |
| 2170 | var warnUniqueIdWithTwoHyphens = (prefix, suffix, uniqueId) => { |
| 2171 | if (true) { |
| 2172 | warn( |
| 2173 | `The usage of data-wp-${prefix}--${suffix}${uniqueId ? `--${uniqueId}` : ""} (two hyphens for unique ID) is deprecated and will stop working in WordPress 7.1. Please use data-wp-${prefix}${uniqueId ? `--${suffix}---${uniqueId}` : `---${suffix}`} (three hyphens for unique ID) from now on.` |
| 2174 | ); |
| 2175 | } |
| 2176 | }; |
| 2177 | var warnUniqueIdNotSupported = (prefix, uniqueId) => { |
| 2178 | if (true) { |
| 2179 | warn( |
| 2180 | `Unique IDs are not supported for the data-wp-${prefix} directive. Ignoring the directive with unique ID "${uniqueId}".` |
| 2181 | ); |
| 2182 | } |
| 2183 | }; |
| 2184 | var warnWithSyncEvent = (wrongPrefix, rightPrefix) => { |
| 2185 | if (true) { |
| 2186 | warn( |
| 2187 | `The usage of data-wp-${wrongPrefix} is deprecated and will stop working in WordPress 7.0. Please, use data-wp-${rightPrefix} with the withSyncEvent() helper from now on.` |
| 2188 | ); |
| 2189 | } |
| 2190 | }; |
| 2191 | function wrapEventAsync(event) { |
| 2192 | const handler = { |
| 2193 | get(target, prop, receiver) { |
| 2194 | const value = target[prop]; |
| 2195 | switch (prop) { |
| 2196 | case "currentTarget": |
| 2197 | if (true) { |
| 2198 | warn( |
| 2199 | `Accessing the synchronous event.${prop} property in a store action without wrapping it in withSyncEvent() is deprecated and will stop working in WordPress 7.0. Please wrap the store action in withSyncEvent().` |
| 2200 | ); |
| 2201 | } |
| 2202 | break; |
| 2203 | case "preventDefault": |
| 2204 | case "stopImmediatePropagation": |
| 2205 | case "stopPropagation": |
| 2206 | if (true) { |
| 2207 | warn( |
| 2208 | `Using the synchronous event.${prop}() function in a store action without wrapping it in withSyncEvent() is deprecated and will stop working in WordPress 7.0. Please wrap the store action in withSyncEvent().` |
| 2209 | ); |
| 2210 | } |
| 2211 | break; |
| 2212 | } |
| 2213 | if (value instanceof Function) { |
| 2214 | return function(...args) { |
| 2215 | return value.apply( |
| 2216 | this === receiver ? target : this, |
| 2217 | args |
| 2218 | ); |
| 2219 | }; |
| 2220 | } |
| 2221 | return value; |
| 2222 | } |
| 2223 | }; |
| 2224 | return new Proxy(event, handler); |
| 2225 | } |
| 2226 | var newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g; |
| 2227 | var ruleClean = /\/\*[^]*?\*\/| +/g; |
| 2228 | var ruleNewline = /\n+/g; |
| 2229 | var empty = " "; |
| 2230 | var cssStringToObject = (val) => { |
| 2231 | const tree = [{}]; |
| 2232 | let block, left; |
| 2233 | while (block = newRule.exec(val.replace(ruleClean, ""))) { |
| 2234 | if (block[4]) { |
| 2235 | tree.shift(); |
| 2236 | } else if (block[3]) { |
| 2237 | left = block[3].replace(ruleNewline, empty).trim(); |
| 2238 | tree.unshift(tree[0][left] = tree[0][left] || {}); |
| 2239 | } else { |
| 2240 | tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim(); |
| 2241 | } |
| 2242 | } |
| 2243 | return tree[0]; |
| 2244 | }; |
| 2245 | var getGlobalEventDirective = (type) => { |
| 2246 | return ({ directives, evaluate }) => { |
| 2247 | directives[`on-${type}`].filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2248 | const suffixParts = entry.suffix.split("--", 2); |
| 2249 | const eventName = suffixParts[0]; |
| 2250 | if (true) { |
| 2251 | if (suffixParts[1]) { |
| 2252 | warnUniqueIdWithTwoHyphens( |
| 2253 | `on-${type}`, |
| 2254 | suffixParts[0], |
| 2255 | suffixParts[1] |
| 2256 | ); |
| 2257 | } |
| 2258 | } |
| 2259 | useInit(() => { |
| 2260 | const cb = (event) => { |
| 2261 | const result = evaluate(entry); |
| 2262 | if (typeof result === "function") { |
| 2263 | if (!result?.sync) { |
| 2264 | event = wrapEventAsync(event); |
| 2265 | } |
| 2266 | result(event); |
| 2267 | } |
| 2268 | }; |
| 2269 | const globalVar = type === "window" ? window : document; |
| 2270 | globalVar.addEventListener(eventName, cb); |
| 2271 | return () => globalVar.removeEventListener(eventName, cb); |
| 2272 | }); |
| 2273 | }); |
| 2274 | }; |
| 2275 | }; |
| 2276 | var evaluateItemKey = (inheritedValue, namespace, item, itemProp, eachKey) => { |
| 2277 | const clientContextWithItem = { |
| 2278 | ...inheritedValue.client, |
| 2279 | [namespace]: { |
| 2280 | ...inheritedValue.client[namespace], |
| 2281 | [itemProp]: item |
| 2282 | } |
| 2283 | }; |
| 2284 | const scope = { |
| 2285 | ...getScope(), |
| 2286 | context: clientContextWithItem, |
| 2287 | serverContext: inheritedValue.server |
| 2288 | }; |
| 2289 | return eachKey ? getEvaluate({ scope })(eachKey) : item; |
| 2290 | }; |
| 2291 | var useItemContexts = function* (inheritedValue, namespace, items, itemProp, eachKey) { |
| 2292 | const { current: itemContexts } = A2(/* @__PURE__ */ new Map()); |
| 2293 | for (const item of items) { |
| 2294 | const key = evaluateItemKey( |
| 2295 | inheritedValue, |
| 2296 | namespace, |
| 2297 | item, |
| 2298 | itemProp, |
| 2299 | eachKey |
| 2300 | ); |
| 2301 | if (!itemContexts.has(key)) { |
| 2302 | itemContexts.set( |
| 2303 | key, |
| 2304 | proxifyContext( |
| 2305 | proxifyState(namespace, { |
| 2306 | // Inits the item prop in the context to shadow it in case |
| 2307 | // it was inherited from the parent context. The actual |
| 2308 | // value is set in the `wp-each` directive later on. |
| 2309 | [itemProp]: void 0 |
| 2310 | }), |
| 2311 | inheritedValue.client[namespace] |
| 2312 | ) |
| 2313 | ); |
| 2314 | } |
| 2315 | yield [item, itemContexts.get(key), key]; |
| 2316 | } |
| 2317 | }; |
| 2318 | var getGlobalAsyncEventDirective = (type) => { |
| 2319 | return ({ directives, evaluate }) => { |
| 2320 | directives[`on-async-${type}`].filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2321 | if (true) { |
| 2322 | warnWithSyncEvent(`on-async-${type}`, `on-${type}`); |
| 2323 | } |
| 2324 | const eventName = entry.suffix.split("--", 1)[0]; |
| 2325 | useInit(() => { |
| 2326 | const cb = async (event) => { |
| 2327 | await splitTask(); |
| 2328 | const result = evaluate(entry); |
| 2329 | if (typeof result === "function") { |
| 2330 | result(event); |
| 2331 | } |
| 2332 | }; |
| 2333 | const globalVar = type === "window" ? window : document; |
| 2334 | globalVar.addEventListener(eventName, cb, { |
| 2335 | passive: true |
| 2336 | }); |
| 2337 | return () => globalVar.removeEventListener(eventName, cb); |
| 2338 | }); |
| 2339 | }); |
| 2340 | }; |
| 2341 | }; |
| 2342 | var routerRegions = /* @__PURE__ */ new Map(); |
| 2343 | var directives_default = () => { |
| 2344 | directive( |
| 2345 | "context", |
| 2346 | ({ |
| 2347 | directives: { context: context2 }, |
| 2348 | props: { children }, |
| 2349 | context: inheritedContext |
| 2350 | }) => { |
| 2351 | const entries = context2.filter(isDefaultDirectiveSuffix).reverse(); |
| 2352 | if (!entries.length) { |
| 2353 | if (true) { |
| 2354 | warn( |
| 2355 | "The usage of data-wp-context--unique-id (two hyphens) is not supported. To add a unique ID to the directive, please use data-wp-context---unique-id (three hyphens) instead." |
| 2356 | ); |
| 2357 | } |
| 2358 | return; |
| 2359 | } |
| 2360 | const { Provider } = inheritedContext; |
| 2361 | const { client: inheritedClient, server: inheritedServer } = x2(inheritedContext); |
| 2362 | const client = A2({}); |
| 2363 | const server = {}; |
| 2364 | const result = { |
| 2365 | client: { ...inheritedClient }, |
| 2366 | server: { ...inheritedServer } |
| 2367 | }; |
| 2368 | const namespaces2 = /* @__PURE__ */ new Set(); |
| 2369 | entries.forEach(({ value, namespace, uniqueId }) => { |
| 2370 | if (!isPlainObject(value)) { |
| 2371 | if (true) { |
| 2372 | warn( |
| 2373 | `The value of data-wp-context${uniqueId ? `---${uniqueId}` : ""} on the ${namespace} namespace must be a valid stringified JSON object.` |
| 2374 | ); |
| 2375 | } |
| 2376 | return; |
| 2377 | } |
| 2378 | if (!client.current[namespace]) { |
| 2379 | client.current[namespace] = proxifyState(namespace, {}); |
| 2380 | } |
| 2381 | deepMerge( |
| 2382 | client.current[namespace], |
| 2383 | deepClone(value), |
| 2384 | false |
| 2385 | ); |
| 2386 | server[namespace] = value; |
| 2387 | namespaces2.add(namespace); |
| 2388 | }); |
| 2389 | namespaces2.forEach((namespace) => { |
| 2390 | result.client[namespace] = proxifyContext( |
| 2391 | client.current[namespace], |
| 2392 | inheritedClient[namespace] |
| 2393 | ); |
| 2394 | result.server[namespace] = proxifyContext( |
| 2395 | server[namespace], |
| 2396 | inheritedServer[namespace] |
| 2397 | ); |
| 2398 | }); |
| 2399 | return k(Provider, { value: result }, children); |
| 2400 | }, |
| 2401 | { priority: 5 } |
| 2402 | ); |
| 2403 | directive("watch", ({ directives: { watch: watch2 }, evaluate }) => { |
| 2404 | watch2.forEach((entry) => { |
| 2405 | if (true) { |
| 2406 | if (entry.suffix) { |
| 2407 | warnUniqueIdWithTwoHyphens("watch", entry.suffix); |
| 2408 | } |
| 2409 | } |
| 2410 | useWatch(() => { |
| 2411 | let start; |
| 2412 | if (true) { |
| 2413 | if (true) { |
| 2414 | start = performance.now(); |
| 2415 | } |
| 2416 | } |
| 2417 | let result = evaluate(entry); |
| 2418 | if (typeof result === "function") { |
| 2419 | result = result(); |
| 2420 | } |
| 2421 | if (true) { |
| 2422 | if (true) { |
| 2423 | performance.measure( |
| 2424 | `interactivity api watch ${entry.namespace}`, |
| 2425 | { |
| 2426 | start, |
| 2427 | end: performance.now(), |
| 2428 | detail: { |
| 2429 | devtools: { |
| 2430 | track: `IA: watch ${entry.namespace}` |
| 2431 | } |
| 2432 | } |
| 2433 | } |
| 2434 | ); |
| 2435 | } |
| 2436 | } |
| 2437 | return result; |
| 2438 | }); |
| 2439 | }); |
| 2440 | }); |
| 2441 | directive("init", ({ directives: { init }, evaluate }) => { |
| 2442 | init.forEach((entry) => { |
| 2443 | if (true) { |
| 2444 | if (entry.suffix) { |
| 2445 | warnUniqueIdWithTwoHyphens("init", entry.suffix); |
| 2446 | } |
| 2447 | } |
| 2448 | useInit(() => { |
| 2449 | let start; |
| 2450 | if (true) { |
| 2451 | if (true) { |
| 2452 | start = performance.now(); |
| 2453 | } |
| 2454 | } |
| 2455 | let result = evaluate(entry); |
| 2456 | if (typeof result === "function") { |
| 2457 | result = result(); |
| 2458 | } |
| 2459 | if (true) { |
| 2460 | if (true) { |
| 2461 | performance.measure( |
| 2462 | `interactivity api init ${entry.namespace}`, |
| 2463 | { |
| 2464 | start, |
| 2465 | end: performance.now(), |
| 2466 | detail: { |
| 2467 | devtools: { |
| 2468 | track: `IA: init ${entry.namespace}` |
| 2469 | } |
| 2470 | } |
| 2471 | } |
| 2472 | ); |
| 2473 | } |
| 2474 | } |
| 2475 | return result; |
| 2476 | }); |
| 2477 | }); |
| 2478 | }); |
| 2479 | directive("on", ({ directives: { on }, element, evaluate }) => { |
| 2480 | const events = /* @__PURE__ */ new Map(); |
| 2481 | on.filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2482 | const suffixParts = entry.suffix.split("--", 2); |
| 2483 | if (true) { |
| 2484 | if (suffixParts[1]) { |
| 2485 | warnUniqueIdWithTwoHyphens( |
| 2486 | "on", |
| 2487 | suffixParts[0], |
| 2488 | suffixParts[1] |
| 2489 | ); |
| 2490 | } |
| 2491 | } |
| 2492 | if (!events.has(suffixParts[0])) { |
| 2493 | events.set(suffixParts[0], /* @__PURE__ */ new Set()); |
| 2494 | } |
| 2495 | events.get(suffixParts[0]).add(entry); |
| 2496 | }); |
| 2497 | events.forEach((entries, eventType) => { |
| 2498 | const existingHandler = element.props[`on${eventType}`]; |
| 2499 | element.props[`on${eventType}`] = (event) => { |
| 2500 | if (existingHandler) { |
| 2501 | existingHandler(event); |
| 2502 | } |
| 2503 | entries.forEach((entry) => { |
| 2504 | let start; |
| 2505 | if (true) { |
| 2506 | if (true) { |
| 2507 | start = performance.now(); |
| 2508 | } |
| 2509 | } |
| 2510 | const result = evaluate(entry); |
| 2511 | if (typeof result === "function") { |
| 2512 | if (!result?.sync) { |
| 2513 | event = wrapEventAsync(event); |
| 2514 | } |
| 2515 | result(event); |
| 2516 | } |
| 2517 | if (true) { |
| 2518 | if (true) { |
| 2519 | performance.measure( |
| 2520 | `interactivity api on ${entry.namespace}`, |
| 2521 | { |
| 2522 | start, |
| 2523 | end: performance.now(), |
| 2524 | detail: { |
| 2525 | devtools: { |
| 2526 | track: `IA: on ${entry.namespace}` |
| 2527 | } |
| 2528 | } |
| 2529 | } |
| 2530 | ); |
| 2531 | } |
| 2532 | } |
| 2533 | }); |
| 2534 | }; |
| 2535 | }); |
| 2536 | }); |
| 2537 | directive( |
| 2538 | "on-async", |
| 2539 | ({ directives: { "on-async": onAsync }, element, evaluate }) => { |
| 2540 | if (true) { |
| 2541 | warnWithSyncEvent("on-async", "on"); |
| 2542 | } |
| 2543 | const events = /* @__PURE__ */ new Map(); |
| 2544 | onAsync.filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2545 | const event = entry.suffix.split("--", 1)[0]; |
| 2546 | if (!events.has(event)) { |
| 2547 | events.set(event, /* @__PURE__ */ new Set()); |
| 2548 | } |
| 2549 | events.get(event).add(entry); |
| 2550 | }); |
| 2551 | events.forEach((entries, eventType) => { |
| 2552 | const existingHandler = element.props[`on${eventType}`]; |
| 2553 | element.props[`on${eventType}`] = (event) => { |
| 2554 | if (existingHandler) { |
| 2555 | existingHandler(event); |
| 2556 | } |
| 2557 | entries.forEach(async (entry) => { |
| 2558 | await splitTask(); |
| 2559 | const result = evaluate(entry); |
| 2560 | if (typeof result === "function") { |
| 2561 | result(event); |
| 2562 | } |
| 2563 | }); |
| 2564 | }; |
| 2565 | }); |
| 2566 | } |
| 2567 | ); |
| 2568 | directive("on-window", getGlobalEventDirective("window")); |
| 2569 | directive("on-document", getGlobalEventDirective("document")); |
| 2570 | directive("on-async-window", getGlobalAsyncEventDirective("window")); |
| 2571 | directive( |
| 2572 | "on-async-document", |
| 2573 | getGlobalAsyncEventDirective("document") |
| 2574 | ); |
| 2575 | directive( |
| 2576 | "class", |
| 2577 | ({ directives: { class: classNames }, element, evaluate }) => { |
| 2578 | classNames.filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2579 | const className = entry.uniqueId ? `${entry.suffix}---${entry.uniqueId}` : entry.suffix; |
| 2580 | let result = evaluate(entry); |
| 2581 | if (result === PENDING_GETTER) { |
| 2582 | return; |
| 2583 | } |
| 2584 | if (typeof result === "function") { |
| 2585 | result = result(); |
| 2586 | } |
| 2587 | const currentClass = element.props.class || ""; |
| 2588 | const classFinder = new RegExp( |
| 2589 | `(^|\\s)${className}(\\s|$)`, |
| 2590 | "g" |
| 2591 | ); |
| 2592 | if (!result) { |
| 2593 | element.props.class = currentClass.replace(classFinder, " ").trim(); |
| 2594 | } else if (!classFinder.test(currentClass)) { |
| 2595 | element.props.class = currentClass ? `${currentClass} ${className}` : className; |
| 2596 | } |
| 2597 | useInit(() => { |
| 2598 | if (!result) { |
| 2599 | element.ref.current.classList.remove(className); |
| 2600 | } else { |
| 2601 | element.ref.current.classList.add(className); |
| 2602 | } |
| 2603 | }); |
| 2604 | }); |
| 2605 | } |
| 2606 | ); |
| 2607 | directive("style", ({ directives: { style }, element, evaluate }) => { |
| 2608 | style.filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2609 | if (entry.uniqueId) { |
| 2610 | if (true) { |
| 2611 | warnUniqueIdNotSupported("style", entry.uniqueId); |
| 2612 | } |
| 2613 | return; |
| 2614 | } |
| 2615 | const styleProp = entry.suffix; |
| 2616 | let result = evaluate(entry); |
| 2617 | if (result === PENDING_GETTER) { |
| 2618 | return; |
| 2619 | } |
| 2620 | if (typeof result === "function") { |
| 2621 | result = result(); |
| 2622 | } |
| 2623 | element.props.style = element.props.style || {}; |
| 2624 | if (typeof element.props.style === "string") { |
| 2625 | element.props.style = cssStringToObject(element.props.style); |
| 2626 | } |
| 2627 | if (!result) { |
| 2628 | delete element.props.style[styleProp]; |
| 2629 | } else { |
| 2630 | element.props.style[styleProp] = result; |
| 2631 | } |
| 2632 | useInit(() => { |
| 2633 | if (!result) { |
| 2634 | element.ref.current.style.removeProperty(styleProp); |
| 2635 | } else { |
| 2636 | element.ref.current.style.setProperty(styleProp, result); |
| 2637 | } |
| 2638 | }); |
| 2639 | }); |
| 2640 | }); |
| 2641 | directive("bind", ({ directives: { bind }, element, evaluate }) => { |
| 2642 | bind.filter(isNonDefaultDirectiveSuffix).forEach((entry) => { |
| 2643 | if (entry.uniqueId) { |
| 2644 | if (true) { |
| 2645 | warnUniqueIdNotSupported("bind", entry.uniqueId); |
| 2646 | } |
| 2647 | return; |
| 2648 | } |
| 2649 | const attribute = entry.suffix; |
| 2650 | let result = evaluate(entry); |
| 2651 | if (result === PENDING_GETTER) { |
| 2652 | return; |
| 2653 | } |
| 2654 | if (typeof result === "function") { |
| 2655 | result = result(); |
| 2656 | } |
| 2657 | element.props[attribute] = result; |
| 2658 | useInit(() => { |
| 2659 | const el = element.ref.current; |
| 2660 | if (attribute === "style") { |
| 2661 | if (typeof result === "string") { |
| 2662 | el.style.cssText = result; |
| 2663 | } |
| 2664 | return; |
| 2665 | } else if (attribute !== "width" && attribute !== "height" && attribute !== "href" && attribute !== "list" && attribute !== "form" && /* |
| 2666 | * The value for `tabindex` follows the parsing rules for an |
| 2667 | * integer. If that fails, or if the attribute isn't present, then |
| 2668 | * the browsers should "follow platform conventions to determine if |
| 2669 | * the element should be considered as a focusable area", |
| 2670 | * practically meaning that most elements get a default of `-1` (not |
| 2671 | * focusable), but several also get a default of `0` (focusable in |
| 2672 | * order after all elements with a positive `tabindex` value). |
| 2673 | * |
| 2674 | * @see https://html.spec.whatwg.org/#tabindex-value |
| 2675 | */ |
| 2676 | attribute !== "tabIndex" && attribute !== "download" && attribute !== "rowSpan" && attribute !== "colSpan" && attribute !== "role" && attribute !== "popover" && attribute in el) { |
| 2677 | try { |
| 2678 | el[attribute] = result === null || result === void 0 ? "" : result; |
| 2679 | return; |
| 2680 | } catch { |
| 2681 | } |
| 2682 | } |
| 2683 | if (result !== null && result !== void 0 && (result !== false || attribute[4] === "-")) { |
| 2684 | el.setAttribute( |
| 2685 | attribute, |
| 2686 | attribute === "popover" && result === true ? "" : result |
| 2687 | ); |
| 2688 | } else { |
| 2689 | el.removeAttribute(attribute); |
| 2690 | } |
| 2691 | }); |
| 2692 | }); |
| 2693 | }); |
| 2694 | directive( |
| 2695 | "ignore", |
| 2696 | ({ |
| 2697 | element: { |
| 2698 | type: Type, |
| 2699 | props: { innerHTML, ...rest } |
| 2700 | } |
| 2701 | }) => { |
| 2702 | if (true) { |
| 2703 | warn( |
| 2704 | "The data-wp-ignore directive is deprecated and will be removed in version 7.0." |
| 2705 | ); |
| 2706 | } |
| 2707 | const cached = T2(() => innerHTML, []); |
| 2708 | return k(Type, { |
| 2709 | dangerouslySetInnerHTML: { __html: cached }, |
| 2710 | ...rest |
| 2711 | }); |
| 2712 | } |
| 2713 | ); |
| 2714 | directive("text", ({ directives: { text }, element, evaluate }) => { |
| 2715 | const entries = text.filter(isDefaultDirectiveSuffix); |
| 2716 | if (!entries.length) { |
| 2717 | if (true) { |
| 2718 | warn( |
| 2719 | "The usage of data-wp-text--suffix is not supported. Please use data-wp-text instead." |
| 2720 | ); |
| 2721 | } |
| 2722 | return; |
| 2723 | } |
| 2724 | entries.forEach((entry) => { |
| 2725 | if (entry.uniqueId) { |
| 2726 | if (true) { |
| 2727 | warnUniqueIdNotSupported("text", entry.uniqueId); |
| 2728 | } |
| 2729 | return; |
| 2730 | } |
| 2731 | try { |
| 2732 | let result = evaluate(entry); |
| 2733 | if (result === PENDING_GETTER) { |
| 2734 | return; |
| 2735 | } |
| 2736 | if (typeof result === "function") { |
| 2737 | result = result(); |
| 2738 | } |
| 2739 | element.props.children = typeof result === "object" ? null : result.toString(); |
| 2740 | } catch { |
| 2741 | element.props.children = null; |
| 2742 | } |
| 2743 | }); |
| 2744 | }); |
| 2745 | directive("run", ({ directives: { run }, evaluate }) => { |
| 2746 | run.forEach((entry) => { |
| 2747 | if (true) { |
| 2748 | if (entry.suffix) { |
| 2749 | warnUniqueIdWithTwoHyphens("run", entry.suffix); |
| 2750 | } |
| 2751 | } |
| 2752 | let result = evaluate(entry); |
| 2753 | if (typeof result === "function") { |
| 2754 | result = result(); |
| 2755 | } |
| 2756 | return result; |
| 2757 | }); |
| 2758 | }); |
| 2759 | directive( |
| 2760 | "each", |
| 2761 | ({ |
| 2762 | directives: { each, "each-key": eachKey }, |
| 2763 | context: inheritedContext, |
| 2764 | element, |
| 2765 | evaluate |
| 2766 | }) => { |
| 2767 | if (element.type !== "template") { |
| 2768 | if (true) { |
| 2769 | warn( |
| 2770 | "The data-wp-each directive can only be used on <template> elements." |
| 2771 | ); |
| 2772 | } |
| 2773 | return; |
| 2774 | } |
| 2775 | const { Provider } = inheritedContext; |
| 2776 | const inheritedValue = x2(inheritedContext); |
| 2777 | const [entry] = each; |
| 2778 | const { namespace, suffix, uniqueId } = entry; |
| 2779 | if (each.length > 1) { |
| 2780 | if (true) { |
| 2781 | warn( |
| 2782 | "The usage of multiple data-wp-each directives on the same element is not supported. Please pick only one." |
| 2783 | ); |
| 2784 | } |
| 2785 | return; |
| 2786 | } |
| 2787 | if (uniqueId) { |
| 2788 | if (true) { |
| 2789 | warnUniqueIdNotSupported("each", uniqueId); |
| 2790 | } |
| 2791 | return; |
| 2792 | } |
| 2793 | let iterable = evaluate(entry); |
| 2794 | if (iterable === PENDING_GETTER) { |
| 2795 | return; |
| 2796 | } |
| 2797 | if (typeof iterable === "function") { |
| 2798 | iterable = iterable(); |
| 2799 | } |
| 2800 | if (typeof iterable?.[Symbol.iterator] !== "function") { |
| 2801 | return; |
| 2802 | } |
| 2803 | const itemProp = suffix ? kebabToCamelCase(suffix) : "item"; |
| 2804 | const result = []; |
| 2805 | const itemContexts = useItemContexts( |
| 2806 | inheritedValue, |
| 2807 | namespace, |
| 2808 | iterable, |
| 2809 | itemProp, |
| 2810 | eachKey?.[0] |
| 2811 | ); |
| 2812 | for (const [item, itemContext, key] of itemContexts) { |
| 2813 | const mergedContext = { |
| 2814 | client: { |
| 2815 | ...inheritedValue.client, |
| 2816 | [namespace]: itemContext |
| 2817 | }, |
| 2818 | server: { ...inheritedValue.server } |
| 2819 | }; |
| 2820 | mergedContext.client[namespace][itemProp] = item; |
| 2821 | result.push( |
| 2822 | k( |
| 2823 | Provider, |
| 2824 | { value: mergedContext, key }, |
| 2825 | element.props.content |
| 2826 | ) |
| 2827 | ); |
| 2828 | } |
| 2829 | return result; |
| 2830 | }, |
| 2831 | { priority: 20 } |
| 2832 | ); |
| 2833 | directive( |
| 2834 | "each-child", |
| 2835 | ({ directives: { "each-child": eachChild }, element, evaluate }) => { |
| 2836 | const entry = eachChild.find(isDefaultDirectiveSuffix); |
| 2837 | if (!entry) { |
| 2838 | return; |
| 2839 | } |
| 2840 | const iterable = evaluate(entry); |
| 2841 | return iterable === PENDING_GETTER ? element : null; |
| 2842 | }, |
| 2843 | { priority: 1 } |
| 2844 | ); |
| 2845 | directive( |
| 2846 | "router-region", |
| 2847 | ({ directives: { "router-region": routerRegion } }) => { |
| 2848 | const entry = routerRegion.find(isDefaultDirectiveSuffix); |
| 2849 | if (!entry) { |
| 2850 | return; |
| 2851 | } |
| 2852 | if (entry.suffix) { |
| 2853 | if (true) { |
| 2854 | warn( |
| 2855 | `Suffixes for the data-wp-router-region directive are not supported. Ignoring the directive with suffix "${entry.suffix}".` |
| 2856 | ); |
| 2857 | } |
| 2858 | return; |
| 2859 | } |
| 2860 | if (entry.uniqueId) { |
| 2861 | if (true) { |
| 2862 | warnUniqueIdNotSupported("router-region", entry.uniqueId); |
| 2863 | } |
| 2864 | return; |
| 2865 | } |
| 2866 | const regionId = typeof entry.value === "string" ? entry.value : entry.value.id; |
| 2867 | if (!routerRegions.has(regionId)) { |
| 2868 | routerRegions.set(regionId, d3()); |
| 2869 | } |
| 2870 | const vdom = routerRegions.get(regionId).value; |
| 2871 | _2(() => { |
| 2872 | if (vdom && typeof vdom.type !== "string") { |
| 2873 | navigationContextSignal.value = navigationContextSignal.peek() + 1; |
| 2874 | } |
| 2875 | }, [vdom]); |
| 2876 | if (vdom && typeof vdom.type !== "string") { |
| 2877 | const previousScope = getScope(); |
| 2878 | return W(vdom, { previousScope }); |
| 2879 | } |
| 2880 | return vdom; |
| 2881 | }, |
| 2882 | { priority: 1 } |
| 2883 | ); |
| 2884 | }; |
| 2885 | |
| 2886 | // packages/interactivity/build-module/hydration.mjs |
| 2887 | init_preact_module(); |
| 2888 | |
| 2889 | // packages/interactivity/build-module/vdom.mjs |
| 2890 | init_preact_module(); |
| 2891 | var directivePrefix = `data-wp-`; |
| 2892 | var namespaces = []; |
| 2893 | var currentNamespace = () => namespaces[namespaces.length - 1] ?? null; |
| 2894 | var isObject = (item) => Boolean(item && typeof item === "object" && item.constructor === Object); |
| 2895 | var invalidCharsRegex = /[^a-z0-9-_]/i; |
| 2896 | function parseDirectiveName(directiveName) { |
| 2897 | const name = directiveName.substring(8); |
| 2898 | if (invalidCharsRegex.test(name)) { |
| 2899 | return null; |
| 2900 | } |
| 2901 | const suffixIndex = name.indexOf("--"); |
| 2902 | if (suffixIndex === -1) { |
| 2903 | return { prefix: name, suffix: null, uniqueId: null }; |
| 2904 | } |
| 2905 | const prefix = name.substring(0, suffixIndex); |
| 2906 | const remaining = name.substring(suffixIndex); |
| 2907 | if (remaining.startsWith("---") && remaining[3] !== "-") { |
| 2908 | return { |
| 2909 | prefix, |
| 2910 | suffix: null, |
| 2911 | uniqueId: remaining.substring(3) || null |
| 2912 | }; |
| 2913 | } |
| 2914 | let suffix = remaining.substring(2); |
| 2915 | const uniqueIdIndex = suffix.indexOf("---"); |
| 2916 | if (uniqueIdIndex !== -1 && suffix.substring(uniqueIdIndex)[3] !== "-") { |
| 2917 | const uniqueId = suffix.substring(uniqueIdIndex + 3) || null; |
| 2918 | suffix = suffix.substring(0, uniqueIdIndex) || null; |
| 2919 | return { prefix, suffix, uniqueId }; |
| 2920 | } |
| 2921 | return { prefix, suffix: suffix || null, uniqueId: null }; |
| 2922 | } |
| 2923 | var nsPathRegExp = /^([\w_\/-]+)::(.+)$/; |
| 2924 | var hydratedIslands = /* @__PURE__ */ new WeakSet(); |
| 2925 | function toVdom(root) { |
| 2926 | const nodesToRemove = /* @__PURE__ */ new Set(); |
| 2927 | const nodesToReplace = /* @__PURE__ */ new Set(); |
| 2928 | const treeWalker = document.createTreeWalker( |
| 2929 | root, |
| 2930 | 205 |
| 2931 | // TEXT + CDATA_SECTION + COMMENT + PROCESSING_INSTRUCTION + ELEMENT |
| 2932 | ); |
| 2933 | function walk(node) { |
| 2934 | const { nodeType } = node; |
| 2935 | if (nodeType === 3) { |
| 2936 | return node.data; |
| 2937 | } |
| 2938 | if (nodeType === 4) { |
| 2939 | nodesToReplace.add(node); |
| 2940 | return node.nodeValue; |
| 2941 | } |
| 2942 | if (nodeType === 8 || nodeType === 7) { |
| 2943 | nodesToRemove.add(node); |
| 2944 | return null; |
| 2945 | } |
| 2946 | const elementNode = node; |
| 2947 | const { attributes } = elementNode; |
| 2948 | const localName = elementNode.localName; |
| 2949 | const props = {}; |
| 2950 | const children = []; |
| 2951 | const directives = []; |
| 2952 | let ignore = false; |
| 2953 | let island = false; |
| 2954 | for (let i6 = 0; i6 < attributes.length; i6++) { |
| 2955 | const attributeName = attributes[i6].name; |
| 2956 | const attributeValue = attributes[i6].value; |
| 2957 | if (attributeName[directivePrefix.length] && attributeName.slice(0, directivePrefix.length) === directivePrefix) { |
| 2958 | if (attributeName === "data-wp-ignore") { |
| 2959 | ignore = true; |
| 2960 | } else { |
| 2961 | const regexResult = nsPathRegExp.exec(attributeValue); |
| 2962 | const namespace = regexResult?.[1] ?? null; |
| 2963 | let value = regexResult?.[2] ?? attributeValue; |
| 2964 | try { |
| 2965 | const parsedValue = JSON.parse(value); |
| 2966 | value = isObject(parsedValue) ? parsedValue : value; |
| 2967 | } catch { |
| 2968 | } |
| 2969 | if (attributeName === "data-wp-interactive") { |
| 2970 | island = true; |
| 2971 | const islandNamespace = ( |
| 2972 | // eslint-disable-next-line no-nested-ternary |
| 2973 | typeof value === "string" ? value : typeof value?.namespace === "string" ? value.namespace : null |
| 2974 | ); |
| 2975 | namespaces.push(islandNamespace); |
| 2976 | } else { |
| 2977 | directives.push([attributeName, namespace, value]); |
| 2978 | } |
| 2979 | } |
| 2980 | } else if (attributeName === "ref") { |
| 2981 | continue; |
| 2982 | } |
| 2983 | if (attributeValue === "" && elementNode[attributeName] === true) { |
| 2984 | props[attributeName] = true; |
| 2985 | } else { |
| 2986 | props[attributeName] = attributeValue; |
| 2987 | } |
| 2988 | } |
| 2989 | if (ignore && !island) { |
| 2990 | return [ |
| 2991 | k(localName, { |
| 2992 | ...props, |
| 2993 | innerHTML: elementNode.innerHTML, |
| 2994 | __directives: { ignore: true } |
| 2995 | }) |
| 2996 | ]; |
| 2997 | } |
| 2998 | if (island) { |
| 2999 | hydratedIslands.add(elementNode); |
| 3000 | } |
| 3001 | if (directives.length) { |
| 3002 | props.__directives = directives.reduce((obj, [name, ns, value]) => { |
| 3003 | const directiveParsed = parseDirectiveName(name); |
| 3004 | if (directiveParsed === null) { |
| 3005 | if (true) { |
| 3006 | warn(`Found malformed directive name: ${name}.`); |
| 3007 | } |
| 3008 | return obj; |
| 3009 | } |
| 3010 | const { prefix, suffix, uniqueId } = directiveParsed; |
| 3011 | obj[prefix] = obj[prefix] || []; |
| 3012 | obj[prefix].push({ |
| 3013 | namespace: ns ?? currentNamespace(), |
| 3014 | value, |
| 3015 | suffix, |
| 3016 | uniqueId |
| 3017 | }); |
| 3018 | return obj; |
| 3019 | }, {}); |
| 3020 | for (const prefix in props.__directives) { |
| 3021 | props.__directives[prefix].sort( |
| 3022 | (a5, b4) => { |
| 3023 | const aSuffix = a5.suffix ?? ""; |
| 3024 | const bSuffix = b4.suffix ?? ""; |
| 3025 | if (aSuffix !== bSuffix) { |
| 3026 | return aSuffix < bSuffix ? -1 : 1; |
| 3027 | } |
| 3028 | const aId = a5.uniqueId ?? ""; |
| 3029 | const bId = b4.uniqueId ?? ""; |
| 3030 | return +(aId > bId) - +(aId < bId); |
| 3031 | } |
| 3032 | ); |
| 3033 | } |
| 3034 | } |
| 3035 | if (props.__directives?.["each-child"]) { |
| 3036 | props.dangerouslySetInnerHTML = { |
| 3037 | __html: elementNode.innerHTML |
| 3038 | }; |
| 3039 | } else if (localName === "template") { |
| 3040 | props.content = [ |
| 3041 | ...elementNode.content.childNodes |
| 3042 | ].map((childNode) => toVdom(childNode)); |
| 3043 | } else { |
| 3044 | let child = treeWalker.firstChild(); |
| 3045 | if (child) { |
| 3046 | while (child) { |
| 3047 | const vnode = walk(child); |
| 3048 | if (vnode) { |
| 3049 | children.push(vnode); |
| 3050 | } |
| 3051 | child = treeWalker.nextSibling(); |
| 3052 | } |
| 3053 | treeWalker.parentNode(); |
| 3054 | } |
| 3055 | } |
| 3056 | if (island) { |
| 3057 | namespaces.pop(); |
| 3058 | } |
| 3059 | return k(localName, props, children); |
| 3060 | } |
| 3061 | const vdom = walk(treeWalker.currentNode); |
| 3062 | nodesToRemove.forEach( |
| 3063 | (node) => node.remove() |
| 3064 | ); |
| 3065 | nodesToReplace.forEach( |
| 3066 | (node) => node.replaceWith( |
| 3067 | new window.Text(node.nodeValue ?? "") |
| 3068 | ) |
| 3069 | ); |
| 3070 | return vdom; |
| 3071 | } |
| 3072 | |
| 3073 | // packages/interactivity/build-module/hydration.mjs |
| 3074 | var regionRootFragments = /* @__PURE__ */ new WeakMap(); |
| 3075 | var getRegionRootFragment = (regions) => { |
| 3076 | const region = Array.isArray(regions) ? regions[0] : regions; |
| 3077 | if (!region.parentElement) { |
| 3078 | throw Error("The passed region should be an element with a parent."); |
| 3079 | } |
| 3080 | if (!regionRootFragments.has(region)) { |
| 3081 | regionRootFragments.set( |
| 3082 | region, |
| 3083 | createRootFragment(region.parentElement, regions) |
| 3084 | ); |
| 3085 | } |
| 3086 | return regionRootFragments.get(region); |
| 3087 | }; |
| 3088 | var initialVdom = /* @__PURE__ */ new WeakMap(); |
| 3089 | var resolveInitialVdom; |
| 3090 | var initialVdomPromise = new Promise((resolve2) => { |
| 3091 | resolveInitialVdom = resolve2; |
| 3092 | }); |
| 3093 | var hydrateRegions = async () => { |
| 3094 | const nodes = document.querySelectorAll(`[data-wp-interactive]`); |
| 3095 | for (const node of nodes) { |
| 3096 | if (!hydratedIslands.has(node)) { |
| 3097 | await splitTask(); |
| 3098 | const fragment = getRegionRootFragment(node); |
| 3099 | const vdom = toVdom(node); |
| 3100 | initialVdom.set(node, vdom); |
| 3101 | await splitTask(); |
| 3102 | U(vdom, fragment); |
| 3103 | } |
| 3104 | } |
| 3105 | resolveInitialVdom(initialVdom); |
| 3106 | }; |
| 3107 | |
| 3108 | // packages/interactivity/build-module/index.mjs |
| 3109 | if (true) { |
| 3110 | await Promise.resolve().then(() => (init_debug_module(), debug_module_exports)); |
| 3111 | } |
| 3112 | var watch = E2; |
| 3113 | var requiredConsent = "I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress."; |
| 3114 | var privateApis = (lock) => { |
| 3115 | if (lock === requiredConsent) { |
| 3116 | return { |
| 3117 | getRegionRootFragment, |
| 3118 | initialVdomPromise, |
| 3119 | toVdom, |
| 3120 | directive, |
| 3121 | getNamespace, |
| 3122 | h: k, |
| 3123 | cloneElement: W, |
| 3124 | render: R, |
| 3125 | proxifyState, |
| 3126 | parseServerData, |
| 3127 | populateServerData, |
| 3128 | batch: r3, |
| 3129 | routerRegions, |
| 3130 | deepReadOnly, |
| 3131 | navigationSignal, |
| 3132 | sessionId, |
| 3133 | warn |
| 3134 | }; |
| 3135 | } |
| 3136 | throw new Error("Forbidden access."); |
| 3137 | }; |
| 3138 | populateServerData(parseServerData()); |
| 3139 | directives_default(); |
| 3140 | onDOMReady(hydrateRegions); |
| 3141 | window.history.replaceState( |
| 3142 | { ...window.history.state, wpInteractivityId: sessionId }, |
| 3143 | "" |
| 3144 | ); |
| 3145 | window.addEventListener("popstate", (event) => { |
| 3146 | if (event.state !== null && event.state?.wpInteractivityId !== sessionId) { |
| 3147 | window.location.reload(); |
| 3148 | } |
| 3149 | }); |
| 3150 | export { |
| 3151 | getConfig, |
| 3152 | getContext, |
| 3153 | getElement, |
| 3154 | getServerContext, |
| 3155 | getServerState, |
| 3156 | privateApis, |
| 3157 | splitTask, |
| 3158 | store, |
| 3159 | useCallback, |
| 3160 | useEffect, |
| 3161 | useInit, |
| 3162 | useLayoutEffect, |
| 3163 | useMemo, |
| 3164 | A2 as useRef, |
| 3165 | d2 as useState, |
| 3166 | useWatch, |
| 3167 | watch, |
| 3168 | withScope, |
| 3169 | withSyncEvent |
| 3170 | }; |
| 3171 | //# sourceMappingURL=index.js.map |
| 3172 |