rails-profiler 0.35.2 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4454 +1,2 @@
1
- "use strict";
2
- (() => {
3
- var __typeError = (msg) => {
4
- throw TypeError(msg);
5
- };
6
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
8
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
10
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
- var __privateWrapper = (obj, member, setter, getter) => ({
12
- set _(value) {
13
- __privateSet(obj, member, value, setter);
14
- },
15
- get _() {
16
- return __privateGet(obj, member, getter);
17
- }
18
- });
19
-
20
- // node_modules/preact/dist/preact.module.js
21
- var n;
22
- var l;
23
- var u;
24
- var t;
25
- var i;
26
- var r;
27
- var o;
28
- var e;
29
- var f;
30
- var c;
31
- var s;
32
- var a;
33
- var h;
34
- var p = {};
35
- var v = [];
36
- var y = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
37
- var d = Array.isArray;
38
- function w(n2, l3) {
39
- for (var u4 in l3) n2[u4] = l3[u4];
40
- return n2;
41
- }
42
- function g(n2) {
43
- n2 && n2.parentNode && n2.parentNode.removeChild(n2);
44
- }
45
- function _(l3, u4, t3) {
46
- var i3, r3, o3, e3 = {};
47
- for (o3 in u4) "key" == o3 ? i3 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : e3[o3] = u4[o3];
48
- if (arguments.length > 2 && (e3.children = arguments.length > 3 ? n.call(arguments, 2) : t3), "function" == typeof l3 && null != l3.defaultProps) for (o3 in l3.defaultProps) void 0 === e3[o3] && (e3[o3] = l3.defaultProps[o3]);
49
- return m(l3, e3, i3, r3, null);
50
- }
51
- function m(n2, t3, i3, r3, o3) {
52
- var e3 = { type: n2, props: t3, key: i3, ref: r3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o3 ? ++u : o3, __i: -1, __u: 0 };
53
- return null == o3 && null != l.vnode && l.vnode(e3), e3;
54
- }
55
- function k(n2) {
56
- return n2.children;
57
- }
58
- function x(n2, l3) {
59
- this.props = n2, this.context = l3;
60
- }
61
- function S(n2, l3) {
62
- if (null == l3) return n2.__ ? S(n2.__, n2.__i + 1) : null;
63
- for (var u4; l3 < n2.__k.length; l3++) if (null != (u4 = n2.__k[l3]) && null != u4.__e) return u4.__e;
64
- return "function" == typeof n2.type ? S(n2) : null;
65
- }
66
- function C(n2) {
67
- if (n2.__P && n2.__d) {
68
- var u4 = n2.__v, t3 = u4.__e, i3 = [], r3 = [], o3 = w({}, u4);
69
- o3.__v = u4.__v + 1, l.vnode && l.vnode(o3), z(n2.__P, o3, u4, n2.__n, n2.__P.namespaceURI, 32 & u4.__u ? [t3] : null, i3, null == t3 ? S(u4) : t3, !!(32 & u4.__u), r3), o3.__v = u4.__v, o3.__.__k[o3.__i] = o3, V(i3, o3, r3), u4.__e = u4.__ = null, o3.__e != t3 && M(o3);
70
- }
71
- }
72
- function M(n2) {
73
- if (null != (n2 = n2.__) && null != n2.__c) return n2.__e = n2.__c.base = null, n2.__k.some(function(l3) {
74
- if (null != l3 && null != l3.__e) return n2.__e = n2.__c.base = l3.__e;
75
- }), M(n2);
76
- }
77
- function $(n2) {
78
- (!n2.__d && (n2.__d = true) && i.push(n2) && !I.__r++ || r != l.debounceRendering) && ((r = l.debounceRendering) || o)(I);
79
- }
80
- function I() {
81
- try {
82
- for (var n2, l3 = 1; i.length; ) i.length > l3 && i.sort(e), n2 = i.shift(), l3 = i.length, C(n2);
83
- } finally {
84
- i.length = I.__r = 0;
85
- }
86
- }
87
- function P(n2, l3, u4, t3, i3, r3, o3, e3, f4, c3, s3) {
88
- var a3, h3, y3, d3, w3, g2, _3, m3 = t3 && t3.__k || v, b = l3.length;
89
- for (f4 = A(u4, l3, m3, f4, b), a3 = 0; a3 < b; a3++) null != (y3 = u4.__k[a3]) && (h3 = -1 != y3.__i && m3[y3.__i] || p, y3.__i = a3, g2 = z(n2, y3, h3, i3, r3, o3, e3, f4, c3, s3), d3 = y3.__e, y3.ref && h3.ref != y3.ref && (h3.ref && D(h3.ref, null, y3), s3.push(y3.ref, y3.__c || d3, y3)), null == w3 && null != d3 && (w3 = d3), (_3 = !!(4 & y3.__u)) || h3.__k === y3.__k ? f4 = H(y3, f4, n2, _3) : "function" == typeof y3.type && void 0 !== g2 ? f4 = g2 : d3 && (f4 = d3.nextSibling), y3.__u &= -7);
90
- return u4.__e = w3, f4;
91
- }
92
- function A(n2, l3, u4, t3, i3) {
93
- var r3, o3, e3, f4, c3, s3 = u4.length, a3 = s3, h3 = 0;
94
- for (n2.__k = new Array(i3), r3 = 0; r3 < i3; r3++) null != (o3 = l3[r3]) && "boolean" != typeof o3 && "function" != typeof o3 ? ("string" == typeof o3 || "number" == typeof o3 || "bigint" == typeof o3 || o3.constructor == String ? o3 = n2.__k[r3] = m(null, o3, null, null, null) : d(o3) ? o3 = n2.__k[r3] = m(k, { children: o3 }, null, null, null) : void 0 === o3.constructor && o3.__b > 0 ? o3 = n2.__k[r3] = m(o3.type, o3.props, o3.key, o3.ref ? o3.ref : null, o3.__v) : n2.__k[r3] = o3, f4 = r3 + h3, o3.__ = n2, o3.__b = n2.__b + 1, e3 = null, -1 != (c3 = o3.__i = T(o3, u4, f4, a3)) && (a3--, (e3 = u4[c3]) && (e3.__u |= 2)), null == e3 || null == e3.__v ? (-1 == c3 && (i3 > s3 ? h3-- : i3 < s3 && h3++), "function" != typeof o3.type && (o3.__u |= 4)) : c3 != f4 && (c3 == f4 - 1 ? h3-- : c3 == f4 + 1 ? h3++ : (c3 > f4 ? h3-- : h3++, o3.__u |= 4))) : n2.__k[r3] = null;
95
- if (a3) for (r3 = 0; r3 < s3; r3++) null != (e3 = u4[r3]) && 0 == (2 & e3.__u) && (e3.__e == t3 && (t3 = S(e3)), E(e3, e3));
96
- return t3;
97
- }
98
- function H(n2, l3, u4, t3) {
99
- var i3, r3;
100
- if ("function" == typeof n2.type) {
101
- for (i3 = n2.__k, r3 = 0; i3 && r3 < i3.length; r3++) i3[r3] && (i3[r3].__ = n2, l3 = H(i3[r3], l3, u4, t3));
102
- return l3;
103
- }
104
- n2.__e != l3 && (t3 && (l3 && n2.type && !l3.parentNode && (l3 = S(n2)), u4.insertBefore(n2.__e, l3 || null)), l3 = n2.__e);
105
- do {
106
- l3 = l3 && l3.nextSibling;
107
- } while (null != l3 && 8 == l3.nodeType);
108
- return l3;
109
- }
110
- function T(n2, l3, u4, t3) {
111
- var i3, r3, o3, e3 = n2.key, f4 = n2.type, c3 = l3[u4], s3 = null != c3 && 0 == (2 & c3.__u);
112
- if (null === c3 && null == e3 || s3 && e3 == c3.key && f4 == c3.type) return u4;
113
- if (t3 > (s3 ? 1 : 0)) {
114
- for (i3 = u4 - 1, r3 = u4 + 1; i3 >= 0 || r3 < l3.length; ) if (null != (c3 = l3[o3 = i3 >= 0 ? i3-- : r3++]) && 0 == (2 & c3.__u) && e3 == c3.key && f4 == c3.type) return o3;
115
- }
116
- return -1;
117
- }
118
- function j(n2, l3, u4) {
119
- "-" == l3[0] ? n2.setProperty(l3, null == u4 ? "" : u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || y.test(l3) ? u4 : u4 + "px";
120
- }
121
- function F(n2, l3, u4, t3, i3) {
122
- var r3, o3;
123
- n: if ("style" == l3) if ("string" == typeof u4) n2.style.cssText = u4;
124
- else {
125
- if ("string" == typeof t3 && (n2.style.cssText = t3 = ""), t3) for (l3 in t3) u4 && l3 in u4 || j(n2.style, l3, "");
126
- if (u4) for (l3 in u4) t3 && u4[l3] == t3[l3] || j(n2.style, l3, u4[l3]);
127
- }
128
- else if ("o" == l3[0] && "n" == l3[1]) r3 = l3 != (l3 = l3.replace(f, "$1")), o3 = l3.toLowerCase(), l3 = o3 in n2 || "onFocusOut" == l3 || "onFocusIn" == l3 ? o3.slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u4, u4 ? t3 ? u4.u = t3.u : (u4.u = c, n2.addEventListener(l3, r3 ? a : s, r3)) : n2.removeEventListener(l3, r3 ? a : s, r3);
129
- else {
130
- if ("http://www.w3.org/2000/svg" == i3) l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
131
- else if ("width" != l3 && "height" != l3 && "href" != l3 && "list" != l3 && "form" != l3 && "tabIndex" != l3 && "download" != l3 && "rowSpan" != l3 && "colSpan" != l3 && "role" != l3 && "popover" != l3 && l3 in n2) try {
132
- n2[l3] = null == u4 ? "" : u4;
133
- break n;
134
- } catch (n3) {
135
- }
136
- "function" == typeof u4 || (null == u4 || false === u4 && "-" != l3[4] ? n2.removeAttribute(l3) : n2.setAttribute(l3, "popover" == l3 && 1 == u4 ? "" : u4));
137
- }
138
- }
139
- function O(n2) {
140
- return function(u4) {
141
- if (this.l) {
142
- var t3 = this.l[u4.type + n2];
143
- if (null == u4.t) u4.t = c++;
144
- else if (u4.t < t3.u) return;
145
- return t3(l.event ? l.event(u4) : u4);
146
- }
147
- };
148
- }
149
- function z(n2, u4, t3, i3, r3, o3, e3, f4, c3, s3) {
150
- var a3, h3, p3, y3, _3, m3, b, S2, C3, M2, $2, I2, A3, H2, L, T3 = u4.type;
151
- if (void 0 !== u4.constructor) return null;
152
- 128 & t3.__u && (c3 = !!(32 & t3.__u), o3 = [f4 = u4.__e = t3.__e]), (a3 = l.__b) && a3(u4);
153
- n: if ("function" == typeof T3) try {
154
- if (S2 = u4.props, C3 = T3.prototype && T3.prototype.render, M2 = (a3 = T3.contextType) && i3[a3.__c], $2 = a3 ? M2 ? M2.props.value : a3.__ : i3, t3.__c ? b = (h3 = u4.__c = t3.__c).__ = h3.__E : (C3 ? u4.__c = h3 = new T3(S2, $2) : (u4.__c = h3 = new x(S2, $2), h3.constructor = T3, h3.render = G), M2 && M2.sub(h3), h3.state || (h3.state = {}), h3.__n = i3, p3 = h3.__d = true, h3.__h = [], h3._sb = []), C3 && null == h3.__s && (h3.__s = h3.state), C3 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = w({}, h3.__s)), w(h3.__s, T3.getDerivedStateFromProps(S2, h3.__s))), y3 = h3.props, _3 = h3.state, h3.__v = u4, p3) C3 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), C3 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
155
- else {
156
- if (C3 && null == T3.getDerivedStateFromProps && S2 !== y3 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(S2, $2), u4.__v == t3.__v || !h3.__e && null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(S2, h3.__s, $2)) {
157
- u4.__v != t3.__v && (h3.props = S2, h3.state = h3.__s, h3.__d = false), u4.__e = t3.__e, u4.__k = t3.__k, u4.__k.some(function(n3) {
158
- n3 && (n3.__ = u4);
159
- }), v.push.apply(h3.__h, h3._sb), h3._sb = [], h3.__h.length && e3.push(h3);
160
- break n;
161
- }
162
- null != h3.componentWillUpdate && h3.componentWillUpdate(S2, h3.__s, $2), C3 && null != h3.componentDidUpdate && h3.__h.push(function() {
163
- h3.componentDidUpdate(y3, _3, m3);
164
- });
165
- }
166
- if (h3.context = $2, h3.props = S2, h3.__P = n2, h3.__e = false, I2 = l.__r, A3 = 0, C3) h3.state = h3.__s, h3.__d = false, I2 && I2(u4), a3 = h3.render(h3.props, h3.state, h3.context), v.push.apply(h3.__h, h3._sb), h3._sb = [];
167
- else do {
168
- h3.__d = false, I2 && I2(u4), a3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
169
- } while (h3.__d && ++A3 < 25);
170
- h3.state = h3.__s, null != h3.getChildContext && (i3 = w(w({}, i3), h3.getChildContext())), C3 && !p3 && null != h3.getSnapshotBeforeUpdate && (m3 = h3.getSnapshotBeforeUpdate(y3, _3)), H2 = null != a3 && a3.type === k && null == a3.key ? q(a3.props.children) : a3, f4 = P(n2, d(H2) ? H2 : [H2], u4, t3, i3, r3, o3, e3, f4, c3, s3), h3.base = u4.__e, u4.__u &= -161, h3.__h.length && e3.push(h3), b && (h3.__E = h3.__ = null);
171
- } catch (n3) {
172
- if (u4.__v = null, c3 || null != o3) if (n3.then) {
173
- for (u4.__u |= c3 ? 160 : 128; f4 && 8 == f4.nodeType && f4.nextSibling; ) f4 = f4.nextSibling;
174
- o3[o3.indexOf(f4)] = null, u4.__e = f4;
175
- } else {
176
- for (L = o3.length; L--; ) g(o3[L]);
177
- N(u4);
178
- }
179
- else u4.__e = t3.__e, u4.__k = t3.__k, n3.then || N(u4);
180
- l.__e(n3, u4, t3);
181
- }
182
- else null == o3 && u4.__v == t3.__v ? (u4.__k = t3.__k, u4.__e = t3.__e) : f4 = u4.__e = B(t3.__e, u4, t3, i3, r3, o3, e3, c3, s3);
183
- return (a3 = l.diffed) && a3(u4), 128 & u4.__u ? void 0 : f4;
184
- }
185
- function N(n2) {
186
- n2 && (n2.__c && (n2.__c.__e = true), n2.__k && n2.__k.some(N));
187
- }
188
- function V(n2, u4, t3) {
189
- for (var i3 = 0; i3 < t3.length; i3++) D(t3[i3], t3[++i3], t3[++i3]);
190
- l.__c && l.__c(u4, n2), n2.some(function(u5) {
191
- try {
192
- n2 = u5.__h, u5.__h = [], n2.some(function(n3) {
193
- n3.call(u5);
194
- });
195
- } catch (n3) {
196
- l.__e(n3, u5.__v);
197
- }
198
- });
199
- }
200
- function q(n2) {
201
- return "object" != typeof n2 || null == n2 || n2.__b > 0 ? n2 : d(n2) ? n2.map(q) : w({}, n2);
202
- }
203
- function B(u4, t3, i3, r3, o3, e3, f4, c3, s3) {
204
- var a3, h3, v3, y3, w3, _3, m3, b = i3.props || p, k3 = t3.props, x3 = t3.type;
205
- if ("svg" == x3 ? o3 = "http://www.w3.org/2000/svg" : "math" == x3 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != e3) {
206
- for (a3 = 0; a3 < e3.length; a3++) if ((w3 = e3[a3]) && "setAttribute" in w3 == !!x3 && (x3 ? w3.localName == x3 : 3 == w3.nodeType)) {
207
- u4 = w3, e3[a3] = null;
208
- break;
209
- }
210
- }
211
- if (null == u4) {
212
- if (null == x3) return document.createTextNode(k3);
213
- u4 = document.createElementNS(o3, x3, k3.is && k3), c3 && (l.__m && l.__m(t3, e3), c3 = false), e3 = null;
214
- }
215
- if (null == x3) b === k3 || c3 && u4.data == k3 || (u4.data = k3);
216
- else {
217
- if (e3 = e3 && n.call(u4.childNodes), !c3 && null != e3) for (b = {}, a3 = 0; a3 < u4.attributes.length; a3++) b[(w3 = u4.attributes[a3]).name] = w3.value;
218
- for (a3 in b) w3 = b[a3], "dangerouslySetInnerHTML" == a3 ? v3 = w3 : "children" == a3 || a3 in k3 || "value" == a3 && "defaultValue" in k3 || "checked" == a3 && "defaultChecked" in k3 || F(u4, a3, null, w3, o3);
219
- for (a3 in k3) w3 = k3[a3], "children" == a3 ? y3 = w3 : "dangerouslySetInnerHTML" == a3 ? h3 = w3 : "value" == a3 ? _3 = w3 : "checked" == a3 ? m3 = w3 : c3 && "function" != typeof w3 || b[a3] === w3 || F(u4, a3, w3, b[a3], o3);
220
- if (h3) c3 || v3 && (h3.__html == v3.__html || h3.__html == u4.innerHTML) || (u4.innerHTML = h3.__html), t3.__k = [];
221
- else if (v3 && (u4.innerHTML = ""), P("template" == t3.type ? u4.content : u4, d(y3) ? y3 : [y3], t3, i3, r3, "foreignObject" == x3 ? "http://www.w3.org/1999/xhtml" : o3, e3, f4, e3 ? e3[0] : i3.__k && S(i3, 0), c3, s3), null != e3) for (a3 = e3.length; a3--; ) g(e3[a3]);
222
- c3 || (a3 = "value", "progress" == x3 && null == _3 ? u4.removeAttribute("value") : null != _3 && (_3 !== u4[a3] || "progress" == x3 && !_3 || "option" == x3 && _3 != b[a3]) && F(u4, a3, _3, b[a3], o3), a3 = "checked", null != m3 && m3 != u4[a3] && F(u4, a3, m3, b[a3], o3));
223
- }
224
- return u4;
225
- }
226
- function D(n2, u4, t3) {
227
- try {
228
- if ("function" == typeof n2) {
229
- var i3 = "function" == typeof n2.__u;
230
- i3 && n2.__u(), i3 && null == u4 || (n2.__u = n2(u4));
231
- } else n2.current = u4;
232
- } catch (n3) {
233
- l.__e(n3, t3);
234
- }
235
- }
236
- function E(n2, u4, t3) {
237
- var i3, r3;
238
- if (l.unmount && l.unmount(n2), (i3 = n2.ref) && (i3.current && i3.current != n2.__e || D(i3, null, u4)), null != (i3 = n2.__c)) {
239
- if (i3.componentWillUnmount) try {
240
- i3.componentWillUnmount();
241
- } catch (n3) {
242
- l.__e(n3, u4);
243
- }
244
- i3.base = i3.__P = null;
245
- }
246
- if (i3 = n2.__k) for (r3 = 0; r3 < i3.length; r3++) i3[r3] && E(i3[r3], u4, t3 || "function" != typeof n2.type);
247
- t3 || g(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
248
- }
249
- function G(n2, l3, u4) {
250
- return this.constructor(n2, u4);
251
- }
252
- function J(u4, t3, i3) {
253
- var r3, o3, e3, f4;
254
- t3 == document && (t3 = document.documentElement), l.__ && l.__(u4, t3), o3 = (r3 = "function" == typeof i3) ? null : i3 && i3.__k || t3.__k, e3 = [], f4 = [], z(t3, u4 = (!r3 && i3 || t3).__k = _(k, null, [u4]), o3 || p, p, t3.namespaceURI, !r3 && i3 ? [i3] : o3 ? null : t3.firstChild ? n.call(t3.childNodes) : null, e3, !r3 && i3 ? i3 : o3 ? o3.__e : t3.firstChild, r3, f4), V(e3, u4, f4);
255
- }
256
- function R(n2) {
257
- function l3(n3) {
258
- var u4, t3;
259
- return this.getChildContext || (u4 = /* @__PURE__ */ new Set(), (t3 = {})[l3.__c] = this, this.getChildContext = function() {
260
- return t3;
261
- }, this.componentWillUnmount = function() {
262
- u4 = null;
263
- }, this.shouldComponentUpdate = function(n4) {
264
- this.props.value != n4.value && u4.forEach(function(n5) {
265
- n5.__e = true, $(n5);
266
- });
267
- }, this.sub = function(n4) {
268
- u4.add(n4);
269
- var l4 = n4.componentWillUnmount;
270
- n4.componentWillUnmount = function() {
271
- u4 && u4.delete(n4), l4 && l4.call(n4);
272
- };
273
- }), n3.children;
274
- }
275
- return l3.__c = "__cC" + h++, l3.__ = n2, l3.Provider = l3.__l = (l3.Consumer = function(n3, l4) {
276
- return n3.children(l4);
277
- }).contextType = l3, l3;
278
- }
279
- n = v.slice, l = { __e: function(n2, l3, u4, t3) {
280
- for (var i3, r3, o3; l3 = l3.__; ) if ((i3 = l3.__c) && !i3.__) try {
281
- if ((r3 = i3.constructor) && null != r3.getDerivedStateFromError && (i3.setState(r3.getDerivedStateFromError(n2)), o3 = i3.__d), null != i3.componentDidCatch && (i3.componentDidCatch(n2, t3 || {}), o3 = i3.__d), o3) return i3.__E = i3;
282
- } catch (l4) {
283
- n2 = l4;
284
- }
285
- throw n2;
286
- } }, u = 0, t = function(n2) {
287
- return null != n2 && void 0 === n2.constructor;
288
- }, x.prototype.setState = function(n2, l3) {
289
- var u4;
290
- u4 = null != this.__s && this.__s != this.state ? this.__s : this.__s = w({}, this.state), "function" == typeof n2 && (n2 = n2(w({}, u4), this.props)), n2 && w(u4, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), $(this));
291
- }, x.prototype.forceUpdate = function(n2) {
292
- this.__v && (this.__e = true, n2 && this.__h.push(n2), $(this));
293
- }, x.prototype.render = k, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n2, l3) {
294
- return n2.__v.__b - l3.__v.__b;
295
- }, I.__r = 0, f = /(PointerCapture)$|Capture$/i, c = 0, s = O(false), a = O(true), h = 0;
296
-
297
- // node_modules/preact/hooks/dist/hooks.module.js
298
- var t2;
299
- var r2;
300
- var u2;
301
- var i2;
302
- var o2 = 0;
303
- var f2 = [];
304
- var c2 = l;
305
- var e2 = c2.__b;
306
- var a2 = c2.__r;
307
- var v2 = c2.diffed;
308
- var l2 = c2.__c;
309
- var m2 = c2.unmount;
310
- var s2 = c2.__;
311
- function p2(n2, t3) {
312
- c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
313
- var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
314
- return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
315
- }
316
- function d2(n2) {
317
- return o2 = 1, h2(D2, n2);
318
- }
319
- function h2(n2, u4, i3) {
320
- var o3 = p2(t2++, 2);
321
- if (o3.t = n2, !o3.__c && (o3.__ = [i3 ? i3(u4) : D2(void 0, u4), function(n3) {
322
- var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
323
- t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
324
- }], o3.__c = r2, !r2.__f)) {
325
- var f4 = function(n3, t3, r3) {
326
- if (!o3.__c.__H) return true;
327
- var u5 = o3.__c.__H.__.filter(function(n4) {
328
- return n4.__c;
329
- });
330
- if (u5.every(function(n4) {
331
- return !n4.__N;
332
- })) return !c3 || c3.call(this, n3, t3, r3);
333
- var i4 = o3.__c.props !== n3;
334
- return u5.some(function(n4) {
335
- if (n4.__N) {
336
- var t4 = n4.__[0];
337
- n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i4 = true);
338
- }
339
- }), c3 && c3.call(this, n3, t3, r3) || i4;
340
- };
341
- r2.__f = true;
342
- var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
343
- r2.componentWillUpdate = function(n3, t3, r3) {
344
- if (this.__e) {
345
- var u5 = c3;
346
- c3 = void 0, f4(n3, t3, r3), c3 = u5;
347
- }
348
- e3 && e3.call(this, n3, t3, r3);
349
- }, r2.shouldComponentUpdate = f4;
350
- }
351
- return o3.__N || o3.__;
352
- }
353
- function y2(n2, u4) {
354
- var i3 = p2(t2++, 3);
355
- !c2.__s && C2(i3.__H, u4) && (i3.__ = n2, i3.u = u4, r2.__H.__h.push(i3));
356
- }
357
- function _2(n2, u4) {
358
- var i3 = p2(t2++, 4);
359
- !c2.__s && C2(i3.__H, u4) && (i3.__ = n2, i3.u = u4, r2.__h.push(i3));
360
- }
361
- function A2(n2) {
362
- return o2 = 5, T2(function() {
363
- return { current: n2 };
364
- }, []);
365
- }
366
- function T2(n2, r3) {
367
- var u4 = p2(t2++, 7);
368
- return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
369
- }
370
- function q2(n2, t3) {
371
- return o2 = 8, T2(function() {
372
- return n2;
373
- }, t3);
374
- }
375
- function x2(n2) {
376
- var u4 = r2.context[n2.__c], i3 = p2(t2++, 9);
377
- return i3.c = n2, u4 ? (null == i3.__ && (i3.__ = true, u4.sub(r2)), u4.props.value) : n2.__;
378
- }
379
- function j2() {
380
- for (var n2; n2 = f2.shift(); ) {
381
- var t3 = n2.__H;
382
- if (n2.__P && t3) try {
383
- t3.__h.some(z2), t3.__h.some(B2), t3.__h = [];
384
- } catch (r3) {
385
- t3.__h = [], c2.__e(r3, n2.__v);
386
- }
387
- }
388
- }
389
- c2.__b = function(n2) {
390
- r2 = null, e2 && e2(n2);
391
- }, c2.__ = function(n2, t3) {
392
- n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
393
- }, c2.__r = function(n2) {
394
- a2 && a2(n2), t2 = 0;
395
- var i3 = (r2 = n2.__c).__H;
396
- i3 && (u2 === r2 ? (i3.__h = [], r2.__h = [], i3.__.some(function(n3) {
397
- n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
398
- })) : (i3.__h.some(z2), i3.__h.some(B2), i3.__h = [], t2 = 0)), u2 = r2;
399
- }, c2.diffed = function(n2) {
400
- v2 && v2(n2);
401
- var t3 = n2.__c;
402
- t3 && t3.__H && (t3.__H.__h.length && (1 !== f2.push(t3) && i2 === c2.requestAnimationFrame || ((i2 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.some(function(n3) {
403
- n3.u && (n3.__H = n3.u), n3.u = void 0;
404
- })), u2 = r2 = null;
405
- }, c2.__c = function(n2, t3) {
406
- t3.some(function(n3) {
407
- try {
408
- n3.__h.some(z2), n3.__h = n3.__h.filter(function(n4) {
409
- return !n4.__ || B2(n4);
410
- });
411
- } catch (r3) {
412
- t3.some(function(n4) {
413
- n4.__h && (n4.__h = []);
414
- }), t3 = [], c2.__e(r3, n3.__v);
415
- }
416
- }), l2 && l2(n2, t3);
417
- }, c2.unmount = function(n2) {
418
- m2 && m2(n2);
419
- var t3, r3 = n2.__c;
420
- r3 && r3.__H && (r3.__H.__.some(function(n3) {
421
- try {
422
- z2(n3);
423
- } catch (n4) {
424
- t3 = n4;
425
- }
426
- }), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
427
- };
428
- var k2 = "function" == typeof requestAnimationFrame;
429
- function w2(n2) {
430
- var t3, r3 = function() {
431
- clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
432
- }, u4 = setTimeout(r3, 35);
433
- k2 && (t3 = requestAnimationFrame(r3));
434
- }
435
- function z2(n2) {
436
- var t3 = r2, u4 = n2.__c;
437
- "function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
438
- }
439
- function B2(n2) {
440
- var t3 = r2;
441
- n2.__c = n2.__(), r2 = t3;
442
- }
443
- function C2(n2, t3) {
444
- return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
445
- return t4 !== n2[r3];
446
- });
447
- }
448
- function D2(n2, t3) {
449
- return "function" == typeof t3 ? t3(n2) : t3;
450
- }
451
-
452
- // node_modules/@tanstack/query-core/build/modern/subscribable.js
453
- var Subscribable = class {
454
- constructor() {
455
- this.listeners = /* @__PURE__ */ new Set();
456
- this.subscribe = this.subscribe.bind(this);
457
- }
458
- subscribe(listener) {
459
- this.listeners.add(listener);
460
- this.onSubscribe();
461
- return () => {
462
- this.listeners.delete(listener);
463
- this.onUnsubscribe();
464
- };
465
- }
466
- hasListeners() {
467
- return this.listeners.size > 0;
468
- }
469
- onSubscribe() {
470
- }
471
- onUnsubscribe() {
472
- }
473
- };
474
-
475
- // node_modules/@tanstack/query-core/build/modern/focusManager.js
476
- var _focused, _cleanup, _setup, _a;
477
- var FocusManager = (_a = class extends Subscribable {
478
- constructor() {
479
- super();
480
- __privateAdd(this, _focused);
481
- __privateAdd(this, _cleanup);
482
- __privateAdd(this, _setup);
483
- __privateSet(this, _setup, (onFocus) => {
484
- if (typeof window !== "undefined" && window.addEventListener) {
485
- const listener = () => onFocus();
486
- window.addEventListener("visibilitychange", listener, false);
487
- return () => {
488
- window.removeEventListener("visibilitychange", listener);
489
- };
490
- }
491
- return;
492
- });
493
- }
494
- onSubscribe() {
495
- if (!__privateGet(this, _cleanup)) {
496
- this.setEventListener(__privateGet(this, _setup));
497
- }
498
- }
499
- onUnsubscribe() {
500
- var _a11;
501
- if (!this.hasListeners()) {
502
- (_a11 = __privateGet(this, _cleanup)) == null ? void 0 : _a11.call(this);
503
- __privateSet(this, _cleanup, void 0);
504
- }
505
- }
506
- setEventListener(setup) {
507
- var _a11;
508
- __privateSet(this, _setup, setup);
509
- (_a11 = __privateGet(this, _cleanup)) == null ? void 0 : _a11.call(this);
510
- __privateSet(this, _cleanup, setup((focused) => {
511
- if (typeof focused === "boolean") {
512
- this.setFocused(focused);
513
- } else {
514
- this.onFocus();
515
- }
516
- }));
517
- }
518
- setFocused(focused) {
519
- const changed = __privateGet(this, _focused) !== focused;
520
- if (changed) {
521
- __privateSet(this, _focused, focused);
522
- this.onFocus();
523
- }
524
- }
525
- onFocus() {
526
- const isFocused = this.isFocused();
527
- this.listeners.forEach((listener) => {
528
- listener(isFocused);
529
- });
530
- }
531
- isFocused() {
532
- if (typeof __privateGet(this, _focused) === "boolean") {
533
- return __privateGet(this, _focused);
534
- }
535
- return globalThis.document?.visibilityState !== "hidden";
536
- }
537
- }, _focused = new WeakMap(), _cleanup = new WeakMap(), _setup = new WeakMap(), _a);
538
- var focusManager = new FocusManager();
539
-
540
- // node_modules/@tanstack/query-core/build/modern/timeoutManager.js
541
- var defaultTimeoutProvider = {
542
- // We need the wrapper function syntax below instead of direct references to
543
- // global setTimeout etc.
544
- //
545
- // BAD: `setTimeout: setTimeout`
546
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
547
- //
548
- // If we use direct references here, then anything that wants to spy on or
549
- // replace the global setTimeout (like tests) won't work since we'll already
550
- // have a hard reference to the original implementation at the time when this
551
- // file was imported.
552
- setTimeout: (callback, delay) => setTimeout(callback, delay),
553
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
554
- setInterval: (callback, delay) => setInterval(callback, delay),
555
- clearInterval: (intervalId) => clearInterval(intervalId)
556
- };
557
- var _provider, _providerCalled, _a2;
558
- var TimeoutManager = (_a2 = class {
559
- constructor() {
560
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
561
- // type at app boot; and if we leave that type, then any new timer provider
562
- // would need to support the default provider's concrete timer ID, which is
563
- // infeasible across environments.
564
- //
565
- // We settle for type safety for the TimeoutProvider type, and accept that
566
- // this class is unsafe internally to allow for extension.
567
- __privateAdd(this, _provider, defaultTimeoutProvider);
568
- __privateAdd(this, _providerCalled, false);
569
- }
570
- setTimeoutProvider(provider) {
571
- if (true) {
572
- if (__privateGet(this, _providerCalled) && provider !== __privateGet(this, _provider)) {
573
- console.error(
574
- `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
575
- { previous: __privateGet(this, _provider), provider }
576
- );
577
- }
578
- }
579
- __privateSet(this, _provider, provider);
580
- if (true) {
581
- __privateSet(this, _providerCalled, false);
582
- }
583
- }
584
- setTimeout(callback, delay) {
585
- if (true) {
586
- __privateSet(this, _providerCalled, true);
587
- }
588
- return __privateGet(this, _provider).setTimeout(callback, delay);
589
- }
590
- clearTimeout(timeoutId) {
591
- __privateGet(this, _provider).clearTimeout(timeoutId);
592
- }
593
- setInterval(callback, delay) {
594
- if (true) {
595
- __privateSet(this, _providerCalled, true);
596
- }
597
- return __privateGet(this, _provider).setInterval(callback, delay);
598
- }
599
- clearInterval(intervalId) {
600
- __privateGet(this, _provider).clearInterval(intervalId);
601
- }
602
- }, _provider = new WeakMap(), _providerCalled = new WeakMap(), _a2);
603
- var timeoutManager = new TimeoutManager();
604
- function systemSetTimeoutZero(callback) {
605
- setTimeout(callback, 0);
606
- }
607
-
608
- // node_modules/@tanstack/query-core/build/modern/utils.js
609
- var isServer = typeof window === "undefined" || "Deno" in globalThis;
610
- function noop() {
611
- }
612
- function functionalUpdate(updater, input) {
613
- return typeof updater === "function" ? updater(input) : updater;
614
- }
615
- function isValidTimeout(value) {
616
- return typeof value === "number" && value >= 0 && value !== Infinity;
617
- }
618
- function timeUntilStale(updatedAt, staleTime) {
619
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
620
- }
621
- function resolveStaleTime(staleTime, query) {
622
- return typeof staleTime === "function" ? staleTime(query) : staleTime;
623
- }
624
- function resolveQueryBoolean(option, query) {
625
- return typeof option === "function" ? option(query) : option;
626
- }
627
- function matchQuery(filters, query) {
628
- const {
629
- type = "all",
630
- exact,
631
- fetchStatus,
632
- predicate,
633
- queryKey,
634
- stale
635
- } = filters;
636
- if (queryKey) {
637
- if (exact) {
638
- if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
639
- return false;
640
- }
641
- } else if (!partialMatchKey(query.queryKey, queryKey)) {
642
- return false;
643
- }
644
- }
645
- if (type !== "all") {
646
- const isActive = query.isActive();
647
- if (type === "active" && !isActive) {
648
- return false;
649
- }
650
- if (type === "inactive" && isActive) {
651
- return false;
652
- }
653
- }
654
- if (typeof stale === "boolean" && query.isStale() !== stale) {
655
- return false;
656
- }
657
- if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
658
- return false;
659
- }
660
- if (predicate && !predicate(query)) {
661
- return false;
662
- }
663
- return true;
664
- }
665
- function matchMutation(filters, mutation) {
666
- const { exact, status, predicate, mutationKey } = filters;
667
- if (mutationKey) {
668
- if (!mutation.options.mutationKey) {
669
- return false;
670
- }
671
- if (exact) {
672
- if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
673
- return false;
674
- }
675
- } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
676
- return false;
677
- }
678
- }
679
- if (status && mutation.state.status !== status) {
680
- return false;
681
- }
682
- if (predicate && !predicate(mutation)) {
683
- return false;
684
- }
685
- return true;
686
- }
687
- function hashQueryKeyByOptions(queryKey, options) {
688
- const hashFn = options?.queryKeyHashFn || hashKey;
689
- return hashFn(queryKey);
690
- }
691
- function hashKey(queryKey) {
692
- return JSON.stringify(
693
- queryKey,
694
- (_3, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
695
- result[key] = val[key];
696
- return result;
697
- }, {}) : val
698
- );
699
- }
700
- function partialMatchKey(a3, b) {
701
- if (a3 === b) {
702
- return true;
703
- }
704
- if (typeof a3 !== typeof b) {
705
- return false;
706
- }
707
- if (a3 && b && typeof a3 === "object" && typeof b === "object") {
708
- return Object.keys(b).every((key) => partialMatchKey(a3[key], b[key]));
709
- }
710
- return false;
711
- }
712
- var hasOwn = Object.prototype.hasOwnProperty;
713
- function replaceEqualDeep(a3, b, depth = 0) {
714
- if (a3 === b) {
715
- return a3;
716
- }
717
- if (depth > 500) return b;
718
- const array = isPlainArray(a3) && isPlainArray(b);
719
- if (!array && !(isPlainObject(a3) && isPlainObject(b))) return b;
720
- const aItems = array ? a3 : Object.keys(a3);
721
- const aSize = aItems.length;
722
- const bItems = array ? b : Object.keys(b);
723
- const bSize = bItems.length;
724
- const copy = array ? new Array(bSize) : {};
725
- let equalItems = 0;
726
- for (let i3 = 0; i3 < bSize; i3++) {
727
- const key = array ? i3 : bItems[i3];
728
- const aItem = a3[key];
729
- const bItem = b[key];
730
- if (aItem === bItem) {
731
- copy[key] = aItem;
732
- if (array ? i3 < aSize : hasOwn.call(a3, key)) equalItems++;
733
- continue;
734
- }
735
- if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
736
- copy[key] = bItem;
737
- continue;
738
- }
739
- const v3 = replaceEqualDeep(aItem, bItem, depth + 1);
740
- copy[key] = v3;
741
- if (v3 === aItem) equalItems++;
742
- }
743
- return aSize === bSize && equalItems === aSize ? a3 : copy;
744
- }
745
- function shallowEqualObjects(a3, b) {
746
- if (!b || Object.keys(a3).length !== Object.keys(b).length) {
747
- return false;
748
- }
749
- for (const key in a3) {
750
- if (a3[key] !== b[key]) {
751
- return false;
752
- }
753
- }
754
- return true;
755
- }
756
- function isPlainArray(value) {
757
- return Array.isArray(value) && value.length === Object.keys(value).length;
758
- }
759
- function isPlainObject(o3) {
760
- if (!hasObjectPrototype(o3)) {
761
- return false;
762
- }
763
- const ctor = o3.constructor;
764
- if (ctor === void 0) {
765
- return true;
766
- }
767
- const prot = ctor.prototype;
768
- if (!hasObjectPrototype(prot)) {
769
- return false;
770
- }
771
- if (!prot.hasOwnProperty("isPrototypeOf")) {
772
- return false;
773
- }
774
- if (Object.getPrototypeOf(o3) !== Object.prototype) {
775
- return false;
776
- }
777
- return true;
778
- }
779
- function hasObjectPrototype(o3) {
780
- return Object.prototype.toString.call(o3) === "[object Object]";
781
- }
782
- function sleep(timeout) {
783
- return new Promise((resolve) => {
784
- timeoutManager.setTimeout(resolve, timeout);
785
- });
786
- }
787
- function replaceData(prevData, data, options) {
788
- if (typeof options.structuralSharing === "function") {
789
- return options.structuralSharing(prevData, data);
790
- } else if (options.structuralSharing !== false) {
791
- if (true) {
792
- try {
793
- return replaceEqualDeep(prevData, data);
794
- } catch (error) {
795
- console.error(
796
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
797
- );
798
- throw error;
799
- }
800
- }
801
- return replaceEqualDeep(prevData, data);
802
- }
803
- return data;
804
- }
805
- function addToEnd(items, item, max = 0) {
806
- const newItems = [...items, item];
807
- return max && newItems.length > max ? newItems.slice(1) : newItems;
808
- }
809
- function addToStart(items, item, max = 0) {
810
- const newItems = [item, ...items];
811
- return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
812
- }
813
- var skipToken = /* @__PURE__ */ Symbol();
814
- function ensureQueryFn(options, fetchOptions) {
815
- if (true) {
816
- if (options.queryFn === skipToken) {
817
- console.error(
818
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
819
- );
820
- }
821
- }
822
- if (!options.queryFn && fetchOptions?.initialPromise) {
823
- return () => fetchOptions.initialPromise;
824
- }
825
- if (!options.queryFn || options.queryFn === skipToken) {
826
- return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
827
- }
828
- return options.queryFn;
829
- }
830
- function shouldThrowError(throwOnError, params) {
831
- if (typeof throwOnError === "function") {
832
- return throwOnError(...params);
833
- }
834
- return !!throwOnError;
835
- }
836
- function addConsumeAwareSignal(object, getSignal, onCancelled) {
837
- let consumed = false;
838
- let signal;
839
- Object.defineProperty(object, "signal", {
840
- enumerable: true,
841
- get: () => {
842
- signal ?? (signal = getSignal());
843
- if (consumed) {
844
- return signal;
845
- }
846
- consumed = true;
847
- if (signal.aborted) {
848
- onCancelled();
849
- } else {
850
- signal.addEventListener("abort", onCancelled, { once: true });
851
- }
852
- return signal;
853
- }
854
- });
855
- return object;
856
- }
857
-
858
- // node_modules/@tanstack/query-core/build/modern/environmentManager.js
859
- var environmentManager = /* @__PURE__ */ (() => {
860
- let isServerFn = () => isServer;
861
- return {
862
- /**
863
- * Returns whether the current runtime should be treated as a server environment.
864
- */
865
- isServer() {
866
- return isServerFn();
867
- },
868
- /**
869
- * Overrides the server check globally.
870
- */
871
- setIsServer(isServerValue) {
872
- isServerFn = isServerValue;
873
- }
874
- };
875
- })();
876
-
877
- // node_modules/@tanstack/query-core/build/modern/thenable.js
878
- function pendingThenable() {
879
- let resolve;
880
- let reject;
881
- const thenable = new Promise((_resolve, _reject) => {
882
- resolve = _resolve;
883
- reject = _reject;
884
- });
885
- thenable.status = "pending";
886
- thenable.catch(() => {
887
- });
888
- function finalize(data) {
889
- Object.assign(thenable, data);
890
- delete thenable.resolve;
891
- delete thenable.reject;
892
- }
893
- thenable.resolve = (value) => {
894
- finalize({
895
- status: "fulfilled",
896
- value
897
- });
898
- resolve(value);
899
- };
900
- thenable.reject = (reason) => {
901
- finalize({
902
- status: "rejected",
903
- reason
904
- });
905
- reject(reason);
906
- };
907
- return thenable;
908
- }
909
-
910
- // node_modules/@tanstack/query-core/build/modern/notifyManager.js
911
- var defaultScheduler = systemSetTimeoutZero;
912
- function createNotifyManager() {
913
- let queue = [];
914
- let transactions = 0;
915
- let notifyFn = (callback) => {
916
- callback();
917
- };
918
- let batchNotifyFn = (callback) => {
919
- callback();
920
- };
921
- let scheduleFn = defaultScheduler;
922
- const schedule = (callback) => {
923
- if (transactions) {
924
- queue.push(callback);
925
- } else {
926
- scheduleFn(() => {
927
- notifyFn(callback);
928
- });
929
- }
930
- };
931
- const flush = () => {
932
- const originalQueue = queue;
933
- queue = [];
934
- if (originalQueue.length) {
935
- scheduleFn(() => {
936
- batchNotifyFn(() => {
937
- originalQueue.forEach((callback) => {
938
- notifyFn(callback);
939
- });
940
- });
941
- });
942
- }
943
- };
944
- return {
945
- batch: (callback) => {
946
- let result;
947
- transactions++;
948
- try {
949
- result = callback();
950
- } finally {
951
- transactions--;
952
- if (!transactions) {
953
- flush();
954
- }
955
- }
956
- return result;
957
- },
958
- /**
959
- * All calls to the wrapped function will be batched.
960
- */
961
- batchCalls: (callback) => {
962
- return (...args) => {
963
- schedule(() => {
964
- callback(...args);
965
- });
966
- };
967
- },
968
- schedule,
969
- /**
970
- * Use this method to set a custom notify function.
971
- * This can be used to for example wrap notifications with `React.act` while running tests.
972
- */
973
- setNotifyFunction: (fn) => {
974
- notifyFn = fn;
975
- },
976
- /**
977
- * Use this method to set a custom function to batch notifications together into a single tick.
978
- * By default React Query will use the batch function provided by ReactDOM or React Native.
979
- */
980
- setBatchNotifyFunction: (fn) => {
981
- batchNotifyFn = fn;
982
- },
983
- setScheduler: (fn) => {
984
- scheduleFn = fn;
985
- }
986
- };
987
- }
988
- var notifyManager = createNotifyManager();
989
-
990
- // node_modules/@tanstack/query-core/build/modern/onlineManager.js
991
- var _online, _cleanup2, _setup2, _a3;
992
- var OnlineManager = (_a3 = class extends Subscribable {
993
- constructor() {
994
- super();
995
- __privateAdd(this, _online, true);
996
- __privateAdd(this, _cleanup2);
997
- __privateAdd(this, _setup2);
998
- __privateSet(this, _setup2, (onOnline) => {
999
- if (typeof window !== "undefined" && window.addEventListener) {
1000
- const onlineListener = () => onOnline(true);
1001
- const offlineListener = () => onOnline(false);
1002
- window.addEventListener("online", onlineListener, false);
1003
- window.addEventListener("offline", offlineListener, false);
1004
- return () => {
1005
- window.removeEventListener("online", onlineListener);
1006
- window.removeEventListener("offline", offlineListener);
1007
- };
1008
- }
1009
- return;
1010
- });
1011
- }
1012
- onSubscribe() {
1013
- if (!__privateGet(this, _cleanup2)) {
1014
- this.setEventListener(__privateGet(this, _setup2));
1015
- }
1016
- }
1017
- onUnsubscribe() {
1018
- var _a11;
1019
- if (!this.hasListeners()) {
1020
- (_a11 = __privateGet(this, _cleanup2)) == null ? void 0 : _a11.call(this);
1021
- __privateSet(this, _cleanup2, void 0);
1022
- }
1023
- }
1024
- setEventListener(setup) {
1025
- var _a11;
1026
- __privateSet(this, _setup2, setup);
1027
- (_a11 = __privateGet(this, _cleanup2)) == null ? void 0 : _a11.call(this);
1028
- __privateSet(this, _cleanup2, setup(this.setOnline.bind(this)));
1029
- }
1030
- setOnline(online) {
1031
- const changed = __privateGet(this, _online) !== online;
1032
- if (changed) {
1033
- __privateSet(this, _online, online);
1034
- this.listeners.forEach((listener) => {
1035
- listener(online);
1036
- });
1037
- }
1038
- }
1039
- isOnline() {
1040
- return __privateGet(this, _online);
1041
- }
1042
- }, _online = new WeakMap(), _cleanup2 = new WeakMap(), _setup2 = new WeakMap(), _a3);
1043
- var onlineManager = new OnlineManager();
1044
-
1045
- // node_modules/@tanstack/query-core/build/modern/retryer.js
1046
- function defaultRetryDelay(failureCount) {
1047
- return Math.min(1e3 * 2 ** failureCount, 3e4);
1048
- }
1049
- function canFetch(networkMode) {
1050
- return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
1051
- }
1052
- var CancelledError = class extends Error {
1053
- constructor(options) {
1054
- super("CancelledError");
1055
- this.revert = options?.revert;
1056
- this.silent = options?.silent;
1057
- }
1058
- };
1059
- function createRetryer(config) {
1060
- let isRetryCancelled = false;
1061
- let failureCount = 0;
1062
- let continueFn;
1063
- const thenable = pendingThenable();
1064
- const isResolved = () => thenable.status !== "pending";
1065
- const cancel = (cancelOptions) => {
1066
- if (!isResolved()) {
1067
- const error = new CancelledError(cancelOptions);
1068
- reject(error);
1069
- config.onCancel?.(error);
1070
- }
1071
- };
1072
- const cancelRetry = () => {
1073
- isRetryCancelled = true;
1074
- };
1075
- const continueRetry = () => {
1076
- isRetryCancelled = false;
1077
- };
1078
- const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
1079
- const canStart = () => canFetch(config.networkMode) && config.canRun();
1080
- const resolve = (value) => {
1081
- if (!isResolved()) {
1082
- continueFn?.();
1083
- thenable.resolve(value);
1084
- }
1085
- };
1086
- const reject = (value) => {
1087
- if (!isResolved()) {
1088
- continueFn?.();
1089
- thenable.reject(value);
1090
- }
1091
- };
1092
- const pause = () => {
1093
- return new Promise((continueResolve) => {
1094
- continueFn = (value) => {
1095
- if (isResolved() || canContinue()) {
1096
- continueResolve(value);
1097
- }
1098
- };
1099
- config.onPause?.();
1100
- }).then(() => {
1101
- continueFn = void 0;
1102
- if (!isResolved()) {
1103
- config.onContinue?.();
1104
- }
1105
- });
1106
- };
1107
- const run = () => {
1108
- if (isResolved()) {
1109
- return;
1110
- }
1111
- let promiseOrValue;
1112
- const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
1113
- try {
1114
- promiseOrValue = initialPromise ?? config.fn();
1115
- } catch (error) {
1116
- promiseOrValue = Promise.reject(error);
1117
- }
1118
- Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
1119
- if (isResolved()) {
1120
- return;
1121
- }
1122
- const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3);
1123
- const retryDelay = config.retryDelay ?? defaultRetryDelay;
1124
- const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
1125
- const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
1126
- if (isRetryCancelled || !shouldRetry) {
1127
- reject(error);
1128
- return;
1129
- }
1130
- failureCount++;
1131
- config.onFail?.(failureCount, error);
1132
- sleep(delay).then(() => {
1133
- return canContinue() ? void 0 : pause();
1134
- }).then(() => {
1135
- if (isRetryCancelled) {
1136
- reject(error);
1137
- } else {
1138
- run();
1139
- }
1140
- });
1141
- });
1142
- };
1143
- return {
1144
- promise: thenable,
1145
- status: () => thenable.status,
1146
- cancel,
1147
- continue: () => {
1148
- continueFn?.();
1149
- return thenable;
1150
- },
1151
- cancelRetry,
1152
- continueRetry,
1153
- canStart,
1154
- start: () => {
1155
- if (canStart()) {
1156
- run();
1157
- } else {
1158
- pause().then(run);
1159
- }
1160
- return thenable;
1161
- }
1162
- };
1163
- }
1164
-
1165
- // node_modules/@tanstack/query-core/build/modern/removable.js
1166
- var _gcTimeout, _a4;
1167
- var Removable = (_a4 = class {
1168
- constructor() {
1169
- __privateAdd(this, _gcTimeout);
1170
- }
1171
- destroy() {
1172
- this.clearGcTimeout();
1173
- }
1174
- scheduleGc() {
1175
- this.clearGcTimeout();
1176
- if (isValidTimeout(this.gcTime)) {
1177
- __privateSet(this, _gcTimeout, timeoutManager.setTimeout(() => {
1178
- this.optionalRemove();
1179
- }, this.gcTime));
1180
- }
1181
- }
1182
- updateGcTime(newGcTime) {
1183
- this.gcTime = Math.max(
1184
- this.gcTime || 0,
1185
- newGcTime ?? (environmentManager.isServer() ? Infinity : 5 * 60 * 1e3)
1186
- );
1187
- }
1188
- clearGcTimeout() {
1189
- if (__privateGet(this, _gcTimeout) !== void 0) {
1190
- timeoutManager.clearTimeout(__privateGet(this, _gcTimeout));
1191
- __privateSet(this, _gcTimeout, void 0);
1192
- }
1193
- }
1194
- }, _gcTimeout = new WeakMap(), _a4);
1195
-
1196
- // node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
1197
- function infiniteQueryBehavior(pages) {
1198
- return {
1199
- onFetch: (context, query) => {
1200
- const options = context.options;
1201
- const direction = context.fetchOptions?.meta?.fetchMore?.direction;
1202
- const oldPages = context.state.data?.pages || [];
1203
- const oldPageParams = context.state.data?.pageParams || [];
1204
- let result = { pages: [], pageParams: [] };
1205
- let currentPage = 0;
1206
- const fetchFn = async () => {
1207
- let cancelled = false;
1208
- const addSignalProperty = (object) => {
1209
- addConsumeAwareSignal(
1210
- object,
1211
- () => context.signal,
1212
- () => cancelled = true
1213
- );
1214
- };
1215
- const queryFn = ensureQueryFn(context.options, context.fetchOptions);
1216
- const fetchPage = async (data, param, previous) => {
1217
- if (cancelled) {
1218
- return Promise.reject(context.signal.reason);
1219
- }
1220
- if (param == null && data.pages.length) {
1221
- return Promise.resolve(data);
1222
- }
1223
- const createQueryFnContext = () => {
1224
- const queryFnContext2 = {
1225
- client: context.client,
1226
- queryKey: context.queryKey,
1227
- pageParam: param,
1228
- direction: previous ? "backward" : "forward",
1229
- meta: context.options.meta
1230
- };
1231
- addSignalProperty(queryFnContext2);
1232
- return queryFnContext2;
1233
- };
1234
- const queryFnContext = createQueryFnContext();
1235
- const page = await queryFn(queryFnContext);
1236
- const { maxPages } = context.options;
1237
- const addTo = previous ? addToStart : addToEnd;
1238
- return {
1239
- pages: addTo(data.pages, page, maxPages),
1240
- pageParams: addTo(data.pageParams, param, maxPages)
1241
- };
1242
- };
1243
- if (direction && oldPages.length) {
1244
- const previous = direction === "backward";
1245
- const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
1246
- const oldData = {
1247
- pages: oldPages,
1248
- pageParams: oldPageParams
1249
- };
1250
- const param = pageParamFn(options, oldData);
1251
- result = await fetchPage(oldData, param, previous);
1252
- } else {
1253
- const remainingPages = pages ?? oldPages.length;
1254
- do {
1255
- const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
1256
- if (currentPage > 0 && param == null) {
1257
- break;
1258
- }
1259
- result = await fetchPage(result, param);
1260
- currentPage++;
1261
- } while (currentPage < remainingPages);
1262
- }
1263
- return result;
1264
- };
1265
- if (context.options.persister) {
1266
- context.fetchFn = () => {
1267
- return context.options.persister?.(
1268
- fetchFn,
1269
- {
1270
- client: context.client,
1271
- queryKey: context.queryKey,
1272
- meta: context.options.meta,
1273
- signal: context.signal
1274
- },
1275
- query
1276
- );
1277
- };
1278
- } else {
1279
- context.fetchFn = fetchFn;
1280
- }
1281
- }
1282
- };
1283
- }
1284
- function getNextPageParam(options, { pages, pageParams }) {
1285
- const lastIndex = pages.length - 1;
1286
- return pages.length > 0 ? options.getNextPageParam(
1287
- pages[lastIndex],
1288
- pages,
1289
- pageParams[lastIndex],
1290
- pageParams
1291
- ) : void 0;
1292
- }
1293
- function getPreviousPageParam(options, { pages, pageParams }) {
1294
- return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
1295
- }
1296
-
1297
- // node_modules/@tanstack/query-core/build/modern/query.js
1298
- var _queryType, _initialState, _revertState, _cache, _client, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, isInitialPausedFetch_fn, dispatch_fn, _a5;
1299
- var Query = (_a5 = class extends Removable {
1300
- constructor(config) {
1301
- super();
1302
- __privateAdd(this, _Query_instances);
1303
- __privateAdd(this, _queryType);
1304
- __privateAdd(this, _initialState);
1305
- __privateAdd(this, _revertState);
1306
- __privateAdd(this, _cache);
1307
- __privateAdd(this, _client);
1308
- __privateAdd(this, _retryer);
1309
- __privateAdd(this, _defaultOptions);
1310
- __privateAdd(this, _abortSignalConsumed);
1311
- __privateSet(this, _abortSignalConsumed, false);
1312
- __privateSet(this, _defaultOptions, config.defaultOptions);
1313
- this.setOptions(config.options);
1314
- this.observers = [];
1315
- __privateSet(this, _client, config.client);
1316
- __privateSet(this, _cache, __privateGet(this, _client).getQueryCache());
1317
- this.queryKey = config.queryKey;
1318
- this.queryHash = config.queryHash;
1319
- __privateSet(this, _initialState, getDefaultState(this.options));
1320
- this.state = config.state ?? __privateGet(this, _initialState);
1321
- this.scheduleGc();
1322
- }
1323
- get meta() {
1324
- return this.options.meta;
1325
- }
1326
- get queryType() {
1327
- return __privateGet(this, _queryType);
1328
- }
1329
- get promise() {
1330
- return __privateGet(this, _retryer)?.promise;
1331
- }
1332
- setOptions(options) {
1333
- this.options = { ...__privateGet(this, _defaultOptions), ...options };
1334
- if (options?._type) {
1335
- __privateSet(this, _queryType, options._type);
1336
- }
1337
- this.updateGcTime(this.options.gcTime);
1338
- if (this.state && this.state.data === void 0) {
1339
- const defaultState = getDefaultState(this.options);
1340
- if (defaultState.data !== void 0) {
1341
- this.setState(
1342
- successState(defaultState.data, defaultState.dataUpdatedAt)
1343
- );
1344
- __privateSet(this, _initialState, defaultState);
1345
- }
1346
- }
1347
- }
1348
- optionalRemove() {
1349
- if (!this.observers.length && this.state.fetchStatus === "idle") {
1350
- __privateGet(this, _cache).remove(this);
1351
- }
1352
- }
1353
- setData(newData, options) {
1354
- const data = replaceData(this.state.data, newData, this.options);
1355
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, {
1356
- data,
1357
- type: "success",
1358
- dataUpdatedAt: options?.updatedAt,
1359
- manual: options?.manual
1360
- });
1361
- return data;
1362
- }
1363
- setState(state) {
1364
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "setState", state });
1365
- }
1366
- cancel(options) {
1367
- const promise = __privateGet(this, _retryer)?.promise;
1368
- __privateGet(this, _retryer)?.cancel(options);
1369
- return promise ? promise.then(noop).catch(noop) : Promise.resolve();
1370
- }
1371
- destroy() {
1372
- super.destroy();
1373
- this.cancel({ silent: true });
1374
- }
1375
- get resetState() {
1376
- return __privateGet(this, _initialState);
1377
- }
1378
- reset() {
1379
- this.destroy();
1380
- this.setState(this.resetState);
1381
- }
1382
- isActive() {
1383
- return this.observers.some(
1384
- (observer) => resolveQueryBoolean(observer.options.enabled, this) !== false
1385
- );
1386
- }
1387
- isDisabled() {
1388
- if (this.getObserversCount() > 0) {
1389
- return !this.isActive();
1390
- }
1391
- return this.options.queryFn === skipToken || !this.isFetched();
1392
- }
1393
- isFetched() {
1394
- return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
1395
- }
1396
- isStatic() {
1397
- if (this.getObserversCount() > 0) {
1398
- return this.observers.some(
1399
- (observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
1400
- );
1401
- }
1402
- return false;
1403
- }
1404
- isStale() {
1405
- if (this.getObserversCount() > 0) {
1406
- return this.observers.some(
1407
- (observer) => observer.getCurrentResult().isStale
1408
- );
1409
- }
1410
- return this.state.data === void 0 || this.state.isInvalidated;
1411
- }
1412
- isStaleByTime(staleTime = 0) {
1413
- if (this.state.data === void 0) {
1414
- return true;
1415
- }
1416
- if (staleTime === "static") {
1417
- return false;
1418
- }
1419
- if (this.state.isInvalidated) {
1420
- return true;
1421
- }
1422
- return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
1423
- }
1424
- onFocus() {
1425
- const observer = this.observers.find((x3) => x3.shouldFetchOnWindowFocus());
1426
- observer?.refetch({ cancelRefetch: false });
1427
- __privateGet(this, _retryer)?.continue();
1428
- }
1429
- onOnline() {
1430
- const observer = this.observers.find((x3) => x3.shouldFetchOnReconnect());
1431
- observer?.refetch({ cancelRefetch: false });
1432
- __privateGet(this, _retryer)?.continue();
1433
- }
1434
- addObserver(observer) {
1435
- if (!this.observers.includes(observer)) {
1436
- this.observers.push(observer);
1437
- this.clearGcTimeout();
1438
- __privateGet(this, _cache).notify({ type: "observerAdded", query: this, observer });
1439
- }
1440
- }
1441
- removeObserver(observer) {
1442
- if (this.observers.includes(observer)) {
1443
- this.observers = this.observers.filter((x3) => x3 !== observer);
1444
- if (!this.observers.length) {
1445
- if (__privateGet(this, _retryer)) {
1446
- if (__privateGet(this, _abortSignalConsumed) || __privateMethod(this, _Query_instances, isInitialPausedFetch_fn).call(this)) {
1447
- __privateGet(this, _retryer).cancel({ revert: true });
1448
- } else {
1449
- __privateGet(this, _retryer).cancelRetry();
1450
- }
1451
- }
1452
- this.scheduleGc();
1453
- }
1454
- __privateGet(this, _cache).notify({ type: "observerRemoved", query: this, observer });
1455
- }
1456
- }
1457
- getObserversCount() {
1458
- return this.observers.length;
1459
- }
1460
- invalidate() {
1461
- if (!this.state.isInvalidated) {
1462
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "invalidate" });
1463
- }
1464
- }
1465
- async fetch(options, fetchOptions) {
1466
- if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
1467
- // re-start the fetch; there is a chance that the query is still in a
1468
- // pending state when that happens
1469
- __privateGet(this, _retryer)?.status() !== "rejected") {
1470
- if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
1471
- this.cancel({ silent: true });
1472
- } else if (__privateGet(this, _retryer)) {
1473
- __privateGet(this, _retryer).continueRetry();
1474
- return __privateGet(this, _retryer).promise;
1475
- }
1476
- }
1477
- if (options) {
1478
- this.setOptions(options);
1479
- }
1480
- if (!this.options.queryFn) {
1481
- const observer = this.observers.find((x3) => x3.options.queryFn);
1482
- if (observer) {
1483
- this.setOptions(observer.options);
1484
- }
1485
- }
1486
- if (true) {
1487
- if (!Array.isArray(this.options.queryKey)) {
1488
- console.error(
1489
- `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
1490
- );
1491
- }
1492
- }
1493
- const abortController = new AbortController();
1494
- const addSignalProperty = (object) => {
1495
- Object.defineProperty(object, "signal", {
1496
- enumerable: true,
1497
- get: () => {
1498
- __privateSet(this, _abortSignalConsumed, true);
1499
- return abortController.signal;
1500
- }
1501
- });
1502
- };
1503
- const fetchFn = () => {
1504
- const queryFn = ensureQueryFn(this.options, fetchOptions);
1505
- const createQueryFnContext = () => {
1506
- const queryFnContext2 = {
1507
- client: __privateGet(this, _client),
1508
- queryKey: this.queryKey,
1509
- meta: this.meta
1510
- };
1511
- addSignalProperty(queryFnContext2);
1512
- return queryFnContext2;
1513
- };
1514
- const queryFnContext = createQueryFnContext();
1515
- __privateSet(this, _abortSignalConsumed, false);
1516
- if (this.options.persister) {
1517
- return this.options.persister(
1518
- queryFn,
1519
- queryFnContext,
1520
- this
1521
- );
1522
- }
1523
- return queryFn(queryFnContext);
1524
- };
1525
- const createFetchContext = () => {
1526
- const context2 = {
1527
- fetchOptions,
1528
- options: this.options,
1529
- queryKey: this.queryKey,
1530
- client: __privateGet(this, _client),
1531
- state: this.state,
1532
- fetchFn
1533
- };
1534
- addSignalProperty(context2);
1535
- return context2;
1536
- };
1537
- const context = createFetchContext();
1538
- const behavior = __privateGet(this, _queryType) === "infinite" ? infiniteQueryBehavior(
1539
- this.options.pages
1540
- ) : this.options.behavior;
1541
- behavior?.onFetch(context, this);
1542
- __privateSet(this, _revertState, this.state);
1543
- if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
1544
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "fetch", meta: context.fetchOptions?.meta });
1545
- }
1546
- __privateSet(this, _retryer, createRetryer({
1547
- initialPromise: fetchOptions?.initialPromise,
1548
- fn: context.fetchFn,
1549
- onCancel: (error) => {
1550
- if (error instanceof CancelledError && error.revert) {
1551
- this.setState({
1552
- ...__privateGet(this, _revertState),
1553
- fetchStatus: "idle"
1554
- });
1555
- }
1556
- abortController.abort();
1557
- },
1558
- onFail: (failureCount, error) => {
1559
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "failed", failureCount, error });
1560
- },
1561
- onPause: () => {
1562
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "pause" });
1563
- },
1564
- onContinue: () => {
1565
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "continue" });
1566
- },
1567
- retry: context.options.retry,
1568
- retryDelay: context.options.retryDelay,
1569
- networkMode: context.options.networkMode,
1570
- canRun: () => true
1571
- }));
1572
- try {
1573
- const data = await __privateGet(this, _retryer).start();
1574
- if (data === void 0) {
1575
- if (true) {
1576
- console.error(
1577
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
1578
- );
1579
- }
1580
- throw new Error(`${this.queryHash} data is undefined`);
1581
- }
1582
- this.setData(data);
1583
- __privateGet(this, _cache).config.onSuccess?.(data, this);
1584
- __privateGet(this, _cache).config.onSettled?.(
1585
- data,
1586
- this.state.error,
1587
- this
1588
- );
1589
- return data;
1590
- } catch (error) {
1591
- if (error instanceof CancelledError) {
1592
- if (error.silent) {
1593
- return __privateGet(this, _retryer).promise;
1594
- } else if (error.revert) {
1595
- if (this.state.data === void 0) {
1596
- throw error;
1597
- }
1598
- return this.state.data;
1599
- }
1600
- }
1601
- __privateMethod(this, _Query_instances, dispatch_fn).call(this, {
1602
- type: "error",
1603
- error
1604
- });
1605
- __privateGet(this, _cache).config.onError?.(
1606
- error,
1607
- this
1608
- );
1609
- __privateGet(this, _cache).config.onSettled?.(
1610
- this.state.data,
1611
- error,
1612
- this
1613
- );
1614
- throw error;
1615
- } finally {
1616
- this.scheduleGc();
1617
- }
1618
- }
1619
- }, _queryType = new WeakMap(), _initialState = new WeakMap(), _revertState = new WeakMap(), _cache = new WeakMap(), _client = new WeakMap(), _retryer = new WeakMap(), _defaultOptions = new WeakMap(), _abortSignalConsumed = new WeakMap(), _Query_instances = new WeakSet(), isInitialPausedFetch_fn = function() {
1620
- return this.state.fetchStatus === "paused" && this.state.status === "pending";
1621
- }, dispatch_fn = function(action) {
1622
- const reducer = (state) => {
1623
- switch (action.type) {
1624
- case "failed":
1625
- return {
1626
- ...state,
1627
- fetchFailureCount: action.failureCount,
1628
- fetchFailureReason: action.error
1629
- };
1630
- case "pause":
1631
- return {
1632
- ...state,
1633
- fetchStatus: "paused"
1634
- };
1635
- case "continue":
1636
- return {
1637
- ...state,
1638
- fetchStatus: "fetching"
1639
- };
1640
- case "fetch":
1641
- return {
1642
- ...state,
1643
- ...fetchState(state.data, this.options),
1644
- fetchMeta: action.meta ?? null
1645
- };
1646
- case "success":
1647
- const newState = {
1648
- ...state,
1649
- ...successState(action.data, action.dataUpdatedAt),
1650
- dataUpdateCount: state.dataUpdateCount + 1,
1651
- ...!action.manual && {
1652
- fetchStatus: "idle",
1653
- fetchFailureCount: 0,
1654
- fetchFailureReason: null
1655
- }
1656
- };
1657
- __privateSet(this, _revertState, action.manual ? newState : void 0);
1658
- return newState;
1659
- case "error":
1660
- const error = action.error;
1661
- return {
1662
- ...state,
1663
- error,
1664
- errorUpdateCount: state.errorUpdateCount + 1,
1665
- errorUpdatedAt: Date.now(),
1666
- fetchFailureCount: state.fetchFailureCount + 1,
1667
- fetchFailureReason: error,
1668
- fetchStatus: "idle",
1669
- status: "error",
1670
- // flag existing data as invalidated if we get a background error
1671
- // note that "no data" always means stale so we can set unconditionally here
1672
- isInvalidated: true
1673
- };
1674
- case "invalidate":
1675
- return {
1676
- ...state,
1677
- isInvalidated: true
1678
- };
1679
- case "setState":
1680
- return {
1681
- ...state,
1682
- ...action.state
1683
- };
1684
- }
1685
- };
1686
- this.state = reducer(this.state);
1687
- notifyManager.batch(() => {
1688
- this.observers.forEach((observer) => {
1689
- observer.onQueryUpdate();
1690
- });
1691
- __privateGet(this, _cache).notify({ query: this, type: "updated", action });
1692
- });
1693
- }, _a5);
1694
- function fetchState(data, options) {
1695
- return {
1696
- fetchFailureCount: 0,
1697
- fetchFailureReason: null,
1698
- fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
1699
- ...data === void 0 && {
1700
- error: null,
1701
- status: "pending"
1702
- }
1703
- };
1704
- }
1705
- function successState(data, dataUpdatedAt) {
1706
- return {
1707
- data,
1708
- dataUpdatedAt: dataUpdatedAt ?? Date.now(),
1709
- error: null,
1710
- isInvalidated: false,
1711
- status: "success"
1712
- };
1713
- }
1714
- function getDefaultState(options) {
1715
- const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
1716
- const hasData = data !== void 0;
1717
- const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
1718
- return {
1719
- data,
1720
- dataUpdateCount: 0,
1721
- dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
1722
- error: null,
1723
- errorUpdateCount: 0,
1724
- errorUpdatedAt: 0,
1725
- fetchFailureCount: 0,
1726
- fetchFailureReason: null,
1727
- fetchMeta: null,
1728
- isInvalidated: false,
1729
- status: hasData ? "success" : "pending",
1730
- fetchStatus: "idle"
1731
- };
1732
- }
1733
-
1734
- // node_modules/@tanstack/query-core/build/modern/queryObserver.js
1735
- var _client2, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _currentThenable, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _QueryObserver_instances, executeFetch_fn, updateStaleTimeout_fn, computeRefetchInterval_fn, updateRefetchInterval_fn, updateTimers_fn, clearStaleTimeout_fn, clearRefetchInterval_fn, updateQuery_fn, notify_fn, _a6;
1736
- var QueryObserver = (_a6 = class extends Subscribable {
1737
- constructor(client, options) {
1738
- super();
1739
- __privateAdd(this, _QueryObserver_instances);
1740
- __privateAdd(this, _client2);
1741
- __privateAdd(this, _currentQuery);
1742
- __privateAdd(this, _currentQueryInitialState);
1743
- __privateAdd(this, _currentResult);
1744
- __privateAdd(this, _currentResultState);
1745
- __privateAdd(this, _currentResultOptions);
1746
- __privateAdd(this, _currentThenable);
1747
- __privateAdd(this, _selectError);
1748
- __privateAdd(this, _selectFn);
1749
- __privateAdd(this, _selectResult);
1750
- // This property keeps track of the last query with defined data.
1751
- // It will be used to pass the previous data and query to the placeholder function between renders.
1752
- __privateAdd(this, _lastQueryWithDefinedData);
1753
- __privateAdd(this, _staleTimeoutId);
1754
- __privateAdd(this, _refetchIntervalId);
1755
- __privateAdd(this, _currentRefetchInterval);
1756
- __privateAdd(this, _trackedProps, /* @__PURE__ */ new Set());
1757
- this.options = options;
1758
- __privateSet(this, _client2, client);
1759
- __privateSet(this, _selectError, null);
1760
- __privateSet(this, _currentThenable, pendingThenable());
1761
- this.bindMethods();
1762
- this.setOptions(options);
1763
- }
1764
- bindMethods() {
1765
- this.refetch = this.refetch.bind(this);
1766
- }
1767
- onSubscribe() {
1768
- if (this.listeners.size === 1) {
1769
- __privateGet(this, _currentQuery).addObserver(this);
1770
- if (shouldFetchOnMount(__privateGet(this, _currentQuery), this.options)) {
1771
- __privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
1772
- } else {
1773
- this.updateResult();
1774
- }
1775
- __privateMethod(this, _QueryObserver_instances, updateTimers_fn).call(this);
1776
- }
1777
- }
1778
- onUnsubscribe() {
1779
- if (!this.hasListeners()) {
1780
- this.destroy();
1781
- }
1782
- }
1783
- shouldFetchOnReconnect() {
1784
- return shouldFetchOn(
1785
- __privateGet(this, _currentQuery),
1786
- this.options,
1787
- this.options.refetchOnReconnect
1788
- );
1789
- }
1790
- shouldFetchOnWindowFocus() {
1791
- return shouldFetchOn(
1792
- __privateGet(this, _currentQuery),
1793
- this.options,
1794
- this.options.refetchOnWindowFocus
1795
- );
1796
- }
1797
- destroy() {
1798
- this.listeners = /* @__PURE__ */ new Set();
1799
- __privateMethod(this, _QueryObserver_instances, clearStaleTimeout_fn).call(this);
1800
- __privateMethod(this, _QueryObserver_instances, clearRefetchInterval_fn).call(this);
1801
- __privateGet(this, _currentQuery).removeObserver(this);
1802
- }
1803
- setOptions(options) {
1804
- const prevOptions = this.options;
1805
- const prevQuery = __privateGet(this, _currentQuery);
1806
- this.options = __privateGet(this, _client2).defaultQueryOptions(options);
1807
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) !== "boolean") {
1808
- throw new Error(
1809
- "Expected enabled to be a boolean or a callback that returns a boolean"
1810
- );
1811
- }
1812
- __privateMethod(this, _QueryObserver_instances, updateQuery_fn).call(this);
1813
- __privateGet(this, _currentQuery).setOptions(this.options);
1814
- if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
1815
- __privateGet(this, _client2).getQueryCache().notify({
1816
- type: "observerOptionsUpdated",
1817
- query: __privateGet(this, _currentQuery),
1818
- observer: this
1819
- });
1820
- }
1821
- const mounted = this.hasListeners();
1822
- if (mounted && shouldFetchOptionally(
1823
- __privateGet(this, _currentQuery),
1824
- prevQuery,
1825
- this.options,
1826
- prevOptions
1827
- )) {
1828
- __privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
1829
- }
1830
- this.updateResult();
1831
- if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) !== resolveQueryBoolean(prevOptions.enabled, __privateGet(this, _currentQuery)) || resolveStaleTime(this.options.staleTime, __privateGet(this, _currentQuery)) !== resolveStaleTime(prevOptions.staleTime, __privateGet(this, _currentQuery)))) {
1832
- __privateMethod(this, _QueryObserver_instances, updateStaleTimeout_fn).call(this);
1833
- }
1834
- const nextRefetchInterval = __privateMethod(this, _QueryObserver_instances, computeRefetchInterval_fn).call(this);
1835
- if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) !== resolveQueryBoolean(prevOptions.enabled, __privateGet(this, _currentQuery)) || nextRefetchInterval !== __privateGet(this, _currentRefetchInterval))) {
1836
- __privateMethod(this, _QueryObserver_instances, updateRefetchInterval_fn).call(this, nextRefetchInterval);
1837
- }
1838
- }
1839
- getOptimisticResult(options) {
1840
- const query = __privateGet(this, _client2).getQueryCache().build(__privateGet(this, _client2), options);
1841
- const result = this.createResult(query, options);
1842
- if (shouldAssignObserverCurrentProperties(this, result)) {
1843
- __privateSet(this, _currentResult, result);
1844
- __privateSet(this, _currentResultOptions, this.options);
1845
- __privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
1846
- }
1847
- return result;
1848
- }
1849
- getCurrentResult() {
1850
- return __privateGet(this, _currentResult);
1851
- }
1852
- trackResult(result, onPropTracked) {
1853
- return new Proxy(result, {
1854
- get: (target, key) => {
1855
- this.trackProp(key);
1856
- onPropTracked?.(key);
1857
- if (key === "promise") {
1858
- this.trackProp("data");
1859
- if (!this.options.experimental_prefetchInRender && __privateGet(this, _currentThenable).status === "pending") {
1860
- __privateGet(this, _currentThenable).reject(
1861
- new Error(
1862
- "experimental_prefetchInRender feature flag is not enabled"
1863
- )
1864
- );
1865
- }
1866
- }
1867
- return Reflect.get(target, key);
1868
- }
1869
- });
1870
- }
1871
- trackProp(key) {
1872
- __privateGet(this, _trackedProps).add(key);
1873
- }
1874
- getCurrentQuery() {
1875
- return __privateGet(this, _currentQuery);
1876
- }
1877
- refetch({ ...options } = {}) {
1878
- return this.fetch({
1879
- ...options
1880
- });
1881
- }
1882
- fetchOptimistic(options) {
1883
- const defaultedOptions = __privateGet(this, _client2).defaultQueryOptions(options);
1884
- const query = __privateGet(this, _client2).getQueryCache().build(__privateGet(this, _client2), defaultedOptions);
1885
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
1886
- }
1887
- fetch(fetchOptions) {
1888
- return __privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this, {
1889
- ...fetchOptions,
1890
- cancelRefetch: fetchOptions.cancelRefetch ?? true
1891
- }).then(() => {
1892
- this.updateResult();
1893
- return __privateGet(this, _currentResult);
1894
- });
1895
- }
1896
- createResult(query, options) {
1897
- const prevQuery = __privateGet(this, _currentQuery);
1898
- const prevOptions = this.options;
1899
- const prevResult = __privateGet(this, _currentResult);
1900
- const prevResultState = __privateGet(this, _currentResultState);
1901
- const prevResultOptions = __privateGet(this, _currentResultOptions);
1902
- const queryChange = query !== prevQuery;
1903
- const queryInitialState = queryChange ? query.state : __privateGet(this, _currentQueryInitialState);
1904
- const { state } = query;
1905
- let newState = { ...state };
1906
- let isPlaceholderData = false;
1907
- let data;
1908
- if (options._optimisticResults) {
1909
- const mounted = this.hasListeners();
1910
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
1911
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
1912
- if (fetchOnMount || fetchOptionally) {
1913
- newState = {
1914
- ...newState,
1915
- ...fetchState(state.data, query.options)
1916
- };
1917
- }
1918
- if (options._optimisticResults === "isRestoring") {
1919
- newState.fetchStatus = "idle";
1920
- }
1921
- }
1922
- let { error, errorUpdatedAt, status } = newState;
1923
- data = newState.data;
1924
- let skipSelect = false;
1925
- if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
1926
- let placeholderData;
1927
- if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
1928
- placeholderData = prevResult.data;
1929
- skipSelect = true;
1930
- } else {
1931
- placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
1932
- __privateGet(this, _lastQueryWithDefinedData)?.state.data,
1933
- __privateGet(this, _lastQueryWithDefinedData)
1934
- ) : options.placeholderData;
1935
- }
1936
- if (placeholderData !== void 0) {
1937
- status = "success";
1938
- data = replaceData(
1939
- prevResult?.data,
1940
- placeholderData,
1941
- options
1942
- );
1943
- isPlaceholderData = true;
1944
- }
1945
- }
1946
- if (options.select && data !== void 0 && !skipSelect) {
1947
- if (prevResult && data === prevResultState?.data && options.select === __privateGet(this, _selectFn)) {
1948
- data = __privateGet(this, _selectResult);
1949
- } else {
1950
- try {
1951
- __privateSet(this, _selectFn, options.select);
1952
- data = options.select(data);
1953
- data = replaceData(prevResult?.data, data, options);
1954
- __privateSet(this, _selectResult, data);
1955
- __privateSet(this, _selectError, null);
1956
- } catch (selectError) {
1957
- __privateSet(this, _selectError, selectError);
1958
- }
1959
- }
1960
- }
1961
- if (__privateGet(this, _selectError)) {
1962
- error = __privateGet(this, _selectError);
1963
- data = __privateGet(this, _selectResult);
1964
- errorUpdatedAt = Date.now();
1965
- status = "error";
1966
- }
1967
- const isFetching = newState.fetchStatus === "fetching";
1968
- const isPending = status === "pending";
1969
- const isError = status === "error";
1970
- const isLoading = isPending && isFetching;
1971
- const hasData = data !== void 0;
1972
- const result = {
1973
- status,
1974
- fetchStatus: newState.fetchStatus,
1975
- isPending,
1976
- isSuccess: status === "success",
1977
- isError,
1978
- isInitialLoading: isLoading,
1979
- isLoading,
1980
- data,
1981
- dataUpdatedAt: newState.dataUpdatedAt,
1982
- error,
1983
- errorUpdatedAt,
1984
- failureCount: newState.fetchFailureCount,
1985
- failureReason: newState.fetchFailureReason,
1986
- errorUpdateCount: newState.errorUpdateCount,
1987
- isFetched: query.isFetched(),
1988
- isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
1989
- isFetching,
1990
- isRefetching: isFetching && !isPending,
1991
- isLoadingError: isError && !hasData,
1992
- isPaused: newState.fetchStatus === "paused",
1993
- isPlaceholderData,
1994
- isRefetchError: isError && hasData,
1995
- isStale: isStale(query, options),
1996
- refetch: this.refetch,
1997
- promise: __privateGet(this, _currentThenable),
1998
- isEnabled: resolveQueryBoolean(options.enabled, query) !== false
1999
- };
2000
- const nextResult = result;
2001
- if (this.options.experimental_prefetchInRender) {
2002
- const hasResultData = nextResult.data !== void 0;
2003
- const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
2004
- const finalizeThenableIfPossible = (thenable) => {
2005
- if (isErrorWithoutData) {
2006
- thenable.reject(nextResult.error);
2007
- } else if (hasResultData) {
2008
- thenable.resolve(nextResult.data);
2009
- }
2010
- };
2011
- const recreateThenable = () => {
2012
- const pending = __privateSet(this, _currentThenable, nextResult.promise = pendingThenable());
2013
- finalizeThenableIfPossible(pending);
2014
- };
2015
- const prevThenable = __privateGet(this, _currentThenable);
2016
- switch (prevThenable.status) {
2017
- case "pending":
2018
- if (query.queryHash === prevQuery.queryHash) {
2019
- finalizeThenableIfPossible(prevThenable);
2020
- }
2021
- break;
2022
- case "fulfilled":
2023
- if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
2024
- recreateThenable();
2025
- }
2026
- break;
2027
- case "rejected":
2028
- if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
2029
- recreateThenable();
2030
- }
2031
- break;
2032
- }
2033
- }
2034
- return nextResult;
2035
- }
2036
- updateResult() {
2037
- const prevResult = __privateGet(this, _currentResult);
2038
- const nextResult = this.createResult(__privateGet(this, _currentQuery), this.options);
2039
- __privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
2040
- __privateSet(this, _currentResultOptions, this.options);
2041
- if (__privateGet(this, _currentResultState).data !== void 0) {
2042
- __privateSet(this, _lastQueryWithDefinedData, __privateGet(this, _currentQuery));
2043
- }
2044
- if (shallowEqualObjects(nextResult, prevResult)) {
2045
- return;
2046
- }
2047
- __privateSet(this, _currentResult, nextResult);
2048
- const shouldNotifyListeners = () => {
2049
- if (!prevResult) {
2050
- return true;
2051
- }
2052
- const { notifyOnChangeProps } = this.options;
2053
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
2054
- if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !__privateGet(this, _trackedProps).size) {
2055
- return true;
2056
- }
2057
- const includedProps = new Set(
2058
- notifyOnChangePropsValue ?? __privateGet(this, _trackedProps)
2059
- );
2060
- if (this.options.throwOnError) {
2061
- includedProps.add("error");
2062
- }
2063
- return Object.keys(__privateGet(this, _currentResult)).some((key) => {
2064
- const typedKey = key;
2065
- const changed = __privateGet(this, _currentResult)[typedKey] !== prevResult[typedKey];
2066
- return changed && includedProps.has(typedKey);
2067
- });
2068
- };
2069
- __privateMethod(this, _QueryObserver_instances, notify_fn).call(this, { listeners: shouldNotifyListeners() });
2070
- }
2071
- onQueryUpdate() {
2072
- this.updateResult();
2073
- if (this.hasListeners()) {
2074
- __privateMethod(this, _QueryObserver_instances, updateTimers_fn).call(this);
2075
- }
2076
- }
2077
- }, _client2 = new WeakMap(), _currentQuery = new WeakMap(), _currentQueryInitialState = new WeakMap(), _currentResult = new WeakMap(), _currentResultState = new WeakMap(), _currentResultOptions = new WeakMap(), _currentThenable = new WeakMap(), _selectError = new WeakMap(), _selectFn = new WeakMap(), _selectResult = new WeakMap(), _lastQueryWithDefinedData = new WeakMap(), _staleTimeoutId = new WeakMap(), _refetchIntervalId = new WeakMap(), _currentRefetchInterval = new WeakMap(), _trackedProps = new WeakMap(), _QueryObserver_instances = new WeakSet(), executeFetch_fn = function(fetchOptions) {
2078
- __privateMethod(this, _QueryObserver_instances, updateQuery_fn).call(this);
2079
- let promise = __privateGet(this, _currentQuery).fetch(
2080
- this.options,
2081
- fetchOptions
2082
- );
2083
- if (!fetchOptions?.throwOnError) {
2084
- promise = promise.catch(noop);
2085
- }
2086
- return promise;
2087
- }, updateStaleTimeout_fn = function() {
2088
- __privateMethod(this, _QueryObserver_instances, clearStaleTimeout_fn).call(this);
2089
- const staleTime = resolveStaleTime(
2090
- this.options.staleTime,
2091
- __privateGet(this, _currentQuery)
2092
- );
2093
- if (environmentManager.isServer() || __privateGet(this, _currentResult).isStale || !isValidTimeout(staleTime)) {
2094
- return;
2095
- }
2096
- const time = timeUntilStale(__privateGet(this, _currentResult).dataUpdatedAt, staleTime);
2097
- const timeout = time + 1;
2098
- __privateSet(this, _staleTimeoutId, timeoutManager.setTimeout(() => {
2099
- if (!__privateGet(this, _currentResult).isStale) {
2100
- this.updateResult();
2101
- }
2102
- }, timeout));
2103
- }, computeRefetchInterval_fn = function() {
2104
- return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(__privateGet(this, _currentQuery)) : this.options.refetchInterval) ?? false;
2105
- }, updateRefetchInterval_fn = function(nextInterval) {
2106
- __privateMethod(this, _QueryObserver_instances, clearRefetchInterval_fn).call(this);
2107
- __privateSet(this, _currentRefetchInterval, nextInterval);
2108
- if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) === false || !isValidTimeout(__privateGet(this, _currentRefetchInterval)) || __privateGet(this, _currentRefetchInterval) === 0) {
2109
- return;
2110
- }
2111
- __privateSet(this, _refetchIntervalId, timeoutManager.setInterval(() => {
2112
- if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
2113
- __privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
2114
- }
2115
- }, __privateGet(this, _currentRefetchInterval)));
2116
- }, updateTimers_fn = function() {
2117
- __privateMethod(this, _QueryObserver_instances, updateStaleTimeout_fn).call(this);
2118
- __privateMethod(this, _QueryObserver_instances, updateRefetchInterval_fn).call(this, __privateMethod(this, _QueryObserver_instances, computeRefetchInterval_fn).call(this));
2119
- }, clearStaleTimeout_fn = function() {
2120
- if (__privateGet(this, _staleTimeoutId) !== void 0) {
2121
- timeoutManager.clearTimeout(__privateGet(this, _staleTimeoutId));
2122
- __privateSet(this, _staleTimeoutId, void 0);
2123
- }
2124
- }, clearRefetchInterval_fn = function() {
2125
- if (__privateGet(this, _refetchIntervalId) !== void 0) {
2126
- timeoutManager.clearInterval(__privateGet(this, _refetchIntervalId));
2127
- __privateSet(this, _refetchIntervalId, void 0);
2128
- }
2129
- }, updateQuery_fn = function() {
2130
- const query = __privateGet(this, _client2).getQueryCache().build(__privateGet(this, _client2), this.options);
2131
- if (query === __privateGet(this, _currentQuery)) {
2132
- return;
2133
- }
2134
- const prevQuery = __privateGet(this, _currentQuery);
2135
- __privateSet(this, _currentQuery, query);
2136
- __privateSet(this, _currentQueryInitialState, query.state);
2137
- if (this.hasListeners()) {
2138
- prevQuery?.removeObserver(this);
2139
- query.addObserver(this);
2140
- }
2141
- }, notify_fn = function(notifyOptions) {
2142
- notifyManager.batch(() => {
2143
- if (notifyOptions.listeners) {
2144
- this.listeners.forEach((listener) => {
2145
- listener(__privateGet(this, _currentResult));
2146
- });
2147
- }
2148
- __privateGet(this, _client2).getQueryCache().notify({
2149
- query: __privateGet(this, _currentQuery),
2150
- type: "observerResultsUpdated"
2151
- });
2152
- });
2153
- }, _a6);
2154
- function shouldLoadOnMount(query, options) {
2155
- return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
2156
- }
2157
- function shouldFetchOnMount(query, options) {
2158
- return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
2159
- }
2160
- function shouldFetchOn(query, options, field) {
2161
- if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
2162
- const value = typeof field === "function" ? field(query) : field;
2163
- return value === "always" || value !== false && isStale(query, options);
2164
- }
2165
- return false;
2166
- }
2167
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
2168
- return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
2169
- }
2170
- function isStale(query, options) {
2171
- return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
2172
- }
2173
- function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
2174
- if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
2175
- return true;
2176
- }
2177
- return false;
2178
- }
2179
-
2180
- // node_modules/@tanstack/query-core/build/modern/mutation.js
2181
- var _client3, _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _a7;
2182
- var Mutation = (_a7 = class extends Removable {
2183
- constructor(config) {
2184
- super();
2185
- __privateAdd(this, _Mutation_instances);
2186
- __privateAdd(this, _client3);
2187
- __privateAdd(this, _observers);
2188
- __privateAdd(this, _mutationCache);
2189
- __privateAdd(this, _retryer2);
2190
- __privateSet(this, _client3, config.client);
2191
- this.mutationId = config.mutationId;
2192
- __privateSet(this, _mutationCache, config.mutationCache);
2193
- __privateSet(this, _observers, []);
2194
- this.state = config.state || getDefaultState2();
2195
- this.setOptions(config.options);
2196
- this.scheduleGc();
2197
- }
2198
- setOptions(options) {
2199
- this.options = options;
2200
- this.updateGcTime(this.options.gcTime);
2201
- }
2202
- get meta() {
2203
- return this.options.meta;
2204
- }
2205
- addObserver(observer) {
2206
- if (!__privateGet(this, _observers).includes(observer)) {
2207
- __privateGet(this, _observers).push(observer);
2208
- this.clearGcTimeout();
2209
- __privateGet(this, _mutationCache).notify({
2210
- type: "observerAdded",
2211
- mutation: this,
2212
- observer
2213
- });
2214
- }
2215
- }
2216
- removeObserver(observer) {
2217
- __privateSet(this, _observers, __privateGet(this, _observers).filter((x3) => x3 !== observer));
2218
- this.scheduleGc();
2219
- __privateGet(this, _mutationCache).notify({
2220
- type: "observerRemoved",
2221
- mutation: this,
2222
- observer
2223
- });
2224
- }
2225
- optionalRemove() {
2226
- if (!__privateGet(this, _observers).length) {
2227
- if (this.state.status === "pending") {
2228
- this.scheduleGc();
2229
- } else {
2230
- __privateGet(this, _mutationCache).remove(this);
2231
- }
2232
- }
2233
- }
2234
- continue() {
2235
- return __privateGet(this, _retryer2)?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
2236
- this.execute(this.state.variables);
2237
- }
2238
- async execute(variables) {
2239
- const onContinue = () => {
2240
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "continue" });
2241
- };
2242
- const mutationFnContext = {
2243
- client: __privateGet(this, _client3),
2244
- meta: this.options.meta,
2245
- mutationKey: this.options.mutationKey
2246
- };
2247
- __privateSet(this, _retryer2, createRetryer({
2248
- fn: () => {
2249
- if (!this.options.mutationFn) {
2250
- return Promise.reject(new Error("No mutationFn found"));
2251
- }
2252
- return this.options.mutationFn(variables, mutationFnContext);
2253
- },
2254
- onFail: (failureCount, error) => {
2255
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "failed", failureCount, error });
2256
- },
2257
- onPause: () => {
2258
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "pause" });
2259
- },
2260
- onContinue,
2261
- retry: this.options.retry ?? 0,
2262
- retryDelay: this.options.retryDelay,
2263
- networkMode: this.options.networkMode,
2264
- canRun: () => __privateGet(this, _mutationCache).canRun(this)
2265
- }));
2266
- const restored = this.state.status === "pending";
2267
- const isPaused = !__privateGet(this, _retryer2).canStart();
2268
- try {
2269
- if (restored) {
2270
- onContinue();
2271
- } else {
2272
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "pending", variables, isPaused });
2273
- if (__privateGet(this, _mutationCache).config.onMutate) {
2274
- await __privateGet(this, _mutationCache).config.onMutate(
2275
- variables,
2276
- this,
2277
- mutationFnContext
2278
- );
2279
- }
2280
- const context = await this.options.onMutate?.(
2281
- variables,
2282
- mutationFnContext
2283
- );
2284
- if (context !== this.state.context) {
2285
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, {
2286
- type: "pending",
2287
- context,
2288
- variables,
2289
- isPaused
2290
- });
2291
- }
2292
- }
2293
- const data = await __privateGet(this, _retryer2).start();
2294
- await __privateGet(this, _mutationCache).config.onSuccess?.(
2295
- data,
2296
- variables,
2297
- this.state.context,
2298
- this,
2299
- mutationFnContext
2300
- );
2301
- await this.options.onSuccess?.(
2302
- data,
2303
- variables,
2304
- this.state.context,
2305
- mutationFnContext
2306
- );
2307
- await __privateGet(this, _mutationCache).config.onSettled?.(
2308
- data,
2309
- null,
2310
- this.state.variables,
2311
- this.state.context,
2312
- this,
2313
- mutationFnContext
2314
- );
2315
- await this.options.onSettled?.(
2316
- data,
2317
- null,
2318
- variables,
2319
- this.state.context,
2320
- mutationFnContext
2321
- );
2322
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "success", data });
2323
- return data;
2324
- } catch (error) {
2325
- try {
2326
- await __privateGet(this, _mutationCache).config.onError?.(
2327
- error,
2328
- variables,
2329
- this.state.context,
2330
- this,
2331
- mutationFnContext
2332
- );
2333
- } catch (e3) {
2334
- void Promise.reject(e3);
2335
- }
2336
- try {
2337
- await this.options.onError?.(
2338
- error,
2339
- variables,
2340
- this.state.context,
2341
- mutationFnContext
2342
- );
2343
- } catch (e3) {
2344
- void Promise.reject(e3);
2345
- }
2346
- try {
2347
- await __privateGet(this, _mutationCache).config.onSettled?.(
2348
- void 0,
2349
- error,
2350
- this.state.variables,
2351
- this.state.context,
2352
- this,
2353
- mutationFnContext
2354
- );
2355
- } catch (e3) {
2356
- void Promise.reject(e3);
2357
- }
2358
- try {
2359
- await this.options.onSettled?.(
2360
- void 0,
2361
- error,
2362
- variables,
2363
- this.state.context,
2364
- mutationFnContext
2365
- );
2366
- } catch (e3) {
2367
- void Promise.reject(e3);
2368
- }
2369
- __privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "error", error });
2370
- throw error;
2371
- } finally {
2372
- __privateGet(this, _mutationCache).runNext(this);
2373
- }
2374
- }
2375
- }, _client3 = new WeakMap(), _observers = new WeakMap(), _mutationCache = new WeakMap(), _retryer2 = new WeakMap(), _Mutation_instances = new WeakSet(), dispatch_fn2 = function(action) {
2376
- const reducer = (state) => {
2377
- switch (action.type) {
2378
- case "failed":
2379
- return {
2380
- ...state,
2381
- failureCount: action.failureCount,
2382
- failureReason: action.error
2383
- };
2384
- case "pause":
2385
- return {
2386
- ...state,
2387
- isPaused: true
2388
- };
2389
- case "continue":
2390
- return {
2391
- ...state,
2392
- isPaused: false
2393
- };
2394
- case "pending":
2395
- return {
2396
- ...state,
2397
- context: action.context,
2398
- data: void 0,
2399
- failureCount: 0,
2400
- failureReason: null,
2401
- error: null,
2402
- isPaused: action.isPaused,
2403
- status: "pending",
2404
- variables: action.variables,
2405
- submittedAt: Date.now()
2406
- };
2407
- case "success":
2408
- return {
2409
- ...state,
2410
- data: action.data,
2411
- failureCount: 0,
2412
- failureReason: null,
2413
- error: null,
2414
- status: "success",
2415
- isPaused: false
2416
- };
2417
- case "error":
2418
- return {
2419
- ...state,
2420
- data: void 0,
2421
- error: action.error,
2422
- failureCount: state.failureCount + 1,
2423
- failureReason: action.error,
2424
- isPaused: false,
2425
- status: "error"
2426
- };
2427
- }
2428
- };
2429
- this.state = reducer(this.state);
2430
- notifyManager.batch(() => {
2431
- __privateGet(this, _observers).forEach((observer) => {
2432
- observer.onMutationUpdate(action);
2433
- });
2434
- __privateGet(this, _mutationCache).notify({
2435
- mutation: this,
2436
- type: "updated",
2437
- action
2438
- });
2439
- });
2440
- }, _a7);
2441
- function getDefaultState2() {
2442
- return {
2443
- context: void 0,
2444
- data: void 0,
2445
- error: null,
2446
- failureCount: 0,
2447
- failureReason: null,
2448
- isPaused: false,
2449
- status: "idle",
2450
- variables: void 0,
2451
- submittedAt: 0
2452
- };
2453
- }
2454
-
2455
- // node_modules/@tanstack/query-core/build/modern/mutationCache.js
2456
- var _mutations, _scopes, _mutationId, _a8;
2457
- var MutationCache = (_a8 = class extends Subscribable {
2458
- constructor(config = {}) {
2459
- super();
2460
- __privateAdd(this, _mutations);
2461
- __privateAdd(this, _scopes);
2462
- __privateAdd(this, _mutationId);
2463
- this.config = config;
2464
- __privateSet(this, _mutations, /* @__PURE__ */ new Set());
2465
- __privateSet(this, _scopes, /* @__PURE__ */ new Map());
2466
- __privateSet(this, _mutationId, 0);
2467
- }
2468
- build(client, options, state) {
2469
- const mutation = new Mutation({
2470
- client,
2471
- mutationCache: this,
2472
- mutationId: ++__privateWrapper(this, _mutationId)._,
2473
- options: client.defaultMutationOptions(options),
2474
- state
2475
- });
2476
- this.add(mutation);
2477
- return mutation;
2478
- }
2479
- add(mutation) {
2480
- __privateGet(this, _mutations).add(mutation);
2481
- const scope = scopeFor(mutation);
2482
- if (typeof scope === "string") {
2483
- const scopedMutations = __privateGet(this, _scopes).get(scope);
2484
- if (scopedMutations) {
2485
- scopedMutations.push(mutation);
2486
- } else {
2487
- __privateGet(this, _scopes).set(scope, [mutation]);
2488
- }
2489
- }
2490
- this.notify({ type: "added", mutation });
2491
- }
2492
- remove(mutation) {
2493
- if (__privateGet(this, _mutations).delete(mutation)) {
2494
- const scope = scopeFor(mutation);
2495
- if (typeof scope === "string") {
2496
- const scopedMutations = __privateGet(this, _scopes).get(scope);
2497
- if (scopedMutations) {
2498
- if (scopedMutations.length > 1) {
2499
- const index = scopedMutations.indexOf(mutation);
2500
- if (index !== -1) {
2501
- scopedMutations.splice(index, 1);
2502
- }
2503
- } else if (scopedMutations[0] === mutation) {
2504
- __privateGet(this, _scopes).delete(scope);
2505
- }
2506
- }
2507
- }
2508
- }
2509
- this.notify({ type: "removed", mutation });
2510
- }
2511
- canRun(mutation) {
2512
- const scope = scopeFor(mutation);
2513
- if (typeof scope === "string") {
2514
- const mutationsWithSameScope = __privateGet(this, _scopes).get(scope);
2515
- const firstPendingMutation = mutationsWithSameScope?.find(
2516
- (m3) => m3.state.status === "pending"
2517
- );
2518
- return !firstPendingMutation || firstPendingMutation === mutation;
2519
- } else {
2520
- return true;
2521
- }
2522
- }
2523
- runNext(mutation) {
2524
- const scope = scopeFor(mutation);
2525
- if (typeof scope === "string") {
2526
- const foundMutation = __privateGet(this, _scopes).get(scope)?.find((m3) => m3 !== mutation && m3.state.isPaused);
2527
- return foundMutation?.continue() ?? Promise.resolve();
2528
- } else {
2529
- return Promise.resolve();
2530
- }
2531
- }
2532
- clear() {
2533
- notifyManager.batch(() => {
2534
- __privateGet(this, _mutations).forEach((mutation) => {
2535
- this.notify({ type: "removed", mutation });
2536
- });
2537
- __privateGet(this, _mutations).clear();
2538
- __privateGet(this, _scopes).clear();
2539
- });
2540
- }
2541
- getAll() {
2542
- return Array.from(__privateGet(this, _mutations));
2543
- }
2544
- find(filters) {
2545
- const defaultedFilters = { exact: true, ...filters };
2546
- return this.getAll().find(
2547
- (mutation) => matchMutation(defaultedFilters, mutation)
2548
- );
2549
- }
2550
- findAll(filters = {}) {
2551
- return this.getAll().filter((mutation) => matchMutation(filters, mutation));
2552
- }
2553
- notify(event) {
2554
- notifyManager.batch(() => {
2555
- this.listeners.forEach((listener) => {
2556
- listener(event);
2557
- });
2558
- });
2559
- }
2560
- resumePausedMutations() {
2561
- const pausedMutations = this.getAll().filter((x3) => x3.state.isPaused);
2562
- return notifyManager.batch(
2563
- () => Promise.all(
2564
- pausedMutations.map((mutation) => mutation.continue().catch(noop))
2565
- )
2566
- );
2567
- }
2568
- }, _mutations = new WeakMap(), _scopes = new WeakMap(), _mutationId = new WeakMap(), _a8);
2569
- function scopeFor(mutation) {
2570
- return mutation.options.scope?.id;
2571
- }
2572
-
2573
- // node_modules/@tanstack/query-core/build/modern/queryCache.js
2574
- var _queries, _a9;
2575
- var QueryCache = (_a9 = class extends Subscribable {
2576
- constructor(config = {}) {
2577
- super();
2578
- __privateAdd(this, _queries);
2579
- this.config = config;
2580
- __privateSet(this, _queries, /* @__PURE__ */ new Map());
2581
- }
2582
- build(client, options, state) {
2583
- const queryKey = options.queryKey;
2584
- const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
2585
- let query = this.get(queryHash);
2586
- if (!query) {
2587
- query = new Query({
2588
- client,
2589
- queryKey,
2590
- queryHash,
2591
- options: client.defaultQueryOptions(options),
2592
- state,
2593
- defaultOptions: client.getQueryDefaults(queryKey)
2594
- });
2595
- this.add(query);
2596
- }
2597
- return query;
2598
- }
2599
- add(query) {
2600
- if (!__privateGet(this, _queries).has(query.queryHash)) {
2601
- __privateGet(this, _queries).set(query.queryHash, query);
2602
- this.notify({
2603
- type: "added",
2604
- query
2605
- });
2606
- }
2607
- }
2608
- remove(query) {
2609
- const queryInMap = __privateGet(this, _queries).get(query.queryHash);
2610
- if (queryInMap) {
2611
- query.destroy();
2612
- if (queryInMap === query) {
2613
- __privateGet(this, _queries).delete(query.queryHash);
2614
- }
2615
- this.notify({ type: "removed", query });
2616
- }
2617
- }
2618
- clear() {
2619
- notifyManager.batch(() => {
2620
- this.getAll().forEach((query) => {
2621
- this.remove(query);
2622
- });
2623
- });
2624
- }
2625
- get(queryHash) {
2626
- return __privateGet(this, _queries).get(queryHash);
2627
- }
2628
- getAll() {
2629
- return [...__privateGet(this, _queries).values()];
2630
- }
2631
- find(filters) {
2632
- const defaultedFilters = { exact: true, ...filters };
2633
- return this.getAll().find(
2634
- (query) => matchQuery(defaultedFilters, query)
2635
- );
2636
- }
2637
- findAll(filters = {}) {
2638
- const queries = this.getAll();
2639
- return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
2640
- }
2641
- notify(event) {
2642
- notifyManager.batch(() => {
2643
- this.listeners.forEach((listener) => {
2644
- listener(event);
2645
- });
2646
- });
2647
- }
2648
- onFocus() {
2649
- notifyManager.batch(() => {
2650
- this.getAll().forEach((query) => {
2651
- query.onFocus();
2652
- });
2653
- });
2654
- }
2655
- onOnline() {
2656
- notifyManager.batch(() => {
2657
- this.getAll().forEach((query) => {
2658
- query.onOnline();
2659
- });
2660
- });
2661
- }
2662
- }, _queries = new WeakMap(), _a9);
2663
-
2664
- // node_modules/@tanstack/query-core/build/modern/queryClient.js
2665
- var _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _a10;
2666
- var QueryClient = (_a10 = class {
2667
- constructor(config = {}) {
2668
- __privateAdd(this, _queryCache);
2669
- __privateAdd(this, _mutationCache2);
2670
- __privateAdd(this, _defaultOptions2);
2671
- __privateAdd(this, _queryDefaults);
2672
- __privateAdd(this, _mutationDefaults);
2673
- __privateAdd(this, _mountCount);
2674
- __privateAdd(this, _unsubscribeFocus);
2675
- __privateAdd(this, _unsubscribeOnline);
2676
- __privateSet(this, _queryCache, config.queryCache || new QueryCache());
2677
- __privateSet(this, _mutationCache2, config.mutationCache || new MutationCache());
2678
- __privateSet(this, _defaultOptions2, config.defaultOptions || {});
2679
- __privateSet(this, _queryDefaults, /* @__PURE__ */ new Map());
2680
- __privateSet(this, _mutationDefaults, /* @__PURE__ */ new Map());
2681
- __privateSet(this, _mountCount, 0);
2682
- }
2683
- mount() {
2684
- __privateWrapper(this, _mountCount)._++;
2685
- if (__privateGet(this, _mountCount) !== 1) return;
2686
- __privateSet(this, _unsubscribeFocus, focusManager.subscribe(async (focused) => {
2687
- if (focused) {
2688
- await this.resumePausedMutations();
2689
- __privateGet(this, _queryCache).onFocus();
2690
- }
2691
- }));
2692
- __privateSet(this, _unsubscribeOnline, onlineManager.subscribe(async (online) => {
2693
- if (online) {
2694
- await this.resumePausedMutations();
2695
- __privateGet(this, _queryCache).onOnline();
2696
- }
2697
- }));
2698
- }
2699
- unmount() {
2700
- var _a11, _b;
2701
- __privateWrapper(this, _mountCount)._--;
2702
- if (__privateGet(this, _mountCount) !== 0) return;
2703
- (_a11 = __privateGet(this, _unsubscribeFocus)) == null ? void 0 : _a11.call(this);
2704
- __privateSet(this, _unsubscribeFocus, void 0);
2705
- (_b = __privateGet(this, _unsubscribeOnline)) == null ? void 0 : _b.call(this);
2706
- __privateSet(this, _unsubscribeOnline, void 0);
2707
- }
2708
- isFetching(filters) {
2709
- return __privateGet(this, _queryCache).findAll({ ...filters, fetchStatus: "fetching" }).length;
2710
- }
2711
- isMutating(filters) {
2712
- return __privateGet(this, _mutationCache2).findAll({ ...filters, status: "pending" }).length;
2713
- }
2714
- /**
2715
- * Imperative (non-reactive) way to retrieve data for a QueryKey.
2716
- * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
2717
- *
2718
- * Hint: Do not use this function inside a component, because it won't receive updates.
2719
- * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
2720
- */
2721
- getQueryData(queryKey) {
2722
- const options = this.defaultQueryOptions({ queryKey });
2723
- return __privateGet(this, _queryCache).get(options.queryHash)?.state.data;
2724
- }
2725
- ensureQueryData(options) {
2726
- const defaultedOptions = this.defaultQueryOptions(options);
2727
- const query = __privateGet(this, _queryCache).build(this, defaultedOptions);
2728
- const cachedData = query.state.data;
2729
- if (cachedData === void 0) {
2730
- return this.fetchQuery(options);
2731
- }
2732
- if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
2733
- void this.prefetchQuery(defaultedOptions);
2734
- }
2735
- return Promise.resolve(cachedData);
2736
- }
2737
- getQueriesData(filters) {
2738
- return __privateGet(this, _queryCache).findAll(filters).map(({ queryKey, state }) => {
2739
- const data = state.data;
2740
- return [queryKey, data];
2741
- });
2742
- }
2743
- setQueryData(queryKey, updater, options) {
2744
- const defaultedOptions = this.defaultQueryOptions({ queryKey });
2745
- const query = __privateGet(this, _queryCache).get(
2746
- defaultedOptions.queryHash
2747
- );
2748
- const prevData = query?.state.data;
2749
- const data = functionalUpdate(updater, prevData);
2750
- if (data === void 0) {
2751
- return void 0;
2752
- }
2753
- return __privateGet(this, _queryCache).build(this, defaultedOptions).setData(data, { ...options, manual: true });
2754
- }
2755
- setQueriesData(filters, updater, options) {
2756
- return notifyManager.batch(
2757
- () => __privateGet(this, _queryCache).findAll(filters).map(({ queryKey }) => [
2758
- queryKey,
2759
- this.setQueryData(queryKey, updater, options)
2760
- ])
2761
- );
2762
- }
2763
- getQueryState(queryKey) {
2764
- const options = this.defaultQueryOptions({ queryKey });
2765
- return __privateGet(this, _queryCache).get(
2766
- options.queryHash
2767
- )?.state;
2768
- }
2769
- removeQueries(filters) {
2770
- const queryCache = __privateGet(this, _queryCache);
2771
- notifyManager.batch(() => {
2772
- queryCache.findAll(filters).forEach((query) => {
2773
- queryCache.remove(query);
2774
- });
2775
- });
2776
- }
2777
- resetQueries(filters, options) {
2778
- const queryCache = __privateGet(this, _queryCache);
2779
- return notifyManager.batch(() => {
2780
- queryCache.findAll(filters).forEach((query) => {
2781
- query.reset();
2782
- });
2783
- return this.refetchQueries(
2784
- {
2785
- type: "active",
2786
- ...filters
2787
- },
2788
- options
2789
- );
2790
- });
2791
- }
2792
- cancelQueries(filters, cancelOptions = {}) {
2793
- const defaultedCancelOptions = { revert: true, ...cancelOptions };
2794
- const promises = notifyManager.batch(
2795
- () => __privateGet(this, _queryCache).findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
2796
- );
2797
- return Promise.all(promises).then(noop).catch(noop);
2798
- }
2799
- invalidateQueries(filters, options = {}) {
2800
- return notifyManager.batch(() => {
2801
- __privateGet(this, _queryCache).findAll(filters).forEach((query) => {
2802
- query.invalidate();
2803
- });
2804
- if (filters?.refetchType === "none") {
2805
- return Promise.resolve();
2806
- }
2807
- return this.refetchQueries(
2808
- {
2809
- ...filters,
2810
- type: filters?.refetchType ?? filters?.type ?? "active"
2811
- },
2812
- options
2813
- );
2814
- });
2815
- }
2816
- refetchQueries(filters, options = {}) {
2817
- const fetchOptions = {
2818
- ...options,
2819
- cancelRefetch: options.cancelRefetch ?? true
2820
- };
2821
- const promises = notifyManager.batch(
2822
- () => __privateGet(this, _queryCache).findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
2823
- let promise = query.fetch(void 0, fetchOptions);
2824
- if (!fetchOptions.throwOnError) {
2825
- promise = promise.catch(noop);
2826
- }
2827
- return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
2828
- })
2829
- );
2830
- return Promise.all(promises).then(noop);
2831
- }
2832
- fetchQuery(options) {
2833
- const defaultedOptions = this.defaultQueryOptions(options);
2834
- if (defaultedOptions.retry === void 0) {
2835
- defaultedOptions.retry = false;
2836
- }
2837
- const query = __privateGet(this, _queryCache).build(this, defaultedOptions);
2838
- return query.isStaleByTime(
2839
- resolveStaleTime(defaultedOptions.staleTime, query)
2840
- ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
2841
- }
2842
- prefetchQuery(options) {
2843
- return this.fetchQuery(options).then(noop).catch(noop);
2844
- }
2845
- fetchInfiniteQuery(options) {
2846
- options._type = "infinite";
2847
- return this.fetchQuery(options);
2848
- }
2849
- prefetchInfiniteQuery(options) {
2850
- return this.fetchInfiniteQuery(options).then(noop).catch(noop);
2851
- }
2852
- ensureInfiniteQueryData(options) {
2853
- options._type = "infinite";
2854
- return this.ensureQueryData(options);
2855
- }
2856
- resumePausedMutations() {
2857
- if (onlineManager.isOnline()) {
2858
- return __privateGet(this, _mutationCache2).resumePausedMutations();
2859
- }
2860
- return Promise.resolve();
2861
- }
2862
- getQueryCache() {
2863
- return __privateGet(this, _queryCache);
2864
- }
2865
- getMutationCache() {
2866
- return __privateGet(this, _mutationCache2);
2867
- }
2868
- getDefaultOptions() {
2869
- return __privateGet(this, _defaultOptions2);
2870
- }
2871
- setDefaultOptions(options) {
2872
- __privateSet(this, _defaultOptions2, options);
2873
- }
2874
- setQueryDefaults(queryKey, options) {
2875
- __privateGet(this, _queryDefaults).set(hashKey(queryKey), {
2876
- queryKey,
2877
- defaultOptions: options
2878
- });
2879
- }
2880
- getQueryDefaults(queryKey) {
2881
- const defaults = [...__privateGet(this, _queryDefaults).values()];
2882
- const result = {};
2883
- defaults.forEach((queryDefault) => {
2884
- if (partialMatchKey(queryKey, queryDefault.queryKey)) {
2885
- Object.assign(result, queryDefault.defaultOptions);
2886
- }
2887
- });
2888
- return result;
2889
- }
2890
- setMutationDefaults(mutationKey, options) {
2891
- __privateGet(this, _mutationDefaults).set(hashKey(mutationKey), {
2892
- mutationKey,
2893
- defaultOptions: options
2894
- });
2895
- }
2896
- getMutationDefaults(mutationKey) {
2897
- const defaults = [...__privateGet(this, _mutationDefaults).values()];
2898
- const result = {};
2899
- defaults.forEach((queryDefault) => {
2900
- if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
2901
- Object.assign(result, queryDefault.defaultOptions);
2902
- }
2903
- });
2904
- return result;
2905
- }
2906
- defaultQueryOptions(options) {
2907
- if (options._defaulted) {
2908
- return options;
2909
- }
2910
- const defaultedOptions = {
2911
- ...__privateGet(this, _defaultOptions2).queries,
2912
- ...this.getQueryDefaults(options.queryKey),
2913
- ...options,
2914
- _defaulted: true
2915
- };
2916
- if (!defaultedOptions.queryHash) {
2917
- defaultedOptions.queryHash = hashQueryKeyByOptions(
2918
- defaultedOptions.queryKey,
2919
- defaultedOptions
2920
- );
2921
- }
2922
- if (defaultedOptions.refetchOnReconnect === void 0) {
2923
- defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
2924
- }
2925
- if (defaultedOptions.throwOnError === void 0) {
2926
- defaultedOptions.throwOnError = !!defaultedOptions.suspense;
2927
- }
2928
- if (!defaultedOptions.networkMode && defaultedOptions.persister) {
2929
- defaultedOptions.networkMode = "offlineFirst";
2930
- }
2931
- if (defaultedOptions.queryFn === skipToken) {
2932
- defaultedOptions.enabled = false;
2933
- }
2934
- return defaultedOptions;
2935
- }
2936
- defaultMutationOptions(options) {
2937
- if (options?._defaulted) {
2938
- return options;
2939
- }
2940
- return {
2941
- ...__privateGet(this, _defaultOptions2).mutations,
2942
- ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
2943
- ...options,
2944
- _defaulted: true
2945
- };
2946
- }
2947
- clear() {
2948
- __privateGet(this, _queryCache).clear();
2949
- __privateGet(this, _mutationCache2).clear();
2950
- }
2951
- }, _queryCache = new WeakMap(), _mutationCache2 = new WeakMap(), _defaultOptions2 = new WeakMap(), _queryDefaults = new WeakMap(), _mutationDefaults = new WeakMap(), _mountCount = new WeakMap(), _unsubscribeFocus = new WeakMap(), _unsubscribeOnline = new WeakMap(), _a10);
2952
-
2953
- // node_modules/@tanstack/preact-query/build/modern/IsRestoringProvider.js
2954
- var IsRestoringContext = R(false);
2955
- var useIsRestoring = () => x2(IsRestoringContext);
2956
- var IsRestoringProvider = IsRestoringContext.Provider;
2957
-
2958
- // node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
2959
- var f3 = 0;
2960
- function u3(e3, t3, n2, o3, i3, u4) {
2961
- t3 || (t3 = {});
2962
- var a3, c3, p3 = t3;
2963
- if ("ref" in p3) for (c3 in p3 = {}, t3) "ref" == c3 ? a3 = t3[c3] : p3[c3] = t3[c3];
2964
- var l3 = { type: e3, props: p3, key: n2, ref: a3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f3, __i: -1, __u: 0, __source: i3, __self: u4 };
2965
- if ("function" == typeof e3 && (a3 = e3.defaultProps)) for (c3 in a3) void 0 === p3[c3] && (p3[c3] = a3[c3]);
2966
- return l.vnode && l.vnode(l3), l3;
2967
- }
2968
-
2969
- // node_modules/@tanstack/preact-query/build/modern/QueryClientProvider.js
2970
- var QueryClientContext = R(
2971
- void 0
2972
- );
2973
- var useQueryClient = (queryClient) => {
2974
- const client = x2(QueryClientContext);
2975
- if (queryClient) {
2976
- return queryClient;
2977
- }
2978
- if (!client) {
2979
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
2980
- }
2981
- return client;
2982
- };
2983
- var QueryClientProvider = ({
2984
- client,
2985
- children
2986
- }) => {
2987
- y2(() => {
2988
- client.mount();
2989
- return () => {
2990
- client.unmount();
2991
- };
2992
- }, [client]);
2993
- return /* @__PURE__ */ u3(QueryClientContext.Provider, { value: client, children });
2994
- };
2995
-
2996
- // node_modules/@tanstack/preact-query/build/modern/QueryErrorResetBoundary.js
2997
- function createValue() {
2998
- let isReset = false;
2999
- return {
3000
- clearReset: () => {
3001
- isReset = false;
3002
- },
3003
- reset: () => {
3004
- isReset = true;
3005
- },
3006
- isReset: () => {
3007
- return isReset;
3008
- }
3009
- };
3010
- }
3011
- var QueryErrorResetBoundaryContext = R(createValue());
3012
- var useQueryErrorResetBoundary = () => x2(QueryErrorResetBoundaryContext);
3013
-
3014
- // node_modules/@tanstack/preact-query/build/modern/errorBoundaryUtils.js
3015
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
3016
- if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) {
3017
- if (!errorResetBoundary.isReset()) {
3018
- options.retryOnMount = false;
3019
- }
3020
- }
3021
- };
3022
- var useClearResetErrorBoundary = (errorResetBoundary) => {
3023
- y2(() => {
3024
- errorResetBoundary.clearReset();
3025
- }, [errorResetBoundary]);
3026
- };
3027
- var getHasError = ({
3028
- result,
3029
- errorResetBoundary,
3030
- throwOnError,
3031
- query,
3032
- suspense
3033
- }) => {
3034
- return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
3035
- };
3036
-
3037
- // node_modules/@tanstack/preact-query/build/modern/suspense.js
3038
- var ensureSuspenseTimers = (defaultedOptions) => {
3039
- if (defaultedOptions.suspense) {
3040
- const MIN_SUSPENSE_TIME_MS = 1e3;
3041
- const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
3042
- const originalStaleTime = defaultedOptions.staleTime;
3043
- defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
3044
- if (typeof defaultedOptions.gcTime === "number") {
3045
- defaultedOptions.gcTime = Math.max(
3046
- defaultedOptions.gcTime,
3047
- MIN_SUSPENSE_TIME_MS
3048
- );
3049
- }
3050
- }
3051
- };
3052
- var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
3053
- var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
3054
- var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
3055
- errorResetBoundary.clearReset();
3056
- });
3057
-
3058
- // node_modules/@tanstack/preact-query/build/modern/utils.js
3059
- function useSyncExternalStore(subscribe, getSnapshot) {
3060
- const value = getSnapshot();
3061
- const [{ _instance }, forceUpdate] = d2({
3062
- _instance: { _value: value, _getSnapshot: getSnapshot }
3063
- });
3064
- _2(() => {
3065
- _instance._value = value;
3066
- _instance._getSnapshot = getSnapshot;
3067
- if (didSnapshotChange(_instance)) {
3068
- forceUpdate({ _instance });
3069
- }
3070
- }, [subscribe, value, getSnapshot]);
3071
- y2(() => {
3072
- if (didSnapshotChange(_instance)) {
3073
- forceUpdate({ _instance });
3074
- }
3075
- return subscribe(() => {
3076
- if (didSnapshotChange(_instance)) {
3077
- forceUpdate({ _instance });
3078
- }
3079
- });
3080
- }, [subscribe]);
3081
- return value;
3082
- }
3083
- function didSnapshotChange(inst) {
3084
- const latestGetSnapshot = inst._getSnapshot;
3085
- const prevValue = inst._value;
3086
- try {
3087
- const nextValue = latestGetSnapshot();
3088
- return !Object.is(prevValue, nextValue);
3089
- } catch (_error) {
3090
- return true;
3091
- }
3092
- }
3093
-
3094
- // node_modules/@tanstack/preact-query/build/modern/useBaseQuery.js
3095
- function useBaseQuery(options, Observer, queryClient) {
3096
- if (true) {
3097
- if (typeof options !== "object" || Array.isArray(options)) {
3098
- throw new Error(
3099
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
3100
- );
3101
- }
3102
- }
3103
- const isRestoring = useIsRestoring();
3104
- const errorResetBoundary = useQueryErrorResetBoundary();
3105
- const client = useQueryClient(queryClient);
3106
- const defaultedOptions = client.defaultQueryOptions(options);
3107
- client.getDefaultOptions().queries?._experimental_beforeQuery?.(
3108
- defaultedOptions
3109
- );
3110
- if (true) {
3111
- if (!defaultedOptions.queryFn) {
3112
- console.error(
3113
- `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
3114
- );
3115
- }
3116
- }
3117
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
3118
- ensureSuspenseTimers(defaultedOptions);
3119
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
3120
- useClearResetErrorBoundary(errorResetBoundary);
3121
- const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
3122
- const [observer] = d2(
3123
- () => new Observer(
3124
- client,
3125
- defaultedOptions
3126
- )
3127
- );
3128
- const result = observer.getOptimisticResult(defaultedOptions);
3129
- const shouldSubscribe = !isRestoring && options.subscribed !== false;
3130
- useSyncExternalStore(
3131
- q2(
3132
- (onStoreChange) => {
3133
- const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
3134
- observer.updateResult();
3135
- return unsubscribe;
3136
- },
3137
- [observer, shouldSubscribe]
3138
- ),
3139
- () => observer.getCurrentResult()
3140
- );
3141
- y2(() => {
3142
- observer.setOptions(defaultedOptions);
3143
- }, [defaultedOptions, observer]);
3144
- if (shouldSuspend(defaultedOptions, result)) {
3145
- throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
3146
- }
3147
- if (getHasError({
3148
- result,
3149
- errorResetBoundary,
3150
- throwOnError: defaultedOptions.throwOnError,
3151
- query: client.getQueryCache().get(defaultedOptions.queryHash),
3152
- suspense: defaultedOptions.suspense
3153
- })) {
3154
- throw result.error;
3155
- }
3156
- ;
3157
- client.getDefaultOptions().queries?._experimental_afterQuery?.(
3158
- defaultedOptions,
3159
- result
3160
- );
3161
- if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
3162
- const promise = isNewCacheEntry ? (
3163
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
3164
- fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
3165
- ) : (
3166
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
3167
- client.getQueryCache().get(defaultedOptions.queryHash)?.promise
3168
- );
3169
- promise?.catch(noop).finally(() => {
3170
- observer.updateResult();
3171
- });
3172
- }
3173
- return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
3174
- }
3175
-
3176
- // node_modules/@tanstack/preact-query/build/modern/useQuery.js
3177
- function useQuery(options, queryClient) {
3178
- return useBaseQuery(options, QueryObserver, queryClient);
3179
- }
3180
-
3181
- // app/assets/typescript/profiler/components/toolbar/ToolbarItem.tsx
3182
- function ToolbarItem({ children, panel, href, className, panelLarge }) {
3183
- const [visible, setVisible] = d2(false);
3184
- const panelRef = A2(null);
3185
- const showTimer = A2(null);
3186
- const hideTimer = A2(null);
3187
- const show = () => {
3188
- if (hideTimer.current) {
3189
- clearTimeout(hideTimer.current);
3190
- hideTimer.current = null;
3191
- }
3192
- showTimer.current = setTimeout(() => setVisible(true), 100);
3193
- };
3194
- const hide = () => {
3195
- if (showTimer.current) {
3196
- clearTimeout(showTimer.current);
3197
- showTimer.current = null;
3198
- }
3199
- hideTimer.current = setTimeout(() => setVisible(false), 150);
3200
- };
3201
- _2(() => {
3202
- if (visible && panelRef.current) {
3203
- const el = panelRef.current;
3204
- el.style.left = "50%";
3205
- el.style.right = "auto";
3206
- el.style.transform = "translateX(-50%)";
3207
- const rect = el.getBoundingClientRect();
3208
- if (rect.left < 8) {
3209
- el.style.left = "0";
3210
- el.style.transform = "none";
3211
- } else if (rect.right > window.innerWidth - 8) {
3212
- el.style.left = "auto";
3213
- el.style.right = "0";
3214
- el.style.transform = "none";
3215
- }
3216
- }
3217
- }, [visible]);
3218
- const cls = [
3219
- "profiler-toolbar-item",
3220
- panel ? "profiler-toolbar-hoverable" : "",
3221
- className || ""
3222
- ].filter(Boolean).join(" ");
3223
- const panelEl = panel ? /* @__PURE__ */ u3(
3224
- "div",
3225
- {
3226
- ref: panelRef,
3227
- class: `profiler-toolbar-panel${panelLarge ? " profiler-toolbar-panel-large" : ""}${visible ? " is-visible" : ""}`,
3228
- onMouseEnter: show,
3229
- onMouseLeave: hide,
3230
- children: panel
3231
- }
3232
- ) : null;
3233
- if (href) {
3234
- return /* @__PURE__ */ u3("a", { href, class: cls, onMouseEnter: show, onMouseLeave: hide, children: [
3235
- children,
3236
- panelEl
3237
- ] });
3238
- }
3239
- return /* @__PURE__ */ u3("span", { class: cls, onMouseEnter: show, onMouseLeave: hide, children: [
3240
- children,
3241
- panelEl
3242
- ] });
3243
- }
3244
-
3245
- // app/assets/typescript/profiler/components/toolbar/panels/RequestPanel.tsx
3246
- function statusClass(status) {
3247
- if (status >= 200 && status < 300) return "profiler-text--success";
3248
- if (status >= 300 && status < 400) return "profiler-text--warning";
3249
- if (status >= 400) return "profiler-text--error";
3250
- return "";
3251
- }
3252
- function RequestPanel({ profile, requestData }) {
3253
- const cls = statusClass(profile.status);
3254
- const controllerAction = requestData.controller_action;
3255
- const routeName = requestData.route_name;
3256
- const routePattern = requestData.route_pattern;
3257
- const routeParams = requestData.route_params;
3258
- return /* @__PURE__ */ u3(k, { children: [
3259
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3260
- "Request & Response",
3261
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: profile.path })
3262
- ] }),
3263
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3264
- /* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Request" }),
3265
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3266
- /* @__PURE__ */ u3("span", { children: "Method" }),
3267
- /* @__PURE__ */ u3("strong", { class: "profiler-text--accent", children: profile.method })
3268
- ] }),
3269
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3270
- /* @__PURE__ */ u3("span", { children: "Path" }),
3271
- /* @__PURE__ */ u3("strong", { children: profile.path })
3272
- ] }),
3273
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3274
- /* @__PURE__ */ u3("span", { children: "Status" }),
3275
- /* @__PURE__ */ u3("strong", { class: cls, children: profile.status })
3276
- ] }),
3277
- controllerAction && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3278
- /* @__PURE__ */ u3("span", { children: "Controller#Action" }),
3279
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: controllerAction })
3280
- ] }),
3281
- routeName && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3282
- /* @__PURE__ */ u3("span", { children: "Route Name" }),
3283
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: routeName })
3284
- ] }),
3285
- routePattern && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3286
- /* @__PURE__ */ u3("span", { children: "Route Pattern" }),
3287
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: routePattern })
3288
- ] }),
3289
- routeParams && Object.keys(routeParams).length > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3290
- /* @__PURE__ */ u3("span", { children: "Route Params" }),
3291
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: Object.entries(routeParams).map(([k3, v3]) => `${k3}: ${v3}`).join(", ") })
3292
- ] }),
3293
- profile.params && Object.keys(profile.params).length > 0 && /* @__PURE__ */ u3(k, { children: [
3294
- /* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Parameters" }),
3295
- Object.entries(profile.params).map(([key, value]) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3296
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
3297
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 40) })
3298
- ] }, key))
3299
- ] })
3300
- ] })
3301
- ] });
3302
- }
3303
-
3304
- // app/assets/typescript/profiler/components/toolbar/panels/DatabasePanel.tsx
3305
- function DatabasePanel({ dbData }) {
3306
- return /* @__PURE__ */ u3(k, { children: [
3307
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3308
- "Database",
3309
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3310
- dbData.total_queries,
3311
- " queries \xB7 ",
3312
- dbData.total_duration.toFixed(2),
3313
- " ms"
3314
- ] })
3315
- ] }),
3316
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3317
- dbData.queries.slice(0, 10).map((query, index) => /* @__PURE__ */ u3(
3318
- "div",
3319
- {
3320
- class: `profiler-toolbar-panel-query${query.slow ? " profiler-toolbar-panel-query-slow" : ""}`,
3321
- children: [
3322
- /* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--between profiler-mb-1", children: [
3323
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
3324
- "#",
3325
- index + 1,
3326
- " ",
3327
- query.name
3328
- ] }),
3329
- /* @__PURE__ */ u3("span", { class: `${query.slow ? "profiler-text--error" : "profiler-text--success"} profiler-text--xs`, children: [
3330
- query.duration.toFixed(2),
3331
- " ms"
3332
- ] })
3333
- ] }),
3334
- /* @__PURE__ */ u3("code", { children: query.sql })
3335
- ]
3336
- },
3337
- index
3338
- )),
3339
- dbData.total_queries > 10 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3340
- "+ ",
3341
- dbData.total_queries - 10,
3342
- " more queries"
3343
- ] })
3344
- ] })
3345
- ] });
3346
- }
3347
-
3348
- // app/assets/typescript/profiler/components/toolbar/panels/AjaxPanel.tsx
3349
- function methodBadgeClass(method) {
3350
- const map = {
3351
- GET: "badge-info",
3352
- POST: "badge-success",
3353
- PUT: "badge-warning",
3354
- PATCH: "badge-warning",
3355
- DELETE: "badge-error"
3356
- };
3357
- return map[method] || "";
3358
- }
3359
- var TURBO_TITLES = {
3360
- frame: "Turbo Frame request",
3361
- stream: "Turbo Stream response"
3362
- };
3363
- function AjaxPanel({ ajaxData }) {
3364
- return /* @__PURE__ */ u3(k, { children: [
3365
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3366
- "AJAX",
3367
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3368
- ajaxData.total_requests,
3369
- " requests \xB7 ",
3370
- ajaxData.total_duration.toFixed(2),
3371
- " ms"
3372
- ] })
3373
- ] }),
3374
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3375
- ajaxData.requests.slice(0, 10).map((req, index) => {
3376
- const statusCls = req.status >= 200 && req.status < 300 ? "profiler-ajax-card--success" : "profiler-ajax-card--error";
3377
- return /* @__PURE__ */ u3("div", { class: `profiler-ajax-card ${statusCls}`, children: /* @__PURE__ */ u3("div", { class: "profiler-ajax-card__row", children: [
3378
- /* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
3379
- /* @__PURE__ */ u3("span", { class: `badge ${methodBadgeClass(req.method)}`, children: req.method }),
3380
- req.turbo && /* @__PURE__ */ u3("span", { class: "badge badge-default", title: TURBO_TITLES[req.turbo], children: req.turbo.toUpperCase() }),
3381
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--truncate", children: req.path })
3382
- ] }),
3383
- /* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
3384
- /* @__PURE__ */ u3("span", { class: `profiler-text--xs ${req.status >= 200 && req.status < 300 ? "profiler-text--success" : "profiler-text--error"}`, children: req.status }),
3385
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
3386
- req.duration.toFixed(2),
3387
- " ms"
3388
- ] })
3389
- ] })
3390
- ] }) }, index);
3391
- }),
3392
- ajaxData.total_requests > 10 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3393
- "+ ",
3394
- ajaxData.total_requests - 10,
3395
- " more"
3396
- ] })
3397
- ] })
3398
- ] });
3399
- }
3400
-
3401
- // app/assets/typescript/profiler/components/toolbar/panels/EventsPanel.tsx
3402
- function EventsPanel({ perfData }) {
3403
- return /* @__PURE__ */ u3(k, { children: [
3404
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: "Events" }),
3405
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: perfData.events.slice(0, 8).map((event, index) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3406
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs", children: event.name }),
3407
- /* @__PURE__ */ u3("strong", { class: "profiler-text--accent", children: [
3408
- event.duration.toFixed(2),
3409
- " ms"
3410
- ] })
3411
- ] }, index)) })
3412
- ] });
3413
- }
3414
-
3415
- // app/assets/typescript/profiler/components/toolbar/panels/ViewsPanel.tsx
3416
- function ViewsPanel({ viewData }) {
3417
- return /* @__PURE__ */ u3(k, { children: [
3418
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3419
- "Views",
3420
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3421
- viewData.total_duration.toFixed(2),
3422
- " ms"
3423
- ] })
3424
- ] }),
3425
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3426
- viewData.views && viewData.views.length > 0 && /* @__PURE__ */ u3(k, { children: [
3427
- /* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Templates" }),
3428
- viewData.views.map((view, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3429
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs", children: view.identifier }),
3430
- /* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: [
3431
- view.duration.toFixed(2),
3432
- " ms"
3433
- ] })
3434
- ] }, i3))
3435
- ] }),
3436
- viewData.partials && viewData.partials.length > 0 && /* @__PURE__ */ u3(k, { children: [
3437
- /* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Partials" }),
3438
- viewData.partials.map((partial, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3439
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs", children: partial.identifier }),
3440
- /* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: [
3441
- partial.duration.toFixed(2),
3442
- " ms"
3443
- ] })
3444
- ] }, i3))
3445
- ] })
3446
- ] })
3447
- ] });
3448
- }
3449
-
3450
- // app/assets/typescript/profiler/components/toolbar/panels/CachePanel.tsx
3451
- function CachePanel({ cacheData }) {
3452
- return /* @__PURE__ */ u3(k, { children: [
3453
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3454
- "Cache",
3455
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3456
- "Hit rate: ",
3457
- cacheData.hit_rate,
3458
- "%"
3459
- ] })
3460
- ] }),
3461
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3462
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3463
- /* @__PURE__ */ u3("span", { children: "Reads" }),
3464
- /* @__PURE__ */ u3("strong", { children: cacheData.total_reads })
3465
- ] }),
3466
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3467
- /* @__PURE__ */ u3("span", { children: "Writes" }),
3468
- /* @__PURE__ */ u3("strong", { children: cacheData.total_writes })
3469
- ] }),
3470
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3471
- /* @__PURE__ */ u3("span", { children: "Hits" }),
3472
- /* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: cacheData.hits })
3473
- ] }),
3474
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3475
- /* @__PURE__ */ u3("span", { children: "Misses" }),
3476
- /* @__PURE__ */ u3("strong", { class: "profiler-text--error", children: cacheData.misses })
3477
- ] })
3478
- ] })
3479
- ] });
3480
- }
3481
-
3482
- // app/assets/typescript/profiler/components/toolbar/panels/DumpsPanel.tsx
3483
- function DumpsPanel({ dumpData }) {
3484
- return /* @__PURE__ */ u3(k, { children: [
3485
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3486
- "Dumps (",
3487
- dumpData.count,
3488
- ")"
3489
- ] }),
3490
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3491
- dumpData.dumps.slice(0, 5).map((dump, index) => /* @__PURE__ */ u3("div", { class: "profiler-dump-card", children: [
3492
- /* @__PURE__ */ u3("div", { class: "profiler-dump-card__header", children: [
3493
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
3494
- "#",
3495
- index + 1,
3496
- dump.label && /* @__PURE__ */ u3(k, { children: [
3497
- " \xB7 ",
3498
- /* @__PURE__ */ u3("strong", { class: "profiler-text--warning", children: dump.label })
3499
- ] })
3500
- ] }),
3501
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
3502
- dump.file.split("/").pop(),
3503
- ":",
3504
- dump.line
3505
- ] })
3506
- ] }),
3507
- /* @__PURE__ */ u3(
3508
- "pre",
3509
- {
3510
- class: "profiler-text--xs profiler-text--truncate profiler-text--warning",
3511
- style: { margin: 0, background: "none", border: "none", padding: 0 },
3512
- children: (dump.formatted.split("\n")[0] || dump.formatted).trim()
3513
- }
3514
- )
3515
- ] }, index)),
3516
- dumpData.count > 5 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3517
- "+ ",
3518
- dumpData.count - 5,
3519
- " more dumps"
3520
- ] })
3521
- ] })
3522
- ] });
3523
- }
3524
-
3525
- // app/assets/typescript/profiler/components/toolbar/panels/HttpPanel.tsx
3526
- function methodBadgeClass2(method) {
3527
- const map = {
3528
- GET: "badge-info",
3529
- POST: "badge-success",
3530
- PUT: "badge-warning",
3531
- PATCH: "badge-warning",
3532
- DELETE: "badge-error"
3533
- };
3534
- return map[method] || "";
3535
- }
3536
- function HttpPanel({ httpData }) {
3537
- const threshold = 500;
3538
- return /* @__PURE__ */ u3(k, { children: [
3539
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3540
- "Outbound HTTP",
3541
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3542
- httpData.total_requests,
3543
- " requests \xB7 ",
3544
- httpData.total_duration.toFixed(2),
3545
- " ms"
3546
- ] })
3547
- ] }),
3548
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3549
- httpData.requests.slice(0, 10).map((req, index) => {
3550
- const isError = req.status >= 400 || req.status === 0;
3551
- const isSlow = req.duration >= threshold;
3552
- const statusCls = isError ? "profiler-ajax-card--error" : isSlow ? "profiler-ajax-card--warning" : "profiler-ajax-card--success";
3553
- const host = (() => {
3554
- try {
3555
- return new URL(req.url).host;
3556
- } catch {
3557
- return req.url;
3558
- }
3559
- })();
3560
- return /* @__PURE__ */ u3("div", { class: `profiler-ajax-card ${statusCls}`, children: /* @__PURE__ */ u3("div", { class: "profiler-ajax-card__row", children: [
3561
- /* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
3562
- /* @__PURE__ */ u3("span", { class: `badge ${methodBadgeClass2(req.method)}`, children: req.method }),
3563
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--truncate", children: host })
3564
- ] }),
3565
- /* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
3566
- /* @__PURE__ */ u3("span", { class: `profiler-text--xs ${isError ? "profiler-text--error" : "profiler-text--success"}`, children: req.status === 0 ? "ERR" : req.status }),
3567
- /* @__PURE__ */ u3("span", { class: `profiler-text--xs ${isSlow ? "profiler-text--error" : "profiler-text--muted"}`, children: [
3568
- req.duration.toFixed(2),
3569
- " ms"
3570
- ] })
3571
- ] })
3572
- ] }) }, index);
3573
- }),
3574
- httpData.total_requests > 10 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3575
- "+ ",
3576
- httpData.total_requests - 10,
3577
- " more"
3578
- ] })
3579
- ] })
3580
- ] });
3581
- }
3582
-
3583
- // app/assets/typescript/profiler/components/toolbar/panels/LogsPanel.tsx
3584
- function levelColor(level) {
3585
- switch (level) {
3586
- case "ERROR":
3587
- case "FATAL":
3588
- return "var(--profiler-error, #ef4444)";
3589
- case "WARN":
3590
- return "var(--profiler-warning, #f59e0b)";
3591
- case "INFO":
3592
- return "var(--profiler-success, #22c55e)";
3593
- default:
3594
- return "var(--profiler-muted, #6b7280)";
3595
- }
3596
- }
3597
- function LogsPanel({ logData }) {
3598
- const recent = logData.logs.slice(-5).reverse();
3599
- return /* @__PURE__ */ u3(k, { children: [
3600
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3601
- "Logs (",
3602
- logData.count,
3603
- ")",
3604
- logData.errors > 0 && /* @__PURE__ */ u3("span", { style: "color:var(--profiler-error,#ef4444);margin-left:8px;", children: [
3605
- logData.errors,
3606
- " error",
3607
- logData.errors !== 1 ? "s" : ""
3608
- ] }),
3609
- logData.warnings > 0 && logData.errors === 0 && /* @__PURE__ */ u3("span", { style: "color:var(--profiler-warning,#f59e0b);margin-left:8px;", children: [
3610
- logData.warnings,
3611
- " warning",
3612
- logData.warnings !== 1 ? "s" : ""
3613
- ] })
3614
- ] }),
3615
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3616
- recent.map((entry, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", style: "align-items:flex-start;gap:6px;", children: [
3617
- /* @__PURE__ */ u3(
3618
- "span",
3619
- {
3620
- class: "profiler-text--xs",
3621
- style: `color:${levelColor(entry.level)};font-weight:600;min-width:40px;`,
3622
- children: entry.level
3623
- }
3624
- ),
3625
- /* @__PURE__ */ u3(
3626
- "span",
3627
- {
3628
- class: "profiler-text--xs profiler-text--truncate",
3629
- style: "flex:1;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",
3630
- children: entry.message
3631
- }
3632
- )
3633
- ] }, i3)),
3634
- logData.count > 5 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3635
- "+ ",
3636
- logData.count - 5,
3637
- " more messages"
3638
- ] })
3639
- ] })
3640
- ] });
3641
- }
3642
-
3643
- // app/assets/typescript/profiler/components/toolbar/panels/ExceptionPanel.tsx
3644
- function ExceptionPanel({ exceptionData }) {
3645
- const firstAppFrame = exceptionData.backtrace?.find((f4) => f4.app_frame);
3646
- return /* @__PURE__ */ u3(k, { children: [
3647
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", style: "color:var(--profiler-error,#ef4444);", children: [
3648
- "\u{1F4A5} ",
3649
- exceptionData.exception_class
3650
- ] }),
3651
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", style: "flex-direction:column;align-items:flex-start;gap:4px;", children: [
3652
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs", style: "max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", children: exceptionData.message }),
3653
- firstAppFrame && /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", style: "max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", children: firstAppFrame.location })
3654
- ] }) })
3655
- ] });
3656
- }
3657
-
3658
- // app/assets/typescript/profiler/components/toolbar/panels/RoutesPanel.tsx
3659
- function RoutesPanel({ routesData }) {
3660
- const { total, matched } = routesData;
3661
- return /* @__PURE__ */ u3(k, { children: [
3662
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3663
- "Routes",
3664
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3665
- total,
3666
- " routes"
3667
- ] })
3668
- ] }),
3669
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: matched ? /* @__PURE__ */ u3(k, { children: [
3670
- /* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Matched Route" }),
3671
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3672
- /* @__PURE__ */ u3("span", { children: "Pattern" }),
3673
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: matched.pattern })
3674
- ] }),
3675
- matched.name && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3676
- /* @__PURE__ */ u3("span", { children: "Name" }),
3677
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: [
3678
- matched.name,
3679
- "_path"
3680
- ] })
3681
- ] }),
3682
- matched.controller_action && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3683
- /* @__PURE__ */ u3("span", { children: "Controller#Action" }),
3684
- /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: matched.controller_action })
3685
- ] })
3686
- ] }) : /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: /* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: "No route matched" }) }) })
3687
- ] });
3688
- }
3689
-
3690
- // app/assets/typescript/profiler/components/toolbar/panels/I18nPanel.tsx
3691
- function I18nPanel({ i18nData }) {
3692
- const missing = i18nData.lookups.filter((l3) => l3.missing);
3693
- const ok = i18nData.lookups.filter((l3) => !l3.missing);
3694
- const prioritized = [...missing, ...ok].slice(0, 5);
3695
- const remaining = i18nData.total - 5;
3696
- return /* @__PURE__ */ u3(k, { children: [
3697
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3698
- "I18n",
3699
- /* @__PURE__ */ u3("span", { style: "margin-left:6px;font-weight:400;color:var(--profiler-muted,#6b7280);", children: [
3700
- "[",
3701
- i18nData.locale,
3702
- "]"
3703
- ] }),
3704
- i18nData.missing_count > 0 && /* @__PURE__ */ u3("span", { style: "color:var(--profiler-error,#ef4444);margin-left:8px;", children: [
3705
- i18nData.missing_count,
3706
- " missing"
3707
- ] })
3708
- ] }),
3709
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3710
- prioritized.map((entry, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", style: "align-items:flex-start;gap:6px;", children: [
3711
- /* @__PURE__ */ u3(
3712
- "span",
3713
- {
3714
- class: "profiler-text--xs profiler-text--truncate",
3715
- style: `flex:1;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;${entry.missing ? "color:var(--profiler-error,#ef4444);" : ""}`,
3716
- children: entry.key
3717
- }
3718
- ),
3719
- entry.missing && /* @__PURE__ */ u3("span", { class: "profiler-text--xs", style: "color:var(--profiler-error,#ef4444);font-weight:600;", children: "\u26A0" })
3720
- ] }, i3)),
3721
- remaining > 0 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3722
- "+ ",
3723
- remaining,
3724
- " more keys"
3725
- ] })
3726
- ] })
3727
- ] });
3728
- }
3729
-
3730
- // app/assets/typescript/profiler/components/toolbar/panels/JobsPanel.tsx
3731
- function JobStatus({ job }) {
3732
- if (job.status === "running") {
3733
- return /* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono profiler-text--info", children: [
3734
- /* @__PURE__ */ u3("span", { class: "profiler-spinner", "aria-hidden": "true", children: "\u25D0" }),
3735
- " running"
3736
- ] });
3737
- }
3738
- const failed = job.status === "failed";
3739
- return /* @__PURE__ */ u3("strong", { class: `profiler-text--xs profiler-text--mono ${failed ? "profiler-text--error" : "profiler-text--success"}`, children: [
3740
- failed ? "\u2717" : "\u2713",
3741
- " ",
3742
- job.duration?.toFixed(0),
3743
- "ms"
3744
- ] });
3745
- }
3746
- function JobsPanel({ jobs }) {
3747
- const running = jobs.filter((j3) => j3.status === "running").length;
3748
- const completed = jobs.filter((j3) => j3.status === "completed").length;
3749
- const failed = jobs.filter((j3) => j3.status === "failed").length;
3750
- const preview = jobs.slice(0, 5);
3751
- const remaining = jobs.length - 5;
3752
- return /* @__PURE__ */ u3(k, { children: [
3753
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3754
- "Background Jobs",
3755
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3756
- jobs.length,
3757
- " job",
3758
- jobs.length !== 1 ? "s" : ""
3759
- ] })
3760
- ] }),
3761
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3762
- /* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Summary" }),
3763
- running > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3764
- /* @__PURE__ */ u3("span", { children: "Running" }),
3765
- /* @__PURE__ */ u3("strong", { class: "profiler-text--info", children: running })
3766
- ] }),
3767
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3768
- /* @__PURE__ */ u3("span", { children: "Completed" }),
3769
- /* @__PURE__ */ u3("strong", { class: completed > 0 ? "profiler-text--success" : "profiler-text--muted", children: completed })
3770
- ] }),
3771
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3772
- /* @__PURE__ */ u3("span", { children: "Failed" }),
3773
- /* @__PURE__ */ u3("strong", { class: failed > 0 ? "profiler-text--error" : "profiler-text--muted", children: failed })
3774
- ] }),
3775
- /* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Last jobs" }),
3776
- preview.map((job, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3777
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: job.job_class }),
3778
- /* @__PURE__ */ u3(JobStatus, { job })
3779
- ] }, i3)),
3780
- remaining > 0 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
3781
- "+ ",
3782
- remaining,
3783
- " more"
3784
- ] })
3785
- ] })
3786
- ] });
3787
- }
3788
-
3789
- // app/assets/typescript/profiler/components/toolbar/panels/EnvPanel.tsx
3790
- function EnvPanel({ envData }) {
3791
- return /* @__PURE__ */ u3(k, { children: [
3792
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: "Environment" }),
3793
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3794
- /* @__PURE__ */ u3("span", { children: "Variables" }),
3795
- /* @__PURE__ */ u3("strong", { children: envData.total })
3796
- ] }) })
3797
- ] });
3798
- }
3799
-
3800
- // app/assets/typescript/profiler/components/toolbar/panels/MailerPanel.tsx
3801
- function MailerPanel({ mailerData }) {
3802
- const hasErrors = mailerData.failed > 0 || mailerData.loop_warnings.length > 0;
3803
- return /* @__PURE__ */ u3(k, { children: [
3804
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
3805
- "Mailers",
3806
- /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
3807
- mailerData.total,
3808
- " email",
3809
- mailerData.total !== 1 ? "s" : ""
3810
- ] })
3811
- ] }),
3812
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3813
- mailerData.deliver_now > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3814
- /* @__PURE__ */ u3("span", { children: "deliver_now" }),
3815
- /* @__PURE__ */ u3("strong", { children: mailerData.deliver_now })
3816
- ] }),
3817
- mailerData.deliver_later > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3818
- /* @__PURE__ */ u3("span", { children: "deliver_later" }),
3819
- /* @__PURE__ */ u3("strong", { children: mailerData.deliver_later })
3820
- ] }),
3821
- (mailerData.queued_count ?? 0) > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3822
- /* @__PURE__ */ u3("span", { children: "Queued" }),
3823
- /* @__PURE__ */ u3("strong", { children: mailerData.queued_count })
3824
- ] }),
3825
- mailerData.multi_part_count > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3826
- /* @__PURE__ */ u3("span", { children: "Multi-part" }),
3827
- /* @__PURE__ */ u3("strong", { children: mailerData.multi_part_count })
3828
- ] }),
3829
- mailerData.failed > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3830
- /* @__PURE__ */ u3("span", { children: "Errors" }),
3831
- /* @__PURE__ */ u3("strong", { class: "profiler-text--error", children: mailerData.failed })
3832
- ] }),
3833
- mailerData.loop_warnings.length > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3834
- /* @__PURE__ */ u3("span", { class: "profiler-text--warning", children: "\u26A0\uFE0F Loop detected" }),
3835
- /* @__PURE__ */ u3("strong", { class: "profiler-text--warning", children: mailerData.loop_warnings.length })
3836
- ] }),
3837
- [...mailerData.emails, ...mailerData.errors].slice(0, 3).map((email, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row profiler-text--sm", children: [
3838
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: [
3839
- email.mailer_class,
3840
- "#",
3841
- email.action
3842
- ] }),
3843
- /* @__PURE__ */ u3("span", { class: email.error ? "profiler-text--error" : "profiler-text--success", children: email.error ? "\u274C" : "\u2705" })
3844
- ] }, i3)),
3845
- mailerData.total > 3 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row profiler-text--muted profiler-text--xs", children: [
3846
- "+",
3847
- mailerData.total - 3,
3848
- " more\u2026"
3849
- ] })
3850
- ] })
3851
- ] });
3852
- }
3853
-
3854
- // app/assets/typescript/profiler/dashboard/utils.ts
3855
- function allocatedObjects(profile) {
3856
- if (profile.allocated_objects != null) return profile.allocated_objects;
3857
- return profile.memory != null ? Math.round(profile.memory / 40) : null;
3858
- }
3859
- function formatAllocations(count) {
3860
- return count == null ? "-" : `${count.toLocaleString("en")} objects`;
3861
- }
3862
- var ALLOCATIONS_HINT = "Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";
3863
-
3864
- // app/assets/typescript/profiler/components/toolbar/ToolbarApp.tsx
3865
- function statusClass2(status) {
3866
- if (status >= 200 && status < 300) return "profiler-text--success";
3867
- if (status >= 300 && status < 400) return "profiler-text--warning";
3868
- if (status >= 400) return "profiler-text--error";
3869
- return "";
3870
- }
3871
- function durationClass(duration) {
3872
- if (duration < 100) return "profiler-text--success";
3873
- if (duration < 500) return "profiler-text--warning";
3874
- return "profiler-text--error";
3875
- }
3876
- function formatTime(iso) {
3877
- return new Date(iso).toLocaleTimeString("en", {
3878
- hour12: false,
3879
- hour: "2-digit",
3880
- minute: "2-digit",
3881
- second: "2-digit"
3882
- });
3883
- }
3884
- function ToolbarApp({ profile, token }) {
3885
- const cd = profile.collectors_data || {};
3886
- const requestData = cd["request"];
3887
- const dbData = cd["database"];
3888
- const ajaxData = cd["ajax"];
3889
- const perfData = cd["performance"];
3890
- const viewData = cd["view"];
3891
- const cacheData = cd["cache"];
3892
- const dumpData = cd["dump"];
3893
- const httpData = cd["http"];
3894
- const logData = cd["logs"];
3895
- const exceptionData = cd["exception"];
3896
- const routesData = cd["routes"];
3897
- const i18nData = cd["i18n"];
3898
- const envData = cd["env"];
3899
- const mailerData = cd["mailer"];
3900
- const childJobs = profile.child_jobs ?? [];
3901
- const reqClass = statusClass2(profile.status);
3902
- const durClass = durationClass(profile.duration);
3903
- const dbClass = (dbData?.slow_queries ?? 0) > 0 ? "profiler-text--error" : "profiler-text--success";
3904
- const ajaxClass = (ajaxData?.total_requests ?? 0) > 20 ? "profiler-text--error" : "profiler-text--success";
3905
- const cacheClass = (cacheData?.hit_rate ?? 0) > 80 ? "profiler-text--success" : "profiler-text--warning";
3906
- return /* @__PURE__ */ u3(k, { children: /* @__PURE__ */ u3("div", { class: "profiler-toolbar-container", children: [
3907
- requestData && /* @__PURE__ */ u3(k, { children: [
3908
- /* @__PURE__ */ u3(
3909
- ToolbarItem,
3910
- {
3911
- href: `/_profiler/profiles/${token}?tab=request`,
3912
- className: reqClass,
3913
- panelLarge: true,
3914
- panel: /* @__PURE__ */ u3(RequestPanel, { profile, requestData }),
3915
- children: [
3916
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: profile.method }),
3917
- /* @__PURE__ */ u3("span", { children: profile.status })
3918
- ]
3919
- }
3920
- ),
3921
- /* @__PURE__ */ u3(
3922
- ToolbarItem,
3923
- {
3924
- href: `/_profiler/profiles/${token}?tab=request`,
3925
- className: durClass,
3926
- panel: /* @__PURE__ */ u3(k, { children: [
3927
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: "Performance" }),
3928
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
3929
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3930
- /* @__PURE__ */ u3("span", { children: "Duration" }),
3931
- /* @__PURE__ */ u3("strong", { class: durClass, children: [
3932
- profile.duration.toFixed(2),
3933
- " ms"
3934
- ] })
3935
- ] }),
3936
- allocatedObjects(profile) != null && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", title: ALLOCATIONS_HINT, children: [
3937
- /* @__PURE__ */ u3("span", { children: "Allocations" }),
3938
- /* @__PURE__ */ u3("strong", { children: formatAllocations(allocatedObjects(profile)) })
3939
- ] }),
3940
- /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
3941
- /* @__PURE__ */ u3("span", { children: "Started" }),
3942
- /* @__PURE__ */ u3("strong", { children: formatTime(profile.started_at) })
3943
- ] })
3944
- ] })
3945
- ] }),
3946
- children: [
3947
- /* @__PURE__ */ u3("span", { class: durClass, children: profile.duration.toFixed(2) }),
3948
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "ms" })
3949
- ]
3950
- }
3951
- )
3952
- ] }),
3953
- dbData?.total_queries !== void 0 && /* @__PURE__ */ u3(
3954
- ToolbarItem,
3955
- {
3956
- href: `/_profiler/profiles/${token}?tab=database`,
3957
- className: dbClass,
3958
- panelLarge: true,
3959
- panel: /* @__PURE__ */ u3(DatabasePanel, { dbData }),
3960
- children: [
3961
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "DB" }),
3962
- /* @__PURE__ */ u3("span", { children: dbData.total_queries }),
3963
- (dbData.slow_queries ?? 0) > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
3964
- "\u25B2 ",
3965
- dbData.slow_queries
3966
- ] }),
3967
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
3968
- dbData.total_duration.toFixed(1),
3969
- "ms"
3970
- ] })
3971
- ]
3972
- }
3973
- ),
3974
- ajaxData && ajaxData.total_requests > 0 && /* @__PURE__ */ u3(
3975
- ToolbarItem,
3976
- {
3977
- href: `/_profiler/profiles/${token}?tab=ajax`,
3978
- className: ajaxClass,
3979
- panelLarge: true,
3980
- panel: /* @__PURE__ */ u3(AjaxPanel, { ajaxData }),
3981
- children: [
3982
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "XHR" }),
3983
- /* @__PURE__ */ u3("span", { children: ajaxData.total_requests }),
3984
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
3985
- ajaxData.total_duration.toFixed(1),
3986
- "ms"
3987
- ] })
3988
- ]
3989
- }
3990
- ),
3991
- perfData?.events && perfData.total_events > 0 && /* @__PURE__ */ u3(
3992
- ToolbarItem,
3993
- {
3994
- href: `/_profiler/profiles/${token}?tab=timeline`,
3995
- panel: /* @__PURE__ */ u3(EventsPanel, { perfData }),
3996
- children: [
3997
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "EVT" }),
3998
- /* @__PURE__ */ u3("span", { children: perfData.total_events })
3999
- ]
4000
- }
4001
- ),
4002
- viewData?.total_views !== void 0 && /* @__PURE__ */ u3(
4003
- ToolbarItem,
4004
- {
4005
- href: `/_profiler/profiles/${token}?tab=views`,
4006
- panel: /* @__PURE__ */ u3(ViewsPanel, { viewData }),
4007
- children: [
4008
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "VIEW" }),
4009
- /* @__PURE__ */ u3("span", { children: viewData.total_views }),
4010
- viewData.total_partials > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
4011
- "+",
4012
- viewData.total_partials,
4013
- "p"
4014
- ] })
4015
- ]
4016
- }
4017
- ),
4018
- cacheData && cacheData.total_reads > 0 && /* @__PURE__ */ u3(
4019
- ToolbarItem,
4020
- {
4021
- href: `/_profiler/profiles/${token}?tab=cache`,
4022
- className: cacheClass,
4023
- panel: /* @__PURE__ */ u3(CachePanel, { cacheData }),
4024
- children: [
4025
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "CACHE" }),
4026
- /* @__PURE__ */ u3("span", { class: cacheClass, children: [
4027
- cacheData.hit_rate,
4028
- "%"
4029
- ] })
4030
- ]
4031
- }
4032
- ),
4033
- httpData && httpData.total_requests > 0 && /* @__PURE__ */ u3(
4034
- ToolbarItem,
4035
- {
4036
- href: `/_profiler/profiles/${token}?tab=http`,
4037
- className: httpData.error_requests > 0 || httpData.slow_requests > 0 ? "profiler-text--error" : "profiler-text--success",
4038
- panelLarge: true,
4039
- panel: /* @__PURE__ */ u3(HttpPanel, { httpData }),
4040
- children: [
4041
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "HTTP" }),
4042
- /* @__PURE__ */ u3("span", { children: httpData.total_requests }),
4043
- httpData.slow_requests > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
4044
- "\u25B2 ",
4045
- httpData.slow_requests
4046
- ] }),
4047
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
4048
- httpData.total_duration.toFixed(1),
4049
- "ms"
4050
- ] })
4051
- ]
4052
- }
4053
- ),
4054
- dumpData && dumpData.count > 0 && /* @__PURE__ */ u3(
4055
- ToolbarItem,
4056
- {
4057
- href: `/_profiler/profiles/${token}?tab=dump`,
4058
- className: "profiler-text--warning",
4059
- panelLarge: true,
4060
- panel: /* @__PURE__ */ u3(DumpsPanel, { dumpData }),
4061
- children: [
4062
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "DUMP" }),
4063
- /* @__PURE__ */ u3("span", { class: "profiler-text--warning", children: dumpData.count })
4064
- ]
4065
- }
4066
- ),
4067
- logData && logData.count > 0 && /* @__PURE__ */ u3(
4068
- ToolbarItem,
4069
- {
4070
- href: `/_profiler/profiles/${token}?tab=logs`,
4071
- className: logData.errors > 0 ? "profiler-text--error" : logData.warnings > 0 ? "profiler-text--warning" : "profiler-text--muted",
4072
- panelLarge: true,
4073
- panel: /* @__PURE__ */ u3(LogsPanel, { logData }),
4074
- children: [
4075
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "LOG" }),
4076
- /* @__PURE__ */ u3("span", { class: logData.errors > 0 ? "profiler-text--error" : logData.warnings > 0 ? "profiler-text--warning" : "", children: logData.errors > 0 ? logData.errors : logData.warnings > 0 ? logData.warnings : logData.count })
4077
- ]
4078
- }
4079
- ),
4080
- exceptionData && exceptionData.exception_class && /* @__PURE__ */ u3(
4081
- ToolbarItem,
4082
- {
4083
- href: `/_profiler/profiles/${token}?tab=exception`,
4084
- className: "profiler-text--error",
4085
- panelLarge: true,
4086
- panel: /* @__PURE__ */ u3(ExceptionPanel, { exceptionData }),
4087
- children: [
4088
- /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: "\u{1F4A5}" }),
4089
- /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: exceptionData.exception_class.split("::").pop() })
4090
- ]
4091
- }
4092
- ),
4093
- routesData && routesData.total > 0 && /* @__PURE__ */ u3(
4094
- ToolbarItem,
4095
- {
4096
- href: `/_profiler/profiles/${token}?tab=routes`,
4097
- panelLarge: true,
4098
- panel: /* @__PURE__ */ u3(RoutesPanel, { routesData }),
4099
- children: [
4100
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "ROUTE" }),
4101
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: routesData.matched?.pattern ?? "-" })
4102
- ]
4103
- }
4104
- ),
4105
- i18nData && i18nData.total > 0 && /* @__PURE__ */ u3(
4106
- ToolbarItem,
4107
- {
4108
- href: `/_profiler/profiles/${token}?tab=i18n`,
4109
- className: i18nData.missing_count > 0 ? "profiler-text--error" : "profiler-text--muted",
4110
- panel: /* @__PURE__ */ u3(I18nPanel, { i18nData }),
4111
- children: [
4112
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "I18N" }),
4113
- /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: i18nData.locale }),
4114
- i18nData.missing_count > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
4115
- "\u26A0 ",
4116
- i18nData.missing_count
4117
- ] })
4118
- ]
4119
- }
4120
- ),
4121
- childJobs.length > 0 && /* @__PURE__ */ u3(
4122
- ToolbarItem,
4123
- {
4124
- href: `/_profiler/profiles/${token}?tab=jobs`,
4125
- className: childJobs.some((j3) => j3.status === "failed") ? "profiler-text--error" : childJobs.some((j3) => j3.status === "running") ? "profiler-text--info" : "profiler-text--success",
4126
- panelLarge: true,
4127
- panel: /* @__PURE__ */ u3(JobsPanel, { jobs: childJobs }),
4128
- children: [
4129
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "JOB" }),
4130
- /* @__PURE__ */ u3("span", { children: childJobs.length }),
4131
- childJobs.some((j3) => j3.status === "failed") && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: "\u2717" }),
4132
- childJobs.some((j3) => j3.status === "running") && /* @__PURE__ */ u3("span", { class: "profiler-spinner profiler-text--info profiler-text--xs", "aria-hidden": "true", children: "\u25D0" })
4133
- ]
4134
- }
4135
- ),
4136
- mailerData && (mailerData.total > 0 || (mailerData.queued_count ?? 0) > 0) && /* @__PURE__ */ u3(
4137
- ToolbarItem,
4138
- {
4139
- href: `/_profiler/profiles/${token}?tab=mailer`,
4140
- className: mailerData.failed > 0 ? "profiler-text--error" : "profiler-text--success",
4141
- panelLarge: true,
4142
- panel: /* @__PURE__ */ u3(MailerPanel, { mailerData }),
4143
- children: [
4144
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "MAIL" }),
4145
- mailerData.total > 0 && /* @__PURE__ */ u3("span", { children: mailerData.total }),
4146
- mailerData.total === 0 && (mailerData.queued_count ?? 0) > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: [
4147
- mailerData.queued_count,
4148
- "q"
4149
- ] }),
4150
- mailerData.total > 0 && (mailerData.queued_count ?? 0) > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
4151
- "+",
4152
- mailerData.queued_count,
4153
- "q"
4154
- ] }),
4155
- mailerData.failed > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
4156
- "\u25B2 ",
4157
- mailerData.failed
4158
- ] })
4159
- ]
4160
- }
4161
- ),
4162
- envData && envData.total > 0 && /* @__PURE__ */ u3(
4163
- ToolbarItem,
4164
- {
4165
- href: `/_profiler/profiles/${token}?tab=env`,
4166
- panel: /* @__PURE__ */ u3(EnvPanel, { envData }),
4167
- children: [
4168
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "ENV" }),
4169
- /* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: envData.total })
4170
- ]
4171
- }
4172
- ),
4173
- /* @__PURE__ */ u3("a", { href: "/_profiler", class: "profiler-toolbar-item profiler-toolbar-logo", children: "\u2B21 Profiler" })
4174
- ] }) });
4175
- }
4176
-
4177
- // app/assets/typescript/profiler/cluster-context.ts
4178
- var STORAGE_KEY = "profiler-active-slave";
4179
- var activeSlavePrefix = (() => {
4180
- try {
4181
- const stored = sessionStorage.getItem(STORAGE_KEY);
4182
- return stored ? `/slaves/${stored}` : "";
4183
- } catch {
4184
- return "";
4185
- }
4186
- })();
4187
- function getActiveSlavePrefix() {
4188
- return activeSlavePrefix;
4189
- }
4190
-
4191
- // app/assets/typescript/profiler/api-fetcher.ts
4192
- async function apiFetch(config) {
4193
- const prefix = getActiveSlavePrefix();
4194
- const resolvedUrl = prefix ? config.url.replace("/_profiler/api", `/_profiler/api${prefix}`) : config.url;
4195
- const { method, params, data, headers = {}, signal } = config;
4196
- const url = resolvedUrl;
4197
- const qs = params ? "?" + new URLSearchParams(Object.entries(params).map(([k3, v3]) => [k3, String(v3)])).toString() : "";
4198
- const baseHeaders = { "X-Profiler-Request": "1", ...headers };
4199
- const res = await fetch(url + qs, {
4200
- method,
4201
- signal,
4202
- headers: data !== void 0 ? { "Content-Type": "application/json", ...baseHeaders } : baseHeaders,
4203
- body: data !== void 0 ? JSON.stringify(data) : void 0
4204
- });
4205
- if (res.status === 204) return {};
4206
- const json = await res.json();
4207
- if (!res.ok) {
4208
- throw Object.assign(new Error(json?.error ?? `HTTP ${res.status}`), { status: res.status, data: json });
4209
- }
4210
- return json;
4211
- }
4212
-
4213
- // app/assets/typescript/profiler/generated/api.ts
4214
- var withQueryKey = (query, queryKey) => {
4215
- const result = { queryKey };
4216
- for (const key of Object.keys(query)) {
4217
- if (key === "queryKey") continue;
4218
- Object.defineProperty(result, key, {
4219
- enumerable: true,
4220
- configurable: true,
4221
- get: () => query[key]
4222
- });
4223
- }
4224
- return result;
4225
- };
4226
- var getToolbar = (token, signal) => {
4227
- return apiFetch(
4228
- {
4229
- url: `/_profiler/api/toolbar/${token}`,
4230
- method: "GET",
4231
- signal
4232
- }
4233
- );
4234
- };
4235
- var getGetToolbarQueryKey = (token) => {
4236
- return [
4237
- `/_profiler/api/toolbar/${token}`
4238
- ];
4239
- };
4240
- var getGetToolbarQueryOptions = (token, options) => {
4241
- const { query: queryOptions } = options ?? {};
4242
- const queryKey = queryOptions?.queryKey ?? getGetToolbarQueryKey(token);
4243
- const queryFn = ({ signal }) => getToolbar(token, signal);
4244
- return { queryKey, queryFn, enabled: token !== null && token !== void 0, ...queryOptions };
4245
- };
4246
- function useGetToolbar(token, options) {
4247
- const queryOptions = getGetToolbarQueryOptions(token, options);
4248
- const query = useQuery(queryOptions);
4249
- return withQueryKey(query, queryOptions.queryKey);
4250
- }
4251
-
4252
- // app/assets/typescript/profiler/hooks/profileUpdatePoller.ts
4253
- var POLL_DELAYS_MS = [1e3, 1e3, 2e3, 2e3, 4e3, 4e3, 8e3, 8e3, 15e3, 15e3];
4254
- var STEADY_DELAY_MS = 3e4;
4255
- var GIVE_UP_AFTER_MS = 10 * 6e4;
4256
- function isValidAnswer(answer) {
4257
- return typeof answer === "object" && answer !== null && Number.isFinite(answer.cursor);
4258
- }
4259
- function startProfileUpdatePoller(options) {
4260
- const now = options.now ?? (() => Date.now());
4261
- const setTimer = options.setTimer ?? ((fn, ms) => setTimeout(fn, ms));
4262
- const clearTimer = options.clearTimer ?? ((timer2) => clearTimeout(timer2));
4263
- let cursor = options.cursor;
4264
- let step = 0;
4265
- let lastSaveAt = now();
4266
- let timer = null;
4267
- let paused = false;
4268
- let stopped = false;
4269
- let inFlight = false;
4270
- const cancelTimer = () => {
4271
- if (timer !== null) {
4272
- clearTimer(timer);
4273
- timer = null;
4274
- }
4275
- };
4276
- const scheduleNext = () => {
4277
- cancelTimer();
4278
- if (stopped || paused) return;
4279
- if (now() - lastSaveAt >= GIVE_UP_AFTER_MS) return;
4280
- const delay = step < POLL_DELAYS_MS.length ? POLL_DELAYS_MS[step] : STEADY_DELAY_MS;
4281
- step += 1;
4282
- timer = setTimer(() => {
4283
- timer = null;
4284
- void checkNow();
4285
- }, delay);
4286
- };
4287
- const checkNow = async () => {
4288
- if (stopped || inFlight) return;
4289
- inFlight = true;
4290
- try {
4291
- const answer = await options.check(cursor);
4292
- if (stopped) return;
4293
- if (isValidAnswer(answer)) {
4294
- cursor = Math.max(cursor, answer.cursor);
4295
- if (answer.updated === true) {
4296
- step = 0;
4297
- lastSaveAt = now();
4298
- options.onUpdate();
4299
- }
4300
- }
4301
- } catch {
4302
- } finally {
4303
- inFlight = false;
4304
- }
4305
- scheduleNext();
4306
- };
4307
- scheduleNext();
4308
- return {
4309
- pause() {
4310
- paused = true;
4311
- cancelTimer();
4312
- },
4313
- resume() {
4314
- if (stopped) return;
4315
- paused = false;
4316
- cancelTimer();
4317
- void checkNow();
4318
- },
4319
- stop() {
4320
- stopped = true;
4321
- cancelTimer();
4322
- }
4323
- };
4324
- }
4325
-
4326
- // app/assets/typescript/profiler/hooks/useProfileEvents.ts
4327
- var BASE = "/_profiler";
4328
- function useProfileEvents(token, cursor, onUpdate) {
4329
- const onUpdateRef = A2(onUpdate);
4330
- onUpdateRef.current = onUpdate;
4331
- const ready = cursor !== void 0;
4332
- y2(() => {
4333
- if (!token || cursor === void 0) return;
4334
- const poller = startProfileUpdatePoller({
4335
- cursor,
4336
- check: (since) => apiFetch({
4337
- url: `${BASE}/api/events/${encodeURIComponent(token)}`,
4338
- method: "GET",
4339
- params: { since }
4340
- }),
4341
- onUpdate: () => onUpdateRef.current()
4342
- });
4343
- const onVisibilityChange = () => {
4344
- if (document.hidden) poller.pause();
4345
- else poller.resume();
4346
- };
4347
- document.addEventListener("visibilitychange", onVisibilityChange);
4348
- if (document.hidden) poller.pause();
4349
- return () => {
4350
- document.removeEventListener("visibilitychange", onVisibilityChange);
4351
- poller.stop();
4352
- };
4353
- }, [token, ready]);
4354
- }
4355
-
4356
- // app/assets/typescript/profiler/toolbar-bundle.tsx
4357
- var ANIM_MS = 280;
4358
- function applyTheme(elements) {
4359
- const stored = localStorage.getItem("profiler-theme");
4360
- const theme = stored === "light" ? "light" : stored === "dark" ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
4361
- elements.forEach((el) => el.setAttribute("data-theme", theme));
4362
- }
4363
- var toolbarQueryClient = new QueryClient({
4364
- defaultOptions: { queries: { staleTime: 3e4, retry: 1 } }
4365
- });
4366
- function ToolbarMount({ token }) {
4367
- const { data, refetch } = useGetToolbar(token, { query: { refetchOnWindowFocus: false } });
4368
- y2(() => {
4369
- window.__PROFILER_REFRESH_TOOLBAR__ = () => {
4370
- refetch();
4371
- };
4372
- }, [refetch]);
4373
- useProfileEvents(token, data?.events_cursor, () => {
4374
- refetch();
4375
- });
4376
- const profile = data?.profile ?? null;
4377
- if (!profile) return null;
4378
- return /* @__PURE__ */ u3(ToolbarApp, { profile, token });
4379
- }
4380
- function mountToolbar() {
4381
- const el = document.getElementById("profiler-toolbar");
4382
- const toggleEl = document.getElementById("profiler-toolbar-toggle");
4383
- if (!el || !toggleEl) return;
4384
- const token = el.dataset.token;
4385
- if (!token) return;
4386
- window.__PROFILER_TOOLBAR_TEARDOWN__?.();
4387
- const listeners = new AbortController();
4388
- const { signal } = listeners;
4389
- const teardown = () => {
4390
- listeners.abort();
4391
- J(null, el);
4392
- if (window.__PROFILER_TOOLBAR_TEARDOWN__ === teardown) delete window.__PROFILER_TOOLBAR_TEARDOWN__;
4393
- };
4394
- window.__PROFILER_TOOLBAR_TEARDOWN__ = teardown;
4395
- document.addEventListener("turbo:load", () => {
4396
- if (!el.isConnected) teardown();
4397
- }, { signal });
4398
- const themeEls = [el, toggleEl];
4399
- applyTheme(themeEls);
4400
- window.addEventListener("storage", (e3) => {
4401
- if (e3.key === "profiler-theme") applyTheme(themeEls);
4402
- }, { signal });
4403
- window.addEventListener("profiler:theme-change", ((e3) => {
4404
- if (e3.detail?.theme) themeEls.forEach((elem) => elem.setAttribute("data-theme", e3.detail.theme));
4405
- }), { signal });
4406
- let isCollapsed = localStorage.getItem("profiler-toolbar-collapsed") === "true";
4407
- toggleEl.dataset.collapsed = String(isCollapsed);
4408
- if (isCollapsed && !el.style.transform) {
4409
- el.style.animation = "none";
4410
- el.style.transform = "translateX(calc(100% + 44px))";
4411
- }
4412
- if (!isCollapsed) {
4413
- setTimeout(() => {
4414
- el.style.animation = "none";
4415
- }, 400);
4416
- }
4417
- function toggleCollapse() {
4418
- const next = !isCollapsed;
4419
- isCollapsed = next;
4420
- localStorage.setItem("profiler-toolbar-collapsed", String(next));
4421
- toggleEl.dataset.collapsed = String(next);
4422
- if (next) {
4423
- el.style.transition = `transform ${ANIM_MS}ms cubic-bezier(0.4,0,0.2,1)`;
4424
- el.style.transform = "translateX(calc(100% + 44px))";
4425
- } else {
4426
- el.style.transition = "none";
4427
- el.style.transform = "translateX(calc(100% + 44px))";
4428
- void el.offsetWidth;
4429
- el.style.transition = `transform ${ANIM_MS}ms cubic-bezier(0.4,0,0.2,1)`;
4430
- el.style.transform = "translateX(0)";
4431
- setTimeout(() => {
4432
- el.style.transform = "";
4433
- el.style.transition = "";
4434
- }, ANIM_MS + 50);
4435
- }
4436
- }
4437
- toggleEl.addEventListener("click", toggleCollapse, { signal });
4438
- document.addEventListener("keydown", (e3) => {
4439
- if (e3.altKey && e3.key === "p") {
4440
- e3.preventDefault();
4441
- toggleCollapse();
4442
- }
4443
- }, { signal });
4444
- J(
4445
- /* @__PURE__ */ u3(QueryClientProvider, { client: toolbarQueryClient, children: /* @__PURE__ */ u3(ToolbarMount, { token }) }),
4446
- el
4447
- );
4448
- }
4449
- if (document.readyState === "loading") {
4450
- document.addEventListener("DOMContentLoaded", mountToolbar);
4451
- } else {
4452
- mountToolbar();
4453
- }
4454
- })();
1
+ "use strict";(()=>{var br=t=>{throw TypeError(t)};var Kt=(t,e,r)=>e.has(t)||br("Cannot "+r);var a=(t,e,r)=>(Kt(t,e,"read from private field"),r?r.call(t):e.get(t)),_=(t,e,r)=>e.has(t)?br("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),h=(t,e,r,o)=>(Kt(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r),E=(t,e,r)=>(Kt(t,e,"access private method"),r);var Ye=(t,e,r,o)=>({set _(i){h(t,e,i,r)},get _(){return a(t,e,o)}});var vt,P,Cr,fo,ue,Rr,Pr,Ar,Or,Lt,Ft,St,Qr,mt={},Tt=[],yo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,gt=Array.isArray;function oe(t,e){for(var r in e)t[r]=e[r];return t}function It(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function ho(t,e,r){var o,i,s,u={};for(s in e)s=="key"?o=e[s]:s=="ref"?i=e[s]:u[s]=e[s];if(arguments.length>2&&(u.children=arguments.length>3?vt.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)u[s]===void 0&&(u[s]=t.defaultProps[s]);return ht(t,u,o,i,null)}function ht(t,e,r,o,i){var s={type:t,props:e,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Cr,__i:-1,__u:0};return i==null&&P.vnode!=null&&P.vnode(s),s}function b(t){return t.children}function Me(t,e){this.props=t,this.context=e}function De(t,e){if(e==null)return t.__?De(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?De(t):null}function mo(t){if(t.__P&&t.__d){var e=t.__v,r=e.__e,o=[],i=[],s=oe({},e);s.__v=e.__v+1,P.vnode&&P.vnode(s),Vt(t.__P,s,e,t.__n,t.__P.namespaceURI,32&e.__u?[r]:null,o,r??De(e),!!(32&e.__u),i),s.__v=e.__v,s.__.__k[s.__i]=s,Kr(o,s,i),e.__e=e.__=null,s.__e!=r&&qr(s)}}function qr(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),qr(t)}function Ut(t){(!t.__d&&(t.__d=!0)&&ue.push(t)&&!_t.__r++||Rr!=P.debounceRendering)&&((Rr=P.debounceRendering)||Pr)(_t)}function _t(){try{for(var t,e=1;ue.length;)ue.length>e&&ue.sort(Ar),t=ue.shift(),e=ue.length,mo(t)}finally{ue.length=_t.__r=0}}function Mr(t,e,r,o,i,s,u,p,f,c,y){var l,m,d,T,x,v,g,R=o&&o.__k||Tt,q=e.length;for(f=To(r,e,R,f,q),l=0;l<q;l++)(d=r.__k[l])!=null&&(m=d.__i!=-1&&R[d.__i]||mt,d.__i=l,v=Vt(t,d,m,i,s,u,p,f,c,y),T=d.__e,d.ref&&m.ref!=d.ref&&(m.ref&&Nt(m.ref,null,d),y.push(d.ref,d.__c||T,d)),x==null&&T!=null&&(x=T),(g=!!(4&d.__u))||m.__k===d.__k?f=Dr(d,f,t,g):typeof d.type=="function"&&v!==void 0?f=v:T&&(f=T.nextSibling),d.__u&=-7);return r.__e=x,f}function To(t,e,r,o,i){var s,u,p,f,c,y=r.length,l=y,m=0;for(t.__k=new Array(i),s=0;s<i;s++)(u=e[s])!=null&&typeof u!="boolean"&&typeof u!="function"?(typeof u=="string"||typeof u=="number"||typeof u=="bigint"||u.constructor==String?u=t.__k[s]=ht(null,u,null,null,null):gt(u)?u=t.__k[s]=ht(b,{children:u},null,null,null):u.constructor===void 0&&u.__b>0?u=t.__k[s]=ht(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):t.__k[s]=u,f=s+m,u.__=t,u.__b=t.__b+1,p=null,(c=u.__i=_o(u,r,f,l))!=-1&&(l--,(p=r[c])&&(p.__u|=2)),p==null||p.__v==null?(c==-1&&(i>y?m--:i<y&&m++),typeof u.type!="function"&&(u.__u|=4)):c!=f&&(c==f-1?m--:c==f+1?m++:(c>f?m--:m++,u.__u|=4))):t.__k[s]=null;if(l)for(s=0;s<y;s++)(p=r[s])!=null&&(2&p.__u)==0&&(p.__e==o&&(o=De(p)),Sr(p,p));return o}function Dr(t,e,r,o){var i,s;if(typeof t.type=="function"){for(i=t.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=t,e=Dr(i[s],e,r,o));return e}t.__e!=e&&(o&&(e&&t.type&&!e.parentNode&&(e=De(t)),r.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function _o(t,e,r,o){var i,s,u,p=t.key,f=t.type,c=e[r],y=c!=null&&(2&c.__u)==0;if(c===null&&p==null||y&&p==c.key&&f==c.type)return r;if(o>(y?1:0)){for(i=r-1,s=r+1;i>=0||s<e.length;)if((c=e[u=i>=0?i--:s++])!=null&&(2&c.__u)==0&&p==c.key&&f==c.type)return u}return-1}function Er(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||yo.test(e)?r:r+"px"}function dt(t,e,r,o,i){var s,u;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)r&&e in r||Er(t.style,e,"");if(r)for(e in r)o&&r[e]==o[e]||Er(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Or,"$1")),u=e.toLowerCase(),e=u in t||e=="onFocusOut"||e=="onFocusIn"?u.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?o?r.u=o.u:(r.u=Lt,t.addEventListener(e,s?St:Ft,s)):t.removeEventListener(e,s?St:Ft,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function wr(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Lt++;else if(e.t<r.u)return;return r(P.event?P.event(e):e)}}}function Vt(t,e,r,o,i,s,u,p,f,c){var y,l,m,d,T,x,v,g,R,q,F,L,W,G,H,Q=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(f=!!(32&r.__u),s=[p=e.__e=r.__e]),(y=P.__b)&&y(e);e:if(typeof Q=="function")try{if(g=e.props,R=Q.prototype&&Q.prototype.render,q=(y=Q.contextType)&&o[y.__c],F=y?q?q.props.value:y.__:o,r.__c?v=(l=e.__c=r.__c).__=l.__E:(R?e.__c=l=new Q(g,F):(e.__c=l=new Me(g,F),l.constructor=Q,l.render=go),q&&q.sub(l),l.state||(l.state={}),l.__n=o,m=l.__d=!0,l.__h=[],l._sb=[]),R&&l.__s==null&&(l.__s=l.state),R&&Q.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=oe({},l.__s)),oe(l.__s,Q.getDerivedStateFromProps(g,l.__s))),d=l.props,T=l.state,l.__v=e,m)R&&Q.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),R&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(R&&Q.getDerivedStateFromProps==null&&g!==d&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,F),e.__v==r.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,F)===!1){e.__v!=r.__v&&(l.props=g,l.state=l.__s,l.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(B){B&&(B.__=e)}),Tt.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&u.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,F),R&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(d,T,x)})}if(l.context=F,l.props=g,l.__P=t,l.__e=!1,L=P.__r,W=0,R)l.state=l.__s,l.__d=!1,L&&L(e),y=l.render(l.props,l.state,l.context),Tt.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,L&&L(e),y=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++W<25);l.state=l.__s,l.getChildContext!=null&&(o=oe(oe({},o),l.getChildContext())),R&&!m&&l.getSnapshotBeforeUpdate!=null&&(x=l.getSnapshotBeforeUpdate(d,T)),G=y!=null&&y.type===b&&y.key==null?Fr(y.props.children):y,p=Mr(t,gt(G)?G:[G],e,r,o,i,s,u,p,f,c),l.base=e.__e,e.__u&=-161,l.__h.length&&u.push(l),v&&(l.__E=l.__=null)}catch(B){if(e.__v=null,f||s!=null)if(B.then){for(e.__u|=f?160:128;p&&p.nodeType==8&&p.nextSibling;)p=p.nextSibling;s[s.indexOf(p)]=null,e.__e=p}else{for(H=s.length;H--;)It(s[H]);kt(e)}else e.__e=r.__e,e.__k=r.__k,B.then||kt(e);P.__e(B,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):p=e.__e=vo(r.__e,e,r,o,i,s,u,f,c);return(y=P.diffed)&&y(e),128&e.__u?void 0:p}function kt(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(kt))}function Kr(t,e,r){for(var o=0;o<r.length;o++)Nt(r[o],r[++o],r[++o]);P.__c&&P.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){P.__e(s,i.__v)}})}function Fr(t){return typeof t!="object"||t==null||t.__b>0?t:gt(t)?t.map(Fr):oe({},t)}function vo(t,e,r,o,i,s,u,p,f){var c,y,l,m,d,T,x,v=r.props||mt,g=e.props,R=e.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((d=s[c])&&"setAttribute"in d==!!R&&(R?d.localName==R:d.nodeType==3)){t=d,s[c]=null;break}}if(t==null){if(R==null)return document.createTextNode(g);t=document.createElementNS(i,R,g.is&&g),p&&(P.__m&&P.__m(e,s),p=!1),s=null}if(R==null)v===g||p&&t.data==g||(t.data=g);else{if(s=s&&vt.call(t.childNodes),!p&&s!=null)for(v={},c=0;c<t.attributes.length;c++)v[(d=t.attributes[c]).name]=d.value;for(c in v)d=v[c],c=="dangerouslySetInnerHTML"?l=d:c=="children"||c in g||c=="value"&&"defaultValue"in g||c=="checked"&&"defaultChecked"in g||dt(t,c,null,d,i);for(c in g)d=g[c],c=="children"?m=d:c=="dangerouslySetInnerHTML"?y=d:c=="value"?T=d:c=="checked"?x=d:p&&typeof d!="function"||v[c]===d||dt(t,c,d,v[c],i);if(y)p||l&&(y.__html==l.__html||y.__html==t.innerHTML)||(t.innerHTML=y.__html),e.__k=[];else if(l&&(t.innerHTML=""),Mr(e.type=="template"?t.content:t,gt(m)?m:[m],e,r,o,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,u,s?s[0]:r.__k&&De(r,0),p,f),s!=null)for(c=s.length;c--;)It(s[c]);p||(c="value",R=="progress"&&T==null?t.removeAttribute("value"):T!=null&&(T!==t[c]||R=="progress"&&!T||R=="option"&&T!=v[c])&&dt(t,c,T,v[c],i),c="checked",x!=null&&x!=t[c]&&dt(t,c,x,v[c],i))}return t}function Nt(t,e,r){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(i){P.__e(i,r)}}function Sr(t,e,r){var o,i;if(P.unmount&&P.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||Nt(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){P.__e(s,e)}o.base=o.__P=null}if(o=t.__k)for(i=0;i<o.length;i++)o[i]&&Sr(o[i],e,r||typeof t.type!="function");r||It(t.__e),t.__c=t.__=t.__e=void 0}function go(t,e,r){return this.constructor(t,r)}function Gt(t,e,r){var o,i,s,u;e==document&&(e=document.documentElement),P.__&&P.__(t,e),i=(o=typeof r=="function")?null:r&&r.__k||e.__k,s=[],u=[],Vt(e,t=(!o&&r||e).__k=ho(b,null,[t]),i||mt,mt,e.namespaceURI,!o&&r?[r]:i?null:e.firstChild?vt.call(e.childNodes):null,s,!o&&r?r:i?i.__e:e.firstChild,o,u),Kr(s,t,u)}function Ke(t){function e(r){var o,i;return this.getChildContext||(o=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&o.forEach(function(u){u.__e=!0,Ut(u)})},this.sub=function(s){o.add(s);var u=s.componentWillUnmount;s.componentWillUnmount=function(){o&&o.delete(s),u&&u.call(s)}}),r.children}return e.__c="__cC"+Qr++,e.__=t,e.Provider=e.__l=(e.Consumer=function(r,o){return r.children(o)}).contextType=e,e}vt=Tt.slice,P={__e:function(t,e,r,o){for(var i,s,u;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),u=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,o||{}),u=i.__d),u)return i.__E=i}catch(p){t=p}throw t}},Cr=0,fo=function(t){return t!=null&&t.constructor===void 0},Me.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=oe({},this.state),typeof t=="function"&&(t=t(oe({},r),this.props)),t&&oe(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Ut(this))},Me.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ut(this))},Me.prototype.render=b,ue=[],Pr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ar=function(t,e){return t.__v.__b-e.__v.__b},_t.__r=0,Or=/(PointerCapture)$|Capture$/i,Lt=0,Ft=wr(!1),St=wr(!0),Qr=0;var Y=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var _e,le,Fe,Ur,xo=(Ur=class extends Y{constructor(){super();_(this,_e);_(this,le);_(this,Fe);h(this,Fe,e=>{if(typeof window<"u"&&window.addEventListener){let r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){a(this,le)||this.setEventListener(a(this,Fe))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,le))==null||e.call(this),h(this,le,void 0))}setEventListener(e){var r;h(this,Fe,e),(r=a(this,le))==null||r.call(this),h(this,le,e(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus()}))}setFocused(e){a(this,_e)!==e&&(h(this,_e,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){return typeof a(this,_e)=="boolean"?a(this,_e):globalThis.document?.visibilityState!=="hidden"}},_e=new WeakMap,le=new WeakMap,Fe=new WeakMap,Ur),Se=new xo;var bo={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},pe,jt,kr,Ro=(kr=class{constructor(){_(this,pe,bo);_(this,jt,!1)}setTimeoutProvider(t){h(this,pe,t)}setTimeout(t,e){return a(this,pe).setTimeout(t,e)}clearTimeout(t){a(this,pe).clearTimeout(t)}setInterval(t,e){return a(this,pe).setInterval(t,e)}clearInterval(t){a(this,pe).clearInterval(t)}},pe=new WeakMap,jt=new WeakMap,kr),Z=new Ro;function Lr(t){setTimeout(t,0)}var Bt=typeof window>"u"||"Deno"in globalThis;function K(){}function Nr(t,e){return typeof t=="function"?t(e):t}function Ze(t){return typeof t=="number"&&t>=0&&t!==1/0}function xt(t,e){return Math.max(t+(e||0)-Date.now(),0)}function z(t,e){return typeof t=="function"?t(e):t}function I(t,e){return typeof t=="function"?t(e):t}function bt(t,e){let{type:r="all",exact:o,fetchStatus:i,predicate:s,queryKey:u,stale:p}=t;if(u){if(o){if(e.queryHash!==et(u,e.options))return!1}else if(!ge(e.queryKey,u))return!1}if(r!=="all"){let f=e.isActive();if(r==="active"&&!f||r==="inactive"&&f)return!1}return!(typeof p=="boolean"&&e.isStale()!==p||i&&i!==e.state.fetchStatus||s&&!s(e))}function Rt(t,e){let{exact:r,status:o,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(ve(e.options.mutationKey)!==ve(s))return!1}else if(!ge(e.options.mutationKey,s))return!1}return!(o&&e.state.status!==o||i&&!i(e))}function et(t,e){return(e?.queryKeyHashFn||ve)(t)}function ve(t){return JSON.stringify(t,(e,r)=>Ht(r)?Object.keys(r).sort().reduce((o,i)=>(o[i]=r[i],o),{}):r)}function ge(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>ge(t[r],e[r])):!1}var Eo=Object.prototype.hasOwnProperty;function Jt(t,e,r=0){if(t===e)return t;if(r>500)return e;let o=Ir(t)&&Ir(e);if(!o&&!(Ht(t)&&Ht(e)))return e;let s=(o?t:Object.keys(t)).length,u=o?e:Object.keys(e),p=u.length,f=o?new Array(p):{},c=0;for(let y=0;y<p;y++){let l=o?y:u[y],m=t[l],d=e[l];if(m===d){f[l]=m,(o?y<s:Eo.call(t,l))&&c++;continue}if(m===null||d===null||typeof m!="object"||typeof d!="object"){f[l]=d;continue}let T=Jt(m,d,r+1);f[l]=T,T===m&&c++}return s===p&&c===s?t:f}function Et(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(t[r]!==e[r])return!1;return!0}function Ir(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Ht(t){if(!Vr(t))return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(!Vr(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Vr(t){return Object.prototype.toString.call(t)==="[object Object]"}function Gr(t){return new Promise(e=>{Z.setTimeout(e,t)})}function tt(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Jt(t,e):e}function jr(t,e,r=0){let o=[...t,e];return r&&o.length>r?o.slice(1):o}function Hr(t,e,r=0){let o=[e,...t];return r&&o.length>r?o.slice(0,-1):o}var Ue=Symbol();function wt(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Ue?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function $t(t,e){return typeof t=="function"?t(...e):!!t}function Br(t,e,r){let o=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),o||(o=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),t}var ee=(()=>{let t=()=>Bt;return{isServer(){return t()},setIsServer(e){t=e}}})();function rt(){let t,e,r=new Promise((i,s)=>{t=i,e=s});r.status="pending",r.catch(()=>{});function o(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{o({status:"fulfilled",value:i}),t(i)},r.reject=i=>{o({status:"rejected",reason:i}),e(i)},r}var Jr=Lr;function wo(){let t=[],e=0,r=p=>{p()},o=p=>{p()},i=Jr,s=p=>{e?t.push(p):i(()=>{r(p)})},u=()=>{let p=t;t=[],p.length&&i(()=>{o(()=>{p.forEach(f=>{r(f)})})})};return{batch:p=>{let f;e++;try{f=p()}finally{e--,e||u()}return f},batchCalls:p=>(...f)=>{s(()=>{p(...f)})},schedule:s,setNotifyFunction:p=>{r=p},setBatchNotifyFunction:p=>{o=p},setScheduler:p=>{i=p}}}var A=wo();var ke,ce,Le,$r,Co=($r=class extends Y{constructor(){super();_(this,ke,!0);_(this,ce);_(this,Le);h(this,Le,e=>{if(typeof window<"u"&&window.addEventListener){let r=()=>e(!0),o=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}}})}onSubscribe(){a(this,ce)||this.setEventListener(a(this,Le))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,ce))==null||e.call(this),h(this,ce,void 0))}setEventListener(e){var r;h(this,Le,e),(r=a(this,ce))==null||r.call(this),h(this,ce,e(this.setOnline.bind(this)))}setOnline(e){a(this,ke)!==e&&(h(this,ke,e),this.listeners.forEach(o=>{o(e)}))}isOnline(){return a(this,ke)}},ke=new WeakMap,ce=new WeakMap,Le=new WeakMap,$r),Ie=new Co;function Po(t){return Math.min(1e3*2**t,3e4)}function Wt(t){return(t??"online")==="online"?Ie.isOnline():!0}var Ct=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Pt(t){let e=!1,r=0,o,i=rt(),s=()=>i.status!=="pending",u=x=>{if(!s()){let v=new Ct(x);m(v),t.onCancel?.(v)}},p=()=>{e=!0},f=()=>{e=!1},c=()=>Se.isFocused()&&(t.networkMode==="always"||Ie.isOnline())&&t.canRun(),y=()=>Wt(t.networkMode)&&t.canRun(),l=x=>{s()||(o?.(),i.resolve(x))},m=x=>{s()||(o?.(),i.reject(x))},d=()=>new Promise(x=>{o=v=>{(s()||c())&&x(v)},t.onPause?.()}).then(()=>{o=void 0,s()||t.onContinue?.()}),T=()=>{if(s())return;let x,v=r===0?t.initialPromise:void 0;try{x=v??t.fn()}catch(g){x=Promise.reject(g)}Promise.resolve(x).then(l).catch(g=>{if(s())return;let R=t.retry??(ee.isServer()?0:3),q=t.retryDelay??Po,F=typeof q=="function"?q(r,g):q,L=R===!0||typeof R=="number"&&r<R||typeof R=="function"&&R(r,g);if(e||!L){m(g);return}r++,t.onFail?.(r,g),Gr(F).then(()=>c()?void 0:d()).then(()=>{e?m(g):T()})})};return{promise:i,status:()=>i.status,cancel:u,continue:()=>(o?.(),i),cancelRetry:p,continueRetry:f,canStart:y,start:()=>(y()?T():d().then(T),i)}}var xe,Wr,At=(Wr=class{constructor(){_(this,xe)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ze(this.gcTime)&&h(this,xe,Z.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ee.isServer()?1/0:300*1e3))}clearGcTimeout(){a(this,xe)!==void 0&&(Z.clearTimeout(a(this,xe)),h(this,xe,void 0))}},xe=new WeakMap,Wr);function Xr(t){return{onFetch:(e,r)=>{let o=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,s=e.state.data?.pages||[],u=e.state.data?.pageParams||[],p={pages:[],pageParams:[]},f=0,c=async()=>{let y=!1,l=T=>{Br(T,()=>e.signal,()=>y=!0)},m=wt(e.options,e.fetchOptions),d=async(T,x,v)=>{if(y)return Promise.reject(e.signal.reason);if(x==null&&T.pages.length)return Promise.resolve(T);let R=(()=>{let W={client:e.client,queryKey:e.queryKey,pageParam:x,direction:v?"backward":"forward",meta:e.options.meta};return l(W),W})(),q=await m(R),{maxPages:F}=e.options,L=v?Hr:jr;return{pages:L(T.pages,q,F),pageParams:L(T.pageParams,x,F)}};if(i&&s.length){let T=i==="backward",x=T?Ao:zr,v={pages:s,pageParams:u},g=x(o,v);p=await d(v,g,T)}else{let T=t??s.length;do{let x=f===0?u[0]??o.initialPageParam:zr(o,p);if(f>0&&x==null)break;p=await d(p,x),f++}while(f<T)}return p};e.options.persister?e.fetchFn=()=>e.options.persister?.(c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=c}}}function zr(t,{pages:e,pageParams:r}){let o=e.length-1;return e.length>0?t.getNextPageParam(e[o],e,r[o],r):void 0}function Ao(t,{pages:e,pageParams:r}){return e.length>0?t.getPreviousPageParam?.(e[0],e,r[0],r):void 0}var Ve,be,Ne,J,Re,S,nt,Ee,j,rn,se,en,tn=(en=class extends At{constructor(e){super();_(this,j);_(this,Ve);_(this,be);_(this,Ne);_(this,J);_(this,Re);_(this,S);_(this,nt);_(this,Ee);h(this,Ee,!1),h(this,nt,e.defaultOptions),this.setOptions(e.options),this.observers=[],h(this,Re,e.client),h(this,J,a(this,Re).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,h(this,be,Zr(this.options)),this.state=e.state??a(this,be),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return a(this,Ve)}get promise(){return a(this,S)?.promise}setOptions(e){if(this.options={...a(this,nt),...e},e?._type&&h(this,Ve,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Zr(this.options);r.data!==void 0&&(this.setState(Yr(r.data,r.dataUpdatedAt)),h(this,be,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&a(this,J).remove(this)}setData(e,r){let o=tt(this.state.data,e,this.options);return E(this,j,se).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(e){E(this,j,se).call(this,{type:"setState",state:e})}cancel(e){let r=a(this,S)?.promise;return a(this,S)?.cancel(e),r?r.then(K).catch(K):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return a(this,be)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>I(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ue||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>z(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!xt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),a(this,S)?.continue()}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),a(this,S)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),a(this,J).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(a(this,S)&&(a(this,Ee)||E(this,j,rn).call(this)?a(this,S).cancel({revert:!0}):a(this,S).cancelRetry()),this.scheduleGc()),a(this,J).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||E(this,j,se).call(this,{type:"invalidate"})}async fetch(e,r){if(this.state.fetchStatus!=="idle"&&a(this,S)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:!0});else if(a(this,S))return a(this,S).continueRetry(),a(this,S).promise}if(e&&this.setOptions(e),!this.options.queryFn){let c=this.observers.find(y=>y.options.queryFn);c&&this.setOptions(c.options)}let o=new AbortController,i=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(h(this,Ee,!0),o.signal)})},s=()=>{let c=wt(this.options,r),l=(()=>{let m={client:a(this,Re),queryKey:this.queryKey,meta:this.meta};return i(m),m})();return h(this,Ee,!1),this.options.persister?this.options.persister(c,l,this):c(l)},p=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:a(this,Re),state:this.state,fetchFn:s};return i(c),c})();(a(this,Ve)==="infinite"?Xr(this.options.pages):this.options.behavior)?.onFetch(p,this),h(this,Ne,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==p.fetchOptions?.meta)&&E(this,j,se).call(this,{type:"fetch",meta:p.fetchOptions?.meta}),h(this,S,Pt({initialPromise:r?.initialPromise,fn:p.fetchFn,onCancel:c=>{c instanceof Ct&&c.revert&&this.setState({...a(this,Ne),fetchStatus:"idle"}),o.abort()},onFail:(c,y)=>{E(this,j,se).call(this,{type:"failed",failureCount:c,error:y})},onPause:()=>{E(this,j,se).call(this,{type:"pause"})},onContinue:()=>{E(this,j,se).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{let c=await a(this,S).start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),a(this,J).config.onSuccess?.(c,this),a(this,J).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof Ct){if(c.silent)return a(this,S).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw E(this,j,se).call(this,{type:"error",error:c}),a(this,J).config.onError?.(c,this),a(this,J).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc()}}},Ve=new WeakMap,be=new WeakMap,Ne=new WeakMap,J=new WeakMap,Re=new WeakMap,S=new WeakMap,nt=new WeakMap,Ee=new WeakMap,j=new WeakSet,rn=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},se=function(e){let r=o=>{switch(e.type){case"failed":return{...o,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...zt(o.data,this.options),fetchMeta:e.meta??null};case"success":let i={...o,...Yr(e.data,e.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return h(this,Ne,e.manual?i:void 0),i;case"error":let s=e.error;return{...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...e.state}}};this.state=r(this.state),A.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),a(this,J).notify({query:this,type:"updated",action:e})})},en);function zt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wt(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Yr(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Zr(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,o=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var N,w,st,V,we,Ge,ie,fe,it,je,He,Ce,Pe,ye,Be,C,ot,Xt,Yt,Zt,er,tr,rr,nr,an,sn,sr=(sn=class extends Y{constructor(e,r){super();_(this,C);_(this,N);_(this,w);_(this,st);_(this,V);_(this,we);_(this,Ge);_(this,ie);_(this,fe);_(this,it);_(this,je);_(this,He);_(this,Ce);_(this,Pe);_(this,ye);_(this,Be,new Set);this.options=r,h(this,N,e),h(this,fe,null),h(this,ie,rt()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(a(this,w).addObserver(this),nn(a(this,w),this.options)?E(this,C,ot).call(this):this.updateResult(),E(this,C,er).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return or(a(this,w),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return or(a(this,w),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,E(this,C,tr).call(this),E(this,C,rr).call(this),a(this,w).removeObserver(this)}setOptions(e){let r=this.options,o=a(this,w);if(this.options=a(this,N).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof I(this.options.enabled,a(this,w))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");E(this,C,nr).call(this),a(this,w).setOptions(this.options),r._defaulted&&!Et(this.options,r)&&a(this,N).getQueryCache().notify({type:"observerOptionsUpdated",query:a(this,w),observer:this});let i=this.hasListeners();i&&on(a(this,w),o,this.options,r)&&E(this,C,ot).call(this),this.updateResult(),i&&(a(this,w)!==o||I(this.options.enabled,a(this,w))!==I(r.enabled,a(this,w))||z(this.options.staleTime,a(this,w))!==z(r.staleTime,a(this,w)))&&E(this,C,Xt).call(this);let s=E(this,C,Yt).call(this);i&&(a(this,w)!==o||I(this.options.enabled,a(this,w))!==I(r.enabled,a(this,w))||s!==a(this,ye))&&E(this,C,Zt).call(this,s)}getOptimisticResult(e){let r=a(this,N).getQueryCache().build(a(this,N),e),o=this.createResult(r,e);return Qo(this,o)&&(h(this,V,o),h(this,Ge,this.options),h(this,we,a(this,w).state)),o}getCurrentResult(){return a(this,V)}trackResult(e,r){return new Proxy(e,{get:(o,i)=>(this.trackProp(i),r?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&a(this,ie).status==="pending"&&a(this,ie).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,i))})}trackProp(e){a(this,Be).add(e)}getCurrentQuery(){return a(this,w)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let r=a(this,N).defaultQueryOptions(e),o=a(this,N).getQueryCache().build(a(this,N),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(e){return E(this,C,ot).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),a(this,V)))}createResult(e,r){let o=a(this,w),i=this.options,s=a(this,V),u=a(this,we),p=a(this,Ge),c=e!==o?e.state:a(this,st),{state:y}=e,l={...y},m=!1,d;if(r._optimisticResults){let Q=this.hasListeners(),B=!Q&&nn(e,r),ct=Q&&on(e,o,r,i);(B||ct)&&(l={...l,...zt(y.data,e.options)}),r._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:T,errorUpdatedAt:x,status:v}=l;d=l.data;let g=!1;if(r.placeholderData!==void 0&&d===void 0&&v==="pending"){let Q;s?.isPlaceholderData&&r.placeholderData===p?.placeholderData?(Q=s.data,g=!0):Q=typeof r.placeholderData=="function"?r.placeholderData(a(this,He)?.state.data,a(this,He)):r.placeholderData,Q!==void 0&&(v="success",d=tt(s?.data,Q,r),m=!0)}if(r.select&&d!==void 0&&!g)if(s&&d===u?.data&&r.select===a(this,it))d=a(this,je);else try{h(this,it,r.select),d=r.select(d),d=tt(s?.data,d,r),h(this,je,d),h(this,fe,null)}catch(Q){h(this,fe,Q)}a(this,fe)&&(T=a(this,fe),d=a(this,je),x=Date.now(),v="error");let R=l.fetchStatus==="fetching",q=v==="pending",F=v==="error",L=q&&R,W=d!==void 0,H={status:v,fetchStatus:l.fetchStatus,isPending:q,isSuccess:v==="success",isError:F,isInitialLoading:L,isLoading:L,data:d,dataUpdatedAt:l.dataUpdatedAt,error:T,errorUpdatedAt:x,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>c.dataUpdateCount||l.errorUpdateCount>c.errorUpdateCount,isFetching:R,isRefetching:R&&!q,isLoadingError:F&&!W,isPaused:l.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:F&&W,isStale:ir(e,r),refetch:this.refetch,promise:a(this,ie),isEnabled:I(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let Q=H.data!==void 0,B=H.status==="error"&&!Q,ct=yt=>{B?yt.reject(H.error):Q&&yt.resolve(H.data)},xr=()=>{let yt=h(this,ie,H.promise=rt());ct(yt)},ft=a(this,ie);switch(ft.status){case"pending":e.queryHash===o.queryHash&&ct(ft);break;case"fulfilled":(B||H.data!==ft.value)&&xr();break;case"rejected":(!B||H.error!==ft.reason)&&xr();break}}return H}updateResult(){let e=a(this,V),r=this.createResult(a(this,w),this.options);if(h(this,we,a(this,w).state),h(this,Ge,this.options),a(this,we).data!==void 0&&h(this,He,a(this,w)),Et(r,e))return;h(this,V,r);let o=()=>{if(!e)return!0;let{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!a(this,Be).size)return!0;let u=new Set(s??a(this,Be));return this.options.throwOnError&&u.add("error"),Object.keys(a(this,V)).some(p=>{let f=p;return a(this,V)[f]!==e[f]&&u.has(f)})};E(this,C,an).call(this,{listeners:o()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&E(this,C,er).call(this)}},N=new WeakMap,w=new WeakMap,st=new WeakMap,V=new WeakMap,we=new WeakMap,Ge=new WeakMap,ie=new WeakMap,fe=new WeakMap,it=new WeakMap,je=new WeakMap,He=new WeakMap,Ce=new WeakMap,Pe=new WeakMap,ye=new WeakMap,Be=new WeakMap,C=new WeakSet,ot=function(e){E(this,C,nr).call(this);let r=a(this,w).fetch(this.options,e);return e?.throwOnError||(r=r.catch(K)),r},Xt=function(){E(this,C,tr).call(this);let e=z(this.options.staleTime,a(this,w));if(ee.isServer()||a(this,V).isStale||!Ze(e))return;let o=xt(a(this,V).dataUpdatedAt,e)+1;h(this,Ce,Z.setTimeout(()=>{a(this,V).isStale||this.updateResult()},o))},Yt=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(a(this,w)):this.options.refetchInterval)??!1},Zt=function(e){E(this,C,rr).call(this),h(this,ye,e),!(ee.isServer()||I(this.options.enabled,a(this,w))===!1||!Ze(a(this,ye))||a(this,ye)===0)&&h(this,Pe,Z.setInterval(()=>{(this.options.refetchIntervalInBackground||Se.isFocused())&&E(this,C,ot).call(this)},a(this,ye)))},er=function(){E(this,C,Xt).call(this),E(this,C,Zt).call(this,E(this,C,Yt).call(this))},tr=function(){a(this,Ce)!==void 0&&(Z.clearTimeout(a(this,Ce)),h(this,Ce,void 0))},rr=function(){a(this,Pe)!==void 0&&(Z.clearInterval(a(this,Pe)),h(this,Pe,void 0))},nr=function(){let e=a(this,N).getQueryCache().build(a(this,N),this.options);if(e===a(this,w))return;let r=a(this,w);h(this,w,e),h(this,st,e.state),this.hasListeners()&&(r?.removeObserver(this),e.addObserver(this))},an=function(e){A.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(a(this,V))}),a(this,N).getQueryCache().notify({query:a(this,w),type:"observerResultsUpdated"})})},sn);function Oo(t,e){return I(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&I(e.retryOnMount,t)===!1)}function nn(t,e){return Oo(t,e)||t.state.data!==void 0&&or(t,e,e.refetchOnMount)}function or(t,e,r){if(I(e.enabled,t)!==!1&&z(e.staleTime,t)!=="static"){let o=typeof r=="function"?r(t):r;return o==="always"||o!==!1&&ir(t,e)}return!1}function on(t,e,r,o){return(t!==e||I(o.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&ir(t,r)}function ir(t,e){return I(e.enabled,t)!==!1&&t.isStaleByTime(z(e.staleTime,t))}function Qo(t,e){return!Et(t.getCurrentResult(),e)}var at,te,k,Ae,re,de,un,ln=(un=class extends At{constructor(e){super();_(this,re);_(this,at);_(this,te);_(this,k);_(this,Ae);h(this,at,e.client),this.mutationId=e.mutationId,h(this,k,e.mutationCache),h(this,te,[]),this.state=e.state||qo(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){a(this,te).includes(e)||(a(this,te).push(e),this.clearGcTimeout(),a(this,k).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){h(this,te,a(this,te).filter(r=>r!==e)),this.scheduleGc(),a(this,k).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){a(this,te).length||(this.state.status==="pending"?this.scheduleGc():a(this,k).remove(this))}continue(){return a(this,Ae)?.continue()??this.execute(this.state.variables)}async execute(e){let r=()=>{E(this,re,de).call(this,{type:"continue"})},o={client:a(this,at),meta:this.options.meta,mutationKey:this.options.mutationKey};h(this,Ae,Pt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,o):Promise.reject(new Error("No mutationFn found")),onFail:(u,p)=>{E(this,re,de).call(this,{type:"failed",failureCount:u,error:p})},onPause:()=>{E(this,re,de).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>a(this,k).canRun(this)}));let i=this.state.status==="pending",s=!a(this,Ae).canStart();try{if(i)r();else{E(this,re,de).call(this,{type:"pending",variables:e,isPaused:s}),a(this,k).config.onMutate&&await a(this,k).config.onMutate(e,this,o);let p=await this.options.onMutate?.(e,o);p!==this.state.context&&E(this,re,de).call(this,{type:"pending",context:p,variables:e,isPaused:s})}let u=await a(this,Ae).start();return await a(this,k).config.onSuccess?.(u,e,this.state.context,this,o),await this.options.onSuccess?.(u,e,this.state.context,o),await a(this,k).config.onSettled?.(u,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(u,null,e,this.state.context,o),E(this,re,de).call(this,{type:"success",data:u}),u}catch(u){try{await a(this,k).config.onError?.(u,e,this.state.context,this,o)}catch(p){Promise.reject(p)}try{await this.options.onError?.(u,e,this.state.context,o)}catch(p){Promise.reject(p)}try{await a(this,k).config.onSettled?.(void 0,u,this.state.variables,this.state.context,this,o)}catch(p){Promise.reject(p)}try{await this.options.onSettled?.(void 0,u,e,this.state.context,o)}catch(p){Promise.reject(p)}throw E(this,re,de).call(this,{type:"error",error:u}),u}finally{a(this,k).runNext(this)}}},at=new WeakMap,te=new WeakMap,k=new WeakMap,Ae=new WeakMap,re=new WeakSet,de=function(e){let r=o=>{switch(e.type){case"failed":return{...o,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...o,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:e.error,failureCount:o.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),A.batch(()=>{a(this,te).forEach(o=>{o.onMutationUpdate(e)}),a(this,k).notify({mutation:this,type:"updated",action:e})})},un);function qo(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ae,X,ut,pn,cn=(pn=class extends Y{constructor(e={}){super();_(this,ae);_(this,X);_(this,ut);this.config=e,h(this,ae,new Set),h(this,X,new Map),h(this,ut,0)}build(e,r,o){let i=new ln({client:e,mutationCache:this,mutationId:++Ye(this,ut)._,options:e.defaultMutationOptions(r),state:o});return this.add(i),i}add(e){a(this,ae).add(e);let r=Ot(e);if(typeof r=="string"){let o=a(this,X).get(r);o?o.push(e):a(this,X).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(a(this,ae).delete(e)){let r=Ot(e);if(typeof r=="string"){let o=a(this,X).get(r);if(o)if(o.length>1){let i=o.indexOf(e);i!==-1&&o.splice(i,1)}else o[0]===e&&a(this,X).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){let r=Ot(e);if(typeof r=="string"){let i=a(this,X).get(r)?.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){let r=Ot(e);return typeof r=="string"?a(this,X).get(r)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{a(this,ae).forEach(e=>{this.notify({type:"removed",mutation:e})}),a(this,ae).clear(),a(this,X).clear()})}getAll(){return Array.from(a(this,ae))}find(e){let r={exact:!0,...e};return this.getAll().find(o=>Rt(r,o))}findAll(e={}){return this.getAll().filter(r=>Rt(e,r))}notify(e){A.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){let e=this.getAll().filter(r=>r.state.isPaused);return A.batch(()=>Promise.all(e.map(r=>r.continue().catch(K))))}},ae=new WeakMap,X=new WeakMap,ut=new WeakMap,pn);function Ot(t){return t.options.scope?.id}var ne,fn,yn=(fn=class extends Y{constructor(e={}){super();_(this,ne);this.config=e,h(this,ne,new Map)}build(e,r,o){let i=r.queryKey,s=r.queryHash??et(i,r),u=this.get(s);return u||(u=new tn({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:o,defaultOptions:e.getQueryDefaults(i)}),this.add(u)),u}add(e){a(this,ne).has(e.queryHash)||(a(this,ne).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let r=a(this,ne).get(e.queryHash);r&&(e.destroy(),r===e&&a(this,ne).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return a(this,ne).get(e)}getAll(){return[...a(this,ne).values()]}find(e){let r={exact:!0,...e};return this.getAll().find(o=>bt(r,o))}findAll(e={}){let r=this.getAll();return Object.keys(e).length>0?r.filter(o=>bt(e,o)):r}notify(e){A.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ne=new WeakMap,fn);var M,he,me,Je,$e,Te,We,ze,dn,ar=(dn=class{constructor(t={}){_(this,M);_(this,he);_(this,me);_(this,Je);_(this,$e);_(this,Te);_(this,We);_(this,ze);h(this,M,t.queryCache||new yn),h(this,he,t.mutationCache||new cn),h(this,me,t.defaultOptions||{}),h(this,Je,new Map),h(this,$e,new Map),h(this,Te,0)}mount(){Ye(this,Te)._++,a(this,Te)===1&&(h(this,We,Se.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,M).onFocus())})),h(this,ze,Ie.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,M).onOnline())})))}unmount(){var t,e;Ye(this,Te)._--,a(this,Te)===0&&((t=a(this,We))==null||t.call(this),h(this,We,void 0),(e=a(this,ze))==null||e.call(this),h(this,ze,void 0))}isFetching(t){return a(this,M).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return a(this,he).findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return a(this,M).get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),r=a(this,M).build(this,e),o=r.state.data;return o===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(z(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(o))}getQueriesData(t){return a(this,M).findAll(t).map(({queryKey:e,state:r})=>{let o=r.data;return[e,o]})}setQueryData(t,e,r){let o=this.defaultQueryOptions({queryKey:t}),s=a(this,M).get(o.queryHash)?.state.data,u=Nr(e,s);if(u!==void 0)return a(this,M).build(this,o).setData(u,{...r,manual:!0})}setQueriesData(t,e,r){return A.batch(()=>a(this,M).findAll(t).map(({queryKey:o})=>[o,this.setQueryData(o,e,r)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return a(this,M).get(e.queryHash)?.state}removeQueries(t){let e=a(this,M);A.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){let r=a(this,M);return A.batch(()=>(r.findAll(t).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let r={revert:!0,...e},o=A.batch(()=>a(this,M).findAll(t).map(i=>i.cancel(r)));return Promise.all(o).then(K).catch(K)}invalidateQueries(t,e={}){return A.batch(()=>(a(this,M).findAll(t).forEach(r=>{r.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let r={...e,cancelRefetch:e.cancelRefetch??!0},o=A.batch(()=>a(this,M).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(K)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(K)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let r=a(this,M).build(this,e);return r.isStaleByTime(z(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(K).catch(K)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(K).catch(K)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Ie.isOnline()?a(this,he).resumePausedMutations():Promise.resolve()}getQueryCache(){return a(this,M)}getMutationCache(){return a(this,he)}getDefaultOptions(){return a(this,me)}setDefaultOptions(t){h(this,me,t)}setQueryDefaults(t,e){a(this,Je).set(ve(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...a(this,Je).values()],r={};return e.forEach(o=>{ge(t,o.queryKey)&&Object.assign(r,o.defaultOptions)}),r}setMutationDefaults(t,e){a(this,$e).set(ve(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...a(this,$e).values()],r={};return e.forEach(o=>{ge(t,o.mutationKey)&&Object.assign(r,o.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;let e={...a(this,me).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=et(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ue&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...a(this,me).mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){a(this,M).clear(),a(this,he).clear()}},M=new WeakMap,he=new WeakMap,me=new WeakMap,Je=new WeakMap,$e=new WeakMap,Te=new WeakMap,We=new WeakMap,ze=new WeakMap,dn);var Oe,O,ur,hn,lt=0,Rn=[],D=P,mn=D.__b,Tn=D.__r,_n=D.diffed,vn=D.__c,gn=D.unmount,xn=D.__;function pt(t,e){D.__h&&D.__h(O,t,lt||e),lt=0;var r=O.__H||(O.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Qe(t){return lt=1,Mo(Cn,t)}function Mo(t,e,r){var o=pt(Oe++,2);if(o.t=t,!o.__c&&(o.__=[r?r(e):Cn(void 0,e),function(p){var f=o.__N?o.__N[0]:o.__[0],c=o.t(f,p);f!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=O,!O.__f)){var i=function(p,f,c){if(!o.__c.__H)return!0;var y=o.__c.__H.__.filter(function(m){return m.__c});if(y.every(function(m){return!m.__N}))return!s||s.call(this,p,f,c);var l=o.__c.props!==p;return y.some(function(m){if(m.__N){var d=m.__[0];m.__=m.__N,m.__N=void 0,d!==m.__[0]&&(l=!0)}}),s&&s.call(this,p,f,c)||l};O.__f=!0;var s=O.shouldComponentUpdate,u=O.componentWillUpdate;O.componentWillUpdate=function(p,f,c){if(this.__e){var y=s;s=void 0,i(p,f,c),s=y}u&&u.call(this,p,f,c)},O.shouldComponentUpdate=i}return o.__N||o.__}function $(t,e){var r=pt(Oe++,3);!D.__s&&pr(r.__H,e)&&(r.__=t,r.u=e,O.__H.__h.push(r))}function qt(t,e){var r=pt(Oe++,4);!D.__s&&pr(r.__H,e)&&(r.__=t,r.u=e,O.__h.push(r))}function qe(t){return lt=5,En(function(){return{current:t}},[])}function En(t,e){var r=pt(Oe++,7);return pr(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function wn(t,e){return lt=8,En(function(){return t},e)}function Xe(t){var e=O.context[t.__c],r=pt(Oe++,9);return r.c=t,e?(r.__==null&&(r.__=!0,e.sub(O)),e.props.value):t.__}function Do(){for(var t;t=Rn.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Qt),e.__h.some(lr),e.__h=[]}catch(r){e.__h=[],D.__e(r,t.__v)}}}D.__b=function(t){O=null,mn&&mn(t)},D.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),xn&&xn(t,e)},D.__r=function(t){Tn&&Tn(t),Oe=0;var e=(O=t.__c).__H;e&&(ur===O?(e.__h=[],O.__h=[],e.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.some(Qt),e.__h.some(lr),e.__h=[],Oe=0)),ur=O},D.diffed=function(t){_n&&_n(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Rn.push(e)!==1&&hn===D.requestAnimationFrame||((hn=D.requestAnimationFrame)||Ko)(Do)),e.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),ur=O=null},D.__c=function(t,e){e.some(function(r){try{r.__h.some(Qt),r.__h=r.__h.filter(function(o){return!o.__||lr(o)})}catch(o){e.some(function(i){i.__h&&(i.__h=[])}),e=[],D.__e(o,r.__v)}}),vn&&vn(t,e)},D.unmount=function(t){gn&&gn(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.some(function(o){try{Qt(o)}catch(i){e=i}}),r.__H=void 0,e&&D.__e(e,r.__v))};var bn=typeof requestAnimationFrame=="function";function Ko(t){var e,r=function(){clearTimeout(o),bn&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(r,35);bn&&(e=requestAnimationFrame(r))}function Qt(t){var e=O,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),O=e}function lr(t){var e=O;t.__c=t.__(),O=e}function pr(t,e){return!t||t.length!==e.length||e.some(function(r,o){return r!==t[o]})}function Cn(t,e){return typeof e=="function"?e(t):e}var Pn=Ke(!1),An=()=>Xe(Pn),$i=Pn.Provider;var Fo=0;function n(t,e,r,o,i,s){e||(e={});var u,p,f=e;if("ref"in f)for(p in f={},e)p=="ref"?u=e[p]:f[p]=e[p];var c={type:t,props:f,key:r,ref:u,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Fo,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(u=t.defaultProps))for(p in u)f[p]===void 0&&(f[p]=u[p]);return P.vnode&&P.vnode(c),c}var cr=Ke(void 0),fr=t=>{let e=Xe(cr);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},yr=({client:t,children:e})=>($(()=>(t.mount(),()=>{t.unmount()}),[t]),n(cr.Provider,{value:t,children:e}));function So(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Uo=Ke(So()),On=()=>Xe(Uo);var Qn=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},qn=t=>{$(()=>{t.clearReset()},[t])},Mn=({result:t,errorResetBoundary:e,throwOnError:r,query:o,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&o&&(i&&t.data===void 0||$t(r,[t.error,o]));var Dn=t=>{if(t.suspense){let r=i=>i==="static"?i:Math.max(i??1e3,1e3),o=t.staleTime;t.staleTime=typeof o=="function"?(...i)=>r(o(...i)):r(o),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Kn=(t,e)=>t.isLoading&&t.isFetching&&!e,Fn=(t,e)=>t?.suspense&&e.isPending,dr=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function Sn(t,e){let r=e(),[{_instance:o},i]=Qe({_instance:{_value:r,_getSnapshot:e}});return qt(()=>{o._value=r,o._getSnapshot=e,hr(o)&&i({_instance:o})},[t,r,e]),$(()=>(hr(o)&&i({_instance:o}),t(()=>{hr(o)&&i({_instance:o})})),[t]),r}function hr(t){let e=t._getSnapshot,r=t._value;try{let o=e();return!Object.is(r,o)}catch{return!0}}function Un(t,e,r){let o=An(),i=On(),s=fr(r),u=s.defaultQueryOptions(t);s.getDefaultOptions().queries?._experimental_beforeQuery?.(u),u._optimisticResults=o?"isRestoring":"optimistic",Dn(u),Qn(u,i),qn(i);let p=!s.getQueryCache().get(u.queryHash),[f]=Qe(()=>new e(s,u)),c=f.getOptimisticResult(u),y=!o&&t.subscribed!==!1;if(Sn(wn(l=>{let m=y?f.subscribe(A.batchCalls(l)):K;return f.updateResult(),m},[f,y]),()=>f.getCurrentResult()),$(()=>{f.setOptions(u)},[u,f]),Fn(u,c))throw dr(u,f,i);if(Mn({result:c,errorResetBoundary:i,throwOnError:u.throwOnError,query:s.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw c.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(u,c),u.experimental_prefetchInRender&&!ee.isServer()&&Kn(c,o)&&(p?dr(u,f,i):s.getQueryCache().get(u.queryHash)?.promise)?.catch(K).finally(()=>{f.updateResult()}),u.notifyOnChangeProps?c:f.trackResult(c)}function mr(t,e){return Un(t,sr,e)}function U({children:t,panel:e,href:r,className:o,panelLarge:i}){let[s,u]=Qe(!1),p=qe(null),f=qe(null),c=qe(null),y=()=>{c.current&&(clearTimeout(c.current),c.current=null),f.current=setTimeout(()=>u(!0),100)},l=()=>{f.current&&(clearTimeout(f.current),f.current=null),c.current=setTimeout(()=>u(!1),150)};qt(()=>{if(s&&p.current){let T=p.current;T.style.left="50%",T.style.right="auto",T.style.transform="translateX(-50%)";let x=T.getBoundingClientRect();x.left<8?(T.style.left="0",T.style.transform="none"):x.right>window.innerWidth-8&&(T.style.left="auto",T.style.right="0",T.style.transform="none")}},[s]);let m=["profiler-toolbar-item",e?"profiler-toolbar-hoverable":"",o||""].filter(Boolean).join(" "),d=e?n("div",{ref:p,class:`profiler-toolbar-panel${i?" profiler-toolbar-panel-large":""}${s?" is-visible":""}`,onMouseEnter:y,onMouseLeave:l,children:e}):null;return r?n("a",{href:r,class:m,onMouseEnter:y,onMouseLeave:l,children:[t,d]}):n("span",{class:m,onMouseEnter:y,onMouseLeave:l,children:[t,d]})}function ko(t){return t>=200&&t<300?"profiler-text--success":t>=300&&t<400?"profiler-text--warning":t>=400?"profiler-text--error":""}function kn({profile:t,requestData:e}){let r=ko(t.status),o=e.controller_action,i=e.route_name,s=e.route_pattern,u=e.route_params;return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Request & Response",n("span",{class:"profiler-float-right",children:t.path})]}),n("div",{class:"profiler-toolbar-panel-content",children:[n("div",{class:"profiler-section__header",children:"Request"}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Method"}),n("strong",{class:"profiler-text--accent",children:t.method})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Path"}),n("strong",{children:t.path})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Status"}),n("strong",{class:r,children:t.status})]}),o&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Controller#Action"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:o})]}),i&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Route Name"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:i})]}),s&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Route Pattern"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:s})]}),u&&Object.keys(u).length>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Route Params"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:Object.entries(u).map(([p,f])=>`${p}: ${f}`).join(", ")})]}),t.params&&Object.keys(t.params).length>0&&n(b,{children:[n("div",{class:"profiler-section__header profiler-mt-3",children:"Parameters"}),Object.entries(t.params).map(([p,f])=>n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{class:"profiler-text--xs profiler-text--mono",children:p}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:String(f).substring(0,40)})]},p))]})]})]})}function Ln({dbData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Database",n("span",{class:"profiler-float-right",children:[t.total_queries," queries \xB7 ",t.total_duration.toFixed(2)," ms"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[t.queries.slice(0,10).map((e,r)=>n("div",{class:`profiler-toolbar-panel-query${e.slow?" profiler-toolbar-panel-query-slow":""}`,children:[n("div",{class:"profiler-flex profiler-flex--between profiler-mb-1",children:[n("span",{class:"profiler-text--xs profiler-text--muted",children:["#",r+1," ",e.name]}),n("span",{class:`${e.slow?"profiler-text--error":"profiler-text--success"} profiler-text--xs`,children:[e.duration.toFixed(2)," ms"]})]}),n("code",{children:e.sql})]},r)),t.total_queries>10&&n("div",{class:"profiler-more",children:["+ ",t.total_queries-10," more queries"]})]})]})}function Lo(t){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[t]||""}var Io={frame:"Turbo Frame request",stream:"Turbo Stream response"};function In({ajaxData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["AJAX",n("span",{class:"profiler-float-right",children:[t.total_requests," requests \xB7 ",t.total_duration.toFixed(2)," ms"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[t.requests.slice(0,10).map((e,r)=>{let o=e.status>=200&&e.status<300?"profiler-ajax-card--success":"profiler-ajax-card--error";return n("div",{class:`profiler-ajax-card ${o}`,children:n("div",{class:"profiler-ajax-card__row",children:[n("div",{class:"profiler-flex profiler-flex--gap-2",children:[n("span",{class:`badge ${Lo(e.method)}`,children:e.method}),e.turbo&&n("span",{class:"badge badge-default",title:Io[e.turbo],children:e.turbo.toUpperCase()}),n("span",{class:"profiler-text--xs profiler-text--truncate",children:e.path})]}),n("div",{class:"profiler-flex profiler-flex--gap-2",children:[n("span",{class:`profiler-text--xs ${e.status>=200&&e.status<300?"profiler-text--success":"profiler-text--error"}`,children:e.status}),n("span",{class:"profiler-text--xs profiler-text--muted",children:[e.duration.toFixed(2)," ms"]})]})]})},r)}),t.total_requests>10&&n("div",{class:"profiler-more",children:["+ ",t.total_requests-10," more"]})]})]})}function Vn({perfData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:"Events"}),n("div",{class:"profiler-toolbar-panel-content",children:t.events.slice(0,8).map((e,r)=>n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{class:"profiler-text--xs",children:e.name}),n("strong",{class:"profiler-text--accent",children:[e.duration.toFixed(2)," ms"]})]},r))})]})}function Nn({viewData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Views",n("span",{class:"profiler-float-right",children:[t.total_duration.toFixed(2)," ms"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[t.views&&t.views.length>0&&n(b,{children:[n("div",{class:"profiler-section__header",children:"Templates"}),t.views.map((e,r)=>n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{class:"profiler-text--xs",children:e.identifier}),n("strong",{class:"profiler-text--success",children:[e.duration.toFixed(2)," ms"]})]},r))]}),t.partials&&t.partials.length>0&&n(b,{children:[n("div",{class:"profiler-section__header profiler-mt-3",children:"Partials"}),t.partials.map((e,r)=>n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{class:"profiler-text--xs",children:e.identifier}),n("strong",{class:"profiler-text--success",children:[e.duration.toFixed(2)," ms"]})]},r))]})]})]})}function Gn({cacheData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Cache",n("span",{class:"profiler-float-right",children:["Hit rate: ",t.hit_rate,"%"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Reads"}),n("strong",{children:t.total_reads})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Writes"}),n("strong",{children:t.total_writes})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Hits"}),n("strong",{class:"profiler-text--success",children:t.hits})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Misses"}),n("strong",{class:"profiler-text--error",children:t.misses})]})]})]})}function jn({dumpData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Dumps (",t.count,")"]}),n("div",{class:"profiler-toolbar-panel-content",children:[t.dumps.slice(0,5).map((e,r)=>n("div",{class:"profiler-dump-card",children:[n("div",{class:"profiler-dump-card__header",children:[n("span",{class:"profiler-text--xs profiler-text--muted",children:["#",r+1,e.label&&n(b,{children:[" \xB7 ",n("strong",{class:"profiler-text--warning",children:e.label})]})]}),n("span",{class:"profiler-text--xs profiler-text--muted",children:[e.file.split("/").pop(),":",e.line]})]}),n("pre",{class:"profiler-text--xs profiler-text--truncate profiler-text--warning",style:{margin:0,background:"none",border:"none",padding:0},children:(e.formatted.split(`
2
+ `)[0]||e.formatted).trim()})]},r)),t.count>5&&n("div",{class:"profiler-more",children:["+ ",t.count-5," more dumps"]})]})]})}function Vo(t){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[t]||""}function Hn({httpData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Outbound HTTP",n("span",{class:"profiler-float-right",children:[t.total_requests," requests \xB7 ",t.total_duration.toFixed(2)," ms"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[t.requests.slice(0,10).map((r,o)=>{let i=r.status>=400||r.status===0,s=r.duration>=500,u=i?"profiler-ajax-card--error":s?"profiler-ajax-card--warning":"profiler-ajax-card--success",p=(()=>{try{return new URL(r.url).host}catch{return r.url}})();return n("div",{class:`profiler-ajax-card ${u}`,children:n("div",{class:"profiler-ajax-card__row",children:[n("div",{class:"profiler-flex profiler-flex--gap-2",children:[n("span",{class:`badge ${Vo(r.method)}`,children:r.method}),n("span",{class:"profiler-text--xs profiler-text--truncate",children:p})]}),n("div",{class:"profiler-flex profiler-flex--gap-2",children:[n("span",{class:`profiler-text--xs ${i?"profiler-text--error":"profiler-text--success"}`,children:r.status===0?"ERR":r.status}),n("span",{class:`profiler-text--xs ${s?"profiler-text--error":"profiler-text--muted"}`,children:[r.duration.toFixed(2)," ms"]})]})]})},o)}),t.total_requests>10&&n("div",{class:"profiler-more",children:["+ ",t.total_requests-10," more"]})]})]})}function No(t){switch(t){case"ERROR":case"FATAL":return"var(--profiler-error, #ef4444)";case"WARN":return"var(--profiler-warning, #f59e0b)";case"INFO":return"var(--profiler-success, #22c55e)";default:return"var(--profiler-muted, #6b7280)"}}function Bn({logData:t}){let e=t.logs.slice(-5).reverse();return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Logs (",t.count,")",t.errors>0&&n("span",{style:"color:var(--profiler-error,#ef4444);margin-left:8px;",children:[t.errors," error",t.errors!==1?"s":""]}),t.warnings>0&&t.errors===0&&n("span",{style:"color:var(--profiler-warning,#f59e0b);margin-left:8px;",children:[t.warnings," warning",t.warnings!==1?"s":""]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[e.map((r,o)=>n("div",{class:"profiler-toolbar-panel-row",style:"align-items:flex-start;gap:6px;",children:[n("span",{class:"profiler-text--xs",style:`color:${No(r.level)};font-weight:600;min-width:40px;`,children:r.level}),n("span",{class:"profiler-text--xs profiler-text--truncate",style:"flex:1;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",children:r.message})]},o)),t.count>5&&n("div",{class:"profiler-more",children:["+ ",t.count-5," more messages"]})]})]})}function Jn({exceptionData:t}){let e=t.backtrace?.find(r=>r.app_frame);return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",style:"color:var(--profiler-error,#ef4444);",children:["\u{1F4A5} ",t.exception_class]}),n("div",{class:"profiler-toolbar-panel-content",children:n("div",{class:"profiler-toolbar-panel-row",style:"flex-direction:column;align-items:flex-start;gap:4px;",children:[n("span",{class:"profiler-text--xs",style:"max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",children:t.message}),e&&n("span",{class:"profiler-text--xs profiler-text--muted",style:"max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",children:e.location})]})})]})}function $n({routesData:t}){let{total:e,matched:r}=t;return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Routes",n("span",{class:"profiler-float-right",children:[e," routes"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:r?n(b,{children:[n("div",{class:"profiler-section__header",children:"Matched Route"}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Pattern"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:r.pattern})]}),r.name&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Name"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:[r.name,"_path"]})]}),r.controller_action&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Controller#Action"}),n("strong",{class:"profiler-text--xs profiler-text--mono",children:r.controller_action})]})]}):n("div",{class:"profiler-toolbar-panel-row",children:n("span",{class:"profiler-text--muted",children:"No route matched"})})})]})}function Wn({i18nData:t}){let e=t.lookups.filter(s=>s.missing),r=t.lookups.filter(s=>!s.missing),o=[...e,...r].slice(0,5),i=t.total-5;return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["I18n",n("span",{style:"margin-left:6px;font-weight:400;color:var(--profiler-muted,#6b7280);",children:["[",t.locale,"]"]}),t.missing_count>0&&n("span",{style:"color:var(--profiler-error,#ef4444);margin-left:8px;",children:[t.missing_count," missing"]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[o.map((s,u)=>n("div",{class:"profiler-toolbar-panel-row",style:"align-items:flex-start;gap:6px;",children:[n("span",{class:"profiler-text--xs profiler-text--truncate",style:`flex:1;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;${s.missing?"color:var(--profiler-error,#ef4444);":""}`,children:s.key}),s.missing&&n("span",{class:"profiler-text--xs",style:"color:var(--profiler-error,#ef4444);font-weight:600;",children:"\u26A0"})]},u)),i>0&&n("div",{class:"profiler-more",children:["+ ",i," more keys"]})]})]})}function Go({job:t}){if(t.status==="running")return n("strong",{class:"profiler-text--xs profiler-text--mono profiler-text--info",children:[n("span",{class:"profiler-spinner","aria-hidden":"true",children:"\u25D0"})," running"]});let e=t.status==="failed";return n("strong",{class:`profiler-text--xs profiler-text--mono ${e?"profiler-text--error":"profiler-text--success"}`,children:[e?"\u2717":"\u2713"," ",t.duration?.toFixed(0),"ms"]})}function zn({jobs:t}){let e=t.filter(u=>u.status==="running").length,r=t.filter(u=>u.status==="completed").length,o=t.filter(u=>u.status==="failed").length,i=t.slice(0,5),s=t.length-5;return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Background Jobs",n("span",{class:"profiler-float-right",children:[t.length," job",t.length!==1?"s":""]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[n("div",{class:"profiler-section__header",children:"Summary"}),e>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Running"}),n("strong",{class:"profiler-text--info",children:e})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Completed"}),n("strong",{class:r>0?"profiler-text--success":"profiler-text--muted",children:r})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Failed"}),n("strong",{class:o>0?"profiler-text--error":"profiler-text--muted",children:o})]}),n("div",{class:"profiler-section__header profiler-mt-3",children:"Last jobs"}),i.map((u,p)=>n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{class:"profiler-text--xs profiler-text--mono",children:u.job_class}),n(Go,{job:u})]},p)),s>0&&n("div",{class:"profiler-more",children:["+ ",s," more"]})]})]})}function Xn({envData:t}){return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:"Environment"}),n("div",{class:"profiler-toolbar-panel-content",children:n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Variables"}),n("strong",{children:t.total})]})})]})}function Yn({mailerData:t}){let e=t.failed>0||t.loop_warnings.length>0;return n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:["Mailers",n("span",{class:"profiler-float-right",children:[t.total," email",t.total!==1?"s":""]})]}),n("div",{class:"profiler-toolbar-panel-content",children:[t.deliver_now>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"deliver_now"}),n("strong",{children:t.deliver_now})]}),t.deliver_later>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"deliver_later"}),n("strong",{children:t.deliver_later})]}),(t.queued_count??0)>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Queued"}),n("strong",{children:t.queued_count})]}),t.multi_part_count>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Multi-part"}),n("strong",{children:t.multi_part_count})]}),t.failed>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Errors"}),n("strong",{class:"profiler-text--error",children:t.failed})]}),t.loop_warnings.length>0&&n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{class:"profiler-text--warning",children:"\u26A0\uFE0F Loop detected"}),n("strong",{class:"profiler-text--warning",children:t.loop_warnings.length})]}),[...t.emails,...t.errors].slice(0,3).map((r,o)=>n("div",{class:"profiler-toolbar-panel-row profiler-text--sm",children:[n("span",{class:"profiler-text--muted",children:[r.mailer_class,"#",r.action]}),n("span",{class:r.error?"profiler-text--error":"profiler-text--success",children:r.error?"\u274C":"\u2705"})]},o)),t.total>3&&n("div",{class:"profiler-toolbar-panel-row profiler-text--muted profiler-text--xs",children:["+",t.total-3," more\u2026"]})]})]})}function Tr(t){return t.allocated_objects!=null?t.allocated_objects:t.memory!=null?Math.round(t.memory/40):null}function Zn(t){return t==null?"-":`${t.toLocaleString("en")} objects`}var eo="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function jo(t){return t>=200&&t<300?"profiler-text--success":t>=300&&t<400?"profiler-text--warning":t>=400?"profiler-text--error":""}function Ho(t){return t<100?"profiler-text--success":t<500?"profiler-text--warning":"profiler-text--error"}function Bo(t){return new Date(t).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function to({profile:t,token:e}){let r=t.collectors_data||{},o=r.request,i=r.database,s=r.ajax,u=r.performance,p=r.view,f=r.cache,c=r.dump,y=r.http,l=r.logs,m=r.exception,d=r.routes,T=r.i18n,x=r.env,v=r.mailer,g=t.child_jobs??[],R=jo(t.status),q=Ho(t.duration),F=(i?.slow_queries??0)>0?"profiler-text--error":"profiler-text--success",L=(s?.total_requests??0)>20?"profiler-text--error":"profiler-text--success",W=(f?.hit_rate??0)>80?"profiler-text--success":"profiler-text--warning";return n(b,{children:n("div",{class:"profiler-toolbar-container",children:[o&&n(b,{children:[n(U,{href:`/_profiler/profiles/${e}?tab=request`,className:R,panelLarge:!0,panel:n(kn,{profile:t,requestData:o}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:t.method}),n("span",{children:t.status})]}),n(U,{href:`/_profiler/profiles/${e}?tab=request`,className:q,panel:n(b,{children:[n("div",{class:"profiler-toolbar-panel-header",children:"Performance"}),n("div",{class:"profiler-toolbar-panel-content",children:[n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Duration"}),n("strong",{class:q,children:[t.duration.toFixed(2)," ms"]})]}),Tr(t)!=null&&n("div",{class:"profiler-toolbar-panel-row",title:eo,children:[n("span",{children:"Allocations"}),n("strong",{children:Zn(Tr(t))})]}),n("div",{class:"profiler-toolbar-panel-row",children:[n("span",{children:"Started"}),n("strong",{children:Bo(t.started_at)})]})]})]}),children:[n("span",{class:q,children:t.duration.toFixed(2)}),n("span",{class:"profiler-text--muted profiler-text--xs",children:"ms"})]})]}),i?.total_queries!==void 0&&n(U,{href:`/_profiler/profiles/${e}?tab=database`,className:F,panelLarge:!0,panel:n(Ln,{dbData:i}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"DB"}),n("span",{children:i.total_queries}),(i.slow_queries??0)>0&&n("span",{class:"profiler-text--error profiler-text--xs",children:["\u25B2 ",i.slow_queries]}),n("span",{class:"profiler-text--muted profiler-text--xs",children:[i.total_duration.toFixed(1),"ms"]})]}),s&&s.total_requests>0&&n(U,{href:`/_profiler/profiles/${e}?tab=ajax`,className:L,panelLarge:!0,panel:n(In,{ajaxData:s}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"XHR"}),n("span",{children:s.total_requests}),n("span",{class:"profiler-text--muted profiler-text--xs",children:[s.total_duration.toFixed(1),"ms"]})]}),u?.events&&u.total_events>0&&n(U,{href:`/_profiler/profiles/${e}?tab=timeline`,panel:n(Vn,{perfData:u}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"EVT"}),n("span",{children:u.total_events})]}),p?.total_views!==void 0&&n(U,{href:`/_profiler/profiles/${e}?tab=views`,panel:n(Nn,{viewData:p}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"VIEW"}),n("span",{children:p.total_views}),p.total_partials>0&&n("span",{class:"profiler-text--muted profiler-text--xs",children:["+",p.total_partials,"p"]})]}),f&&f.total_reads>0&&n(U,{href:`/_profiler/profiles/${e}?tab=cache`,className:W,panel:n(Gn,{cacheData:f}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"CACHE"}),n("span",{class:W,children:[f.hit_rate,"%"]})]}),y&&y.total_requests>0&&n(U,{href:`/_profiler/profiles/${e}?tab=http`,className:y.error_requests>0||y.slow_requests>0?"profiler-text--error":"profiler-text--success",panelLarge:!0,panel:n(Hn,{httpData:y}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"HTTP"}),n("span",{children:y.total_requests}),y.slow_requests>0&&n("span",{class:"profiler-text--error profiler-text--xs",children:["\u25B2 ",y.slow_requests]}),n("span",{class:"profiler-text--muted profiler-text--xs",children:[y.total_duration.toFixed(1),"ms"]})]}),c&&c.count>0&&n(U,{href:`/_profiler/profiles/${e}?tab=dump`,className:"profiler-text--warning",panelLarge:!0,panel:n(jn,{dumpData:c}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"DUMP"}),n("span",{class:"profiler-text--warning",children:c.count})]}),l&&l.count>0&&n(U,{href:`/_profiler/profiles/${e}?tab=logs`,className:l.errors>0?"profiler-text--error":l.warnings>0?"profiler-text--warning":"profiler-text--muted",panelLarge:!0,panel:n(Bn,{logData:l}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"LOG"}),n("span",{class:l.errors>0?"profiler-text--error":l.warnings>0?"profiler-text--warning":"",children:l.errors>0?l.errors:l.warnings>0?l.warnings:l.count})]}),m&&m.exception_class&&n(U,{href:`/_profiler/profiles/${e}?tab=exception`,className:"profiler-text--error",panelLarge:!0,panel:n(Jn,{exceptionData:m}),children:[n("span",{class:"profiler-text--error profiler-text--xs",children:"\u{1F4A5}"}),n("span",{class:"profiler-text--error profiler-text--xs",children:m.exception_class.split("::").pop()})]}),d&&d.total>0&&n(U,{href:`/_profiler/profiles/${e}?tab=routes`,panelLarge:!0,panel:n($n,{routesData:d}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"ROUTE"}),n("span",{class:"profiler-text--xs profiler-text--mono",children:d.matched?.pattern??"-"})]}),T&&T.total>0&&n(U,{href:`/_profiler/profiles/${e}?tab=i18n`,className:T.missing_count>0?"profiler-text--error":"profiler-text--muted",panel:n(Wn,{i18nData:T}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"I18N"}),n("span",{class:"profiler-text--xs profiler-text--mono",children:T.locale}),T.missing_count>0&&n("span",{class:"profiler-text--error profiler-text--xs",children:["\u26A0 ",T.missing_count]})]}),g.length>0&&n(U,{href:`/_profiler/profiles/${e}?tab=jobs`,className:g.some(G=>G.status==="failed")?"profiler-text--error":g.some(G=>G.status==="running")?"profiler-text--info":"profiler-text--success",panelLarge:!0,panel:n(zn,{jobs:g}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"JOB"}),n("span",{children:g.length}),g.some(G=>G.status==="failed")&&n("span",{class:"profiler-text--error profiler-text--xs",children:"\u2717"}),g.some(G=>G.status==="running")&&n("span",{class:"profiler-spinner profiler-text--info profiler-text--xs","aria-hidden":"true",children:"\u25D0"})]}),v&&(v.total>0||(v.queued_count??0)>0)&&n(U,{href:`/_profiler/profiles/${e}?tab=mailer`,className:v.failed>0?"profiler-text--error":"profiler-text--success",panelLarge:!0,panel:n(Yn,{mailerData:v}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"MAIL"}),v.total>0&&n("span",{children:v.total}),v.total===0&&(v.queued_count??0)>0&&n("span",{class:"profiler-text--muted",children:[v.queued_count,"q"]}),v.total>0&&(v.queued_count??0)>0&&n("span",{class:"profiler-text--muted profiler-text--xs",children:["+",v.queued_count,"q"]}),v.failed>0&&n("span",{class:"profiler-text--error profiler-text--xs",children:["\u25B2 ",v.failed]})]}),x&&x.total>0&&n(U,{href:`/_profiler/profiles/${e}?tab=env`,panel:n(Xn,{envData:x}),children:[n("span",{class:"profiler-text--muted profiler-text--xs",children:"ENV"}),n("span",{class:"profiler-text--muted",children:x.total})]}),n("a",{href:"/_profiler",class:"profiler-toolbar-item profiler-toolbar-logo",children:"\u2B21 Profiler"})]})})}var Jo="profiler-active-slave",$o=(()=>{try{let t=sessionStorage.getItem(Jo);return t?`/slaves/${t}`:""}catch{return""}})();function ro(){return $o}var Wo="/_profiler/api/cluster/";async function Mt(t){let e=t.url.startsWith(Wo)?"":ro(),r=e?t.url.replace("/_profiler/api",`/_profiler/api${e}`):t.url,{method:o,params:i,data:s,headers:u={},signal:p}=t,f=r,c=i?"?"+new URLSearchParams(Object.entries(i).map(([d,T])=>[d,String(T)])).toString():"",y={"X-Profiler-Request":"1",...u},l=await fetch(f+c,{method:o,signal:p,headers:s!==void 0?{"Content-Type":"application/json",...y}:y,body:s!==void 0?JSON.stringify(s):void 0});if(l.status===204)return{};let m=await l.json();if(!l.ok)throw Object.assign(new Error(m?.error??`HTTP ${l.status}`),{status:l.status,data:m});return m}var zo=(t,e)=>{let r={queryKey:e};for(let o of Object.keys(t))o!=="queryKey"&&Object.defineProperty(r,o,{enumerable:!0,configurable:!0,get:()=>t[o]});return r};var Xo=(t,e)=>Mt({url:`/_profiler/api/toolbar/${t}`,method:"GET",signal:e}),Yo=t=>[`/_profiler/api/toolbar/${t}`],Zo=(t,e)=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Yo(t),queryFn:({signal:s})=>Xo(t,s),enabled:t!=null,...r}};function no(t,e){let r=Zo(t,e),o=mr(r);return zo(o,r.queryKey)}var oo=[1e3,1e3,2e3,2e3,4e3,4e3,8e3,8e3,15e3,15e3],es=3e4,ts=10*6e4;function rs(t){return typeof t=="object"&&t!==null&&Number.isFinite(t.cursor)}function so(t){let e=t.now??(()=>Date.now()),r=t.setTimer??((T,x)=>setTimeout(T,x)),o=t.clearTimer??(T=>clearTimeout(T)),i=t.cursor,s=0,u=e(),p=null,f=!1,c=!1,y=!1,l=()=>{p!==null&&(o(p),p=null)},m=()=>{if(l(),c||f||e()-u>=ts)return;let T=s<oo.length?oo[s]:es;s+=1,p=r(()=>{p=null,d()},T)},d=async()=>{if(!(c||y)){y=!0;try{let T=await t.check(i);if(c)return;rs(T)&&(i=Math.max(i,T.cursor),T.updated===!0&&(s=0,u=e(),t.onUpdate()))}catch{}finally{y=!1}m()}};return m(),{pause(){f=!0,l()},resume(){c||(f=!1,l(),d())},stop(){c=!0,l()}}}var ns="/_profiler";function io(t,e,r){let o=qe(r);o.current=r,$(()=>{if(!t||e===void 0)return;let s=so({cursor:e,check:p=>Mt({url:`${ns}/api/events/${encodeURIComponent(t)}`,method:"GET",params:{since:p}}),onUpdate:()=>o.current()}),u=()=>{document.hidden?s.pause():s.resume()};return document.addEventListener("visibilitychange",u),document.hidden&&s.pause(),()=>{document.removeEventListener("visibilitychange",u),s.stop()}},[t,e!==void 0])}function ao({token:t}){let{data:e,refetch:r,isError:o,isFetching:i}=no(t,{query:{refetchOnWindowFocus:!1}});$(()=>{window.__PROFILER_REFRESH_TOOLBAR__=()=>{r()}},[r]),io(t,e?.events_cursor,()=>{r()});let s=e?.profile??null;return s?n(to,{profile:s,token:t}):o?n("div",{class:"profiler-toolbar-container",children:n("span",{class:"profiler-toolbar-error",role:"alert",children:[n("span",{class:"profiler-text--error",children:"Profiler data could not be loaded."}),n("button",{type:"button",class:"profiler-toolbar-retry",disabled:i,onClick:()=>{r()},children:i?"Retrying...":"Retry"})]})}):null}var Dt=class extends Me{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r){console.error("[Profiler] The toolbar failed to render:",r)}render(){return this.state.failed?n("div",{class:"profiler-toolbar-container",children:n("span",{class:"profiler-toolbar-error",role:"alert",children:[n("span",{class:"profiler-text--error",children:"Profiler toolbar error."}),n("button",{type:"button",class:"profiler-toolbar-retry",onClick:()=>this.setState({failed:!1}),children:"Retry"})]})}):this.props.children}};function uo(t){return t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey&&t.code==="KeyP"}var _r=new Map;function vr(t){try{return localStorage.getItem(t)}catch{return _r.has(t)?_r.get(t):null}}function lo(t,e){_r.set(t,e);try{localStorage.setItem(t,e)}catch{}}var gr=280;function po(t){let e=vr("profiler-theme"),r=e==="light"?"light":e==="dark"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";t.forEach(o=>o.setAttribute("data-theme",r))}var os=new ar({defaultOptions:{queries:{staleTime:3e4,retry:1}}});function co(){let t=document.getElementById("profiler-toolbar"),e=document.getElementById("profiler-toolbar-toggle");if(!t||!e)return;let r=t.dataset.token;if(!r)return;window.__PROFILER_TOOLBAR_TEARDOWN__?.();let o=new AbortController,{signal:i}=o,s=()=>{o.abort(),Gt(null,t),window.__PROFILER_TOOLBAR_TEARDOWN__===s&&delete window.__PROFILER_TOOLBAR_TEARDOWN__};window.__PROFILER_TOOLBAR_TEARDOWN__=s,document.addEventListener("turbo:load",()=>{t.isConnected||s()},{signal:i});let u=[t,e];po(u),window.addEventListener("storage",c=>{c.key==="profiler-theme"&&po(u)},{signal:i}),window.addEventListener("profiler:theme-change",(c=>{c.detail?.theme&&u.forEach(y=>y.setAttribute("data-theme",c.detail.theme))}),{signal:i});let p=vr("profiler-toolbar-collapsed")==="true";e.dataset.collapsed=String(p),p&&!t.style.transform&&(t.style.animation="none",t.style.transform="translateX(calc(100% + 44px))"),p||setTimeout(()=>{t.style.animation="none"},400);function f(){let c=!p;p=c,lo("profiler-toolbar-collapsed",String(c)),e.dataset.collapsed=String(c),c?(t.style.transition=`transform ${gr}ms cubic-bezier(0.4,0,0.2,1)`,t.style.transform="translateX(calc(100% + 44px))"):(t.style.transition="none",t.style.transform="translateX(calc(100% + 44px))",t.offsetWidth,t.style.transition=`transform ${gr}ms cubic-bezier(0.4,0,0.2,1)`,t.style.transform="translateX(0)",setTimeout(()=>{t.style.transform="",t.style.transition=""},gr+50))}e.addEventListener("click",f,{signal:i}),document.addEventListener("keydown",c=>{uo(c)&&(c.preventDefault(),f())},{signal:i}),Gt(n(yr,{client:os,children:n(Dt,{children:n(ao,{token:r})})}),t)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",co):co();})();