PluginProbe
Gutenberg / 22.9.0
Gutenberg v22.9.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / modules / interactivity / index.js

index.js in Gutenberg 22.9.0, at build/modules/interactivity/index.js

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