@motiadev/plugin-states 0.14.0-beta.165-285707 → 0.14.0-beta.165-602289

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.
package/dist/index.js CHANGED
@@ -1,1996 +0,0 @@
1
- import * as D from "react";
2
- import W, { forwardRef as _t, createElement as Te, useState as P, useCallback as K, useEffect as Y, createContext as Yt, useContext as te, isValidElement as qt, useRef as V, useMemo as ue, memo as Fe } from "react";
3
- import { useThemeStore as Bt, Button as ye, Sidebar as Wt, Input as Kt, Table as Gt, TableHeader as Xt, TableRow as Ke, TableHead as pe, Checkbox as Ge, TableBody as Qt, cn as er, TableCell as ge } from "@motiadev/ui";
4
- var he = { exports: {} }, se = {};
5
- /**
6
- * @license React
7
- * react-jsx-runtime.production.js
8
- *
9
- * Copyright (c) Meta Platforms, Inc. and affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- */
14
- var Xe;
15
- function tr() {
16
- if (Xe) return se;
17
- Xe = 1;
18
- var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
19
- function r(n, s, o) {
20
- var c = null;
21
- if (o !== void 0 && (c = "" + o), s.key !== void 0 && (c = "" + s.key), "key" in s) {
22
- o = {};
23
- for (var l in s)
24
- l !== "key" && (o[l] = s[l]);
25
- } else o = s;
26
- return s = o.ref, {
27
- $$typeof: e,
28
- type: n,
29
- key: c,
30
- ref: s !== void 0 ? s : null,
31
- props: o
32
- };
33
- }
34
- return se.Fragment = t, se.jsx = r, se.jsxs = r, se;
35
- }
36
- var oe = {};
37
- /**
38
- * @license React
39
- * react-jsx-runtime.development.js
40
- *
41
- * Copyright (c) Meta Platforms, Inc. and affiliates.
42
- *
43
- * This source code is licensed under the MIT license found in the
44
- * LICENSE file in the root directory of this source tree.
45
- */
46
- var Qe;
47
- function rr() {
48
- return Qe || (Qe = 1, process.env.NODE_ENV !== "production" && function() {
49
- function e(i) {
50
- if (i == null) return null;
51
- if (typeof i == "function")
52
- return i.$$typeof === C ? null : i.displayName || i.name || null;
53
- if (typeof i == "string") return i;
54
- switch (i) {
55
- case A:
56
- return "Fragment";
57
- case N:
58
- return "Profiler";
59
- case f:
60
- return "StrictMode";
61
- case m:
62
- return "Suspense";
63
- case w:
64
- return "SuspenseList";
65
- case _:
66
- return "Activity";
67
- }
68
- if (typeof i == "object")
69
- switch (typeof i.tag == "number" && console.error(
70
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
71
- ), i.$$typeof) {
72
- case O:
73
- return "Portal";
74
- case M:
75
- return (i.displayName || "Context") + ".Provider";
76
- case E:
77
- return (i._context.displayName || "Context") + ".Consumer";
78
- case b:
79
- var p = i.render;
80
- return i = i.displayName, i || (i = p.displayName || p.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
81
- case y:
82
- return p = i.displayName || null, p !== null ? p : e(i.type) || "Memo";
83
- case H:
84
- p = i._payload, i = i._init;
85
- try {
86
- return e(i(p));
87
- } catch {
88
- }
89
- }
90
- return null;
91
- }
92
- function t(i) {
93
- return "" + i;
94
- }
95
- function r(i) {
96
- try {
97
- t(i);
98
- var p = !1;
99
- } catch {
100
- p = !0;
101
- }
102
- if (p) {
103
- p = console;
104
- var x = p.error, h = typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object";
105
- return x.call(
106
- p,
107
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
- h
109
- ), t(i);
110
- }
111
- }
112
- function n(i) {
113
- if (i === A) return "<>";
114
- if (typeof i == "object" && i !== null && i.$$typeof === H)
115
- return "<...>";
116
- try {
117
- var p = e(i);
118
- return p ? "<" + p + ">" : "<...>";
119
- } catch {
120
- return "<...>";
121
- }
122
- }
123
- function s() {
124
- var i = $.A;
125
- return i === null ? null : i.getOwner();
126
- }
127
- function o() {
128
- return Error("react-stack-top-frame");
129
- }
130
- function c(i) {
131
- if (L.call(i, "key")) {
132
- var p = Object.getOwnPropertyDescriptor(i, "key").get;
133
- if (p && p.isReactWarning) return !1;
134
- }
135
- return i.key !== void 0;
136
- }
137
- function l(i, p) {
138
- function x() {
139
- j || (j = !0, console.error(
140
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
141
- p
142
- ));
143
- }
144
- x.isReactWarning = !0, Object.defineProperty(i, "key", {
145
- get: x,
146
- configurable: !0
147
- });
148
- }
149
- function g() {
150
- var i = e(this.type);
151
- return R[i] || (R[i] = !0, console.error(
152
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
153
- )), i = this.props.ref, i !== void 0 ? i : null;
154
- }
155
- function u(i, p, x, h, k, q, Se, Oe) {
156
- return x = q.ref, i = {
157
- $$typeof: T,
158
- type: i,
159
- key: p,
160
- props: q,
161
- _owner: k
162
- }, (x !== void 0 ? x : null) !== null ? Object.defineProperty(i, "ref", {
163
- enumerable: !1,
164
- get: g
165
- }) : Object.defineProperty(i, "ref", { enumerable: !1, value: null }), i._store = {}, Object.defineProperty(i._store, "validated", {
166
- configurable: !1,
167
- enumerable: !1,
168
- writable: !0,
169
- value: 0
170
- }), Object.defineProperty(i, "_debugInfo", {
171
- configurable: !1,
172
- enumerable: !1,
173
- writable: !0,
174
- value: null
175
- }), Object.defineProperty(i, "_debugStack", {
176
- configurable: !1,
177
- enumerable: !1,
178
- writable: !0,
179
- value: Se
180
- }), Object.defineProperty(i, "_debugTask", {
181
- configurable: !1,
182
- enumerable: !1,
183
- writable: !0,
184
- value: Oe
185
- }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
186
- }
187
- function d(i, p, x, h, k, q, Se, Oe) {
188
- var J = p.children;
189
- if (J !== void 0)
190
- if (h)
191
- if (U(J)) {
192
- for (h = 0; h < J.length; h++)
193
- v(J[h]);
194
- Object.freeze && Object.freeze(J);
195
- } else
196
- console.error(
197
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
- );
199
- else v(J);
200
- if (L.call(p, "key")) {
201
- J = e(i);
202
- var re = Object.keys(p).filter(function(Jt) {
203
- return Jt !== "key";
204
- });
205
- h = 0 < re.length ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}", Z[J + h] || (re = 0 < re.length ? "{" + re.join(": ..., ") + ": ...}" : "{}", console.error(
206
- `A props object containing a "key" prop is being spread into JSX:
207
- let props = %s;
208
- <%s {...props} />
209
- React keys must be passed directly to JSX without using spread:
210
- let props = %s;
211
- <%s key={someKey} {...props} />`,
212
- h,
213
- J,
214
- re,
215
- J
216
- ), Z[J + h] = !0);
217
- }
218
- if (J = null, x !== void 0 && (r(x), J = "" + x), c(p) && (r(p.key), J = "" + p.key), "key" in p) {
219
- x = {};
220
- for (var Ee in p)
221
- Ee !== "key" && (x[Ee] = p[Ee]);
222
- } else x = p;
223
- return J && l(
224
- x,
225
- typeof i == "function" ? i.displayName || i.name || "Unknown" : i
226
- ), u(
227
- i,
228
- J,
229
- q,
230
- k,
231
- s(),
232
- x,
233
- Se,
234
- Oe
235
- );
236
- }
237
- function v(i) {
238
- typeof i == "object" && i !== null && i.$$typeof === T && i._store && (i._store.validated = 1);
239
- }
240
- var S = W, T = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), E = Symbol.for("react.consumer"), M = Symbol.for("react.context"), b = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), C = Symbol.for("react.client.reference"), $ = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, U = Array.isArray, F = console.createTask ? console.createTask : function() {
241
- return null;
242
- };
243
- S = {
244
- react_stack_bottom_frame: function(i) {
245
- return i();
246
- }
247
- };
248
- var j, R = {}, I = S.react_stack_bottom_frame.bind(
249
- S,
250
- o
251
- )(), z = F(n(o)), Z = {};
252
- oe.Fragment = A, oe.jsx = function(i, p, x, h, k) {
253
- var q = 1e4 > $.recentlyCreatedOwnerStacks++;
254
- return d(
255
- i,
256
- p,
257
- x,
258
- !1,
259
- h,
260
- k,
261
- q ? Error("react-stack-top-frame") : I,
262
- q ? F(n(i)) : z
263
- );
264
- }, oe.jsxs = function(i, p, x, h, k) {
265
- var q = 1e4 > $.recentlyCreatedOwnerStacks++;
266
- return d(
267
- i,
268
- p,
269
- x,
270
- !0,
271
- h,
272
- k,
273
- q ? Error("react-stack-top-frame") : I,
274
- q ? F(n(i)) : z
275
- );
276
- };
277
- }()), oe;
278
- }
279
- var et;
280
- function nr() {
281
- return et || (et = 1, process.env.NODE_ENV === "production" ? he.exports = tr() : he.exports = rr()), he.exports;
282
- }
283
- var a = nr();
284
- /**
285
- * @license lucide-react v0.545.0 - ISC
286
- *
287
- * This source code is licensed under the ISC license.
288
- * See the LICENSE file in the root directory of this source tree.
289
- */
290
- const ar = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), sr = (e) => e.replace(
291
- /^([A-Z])|[\s-_]+(\w)/g,
292
- (t, r, n) => n ? n.toUpperCase() : r.toLowerCase()
293
- ), tt = (e) => {
294
- const t = sr(e);
295
- return t.charAt(0).toUpperCase() + t.slice(1);
296
- }, Rt = (...e) => e.filter((t, r, n) => !!t && t.trim() !== "" && n.indexOf(t) === r).join(" ").trim(), or = (e) => {
297
- for (const t in e)
298
- if (t.startsWith("aria-") || t === "role" || t === "title")
299
- return !0;
300
- };
301
- /**
302
- * @license lucide-react v0.545.0 - ISC
303
- *
304
- * This source code is licensed under the ISC license.
305
- * See the LICENSE file in the root directory of this source tree.
306
- */
307
- var ir = {
308
- xmlns: "http://www.w3.org/2000/svg",
309
- width: 24,
310
- height: 24,
311
- viewBox: "0 0 24 24",
312
- fill: "none",
313
- stroke: "currentColor",
314
- strokeWidth: 2,
315
- strokeLinecap: "round",
316
- strokeLinejoin: "round"
317
- };
318
- /**
319
- * @license lucide-react v0.545.0 - ISC
320
- *
321
- * This source code is licensed under the ISC license.
322
- * See the LICENSE file in the root directory of this source tree.
323
- */
324
- const cr = _t(
325
- ({
326
- color: e = "currentColor",
327
- size: t = 24,
328
- strokeWidth: r = 2,
329
- absoluteStrokeWidth: n,
330
- className: s = "",
331
- children: o,
332
- iconNode: c,
333
- ...l
334
- }, g) => Te(
335
- "svg",
336
- {
337
- ref: g,
338
- ...ir,
339
- width: t,
340
- height: t,
341
- stroke: e,
342
- strokeWidth: n ? Number(r) * 24 / Number(t) : r,
343
- className: Rt("lucide", s),
344
- ...!o && !or(l) && { "aria-hidden": "true" },
345
- ...l
346
- },
347
- [
348
- ...c.map(([u, d]) => Te(u, d)),
349
- ...Array.isArray(o) ? o : [o]
350
- ]
351
- )
352
- );
353
- /**
354
- * @license lucide-react v0.545.0 - ISC
355
- *
356
- * This source code is licensed under the ISC license.
357
- * See the LICENSE file in the root directory of this source tree.
358
- */
359
- const X = (e, t) => {
360
- const r = _t(
361
- ({ className: n, ...s }, o) => Te(cr, {
362
- ref: o,
363
- iconNode: t,
364
- className: Rt(
365
- `lucide-${ar(tt(e))}`,
366
- `lucide-${e}`,
367
- n
368
- ),
369
- ...s
370
- })
371
- );
372
- return r.displayName = tt(e), r;
373
- };
374
- /**
375
- * @license lucide-react v0.545.0 - ISC
376
- *
377
- * This source code is licensed under the ISC license.
378
- * See the LICENSE file in the root directory of this source tree.
379
- */
380
- const lr = [
381
- ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
382
- ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
383
- ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
384
- ["path", { d: "M8 16H3v5", key: "1cv678" }]
385
- ], ur = X("refresh-cw", lr);
386
- /**
387
- * @license lucide-react v0.545.0 - ISC
388
- *
389
- * This source code is licensed under the ISC license.
390
- * See the LICENSE file in the root directory of this source tree.
391
- */
392
- const dr = [
393
- ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
394
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
395
- ], fr = X("search", dr);
396
- /**
397
- * @license lucide-react v0.545.0 - ISC
398
- *
399
- * This source code is licensed under the ISC license.
400
- * See the LICENSE file in the root directory of this source tree.
401
- */
402
- const pr = [
403
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
404
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
405
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
406
- ], gr = X("trash", pr);
407
- /**
408
- * @license lucide-react v0.545.0 - ISC
409
- *
410
- * This source code is licensed under the ISC license.
411
- * See the LICENSE file in the root directory of this source tree.
412
- */
413
- const hr = [
414
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
415
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
416
- ], Mt = X("x", hr), vr = () => {
417
- const [e, t] = P([]), r = K(() => {
418
- fetch("/__motia/state").then(async (s) => {
419
- if (s.ok)
420
- return s.json();
421
- throw await s.json();
422
- }).then(t).catch((s) => console.error(s));
423
- }, []), n = (s) => {
424
- fetch("/__motia/state/delete", {
425
- method: "POST",
426
- headers: { "Content-Type": "application/json" },
427
- body: JSON.stringify({ ids: s })
428
- }).then(() => r());
429
- };
430
- return Y(() => {
431
- r();
432
- }, [r]), { items: e, deleteItems: n, refetch: r };
433
- }, rt = (e) => {
434
- let t;
435
- const r = /* @__PURE__ */ new Set(), n = (u, d) => {
436
- const v = typeof u == "function" ? u(t) : u;
437
- if (!Object.is(v, t)) {
438
- const S = t;
439
- t = d ?? (typeof v != "object" || v === null) ? v : Object.assign({}, t, v), r.forEach((T) => T(t, S));
440
- }
441
- }, s = () => t, l = { setState: n, getState: s, getInitialState: () => g, subscribe: (u) => (r.add(u), () => r.delete(u)) }, g = t = e(n, s, l);
442
- return l;
443
- }, mr = (e) => e ? rt(e) : rt, yr = (e) => e;
444
- function jr(e, t = yr) {
445
- const r = W.useSyncExternalStore(
446
- e.subscribe,
447
- W.useCallback(() => t(e.getState()), [e, t]),
448
- W.useCallback(() => t(e.getInitialState()), [e, t])
449
- );
450
- return W.useDebugValue(r), r;
451
- }
452
- const br = (e) => {
453
- const t = mr(e), r = (n) => jr(t, n);
454
- return Object.assign(r, t), r;
455
- }, wr = (e) => br, nt = wr()((e) => ({
456
- selectedStateId: void 0,
457
- selectStateId: (t) => e({ selectedStateId: t })
458
- }));
459
- function xr(e, t, r, n) {
460
- function s(o) {
461
- return o instanceof r ? o : new r(function(c) {
462
- c(o);
463
- });
464
- }
465
- return new (r || (r = Promise))(function(o, c) {
466
- function l(d) {
467
- try {
468
- u(n.next(d));
469
- } catch (v) {
470
- c(v);
471
- }
472
- }
473
- function g(d) {
474
- try {
475
- u(n.throw(d));
476
- } catch (v) {
477
- c(v);
478
- }
479
- }
480
- function u(d) {
481
- d.done ? o(d.value) : s(d.value).then(l, g);
482
- }
483
- u((n = n.apply(e, [])).next());
484
- });
485
- }
486
- var Cr = function() {
487
- var e = document.getSelection();
488
- if (!e.rangeCount)
489
- return function() {
490
- };
491
- for (var t = document.activeElement, r = [], n = 0; n < e.rangeCount; n++)
492
- r.push(e.getRangeAt(n));
493
- switch (t.tagName.toUpperCase()) {
494
- // .toUpperCase handles XHTML
495
- case "INPUT":
496
- case "TEXTAREA":
497
- t.blur();
498
- break;
499
- default:
500
- t = null;
501
- break;
502
- }
503
- return e.removeAllRanges(), function() {
504
- e.type === "Caret" && e.removeAllRanges(), e.rangeCount || r.forEach(function(s) {
505
- e.addRange(s);
506
- }), t && t.focus();
507
- };
508
- }, Sr = Cr, at = {
509
- "text/plain": "Text",
510
- "text/html": "Url",
511
- default: "Text"
512
- }, Or = "Copy to clipboard: #{key}, Enter";
513
- function Er(e) {
514
- var t = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
515
- return e.replace(/#{\s*key\s*}/g, t);
516
- }
517
- function kr(e, t) {
518
- var r, n, s, o, c, l, g = !1;
519
- t || (t = {}), r = t.debug || !1;
520
- try {
521
- s = Sr(), o = document.createRange(), c = document.getSelection(), l = document.createElement("span"), l.textContent = e, l.ariaHidden = "true", l.style.all = "unset", l.style.position = "fixed", l.style.top = 0, l.style.clip = "rect(0, 0, 0, 0)", l.style.whiteSpace = "pre", l.style.webkitUserSelect = "text", l.style.MozUserSelect = "text", l.style.msUserSelect = "text", l.style.userSelect = "text", l.addEventListener("copy", function(d) {
522
- if (d.stopPropagation(), t.format)
523
- if (d.preventDefault(), typeof d.clipboardData > "u") {
524
- r && console.warn("unable to use e.clipboardData"), r && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
525
- var v = at[t.format] || at.default;
526
- window.clipboardData.setData(v, e);
527
- } else
528
- d.clipboardData.clearData(), d.clipboardData.setData(t.format, e);
529
- t.onCopy && (d.preventDefault(), t.onCopy(d.clipboardData));
530
- }), document.body.appendChild(l), o.selectNodeContents(l), c.addRange(o);
531
- var u = document.execCommand("copy");
532
- if (!u)
533
- throw new Error("copy command was unsuccessful");
534
- g = !0;
535
- } catch (d) {
536
- r && console.error("unable to copy using execCommand: ", d), r && console.warn("trying IE specific stuff");
537
- try {
538
- window.clipboardData.setData(t.format || "text", e), t.onCopy && t.onCopy(window.clipboardData), g = !0;
539
- } catch (v) {
540
- r && console.error("unable to copy using clipboardData: ", v), r && console.error("falling back to prompt"), n = Er("message" in t ? t.message : Or), window.prompt(n, e);
541
- }
542
- } finally {
543
- c && (typeof c.removeRange == "function" ? c.removeRange(o) : c.removeAllRanges()), l && document.body.removeChild(l), s();
544
- }
545
- return g;
546
- }
547
- var Ar = kr;
548
- function Q(e) {
549
- return Object.prototype.toString.call(e) === "[object Object]";
550
- }
551
- function ce(e) {
552
- return Array.isArray(e) ? e.length : Q(e) ? Object.keys(e).length : 0;
553
- }
554
- function Nr(e, t) {
555
- if (typeof e == "string")
556
- return e;
557
- try {
558
- return JSON.stringify(e, (r, n) => {
559
- switch (typeof n) {
560
- case "bigint":
561
- return String(n) + "n";
562
- case "number":
563
- case "boolean":
564
- case "object":
565
- case "string":
566
- return n;
567
- default:
568
- return String(n);
569
- }
570
- }, t);
571
- } catch (r) {
572
- return `${r.name}: ${r.message}` || "JSON.stringify failed";
573
- }
574
- }
575
- function Tr(e) {
576
- return xr(this, void 0, void 0, function* () {
577
- try {
578
- yield navigator.clipboard.writeText(e);
579
- } catch {
580
- Ar(e);
581
- }
582
- });
583
- }
584
- function st(e, t, r, n, s, o) {
585
- if (o && o.collapsed !== void 0)
586
- return !!o.collapsed;
587
- if (typeof n == "boolean")
588
- return n;
589
- if (typeof n == "number" && t > n)
590
- return !0;
591
- const c = ce(e);
592
- if (typeof n == "function") {
593
- const l = Ue(n, [{ node: e, depth: t, indexOrName: r, size: c }]);
594
- if (typeof l == "boolean")
595
- return l;
596
- }
597
- return !!(Array.isArray(e) && c > s || Q(e) && c > s);
598
- }
599
- function ot(e, t, r, n, s, o) {
600
- if (o && o.collapsed !== void 0)
601
- return !!o.collapsed;
602
- if (typeof n == "boolean")
603
- return n;
604
- if (typeof n == "number" && t > n)
605
- return !0;
606
- const c = Math.ceil(e.length / 100);
607
- if (typeof n == "function") {
608
- const l = Ue(n, [{ node: e, depth: t, indexOrName: r, size: c }]);
609
- if (typeof l == "boolean")
610
- return l;
611
- }
612
- return !!(Array.isArray(e) && c > s || Q(e) && c > s);
613
- }
614
- function ae(e, t, r) {
615
- return typeof e == "boolean" ? e : !!(typeof e == "number" && t > e || e === "collapsed" && r || e === "expanded" && !r);
616
- }
617
- function Ue(e, t) {
618
- try {
619
- return e(...t);
620
- } catch (r) {
621
- reportError(r);
622
- }
623
- }
624
- function It(e) {
625
- if (e === !0 || Q(e) && e.add === !0)
626
- return !0;
627
- }
628
- function it(e) {
629
- if (e === !0 || Q(e) && e.edit === !0)
630
- return !0;
631
- }
632
- function ze(e) {
633
- if (e === !0 || Q(e) && e.delete === !0)
634
- return !0;
635
- }
636
- function _r(e) {
637
- return typeof e == "function";
638
- }
639
- function Pt(e) {
640
- return !e || e.add === void 0 || !!e.add;
641
- }
642
- function ct(e) {
643
- return !e || e.edit === void 0 || !!e.edit;
644
- }
645
- function Ze(e) {
646
- return !e || e.delete === void 0 || !!e.delete;
647
- }
648
- function we(e) {
649
- return !e || e.enableClipboard === void 0 || !!e.enableClipboard;
650
- }
651
- function Rr(e) {
652
- return !e || e.matchesURL === void 0 || !!e.matchesURL;
653
- }
654
- function Mr(e, t) {
655
- return e === "string" ? t.trim().replace(/^\"([\s\S]+?)\"$/, "$1") : t;
656
- }
657
- var lt;
658
- function _e() {
659
- return _e = Object.assign ? Object.assign.bind() : function(e) {
660
- for (var t = 1; t < arguments.length; t++) {
661
- var r = arguments[t];
662
- for (var n in r)
663
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
664
- }
665
- return e;
666
- }, _e.apply(this, arguments);
667
- }
668
- var Je = function(t) {
669
- return /* @__PURE__ */ D.createElement("svg", _e({
670
- xmlns: "http://www.w3.org/2000/svg",
671
- width: 16,
672
- height: 16,
673
- fill: "none",
674
- viewBox: "0 0 16 16"
675
- }, t), lt || (lt = /* @__PURE__ */ D.createElement("path", {
676
- fill: "currentColor",
677
- d: "M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"
678
- })));
679
- }, ut;
680
- function Re() {
681
- return Re = Object.assign ? Object.assign.bind() : function(e) {
682
- for (var t = 1; t < arguments.length; t++) {
683
- var r = arguments[t];
684
- for (var n in r)
685
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
686
- }
687
- return e;
688
- }, Re.apply(this, arguments);
689
- }
690
- var Ir = function(t) {
691
- return /* @__PURE__ */ D.createElement("svg", Re({
692
- xmlns: "http://www.w3.org/2000/svg",
693
- width: 24,
694
- height: 24,
695
- fill: "none",
696
- viewBox: "0 0 24 24"
697
- }, t), ut || (ut = /* @__PURE__ */ D.createElement("path", {
698
- fill: "currentColor",
699
- d: "M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"
700
- })));
701
- }, dt, ft;
702
- function Me() {
703
- return Me = Object.assign ? Object.assign.bind() : function(e) {
704
- for (var t = 1; t < arguments.length; t++) {
705
- var r = arguments[t];
706
- for (var n in r)
707
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
708
- }
709
- return e;
710
- }, Me.apply(this, arguments);
711
- }
712
- var Pr = function(t) {
713
- return /* @__PURE__ */ D.createElement("svg", Me({
714
- xmlns: "http://www.w3.org/2000/svg",
715
- width: 24,
716
- height: 24,
717
- fill: "none",
718
- viewBox: "0 0 24 24"
719
- }, t), dt || (dt = /* @__PURE__ */ D.createElement("path", {
720
- fill: "currentColor",
721
- d: "M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"
722
- })), ft || (ft = /* @__PURE__ */ D.createElement("path", {
723
- fill: "#14C786",
724
- d: "M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"
725
- })));
726
- };
727
- function xe({ node: e, nodeMeta: t }) {
728
- const { customizeCopy: r, CopyComponent: n, CopiedComponent: s } = te(ee), [o, c] = P(!1), l = (g) => {
729
- g.stopPropagation();
730
- const u = r(e, t);
731
- typeof u == "string" && u && Tr(u), c(!0), setTimeout(() => c(!1), 3e3);
732
- };
733
- return o ? typeof s == "function" ? a.jsx(s, { className: "json-view--copy", style: { display: "inline-block" } }) : a.jsx(Pr, { className: "json-view--copy", style: { display: "inline-block" } }) : typeof n == "function" ? a.jsx(n, { onClick: l, className: "json-view--copy" }) : a.jsx(Ir, { onClick: l, className: "json-view--copy" });
734
- }
735
- function Ie({ indexOrName: e, value: t, depth: r, deleteHandle: n, editHandle: s, parent: o, parentPath: c }) {
736
- const { displayArrayIndex: l } = te(ee), g = Array.isArray(o);
737
- return a.jsxs("div", Object.assign({ className: "json-view--pair" }, { children: [!g || g && l ? a.jsxs(a.Fragment, { children: [a.jsx("span", Object.assign({ className: typeof e == "number" ? "json-view--index" : "json-view--property" }, { children: e })), ":", " "] }) : a.jsx(a.Fragment, {}), a.jsx(Dt, { node: t, depth: r + 1, deleteHandle: (u, d) => n(u, d), editHandle: (u, d, v, S) => s(u, d, v, S), parent: o, indexOrName: e, parentPath: c })] }));
738
- }
739
- var pt, gt;
740
- function Pe() {
741
- return Pe = Object.assign ? Object.assign.bind() : function(e) {
742
- for (var t = 1; t < arguments.length; t++) {
743
- var r = arguments[t];
744
- for (var n in r)
745
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
746
- }
747
- return e;
748
- }, Pe.apply(this, arguments);
749
- }
750
- var Ye = function(t) {
751
- return /* @__PURE__ */ D.createElement("svg", Pe({
752
- xmlns: "http://www.w3.org/2000/svg",
753
- width: 24,
754
- height: 24,
755
- fill: "none",
756
- viewBox: "0 0 24 24"
757
- }, t), pt || (pt = /* @__PURE__ */ D.createElement("path", {
758
- fill: "currentColor",
759
- d: "M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"
760
- })), gt || (gt = /* @__PURE__ */ D.createElement("path", {
761
- fill: "#DA0000",
762
- d: "M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"
763
- })));
764
- }, ht, vt;
765
- function $e() {
766
- return $e = Object.assign ? Object.assign.bind() : function(e) {
767
- for (var t = 1; t < arguments.length; t++) {
768
- var r = arguments[t];
769
- for (var n in r)
770
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
771
- }
772
- return e;
773
- }, $e.apply(this, arguments);
774
- }
775
- var $t = function(t) {
776
- return /* @__PURE__ */ D.createElement("svg", $e({
777
- xmlns: "http://www.w3.org/2000/svg",
778
- width: 24,
779
- height: 24,
780
- fill: "none",
781
- viewBox: "0 0 24 24"
782
- }, t), ht || (ht = /* @__PURE__ */ D.createElement("path", {
783
- fill: "currentColor",
784
- d: "M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"
785
- })), vt || (vt = /* @__PURE__ */ D.createElement("path", {
786
- fill: "#14C786",
787
- d: "M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"
788
- })));
789
- }, mt, yt;
790
- function De() {
791
- return De = Object.assign ? Object.assign.bind() : function(e) {
792
- for (var t = 1; t < arguments.length; t++) {
793
- var r = arguments[t];
794
- for (var n in r)
795
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
796
- }
797
- return e;
798
- }, De.apply(this, arguments);
799
- }
800
- var qe = function(t) {
801
- return /* @__PURE__ */ D.createElement("svg", De({
802
- xmlns: "http://www.w3.org/2000/svg",
803
- width: 24,
804
- height: 24,
805
- fill: "none",
806
- viewBox: "0 0 24 24"
807
- }, t), mt || (mt = /* @__PURE__ */ D.createElement("path", {
808
- fill: "currentColor",
809
- d: "M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"
810
- })), yt || (yt = /* @__PURE__ */ D.createElement("path", {
811
- fill: "#14C786",
812
- d: "m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"
813
- })));
814
- }, jt, bt;
815
- function Le() {
816
- return Le = Object.assign ? Object.assign.bind() : function(e) {
817
- for (var t = 1; t < arguments.length; t++) {
818
- var r = arguments[t];
819
- for (var n in r)
820
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
821
- }
822
- return e;
823
- }, Le.apply(this, arguments);
824
- }
825
- var Be = function(t) {
826
- return /* @__PURE__ */ D.createElement("svg", Le({
827
- xmlns: "http://www.w3.org/2000/svg",
828
- width: 24,
829
- height: 24,
830
- fill: "none",
831
- viewBox: "0 0 24 24"
832
- }, t), jt || (jt = /* @__PURE__ */ D.createElement("path", {
833
- fill: "#DA0000",
834
- d: "M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"
835
- })), bt || (bt = /* @__PURE__ */ D.createElement("path", {
836
- fill: "currentColor",
837
- d: "M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"
838
- })));
839
- };
840
- function $r({ originNode: e, node: t, depth: r, index: n, deleteHandle: s, customOptions: o, startIndex: c, parent: l, parentPath: g }) {
841
- const { enableClipboard: u, src: d, onEdit: v, onChange: S, forceUpdate: T, displaySize: O, CustomOperation: A } = te(ee), f = [...g, String(n)], [N, E] = P(!0), M = K((w, y, H) => {
842
- e[w] = y, v && v({
843
- newValue: y,
844
- oldValue: H,
845
- depth: r,
846
- src: d,
847
- indexOrName: w,
848
- parentType: "array",
849
- parentPath: g
850
- }), S && S({ type: "edit", depth: r, src: d, indexOrName: w, parentType: "array", parentPath: g }), T();
851
- }, [t, v, S, T]), b = (w) => {
852
- e.splice(w, 1), s && s(w, g), T();
853
- }, m = a.jsxs(a.Fragment, { children: [!N && a.jsxs("span", Object.assign({ onClick: () => E(!0), className: "jv-size-chevron" }, { children: [ae(O, r, N) && a.jsxs("span", Object.assign({ className: "jv-size" }, { children: [ce(t), " Items"] })), a.jsx(Je, { className: "jv-chevron" })] })), !N && u && we(o) && a.jsx(xe, { node: t, nodeMeta: { depth: r, indexOrName: n, parent: l, parentPath: g, currentPath: f } }), typeof A == "function" ? a.jsx(A, { node: t }) : null] });
854
- return a.jsxs("div", { children: [a.jsx("span", { children: "[" }), m, N ? a.jsxs("button", Object.assign({ onClick: () => E(!1), className: "jv-button" }, { children: [c, " ... ", c + t.length - 1] })) : a.jsx("div", Object.assign({ className: "jv-indent" }, { children: t.map((w, y) => a.jsx(Ie, { indexOrName: y + c, value: w, depth: r, parent: t, deleteHandle: b, editHandle: M, parentPath: g }, String(n) + String(y))) })), a.jsx("span", { children: "]" })] });
855
- }
856
- function Dr({ node: e, depth: t, deleteHandle: r, indexOrName: n, customOptions: s, parent: o, parentPath: c }) {
857
- const l = typeof n < "u" ? [...c, String(n)] : c, g = [];
858
- for (let j = 0; j < e.length; j += 100)
859
- g.push(e.slice(j, j + 100));
860
- const { collapsed: u, enableClipboard: d, collapseObjectsAfterLength: v, editable: S, onDelete: T, src: O, onAdd: A, CustomOperation: f, onChange: N, forceUpdate: E, displaySize: M } = te(ee), [b, m] = P(ot(e, t, n, u, v, s));
861
- Y(() => {
862
- m(ot(e, t, n, u, v, s));
863
- }, [u, v]);
864
- const [w, y] = P(!1), H = () => {
865
- y(!1), r && r(n, c), T && T({ value: e, depth: t, src: O, indexOrName: n, parentType: "array", parentPath: c }), N && N({
866
- type: "delete",
867
- depth: t,
868
- src: O,
869
- indexOrName: n,
870
- parentType: "array",
871
- parentPath: c
872
- });
873
- }, [_, C] = P(!1), $ = () => {
874
- const j = e;
875
- j.push(null), A && A({ indexOrName: j.length - 1, depth: t, src: O, parentType: "array", parentPath: c }), N && N({ type: "add", indexOrName: j.length - 1, depth: t, src: O, parentType: "array", parentPath: c }), E();
876
- }, L = w || _, U = () => {
877
- y(!1), C(!1);
878
- }, F = a.jsxs(a.Fragment, { children: [!b && !L && a.jsxs("span", Object.assign({ onClick: () => m(!0), className: "jv-size-chevron" }, { children: [ae(M, t, b) && a.jsxs("span", Object.assign({ className: "jv-size" }, { children: [e.length, " Items"] })), a.jsx(Je, { className: "jv-chevron" })] })), L && a.jsx(qe, { className: "json-view--edit", style: { display: "inline-block" }, onClick: _ ? $ : H }), L && a.jsx(Be, { className: "json-view--edit", style: { display: "inline-block" }, onClick: U }), !b && !L && d && we(s) && a.jsx(xe, { node: e, nodeMeta: { depth: t, indexOrName: n, parent: o, parentPath: c, currentPath: l } }), !b && !L && It(S) && Pt(s) && a.jsx($t, { className: "json-view--edit", onClick: () => {
879
- $();
880
- } }), !b && !L && ze(S) && Ze(s) && r && a.jsx(Ye, { className: "json-view--edit", onClick: () => y(!0) }), typeof f == "function" ? a.jsx(f, { node: e }) : null] });
881
- return a.jsxs(a.Fragment, { children: [a.jsx("span", { children: "[" }), F, b ? a.jsx("button", Object.assign({ onClick: () => m(!1), className: "jv-button" }, { children: "..." })) : a.jsx("div", Object.assign({ className: "jv-indent" }, { children: g.map((j, R) => a.jsx($r, { originNode: e, node: j, depth: t, index: R, startIndex: R * 100, deleteHandle: r, customOptions: s, parentPath: c }, String(n) + String(R))) })), a.jsx("span", { children: "]" }), b && ae(M, t, b) && a.jsxs("span", Object.assign({ onClick: () => m(!1), className: "jv-size" }, { children: [e.length, " Items"] }))] });
882
- }
883
- function Lr({ node: e, depth: t, indexOrName: r, deleteHandle: n, customOptions: s, parent: o, parentPath: c }) {
884
- const { collapsed: l, onCollapse: g, enableClipboard: u, ignoreLargeArray: d, collapseObjectsAfterLength: v, editable: S, onDelete: T, src: O, onAdd: A, onEdit: f, onChange: N, forceUpdate: E, displaySize: M, CustomOperation: b } = te(ee), m = typeof r < "u" ? [...c, String(r)] : c;
885
- if (!d && Array.isArray(e) && e.length > 100)
886
- return a.jsx(Dr, { node: e, depth: t, indexOrName: r, deleteHandle: n, customOptions: s, parentPath: m });
887
- const w = Q(e), [y, H] = P(st(e, t, r, l, v, s)), _ = (h) => {
888
- g?.({ isCollapsing: !h, node: e, depth: t, indexOrName: r }), H(h);
889
- };
890
- Y(() => {
891
- _(st(e, t, r, l, v, s));
892
- }, [l, v]);
893
- const C = K((h, k, q) => {
894
- Array.isArray(e) ? e[+h] = k : e && (e[h] = k), f && f({
895
- newValue: k,
896
- oldValue: q,
897
- depth: t,
898
- src: O,
899
- indexOrName: h,
900
- parentType: w ? "object" : "array",
901
- parentPath: m
902
- }), N && N({ type: "edit", depth: t, src: O, indexOrName: h, parentType: w ? "object" : "array", parentPath: m }), E();
903
- }, [e, f, N, E]), $ = (h) => {
904
- Array.isArray(e) ? e.splice(+h, 1) : e && delete e[h], E();
905
- }, [L, U] = P(!1), F = () => {
906
- U(!1), n && n(r, m), T && T({ value: e, depth: t, src: O, indexOrName: r, parentType: w ? "object" : "array", parentPath: m }), N && N({
907
- type: "delete",
908
- depth: t,
909
- src: O,
910
- indexOrName: r,
911
- parentType: w ? "object" : "array",
912
- parentPath: m
913
- });
914
- }, [j, R] = P(!1), I = V(null), z = () => {
915
- var h;
916
- if (w) {
917
- const k = (h = I.current) === null || h === void 0 ? void 0 : h.value;
918
- k && (e[k] = null, I.current && (I.current.value = ""), R(!1), A && A({ indexOrName: k, depth: t, src: O, parentType: "object", parentPath: m }), N && N({ type: "add", indexOrName: k, depth: t, src: O, parentType: "object", parentPath: m }));
919
- } else if (Array.isArray(e)) {
920
- const k = e;
921
- k.push(null), A && A({ indexOrName: k.length - 1, depth: t, src: O, parentType: "array", parentPath: m }), N && N({ type: "add", indexOrName: k.length - 1, depth: t, src: O, parentType: "array", parentPath: m });
922
- }
923
- E();
924
- }, Z = (h) => {
925
- h.key === "Enter" ? (h.preventDefault(), z()) : h.key === "Escape" && p();
926
- }, i = L || j, p = () => {
927
- U(!1), R(!1);
928
- }, x = a.jsxs(a.Fragment, { children: [!y && !i && a.jsxs("span", Object.assign({ onClick: () => _(!0), className: "jv-size-chevron" }, { children: [ae(M, t, y) && a.jsxs("span", Object.assign({ className: "jv-size" }, { children: [ce(e), " Items"] })), a.jsx(Je, { className: "jv-chevron" })] })), j && w && a.jsx("input", { className: "json-view--input", placeholder: "property", ref: I, onKeyDown: Z }), i && a.jsx(qe, { className: "json-view--edit", style: { display: "inline-block" }, onClick: j ? z : F }), i && a.jsx(Be, { className: "json-view--edit", style: { display: "inline-block" }, onClick: p }), !y && !i && u && we(s) && a.jsx(xe, { node: e, nodeMeta: { depth: t, indexOrName: r, parent: o, parentPath: c, currentPath: m } }), !y && !i && It(S) && Pt(s) && a.jsx($t, { className: "json-view--edit", onClick: () => {
929
- w ? (R(!0), setTimeout(() => {
930
- var h;
931
- return (h = I.current) === null || h === void 0 ? void 0 : h.focus();
932
- })) : z();
933
- } }), !y && !i && ze(S) && Ze(s) && n && a.jsx(Ye, { className: "json-view--edit", onClick: () => U(!0) }), typeof b == "function" ? a.jsx(b, { node: e }) : null] });
934
- return Array.isArray(e) ? a.jsxs(a.Fragment, { children: [a.jsx("span", { children: "[" }), x, y ? a.jsx("button", Object.assign({ onClick: () => _(!1), className: "jv-button" }, { children: "..." })) : a.jsx("div", Object.assign({ className: "jv-indent" }, { children: e.map((h, k) => a.jsx(Ie, { indexOrName: k, value: h, depth: t, parent: e, deleteHandle: $, editHandle: C, parentPath: m }, String(r) + String(k))) })), a.jsx("span", { children: "]" }), y && ae(M, t, y) && a.jsxs("span", Object.assign({ onClick: () => _(!1), className: "jv-size" }, { children: [ce(e), " Items"] }))] }) : w ? a.jsxs(a.Fragment, { children: [a.jsx("span", { children: "{" }), x, y ? a.jsx("button", Object.assign({ onClick: () => _(!1), className: "jv-button" }, { children: "..." })) : a.jsx("div", Object.assign({ className: "jv-indent" }, { children: Object.entries(e).map(([h, k]) => a.jsx(Ie, { indexOrName: h, value: k, depth: t, parent: e, deleteHandle: $, editHandle: C, parentPath: m }, String(r) + String(h))) })), a.jsx("span", { children: "}" }), y && ae(M, t, y) && a.jsxs("span", Object.assign({ onClick: () => _(!1), className: "jv-size" }, { children: [ce(e), " Items"] }))] }) : a.jsx("span", { children: String(e) });
935
- }
936
- const Vr = W.forwardRef(({ str: e, className: t, ctrlClick: r }, n) => {
937
- let { collapseStringMode: s, collapseStringsAfterLength: o, customizeCollapseStringUI: c } = te(ee);
938
- const [l, g] = P(!0), u = V(null);
939
- o = o > 0 ? o : 0;
940
- const d = e.replace(/\s+/g, " "), v = typeof c == "function" ? c(d, l) : typeof c == "string" ? c : "...", S = (T) => {
941
- var O;
942
- if ((T.ctrlKey || T.metaKey) && r)
943
- r(T);
944
- else {
945
- const A = window.getSelection();
946
- if (A && A.anchorOffset !== A.focusOffset && ((O = A.anchorNode) === null || O === void 0 ? void 0 : O.parentElement) === u.current)
947
- return;
948
- g(!l);
949
- }
950
- };
951
- if (e.length <= o)
952
- return a.jsxs("span", Object.assign({ ref: u, className: t, onClick: r }, { children: ['"', e, '"'] }));
953
- if (s === "address")
954
- return e.length <= 10 ? a.jsxs("span", Object.assign({ ref: u, className: t, onClick: r }, { children: ['"', e, '"'] })) : a.jsxs("span", Object.assign({ ref: u, onClick: S, className: t + " cursor-pointer" }, { children: ['"', l ? [d.slice(0, 6), v, d.slice(-4)] : e, '"'] }));
955
- if (s === "directly")
956
- return a.jsxs("span", Object.assign({ ref: u, onClick: S, className: t + " cursor-pointer" }, { children: ['"', l ? [d.slice(0, o), v] : e, '"'] }));
957
- if (s === "word") {
958
- let T = o, O = o + 1, A = d, f = 1;
959
- for (; ; ) {
960
- if (/\W/.test(e[T])) {
961
- A = e.slice(0, T);
962
- break;
963
- }
964
- if (/\W/.test(e[O])) {
965
- A = e.slice(0, O);
966
- break;
967
- }
968
- if (f === 6) {
969
- A = e.slice(0, o);
970
- break;
971
- }
972
- f++, T--, O++;
973
- }
974
- return a.jsxs("span", Object.assign({ ref: u, onClick: S, className: t + " cursor-pointer" }, { children: ['"', l ? [A, v] : e, '"'] }));
975
- }
976
- return a.jsxs("span", Object.assign({ ref: u, className: t }, { children: ['"', e, '"'] }));
977
- });
978
- var wt;
979
- function Ve() {
980
- return Ve = Object.assign ? Object.assign.bind() : function(e) {
981
- for (var t = 1; t < arguments.length; t++) {
982
- var r = arguments[t];
983
- for (var n in r)
984
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
985
- }
986
- return e;
987
- }, Ve.apply(this, arguments);
988
- }
989
- var Hr = function(t) {
990
- return /* @__PURE__ */ D.createElement("svg", Ve({
991
- xmlns: "http://www.w3.org/2000/svg",
992
- width: 24,
993
- height: 24,
994
- fill: "none",
995
- viewBox: "0 0 24 24"
996
- }, t), wt || (wt = /* @__PURE__ */ D.createElement("path", {
997
- fill: "currentColor",
998
- d: "M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"
999
- })));
1000
- }, xt, Ct;
1001
- function He() {
1002
- return He = Object.assign ? Object.assign.bind() : function(e) {
1003
- for (var t = 1; t < arguments.length; t++) {
1004
- var r = arguments[t];
1005
- for (var n in r)
1006
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
1007
- }
1008
- return e;
1009
- }, He.apply(this, arguments);
1010
- }
1011
- var Fr = function(t) {
1012
- return /* @__PURE__ */ D.createElement("svg", He({
1013
- xmlns: "http://www.w3.org/2000/svg",
1014
- width: 24,
1015
- height: 24,
1016
- fill: "none",
1017
- viewBox: "0 0 24 24"
1018
- }, t), xt || (xt = /* @__PURE__ */ D.createElement("path", {
1019
- fill: "currentColor",
1020
- d: "M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"
1021
- })), Ct || (Ct = /* @__PURE__ */ D.createElement("path", {
1022
- fill: "currentColor",
1023
- d: "M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"
1024
- })));
1025
- };
1026
- function Dt({ node: e, depth: t, deleteHandle: r, indexOrName: n, parent: s, editHandle: o, parentPath: c }) {
1027
- const { collapseStringsAfterLength: l, enableClipboard: g, editable: u, src: d, onDelete: v, onChange: S, customizeNode: T, matchesURL: O, urlRegExp: A, EditComponent: f, DoneComponent: N, CancelComponent: E, CustomOperation: M } = te(ee);
1028
- let b;
1029
- if (typeof T == "function" && (b = Ue(T, [{ node: e, depth: t, indexOrName: n }])), b) {
1030
- if (qt(b))
1031
- return b;
1032
- if (_r(b)) {
1033
- const m = b;
1034
- return a.jsx(m, { node: e, depth: t, indexOrName: n });
1035
- }
1036
- }
1037
- if (Array.isArray(e) || Q(e))
1038
- return a.jsx(Lr, { parent: s, node: e, depth: t, indexOrName: n, deleteHandle: r, parentPath: c, customOptions: typeof b == "object" ? b : void 0 });
1039
- {
1040
- const m = typeof e, w = typeof n < "u" ? [...c, String(n)] : c, [y, H] = P(!1), [_, C] = P(!1), $ = V(null), L = () => {
1041
- H(!0), setTimeout(() => {
1042
- var h, k;
1043
- (h = window.getSelection()) === null || h === void 0 || h.selectAllChildren($.current), (k = $.current) === null || k === void 0 || k.focus();
1044
- });
1045
- }, U = K(() => {
1046
- let h = $.current.innerText;
1047
- try {
1048
- const k = JSON.parse(h);
1049
- o && o(n, k, e, c);
1050
- } catch {
1051
- const q = Mr(m, h);
1052
- o && o(n, q, e, c);
1053
- }
1054
- H(!1);
1055
- }, [o, n, e, c, m]), F = () => {
1056
- H(!1), C(!1);
1057
- }, j = () => {
1058
- C(!1), r && r(n, c), v && v({
1059
- value: e,
1060
- depth: t,
1061
- src: d,
1062
- indexOrName: n,
1063
- parentType: Array.isArray(s) ? "array" : "object",
1064
- parentPath: c
1065
- }), S && S({
1066
- depth: t,
1067
- src: d,
1068
- indexOrName: n,
1069
- parentType: Array.isArray(s) ? "array" : "object",
1070
- type: "delete",
1071
- parentPath: c
1072
- });
1073
- }, R = K((h) => {
1074
- h.key === "Enter" ? (h.preventDefault(), U()) : h.key === "Escape" && F();
1075
- }, [U]), I = y || _, z = !I && it(u) && ct(b) && o ? (h) => {
1076
- (h.ctrlKey || h.metaKey) && L();
1077
- } : void 0, Z = a.jsxs(a.Fragment, { children: [I && (typeof N == "function" ? a.jsx(N, { className: "json-view--edit", style: { display: "inline-block" }, onClick: _ ? j : U }) : a.jsx(qe, { className: "json-view--edit", style: { display: "inline-block" }, onClick: _ ? j : U })), I && (typeof E == "function" ? a.jsx(E, { className: "json-view--edit", style: { display: "inline-block" }, onClick: F }) : a.jsx(Be, { className: "json-view--edit", style: { display: "inline-block" }, onClick: F })), !I && g && we(b) && a.jsx(xe, { node: e, nodeMeta: { depth: t, indexOrName: n, parent: s, parentPath: c, currentPath: w } }), !I && O && m === "string" && A.test(e) && Rr(b) && a.jsx("a", Object.assign({ href: e, target: "_blank", className: "json-view--link" }, { children: a.jsx(Fr, {}) })), !I && it(u) && ct(b) && o && (typeof f == "function" ? a.jsx(f, { className: "json-view--edit", onClick: L }) : a.jsx(Hr, { className: "json-view--edit", onClick: L })), !I && ze(u) && Ze(b) && r && a.jsx(Ye, { className: "json-view--edit", onClick: () => C(!0) }), typeof M == "function" ? a.jsx(M, { node: e }) : null] });
1078
- let i = "json-view--string";
1079
- switch (m) {
1080
- case "number":
1081
- case "bigint":
1082
- i = "json-view--number";
1083
- break;
1084
- case "boolean":
1085
- i = "json-view--boolean";
1086
- break;
1087
- case "object":
1088
- i = "json-view--null";
1089
- break;
1090
- }
1091
- typeof b?.className == "string" && (i += " " + b.className), _ && (i += " json-view--deleting");
1092
- let p = String(e);
1093
- m === "bigint" && (p += "n");
1094
- const x = ue(() => a.jsx("span", { contentEditable: !0, className: i, dangerouslySetInnerHTML: { __html: m === "string" ? `"${p}"` : p }, ref: $, onKeyDown: R }), [p, m, R]);
1095
- return m === "string" ? a.jsxs(a.Fragment, { children: [y ? x : e.length > l ? a.jsx(Vr, { str: e, ref: $, className: i, ctrlClick: z }) : a.jsxs("span", Object.assign({ className: i, onClick: z }, { children: ['"', p, '"'] })), Z] }) : a.jsxs(a.Fragment, { children: [y ? x : a.jsx("span", Object.assign({ className: i, onClick: z }, { children: p })), Z] });
1096
- }
1097
- }
1098
- const Lt = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/, ee = Yt({
1099
- src: void 0,
1100
- collapseStringsAfterLength: 99,
1101
- collapseStringMode: "directly",
1102
- customizeCollapseStringUI: void 0,
1103
- collapseObjectsAfterLength: 20,
1104
- collapsed: !1,
1105
- onCollapse: void 0,
1106
- enableClipboard: !0,
1107
- editable: !1,
1108
- onEdit: void 0,
1109
- onDelete: void 0,
1110
- onAdd: void 0,
1111
- onChange: void 0,
1112
- forceUpdate: () => {
1113
- },
1114
- customizeNode: void 0,
1115
- customizeCopy: () => {
1116
- },
1117
- displaySize: void 0,
1118
- displayArrayIndex: !0,
1119
- matchesURL: !1,
1120
- urlRegExp: Lt,
1121
- ignoreLargeArray: !1,
1122
- CopyComponent: void 0,
1123
- CopiedComponent: void 0,
1124
- EditComponent: void 0,
1125
- CancelComponent: void 0,
1126
- DoneComponent: void 0,
1127
- CustomOperation: void 0
1128
- });
1129
- function Ur({ src: e, collapseStringsAfterLength: t = 99, collapseStringMode: r = "directly", customizeCollapseStringUI: n, collapseObjectsAfterLength: s = 99, collapsed: o, onCollapse: c, enableClipboard: l = !0, editable: g = !1, onEdit: u, onDelete: d, onAdd: v, onChange: S, dark: T = !1, theme: O = "default", customizeNode: A, customizeCopy: f = (F) => Nr(F), displaySize: N, displayArrayIndex: E = !0, style: M, className: b, matchesURL: m = !1, urlRegExp: w = Lt, ignoreLargeArray: y = !1, CopyComponent: H, CopiedComponent: _, EditComponent: C, CancelComponent: $, DoneComponent: L, CustomOperation: U }) {
1130
- const [F, j] = P(0), R = K(() => j((Z) => ++Z), []), [I, z] = P(e);
1131
- return Y(() => z(e), [e]), a.jsx(ee.Provider, Object.assign({ value: {
1132
- src: I,
1133
- collapseStringsAfterLength: t,
1134
- collapseStringMode: r,
1135
- customizeCollapseStringUI: n,
1136
- collapseObjectsAfterLength: s,
1137
- collapsed: o,
1138
- onCollapse: c,
1139
- enableClipboard: l,
1140
- editable: g,
1141
- onEdit: u,
1142
- onDelete: d,
1143
- onAdd: v,
1144
- onChange: S,
1145
- forceUpdate: R,
1146
- customizeNode: A,
1147
- customizeCopy: f,
1148
- displaySize: N,
1149
- displayArrayIndex: E,
1150
- matchesURL: m,
1151
- urlRegExp: w,
1152
- ignoreLargeArray: y,
1153
- CopyComponent: H,
1154
- CopiedComponent: _,
1155
- EditComponent: C,
1156
- CancelComponent: $,
1157
- DoneComponent: L,
1158
- CustomOperation: U
1159
- } }, { children: a.jsx("code", Object.assign({ className: "json-view" + (T ? " dark" : "") + (O && O !== "default" ? " json-view_" + O : "") + (b ? " " + b : ""), style: M }, { children: a.jsx(Dt, { node: I, depth: 1, editHandle: (Z, i, p, x) => {
1160
- z(i), u && u({
1161
- newValue: i,
1162
- oldValue: p,
1163
- depth: 1,
1164
- src: I,
1165
- indexOrName: Z,
1166
- parentType: null,
1167
- parentPath: x
1168
- }), S && S({ type: "edit", depth: 1, src: I, indexOrName: Z, parentType: null, parentPath: x });
1169
- }, deleteHandle: (Z, i) => {
1170
- z(void 0), d && d({
1171
- value: I,
1172
- depth: 1,
1173
- src: I,
1174
- indexOrName: Z,
1175
- parentType: null,
1176
- parentPath: i
1177
- }), S && S({
1178
- depth: 1,
1179
- src: I,
1180
- indexOrName: Z,
1181
- parentType: null,
1182
- type: "delete",
1183
- parentPath: i
1184
- });
1185
- }, parentPath: [] }) })) }));
1186
- }
1187
- const zr = ({ state: e }) => /* @__PURE__ */ a.jsx(Ur, { src: e.value, theme: "default" });
1188
- /**
1189
- * @license lucide-react v0.545.0 - ISC
1190
- *
1191
- * This source code is licensed under the ISC license.
1192
- * See the LICENSE file in the root directory of this source tree.
1193
- */
1194
- const Zr = [
1195
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1196
- ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
1197
- ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
1198
- ], St = X("circle-alert", Zr);
1199
- /**
1200
- * @license lucide-react v0.545.0 - ISC
1201
- *
1202
- * This source code is licensed under the ISC license.
1203
- * See the LICENSE file in the root directory of this source tree.
1204
- */
1205
- const Jr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Yr = X("check", Jr);
1206
- /**
1207
- * @license lucide-react v0.545.0 - ISC
1208
- *
1209
- * This source code is licensed under the ISC license.
1210
- * See the LICENSE file in the root directory of this source tree.
1211
- */
1212
- const qr = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Br = X("loader-circle", qr);
1213
- /**
1214
- * @license lucide-react v0.545.0 - ISC
1215
- *
1216
- * This source code is licensed under the ISC license.
1217
- * See the LICENSE file in the root directory of this source tree.
1218
- */
1219
- const Wr = [
1220
- [
1221
- "path",
1222
- {
1223
- d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
1224
- key: "1c8476"
1225
- }
1226
- ],
1227
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
1228
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
1229
- ], Kr = X("save", Wr);
1230
- function Gr(e, t, r) {
1231
- return t in e ? Object.defineProperty(e, t, {
1232
- value: r,
1233
- enumerable: !0,
1234
- configurable: !0,
1235
- writable: !0
1236
- }) : e[t] = r, e;
1237
- }
1238
- function Ot(e, t) {
1239
- var r = Object.keys(e);
1240
- if (Object.getOwnPropertySymbols) {
1241
- var n = Object.getOwnPropertySymbols(e);
1242
- t && (n = n.filter(function(s) {
1243
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
1244
- })), r.push.apply(r, n);
1245
- }
1246
- return r;
1247
- }
1248
- function Et(e) {
1249
- for (var t = 1; t < arguments.length; t++) {
1250
- var r = arguments[t] != null ? arguments[t] : {};
1251
- t % 2 ? Ot(Object(r), !0).forEach(function(n) {
1252
- Gr(e, n, r[n]);
1253
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ot(Object(r)).forEach(function(n) {
1254
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1255
- });
1256
- }
1257
- return e;
1258
- }
1259
- function Xr(e, t) {
1260
- if (e == null) return {};
1261
- var r = {}, n = Object.keys(e), s, o;
1262
- for (o = 0; o < n.length; o++)
1263
- s = n[o], !(t.indexOf(s) >= 0) && (r[s] = e[s]);
1264
- return r;
1265
- }
1266
- function Qr(e, t) {
1267
- if (e == null) return {};
1268
- var r = Xr(e, t), n, s;
1269
- if (Object.getOwnPropertySymbols) {
1270
- var o = Object.getOwnPropertySymbols(e);
1271
- for (s = 0; s < o.length; s++)
1272
- n = o[s], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
1273
- }
1274
- return r;
1275
- }
1276
- function en(e, t) {
1277
- return tn(e) || rn(e, t) || nn(e, t) || an();
1278
- }
1279
- function tn(e) {
1280
- if (Array.isArray(e)) return e;
1281
- }
1282
- function rn(e, t) {
1283
- if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
1284
- var r = [], n = !0, s = !1, o = void 0;
1285
- try {
1286
- for (var c = e[Symbol.iterator](), l; !(n = (l = c.next()).done) && (r.push(l.value), !(t && r.length === t)); n = !0)
1287
- ;
1288
- } catch (g) {
1289
- s = !0, o = g;
1290
- } finally {
1291
- try {
1292
- !n && c.return != null && c.return();
1293
- } finally {
1294
- if (s) throw o;
1295
- }
1296
- }
1297
- return r;
1298
- }
1299
- }
1300
- function nn(e, t) {
1301
- if (e) {
1302
- if (typeof e == "string") return kt(e, t);
1303
- var r = Object.prototype.toString.call(e).slice(8, -1);
1304
- if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
1305
- if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return kt(e, t);
1306
- }
1307
- }
1308
- function kt(e, t) {
1309
- (t == null || t > e.length) && (t = e.length);
1310
- for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
1311
- return n;
1312
- }
1313
- function an() {
1314
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1315
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1316
- }
1317
- function sn(e, t, r) {
1318
- return t in e ? Object.defineProperty(e, t, {
1319
- value: r,
1320
- enumerable: !0,
1321
- configurable: !0,
1322
- writable: !0
1323
- }) : e[t] = r, e;
1324
- }
1325
- function At(e, t) {
1326
- var r = Object.keys(e);
1327
- if (Object.getOwnPropertySymbols) {
1328
- var n = Object.getOwnPropertySymbols(e);
1329
- t && (n = n.filter(function(s) {
1330
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
1331
- })), r.push.apply(r, n);
1332
- }
1333
- return r;
1334
- }
1335
- function Nt(e) {
1336
- for (var t = 1; t < arguments.length; t++) {
1337
- var r = arguments[t] != null ? arguments[t] : {};
1338
- t % 2 ? At(Object(r), !0).forEach(function(n) {
1339
- sn(e, n, r[n]);
1340
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : At(Object(r)).forEach(function(n) {
1341
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1342
- });
1343
- }
1344
- return e;
1345
- }
1346
- function on() {
1347
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
1348
- t[r] = arguments[r];
1349
- return function(n) {
1350
- return t.reduceRight(function(s, o) {
1351
- return o(s);
1352
- }, n);
1353
- };
1354
- }
1355
- function ie(e) {
1356
- return function t() {
1357
- for (var r = this, n = arguments.length, s = new Array(n), o = 0; o < n; o++)
1358
- s[o] = arguments[o];
1359
- return s.length >= e.length ? e.apply(this, s) : function() {
1360
- for (var c = arguments.length, l = new Array(c), g = 0; g < c; g++)
1361
- l[g] = arguments[g];
1362
- return t.apply(r, [].concat(s, l));
1363
- };
1364
- };
1365
- }
1366
- function je(e) {
1367
- return {}.toString.call(e).includes("Object");
1368
- }
1369
- function cn(e) {
1370
- return !Object.keys(e).length;
1371
- }
1372
- function de(e) {
1373
- return typeof e == "function";
1374
- }
1375
- function ln(e, t) {
1376
- return Object.prototype.hasOwnProperty.call(e, t);
1377
- }
1378
- function un(e, t) {
1379
- return je(t) || G("changeType"), Object.keys(t).some(function(r) {
1380
- return !ln(e, r);
1381
- }) && G("changeField"), t;
1382
- }
1383
- function dn(e) {
1384
- de(e) || G("selectorType");
1385
- }
1386
- function fn(e) {
1387
- de(e) || je(e) || G("handlerType"), je(e) && Object.values(e).some(function(t) {
1388
- return !de(t);
1389
- }) && G("handlersType");
1390
- }
1391
- function pn(e) {
1392
- e || G("initialIsRequired"), je(e) || G("initialType"), cn(e) && G("initialContent");
1393
- }
1394
- function gn(e, t) {
1395
- throw new Error(e[t] || e.default);
1396
- }
1397
- var hn = {
1398
- initialIsRequired: "initial state is required",
1399
- initialType: "initial state should be an object",
1400
- initialContent: "initial state shouldn't be an empty object",
1401
- handlerType: "handler should be an object or a function",
1402
- handlersType: "all handlers should be a functions",
1403
- selectorType: "selector should be a function",
1404
- changeType: "provided value of changes should be an object",
1405
- changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
1406
- default: "an unknown error accured in `state-local` package"
1407
- }, G = ie(gn)(hn), ve = {
1408
- changes: un,
1409
- selector: dn,
1410
- handler: fn,
1411
- initial: pn
1412
- };
1413
- function vn(e) {
1414
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1415
- ve.initial(e), ve.handler(t);
1416
- var r = {
1417
- current: e
1418
- }, n = ie(jn)(r, t), s = ie(yn)(r), o = ie(ve.changes)(e), c = ie(mn)(r);
1419
- function l() {
1420
- var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(d) {
1421
- return d;
1422
- };
1423
- return ve.selector(u), u(r.current);
1424
- }
1425
- function g(u) {
1426
- on(n, s, o, c)(u);
1427
- }
1428
- return [l, g];
1429
- }
1430
- function mn(e, t) {
1431
- return de(t) ? t(e.current) : t;
1432
- }
1433
- function yn(e, t) {
1434
- return e.current = Nt(Nt({}, e.current), t), t;
1435
- }
1436
- function jn(e, t, r) {
1437
- return de(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
1438
- var s;
1439
- return (s = t[n]) === null || s === void 0 ? void 0 : s.call(t, e.current[n]);
1440
- }), r;
1441
- }
1442
- var bn = {
1443
- create: vn
1444
- }, wn = {
1445
- paths: {
1446
- vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"
1447
- }
1448
- };
1449
- function xn(e) {
1450
- return function t() {
1451
- for (var r = this, n = arguments.length, s = new Array(n), o = 0; o < n; o++)
1452
- s[o] = arguments[o];
1453
- return s.length >= e.length ? e.apply(this, s) : function() {
1454
- for (var c = arguments.length, l = new Array(c), g = 0; g < c; g++)
1455
- l[g] = arguments[g];
1456
- return t.apply(r, [].concat(s, l));
1457
- };
1458
- };
1459
- }
1460
- function Cn(e) {
1461
- return {}.toString.call(e).includes("Object");
1462
- }
1463
- function Sn(e) {
1464
- return e || Tt("configIsRequired"), Cn(e) || Tt("configType"), e.urls ? (On(), {
1465
- paths: {
1466
- vs: e.urls.monacoBase
1467
- }
1468
- }) : e;
1469
- }
1470
- function On() {
1471
- console.warn(Vt.deprecation);
1472
- }
1473
- function En(e, t) {
1474
- throw new Error(e[t] || e.default);
1475
- }
1476
- var Vt = {
1477
- configIsRequired: "the configuration object is required",
1478
- configType: "the configuration object should be an object",
1479
- default: "an unknown error accured in `@monaco-editor/loader` package",
1480
- deprecation: `Deprecation warning!
1481
- You are using deprecated way of configuration.
1482
-
1483
- Instead of using
1484
- monaco.config({ urls: { monacoBase: '...' } })
1485
- use
1486
- monaco.config({ paths: { vs: '...' } })
1487
-
1488
- For more please check the link https://github.com/suren-atoyan/monaco-loader#config
1489
- `
1490
- }, Tt = xn(En)(Vt), kn = {
1491
- config: Sn
1492
- }, An = function() {
1493
- for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
1494
- r[n] = arguments[n];
1495
- return function(s) {
1496
- return r.reduceRight(function(o, c) {
1497
- return c(o);
1498
- }, s);
1499
- };
1500
- };
1501
- function Ht(e, t) {
1502
- return Object.keys(t).forEach(function(r) {
1503
- t[r] instanceof Object && e[r] && Object.assign(t[r], Ht(e[r], t[r]));
1504
- }), Et(Et({}, e), t);
1505
- }
1506
- var Nn = {
1507
- type: "cancelation",
1508
- msg: "operation is manually canceled"
1509
- };
1510
- function ke(e) {
1511
- var t = !1, r = new Promise(function(n, s) {
1512
- e.then(function(o) {
1513
- return t ? s(Nn) : n(o);
1514
- }), e.catch(s);
1515
- });
1516
- return r.cancel = function() {
1517
- return t = !0;
1518
- }, r;
1519
- }
1520
- var Tn = bn.create({
1521
- config: wn,
1522
- isInitialized: !1,
1523
- resolve: null,
1524
- reject: null,
1525
- monaco: null
1526
- }), Ft = en(Tn, 2), fe = Ft[0], Ce = Ft[1];
1527
- function _n(e) {
1528
- var t = kn.config(e), r = t.monaco, n = Qr(t, ["monaco"]);
1529
- Ce(function(s) {
1530
- return {
1531
- config: Ht(s.config, n),
1532
- monaco: r
1533
- };
1534
- });
1535
- }
1536
- function Rn() {
1537
- var e = fe(function(t) {
1538
- var r = t.monaco, n = t.isInitialized, s = t.resolve;
1539
- return {
1540
- monaco: r,
1541
- isInitialized: n,
1542
- resolve: s
1543
- };
1544
- });
1545
- if (!e.isInitialized) {
1546
- if (Ce({
1547
- isInitialized: !0
1548
- }), e.monaco)
1549
- return e.resolve(e.monaco), ke(Ae);
1550
- if (window.monaco && window.monaco.editor)
1551
- return Ut(window.monaco), e.resolve(window.monaco), ke(Ae);
1552
- An(Mn, Pn)($n);
1553
- }
1554
- return ke(Ae);
1555
- }
1556
- function Mn(e) {
1557
- return document.body.appendChild(e);
1558
- }
1559
- function In(e) {
1560
- var t = document.createElement("script");
1561
- return e && (t.src = e), t;
1562
- }
1563
- function Pn(e) {
1564
- var t = fe(function(n) {
1565
- var s = n.config, o = n.reject;
1566
- return {
1567
- config: s,
1568
- reject: o
1569
- };
1570
- }), r = In("".concat(t.config.paths.vs, "/loader.js"));
1571
- return r.onload = function() {
1572
- return e();
1573
- }, r.onerror = t.reject, r;
1574
- }
1575
- function $n() {
1576
- var e = fe(function(r) {
1577
- var n = r.config, s = r.resolve, o = r.reject;
1578
- return {
1579
- config: n,
1580
- resolve: s,
1581
- reject: o
1582
- };
1583
- }), t = window.require;
1584
- t.config(e.config), t(["vs/editor/editor.main"], function(r) {
1585
- Ut(r), e.resolve(r);
1586
- }, function(r) {
1587
- e.reject(r);
1588
- });
1589
- }
1590
- function Ut(e) {
1591
- fe().monaco || Ce({
1592
- monaco: e
1593
- });
1594
- }
1595
- function Dn() {
1596
- return fe(function(e) {
1597
- var t = e.monaco;
1598
- return t;
1599
- });
1600
- }
1601
- var Ae = new Promise(function(e, t) {
1602
- return Ce({
1603
- resolve: e,
1604
- reject: t
1605
- });
1606
- }), be = {
1607
- config: _n,
1608
- init: Rn,
1609
- __getMonacoInstance: Dn
1610
- }, Ln = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, Ne = Ln, Vn = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Hn = Vn;
1611
- function Fn({ children: e }) {
1612
- return W.createElement("div", { style: Hn.container }, e);
1613
- }
1614
- var Un = Fn, zn = Un;
1615
- function Zn({ width: e, height: t, isEditorReady: r, loading: n, _ref: s, className: o, wrapperProps: c }) {
1616
- return W.createElement("section", { style: { ...Ne.wrapper, width: e, height: t }, ...c }, !r && W.createElement(zn, null, n), W.createElement("div", { ref: s, style: { ...Ne.fullWidth, ...!r && Ne.hide }, className: o }));
1617
- }
1618
- var Jn = Zn, zt = Fe(Jn);
1619
- function Yn(e) {
1620
- Y(e, []);
1621
- }
1622
- var We = Yn;
1623
- function qn(e, t, r = !0) {
1624
- let n = V(!0);
1625
- Y(n.current || !r ? () => {
1626
- n.current = !1;
1627
- } : e, t);
1628
- }
1629
- var B = qn;
1630
- function le() {
1631
- }
1632
- function ne(e, t, r, n) {
1633
- return Bn(e, n) || Wn(e, t, r, n);
1634
- }
1635
- function Bn(e, t) {
1636
- return e.editor.getModel(Zt(e, t));
1637
- }
1638
- function Wn(e, t, r, n) {
1639
- return e.editor.createModel(t, r, n ? Zt(e, n) : void 0);
1640
- }
1641
- function Zt(e, t) {
1642
- return e.Uri.parse(t);
1643
- }
1644
- function Kn({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: s, originalModelPath: o, modifiedModelPath: c, keepCurrentOriginalModel: l = !1, keepCurrentModifiedModel: g = !1, theme: u = "light", loading: d = "Loading...", options: v = {}, height: S = "100%", width: T = "100%", className: O, wrapperProps: A = {}, beforeMount: f = le, onMount: N = le }) {
1645
- let [E, M] = P(!1), [b, m] = P(!0), w = V(null), y = V(null), H = V(null), _ = V(N), C = V(f), $ = V(!1);
1646
- We(() => {
1647
- let j = be.init();
1648
- return j.then((R) => (y.current = R) && m(!1)).catch((R) => R?.type !== "cancelation" && console.error("Monaco initialization: error:", R)), () => w.current ? F() : j.cancel();
1649
- }), B(() => {
1650
- if (w.current && y.current) {
1651
- let j = w.current.getOriginalEditor(), R = ne(y.current, e || "", n || r || "text", o || "");
1652
- R !== j.getModel() && j.setModel(R);
1653
- }
1654
- }, [o], E), B(() => {
1655
- if (w.current && y.current) {
1656
- let j = w.current.getModifiedEditor(), R = ne(y.current, t || "", s || r || "text", c || "");
1657
- R !== j.getModel() && j.setModel(R);
1658
- }
1659
- }, [c], E), B(() => {
1660
- let j = w.current.getModifiedEditor();
1661
- j.getOption(y.current.editor.EditorOption.readOnly) ? j.setValue(t || "") : t !== j.getValue() && (j.executeEdits("", [{ range: j.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), j.pushUndoStop());
1662
- }, [t], E), B(() => {
1663
- w.current?.getModel()?.original.setValue(e || "");
1664
- }, [e], E), B(() => {
1665
- let { original: j, modified: R } = w.current.getModel();
1666
- y.current.editor.setModelLanguage(j, n || r || "text"), y.current.editor.setModelLanguage(R, s || r || "text");
1667
- }, [r, n, s], E), B(() => {
1668
- y.current?.editor.setTheme(u);
1669
- }, [u], E), B(() => {
1670
- w.current?.updateOptions(v);
1671
- }, [v], E);
1672
- let L = K(() => {
1673
- if (!y.current) return;
1674
- C.current(y.current);
1675
- let j = ne(y.current, e || "", n || r || "text", o || ""), R = ne(y.current, t || "", s || r || "text", c || "");
1676
- w.current?.setModel({ original: j, modified: R });
1677
- }, [r, t, s, e, n, o, c]), U = K(() => {
1678
- !$.current && H.current && (w.current = y.current.editor.createDiffEditor(H.current, { automaticLayout: !0, ...v }), L(), y.current?.editor.setTheme(u), M(!0), $.current = !0);
1679
- }, [v, u, L]);
1680
- Y(() => {
1681
- E && _.current(w.current, y.current);
1682
- }, [E]), Y(() => {
1683
- !b && !E && U();
1684
- }, [b, E, U]);
1685
- function F() {
1686
- let j = w.current?.getModel();
1687
- l || j?.original?.dispose(), g || j?.modified?.dispose(), w.current?.dispose();
1688
- }
1689
- return W.createElement(zt, { width: T, height: S, isEditorReady: E, loading: d, _ref: H, className: O, wrapperProps: A });
1690
- }
1691
- var Gn = Kn;
1692
- Fe(Gn);
1693
- function Xn() {
1694
- let [e, t] = P(be.__getMonacoInstance());
1695
- return We(() => {
1696
- let r;
1697
- return e || (r = be.init(), r.then((n) => {
1698
- t(n);
1699
- })), () => r?.cancel();
1700
- }), e;
1701
- }
1702
- var Qn = Xn;
1703
- function ea(e) {
1704
- let t = V();
1705
- return Y(() => {
1706
- t.current = e;
1707
- }, [e]), t.current;
1708
- }
1709
- var ta = ea, me = /* @__PURE__ */ new Map();
1710
- function ra({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: s, path: o, theme: c = "light", line: l, loading: g = "Loading...", options: u = {}, overrideServices: d = {}, saveViewState: v = !0, keepCurrentModel: S = !1, width: T = "100%", height: O = "100%", className: A, wrapperProps: f = {}, beforeMount: N = le, onMount: E = le, onChange: M, onValidate: b = le }) {
1711
- let [m, w] = P(!1), [y, H] = P(!0), _ = V(null), C = V(null), $ = V(null), L = V(E), U = V(N), F = V(), j = V(n), R = ta(o), I = V(!1), z = V(!1);
1712
- We(() => {
1713
- let p = be.init();
1714
- return p.then((x) => (_.current = x) && H(!1)).catch((x) => x?.type !== "cancelation" && console.error("Monaco initialization: error:", x)), () => C.current ? i() : p.cancel();
1715
- }), B(() => {
1716
- let p = ne(_.current, e || n || "", t || s || "", o || r || "");
1717
- p !== C.current?.getModel() && (v && me.set(R, C.current?.saveViewState()), C.current?.setModel(p), v && C.current?.restoreViewState(me.get(o)));
1718
- }, [o], m), B(() => {
1719
- C.current?.updateOptions(u);
1720
- }, [u], m), B(() => {
1721
- !C.current || n === void 0 || (C.current.getOption(_.current.editor.EditorOption.readOnly) ? C.current.setValue(n) : n !== C.current.getValue() && (z.current = !0, C.current.executeEdits("", [{ range: C.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), C.current.pushUndoStop(), z.current = !1));
1722
- }, [n], m), B(() => {
1723
- let p = C.current?.getModel();
1724
- p && s && _.current?.editor.setModelLanguage(p, s);
1725
- }, [s], m), B(() => {
1726
- l !== void 0 && C.current?.revealLine(l);
1727
- }, [l], m), B(() => {
1728
- _.current?.editor.setTheme(c);
1729
- }, [c], m);
1730
- let Z = K(() => {
1731
- if (!(!$.current || !_.current) && !I.current) {
1732
- U.current(_.current);
1733
- let p = o || r, x = ne(_.current, n || e || "", t || s || "", p || "");
1734
- C.current = _.current?.editor.create($.current, { model: x, automaticLayout: !0, ...u }, d), v && C.current.restoreViewState(me.get(p)), _.current.editor.setTheme(c), l !== void 0 && C.current.revealLine(l), w(!0), I.current = !0;
1735
- }
1736
- }, [e, t, r, n, s, o, u, d, v, c, l]);
1737
- Y(() => {
1738
- m && L.current(C.current, _.current);
1739
- }, [m]), Y(() => {
1740
- !y && !m && Z();
1741
- }, [y, m, Z]), j.current = n, Y(() => {
1742
- m && M && (F.current?.dispose(), F.current = C.current?.onDidChangeModelContent((p) => {
1743
- z.current || M(C.current.getValue(), p);
1744
- }));
1745
- }, [m, M]), Y(() => {
1746
- if (m) {
1747
- let p = _.current.editor.onDidChangeMarkers((x) => {
1748
- let h = C.current.getModel()?.uri;
1749
- if (h && x.find((k) => k.path === h.path)) {
1750
- let k = _.current.editor.getModelMarkers({ resource: h });
1751
- b?.(k);
1752
- }
1753
- });
1754
- return () => {
1755
- p?.dispose();
1756
- };
1757
- }
1758
- return () => {
1759
- };
1760
- }, [m, b]);
1761
- function i() {
1762
- F.current?.dispose(), S ? v && me.set(o, C.current.saveViewState()) : C.current.getModel()?.dispose(), C.current.dispose();
1763
- }
1764
- return W.createElement(zt, { width: T, height: O, isEditorReady: m, loading: g, _ref: $, className: A, wrapperProps: f });
1765
- }
1766
- var na = ra, aa = Fe(na), sa = aa;
1767
- const oa = ({
1768
- value: e,
1769
- height: t = 300,
1770
- schema: r,
1771
- onChange: n,
1772
- onValidate: s,
1773
- language: o = "json",
1774
- readOnly: c = !1
1775
- }) => {
1776
- const l = Qn(), g = Bt((d) => d.theme), u = ue(() => g === "dark" ? "vs-dark" : "light", [g]);
1777
- return Y(() => {
1778
- l && (l.languages.typescript.javascriptDefaults.setCompilerOptions({ isolatedModules: !0 }), l.languages.json.jsonDefaults.setDiagnosticsOptions({
1779
- schemas: r ? [
1780
- {
1781
- uri: window.location.href,
1782
- fileMatch: ["*"],
1783
- schema: r
1784
- }
1785
- ] : []
1786
- }));
1787
- }, [l, r, o]), /* @__PURE__ */ a.jsx(
1788
- sa,
1789
- {
1790
- "data-testid": "json-editor",
1791
- height: t,
1792
- language: o,
1793
- value: e,
1794
- theme: u,
1795
- onChange: (d) => {
1796
- d || s?.(!1), n?.(d ?? "");
1797
- },
1798
- onValidate: (d) => s?.(d.length === 0),
1799
- options: {
1800
- readOnly: c,
1801
- scrollBeyondLastLine: !1,
1802
- minimap: { enabled: !1 }
1803
- }
1804
- }
1805
- );
1806
- }, ia = ({ state: e }) => {
1807
- const [t, r] = P(!1), [n, s] = P(!0), [o, c] = P(JSON.stringify(e.value, null, 2)), [l, g] = P(!1), [u, d] = P("idle"), v = V(JSON.stringify(e.value, null, 2));
1808
- Y(() => {
1809
- c(JSON.stringify(e.value, null, 2));
1810
- }, [e.value]);
1811
- const S = K((f) => {
1812
- g(f !== v.current), c(f), d("idle");
1813
- }, []), T = async () => {
1814
- if (!(!n || !l))
1815
- try {
1816
- r(!0), d("idle");
1817
- const f = await fetch("/__motia/state", {
1818
- method: "POST",
1819
- headers: {
1820
- "Content-Type": "application/json"
1821
- },
1822
- body: JSON.stringify({
1823
- key: e.key,
1824
- groupId: e.groupId,
1825
- value: JSON.parse(o)
1826
- })
1827
- });
1828
- if (!f.ok)
1829
- throw new Error(`HTTP error! status: ${f.status}`);
1830
- v.current = o, d("success"), g(!1), setTimeout(() => {
1831
- d("idle");
1832
- }, 3e3);
1833
- } catch (f) {
1834
- console.error("Failed to save state:", f), d("error");
1835
- } finally {
1836
- r(!1);
1837
- }
1838
- }, O = K(() => {
1839
- c(JSON.stringify(e.value, null, 2)), g(!1), d("idle");
1840
- }, [e.value]), A = ue(() => u === "success" ? /* @__PURE__ */ a.jsx("div", { className: "bg-green-50 dark:bg-green-950/20 border border-green-200 dark:border-green-800 rounded-lg p-2", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2 text-green-700 dark:text-green-400 text-sm", children: [
1841
- /* @__PURE__ */ a.jsx(Yr, { className: "w-4 h-4" }),
1842
- "State saved successfully!"
1843
- ] }) }) : u === "error" ? /* @__PURE__ */ a.jsx("div", { className: "bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded-lg p-2", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2 text-red-700 dark:text-red-400 text-sm", children: [
1844
- /* @__PURE__ */ a.jsx(St, { className: "w-4 h-4" }),
1845
- "Failed to save state. Please try again."
1846
- ] }) }) : /* @__PURE__ */ a.jsx("div", { className: "text-xs text-muted-foreground", children: l ? /* @__PURE__ */ a.jsxs("span", { className: "flex items-center gap-1", children: [
1847
- /* @__PURE__ */ a.jsx("div", { className: "w-2 h-2 bg-orange-500 rounded-full" }),
1848
- "Unsaved changes"
1849
- ] }) : /* @__PURE__ */ a.jsxs("span", { className: "flex items-center gap-1", children: [
1850
- /* @__PURE__ */ a.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }),
1851
- "Up to date"
1852
- ] }) }), [u, l]);
1853
- return /* @__PURE__ */ a.jsxs("div", { className: "flex flex-col gap-2 h-full", children: [
1854
- /* @__PURE__ */ a.jsx("p", { className: "text-xs text-muted-foreground", children: "Modify the state value using the JSON editor below." }),
1855
- /* @__PURE__ */ a.jsx("div", { className: "space-y-3 pt-2 flex flex-col", children: /* @__PURE__ */ a.jsxs("div", { className: "relative flex-1", children: [
1856
- /* @__PURE__ */ a.jsx(
1857
- oa,
1858
- {
1859
- value: o,
1860
- onChange: S,
1861
- onValidate: s,
1862
- height: "calc(100vh - 300px)"
1863
- }
1864
- ),
1865
- !n && /* @__PURE__ */ a.jsxs("div", { className: "absolute top-2 right-2 bg-destructive/90 text-destructive-foreground px-2 py-1 rounded text-xs flex items-center gap-1", children: [
1866
- /* @__PURE__ */ a.jsx(St, { className: "w-3 h-3" }),
1867
- "Invalid JSON"
1868
- ] })
1869
- ] }) }),
1870
- /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between pt-2", children: [
1871
- A,
1872
- /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2", children: [
1873
- l && /* @__PURE__ */ a.jsx(ye, { variant: "secondary", onClick: O, disabled: t, children: "Reset" }),
1874
- /* @__PURE__ */ a.jsx(
1875
- ye,
1876
- {
1877
- onClick: T,
1878
- variant: "accent",
1879
- disabled: t || !n || !l,
1880
- "data-testid": "state-save-button",
1881
- children: t ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1882
- /* @__PURE__ */ a.jsx(Br, { className: "w-3 h-3 animate-spin mr-1" }),
1883
- "Saving..."
1884
- ] }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1885
- /* @__PURE__ */ a.jsx(Kr, { className: "w-3 h-3 mr-1" }),
1886
- "Save Changes"
1887
- ] })
1888
- }
1889
- )
1890
- ] })
1891
- ] })
1892
- ] });
1893
- }, ca = ({ state: e, onClose: t }) => /* @__PURE__ */ a.jsx(
1894
- Wt,
1895
- {
1896
- onClose: t,
1897
- title: "State Details",
1898
- initialWidth: 500,
1899
- tabs: [
1900
- {
1901
- label: "Overview",
1902
- content: /* @__PURE__ */ a.jsx(zr, { state: e })
1903
- },
1904
- {
1905
- label: "Editor",
1906
- content: /* @__PURE__ */ a.jsx(ia, { state: e })
1907
- }
1908
- ],
1909
- actions: [{ icon: /* @__PURE__ */ a.jsx(Mt, {}), onClick: t, label: "Close" }]
1910
- }
1911
- ), da = () => {
1912
- const e = nt((f) => f.selectedStateId), t = nt((f) => f.selectStateId), { items: r, deleteItems: n, refetch: s } = vr(), [o, c] = P(""), l = ue(() => r.filter((f) => f.groupId.toLowerCase().includes(o.toLowerCase()) || f.key.toLowerCase().includes(o.toLowerCase())), [r, o]), g = ue(
1913
- () => e ? l.find((f) => `${f.groupId}:${f.key}` === e) : null,
1914
- [l, e]
1915
- ), [u, d] = P(/* @__PURE__ */ new Set()), v = (f) => t(`${f.groupId}:${f.key}`), S = () => t(void 0), T = () => {
1916
- n(Array.from(u)), d(/* @__PURE__ */ new Set());
1917
- }, O = (f) => {
1918
- const N = u.has(`${f.groupId}:${f.key}`);
1919
- d((E) => {
1920
- const M = new Set(E);
1921
- return N ? M.delete(`${f.groupId}:${f.key}`) : M.add(`${f.groupId}:${f.key}`), M;
1922
- });
1923
- }, A = (f) => {
1924
- d((N) => {
1925
- const E = new Set(N);
1926
- return f ? l.forEach((M) => E.add(`${M.groupId}:${M.key}`)) : l.forEach((M) => E.delete(`${M.groupId}:${M.key}`)), E;
1927
- });
1928
- };
1929
- return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1930
- g && /* @__PURE__ */ a.jsx(ca, { state: g, onClose: S }),
1931
- /* @__PURE__ */ a.jsxs("div", { className: "grid grid-rows-[auto_1fr] h-full", "data-testid": "states-container", children: [
1932
- /* @__PURE__ */ a.jsxs("div", { className: "flex p-2 border-b gap-2", "data-testid": "logs-search-container", children: [
1933
- /* @__PURE__ */ a.jsxs("div", { className: "flex-1 relative", children: [
1934
- /* @__PURE__ */ a.jsx(
1935
- Kt,
1936
- {
1937
- variant: "shade",
1938
- value: o,
1939
- onChange: (f) => c(f.target.value),
1940
- className: "px-9! font-medium",
1941
- placeholder: "Search by Group ID or Key"
1942
- }
1943
- ),
1944
- /* @__PURE__ */ a.jsx(fr, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" }),
1945
- /* @__PURE__ */ a.jsx(
1946
- Mt,
1947
- {
1948
- className: "cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",
1949
- onClick: () => c("")
1950
- }
1951
- )
1952
- ] }),
1953
- /* @__PURE__ */ a.jsxs(ye, { variant: "default", className: "h-[34px]", disabled: u.size === 0, onClick: T, children: [
1954
- /* @__PURE__ */ a.jsx(gr, {}),
1955
- " Delete"
1956
- ] }),
1957
- /* @__PURE__ */ a.jsx(ye, { variant: "default", className: "h-[34px]", onClick: s, children: /* @__PURE__ */ a.jsx(ur, { className: "w-4 h-4 text-muted-foreground" }) })
1958
- ] }),
1959
- /* @__PURE__ */ a.jsxs(Gt, { children: [
1960
- /* @__PURE__ */ a.jsx(Xt, { className: "sticky top-0 bg-background/20 backdrop-blur-sm", children: /* @__PURE__ */ a.jsxs(Ke, { children: [
1961
- /* @__PURE__ */ a.jsx(pe, { children: /* @__PURE__ */ a.jsx(Ge, { onClick: (f) => f.stopPropagation(), onCheckedChange: A }) }),
1962
- /* @__PURE__ */ a.jsx(pe, { className: "rounded-0", children: "Group ID" }),
1963
- /* @__PURE__ */ a.jsx(pe, { children: "Key" }),
1964
- /* @__PURE__ */ a.jsx(pe, { children: "Type" })
1965
- ] }) }),
1966
- /* @__PURE__ */ a.jsx(Qt, { children: l.map((f) => /* @__PURE__ */ a.jsxs(
1967
- Ke,
1968
- {
1969
- "data-testid": `item-${f}`,
1970
- onClick: () => v(f),
1971
- className: er(
1972
- "font-mono font-semibold cursor-pointer border-0",
1973
- g === f ? "bg-muted-foreground/10 hover:bg-muted-foreground/20" : "hover:bg-muted-foreground/10"
1974
- ),
1975
- children: [
1976
- /* @__PURE__ */ a.jsx(ge, { onClick: (N) => N.stopPropagation(), children: /* @__PURE__ */ a.jsx(
1977
- Ge,
1978
- {
1979
- checked: u.has(`${f.groupId}:${f.key}`),
1980
- onClick: () => O(f)
1981
- }
1982
- ) }),
1983
- /* @__PURE__ */ a.jsx(ge, { className: "hover:bg-transparent", children: f.groupId }),
1984
- /* @__PURE__ */ a.jsx(ge, { className: "hover:bg-transparent", children: f.key }),
1985
- /* @__PURE__ */ a.jsx(ge, { className: "hover:bg-transparent", children: f.type })
1986
- ]
1987
- },
1988
- `${f.groupId}:${f.key}`
1989
- )) })
1990
- ] })
1991
- ] })
1992
- ] });
1993
- };
1994
- export {
1995
- da as StatesPage
1996
- };