@wp-playground/components 3.1.44 → 3.1.45

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/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import o, { forwardRef as Bt, useMemo as Nt, useState as Q, useRef as M, useEffect as I, useImperativeHandle as Wt, useLayoutEffect as Gt, useCallback as ft } from "react";
2
- import { dirname as Oe, joinPaths as We, basename as Ot, normalizePath as At } from "@php-wasm/util";
3
- import { __experimentalTreeGrid as Kt, Popover as qt, NavigableMenu as Jt, MenuItem as qe, __experimentalTreeGridRow as Xt, __experimentalTreeGridCell as Qt, Button as mt, Modal as er, Icon as Ft, Notice as tr } from "@wordpress/components";
4
- import et from "classnames";
5
- import { forwardRef as Ht, cloneElement as rr, createElement as nr } from "@wordpress/element";
6
- import ar from "clsx";
7
- import { Compartment as Tt, EditorSelection as pt, EditorState as or } from "@codemirror/state";
8
- import { ViewPlugin as ir, lineNumbers as sr, highlightActiveLineGutter as lr, highlightActiveLine as cr, dropCursor as ur, rectangularSelection as fr, crosshairCursor as dr, EditorView as Qe, keymap as mr } from "@codemirror/view";
9
- import { history as pr, historyKeymap as hr, defaultKeymap as wr, indentWithTab as vr } from "@codemirror/commands";
10
- import { highlightSelectionMatches as gr, searchKeymap as Er } from "@codemirror/search";
11
- import { closeBrackets as yr, autocompletion as _r, closeBracketsKeymap as br, completionKeymap as Cr } from "@codemirror/autocomplete";
12
- import { foldGutter as xr, syntaxHighlighting as Rr, defaultHighlightStyle as Tr, indentOnInput as Pr, bracketMatching as kr, foldKeymap as Sr } from "@codemirror/language";
13
- import { php as tt } from "@codemirror/lang-php";
14
- import { FilePickerTree as Nr, BinaryFilePreview as Dr } from "@wp-playground/components";
15
- import { logger as dt } from "@php-wasm/logger";
1
+ import r, { forwardRef as $t, useMemo as Ft, useState as ee, useRef as V, useEffect as H, useImperativeHandle as Wt, useLayoutEffect as qt, useCallback as We } from "react";
2
+ import { joinPaths as Oe, dirname as Le, normalizePath as Jt, basename as it, isParentOf as Xt, concatUint8Arrays as Qt } from "@php-wasm/util";
3
+ import { __experimentalTreeGrid as er, Popover as tr, NavigableMenu as rr, MenuItem as rt, __experimentalTreeGridRow as nr, __experimentalTreeGridCell as ar, Button as Je, Modal as or, Icon as St, Tooltip as Ht, VisuallyHidden as ir, Notice as lr } from "@wordpress/components";
4
+ import Ne from "classnames";
5
+ import { forwardRef as Ut, cloneElement as sr, createElement as cr } from "@wordpress/element";
6
+ import ur from "clsx";
7
+ import { Compartment as Pt, EditorSelection as vt, EditorState as fr } from "@codemirror/state";
8
+ import { ViewPlugin as dr, lineNumbers as mr, highlightActiveLineGutter as pr, highlightActiveLine as hr, dropCursor as vr, rectangularSelection as wr, crosshairCursor as gr, EditorView as ot, keymap as Er } from "@codemirror/view";
9
+ import { history as yr, historyKeymap as _r, defaultKeymap as xr, indentWithTab as br } from "@codemirror/commands";
10
+ import { highlightSelectionMatches as Cr, searchKeymap as Rr } from "@codemirror/search";
11
+ import { closeBrackets as kr, autocompletion as Tr, closeBracketsKeymap as Sr, completionKeymap as Pr } from "@codemirror/autocomplete";
12
+ import { foldGutter as Dr, syntaxHighlighting as Ar, defaultHighlightStyle as Nr, indentOnInput as Fr, bracketMatching as Ir, foldKeymap as Lr } from "@codemirror/language";
13
+ import { php as lt } from "@codemirror/lang-php";
14
+ import { FilePickerTree as Or, BinaryFilePreview as Br } from "@wp-playground/components";
15
+ import { logger as Ke } from "@php-wasm/logger";
16
16
  import Lt from "@php-wasm/universal/mime-types";
17
- const fa = (n) => /* @__PURE__ */ o.createElement(
17
+ const Na = (n) => /* @__PURE__ */ r.createElement(
18
18
  "svg",
19
19
  {
20
20
  width: "32",
@@ -24,7 +24,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
24
24
  xmlns: "http://www.w3.org/2000/svg",
25
25
  ...n
26
26
  },
27
- /* @__PURE__ */ o.createElement(
27
+ /* @__PURE__ */ r.createElement(
28
28
  "rect",
29
29
  {
30
30
  width: "10.4176",
@@ -35,7 +35,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
35
35
  strokeWidth: "0.965644"
36
36
  }
37
37
  ),
38
- /* @__PURE__ */ o.createElement(
38
+ /* @__PURE__ */ r.createElement(
39
39
  "rect",
40
40
  {
41
41
  width: "13.2346",
@@ -46,7 +46,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
46
46
  strokeWidth: "1.44847"
47
47
  }
48
48
  ),
49
- /* @__PURE__ */ o.createElement(
49
+ /* @__PURE__ */ r.createElement(
50
50
  "rect",
51
51
  {
52
52
  width: "17.451",
@@ -57,7 +57,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
57
57
  strokeWidth: "1.93129"
58
58
  }
59
59
  )
60
- ), da = (n) => /* @__PURE__ */ o.createElement(
60
+ ), Fa = (n) => /* @__PURE__ */ r.createElement(
61
61
  "svg",
62
62
  {
63
63
  width: "16",
@@ -67,7 +67,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
67
67
  xmlns: "http://www.w3.org/2000/svg",
68
68
  ...n
69
69
  },
70
- /* @__PURE__ */ o.createElement(
70
+ /* @__PURE__ */ r.createElement(
71
71
  "path",
72
72
  {
73
73
  fillRule: "evenodd",
@@ -76,7 +76,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
76
76
  fill: "#949494"
77
77
  }
78
78
  )
79
- ), ma = (n) => /* @__PURE__ */ o.createElement(
79
+ ), Ia = (n) => /* @__PURE__ */ r.createElement(
80
80
  "svg",
81
81
  {
82
82
  width: "20",
@@ -86,14 +86,14 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
86
86
  xmlns: "http://www.w3.org/2000/svg",
87
87
  ...n
88
88
  },
89
- /* @__PURE__ */ o.createElement(
89
+ /* @__PURE__ */ r.createElement(
90
90
  "path",
91
91
  {
92
92
  d: "M20 10.5C20 4.99 15.51 0.5 10 0.5C4.48 0.5 0 4.99 0 10.5C0 16.02 4.48 20.5 10 20.5C15.51 20.5 20 16.02 20 10.5ZM7.78 15.87L4.37 6.72C4.92 6.7 5.54 6.64 5.54 6.64C6.04 6.58 5.98 5.51 5.48 5.53C5.48 5.53 4.03 5.64 3.11 5.64C2.93 5.64 2.74 5.64 2.53 5.63C4.12 3.19 6.87 1.61 10 1.61C12.33 1.61 14.45 2.48 16.05 3.95C15.37 3.84 14.4 4.34 14.4 5.53C14.4 6.27 14.85 6.89 15.3 7.63C15.65 8.24 15.85 8.99 15.85 10.09C15.85 11.58 14.45 15.09 14.45 15.09L11.42 6.72C11.96 6.7 12.24 6.55 12.24 6.55C12.74 6.5 12.68 5.3 12.18 5.33C12.18 5.33 10.74 5.45 9.8 5.45C8.93 5.45 7.47 5.33 7.47 5.33C6.97 5.3 6.91 6.53 7.41 6.55L8.33 6.63L9.59 10.04L7.78 15.87ZM17.41 10.5C17.65 9.86 18.15 8.63 17.84 6.25C18.54 7.54 18.89 8.96 18.89 10.5C18.89 13.79 17.16 16.74 14.49 18.28C15.46 15.69 16.43 13.08 17.41 10.5ZM6.1 18.59C3.12 17.15 1.11 14.03 1.11 10.5C1.11 9.2 1.34 8.02 1.83 6.91C3.25 10.8 4.67 14.7 6.1 18.59ZM10.13 11.96L12.71 18.94C11.85 19.23 10.95 19.39 10 19.39C9.21 19.39 8.43 19.28 7.71 19.06C8.52 16.68 9.33 14.32 10.13 11.96Z",
93
93
  fill: "#ffffff"
94
94
  }
95
95
  )
96
- ), Or = /* @__PURE__ */ o.createElement(
96
+ ), Mr = /* @__PURE__ */ r.createElement(
97
97
  "svg",
98
98
  {
99
99
  xmlns: "http://www.w3.org/2000/svg",
@@ -102,7 +102,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
102
102
  viewBox: "0 0 15 14",
103
103
  fill: "none"
104
104
  },
105
- /* @__PURE__ */ o.createElement(
105
+ /* @__PURE__ */ r.createElement(
106
106
  "path",
107
107
  {
108
108
  fillRule: "evenodd",
@@ -110,7 +110,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
110
110
  d: "M7.59196 3.59524L6.77745 1.96623C6.70755 1.82641 6.56464 1.7381 6.40832 1.7381H1.65079C1.42287 1.7381 1.2381 1.92287 1.2381 2.15079V11.8492C1.2381 12.0771 1.42287 12.2619 1.65079 12.2619H13.2063C13.4343 12.2619 13.619 12.0771 13.619 11.8492V4.00794C13.619 3.78001 13.4343 3.59524 13.2063 3.59524H7.59196ZM8.35714 2.35714L7.88484 1.41254C7.60521 0.853274 7.0336 0.5 6.40832 0.5H1.65079C0.739085 0.5 0 1.23909 0 2.15079V11.8492C0 12.7609 0.739085 13.5 1.65079 13.5H13.2063C14.1181 13.5 14.8571 12.7609 14.8571 11.8492V4.00794C14.8571 3.09623 14.1181 2.35714 13.2063 2.35714H8.35714Z"
111
111
  }
112
112
  )
113
- ), Ar = /* @__PURE__ */ o.createElement(
113
+ ), jr = /* @__PURE__ */ r.createElement(
114
114
  "svg",
115
115
  {
116
116
  xmlns: "http://www.w3.org/2000/svg",
@@ -120,8 +120,8 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
120
120
  className: "bi bi-file-earmark",
121
121
  viewBox: "0 0 16 16"
122
122
  },
123
- /* @__PURE__ */ o.createElement("path", { d: "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" })
124
- ), pa = (n) => /* @__PURE__ */ o.createElement(
123
+ /* @__PURE__ */ r.createElement("path", { d: "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" })
124
+ ), La = (n) => /* @__PURE__ */ r.createElement(
125
125
  "svg",
126
126
  {
127
127
  xmlns: "http://www.w3.org/2000/svg",
@@ -131,7 +131,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
131
131
  fill: "none",
132
132
  ...n
133
133
  },
134
- /* @__PURE__ */ o.createElement(
134
+ /* @__PURE__ */ r.createElement(
135
135
  "path",
136
136
  {
137
137
  fillRule: "evenodd",
@@ -140,7 +140,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
140
140
  fill: "#949494"
141
141
  }
142
142
  )
143
- ), ha = /* @__PURE__ */ o.createElement(
143
+ ), Oa = /* @__PURE__ */ r.createElement(
144
144
  "svg",
145
145
  {
146
146
  xmlns: "http://www.w3.org/2000/svg",
@@ -149,7 +149,7 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
149
149
  viewBox: "0 0 14 14",
150
150
  fill: "none"
151
151
  },
152
- /* @__PURE__ */ o.createElement(
152
+ /* @__PURE__ */ r.createElement(
153
153
  "path",
154
154
  {
155
155
  fillRule: "evenodd",
@@ -159,14 +159,14 @@ const fa = (n) => /* @__PURE__ */ o.createElement(
159
159
  }
160
160
  )
161
161
  );
162
- function wa(n) {
162
+ function Ba(n) {
163
163
  return `data:${n.mime};base64,${n.data}`;
164
164
  }
165
- function va({
165
+ function Ma({
166
166
  size: n = 24,
167
- sidebarActive: u = !1
167
+ sidebarActive: c = !1
168
168
  }) {
169
- return /* @__PURE__ */ o.createElement(
169
+ return /* @__PURE__ */ r.createElement(
170
170
  "svg",
171
171
  {
172
172
  width: n,
@@ -179,8 +179,8 @@ function va({
179
179
  strokeLinecap: "round",
180
180
  strokeLinejoin: "round"
181
181
  },
182
- /* @__PURE__ */ o.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
183
- u ? /* @__PURE__ */ o.createElement(
182
+ /* @__PURE__ */ r.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
183
+ c ? /* @__PURE__ */ r.createElement(
184
184
  "rect",
185
185
  {
186
186
  x: "3",
@@ -191,7 +191,7 @@ function va({
191
191
  ry: "2",
192
192
  fill: "currentColor"
193
193
  }
194
- ) : /* @__PURE__ */ o.createElement(
194
+ ) : /* @__PURE__ */ r.createElement(
195
195
  "rect",
196
196
  {
197
197
  x: "3",
@@ -207,17 +207,17 @@ function va({
207
207
  )
208
208
  );
209
209
  }
210
- const jt = Ht(({
210
+ const Ot = Ut(({
211
211
  icon: n,
212
- size: u = 24,
213
- ...l
214
- }, m) => rr(n, {
215
- width: u,
216
- height: u,
217
- ...l,
218
- ref: m
212
+ size: c = 24,
213
+ ...d
214
+ }, l) => sr(n, {
215
+ width: c,
216
+ height: c,
217
+ ...d,
218
+ ref: l
219
219
  }));
220
- var Dt = { exports: {} }, Je = {};
220
+ var It = { exports: {} }, nt = {};
221
221
  /**
222
222
  * @license React
223
223
  * react-jsx-runtime.production.min.js
@@ -227,21 +227,21 @@ var Dt = { exports: {} }, Je = {};
227
227
  * This source code is licensed under the MIT license found in the
228
228
  * LICENSE file in the root directory of this source tree.
229
229
  */
230
- var It;
231
- function Fr() {
232
- if (It) return Je;
233
- It = 1;
234
- var n = o, u = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, E = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
235
- function k(V, T, y) {
236
- var v, N = {}, P = null, j = null;
237
- y !== void 0 && (P = "" + y), T.key !== void 0 && (P = "" + T.key), T.ref !== void 0 && (j = T.ref);
238
- for (v in T) m.call(T, v) && !g.hasOwnProperty(v) && (N[v] = T[v]);
239
- if (V && V.defaultProps) for (v in T = V.defaultProps, T) N[v] === void 0 && (N[v] = T[v]);
240
- return { $$typeof: u, type: V, key: P, ref: j, props: N, _owner: E.current };
230
+ var Bt;
231
+ function Vr() {
232
+ if (Bt) return nt;
233
+ Bt = 1;
234
+ var n = r, c = Symbol.for("react.element"), d = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, R = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
235
+ function k(N, h, S) {
236
+ var _, T = {}, P = null, W = null;
237
+ S !== void 0 && (P = "" + S), h.key !== void 0 && (P = "" + h.key), h.ref !== void 0 && (W = h.ref);
238
+ for (_ in h) l.call(h, _) && !m.hasOwnProperty(_) && (T[_] = h[_]);
239
+ if (N && N.defaultProps) for (_ in h = N.defaultProps, h) T[_] === void 0 && (T[_] = h[_]);
240
+ return { $$typeof: c, type: N, key: P, ref: W, props: T, _owner: R.current };
241
241
  }
242
- return Je.Fragment = l, Je.jsx = k, Je.jsxs = k, Je;
242
+ return nt.Fragment = d, nt.jsx = k, nt.jsxs = k, nt;
243
243
  }
244
- var Xe = {};
244
+ var at = {};
245
245
  /**
246
246
  * @license React
247
247
  * react-jsx-runtime.development.js
@@ -252,53 +252,53 @@ var Xe = {};
252
252
  * LICENSE file in the root directory of this source tree.
253
253
  */
254
254
  var Mt;
255
- function Lr() {
255
+ function $r() {
256
256
  return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
257
- var n = o, u = Symbol.for("react.element"), l = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), V = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), Z = Symbol.iterator, A = "@@iterator";
258
- function D(e) {
257
+ var n = r, c = Symbol.for("react.element"), d = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), N = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), F = Symbol.iterator, D = "@@iterator";
258
+ function ce(e) {
259
259
  if (e === null || typeof e != "object")
260
260
  return null;
261
- var c = Z && e[Z] || e[A];
262
- return typeof c == "function" ? c : null;
261
+ var s = F && e[F] || e[D];
262
+ return typeof s == "function" ? s : null;
263
263
  }
264
- var p = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
264
+ var v = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
265
265
  function b(e) {
266
266
  {
267
- for (var c = arguments.length, f = new Array(c > 1 ? c - 1 : 0), R = 1; R < c; R++)
268
- f[R - 1] = arguments[R];
269
- q("error", e, f);
267
+ for (var s = arguments.length, p = new Array(s > 1 ? s - 1 : 0), C = 1; C < s; C++)
268
+ p[C - 1] = arguments[C];
269
+ K("error", e, p);
270
270
  }
271
271
  }
272
- function q(e, c, f) {
272
+ function K(e, s, p) {
273
273
  {
274
- var R = p.ReactDebugCurrentFrame, $ = R.getStackAddendum();
275
- $ !== "" && (c += "%s", f = f.concat([$]));
276
- var Y = f.map(function(L) {
277
- return String(L);
274
+ var C = v.ReactDebugCurrentFrame, U = C.getStackAddendum();
275
+ U !== "" && (s += "%s", p = p.concat([U]));
276
+ var Z = p.map(function(j) {
277
+ return String(j);
278
278
  });
279
- Y.unshift("Warning: " + c), Function.prototype.apply.call(console[e], console, Y);
279
+ Z.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, Z);
280
280
  }
281
281
  }
282
- var B = !1, G = !1, ee = !1, W = !1, F = !1, te;
283
- te = Symbol.for("react.module.reference");
284
- function _(e) {
285
- return !!(typeof e == "string" || typeof e == "function" || e === m || e === g || F || e === E || e === y || e === v || W || e === j || B || G || ee || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === N || e.$$typeof === k || e.$$typeof === V || e.$$typeof === T || // This needs to include all possible module reference object
282
+ var te = !1, q = !1, y = !1, M = !1, I = !1, $;
283
+ $ = Symbol.for("react.module.reference");
284
+ function g(e) {
285
+ return !!(typeof e == "string" || typeof e == "function" || e === l || e === m || I || e === R || e === S || e === _ || M || e === W || te || q || y || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === T || e.$$typeof === k || e.$$typeof === N || e.$$typeof === h || // This needs to include all possible module reference object
286
286
  // types supported by any Flight configuration anywhere since
287
287
  // we don't know which Flight build this will end up being used
288
288
  // with.
289
- e.$$typeof === te || e.getModuleId !== void 0));
289
+ e.$$typeof === $ || e.getModuleId !== void 0));
290
290
  }
291
- function H(e, c, f) {
292
- var R = e.displayName;
293
- if (R)
294
- return R;
295
- var $ = c.displayName || c.name || "";
296
- return $ !== "" ? f + "(" + $ + ")" : f;
291
+ function O(e, s, p) {
292
+ var C = e.displayName;
293
+ if (C)
294
+ return C;
295
+ var U = s.displayName || s.name || "";
296
+ return U !== "" ? p + "(" + U + ")" : p;
297
297
  }
298
- function de(e) {
298
+ function me(e) {
299
299
  return e.displayName || "Context";
300
300
  }
301
- function ae(e) {
301
+ function A(e) {
302
302
  if (e == null)
303
303
  return null;
304
304
  if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
@@ -306,36 +306,36 @@ function Lr() {
306
306
  if (typeof e == "string")
307
307
  return e;
308
308
  switch (e) {
309
- case m:
310
- return "Fragment";
311
309
  case l:
310
+ return "Fragment";
311
+ case d:
312
312
  return "Portal";
313
- case g:
313
+ case m:
314
314
  return "Profiler";
315
- case E:
315
+ case R:
316
316
  return "StrictMode";
317
- case y:
317
+ case S:
318
318
  return "Suspense";
319
- case v:
319
+ case _:
320
320
  return "SuspenseList";
321
321
  }
322
322
  if (typeof e == "object")
323
323
  switch (e.$$typeof) {
324
- case V:
325
- var c = e;
326
- return de(c) + ".Consumer";
324
+ case N:
325
+ var s = e;
326
+ return me(s) + ".Consumer";
327
327
  case k:
328
- var f = e;
329
- return de(f._context) + ".Provider";
328
+ var p = e;
329
+ return me(p._context) + ".Provider";
330
+ case h:
331
+ return O(e, e.render, "ForwardRef");
330
332
  case T:
331
- return H(e, e.render, "ForwardRef");
332
- case N:
333
- var R = e.displayName || null;
334
- return R !== null ? R : ae(e.type) || "Memo";
333
+ var C = e.displayName || null;
334
+ return C !== null ? C : A(e.type) || "Memo";
335
335
  case P: {
336
- var $ = e, Y = $._payload, L = $._init;
336
+ var U = e, Z = U._payload, j = U._init;
337
337
  try {
338
- return ae(L(Y));
338
+ return A(j(Z));
339
339
  } catch {
340
340
  return null;
341
341
  }
@@ -343,18 +343,18 @@ function Lr() {
343
343
  }
344
344
  return null;
345
345
  }
346
- var re = Object.assign, ue = 0, oe, be, Re, Te, Pe, le, S;
347
- function C() {
346
+ var J = Object.assign, fe = 0, X, le, Se, be, Ce, ue, Fe;
347
+ function re() {
348
348
  }
349
- C.__reactDisabledLog = !0;
350
- function J() {
349
+ re.__reactDisabledLog = !0;
350
+ function Pe() {
351
351
  {
352
- if (ue === 0) {
353
- oe = console.log, be = console.info, Re = console.warn, Te = console.error, Pe = console.group, le = console.groupCollapsed, S = console.groupEnd;
352
+ if (fe === 0) {
353
+ X = console.log, le = console.info, Se = console.warn, be = console.error, Ce = console.group, ue = console.groupCollapsed, Fe = console.groupEnd;
354
354
  var e = {
355
355
  configurable: !0,
356
356
  enumerable: !0,
357
- value: C,
357
+ value: re,
358
358
  writable: !0
359
359
  };
360
360
  Object.defineProperties(console, {
@@ -367,332 +367,332 @@ function Lr() {
367
367
  groupEnd: e
368
368
  });
369
369
  }
370
- ue++;
370
+ fe++;
371
371
  }
372
372
  }
373
- function z() {
373
+ function Re() {
374
374
  {
375
- if (ue--, ue === 0) {
375
+ if (fe--, fe === 0) {
376
376
  var e = {
377
377
  configurable: !0,
378
378
  enumerable: !0,
379
379
  writable: !0
380
380
  };
381
381
  Object.defineProperties(console, {
382
- log: re({}, e, {
383
- value: oe
382
+ log: J({}, e, {
383
+ value: X
384
384
  }),
385
- info: re({}, e, {
386
- value: be
385
+ info: J({}, e, {
386
+ value: le
387
387
  }),
388
- warn: re({}, e, {
389
- value: Re
388
+ warn: J({}, e, {
389
+ value: Se
390
390
  }),
391
- error: re({}, e, {
392
- value: Te
391
+ error: J({}, e, {
392
+ value: be
393
393
  }),
394
- group: re({}, e, {
395
- value: Pe
394
+ group: J({}, e, {
395
+ value: Ce
396
396
  }),
397
- groupCollapsed: re({}, e, {
398
- value: le
397
+ groupCollapsed: J({}, e, {
398
+ value: ue
399
399
  }),
400
- groupEnd: re({}, e, {
401
- value: S
400
+ groupEnd: J({}, e, {
401
+ value: Fe
402
402
  })
403
403
  });
404
404
  }
405
- ue < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
405
+ fe < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
406
406
  }
407
407
  }
408
- var ie = p.ReactCurrentDispatcher, Ee;
409
- function ve(e, c, f) {
408
+ var ye = v.ReactCurrentDispatcher, De;
409
+ function _e(e, s, p) {
410
410
  {
411
- if (Ee === void 0)
411
+ if (De === void 0)
412
412
  try {
413
413
  throw Error();
414
- } catch ($) {
415
- var R = $.stack.trim().match(/\n( *(at )?)/);
416
- Ee = R && R[1] || "";
414
+ } catch (U) {
415
+ var C = U.stack.trim().match(/\n( *(at )?)/);
416
+ De = C && C[1] || "";
417
417
  }
418
418
  return `
419
- ` + Ee + e;
419
+ ` + De + e;
420
420
  }
421
421
  }
422
- var ce = !1, U;
422
+ var oe = !1, Y;
423
423
  {
424
- var h = typeof WeakMap == "function" ? WeakMap : Map;
425
- U = new h();
424
+ var u = typeof WeakMap == "function" ? WeakMap : Map;
425
+ Y = new u();
426
426
  }
427
- function ge(e, c) {
428
- if (!e || ce)
427
+ function x(e, s) {
428
+ if (!e || oe)
429
429
  return "";
430
430
  {
431
- var f = U.get(e);
432
- if (f !== void 0)
433
- return f;
431
+ var p = Y.get(e);
432
+ if (p !== void 0)
433
+ return p;
434
434
  }
435
- var R;
436
- ce = !0;
437
- var $ = Error.prepareStackTrace;
435
+ var C;
436
+ oe = !0;
437
+ var U = Error.prepareStackTrace;
438
438
  Error.prepareStackTrace = void 0;
439
- var Y;
440
- Y = ie.current, ie.current = null, J();
439
+ var Z;
440
+ Z = ye.current, ye.current = null, Pe();
441
441
  try {
442
- if (c) {
443
- var L = function() {
442
+ if (s) {
443
+ var j = function() {
444
444
  throw Error();
445
445
  };
446
- if (Object.defineProperty(L.prototype, "props", {
446
+ if (Object.defineProperty(j.prototype, "props", {
447
447
  set: function() {
448
448
  throw Error();
449
449
  }
450
450
  }), typeof Reflect == "object" && Reflect.construct) {
451
451
  try {
452
- Reflect.construct(L, []);
453
- } catch (he) {
454
- R = he;
452
+ Reflect.construct(j, []);
453
+ } catch (we) {
454
+ C = we;
455
455
  }
456
- Reflect.construct(e, [], L);
456
+ Reflect.construct(e, [], j);
457
457
  } else {
458
458
  try {
459
- L.call();
460
- } catch (he) {
461
- R = he;
459
+ j.call();
460
+ } catch (we) {
461
+ C = we;
462
462
  }
463
- e.call(L.prototype);
463
+ e.call(j.prototype);
464
464
  }
465
465
  } else {
466
466
  try {
467
467
  throw Error();
468
- } catch (he) {
469
- R = he;
468
+ } catch (we) {
469
+ C = we;
470
470
  }
471
471
  e();
472
472
  }
473
- } catch (he) {
474
- if (he && R && typeof he.stack == "string") {
475
- for (var O = he.stack.split(`
476
- `), pe = R.stack.split(`
477
- `), ne = O.length - 1, se = pe.length - 1; ne >= 1 && se >= 0 && O[ne] !== pe[se]; )
473
+ } catch (we) {
474
+ if (we && C && typeof we.stack == "string") {
475
+ for (var L = we.stack.split(`
476
+ `), pe = C.stack.split(`
477
+ `), ie = L.length - 1, se = pe.length - 1; ie >= 1 && se >= 0 && L[ie] !== pe[se]; )
478
478
  se--;
479
- for (; ne >= 1 && se >= 0; ne--, se--)
480
- if (O[ne] !== pe[se]) {
481
- if (ne !== 1 || se !== 1)
479
+ for (; ie >= 1 && se >= 0; ie--, se--)
480
+ if (L[ie] !== pe[se]) {
481
+ if (ie !== 1 || se !== 1)
482
482
  do
483
- if (ne--, se--, se < 0 || O[ne] !== pe[se]) {
484
- var _e = `
485
- ` + O[ne].replace(" at new ", " at ");
486
- return e.displayName && _e.includes("<anonymous>") && (_e = _e.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, _e), _e;
483
+ if (ie--, se--, se < 0 || L[ie] !== pe[se]) {
484
+ var ke = `
485
+ ` + L[ie].replace(" at new ", " at ");
486
+ return e.displayName && ke.includes("<anonymous>") && (ke = ke.replace("<anonymous>", e.displayName)), typeof e == "function" && Y.set(e, ke), ke;
487
487
  }
488
- while (ne >= 1 && se >= 0);
488
+ while (ie >= 1 && se >= 0);
489
489
  break;
490
490
  }
491
491
  }
492
492
  } finally {
493
- ce = !1, ie.current = Y, z(), Error.prepareStackTrace = $;
493
+ oe = !1, ye.current = Z, Re(), Error.prepareStackTrace = U;
494
494
  }
495
- var Be = e ? e.displayName || e.name : "", je = Be ? ve(Be) : "";
496
- return typeof e == "function" && U.set(e, je), je;
495
+ var Ze = e ? e.displayName || e.name : "", $e = Ze ? _e(Ze) : "";
496
+ return typeof e == "function" && Y.set(e, $e), $e;
497
497
  }
498
- function me(e, c, f) {
499
- return ge(e, !1);
498
+ function z(e, s, p) {
499
+ return x(e, !1);
500
500
  }
501
- function ye(e) {
502
- var c = e.prototype;
503
- return !!(c && c.isReactComponent);
501
+ function G(e) {
502
+ var s = e.prototype;
503
+ return !!(s && s.isReactComponent);
504
504
  }
505
- function ke(e, c, f) {
505
+ function Q(e, s, p) {
506
506
  if (e == null)
507
507
  return "";
508
508
  if (typeof e == "function")
509
- return ge(e, ye(e));
509
+ return x(e, G(e));
510
510
  if (typeof e == "string")
511
- return ve(e);
511
+ return _e(e);
512
512
  switch (e) {
513
- case y:
514
- return ve("Suspense");
515
- case v:
516
- return ve("SuspenseList");
513
+ case S:
514
+ return _e("Suspense");
515
+ case _:
516
+ return _e("SuspenseList");
517
517
  }
518
518
  if (typeof e == "object")
519
519
  switch (e.$$typeof) {
520
+ case h:
521
+ return z(e.render);
520
522
  case T:
521
- return me(e.render);
522
- case N:
523
- return ke(e.type, c, f);
523
+ return Q(e.type, s, p);
524
524
  case P: {
525
- var R = e, $ = R._payload, Y = R._init;
525
+ var C = e, U = C._payload, Z = C._init;
526
526
  try {
527
- return ke(Y($), c, f);
527
+ return Q(Z(U), s, p);
528
528
  } catch {
529
529
  }
530
530
  }
531
531
  }
532
532
  return "";
533
533
  }
534
- var Ne = Object.prototype.hasOwnProperty, Ae = {}, ze = p.ReactDebugCurrentFrame;
535
- function Me(e) {
534
+ var de = Object.prototype.hasOwnProperty, Ae = {}, xe = v.ReactDebugCurrentFrame;
535
+ function he(e) {
536
536
  if (e) {
537
- var c = e._owner, f = ke(e.type, e._source, c ? c.type : null);
538
- ze.setExtraStackFrame(f);
537
+ var s = e._owner, p = Q(e.type, e._source, s ? s.type : null);
538
+ xe.setExtraStackFrame(p);
539
539
  } else
540
- ze.setExtraStackFrame(null);
540
+ xe.setExtraStackFrame(null);
541
541
  }
542
- function Ue(e, c, f, R, $) {
542
+ function Me(e, s, p, C, U) {
543
543
  {
544
- var Y = Function.call.bind(Ne);
545
- for (var L in e)
546
- if (Y(e, L)) {
547
- var O = void 0;
544
+ var Z = Function.call.bind(de);
545
+ for (var j in e)
546
+ if (Z(e, j)) {
547
+ var L = void 0;
548
548
  try {
549
- if (typeof e[L] != "function") {
550
- var pe = Error((R || "React class") + ": " + f + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
549
+ if (typeof e[j] != "function") {
550
+ var pe = Error((C || "React class") + ": " + p + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
551
551
  throw pe.name = "Invariant Violation", pe;
552
552
  }
553
- O = e[L](c, L, R, f, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
554
- } catch (ne) {
555
- O = ne;
553
+ L = e[j](s, j, C, p, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
554
+ } catch (ie) {
555
+ L = ie;
556
556
  }
557
- O && !(O instanceof Error) && (Me($), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", R || "React class", f, L, typeof O), Me(null)), O instanceof Error && !(O.message in Ae) && (Ae[O.message] = !0, Me($), b("Failed %s type: %s", f, O.message), Me(null));
557
+ L && !(L instanceof Error) && (he(U), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", C || "React class", p, j, typeof L), he(null)), L instanceof Error && !(L.message in Ae) && (Ae[L.message] = !0, he(U), b("Failed %s type: %s", p, L.message), he(null));
558
558
  }
559
559
  }
560
560
  }
561
- var ht = Array.isArray;
562
- function Fe(e) {
563
- return ht(e);
561
+ var et = Array.isArray;
562
+ function je(e) {
563
+ return et(e);
564
564
  }
565
565
  function wt(e) {
566
566
  {
567
- var c = typeof Symbol == "function" && Symbol.toStringTag, f = c && e[Symbol.toStringTag] || e.constructor.name || "Object";
568
- return f;
567
+ var s = typeof Symbol == "function" && Symbol.toStringTag, p = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
568
+ return p;
569
569
  }
570
570
  }
571
- function vt(e) {
571
+ function gt(e) {
572
572
  try {
573
- return at(e), !1;
573
+ return st(e), !1;
574
574
  } catch {
575
575
  return !0;
576
576
  }
577
577
  }
578
- function at(e) {
578
+ function st(e) {
579
579
  return "" + e;
580
580
  }
581
- function ot(e) {
582
- if (vt(e))
583
- return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wt(e)), at(e);
581
+ function ct(e) {
582
+ if (gt(e))
583
+ return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wt(e)), st(e);
584
584
  }
585
- var it = p.ReactCurrentOwner, gt = {
585
+ var ut = v.ReactCurrentOwner, Et = {
586
586
  key: !0,
587
587
  ref: !0,
588
588
  __self: !0,
589
589
  __source: !0
590
- }, st, Le;
591
- function Ve(e) {
592
- if (Ne.call(e, "ref")) {
593
- var c = Object.getOwnPropertyDescriptor(e, "ref").get;
594
- if (c && c.isReactWarning)
590
+ }, ft, Ve;
591
+ function Ue(e) {
592
+ if (de.call(e, "ref")) {
593
+ var s = Object.getOwnPropertyDescriptor(e, "ref").get;
594
+ if (s && s.isReactWarning)
595
595
  return !1;
596
596
  }
597
597
  return e.ref !== void 0;
598
598
  }
599
- function Et(e) {
600
- if (Ne.call(e, "key")) {
601
- var c = Object.getOwnPropertyDescriptor(e, "key").get;
602
- if (c && c.isReactWarning)
599
+ function yt(e) {
600
+ if (de.call(e, "key")) {
601
+ var s = Object.getOwnPropertyDescriptor(e, "key").get;
602
+ if (s && s.isReactWarning)
603
603
  return !1;
604
604
  }
605
605
  return e.key !== void 0;
606
606
  }
607
- function yt(e, c) {
608
- typeof e.ref == "string" && it.current;
607
+ function _t(e, s) {
608
+ typeof e.ref == "string" && ut.current;
609
609
  }
610
- function _t(e, c) {
610
+ function xt(e, s) {
611
611
  {
612
- var f = function() {
613
- st || (st = !0, b("%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://reactjs.org/link/special-props)", c));
612
+ var p = function() {
613
+ ft || (ft = !0, b("%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://reactjs.org/link/special-props)", s));
614
614
  };
615
- f.isReactWarning = !0, Object.defineProperty(e, "key", {
616
- get: f,
615
+ p.isReactWarning = !0, Object.defineProperty(e, "key", {
616
+ get: p,
617
617
  configurable: !0
618
618
  });
619
619
  }
620
620
  }
621
- function bt(e, c) {
621
+ function bt(e, s) {
622
622
  {
623
- var f = function() {
624
- Le || (Le = !0, b("%s: `ref` 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://reactjs.org/link/special-props)", c));
623
+ var p = function() {
624
+ Ve || (Ve = !0, b("%s: `ref` 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://reactjs.org/link/special-props)", s));
625
625
  };
626
- f.isReactWarning = !0, Object.defineProperty(e, "ref", {
627
- get: f,
626
+ p.isReactWarning = !0, Object.defineProperty(e, "ref", {
627
+ get: p,
628
628
  configurable: !0
629
629
  });
630
630
  }
631
631
  }
632
- var Ct = function(e, c, f, R, $, Y, L) {
633
- var O = {
632
+ var Ct = function(e, s, p, C, U, Z, j) {
633
+ var L = {
634
634
  // This tag allows us to uniquely identify this as a React Element
635
- $$typeof: u,
635
+ $$typeof: c,
636
636
  // Built-in properties that belong on the element
637
637
  type: e,
638
- key: c,
639
- ref: f,
640
- props: L,
638
+ key: s,
639
+ ref: p,
640
+ props: j,
641
641
  // Record the component responsible for creating this element.
642
- _owner: Y
642
+ _owner: Z
643
643
  };
644
- return O._store = {}, Object.defineProperty(O._store, "validated", {
644
+ return L._store = {}, Object.defineProperty(L._store, "validated", {
645
645
  configurable: !1,
646
646
  enumerable: !1,
647
647
  writable: !0,
648
648
  value: !1
649
- }), Object.defineProperty(O, "_self", {
649
+ }), Object.defineProperty(L, "_self", {
650
650
  configurable: !1,
651
651
  enumerable: !1,
652
652
  writable: !1,
653
- value: R
654
- }), Object.defineProperty(O, "_source", {
653
+ value: C
654
+ }), Object.defineProperty(L, "_source", {
655
655
  configurable: !1,
656
656
  enumerable: !1,
657
657
  writable: !1,
658
- value: $
659
- }), Object.freeze && (Object.freeze(O.props), Object.freeze(O)), O;
658
+ value: U
659
+ }), Object.freeze && (Object.freeze(L.props), Object.freeze(L)), L;
660
660
  };
661
- function lt(e, c, f, R, $) {
661
+ function dt(e, s, p, C, U) {
662
662
  {
663
- var Y, L = {}, O = null, pe = null;
664
- f !== void 0 && (ot(f), O = "" + f), Et(c) && (ot(c.key), O = "" + c.key), Ve(c) && (pe = c.ref, yt(c, $));
665
- for (Y in c)
666
- Ne.call(c, Y) && !gt.hasOwnProperty(Y) && (L[Y] = c[Y]);
663
+ var Z, j = {}, L = null, pe = null;
664
+ p !== void 0 && (ct(p), L = "" + p), yt(s) && (ct(s.key), L = "" + s.key), Ue(s) && (pe = s.ref, _t(s, U));
665
+ for (Z in s)
666
+ de.call(s, Z) && !Et.hasOwnProperty(Z) && (j[Z] = s[Z]);
667
667
  if (e && e.defaultProps) {
668
- var ne = e.defaultProps;
669
- for (Y in ne)
670
- L[Y] === void 0 && (L[Y] = ne[Y]);
668
+ var ie = e.defaultProps;
669
+ for (Z in ie)
670
+ j[Z] === void 0 && (j[Z] = ie[Z]);
671
671
  }
672
- if (O || pe) {
672
+ if (L || pe) {
673
673
  var se = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
674
- O && _t(L, se), pe && bt(L, se);
674
+ L && xt(j, se), pe && bt(j, se);
675
675
  }
676
- return Ct(e, O, pe, $, R, it.current, L);
676
+ return Ct(e, L, pe, U, C, ut.current, j);
677
677
  }
678
678
  }
679
- var $e = p.ReactCurrentOwner, Ye = p.ReactDebugCurrentFrame;
680
- function De(e) {
679
+ var ze = v.ReactCurrentOwner, tt = v.ReactDebugCurrentFrame;
680
+ function Be(e) {
681
681
  if (e) {
682
- var c = e._owner, f = ke(e.type, e._source, c ? c.type : null);
683
- Ye.setExtraStackFrame(f);
682
+ var s = e._owner, p = Q(e.type, e._source, s ? s.type : null);
683
+ tt.setExtraStackFrame(p);
684
684
  } else
685
- Ye.setExtraStackFrame(null);
685
+ tt.setExtraStackFrame(null);
686
686
  }
687
- var Ze;
688
- Ze = !1;
689
- function Ge(e) {
690
- return typeof e == "object" && e !== null && e.$$typeof === u;
687
+ var Ge;
688
+ Ge = !1;
689
+ function Ye(e) {
690
+ return typeof e == "object" && e !== null && e.$$typeof === c;
691
691
  }
692
- function ct() {
692
+ function mt() {
693
693
  {
694
- if ($e.current) {
695
- var e = ae($e.current.type);
694
+ if (ze.current) {
695
+ var e = A(ze.current.type);
696
696
  if (e)
697
697
  return `
698
698
 
@@ -701,148 +701,148 @@ Check the render method of \`` + e + "`.";
701
701
  return "";
702
702
  }
703
703
  }
704
- function xt(e) {
704
+ function Rt(e) {
705
705
  return "";
706
706
  }
707
- var ut = {};
708
- function t(e) {
707
+ var pt = {};
708
+ function kt(e) {
709
709
  {
710
- var c = ct();
711
- if (!c) {
712
- var f = typeof e == "string" ? e : e.displayName || e.name;
713
- f && (c = `
710
+ var s = mt();
711
+ if (!s) {
712
+ var p = typeof e == "string" ? e : e.displayName || e.name;
713
+ p && (s = `
714
714
 
715
- Check the top-level render call using <` + f + ">.");
715
+ Check the top-level render call using <` + p + ">.");
716
716
  }
717
- return c;
717
+ return s;
718
718
  }
719
719
  }
720
- function r(e, c) {
720
+ function ht(e, s) {
721
721
  {
722
722
  if (!e._store || e._store.validated || e.key != null)
723
723
  return;
724
724
  e._store.validated = !0;
725
- var f = t(c);
726
- if (ut[f])
725
+ var p = kt(s);
726
+ if (pt[p])
727
727
  return;
728
- ut[f] = !0;
729
- var R = "";
730
- e && e._owner && e._owner !== $e.current && (R = " It was passed a child from " + ae(e._owner.type) + "."), De(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', f, R), De(null);
728
+ pt[p] = !0;
729
+ var C = "";
730
+ e && e._owner && e._owner !== ze.current && (C = " It was passed a child from " + A(e._owner.type) + "."), Be(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', p, C), Be(null);
731
731
  }
732
732
  }
733
- function a(e, c) {
733
+ function t(e, s) {
734
734
  {
735
735
  if (typeof e != "object")
736
736
  return;
737
- if (Fe(e))
738
- for (var f = 0; f < e.length; f++) {
739
- var R = e[f];
740
- Ge(R) && r(R, c);
737
+ if (je(e))
738
+ for (var p = 0; p < e.length; p++) {
739
+ var C = e[p];
740
+ Ye(C) && ht(C, s);
741
741
  }
742
- else if (Ge(e))
742
+ else if (Ye(e))
743
743
  e._store && (e._store.validated = !0);
744
744
  else if (e) {
745
- var $ = D(e);
746
- if (typeof $ == "function" && $ !== e.entries)
747
- for (var Y = $.call(e), L; !(L = Y.next()).done; )
748
- Ge(L.value) && r(L.value, c);
745
+ var U = ce(e);
746
+ if (typeof U == "function" && U !== e.entries)
747
+ for (var Z = U.call(e), j; !(j = Z.next()).done; )
748
+ Ye(j.value) && ht(j.value, s);
749
749
  }
750
750
  }
751
751
  }
752
- function s(e) {
752
+ function a(e) {
753
753
  {
754
- var c = e.type;
755
- if (c == null || typeof c == "string")
754
+ var s = e.type;
755
+ if (s == null || typeof s == "string")
756
756
  return;
757
- var f;
758
- if (typeof c == "function")
759
- f = c.propTypes;
760
- else if (typeof c == "object" && (c.$$typeof === T || // Note: Memo only checks outer props here.
757
+ var p;
758
+ if (typeof s == "function")
759
+ p = s.propTypes;
760
+ else if (typeof s == "object" && (s.$$typeof === h || // Note: Memo only checks outer props here.
761
761
  // Inner props are checked in the reconciler.
762
- c.$$typeof === N))
763
- f = c.propTypes;
762
+ s.$$typeof === T))
763
+ p = s.propTypes;
764
764
  else
765
765
  return;
766
- if (f) {
767
- var R = ae(c);
768
- Ue(f, e.props, "prop", R, e);
769
- } else if (c.PropTypes !== void 0 && !Ze) {
770
- Ze = !0;
771
- var $ = ae(c);
772
- b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown");
766
+ if (p) {
767
+ var C = A(s);
768
+ Me(p, e.props, "prop", C, e);
769
+ } else if (s.PropTypes !== void 0 && !Ge) {
770
+ Ge = !0;
771
+ var U = A(s);
772
+ b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", U || "Unknown");
773
773
  }
774
- typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
774
+ typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
775
775
  }
776
776
  }
777
- function i(e) {
777
+ function o(e) {
778
778
  {
779
- for (var c = Object.keys(e.props), f = 0; f < c.length; f++) {
780
- var R = c[f];
781
- if (R !== "children" && R !== "key") {
782
- De(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", R), De(null);
779
+ for (var s = Object.keys(e.props), p = 0; p < s.length; p++) {
780
+ var C = s[p];
781
+ if (C !== "children" && C !== "key") {
782
+ Be(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", C), Be(null);
783
783
  break;
784
784
  }
785
785
  }
786
- e.ref !== null && (De(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), De(null));
786
+ e.ref !== null && (Be(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), Be(null));
787
787
  }
788
788
  }
789
- var w = {};
790
- function d(e, c, f, R, $, Y) {
789
+ var i = {};
790
+ function f(e, s, p, C, U, Z) {
791
791
  {
792
- var L = _(e);
793
- if (!L) {
794
- var O = "";
795
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (O += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
796
- var pe = xt();
797
- pe ? O += pe : O += ct();
798
- var ne;
799
- e === null ? ne = "null" : Fe(e) ? ne = "array" : e !== void 0 && e.$$typeof === u ? (ne = "<" + (ae(e.type) || "Unknown") + " />", O = " Did you accidentally export a JSX literal instead of a component?") : ne = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ne, O);
792
+ var j = g(e);
793
+ if (!j) {
794
+ var L = "";
795
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (L += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
796
+ var pe = Rt();
797
+ pe ? L += pe : L += mt();
798
+ var ie;
799
+ e === null ? ie = "null" : je(e) ? ie = "array" : e !== void 0 && e.$$typeof === c ? (ie = "<" + (A(e.type) || "Unknown") + " />", L = " Did you accidentally export a JSX literal instead of a component?") : ie = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ie, L);
800
800
  }
801
- var se = lt(e, c, f, $, Y);
801
+ var se = dt(e, s, p, U, Z);
802
802
  if (se == null)
803
803
  return se;
804
- if (L) {
805
- var _e = c.children;
806
- if (_e !== void 0)
807
- if (R)
808
- if (Fe(_e)) {
809
- for (var Be = 0; Be < _e.length; Be++)
810
- a(_e[Be], e);
811
- Object.freeze && Object.freeze(_e);
804
+ if (j) {
805
+ var ke = s.children;
806
+ if (ke !== void 0)
807
+ if (C)
808
+ if (je(ke)) {
809
+ for (var Ze = 0; Ze < ke.length; Ze++)
810
+ t(ke[Ze], e);
811
+ Object.freeze && Object.freeze(ke);
812
812
  } else
813
813
  b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
814
814
  else
815
- a(_e, e);
815
+ t(ke, e);
816
816
  }
817
- if (Ne.call(c, "key")) {
818
- var je = ae(e), he = Object.keys(c).filter(function(Zt) {
819
- return Zt !== "key";
820
- }), Rt = he.length > 0 ? "{key: someKey, " + he.join(": ..., ") + ": ...}" : "{key: someKey}";
821
- if (!w[je + Rt]) {
822
- var Yt = he.length > 0 ? "{" + he.join(": ..., ") + ": ...}" : "{}";
817
+ if (de.call(s, "key")) {
818
+ var $e = A(e), we = Object.keys(s).filter(function(Kt) {
819
+ return Kt !== "key";
820
+ }), Tt = we.length > 0 ? "{key: someKey, " + we.join(": ..., ") + ": ...}" : "{key: someKey}";
821
+ if (!i[$e + Tt]) {
822
+ var Zt = we.length > 0 ? "{" + we.join(": ..., ") + ": ...}" : "{}";
823
823
  b(`A props object containing a "key" prop is being spread into JSX:
824
824
  let props = %s;
825
825
  <%s {...props} />
826
826
  React keys must be passed directly to JSX without using spread:
827
827
  let props = %s;
828
- <%s key={someKey} {...props} />`, Rt, je, Yt, je), w[je + Rt] = !0;
828
+ <%s key={someKey} {...props} />`, Tt, $e, Zt, $e), i[$e + Tt] = !0;
829
829
  }
830
830
  }
831
- return e === m ? i(se) : s(se), se;
831
+ return e === l ? o(se) : a(se), se;
832
832
  }
833
833
  }
834
- function x(e, c, f) {
835
- return d(e, c, f, !0);
834
+ function w(e, s, p) {
835
+ return f(e, s, p, !0);
836
836
  }
837
- function X(e, c, f) {
838
- return d(e, c, f, !1);
837
+ function E(e, s, p) {
838
+ return f(e, s, p, !1);
839
839
  }
840
- var Se = X, Ke = x;
841
- Xe.Fragment = m, Xe.jsx = Se, Xe.jsxs = Ke;
842
- }()), Xe;
840
+ var ne = E, ve = w;
841
+ at.Fragment = l, at.jsx = ne, at.jsxs = ve;
842
+ }()), at;
843
843
  }
844
- process.env.NODE_ENV === "production" ? Dt.exports = Fr() : Dt.exports = Lr();
845
- var xe = Dt.exports, rt = (n) => nr("path", n), nt = Ht(
844
+ process.env.NODE_ENV === "production" ? It.exports = Vr() : It.exports = $r();
845
+ var Te = It.exports, Xe = (n) => cr("path", n), Qe = Ut(
846
846
  /**
847
847
  * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
848
848
  * Other props will be passed through to svg component.
@@ -850,388 +850,385 @@ var xe = Dt.exports, rt = (n) => nr("path", n), nt = Ht(
850
850
  *
851
851
  * @return {React.JSX.Element} Stop component
852
852
  */
853
- ({ className: n, isPressed: u, ...l }, m) => {
854
- const E = {
855
- ...l,
856
- className: ar(n, { "is-pressed": u }) || void 0,
853
+ ({ className: n, isPressed: c, ...d }, l) => {
854
+ const R = {
855
+ ...d,
856
+ className: ur(n, { "is-pressed": c }) || void 0,
857
857
  "aria-hidden": !0,
858
858
  focusable: !1
859
859
  };
860
- return /* @__PURE__ */ xe.jsx("svg", { ...E, ref: m });
860
+ return /* @__PURE__ */ Te.jsx("svg", { ...R, ref: l });
861
861
  }
862
862
  );
863
- nt.displayName = "SVG";
864
- const jr = /* @__PURE__ */ xe.jsx(nt, {
863
+ Qe.displayName = "SVG";
864
+ const Wr = /* @__PURE__ */ Te.jsx(Qe, {
865
865
  viewBox: "0 0 24 24",
866
866
  xmlns: "http://www.w3.org/2000/svg",
867
- children: /* @__PURE__ */ xe.jsx(rt, {
867
+ children: /* @__PURE__ */ Te.jsx(Xe, {
868
868
  d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
869
869
  })
870
- }), Ir = /* @__PURE__ */ xe.jsx(nt, {
870
+ }), Hr = /* @__PURE__ */ Te.jsx(Qe, {
871
871
  xmlns: "http://www.w3.org/2000/svg",
872
872
  viewBox: "0 0 24 24",
873
- children: /* @__PURE__ */ xe.jsx(rt, {
873
+ children: /* @__PURE__ */ Te.jsx(Xe, {
874
874
  d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
875
875
  })
876
- }), Mr = /* @__PURE__ */ xe.jsx(nt, {
876
+ }), Ur = /* @__PURE__ */ Te.jsx(Qe, {
877
877
  viewBox: "0 0 24 24",
878
878
  xmlns: "http://www.w3.org/2000/svg",
879
- children: /* @__PURE__ */ xe.jsx(rt, {
879
+ children: /* @__PURE__ */ Te.jsx(Xe, {
880
880
  fillRule: "evenodd",
881
881
  clipRule: "evenodd",
882
882
  d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
883
883
  })
884
- }), Vr = /* @__PURE__ */ xe.jsxs(nt, {
884
+ }), zr = /* @__PURE__ */ Te.jsxs(Qe, {
885
885
  xmlns: "http://www.w3.org/2000/svg",
886
886
  viewBox: "0 0 24 24",
887
- children: [/* @__PURE__ */ xe.jsx(rt, {
887
+ children: [/* @__PURE__ */ Te.jsx(Xe, {
888
888
  d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
889
- }), /* @__PURE__ */ xe.jsx(rt, {
889
+ }), /* @__PURE__ */ Te.jsx(Xe, {
890
890
  d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
891
891
  })]
892
- }), $r = "_file-picker-tree_3rwm2_1", Br = "_file-node-button_3rwm2_17", Wr = "_selected_3rwm2_53", Hr = "_focused_3rwm2_65", zr = "_dropTarget_3rwm2_70", Ur = "_dropTargetInvalid_3rwm2_79", Yr = "_renaming_3rwm2_88", Zr = "_renameInput_3rwm2_93", Gr = "_file-name_3rwm2_108", we = {
893
- filePickerTree: $r,
894
- fileNodeButton: Br,
895
- selected: Wr,
896
- focused: Hr,
897
- dropTarget: zr,
898
- dropTargetInvalid: Ur,
899
- renaming: Yr,
900
- renameInput: Zr,
901
- fileName: Gr
892
+ }), Gr = /* @__PURE__ */ Te.jsx(Qe, {
893
+ xmlns: "http://www.w3.org/2000/svg",
894
+ viewBox: "0 0 24 24",
895
+ children: /* @__PURE__ */ Te.jsx(Xe, {
896
+ d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
897
+ })
898
+ }), Yr = "_file-picker-tree_ad9od_1", Zr = "_file-node-button_ad9od_17", Kr = "_selected_ad9od_56", qr = "_focused_ad9od_75", Jr = "_dropTarget_ad9od_83", Xr = "_dropTargetInvalid_ad9od_95", Qr = "_renaming_ad9od_104", en = "_renameInput_ad9od_109", tn = "_file-name_ad9od_124", Ee = {
899
+ filePickerTree: Yr,
900
+ fileNodeButton: Zr,
901
+ selected: Kr,
902
+ focused: qr,
903
+ dropTarget: Jr,
904
+ dropTargetInvalid: Xr,
905
+ renaming: Qr,
906
+ renameInput: en,
907
+ fileName: tn
902
908
  };
903
- function Pt(n) {
909
+ function Dt(n) {
904
910
  if (!n) return [];
905
- const u = n.replaceAll(/\\+/g, "/").replace(/\/{2,}/g, "/").replace(/\/$/, "") || n, l = u.startsWith("/"), m = u.split("/").filter(Boolean), E = [];
906
- let g = l ? "/" : "";
907
- l && E.push("/");
908
- for (const k of m)
909
- !g || g === "/" ? g = g === "/" ? `/${k}` : k : g = `${g}/${k}`, E.push(g);
910
- return E;
911
- }
912
- function Kr(n, u) {
913
- if (!n || !u || n === u) return !1;
914
- const l = n === "/" ? "/" : n.replace(/\/{2,}/g, "/"), m = u.replace(/\/{2,}/g, "/");
915
- return l === "/" ? m.startsWith("/") && m !== "/" : m.startsWith(`${l}/`);
911
+ const c = Jt(n), d = c.startsWith("/"), l = c.split("/").filter(Boolean), R = [];
912
+ let m = d ? "/" : "";
913
+ d && R.push("/");
914
+ for (const k of l)
915
+ !m || m === "/" ? m = m === "/" ? `/${k}` : k : m = `${m}/${k}`, R.push(m);
916
+ return R;
916
917
  }
917
- function kt(n, u, l) {
918
- return n && (n === u ? l : n.startsWith(u === "/" ? "/" : `${u}/`) ? l + n.slice(u.length) : n);
918
+ function He(n, c, d) {
919
+ return n && (n === c ? d : n.startsWith(c === "/" ? "/" : `${c}/`) ? d + n.slice(c.length) : n);
919
920
  }
920
- const qr = Bt(function({
921
- withContextMenu: u = !0,
921
+ const rn = $t(function({
922
+ withContextMenu: c = !0,
923
+ readOnly: d = !1,
922
924
  filesystem: l,
923
- root: m = "/wordpress",
924
- initialSelectedPath: E,
925
- onSelect: g = () => {
925
+ root: R = "/wordpress",
926
+ initialSelectedPath: m,
927
+ onSelect: k = () => {
926
928
  },
927
- onDoubleClickFile: k
928
- }, V) {
929
- const T = Nt(() => {
930
- let t = (m || "/").replace(/\\+/g, "/");
931
- return t.startsWith("/") || (t = `/${t}`), t = t.replace(/\/{2,}/g, "/"), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t || "/";
932
- }, [m]), y = (t) => !t || t === "." || t === ".." ? !1 : !/[\\/]/.test(t), [v, N] = Q(() => {
933
- if (!E)
929
+ onDoubleClickFile: N
930
+ }, h) {
931
+ const S = Ft(() => Oe("/", R || "/"), [R]), [_, T] = ee(() => {
932
+ if (!m)
934
933
  return {};
935
934
  const t = {};
936
- for (const r of Pt(E))
937
- t[r] = !0;
935
+ for (const a of Dt(m))
936
+ t[a] = !0;
938
937
  return t;
939
- }), [P, j] = Q(
940
- () => E ?? null
941
- ), [Z, A] = Q(
942
- () => E ?? null
943
- ), [D, p] = Q({}), [b, q] = Q(
938
+ }), [P, W] = ee(
939
+ () => m ?? null
940
+ ), [F, D] = ee(
941
+ () => m ?? null
942
+ ), [ce, v] = ee({}), [b, K] = ee(
944
943
  {}
945
- ), [B, G] = Q(null), [ee, W] = Q(
944
+ ), [te, q] = ee(null), [y, M] = ee(
946
945
  null
947
- ), F = M({}), te = M(!1), _ = M(null), H = M(null), de = M(b), ae = M(D), re = () => {
948
- for (const t of Object.keys(F.current))
949
- clearTimeout(F.current[t]), delete F.current[t];
950
- }, ue = (t) => {
951
- const r = F.current[t];
952
- r && (clearTimeout(r), delete F.current[t]);
946
+ ), I = V({}), $ = V(!1), g = V(null), O = V(null), me = V(b), A = V(ce), J = () => {
947
+ for (const t of Object.keys(I.current))
948
+ clearTimeout(I.current[t]), delete I.current[t];
949
+ }, fe = (t) => {
950
+ const a = I.current[t];
951
+ a && (clearTimeout(a), delete I.current[t]);
953
952
  };
954
- I(() => {
955
- de.current = b;
956
- }, [b]), I(() => {
957
- ae.current = D;
958
- }, [D]);
959
- const oe = (t) => {
960
- var a;
961
- const r = (a = _.current) == null ? void 0 : a.querySelector(
962
- `[data-path="${t}"]`
953
+ H(() => {
954
+ me.current = b;
955
+ }, [b]), H(() => {
956
+ A.current = ce;
957
+ }, [ce]);
958
+ const X = (t) => {
959
+ var o;
960
+ const a = (o = g.current) == null ? void 0 : o.querySelector(
961
+ `[data-path="${CSS.escape(t)}"]`
963
962
  );
964
- r && typeof r.focus == "function" && (r.focus(), r.scrollIntoView({
963
+ a && typeof a.focus == "function" && (a.focus(), a.scrollIntoView({
965
964
  behavior: "smooth",
966
965
  block: "nearest"
967
966
  }));
968
- }, be = (t, r = "") => (r ? `${r}/${t.name}` : t.name).replaceAll(/\\+/g, "/").replace(/\/{2,}/g, "/"), Re = (t, r) => t.children ? t.children : D[r], Te = async (t, r) => {
969
- const a = await t.listFiles(r), s = [];
970
- for (const i of a) {
971
- const w = r === "/" ? `/${i}` : `${r}/${i}`, d = await t.isDir(w);
972
- s.push({ name: i, type: d ? "folder" : "file" });
973
- }
974
- return s.sort((i, w) => {
975
- var Se;
976
- if (i.type !== w.type) return i.type === "folder" ? -1 : 1;
977
- const d = r === "/" ? `/${i.name}` : `${r}/${i.name}`, x = r === "/" ? `/${w.name}` : `${r}/${w.name}`, X = (Se = ye.current) == null ? void 0 : Se.tempPath;
978
- if (X) {
979
- if (d === X) return -1;
980
- if (x === X) return 1;
967
+ }, le = (t, a = "") => a ? Oe(a, t.name) : Oe("/", t.name), Se = (t, a) => t.children ? t.children : ce[a], be = async (t, a) => {
968
+ const o = await t.listFiles(a), i = [];
969
+ for (const f of o) {
970
+ const w = a === "/" ? `/${f}` : `${a}/${f}`, E = await t.isDir(w);
971
+ i.push({ name: f, type: E ? "folder" : "file" });
972
+ }
973
+ return i.sort((f, w) => {
974
+ var e;
975
+ if (f.type !== w.type) return f.type === "folder" ? -1 : 1;
976
+ const E = a === "/" ? `/${f.name}` : `${a}/${f.name}`, ne = a === "/" ? `/${w.name}` : `${a}/${w.name}`, ve = (e = G.current) == null ? void 0 : e.tempPath;
977
+ if (ve) {
978
+ if (E === ve) return -1;
979
+ if (ne === ve) return 1;
981
980
  }
982
- return i.name.localeCompare(w.name);
983
- }), s;
984
- }, Pe = async (t) => await Te(l, t), le = (t, r) => {
985
- if (r.type !== "folder")
986
- return r.children;
987
- const a = r.children ?? ae.current[t];
988
- return a || de.current[t] ? a : (q((s) => ({ ...s, [t]: !0 })), new Promise((s) => {
989
- Pe(t).then((i) => {
990
- p((w) => ({
981
+ return f.name.localeCompare(w.name);
982
+ }), i;
983
+ }, Ce = async (t) => await be(l, t), ue = (t, a) => {
984
+ if (a.type !== "folder")
985
+ return a.children;
986
+ const o = a.children ?? A.current[t];
987
+ return o || me.current[t] ? o : (K((i) => ({ ...i, [t]: !0 })), new Promise((i) => {
988
+ Ce(t).then((f) => {
989
+ v((w) => ({
991
990
  ...w,
992
- [t]: i ?? []
993
- })), s(i ?? []);
991
+ [t]: f ?? []
992
+ })), i(f ?? []);
994
993
  }).catch(() => {
995
- s([]);
994
+ i([]);
996
995
  }).finally(() => {
997
- q((i) => {
998
- const w = { ...i };
996
+ K((f) => {
997
+ const w = { ...f };
999
998
  return delete w[t], w;
1000
999
  });
1001
1000
  });
1002
1001
  }));
1003
- }, S = (t, r) => {
1004
- r.type === "folder" && (typeof window > "u" || F.current[t] || (F.current[t] = window.setTimeout(() => {
1005
- N((a) => a[t] ? a : { ...a, [t]: !0 }), le(t, r), delete F.current[t];
1002
+ }, Fe = (t, a) => {
1003
+ a.type === "folder" && (typeof window > "u" || I.current[t] || (I.current[t] = window.setTimeout(() => {
1004
+ T((o) => o[t] ? o : { ...o, [t]: !0 }), ue(t, a), delete I.current[t];
1006
1005
  }, 600)));
1007
- }, C = (t) => (q((r) => ({ ...r, [t]: !0 })), new Promise((r) => {
1008
- Pe(t).then((a) => {
1009
- p((s) => ({
1010
- ...s,
1011
- [t]: a ?? []
1012
- })), r(a ?? []);
1006
+ }, re = (t) => (K((a) => ({ ...a, [t]: !0 })), new Promise((a) => {
1007
+ Ce(t).then((o) => {
1008
+ v((i) => ({
1009
+ ...i,
1010
+ [t]: o ?? []
1011
+ })), a(o ?? []);
1013
1012
  }).catch(() => {
1014
- r([]);
1013
+ a([]);
1015
1014
  }).finally(() => {
1016
- q((a) => {
1017
- const s = { ...a };
1018
- return delete s[t], s;
1015
+ K((o) => {
1016
+ const i = { ...o };
1017
+ return delete i[t], i;
1019
1018
  });
1020
1019
  });
1021
- })), J = (t, r, a) => {
1022
- N((s) => ({
1023
- ...s,
1024
- [t]: a
1025
- })), a ? le(t, r) : p((s) => {
1026
- if (s[t] === void 0)
1027
- return s;
1028
- const i = { ...s };
1029
- return delete i[t], i;
1020
+ })), Pe = (t, a, o) => {
1021
+ T((i) => ({
1022
+ ...i,
1023
+ [t]: o
1024
+ })), o ? ue(t, a) : v((i) => {
1025
+ if (i[t] === void 0)
1026
+ return i;
1027
+ const f = { ...i };
1028
+ return delete f[t], f;
1030
1029
  });
1031
- }, z = async (t) => {
1030
+ }, Re = async (t) => {
1032
1031
  if (!t) return;
1033
- const r = Pt(t);
1034
- if (r.length === 0) return;
1035
- N((i) => {
1036
- const w = { ...i };
1037
- for (const d of r)
1038
- w[d] = !0;
1032
+ const a = Dt(t);
1033
+ if (a.length === 0) return;
1034
+ T((f) => {
1035
+ const w = { ...f };
1036
+ for (const E of a)
1037
+ w[E] = !0;
1039
1038
  return w;
1040
1039
  });
1041
- let a = [
1042
- { name: T, type: "folder" }
1043
- ], s = "";
1044
- for (const i of r) {
1045
- const w = a == null ? void 0 : a.find((x) => be(x, s) === i);
1040
+ let o = [
1041
+ { name: S, type: "folder" }
1042
+ ], i = "";
1043
+ for (const f of a) {
1044
+ const w = o == null ? void 0 : o.find((ne) => le(ne, i) === f);
1046
1045
  if (!w || w.type !== "folder") {
1047
- s = i, a = [];
1046
+ i = f, o = [];
1048
1047
  continue;
1049
1048
  }
1050
- a = await le(i, w) ?? ae.current[i], s = i;
1051
- }
1052
- }, ie = (t, r) => {
1053
- if (!t || !r || t === r)
1054
- return;
1055
- const a = t === "/" ? "/" : `${t}/`, s = (i) => i === t ? r : i.startsWith(a) ? r + i.slice(t.length) : null;
1056
- N((i) => {
1057
- let w = !1;
1058
- const d = { ...i };
1059
- for (const x of Object.keys(i)) {
1060
- const X = s(x);
1061
- X && X !== x && (d[X] = i[x], delete d[x], w = !0);
1049
+ o = await ue(f, w) ?? A.current[f], i = f;
1050
+ }
1051
+ }, ye = (t, a) => {
1052
+ !t || !a || t === a || (T((o) => {
1053
+ let i = !1;
1054
+ const f = { ...o };
1055
+ for (const w of Object.keys(o)) {
1056
+ const E = He(w, t, a);
1057
+ E && E !== w && (f[E] = o[w], delete f[w], i = !0);
1062
1058
  }
1063
- return w ? d : i;
1064
- }), p((i) => {
1065
- let w = !1;
1066
- const d = { ...i };
1067
- for (const x of Object.keys(i)) {
1068
- const X = s(x);
1069
- X && X !== x && (d[X] = i[x], delete d[x], w = !0);
1059
+ return i ? f : o;
1060
+ }), v((o) => {
1061
+ let i = !1;
1062
+ const f = { ...o };
1063
+ for (const w of Object.keys(o)) {
1064
+ const E = He(w, t, a);
1065
+ E && E !== w && (f[E] = o[w], delete f[w], i = !0);
1070
1066
  }
1071
- return w ? d : i;
1072
- }), j((i) => i && (s(i) ?? i)), A((i) => i && (s(i) ?? i));
1073
- }, Ee = () => {
1074
- G(null), W(null), re();
1075
- }, ve = (t, r = !0) => {
1076
- j(t), r && g(t);
1077
- }, ce = Nt(() => [{ name: T, type: "folder" }], [T]), [U, h] = Q(null), [ge, me] = Q(null), ye = M(null), ke = ge;
1067
+ return i ? f : o;
1068
+ }), W((o) => He(o, t, a)), D((o) => He(o, t, a)));
1069
+ }, De = () => {
1070
+ q(null), M(null), J();
1071
+ }, _e = (t, a = !0) => {
1072
+ W(t), a && k(t);
1073
+ }, oe = Ft(() => [{ name: S, type: "folder" }], [S]), [Y, u] = ee(null), [x, z] = ee(null), G = V(null), Q = d ? null : x;
1078
1074
  Wt(
1079
- V,
1075
+ h,
1080
1076
  () => ({
1081
- focusPath: (t, r = {}) => {
1077
+ focusPath: (t, a = {}) => {
1082
1078
  if (!t) return;
1083
1079
  const {
1084
- select: a = !0,
1085
- domFocus: s = !0,
1086
- notify: i = !1
1087
- } = r;
1088
- a && ve(t, i), A(t), s && oe(t);
1080
+ select: o = !0,
1081
+ domFocus: i = !0,
1082
+ notify: f = !1
1083
+ } = a;
1084
+ o && _e(t, f), D(t), i && X(t);
1089
1085
  },
1090
1086
  selectPath: (t) => {
1091
- t && (ve(t), A(t), oe(t));
1087
+ t && (_e(t), D(t), X(t));
1092
1088
  },
1093
1089
  getSelectedPath: () => P,
1094
- expandToPath: async (t) => await z(t),
1095
- refresh: async (t) => await C(t),
1096
- remapPath: ie,
1090
+ expandToPath: async (t) => await Re(t),
1091
+ refresh: async (t) => await re(t),
1092
+ remapPath: ye,
1097
1093
  createFile: async (t) => {
1098
- await Ve(t, "file", "untitled.php");
1094
+ d || await Ue(t, "file", "untitled.php");
1099
1095
  },
1100
1096
  createFolder: async (t) => {
1101
- await Ve(t, "folder", "New Folder");
1097
+ d || await Ue(t, "folder", "New Folder");
1098
+ },
1099
+ importFiles: async (t, a) => {
1100
+ d || await Be(t, a);
1101
+ },
1102
+ importDataTransfer: async (t, a) => {
1103
+ d || await Ge(t, a);
1102
1104
  }
1103
1105
  }),
1104
- [P, C, ie, z]
1106
+ [P, re, ye, Re, d]
1105
1107
  );
1106
- const Ne = M(!1), Ae = M(
1107
- E ?? null
1108
- ), ze = M(E);
1109
- I(() => {
1110
- te.current = !1;
1111
- }, [T]), I(() => {
1112
- E && E !== ze.current ? Ae.current = E : E || (Ae.current = null), ze.current = E;
1113
- }, [E]), I(() => {
1114
- if (!E || Ne.current)
1108
+ const de = V(!1), Ae = V(
1109
+ m ?? null
1110
+ ), xe = V(m);
1111
+ H(() => {
1112
+ $.current = !1;
1113
+ }, [S]), H(() => {
1114
+ m && m !== xe.current ? Ae.current = m : m || (Ae.current = null), xe.current = m;
1115
+ }, [m]), H(() => {
1116
+ if (!m || de.current)
1115
1117
  return;
1116
- Ne.current = !0;
1117
- const t = Pt(E);
1118
- N((a) => {
1119
- const s = { ...a };
1120
- for (const i of t)
1121
- s[i] = !0;
1122
- return s;
1118
+ de.current = !0;
1119
+ const t = Dt(m);
1120
+ T((o) => {
1121
+ const i = { ...o };
1122
+ for (const f of t)
1123
+ i[f] = !0;
1124
+ return i;
1123
1125
  });
1124
- const r = t[t.length - 1] || E;
1125
- A(r), j(r), z(E);
1126
- }, [E, z]), I(() => {
1126
+ const a = t[t.length - 1] || m;
1127
+ D(a), W(a), Re(m);
1128
+ }, [m, Re]), H(() => {
1127
1129
  const t = Ae.current;
1128
- !t || ce.length === 0 || (Ae.current = null, z(t));
1129
- }, [ce, z]), I(() => {
1130
- if (!Z) {
1131
- if (ce.length > 0) {
1132
- const t = be(ce[0]);
1133
- A(t);
1130
+ !t || oe.length === 0 || (Ae.current = null, Re(t));
1131
+ }, [oe, Re]), H(() => {
1132
+ if (!F) {
1133
+ if (oe.length > 0) {
1134
+ const t = le(oe[0]);
1135
+ D(t);
1134
1136
  }
1135
1137
  return;
1136
1138
  }
1137
- ke && ke === Z || oe(Z);
1138
- }, [ce, Z, ke]), I(() => {
1139
- if (ce.length === 0)
1139
+ Q && Q === F || X(F);
1140
+ }, [oe, F, Q]), H(() => {
1141
+ if (oe.length === 0)
1140
1142
  return;
1141
- const t = ce[0];
1142
- if ((t == null ? void 0 : t.type) !== "folder" || te.current)
1143
+ const t = oe[0];
1144
+ if ((t == null ? void 0 : t.type) !== "folder" || $.current)
1143
1145
  return;
1144
- const r = t.name;
1145
- te.current = !0, N(
1146
- (a) => a[r] ? a : { ...a, [r]: !0 }
1147
- ), !ae.current[r] && !de.current[r] && le(r, t);
1148
- }, [ce, le, T]), I(() => () => {
1149
- H.current && clearTimeout(H.current), re();
1150
- }, []), I(() => {
1151
- U && setTimeout(() => {
1146
+ const a = t.name;
1147
+ $.current = !0, T(
1148
+ (o) => o[a] ? o : { ...o, [a]: !0 }
1149
+ ), !A.current[a] && !me.current[a] && ue(a, t);
1150
+ }, [oe, ue, S]), H(() => () => {
1151
+ O.current && clearTimeout(O.current), J();
1152
+ }, []), H(() => {
1153
+ Y && setTimeout(() => {
1152
1154
  const t = document.querySelector(
1153
1155
  '[role="menu"] [role="menuitem"]'
1154
1156
  );
1155
1157
  t && typeof t.focus == "function" && t.focus();
1156
1158
  }, 0);
1157
- }, [U]);
1158
- const [Me, Ue] = Q(""), ht = (t, r) => {
1159
+ }, [Y]);
1160
+ const [he, Me] = ee(""), et = (t, a) => {
1159
1161
  if (t.type === "folder")
1160
- return r;
1161
- const a = Oe(r);
1162
- return a && a || "/";
1163
- }, Fe = (t, r, a) => {
1164
- const s = ht(t, r);
1165
- if (!s)
1166
- return { allowed: !1, state: "invalid", destination: null };
1167
- if (a) {
1168
- if (s === a)
1169
- return { allowed: !1, state: "invalid", destination: null };
1170
- if (Kr(a, s))
1171
- return { allowed: !1, state: "invalid", destination: null };
1172
- }
1173
- return { allowed: !0, state: "valid", destination: s };
1174
- }, wt = (t, r, a) => {
1175
- r.type !== "folder" && r.type !== "file" || (G(a), W(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
1162
+ return a;
1163
+ const o = Le(a);
1164
+ return o && o || "/";
1165
+ }, je = (t, a, o) => {
1166
+ const i = et(t, a);
1167
+ return i ? o && Xt(o, i) ? { allowed: !1, state: "invalid", destination: null } : { allowed: !0, state: "valid", destination: i } : { allowed: !1, state: "invalid", destination: null };
1168
+ }, wt = (t, a, o) => {
1169
+ a.type !== "folder" && a.type !== "file" || (q(o), M(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
1176
1170
  "application/x-wp-playground-path",
1177
- a
1178
- ), t.dataTransfer.setData("text/plain", a)));
1179
- }, vt = () => {
1180
- Ee();
1181
- }, at = (t, r, a) => {
1182
- const s = Fe(r, a, B);
1183
- s.allowed && r.type === "folder" && S(a, r), W((i) => (i == null ? void 0 : i.path) === a && i.state === s.state ? i : { path: a, state: s.state });
1184
- }, ot = (t, r, a) => {
1185
- const s = Fe(r, a, B);
1186
- s.allowed && s.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = B ? "move" : "copy"), r.type === "folder" && S(a, r), W((i) => (i == null ? void 0 : i.path) === a && i.state === s.state ? i : { path: a, state: s.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), ue(a), W((i) => (i == null ? void 0 : i.path) === a && i.state === "invalid" ? i : { path: a, state: "invalid" }));
1187
- }, it = (t, r, a) => {
1188
- ue(a);
1189
- const s = t.relatedTarget;
1190
- s && t.currentTarget.contains(s) || W((i) => (i == null ? void 0 : i.path) === a ? null : i);
1191
- }, gt = async (t, r, a) => {
1192
- const s = B, i = Fe(r, a, s);
1193
- if (!i.allowed || !i.destination) {
1194
- Ee();
1171
+ o
1172
+ ), t.dataTransfer.setData("text/plain", o)));
1173
+ }, gt = () => {
1174
+ De();
1175
+ }, st = (t, a, o) => {
1176
+ const i = je(a, o, te);
1177
+ i.allowed && a.type === "folder" && Fe(o, a), M((f) => (f == null ? void 0 : f.path) === o && f.state === i.state ? f : { path: o, state: i.state });
1178
+ }, ct = (t, a, o) => {
1179
+ const i = je(a, o, te);
1180
+ i.allowed && i.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = te ? "move" : "copy"), a.type === "folder" && Fe(o, a), M((f) => (f == null ? void 0 : f.path) === o && f.state === i.state ? f : { path: o, state: i.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), fe(o), M((f) => (f == null ? void 0 : f.path) === o && f.state === "invalid" ? f : { path: o, state: "invalid" }));
1181
+ }, ut = (t, a, o) => {
1182
+ fe(o);
1183
+ const i = t.relatedTarget;
1184
+ i && t.currentTarget.contains(i) || M((f) => (f == null ? void 0 : f.path) === o ? null : f);
1185
+ }, Et = async (t, a, o) => {
1186
+ const i = te, f = je(a, o, i);
1187
+ if (!f.allowed || !f.destination) {
1188
+ De();
1195
1189
  return;
1196
1190
  }
1197
- t.preventDefault(), t.stopPropagation(), ue(a), W(null);
1191
+ t.preventDefault(), t.stopPropagation(), fe(o), M(null);
1198
1192
  try {
1199
- s ? await _t(s, i.destination) : await De(t, i.destination);
1193
+ i ? await xt(i, f.destination) : await Ge(
1194
+ t.dataTransfer,
1195
+ f.destination
1196
+ );
1200
1197
  } finally {
1201
- Ee();
1198
+ De();
1202
1199
  }
1203
- }, st = (t, r, a) => {
1204
- u && (t.preventDefault(), t.stopPropagation(), me(null), h({
1205
- absPath: a,
1206
- type: r.type,
1200
+ }, ft = (t, a, o) => {
1201
+ c && (t.preventDefault(), t.stopPropagation(), z(null), u({
1202
+ absPath: o,
1203
+ type: a.type,
1207
1204
  x: t.clientX,
1208
1205
  y: t.clientY
1209
1206
  }));
1210
- }, Le = async (t, r) => {
1211
- let a = r, s = 0;
1212
- const i = (d) => {
1213
- const x = d.lastIndexOf(".");
1214
- return x > 0 ? { stem: d.slice(0, x), ext: d.slice(x) } : { stem: d, ext: "" };
1207
+ }, Ve = async (t, a) => {
1208
+ let o = a, i = 0;
1209
+ const f = (E) => {
1210
+ const ne = E.lastIndexOf(".");
1211
+ return ne > 0 ? { stem: E.slice(0, ne), ext: E.slice(ne) } : { stem: E, ext: "" };
1215
1212
  }, w = t === "/" ? "" : t;
1216
- for (; await (l == null ? void 0 : l.fileExists(`${w}/${a}`)) || await (l == null ? void 0 : l.isDir(`${w}/${a}`)); ) {
1217
- s += 1;
1218
- const { stem: d, ext: x } = i(r);
1219
- a = `${d} (${s})${x}`;
1213
+ for (; await (l == null ? void 0 : l.fileExists(`${w}/${o}`)) || await (l == null ? void 0 : l.isDir(`${w}/${o}`)); ) {
1214
+ i += 1;
1215
+ const { stem: E, ext: ne } = f(a);
1216
+ o = `${E} (${i})${ne}`;
1220
1217
  }
1221
- return a;
1222
- }, Ve = async (t, r, a) => {
1218
+ return o;
1219
+ }, Ue = async (t, a, o) => {
1223
1220
  if (!l) return;
1224
- let s = t || P || T;
1221
+ let i = t || P || S;
1225
1222
  try {
1226
- await l.isDir(s) || (s = Oe(s));
1223
+ await l.isDir(i) || (i = Le(i));
1227
1224
  } catch {
1228
- s = Oe(s);
1225
+ i = Le(i);
1229
1226
  }
1230
- const i = s, w = await Le(i, a), d = We(i, w);
1231
- r === "folder" ? await l.mkdir(d) : await l.writeFile(d, ""), ye.current = { type: r, tempPath: d }, me(d), await C(i), setTimeout(() => {
1232
- A(d), oe(d);
1227
+ const f = i, w = await Ve(f, o), E = Oe(f, w);
1228
+ a === "folder" ? await l.mkdir(E) : await l.writeFile(E, ""), G.current = { type: a, tempPath: E }, z(E), await re(f), setTimeout(() => {
1229
+ D(E), X(E);
1233
1230
  }, 0);
1234
- }, Et = async (t) => {
1231
+ }, yt = async (t) => {
1235
1232
  if (!l) return !1;
1236
1233
  try {
1237
1234
  if (await l.fileExists(t))
@@ -1244,258 +1241,259 @@ const qr = Bt(function({
1244
1241
  } catch {
1245
1242
  }
1246
1243
  return !1;
1247
- }, yt = async (t) => {
1244
+ }, _t = async (t) => {
1248
1245
  if (l)
1249
1246
  try {
1250
1247
  await l.mkdir(t);
1251
- } catch (r) {
1248
+ } catch (a) {
1252
1249
  if (!await l.isDir(t).catch(() => !1))
1253
- throw r;
1250
+ throw a;
1254
1251
  }
1255
- }, _t = async (t, r) => {
1252
+ }, xt = async (t, a) => {
1256
1253
  if (!l) return;
1257
- const a = Ot(t), s = We(r, a);
1258
- if (s === t || await Et(s))
1254
+ const o = it(t), i = Oe(a, o);
1255
+ if (i === t || await yt(i))
1259
1256
  return;
1260
- const i = Oe(t);
1257
+ const f = Le(t);
1261
1258
  try {
1262
- await l.mv(t, s), ie(t, s);
1263
- const w = kt(
1259
+ await l.mv(t, i), ye(t, i);
1260
+ const w = He(
1264
1261
  P,
1265
1262
  t,
1266
- s
1263
+ i
1267
1264
  );
1268
- P && (P === t || P.startsWith(`${t}/`)) && g(w), A(
1269
- (d) => kt(d, t, s)
1270
- ), N((d) => ({
1271
- ...d,
1272
- [r]: !0
1265
+ P && (P === t || P.startsWith(`${t}/`)) && k(w), D(
1266
+ (E) => He(E, t, i)
1267
+ ), T((E) => ({
1268
+ ...E,
1269
+ [a]: !0
1273
1270
  })), await Promise.all([
1274
- C(i),
1275
- C(r)
1276
- ]), j(
1277
- (d) => kt(d, t, s)
1278
- ), oe(s);
1271
+ re(f),
1272
+ re(a)
1273
+ ]), W(
1274
+ (E) => He(E, t, i)
1275
+ ), X(i);
1279
1276
  } catch {
1280
1277
  }
1281
1278
  }, bt = (t) => {
1282
- const r = t;
1283
- return r.webkitGetAsEntry ? r.webkitGetAsEntry() : null;
1284
- }, Ct = (t) => new Promise((r, a) => {
1285
- t.file(r, a);
1286
- }), lt = async (t, r) => {
1279
+ const a = t;
1280
+ return a.webkitGetAsEntry ? a.webkitGetAsEntry() : null;
1281
+ }, Ct = (t) => new Promise((a, o) => {
1282
+ t.file(a, o);
1283
+ }), dt = async (t, a) => {
1287
1284
  if (!l) return;
1288
- const a = t.name || "untitled", s = await Le(r, a), i = We(r, s), w = new Uint8Array(await t.arrayBuffer());
1289
- await l.writeFile(i, w);
1290
- }, $e = async (t, r) => {
1291
- const a = await Ct(t);
1292
- await lt(a, r);
1293
- }, Ye = async (t, r) => {
1294
- const a = await Le(
1295
- r,
1285
+ const o = t.name || "untitled", i = await Ve(a, o), f = Oe(a, i), w = new Uint8Array(await t.arrayBuffer());
1286
+ await l.writeFile(f, w);
1287
+ }, ze = async (t, a) => {
1288
+ const o = await Ct(t);
1289
+ await dt(o, a);
1290
+ }, tt = async (t, a) => {
1291
+ const o = await Ve(
1292
+ a,
1296
1293
  t.name || "New Folder"
1297
- ), s = We(r, a);
1298
- await yt(s);
1299
- const i = t.createReader(), w = () => new Promise((d, x) => {
1300
- i.readEntries(
1301
- (X) => d(Array.from(X)),
1302
- x
1294
+ ), i = Oe(a, o);
1295
+ await _t(i);
1296
+ const f = t.createReader(), w = () => new Promise((E, ne) => {
1297
+ f.readEntries(
1298
+ (ve) => E(Array.from(ve)),
1299
+ ne
1303
1300
  );
1304
1301
  });
1305
1302
  for (; ; ) {
1306
- const d = await w();
1307
- if (!d.length)
1303
+ const E = await w();
1304
+ if (!E.length)
1308
1305
  break;
1309
- for (const x of d)
1310
- x.isFile ? await $e(
1311
- x,
1312
- s
1313
- ) : x.isDirectory && await Ye(
1314
- x,
1315
- s
1306
+ for (const ne of E)
1307
+ ne.isFile ? await ze(
1308
+ ne,
1309
+ i
1310
+ ) : ne.isDirectory && await tt(
1311
+ ne,
1312
+ i
1316
1313
  );
1317
1314
  }
1318
- }, De = async (t, r) => {
1319
- var i, w;
1320
- if (!l) return;
1321
- const s = ((i = t.dataTransfer) != null && i.items ? Array.from(t.dataTransfer.items) : []).filter((d) => d.kind === "file").map((d) => bt(d)).filter((d) => !!d);
1322
- if (s.length > 0)
1323
- for (const d of s)
1324
- d.isFile ? await $e(
1325
- d,
1326
- r
1327
- ) : d.isDirectory && await Ye(
1328
- d,
1329
- r
1330
- );
1331
- else {
1332
- const d = (w = t.dataTransfer) != null && w.files ? Array.from(t.dataTransfer.files) : [];
1333
- for (const x of d)
1334
- await lt(x, r);
1315
+ }, Be = (t, a) => Ye([], t, a), Ge = (t, a) => {
1316
+ const i = Array.from(t.items).filter((w) => w.kind === "file").map((w) => bt(w)).filter((w) => !!w), f = Array.from(t.files);
1317
+ return Ye(i, f, a);
1318
+ }, Ye = async (t, a, o) => {
1319
+ if (l) {
1320
+ if (t.length > 0)
1321
+ for (const i of t)
1322
+ i.isFile ? await ze(
1323
+ i,
1324
+ o
1325
+ ) : i.isDirectory && await tt(
1326
+ i,
1327
+ o
1328
+ );
1329
+ else
1330
+ for (const i of a)
1331
+ await dt(i, o);
1332
+ await re(o), T((i) => ({
1333
+ ...i,
1334
+ [o]: !0
1335
+ }));
1335
1336
  }
1336
- await C(r), N((d) => ({
1337
- ...d,
1338
- [r]: !0
1339
- }));
1340
- }, Ze = async (t, r) => {
1337
+ }, mt = async (t, a) => {
1341
1338
  if (!l) return;
1342
- const a = t;
1343
- h(null);
1339
+ const o = t;
1340
+ u(null);
1344
1341
  try {
1345
- r === "folder" ? await l.rmdir(a, { recursive: !0 }) : await l.unlink(a);
1342
+ a === "folder" ? await l.rmdir(o, { recursive: !0 }) : await l.unlink(o);
1346
1343
  } catch {
1347
1344
  } finally {
1348
- me(null);
1349
- const s = Oe(a);
1350
- await C(s), P && (P === a || P.startsWith(`${a}/`)) && g(null);
1345
+ z(null);
1346
+ const i = Le(o);
1347
+ await re(i), P && (P === o || P.startsWith(`${o}/`)) && k(null);
1351
1348
  }
1352
- }, Ge = async (t) => {
1349
+ }, Rt = async (t) => {
1353
1350
  if (l)
1354
1351
  try {
1355
- const a = await (await l.read(t)).arrayBuffer(), s = new Blob([a]), i = URL.createObjectURL(s), w = document.createElement("a");
1356
- w.href = i, w.download = Ot(t) || "download", document.body.appendChild(w), w.click(), document.body.removeChild(w), setTimeout(() => URL.revokeObjectURL(i), 6e4);
1357
- } catch (r) {
1358
- console.error("Failed to download file", r);
1352
+ const o = await (await l.read(t)).arrayBuffer(), i = new Blob([o]), f = URL.createObjectURL(i), w = document.createElement("a");
1353
+ w.href = f, w.download = it(t) || "download", document.body.appendChild(w), w.click(), document.body.removeChild(w), setTimeout(() => URL.revokeObjectURL(f), 6e4);
1354
+ } catch (a) {
1355
+ console.error("Failed to download file", a);
1359
1356
  }
1360
- }, ct = (t) => {
1361
- var r;
1362
- if (!ge)
1357
+ }, pt = (t) => {
1358
+ var a;
1359
+ if (!x)
1363
1360
  if (t.key.length === 1 && t.key.match(/\S/)) {
1364
- const a = Me + t.key.toLowerCase();
1365
- if (Ue(a), H.current && clearTimeout(H.current), H.current = setTimeout(() => {
1366
- Ue("");
1367
- }, 1e3), !_.current)
1361
+ const o = he + t.key.toLowerCase();
1362
+ if (Me(o), O.current && clearTimeout(O.current), O.current = setTimeout(() => {
1363
+ Me("");
1364
+ }, 1e3), !g.current)
1368
1365
  return;
1369
- const s = Array.from(
1370
- _.current.querySelectorAll(".file-node-button")
1371
- ), i = document.activeElement;
1366
+ const i = Array.from(
1367
+ g.current.querySelectorAll(".file-node-button")
1368
+ ), f = document.activeElement;
1372
1369
  let w = 0;
1373
- i && s.includes(i) && (w = s.indexOf(
1374
- i
1370
+ f && i.includes(f) && (w = i.indexOf(
1371
+ f
1375
1372
  ));
1376
- for (let d = 0; d < s.length; d++) {
1377
- const x = (w + d) % s.length, X = s[x];
1378
- if ((r = X.textContent) != null && r.toLowerCase().trim().startsWith(a)) {
1379
- X.focus();
1380
- const Se = X.getAttribute("data-path");
1381
- Se && A(Se);
1373
+ for (let E = 0; E < i.length; E++) {
1374
+ const ne = (w + E) % i.length, ve = i[ne];
1375
+ if ((a = ve.textContent) != null && a.toLowerCase().trim().startsWith(o)) {
1376
+ ve.focus();
1377
+ const e = ve.getAttribute("data-path");
1378
+ e && D(e);
1382
1379
  break;
1383
1380
  }
1384
1381
  }
1385
1382
  } else
1386
- Ue(""), H.current && clearTimeout(H.current);
1387
- }, xt = async (t, r) => {
1388
- const a = ye.current, s = (a == null ? void 0 : a.tempPath) === t, i = Oe(t), w = (r || "").trim();
1389
- if (!y(w)) {
1390
- if (s) {
1383
+ Me(""), O.current && clearTimeout(O.current);
1384
+ }, kt = async (t, a) => {
1385
+ if (d) return;
1386
+ const o = G.current, i = (o == null ? void 0 : o.tempPath) === t, f = Le(t);
1387
+ if (!a || a === "." || a === ".." || it(a) !== a) {
1388
+ if (i) {
1391
1389
  try {
1392
- a.type === "folder" ? await l.rmdir(t, {
1390
+ o.type === "folder" ? await l.rmdir(t, {
1393
1391
  recursive: !0
1394
1392
  }) : await l.unlink(t);
1395
1393
  } catch {
1396
1394
  }
1397
- ye.current = null;
1395
+ G.current = null;
1398
1396
  }
1399
- me(s ? null : t);
1397
+ z(i ? null : t);
1400
1398
  return;
1401
1399
  }
1402
- let d = We(i, w), x = d;
1403
- if (x === t) {
1404
- me(null);
1405
- const e = s && (a == null ? void 0 : a.type) === "file";
1406
- s && (ye.current = null), setTimeout(() => {
1407
- A(x), oe(x), e && k && k(x);
1400
+ let w = Oe(f, a), E = w;
1401
+ if (E === t) {
1402
+ z(null);
1403
+ const s = i && (o == null ? void 0 : o.type) === "file";
1404
+ i && (G.current = null), setTimeout(() => {
1405
+ D(E), X(E), s && N && N(E);
1408
1406
  }, 0);
1409
1407
  return;
1410
1408
  }
1411
- const X = await l.fileExists(x), Se = await l.isDir(x);
1412
- if ((X || Se) && x !== t)
1413
- if (s)
1409
+ const ne = await l.fileExists(E), ve = await l.isDir(E);
1410
+ if ((ne || ve) && E !== t)
1411
+ if (i)
1414
1412
  try {
1415
- const e = await Le(
1416
- i === "/" ? "/" : i,
1417
- w
1413
+ const s = await Ve(
1414
+ f === "/" ? "/" : f,
1415
+ a
1418
1416
  );
1419
- d = We(i, e), x = d;
1417
+ w = Oe(f, s), E = w;
1420
1418
  } catch {
1421
1419
  }
1422
1420
  else {
1423
- me(t);
1421
+ z(t);
1424
1422
  return;
1425
1423
  }
1426
- let Ke = (a == null ? void 0 : a.type) === "folder";
1424
+ let e = (o == null ? void 0 : o.type) === "folder";
1427
1425
  try {
1428
- await l.mv(t, d), a || (Ke = await l.isDir(d)), Ke && ie(t, x), P === t && g(x), await C(i), A(x), oe(x), s && !Ke && k && k(x);
1426
+ await l.mv(t, w), o || (e = await l.isDir(w)), e && ye(t, E), P === t && k(E), await re(f), D(E), X(E), i && !e && N && N(E);
1429
1427
  } catch {
1430
- if (s)
1428
+ if (i)
1431
1429
  try {
1432
- (a == null ? void 0 : a.type) === "folder" ? await l.rmdir(t, {
1430
+ (o == null ? void 0 : o.type) === "folder" ? await l.rmdir(t, {
1433
1431
  recursive: !0
1434
1432
  }) : await l.unlink(t);
1435
1433
  } catch {
1436
1434
  }
1437
1435
  } finally {
1438
- ye.current = null, me(null);
1436
+ G.current = null, z(null);
1439
1437
  }
1440
- }, ut = async (t) => {
1441
- const r = ye.current;
1442
- if (!l || (r == null ? void 0 : r.tempPath) !== t) {
1443
- me((s) => s === t ? null : s);
1438
+ }, ht = async (t) => {
1439
+ const a = G.current;
1440
+ if (!l || (a == null ? void 0 : a.tempPath) !== t) {
1441
+ z((i) => i === t ? null : i);
1444
1442
  return;
1445
1443
  }
1446
1444
  try {
1447
- r.type === "folder" ? await l.rmdir(t, { recursive: !0 }) : await l.unlink(t);
1445
+ a.type === "folder" ? await l.rmdir(t, { recursive: !0 }) : await l.unlink(t);
1448
1446
  } catch {
1449
1447
  }
1450
- ye.current = null, me(null);
1451
- const a = Oe(t);
1452
- await C(a), A(a), oe(a);
1448
+ G.current = null, z(null);
1449
+ const o = Le(t);
1450
+ await re(o), D(o), X(o);
1453
1451
  };
1454
- return /* @__PURE__ */ o.createElement("div", { onKeyDown: ct, ref: _ }, /* @__PURE__ */ o.createElement(Kt, { className: we.filePickerTree }, ce.map((t, r) => /* @__PURE__ */ o.createElement(
1452
+ return /* @__PURE__ */ r.createElement("div", { onKeyDown: pt, ref: g }, /* @__PURE__ */ r.createElement(er, { className: Ee.filePickerTree }, oe.map((t, a) => /* @__PURE__ */ r.createElement(
1455
1453
  zt,
1456
1454
  {
1457
1455
  key: t.name,
1458
1456
  node: t,
1459
1457
  level: 0,
1460
- position: r + 1,
1461
- setSize: ce.length,
1462
- expandedNodePaths: v,
1463
- onToggle: J,
1458
+ position: a + 1,
1459
+ setSize: oe.length,
1460
+ expandedNodePaths: _,
1461
+ onToggle: Pe,
1464
1462
  selectedNode: P,
1465
- focusPath: (a) => A(a),
1466
- focusedNode: Z,
1467
- selectPath: ve,
1468
- generatePath: be,
1469
- getChildren: Re,
1470
- onContextMenu: st,
1471
- renamingPath: ke,
1472
- onRename: xt,
1473
- onRenameCancel: ut,
1474
- dropIndicator: ee,
1475
- onDragStart: wt,
1476
- onDragEnd: vt,
1477
- onDragEnter: at,
1478
- onDragOver: ot,
1479
- onDragLeave: it,
1480
- onDrop: gt,
1481
- rootPath: T,
1482
- onDoubleClickFile: k
1483
- }
1484
- ))), U && /* @__PURE__ */ o.createElement(
1485
- qt,
1463
+ focusPath: (o) => D(o),
1464
+ focusedNode: F,
1465
+ selectPath: _e,
1466
+ generatePath: le,
1467
+ getChildren: Se,
1468
+ onContextMenu: d ? void 0 : ft,
1469
+ renamingPath: Q,
1470
+ onRename: kt,
1471
+ onRenameCancel: ht,
1472
+ dropIndicator: y,
1473
+ onDragStart: d ? void 0 : wt,
1474
+ onDragEnd: d ? void 0 : gt,
1475
+ onDragEnter: d ? void 0 : st,
1476
+ onDragOver: d ? void 0 : ct,
1477
+ onDragLeave: d ? void 0 : ut,
1478
+ onDrop: d ? void 0 : Et,
1479
+ rootPath: S,
1480
+ onDoubleClickFile: N
1481
+ }
1482
+ ))), !d && Y && /* @__PURE__ */ r.createElement(
1483
+ tr,
1486
1484
  {
1487
1485
  placement: "bottom-start",
1488
- onClose: () => h(null),
1486
+ onClose: () => u(null),
1489
1487
  anchor: {
1490
1488
  getBoundingClientRect: () => ({
1491
- x: U.x,
1492
- y: U.y,
1489
+ x: Y.x,
1490
+ y: Y.y,
1493
1491
  width: 0,
1494
1492
  height: 0,
1495
- top: U.y,
1496
- left: U.x,
1497
- right: U.x,
1498
- bottom: U.y,
1493
+ top: Y.y,
1494
+ left: Y.x,
1495
+ right: Y.x,
1496
+ bottom: Y.y,
1499
1497
  toJSON: () => ({})
1500
1498
  }),
1501
1499
  ownerDocument: document
@@ -1504,59 +1502,59 @@ const qr = Bt(function({
1504
1502
  resize: !1,
1505
1503
  focusOnMount: "firstElement"
1506
1504
  },
1507
- /* @__PURE__ */ o.createElement(Jt, { role: "menu" }, U.type === "folder" && /* @__PURE__ */ o.createElement(
1508
- qe,
1505
+ /* @__PURE__ */ r.createElement(rr, { role: "menu" }, Y.type === "folder" && /* @__PURE__ */ r.createElement(
1506
+ rt,
1509
1507
  {
1510
1508
  role: "menuitem",
1511
1509
  onClick: async () => {
1512
- h(null), await Ve(
1513
- U.absPath,
1510
+ u(null), await Ue(
1511
+ Y.absPath,
1514
1512
  "file",
1515
1513
  "untitled.php"
1516
1514
  );
1517
1515
  }
1518
1516
  },
1519
1517
  "Create file"
1520
- ), U.type === "folder" && /* @__PURE__ */ o.createElement(
1521
- qe,
1518
+ ), Y.type === "folder" && /* @__PURE__ */ r.createElement(
1519
+ rt,
1522
1520
  {
1523
1521
  role: "menuitem",
1524
1522
  onClick: async () => {
1525
- h(null), await Ve(
1526
- U.absPath,
1523
+ u(null), await Ue(
1524
+ Y.absPath,
1527
1525
  "folder",
1528
1526
  "New Folder"
1529
1527
  );
1530
1528
  }
1531
1529
  },
1532
1530
  "Create directory"
1533
- ), /* @__PURE__ */ o.createElement(
1534
- qe,
1531
+ ), /* @__PURE__ */ r.createElement(
1532
+ rt,
1535
1533
  {
1536
1534
  role: "menuitem",
1537
1535
  onClick: () => {
1538
- h(null), me(U.absPath);
1536
+ u(null), z(Y.absPath);
1539
1537
  }
1540
1538
  },
1541
1539
  "Rename"
1542
- ), U.type === "file" && /* @__PURE__ */ o.createElement(
1543
- qe,
1540
+ ), Y.type === "file" && /* @__PURE__ */ r.createElement(
1541
+ rt,
1544
1542
  {
1545
1543
  role: "menuitem",
1546
1544
  onClick: async () => {
1547
- h(null), await Ge(
1548
- U.absPath
1545
+ u(null), await Rt(
1546
+ Y.absPath
1549
1547
  );
1550
1548
  }
1551
1549
  },
1552
1550
  "Download"
1553
- ), /* @__PURE__ */ o.createElement(
1554
- qe,
1551
+ ), /* @__PURE__ */ r.createElement(
1552
+ rt,
1555
1553
  {
1556
1554
  role: "menuitem",
1557
- onClick: () => Ze(
1558
- U.absPath,
1559
- U.type
1555
+ onClick: () => mt(
1556
+ Y.absPath,
1557
+ Y.type
1560
1558
  )
1561
1559
  },
1562
1560
  "Delete"
@@ -1564,982 +1562,1299 @@ const qr = Bt(function({
1564
1562
  ));
1565
1563
  }), zt = ({
1566
1564
  node: n,
1567
- level: u,
1568
- position: l,
1569
- setSize: m,
1570
- expandedNodePaths: E,
1571
- onToggle: g,
1565
+ level: c,
1566
+ position: d,
1567
+ setSize: l,
1568
+ expandedNodePaths: R,
1569
+ onToggle: m,
1572
1570
  selectedNode: k,
1573
- focusPath: V,
1574
- focusedNode: T,
1575
- selectPath: y,
1576
- generatePath: v,
1577
- getChildren: N,
1571
+ focusPath: N,
1572
+ focusedNode: h,
1573
+ selectPath: S,
1574
+ generatePath: _,
1575
+ getChildren: T,
1578
1576
  onContextMenu: P,
1579
- renamingPath: j,
1580
- onRename: Z,
1581
- onRenameCancel: A,
1582
- parentPath: D = "",
1583
- dropIndicator: p,
1577
+ renamingPath: W,
1578
+ onRename: F,
1579
+ onRenameCancel: D,
1580
+ parentPath: ce = "",
1581
+ dropIndicator: v,
1584
1582
  onDragStart: b,
1585
- onDragEnd: q,
1586
- onDragEnter: B,
1587
- onDragOver: G,
1588
- onDragLeave: ee,
1589
- onDrop: W,
1590
- rootPath: F,
1591
- onDoubleClickFile: te
1583
+ onDragEnd: K,
1584
+ onDragEnter: te,
1585
+ onDragOver: q,
1586
+ onDragLeave: y,
1587
+ onDrop: M,
1588
+ rootPath: I,
1589
+ onDoubleClickFile: $
1592
1590
  }) => {
1593
- const _ = v(n, D), H = E[_], de = j === _, ae = M(null), [re, ue] = Q(n.name), oe = M(!1), be = (p == null ? void 0 : p.path) === _, Re = be && (p == null ? void 0 : p.state) === "valid", Te = be && (p == null ? void 0 : p.state) === "invalid", Pe = !de && _ !== F, le = M(null), S = {
1594
- onDragEnter: (h) => B == null ? void 0 : B(h, n, _),
1595
- onDragOver: (h) => G == null ? void 0 : G(h, n, _),
1596
- onDragLeave: (h) => ee == null ? void 0 : ee(h, n, _),
1597
- onDrop: (h) => W == null ? void 0 : W(h, n, _)
1598
- }, C = N(n, _) ?? [];
1599
- I(() => {
1600
- var h;
1601
- de ? (ue(n.name), oe.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
1602
- var ge;
1603
- (ge = ae.current) == null || ge.select();
1604
- }) : (h = ae.current) == null || h.select()) : oe.current = !1;
1605
- }, [de, n.name]);
1606
- const J = () => {
1607
- n.type === "folder" && g(_, n, !H);
1608
- }, z = (h) => {
1609
- var ge, me;
1610
- if (h.key === "ArrowLeft")
1611
- H ? J() : (ge = document.querySelector(
1612
- `[data-path="${D}"]`
1613
- )) == null || ge.focus(), h.preventDefault(), h.stopPropagation();
1614
- else if (h.key === "ArrowRight") {
1615
- if (H) {
1616
- if (C != null && C.length) {
1617
- const ye = v(
1618
- C[0],
1619
- _
1591
+ const g = _(n, ce), O = R[g], me = W === g, A = V(null), [J, fe] = ee(n.name), X = V(!1), le = (v == null ? void 0 : v.path) === g, Se = le && (v == null ? void 0 : v.state) === "valid", be = le && (v == null ? void 0 : v.state) === "invalid", Ce = !!b && !me && g !== I, ue = V(null), Fe = {
1592
+ onDragEnter: (u) => te == null ? void 0 : te(u, n, g),
1593
+ onDragOver: (u) => q == null ? void 0 : q(u, n, g),
1594
+ onDragLeave: (u) => y == null ? void 0 : y(u, n, g),
1595
+ onDrop: (u) => M == null ? void 0 : M(u, n, g)
1596
+ }, re = T(n, g) ?? [];
1597
+ H(() => {
1598
+ var u;
1599
+ me ? (fe(n.name), X.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
1600
+ var x;
1601
+ (x = A.current) == null || x.select();
1602
+ }) : (u = A.current) == null || u.select()) : X.current = !1;
1603
+ }, [me, n.name]);
1604
+ const Pe = () => {
1605
+ n.type === "folder" && m(g, n, !O);
1606
+ }, Re = (u) => {
1607
+ var x, z;
1608
+ if (u.key === "ArrowLeft")
1609
+ O ? Pe() : (x = document.querySelector(
1610
+ `[data-path="${CSS.escape(ce)}"]`
1611
+ )) == null || x.focus(), u.preventDefault(), u.stopPropagation();
1612
+ else if (u.key === "ArrowRight") {
1613
+ if (O) {
1614
+ if (re != null && re.length) {
1615
+ const G = _(
1616
+ re[0],
1617
+ g
1620
1618
  );
1621
- (me = document.querySelector(
1622
- `[data-path="${ye}"]`
1623
- )) == null || me.focus();
1619
+ (z = document.querySelector(
1620
+ `[data-path="${CSS.escape(G)}"]`
1621
+ )) == null || z.focus();
1624
1622
  }
1625
1623
  } else
1626
- J();
1627
- h.preventDefault(), h.stopPropagation();
1628
- } else h.key === " " || h.key === "Space" || h.key === "Spacebar" ? (n.type === "folder" && g(_, n, !H), h.preventDefault()) : h.key === "Enter" && (n.type === "folder" ? g(_, n, !H) : (y(_, !1), V(_), te ? te(_) : y(_, !0)), h.preventDefault());
1629
- }, ie = (h) => {
1630
- P == null || P(h, n, _);
1631
- }, Ee = (h) => {
1632
- h.preventDefault(), oe.current = !0, Z == null || Z(_, re.trim());
1633
- }, ve = (h) => {
1634
- if (h.key === "Escape") {
1635
- h.preventDefault(), h.stopPropagation(), oe.current = !0, A == null || A(_);
1624
+ Pe();
1625
+ u.preventDefault(), u.stopPropagation();
1626
+ } else u.key === " " || u.key === "Space" || u.key === "Spacebar" ? (n.type === "folder" && m(g, n, !O), u.preventDefault()) : u.key === "Enter" && (n.type === "folder" ? m(g, n, !O) : (S(g, !1), N(g), $ ? $(g) : S(g, !0)), u.preventDefault());
1627
+ }, ye = (u) => {
1628
+ P == null || P(u, n, g);
1629
+ }, De = (u) => {
1630
+ u.preventDefault(), X.current = !0, F == null || F(g, J);
1631
+ }, _e = (u) => {
1632
+ if (u.key === "Escape") {
1633
+ u.preventDefault(), u.stopPropagation(), X.current = !0, D == null || D(g);
1636
1634
  return;
1637
1635
  }
1638
- (h.key === "ArrowLeft" || h.key === "ArrowRight" || h.key === "ArrowUp" || h.key === "ArrowDown") && h.stopPropagation();
1639
- }, ce = () => {
1640
- oe.current || A == null || A(_), oe.current = !1;
1641
- }, U = () => {
1636
+ (u.key === "ArrowLeft" || u.key === "ArrowRight" || u.key === "ArrowUp" || u.key === "ArrowDown") && u.stopPropagation();
1637
+ }, oe = () => {
1638
+ X.current || D == null || D(g), X.current = !1;
1639
+ }, Y = () => {
1642
1640
  if (n.type === "folder") {
1643
- J(), y(_), V(_);
1641
+ Pe(), S(g), N(g);
1644
1642
  return;
1645
1643
  }
1646
- const h = le.current !== null;
1647
- if (h && le.current && clearTimeout(le.current), le.current = null, h) {
1648
- te ? te(_) : y(_, !0);
1644
+ const u = ue.current !== null;
1645
+ if (u && ue.current && clearTimeout(ue.current), ue.current = null, u) {
1646
+ $ ? $(g) : S(g, !0);
1649
1647
  return;
1650
1648
  }
1651
- y(_, !1), V(_), y(_, !0), le.current = window.setTimeout(() => {
1652
- le.current = null;
1649
+ S(g, !1), N(g), S(g, !0), ue.current = window.setTimeout(() => {
1650
+ ue.current = null;
1653
1651
  }, 300);
1654
1652
  };
1655
- return I(() => () => {
1656
- le.current !== null && typeof window < "u" && clearTimeout(le.current);
1657
- }, []), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1658
- Xt,
1653
+ return H(() => () => {
1654
+ ue.current !== null && typeof window < "u" && clearTimeout(ue.current);
1655
+ }, []), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1656
+ nr,
1659
1657
  {
1660
- level: u,
1661
- positionInSet: l,
1662
- setSize: m
1658
+ level: c,
1659
+ positionInSet: d,
1660
+ setSize: l
1663
1661
  },
1664
- /* @__PURE__ */ o.createElement(Qt, null, () => /* @__PURE__ */ o.createElement(o.Fragment, null, de ? /* @__PURE__ */ o.createElement(
1662
+ /* @__PURE__ */ r.createElement(ar, null, () => /* @__PURE__ */ r.createElement(r.Fragment, null, me ? /* @__PURE__ */ r.createElement(
1665
1663
  "form",
1666
1664
  {
1667
- onSubmit: Ee,
1668
- className: et(
1669
- we.fileNodeButton,
1670
- we.renaming,
1665
+ onSubmit: De,
1666
+ className: Ne(
1667
+ Ee.fileNodeButton,
1668
+ Ee.renaming,
1671
1669
  "file-node-button",
1672
1670
  {
1673
- [we.selected]: k === _,
1674
- [we.focused]: T === _,
1675
- [we.dropTarget]: Re,
1676
- [we.dropTargetInvalid]: Te
1671
+ [Ee.selected]: k === g,
1672
+ [Ee.focused]: h === g,
1673
+ [Ee.dropTarget]: Se,
1674
+ [Ee.dropTargetInvalid]: be
1677
1675
  }
1678
1676
  ),
1679
- "data-path": _,
1680
- onContextMenu: ie,
1681
- ...S
1677
+ "data-path": g,
1678
+ onContextMenu: ye,
1679
+ ...Fe
1682
1680
  },
1683
- /* @__PURE__ */ o.createElement(
1684
- Vt,
1681
+ /* @__PURE__ */ r.createElement(
1682
+ jt,
1685
1683
  {
1686
1684
  node: n,
1687
- isOpen: n.type === "folder" && H,
1688
- level: u,
1685
+ isOpen: n.type === "folder" && O,
1686
+ level: c,
1689
1687
  hideName: !0
1690
1688
  }
1691
1689
  ),
1692
- /* @__PURE__ */ o.createElement(
1690
+ /* @__PURE__ */ r.createElement(
1693
1691
  "input",
1694
1692
  {
1695
- ref: ae,
1696
- className: we.renameInput,
1697
- value: re,
1698
- onChange: (h) => ue(h.target.value),
1699
- onBlur: ce,
1700
- onFocus: () => V(_),
1701
- onKeyDown: ve
1693
+ ref: A,
1694
+ className: Ee.renameInput,
1695
+ value: J,
1696
+ onChange: (u) => fe(u.target.value),
1697
+ onBlur: oe,
1698
+ onFocus: () => N(g),
1699
+ onKeyDown: _e
1702
1700
  }
1703
1701
  )
1704
- ) : /* @__PURE__ */ o.createElement(
1705
- mt,
1702
+ ) : /* @__PURE__ */ r.createElement(
1703
+ Je,
1706
1704
  {
1707
- ...S,
1708
- draggable: Pe,
1709
- onDragStart: (h) => b == null ? void 0 : b(h, n, _),
1710
- onDragEnd: (h) => q == null ? void 0 : q(h, n, _),
1711
- onClick: U,
1712
- onKeyDown: z,
1705
+ ...Fe,
1706
+ draggable: Ce,
1707
+ onDragStart: (u) => b == null ? void 0 : b(u, n, g),
1708
+ onDragEnd: (u) => K == null ? void 0 : K(u, n, g),
1709
+ onClick: Y,
1710
+ onKeyDown: Re,
1713
1711
  onFocus: () => {
1714
- V(_);
1712
+ N(g);
1715
1713
  },
1716
- onContextMenu: ie,
1717
- className: et(
1718
- we.fileNodeButton,
1714
+ onContextMenu: ye,
1715
+ className: Ne(
1716
+ Ee.fileNodeButton,
1719
1717
  "file-node-button",
1720
1718
  {
1721
- [we.selected]: k === _,
1722
- [we.focused]: T === _,
1723
- [we.dropTarget]: Re,
1724
- [we.dropTargetInvalid]: Te
1719
+ [Ee.selected]: k === g,
1720
+ [Ee.focused]: h === g,
1721
+ [Ee.dropTarget]: Se,
1722
+ [Ee.dropTargetInvalid]: be
1725
1723
  }
1726
1724
  ),
1727
- "data-path": _,
1728
- "data-expanded": H ? "true" : "false"
1725
+ "data-path": g,
1726
+ "data-expanded": O ? "true" : "false"
1729
1727
  },
1730
- /* @__PURE__ */ o.createElement(
1731
- Vt,
1728
+ /* @__PURE__ */ r.createElement(
1729
+ jt,
1732
1730
  {
1733
1731
  node: n,
1734
- isOpen: n.type === "folder" && H,
1735
- level: u
1732
+ isOpen: n.type === "folder" && O,
1733
+ level: c
1736
1734
  }
1737
1735
  )
1738
1736
  )))
1739
- ), H && C && C.map((h, ge) => /* @__PURE__ */ o.createElement(
1737
+ ), O && re && re.map((u, x) => /* @__PURE__ */ r.createElement(
1740
1738
  zt,
1741
1739
  {
1742
- key: h.name,
1743
- node: h,
1744
- level: u + 1,
1745
- position: ge + 1,
1746
- setSize: C.length,
1747
- expandedNodePaths: E,
1748
- onToggle: g,
1740
+ key: u.name,
1741
+ node: u,
1742
+ level: c + 1,
1743
+ position: x + 1,
1744
+ setSize: re.length,
1745
+ expandedNodePaths: R,
1746
+ onToggle: m,
1749
1747
  selectedNode: k,
1750
- focusPath: V,
1751
- focusedNode: T,
1752
- selectPath: y,
1753
- generatePath: v,
1754
- getChildren: N,
1748
+ focusPath: N,
1749
+ focusedNode: h,
1750
+ selectPath: S,
1751
+ generatePath: _,
1752
+ getChildren: T,
1755
1753
  onContextMenu: P,
1756
- renamingPath: j,
1757
- onRename: Z,
1758
- onRenameCancel: A,
1759
- parentPath: _,
1760
- dropIndicator: p,
1754
+ renamingPath: W,
1755
+ onRename: F,
1756
+ onRenameCancel: D,
1757
+ parentPath: g,
1758
+ dropIndicator: v,
1761
1759
  onDragStart: b,
1762
- onDragEnd: q,
1763
- onDragEnter: B,
1764
- onDragOver: G,
1765
- onDragLeave: ee,
1766
- onDrop: W,
1767
- rootPath: F,
1768
- onDoubleClickFile: te
1760
+ onDragEnd: K,
1761
+ onDragEnter: te,
1762
+ onDragOver: q,
1763
+ onDragLeave: y,
1764
+ onDrop: M,
1765
+ rootPath: I,
1766
+ onDoubleClickFile: $
1769
1767
  }
1770
1768
  )));
1771
- }, Vt = ({ node: n, level: u, isOpen: l, hideName: m = !1 }) => {
1772
- const E = [];
1773
- for (let g = 0; g < u; g++)
1774
- E.push("&nbsp;&nbsp;&nbsp;&nbsp;");
1775
- return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1769
+ }, jt = ({ node: n, level: c, isOpen: d, hideName: l = !1 }) => {
1770
+ const R = [];
1771
+ for (let m = 0; m < c; m++)
1772
+ R.push("&nbsp;&nbsp;&nbsp;&nbsp;");
1773
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1776
1774
  "span",
1777
1775
  {
1778
1776
  "aria-hidden": "true",
1779
- dangerouslySetInnerHTML: { __html: E.join("") }
1780
- }
1781
- ), n.type === "folder" ? /* @__PURE__ */ o.createElement(jt, { width: 16, icon: l ? jr : Ir }) : /* @__PURE__ */ o.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ o.createElement(jt, { width: 16, icon: n.type === "folder" ? Or : Ar }), !m && /* @__PURE__ */ o.createElement("span", { className: we.fileName }, n.name));
1782
- }, Jr = "_control_kp9d9_1", Xr = "_browse-label_kp9d9_11", Qr = "_path-preview_kp9d9_37", en = "_modal_kp9d9_43", tn = "_modal-footer_kp9d9_48", He = {
1783
- control: Jr,
1784
- browseLabel: Xr,
1785
- pathPreview: Qr,
1786
- modal: en,
1787
- modalFooter: tn
1777
+ dangerouslySetInnerHTML: { __html: R.join("") }
1778
+ }
1779
+ ), n.type === "folder" ? /* @__PURE__ */ r.createElement(Ot, { width: 16, icon: d ? Wr : Hr }) : /* @__PURE__ */ r.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ r.createElement(Ot, { width: 16, icon: n.type === "folder" ? Mr : jr }), !l && /* @__PURE__ */ r.createElement("span", { className: Ee.fileName }, n.name));
1780
+ }, nn = "_control_kp9d9_1", an = "_browse-label_kp9d9_11", on = "_path-preview_kp9d9_37", ln = "_modal_kp9d9_43", sn = "_modal-footer_kp9d9_48", qe = {
1781
+ control: nn,
1782
+ browseLabel: an,
1783
+ pathPreview: on,
1784
+ modal: ln,
1785
+ modalFooter: sn
1788
1786
  };
1789
- function rn({ path: n }) {
1787
+ function cn({ path: n }) {
1790
1788
  if (!n)
1791
- return /* @__PURE__ */ o.createElement("div", { className: He.pathPreview }, /* @__PURE__ */ o.createElement("i", null, "Select a path"));
1792
- const u = n.split("/");
1793
- let l = (u.length > 2 ? "/" : "") + u.pop();
1794
- l.length > 10 && (l = l.substring(l.length - 10));
1795
- const m = n.substring(
1789
+ return /* @__PURE__ */ r.createElement("div", { className: qe.pathPreview }, /* @__PURE__ */ r.createElement("i", null, "Select a path"));
1790
+ const c = n.split("/");
1791
+ let d = (c.length > 2 ? "/" : "") + c.pop();
1792
+ d.length > 10 && (d = d.substring(d.length - 10));
1793
+ const l = n.substring(
1796
1794
  0,
1797
- n.length - l.length
1795
+ n.length - d.length
1798
1796
  );
1799
- return /* @__PURE__ */ o.createElement(
1797
+ return /* @__PURE__ */ r.createElement(
1800
1798
  "div",
1801
1799
  {
1802
- className: He.pathPreview,
1803
- "data-content-start": m,
1804
- "data-content-end": l
1800
+ className: qe.pathPreview,
1801
+ "data-content-start": l,
1802
+ "data-content-end": d
1805
1803
  }
1806
1804
  );
1807
1805
  }
1808
- function ga({
1806
+ function ja({
1809
1807
  value: n = "",
1810
- onChange: u,
1811
- filesystem: l
1808
+ onChange: c,
1809
+ filesystem: d
1812
1810
  }) {
1813
- const [m, E] = Q(!1), g = () => E(!0), k = () => E(!1), [V, T] = Q(
1811
+ const [l, R] = ee(!1), m = () => R(!0), k = () => R(!1), [N, h] = ee(
1814
1812
  n || null
1815
1813
  );
1816
- function y(v) {
1817
- v == null || v.preventDefault(), u(V || ""), k();
1814
+ function S(_) {
1815
+ _ == null || _.preventDefault(), c(N || ""), k();
1818
1816
  }
1819
- return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1820
- mt,
1817
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1818
+ Je,
1821
1819
  {
1822
1820
  variant: "tertiary",
1823
- className: He.control,
1824
- onClick: g
1821
+ className: qe.control,
1822
+ onClick: m
1825
1823
  },
1826
- /* @__PURE__ */ o.createElement("span", { className: He.browseLabel }, "Browse"),
1827
- /* @__PURE__ */ o.createElement(rn, { path: n || "" })
1828
- ), m && /* @__PURE__ */ o.createElement(
1829
- er,
1824
+ /* @__PURE__ */ r.createElement("span", { className: qe.browseLabel }, "Browse"),
1825
+ /* @__PURE__ */ r.createElement(cn, { path: n || "" })
1826
+ ), l && /* @__PURE__ */ r.createElement(
1827
+ or,
1830
1828
  {
1831
1829
  title: "Select a path ",
1832
1830
  onRequestClose: k,
1833
- className: He.modal
1831
+ className: qe.modal
1834
1832
  },
1835
- /* @__PURE__ */ o.createElement("form", { onSubmit: y }, /* @__PURE__ */ o.createElement(
1836
- qr,
1833
+ /* @__PURE__ */ r.createElement("form", { onSubmit: S }, /* @__PURE__ */ r.createElement(
1834
+ rn,
1837
1835
  {
1838
- filesystem: l,
1836
+ filesystem: d,
1839
1837
  initialSelectedPath: n,
1840
- onSelect: T
1838
+ onSelect: h
1841
1839
  }
1842
- ), /* @__PURE__ */ o.createElement("div", { className: He.modalFooter }, /* @__PURE__ */ o.createElement(mt, { type: "submit", variant: "primary" }, "Select Path")))
1840
+ ), /* @__PURE__ */ r.createElement("div", { className: qe.modalFooter }, /* @__PURE__ */ r.createElement(Je, { type: "submit", variant: "primary" }, "Select Path")))
1843
1841
  ));
1844
1842
  }
1845
- const nn = "_container_1h0az_1", an = "_header_1h0az_9", on = "_filename_1h0az_18", sn = "_downloadLink_1h0az_26", ln = "_previewArea_1h0az_38", cn = "_imagePreview_1h0az_51", un = "_videoPreview_1h0az_57", fn = "_audioPreview_1h0az_64", dn = "_unsupportedMessage_1h0az_68", mn = "_actions_1h0az_74", Ce = {
1846
- container: nn,
1847
- header: an,
1848
- filename: on,
1849
- downloadLink: sn,
1850
- previewArea: ln,
1851
- imagePreview: cn,
1852
- videoPreview: un,
1853
- audioPreview: fn,
1854
- unsupportedMessage: dn,
1855
- actions: mn
1856
- }, pn = (n) => {
1843
+ const un = "_container_1h0az_1", fn = "_header_1h0az_9", dn = "_filename_1h0az_18", mn = "_downloadLink_1h0az_26", pn = "_previewArea_1h0az_38", hn = "_imagePreview_1h0az_51", vn = "_videoPreview_1h0az_57", wn = "_audioPreview_1h0az_64", gn = "_unsupportedMessage_1h0az_68", En = "_actions_1h0az_74", Ie = {
1844
+ container: un,
1845
+ header: fn,
1846
+ filename: dn,
1847
+ downloadLink: mn,
1848
+ previewArea: pn,
1849
+ imagePreview: hn,
1850
+ videoPreview: vn,
1851
+ audioPreview: wn,
1852
+ unsupportedMessage: gn,
1853
+ actions: En
1854
+ }, yn = (n) => {
1857
1855
  if (!n)
1858
1856
  return {
1859
1857
  isImage: !1,
1860
1858
  isVideo: !1,
1861
1859
  isAudio: !1
1862
1860
  };
1863
- const u = n.toLowerCase();
1861
+ const c = n.toLowerCase();
1864
1862
  return {
1865
- isImage: u.startsWith("image/"),
1866
- isVideo: u.startsWith("video/"),
1867
- isAudio: u.startsWith("audio/")
1863
+ isImage: c.startsWith("image/"),
1864
+ isVideo: c.startsWith("video/"),
1865
+ isAudio: c.startsWith("audio/")
1868
1866
  };
1869
1867
  };
1870
- function Ea({
1868
+ function Va({
1871
1869
  filename: n,
1872
- mimeType: u,
1873
- dataUrl: l,
1874
- downloadUrl: m,
1875
- showHeader: E = !0
1870
+ mimeType: c,
1871
+ dataUrl: d,
1872
+ downloadUrl: l,
1873
+ showHeader: R = !0
1876
1874
  }) {
1877
- const { isImage: g, isVideo: k, isAudio: V } = pn(u), T = E !== !1, y = !!(m && n), v = () => y ? /* @__PURE__ */ o.createElement(
1875
+ const { isImage: m, isVideo: k, isAudio: N } = yn(c), h = R !== !1, S = !!(l && n), _ = () => S ? /* @__PURE__ */ r.createElement(
1878
1876
  "a",
1879
1877
  {
1880
- className: Ce.downloadLink,
1881
- href: m,
1878
+ className: Ie.downloadLink,
1879
+ href: l,
1882
1880
  download: n
1883
1881
  },
1884
1882
  "Download"
1885
- ) : null, N = () => g ? /* @__PURE__ */ o.createElement(
1883
+ ) : null, T = () => m ? /* @__PURE__ */ r.createElement(
1886
1884
  "img",
1887
1885
  {
1888
- className: Ce.imagePreview,
1889
- src: l,
1886
+ className: Ie.imagePreview,
1887
+ src: d,
1890
1888
  alt: n || "Preview"
1891
1889
  }
1892
- ) : k ? /* @__PURE__ */ o.createElement(
1890
+ ) : k ? /* @__PURE__ */ r.createElement(
1893
1891
  "video",
1894
1892
  {
1895
- className: Ce.videoPreview,
1893
+ className: Ie.videoPreview,
1896
1894
  controls: !0,
1897
1895
  preload: "metadata"
1898
1896
  },
1899
- /* @__PURE__ */ o.createElement("source", { src: l, type: u }),
1897
+ /* @__PURE__ */ r.createElement("source", { src: d, type: c }),
1900
1898
  "Your browser does not support the video tag."
1901
- ) : V ? /* @__PURE__ */ o.createElement("audio", { className: Ce.audioPreview, controls: !0 }, /* @__PURE__ */ o.createElement("source", { src: l, type: u }), "Your browser does not support the audio tag.") : /* @__PURE__ */ o.createElement("div", { className: Ce.unsupportedMessage }, /* @__PURE__ */ o.createElement("p", null, "Preview unavailable for this file type."), y ? /* @__PURE__ */ o.createElement("p", null, v()) : /* @__PURE__ */ o.createElement("p", null, "Download the file to inspect its contents."));
1902
- return /* @__PURE__ */ o.createElement("div", { className: Ce.container }, T && /* @__PURE__ */ o.createElement("div", { className: Ce.header }, /* @__PURE__ */ o.createElement("span", { className: Ce.filename, title: n }, n), v()), /* @__PURE__ */ o.createElement("div", { className: Ce.previewArea }, N()), !T && y && /* @__PURE__ */ o.createElement("div", { className: Ce.actions }, v()));
1899
+ ) : N ? /* @__PURE__ */ r.createElement("audio", { className: Ie.audioPreview, controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: d, type: c }), "Your browser does not support the audio tag.") : /* @__PURE__ */ r.createElement("div", { className: Ie.unsupportedMessage }, /* @__PURE__ */ r.createElement("p", null, "Preview unavailable for this file type."), S ? /* @__PURE__ */ r.createElement("p", null, _()) : /* @__PURE__ */ r.createElement("p", null, "Download the file to inspect its contents."));
1900
+ return /* @__PURE__ */ r.createElement("div", { className: Ie.container }, h && /* @__PURE__ */ r.createElement("div", { className: Ie.header }, /* @__PURE__ */ r.createElement("span", { className: Ie.filename, title: n }, n), _()), /* @__PURE__ */ r.createElement("div", { className: Ie.previewArea }, T()), !h && S && /* @__PURE__ */ r.createElement("div", { className: Ie.actions }, _()));
1903
1901
  }
1904
- const St = /* @__PURE__ */ new Map(), hn = async (n) => {
1905
- var E;
1902
+ const At = /* @__PURE__ */ new Map(), _n = async (n) => {
1903
+ var R;
1906
1904
  if (!n)
1907
- return tt();
1908
- const u = (E = n.split(".").pop()) == null ? void 0 : E.toLowerCase();
1909
- if (!u || u === "php")
1910
- return tt();
1911
- const l = n;
1912
- if (St.has(l))
1913
- return St.get(l);
1914
- let m;
1915
- switch (u) {
1905
+ return lt();
1906
+ const c = (R = n.split(".").pop()) == null ? void 0 : R.toLowerCase();
1907
+ if (!c || c === "php")
1908
+ return lt();
1909
+ const d = n;
1910
+ if (At.has(d))
1911
+ return At.get(d);
1912
+ let l;
1913
+ switch (c) {
1916
1914
  case "css":
1917
- m = await import("@codemirror/lang-css").then(
1918
- (g) => g.css()
1915
+ l = await import("@codemirror/lang-css").then(
1916
+ (m) => m.css()
1919
1917
  );
1920
1918
  break;
1921
1919
  case "js":
1922
1920
  case "jsx":
1923
1921
  case "ts":
1924
1922
  case "tsx":
1925
- m = await import("@codemirror/lang-javascript").then(
1926
- (g) => g.javascript({
1927
- jsx: u === "jsx" || u === "tsx",
1928
- typescript: u === "ts" || u === "tsx"
1923
+ l = await import("@codemirror/lang-javascript").then(
1924
+ (m) => m.javascript({
1925
+ jsx: c === "jsx" || c === "tsx",
1926
+ typescript: c === "ts" || c === "tsx"
1929
1927
  })
1930
1928
  );
1931
1929
  break;
1932
1930
  case "json":
1933
- m = await import("@codemirror/lang-json").then(
1934
- (g) => g.json()
1931
+ l = await import("@codemirror/lang-json").then(
1932
+ (m) => m.json()
1935
1933
  );
1936
1934
  break;
1937
1935
  case "html":
1938
1936
  case "htm":
1939
- m = await import("@codemirror/lang-html").then(
1940
- (g) => g.html()
1937
+ l = await import("@codemirror/lang-html").then(
1938
+ (m) => m.html()
1941
1939
  );
1942
1940
  break;
1943
1941
  case "md":
1944
1942
  case "markdown":
1945
- m = await import("@codemirror/lang-markdown").then(
1946
- (g) => g.markdown()
1943
+ l = await import("@codemirror/lang-markdown").then(
1944
+ (m) => m.markdown()
1947
1945
  );
1948
1946
  break;
1949
1947
  default:
1950
- m = tt();
1948
+ l = lt();
1951
1949
  }
1952
- return St.set(l, m), m;
1950
+ return At.set(d, l), l;
1953
1951
  };
1954
- class wn {
1955
- constructor(u) {
1956
- this.view = u, this.handleClick = this.handleClick.bind(this), this.view.dom.addEventListener("mousedown", this.handleClick);
1952
+ class xn {
1953
+ constructor(c) {
1954
+ this.view = c, this.handleClick = this.handleClick.bind(this), this.view.dom.addEventListener("mousedown", this.handleClick);
1957
1955
  }
1958
- handleClick(u) {
1959
- const l = u.target;
1960
- if ((l.classList.contains("cm-scroller") || l.classList.contains("cm-content")) && this.view.posAtCoords({
1961
- x: u.clientX,
1962
- y: u.clientY
1956
+ handleClick(c) {
1957
+ const d = c.target;
1958
+ if ((d.classList.contains("cm-scroller") || d.classList.contains("cm-content")) && this.view.posAtCoords({
1959
+ x: c.clientX,
1960
+ y: c.clientY
1963
1961
  }) === null) {
1964
- const E = this.view.state.doc.length, g = pt.create([
1965
- pt.range(E, E)
1962
+ const R = this.view.state.doc.length, m = vt.create([
1963
+ vt.range(R, R)
1966
1964
  ]);
1967
1965
  this.view.dispatch({
1968
- selection: g,
1969
- effects: Qe.scrollIntoView(E, {
1966
+ selection: m,
1967
+ effects: ot.scrollIntoView(R, {
1970
1968
  y: "center"
1971
1969
  })
1972
- }), this.view.focus(), u.preventDefault();
1970
+ }), this.view.focus(), c.preventDefault();
1973
1971
  }
1974
1972
  }
1975
1973
  destroy() {
1976
1974
  this.view.dom.removeEventListener("mousedown", this.handleClick);
1977
1975
  }
1978
1976
  }
1979
- const vn = ir.define(
1980
- (n) => new wn(n)
1981
- ), Ut = Bt(
1977
+ const bn = dr.define(
1978
+ (n) => new xn(n)
1979
+ ), Gt = $t(
1982
1980
  function({
1983
- code: u,
1984
- onChange: l,
1985
- currentPath: m,
1986
- className: E,
1987
- onSaveShortcut: g,
1981
+ code: c,
1982
+ onChange: d,
1983
+ currentPath: l,
1984
+ className: R,
1985
+ onSaveShortcut: m,
1988
1986
  readOnly: k = !1,
1989
- additionalExtensions: V
1990
- }, T) {
1991
- const y = M(
1987
+ additionalExtensions: N
1988
+ }, h) {
1989
+ const S = V(
1992
1990
  null
1993
- ), v = M(null), N = M(new Tt()), P = M(new Tt()), j = M(new Tt()), Z = M(u), A = M(l), D = M(!1);
1994
- return Wt(T, () => ({
1991
+ ), _ = V(null), T = V(new Pt()), P = V(new Pt()), W = V(new Pt()), F = V(c), D = V(d), ce = V(!1);
1992
+ return Wt(h, () => ({
1995
1993
  focus: () => {
1996
- var p;
1997
- (p = v.current) == null || p.focus();
1994
+ var v;
1995
+ (v = _.current) == null || v.focus();
1998
1996
  },
1999
1997
  blur: () => {
2000
- const p = v.current;
2001
- p && p.contentDOM.blur();
1998
+ const v = _.current;
1999
+ v && v.contentDOM.blur();
2002
2000
  },
2003
- getCursorPosition: () => v.current ? v.current.state.selection.main.anchor : null,
2004
- setCursorPosition: (p) => {
2005
- if (!v.current)
2001
+ getCursorPosition: () => _.current ? _.current.state.selection.main.anchor : null,
2002
+ setCursorPosition: (v) => {
2003
+ if (!_.current)
2006
2004
  return;
2007
2005
  const b = Math.min(
2008
- p,
2009
- v.current.state.doc.length
2010
- ), q = pt.create([
2011
- pt.range(b, b)
2006
+ v,
2007
+ _.current.state.doc.length
2008
+ ), K = vt.create([
2009
+ vt.range(b, b)
2012
2010
  ]);
2013
- v.current.dispatch({
2014
- selection: q,
2011
+ _.current.dispatch({
2012
+ selection: K,
2015
2013
  scrollIntoView: !0
2016
2014
  });
2017
2015
  }
2018
- })), I(() => {
2019
- Z.current = u;
2020
- }, [u]), I(() => {
2021
- A.current = l;
2022
- }, [l]), I(() => {
2023
- if (v.current)
2016
+ })), H(() => {
2017
+ F.current = c;
2018
+ }, [c]), H(() => {
2019
+ D.current = d;
2020
+ }, [d]), H(() => {
2021
+ if (_.current)
2024
2022
  return;
2025
- const p = y.current;
2026
- if (!p)
2023
+ const v = S.current;
2024
+ if (!v)
2027
2025
  return;
2028
- const b = or.create({
2029
- doc: u,
2026
+ const b = fr.create({
2027
+ doc: c,
2030
2028
  extensions: [
2031
- j.current.of(V ?? []),
2032
- sr(),
2033
- lr(),
2034
- cr(),
2035
- xr(),
2036
- ur(),
2037
- fr(),
2038
- dr(),
2039
- vn,
2040
- N.current.of(tt()),
2029
+ W.current.of(N ?? []),
2030
+ mr(),
2031
+ pr(),
2032
+ hr(),
2033
+ Dr(),
2034
+ vr(),
2035
+ wr(),
2036
+ gr(),
2037
+ bn,
2038
+ T.current.of(lt()),
2041
2039
  P.current.of(
2042
- Qe.editable.of(!k)
2040
+ ot.editable.of(!k)
2043
2041
  ),
2044
- Rr(Tr),
2045
- Pr(),
2042
+ Ar(Nr),
2043
+ Fr(),
2044
+ Ir(),
2046
2045
  kr(),
2047
2046
  yr(),
2048
- pr(),
2049
- gr(),
2050
- _r(),
2051
- Qe.updateListener.of((B) => {
2052
- if (!B.docChanged)
2047
+ Cr(),
2048
+ Tr(),
2049
+ ot.updateListener.of((te) => {
2050
+ if (!te.docChanged)
2053
2051
  return;
2054
- const G = B.state.doc.toString();
2055
- G !== Z.current && (Z.current = G, A.current(G));
2052
+ const q = te.state.doc.toString();
2053
+ q !== F.current && (F.current = q, D.current(q));
2056
2054
  }),
2057
- mr.of([
2055
+ Er.of([
2058
2056
  {
2059
2057
  key: "Mod-s",
2060
2058
  preventDefault: !0,
2061
- run: () => (g == null || g(), !0)
2059
+ run: () => (m == null || m(), !0)
2062
2060
  },
2063
- ...br,
2064
- ...Cr,
2065
2061
  ...Sr,
2066
- ...Er,
2067
- ...hr,
2068
- ...wr,
2069
- vr
2062
+ ...Pr,
2063
+ ...Lr,
2064
+ ...Rr,
2065
+ ..._r,
2066
+ ...xr,
2067
+ br
2070
2068
  ])
2071
2069
  ]
2072
- }), q = new Qe({ state: b, parent: p });
2073
- return v.current = q, () => {
2074
- q.destroy(), v.current = null;
2070
+ }), K = new ot({ state: b, parent: v });
2071
+ return _.current = K, () => {
2072
+ K.destroy(), _.current = null;
2075
2073
  };
2076
- }, []), I(() => {
2077
- const p = v.current;
2078
- p && p.dispatch({
2079
- effects: j.current.reconfigure(
2080
- V ?? []
2074
+ }, []), H(() => {
2075
+ const v = _.current;
2076
+ v && v.dispatch({
2077
+ effects: W.current.reconfigure(
2078
+ N ?? []
2081
2079
  )
2082
2080
  });
2083
- }, [V]), I(() => {
2084
- const p = v.current;
2085
- if (!p)
2081
+ }, [N]), H(() => {
2082
+ const v = _.current;
2083
+ if (!v)
2086
2084
  return;
2087
- const b = p.state.doc.toString();
2088
- u !== b && p.dispatch({
2089
- changes: { from: 0, to: p.state.doc.length, insert: u }
2085
+ const b = v.state.doc.toString();
2086
+ c !== b && v.dispatch({
2087
+ changes: { from: 0, to: v.state.doc.length, insert: c }
2090
2088
  });
2091
- }, [u]), I(() => {
2092
- var G;
2093
- const p = v.current;
2094
- if (!p)
2089
+ }, [c]), H(() => {
2090
+ var q;
2091
+ const v = _.current;
2092
+ if (!v)
2095
2093
  return;
2096
- const b = (G = m == null ? void 0 : m.split(".").pop()) == null ? void 0 : G.toLowerCase();
2097
- (!b || b === "php") && p.dispatch({
2098
- effects: N.current.reconfigure(tt())
2094
+ const b = (q = l == null ? void 0 : l.split(".").pop()) == null ? void 0 : q.toLowerCase();
2095
+ (!b || b === "php") && v.dispatch({
2096
+ effects: T.current.reconfigure(lt())
2099
2097
  });
2100
- let B = !1;
2101
- return hn(m).then((ee) => {
2102
- B || !v.current || v.current.dispatch({
2103
- effects: N.current.reconfigure(ee)
2098
+ let te = !1;
2099
+ return _n(l).then((y) => {
2100
+ te || !_.current || _.current.dispatch({
2101
+ effects: T.current.reconfigure(y)
2104
2102
  });
2105
2103
  }), () => {
2106
- B = !0;
2104
+ te = !0;
2107
2105
  };
2108
- }, [m]), I(() => {
2109
- const p = v.current;
2110
- p && (p.hasFocus && (D.current = !0), p.dispatch({
2106
+ }, [l]), H(() => {
2107
+ const v = _.current;
2108
+ v && (v.hasFocus && (ce.current = !0), v.dispatch({
2111
2109
  effects: P.current.reconfigure(
2112
- Qe.editable.of(!k)
2110
+ ot.editable.of(!k)
2113
2111
  )
2114
2112
  }));
2115
- }, [k]), Gt(() => {
2116
- const p = v.current;
2117
- p && D.current && !p.hasFocus && (p.focus(), D.current = !1);
2118
- }, [m, k]), /* @__PURE__ */ o.createElement("div", { ref: y, className: E });
2113
+ }, [k]), qt(() => {
2114
+ const v = _.current;
2115
+ v && ce.current && !v.hasFocus && (v.focus(), ce.current = !1);
2116
+ }, [l, k]), /* @__PURE__ */ r.createElement("div", { ref: S, className: R });
2119
2117
  }
2120
2118
  );
2121
- Ut.displayName = "CodeEditor";
2122
- const gn = "_fileExplorerContainer_1m4t6_1", En = "_fileExplorerHeader_1m4t6_14", yn = "_fileExplorerTitle_1m4t6_23", _n = "_fileExplorerActions_1m4t6_31", bn = "_fileExplorerButton_1m4t6_37", Cn = "_fileExplorerTree_1m4t6_84", Ie = {
2123
- fileExplorerContainer: gn,
2124
- fileExplorerHeader: En,
2125
- fileExplorerTitle: yn,
2126
- fileExplorerActions: _n,
2127
- fileExplorerButton: bn,
2128
- fileExplorerTree: Cn
2129
- }, xn = 1024 * 1024, Rn = (n) => {
2130
- const u = n.byteLength;
2131
- for (let l = 0; l < Math.min(u, 4096); l++)
2132
- if (n[l] === 0)
2119
+ Gt.displayName = "CodeEditor";
2120
+ const Cn = "_fileExplorerContainer_8eol9_1", Rn = "_dropActive_8eol9_9", kn = "_fileExplorerHeader_8eol9_14", Tn = "_fileExplorerTitle_8eol9_23", Sn = "_fileExplorerActions_8eol9_31", Pn = "_fileExplorerButton_8eol9_37", Dn = "_fileExplorerIconButton_8eol9_67", An = "_fileExplorerTree_8eol9_79", Nn = "_dockPresentation_8eol9_88", Fn = "_fileExplorerUploadButton_8eol9_148", ge = {
2121
+ fileExplorerContainer: Cn,
2122
+ dropActive: Rn,
2123
+ fileExplorerHeader: kn,
2124
+ fileExplorerTitle: Tn,
2125
+ fileExplorerActions: Sn,
2126
+ fileExplorerButton: Pn,
2127
+ fileExplorerIconButton: Dn,
2128
+ fileExplorerTree: An,
2129
+ dockPresentation: Nn,
2130
+ fileExplorerUploadButton: Fn
2131
+ }, Yt = 1024 * 1024, In = (n) => {
2132
+ const c = n.byteLength;
2133
+ for (let d = 0; d < Math.min(c, 4096); d++)
2134
+ if (n[d] === 0)
2133
2135
  return !0;
2134
2136
  try {
2135
2137
  return new TextDecoder("utf-8", { fatal: !0 }).decode(n), !1;
2136
2138
  } catch {
2137
2139
  return !0;
2138
2140
  }
2139
- }, $t = (n, u) => {
2140
- const l = new Blob([n]), m = URL.createObjectURL(l);
2141
- return setTimeout(() => URL.revokeObjectURL(m), 6e4), { url: m, filename: u };
2142
- }, Tn = (n) => {
2143
- const u = n.split(".").pop();
2144
- return Lt[u] || Lt._default;
2145
- }, Pn = (n) => n.startsWith("image/") || n.startsWith("video/") || n.startsWith("audio/");
2146
- function kn({
2141
+ }, Vt = (n, c) => {
2142
+ const d = new Blob([n]), l = URL.createObjectURL(d);
2143
+ return setTimeout(() => URL.revokeObjectURL(l), 6e4), { url: l, filename: c };
2144
+ };
2145
+ async function Ln(n, c = Yt) {
2146
+ const d = On(n);
2147
+ if (d !== void 0 && d > c)
2148
+ return { type: "too-large" };
2149
+ if (typeof n.stream == "function")
2150
+ return Bn(n, c);
2151
+ const l = new Uint8Array(await n.arrayBuffer());
2152
+ return l.byteLength > c ? { type: "too-large" } : { type: "inline", data: l };
2153
+ }
2154
+ function On(n) {
2155
+ if (typeof n.filesize == "number")
2156
+ return n.filesize;
2157
+ if (typeof n.size == "number")
2158
+ return n.size;
2159
+ }
2160
+ async function Bn(n, c) {
2161
+ const d = n.stream().getReader(), l = [];
2162
+ let R = 0;
2163
+ try {
2164
+ for (; ; ) {
2165
+ const { done: m, value: k } = await d.read();
2166
+ if (m)
2167
+ return {
2168
+ type: "inline",
2169
+ data: Qt(l)
2170
+ };
2171
+ if (k) {
2172
+ if (R += k.byteLength, R > c)
2173
+ return await d.cancel().catch(() => {
2174
+ }), { type: "too-large" };
2175
+ l.push(k);
2176
+ }
2177
+ }
2178
+ } finally {
2179
+ d.releaseLock();
2180
+ }
2181
+ }
2182
+ const Mn = (n) => {
2183
+ const c = n.split(".").pop();
2184
+ return Lt[c] || Lt._default;
2185
+ }, jn = (n) => n.startsWith("image/") || n.startsWith("video/") || n.startsWith("audio/");
2186
+ function Vn({
2147
2187
  filesystem: n,
2148
- currentPath: u,
2149
- selectedDirPath: l,
2150
- setSelectedDirPath: m,
2151
- onFileOpened: E,
2152
- onSelectionCleared: g,
2188
+ currentPath: c,
2189
+ selectedDirPath: d,
2190
+ setSelectedDirPath: l,
2191
+ onFileOpened: R,
2192
+ onSelectionCleared: m,
2153
2193
  onShowMessage: k,
2154
- documentRoot: V
2194
+ documentRoot: N,
2195
+ readOnly: h = !1,
2196
+ title: S = "Files",
2197
+ showBinaryPreviewHeader: _ = !0,
2198
+ dockPresentation: T = !1,
2199
+ useWordPressTooltips: P = !1
2155
2200
  }) {
2156
- const T = M(null), y = Nt(() => At(
2157
- u ? Oe(At(u)) : l ?? V
2158
- ), [u, V]), [v, N] = Q(
2159
- null
2160
- ), P = async (j, Z) => {
2201
+ const W = V(null), F = V(null), D = Ft(() => c ? Le(c) : d ?? N, [c, N]), [ce, v] = ee(!1);
2202
+ H(() => {
2203
+ !c || !W.current || (l(Le(c)), W.current.focusPath(c, {
2204
+ select: !0,
2205
+ domFocus: !1,
2206
+ notify: !1
2207
+ }), W.current.expandToPath(c));
2208
+ }, [c, l]);
2209
+ const b = async (y, M) => {
2161
2210
  try {
2162
- const A = await n.read(j), D = new Uint8Array(await A.arrayBuffer()), p = D.byteLength, b = j.split("/").pop() || "download";
2163
- if (p > xn) {
2164
- const { url: B, filename: G } = $t(
2165
- D,
2166
- b
2167
- );
2211
+ const I = await n.read(y), $ = await Ln(I);
2212
+ if ($.type === "too-large") {
2213
+ const A = Yt / 1024 / 1024;
2214
+ if (!T) {
2215
+ await k(
2216
+ y,
2217
+ /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${A}MB).`), /* @__PURE__ */ r.createElement("p", null, "Open or download it outside the in-browser editor."))
2218
+ );
2219
+ return;
2220
+ }
2221
+ const J = it(y) || "download";
2168
2222
  await k(
2169
- j,
2170
- /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("p", null, "File too large to open (>1MB)."), /* @__PURE__ */ o.createElement("p", null, /* @__PURE__ */ o.createElement("a", { href: B, download: G }, "Download ", G)))
2223
+ y,
2224
+ /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${A}MB).`), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement(
2225
+ Je,
2226
+ {
2227
+ type: "button",
2228
+ variant: "link",
2229
+ onClick: () => {
2230
+ K(y, J);
2231
+ }
2232
+ },
2233
+ "Download ",
2234
+ J
2235
+ )))
2171
2236
  );
2172
2237
  return;
2173
2238
  }
2174
- if (Rn(D)) {
2175
- const B = Tn(b), { url: G, filename: ee } = $t(
2176
- D,
2177
- b
2239
+ const g = $.data, O = it(y) || "download";
2240
+ if (In(g)) {
2241
+ const A = Mn(O), { url: J, filename: fe } = Vt(
2242
+ g,
2243
+ O
2178
2244
  );
2179
- if (Pn(B)) {
2180
- const W = new Blob([D], { type: B }), F = URL.createObjectURL(W);
2245
+ if (jn(A)) {
2246
+ const X = new Blob([g], { type: A }), le = URL.createObjectURL(X);
2181
2247
  await k(
2182
- j,
2183
- /* @__PURE__ */ o.createElement(
2184
- Dr,
2248
+ y,
2249
+ /* @__PURE__ */ r.createElement(
2250
+ Br,
2185
2251
  {
2186
- filename: ee,
2187
- mimeType: B,
2188
- dataUrl: F,
2189
- downloadUrl: G
2252
+ filename: fe,
2253
+ mimeType: A,
2254
+ dataUrl: le,
2255
+ downloadUrl: J,
2256
+ showHeader: _
2190
2257
  }
2191
2258
  )
2192
2259
  );
2193
2260
  return;
2194
2261
  }
2195
2262
  await k(
2196
- j,
2197
- /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("p", null, "Binary file. Cannot be edited."), /* @__PURE__ */ o.createElement("p", null, /* @__PURE__ */ o.createElement("a", { href: G, download: ee }, "Download ", ee)))
2263
+ y,
2264
+ /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, "Binary file. Cannot be edited."), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement("a", { href: J, download: fe }, "Download ", fe)))
2198
2265
  );
2199
2266
  return;
2200
2267
  }
2201
- const q = new TextDecoder("utf-8").decode(D);
2202
- await E(j, q, Z);
2203
- } catch (A) {
2204
- dt.error("Could not open file", A), await k(null, "Could not open file.");
2268
+ const me = new TextDecoder("utf-8").decode(g);
2269
+ await R(y, me, M);
2270
+ } catch (I) {
2271
+ Ke.error("Could not open file", I), await k(null, "Could not open file.");
2205
2272
  }
2273
+ }, K = async (y, M) => {
2274
+ try {
2275
+ const I = await n.read(y), $ = new Uint8Array(await I.arrayBuffer()), { url: g } = Vt($, M), O = document.createElement("a");
2276
+ O.href = g, O.download = M, document.body.appendChild(O), O.click(), document.body.removeChild(O);
2277
+ } catch (I) {
2278
+ Ke.error("Could not download file", I), await k(y, "Could not download file.");
2279
+ }
2280
+ }, te = (y) => {
2281
+ var I;
2282
+ const M = Array.from(y.target.files ?? []);
2283
+ y.target.value = "", M.length !== 0 && ((I = W.current) == null || I.importFiles(M, d ?? N).catch(($) => Ke.error("Failed to import files", $)));
2284
+ }, q = (y) => {
2285
+ var M;
2286
+ y.dataTransfer.types.includes(
2287
+ "application/x-wp-playground-path"
2288
+ ) || (y.preventDefault(), !h && ((M = W.current) == null || M.importDataTransfer(
2289
+ y.dataTransfer,
2290
+ d ?? N
2291
+ ).catch(
2292
+ (I) => Ke.error("Failed to import dropped files", I)
2293
+ )));
2206
2294
  };
2207
- return /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerContainer }, /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerHeader }, /* @__PURE__ */ o.createElement("span", { className: Ie.fileExplorerTitle }, "Files"), /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerActions }, /* @__PURE__ */ o.createElement(
2208
- "button",
2295
+ return /* @__PURE__ */ r.createElement(
2296
+ "div",
2209
2297
  {
2210
- className: Ie.fileExplorerButton,
2211
- type: "button",
2212
- onClick: () => {
2213
- T.current && T.current.createFile(
2214
- v ?? void 0
2215
- );
2298
+ className: Ne(ge.fileExplorerContainer, {
2299
+ [ge.dropActive]: ce,
2300
+ [ge.dockPresentation]: T
2301
+ }),
2302
+ onDragEnter: (y) => {
2303
+ y.dataTransfer.types.includes(
2304
+ "application/x-wp-playground-path"
2305
+ ) || (y.preventDefault(), h || v(!0));
2216
2306
  },
2217
- title: "Create new file"
2218
- },
2219
- /* @__PURE__ */ o.createElement(Ft, { icon: Vr, size: 16 }),
2220
- "New File"
2221
- ), /* @__PURE__ */ o.createElement(
2222
- "button",
2223
- {
2224
- className: Ie.fileExplorerButton,
2225
- type: "button",
2226
- onClick: () => {
2227
- T.current && T.current.createFolder(
2228
- v ?? void 0
2229
- );
2307
+ onDragOver: (y) => {
2308
+ y.dataTransfer.types.includes(
2309
+ "application/x-wp-playground-path"
2310
+ ) || (y.preventDefault(), y.dataTransfer.dropEffect = h ? "none" : "copy");
2311
+ },
2312
+ onDragLeave: (y) => {
2313
+ const M = y.relatedTarget;
2314
+ (!M || !y.currentTarget.contains(M)) && v(!1);
2230
2315
  },
2231
- title: "Create new folder"
2316
+ onDropCapture: () => v(!1),
2317
+ onDrop: q
2232
2318
  },
2233
- /* @__PURE__ */ o.createElement(Ft, { icon: Mr, size: 16 }),
2234
- "New Folder"
2235
- ))), /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerTree }, /* @__PURE__ */ o.createElement(
2236
- Nr,
2237
- {
2238
- ref: T,
2239
- filesystem: n,
2240
- root: V,
2241
- initialSelectedPath: y,
2242
- onSelect: async (j) => {
2243
- if (N(j), !j) {
2244
- await g();
2245
- return;
2246
- }
2247
- try {
2248
- if (await n.isDir(j)) {
2249
- m(j);
2319
+ /* @__PURE__ */ r.createElement("div", { className: ge.fileExplorerHeader }, /* @__PURE__ */ r.createElement("span", { className: ge.fileExplorerTitle }, S), h ? null : /* @__PURE__ */ r.createElement("div", { className: ge.fileExplorerActions }, /* @__PURE__ */ r.createElement(
2320
+ Nt,
2321
+ {
2322
+ label: "Create new file",
2323
+ useWordPressTooltip: P
2324
+ },
2325
+ /* @__PURE__ */ r.createElement(
2326
+ "button",
2327
+ {
2328
+ className: Ne(
2329
+ ge.fileExplorerButton,
2330
+ ge.fileExplorerIconButton
2331
+ ),
2332
+ type: "button",
2333
+ onClick: () => {
2334
+ W.current && W.current.createFile();
2335
+ },
2336
+ "aria-label": "Create new file",
2337
+ title: P ? void 0 : "Create new file"
2338
+ },
2339
+ T ? /* @__PURE__ */ r.createElement($n, null) : /* @__PURE__ */ r.createElement(St, { icon: zr, size: 20 })
2340
+ )
2341
+ ), /* @__PURE__ */ r.createElement(
2342
+ Nt,
2343
+ {
2344
+ label: "Create new folder",
2345
+ useWordPressTooltip: P
2346
+ },
2347
+ /* @__PURE__ */ r.createElement(
2348
+ "button",
2349
+ {
2350
+ className: Ne(
2351
+ ge.fileExplorerButton,
2352
+ ge.fileExplorerIconButton
2353
+ ),
2354
+ type: "button",
2355
+ onClick: () => {
2356
+ W.current && W.current.createFolder();
2357
+ },
2358
+ "aria-label": "Create new folder",
2359
+ title: P ? void 0 : "Create new folder"
2360
+ },
2361
+ T ? /* @__PURE__ */ r.createElement(Wn, null) : /* @__PURE__ */ r.createElement(St, { icon: Ur, size: 20 })
2362
+ )
2363
+ ), /* @__PURE__ */ r.createElement(
2364
+ Nt,
2365
+ {
2366
+ label: "Upload files",
2367
+ useWordPressTooltip: P
2368
+ },
2369
+ /* @__PURE__ */ r.createElement(
2370
+ "button",
2371
+ {
2372
+ className: Ne(
2373
+ ge.fileExplorerButton,
2374
+ ge.fileExplorerIconButton,
2375
+ ge.fileExplorerUploadButton
2376
+ ),
2377
+ type: "button",
2378
+ onClick: () => {
2379
+ var y;
2380
+ return (y = F.current) == null ? void 0 : y.click();
2381
+ },
2382
+ "aria-label": "Upload files",
2383
+ title: P ? void 0 : "Upload files"
2384
+ },
2385
+ /* @__PURE__ */ r.createElement(
2386
+ St,
2387
+ {
2388
+ icon: Gr,
2389
+ size: T ? 16 : 20
2390
+ }
2391
+ )
2392
+ )
2393
+ ), /* @__PURE__ */ r.createElement(
2394
+ "input",
2395
+ {
2396
+ ref: F,
2397
+ type: "file",
2398
+ multiple: !0,
2399
+ style: { display: "none" },
2400
+ onChange: te
2401
+ }
2402
+ ))),
2403
+ /* @__PURE__ */ r.createElement("div", { className: ge.fileExplorerTree }, /* @__PURE__ */ r.createElement(
2404
+ Or,
2405
+ {
2406
+ ref: W,
2407
+ readOnly: h,
2408
+ filesystem: n,
2409
+ root: N,
2410
+ initialSelectedPath: D,
2411
+ onSelect: async (y) => {
2412
+ if (!y) {
2413
+ l(N), await m();
2250
2414
  return;
2251
2415
  }
2252
- } catch {
2416
+ try {
2417
+ if (await n.isDir(y)) {
2418
+ l(y);
2419
+ return;
2420
+ }
2421
+ } catch {
2422
+ }
2423
+ l(Le(y)), await b(y, !1);
2424
+ },
2425
+ onDoubleClickFile: async (y) => {
2426
+ await b(y, !0);
2253
2427
  }
2254
- await P(j, !1);
2255
- },
2256
- onDoubleClickFile: async (j) => {
2257
- await P(j, !0);
2258
2428
  }
2259
- }
2260
- )));
2429
+ ))
2430
+ );
2261
2431
  }
2262
- const Sn = "_container_15o5h_1", Nn = "_content_15o5h_9", Dn = "_sidebarWrapper_15o5h_17", On = "_editorWrapper_15o5h_28", An = "_editorHeader_15o5h_37", Fn = "_editorPath_15o5h_49", Ln = "_editorPathPlaceholder_15o5h_60", jn = "_saveStatus_15o5h_71", In = "_saveStatusSaving_15o5h_78", Mn = "_saveStatusPending_15o5h_79", Vn = "_saveStatusError_15o5h_83", $n = "_editor_15o5h_28", Bn = "_placeholder_15o5h_105", Wn = "_messageArea_15o5h_116", Hn = "_mobileToggle_15o5h_152", zn = "_mobileOverlay_15o5h_156", Un = "_sidebarOpen_15o5h_171", fe = {
2263
- container: Sn,
2264
- content: Nn,
2265
- sidebarWrapper: Dn,
2266
- editorWrapper: On,
2267
- editorHeader: An,
2268
- editorPath: Fn,
2269
- editorPathPlaceholder: Ln,
2270
- saveStatus: jn,
2271
- saveStatusSaving: In,
2272
- saveStatusPending: Mn,
2273
- saveStatusError: Vn,
2274
- editor: $n,
2275
- placeholder: Bn,
2276
- messageArea: Wn,
2277
- mobileToggle: Hn,
2278
- mobileOverlay: zn,
2279
- sidebarOpen: Un
2280
- }, Yn = 1500, K = {
2432
+ function Nt({
2433
+ label: n,
2434
+ useWordPressTooltip: c,
2435
+ children: d
2436
+ }) {
2437
+ return c ? /* @__PURE__ */ r.createElement(Ht, { text: n, delay: 0, placement: "top" }, d) : d;
2438
+ }
2439
+ const $n = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32", width: "24", height: "24", "aria-hidden": "true" }, /* @__PURE__ */ r.createElement(
2440
+ "path",
2441
+ {
2442
+ d: "M11 6h7l5 5v12a2 2 0 0 1-2 2H11a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",
2443
+ fill: "none",
2444
+ stroke: "currentColor",
2445
+ strokeWidth: "2",
2446
+ strokeLinejoin: "round"
2447
+ }
2448
+ ), /* @__PURE__ */ r.createElement(
2449
+ "path",
2450
+ {
2451
+ d: "M18 6v5h5",
2452
+ fill: "none",
2453
+ stroke: "currentColor",
2454
+ strokeWidth: "2",
2455
+ strokeLinejoin: "round"
2456
+ }
2457
+ ), /* @__PURE__ */ r.createElement("g", { transform: "translate(19 19)" }, /* @__PURE__ */ r.createElement("circle", { cx: "5", cy: "5", r: "8", fill: "var(--paper-2, #fff)" }), /* @__PURE__ */ r.createElement(
2458
+ "path",
2459
+ {
2460
+ d: "M5 1.5v7M1.5 5h7",
2461
+ fill: "none",
2462
+ stroke: "currentColor",
2463
+ strokeWidth: "2",
2464
+ strokeLinecap: "round"
2465
+ }
2466
+ ))), Wn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32", width: "24", height: "24", "aria-hidden": "true" }, /* @__PURE__ */ r.createElement(
2467
+ "path",
2468
+ {
2469
+ d: "M6 9h7l3 3h10v11a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9z",
2470
+ fill: "none",
2471
+ stroke: "currentColor",
2472
+ strokeWidth: "2",
2473
+ strokeLinejoin: "round"
2474
+ }
2475
+ ), /* @__PURE__ */ r.createElement(
2476
+ "path",
2477
+ {
2478
+ d: "M6 9V8a2 2 0 0 1 2-2h5l3 3",
2479
+ fill: "none",
2480
+ stroke: "currentColor",
2481
+ strokeWidth: "2",
2482
+ strokeLinejoin: "round"
2483
+ }
2484
+ ), /* @__PURE__ */ r.createElement("g", { transform: "translate(19 19)" }, /* @__PURE__ */ r.createElement("circle", { cx: "5", cy: "5", r: "8", fill: "var(--paper-2, #fff)" }), /* @__PURE__ */ r.createElement(
2485
+ "path",
2486
+ {
2487
+ d: "M5 1.5v7M1.5 5h7",
2488
+ fill: "none",
2489
+ stroke: "currentColor",
2490
+ strokeWidth: "2",
2491
+ strokeLinecap: "round"
2492
+ }
2493
+ ))), Hn = "_container_xer29_1", Un = "_content_xer29_9", zn = "_sidebarWrapper_xer29_17", Gn = "_editorWrapper_xer29_28", Yn = "_editorHeader_xer29_37", Zn = "_editorPath_xer29_49", Kn = "_editorPathPlaceholder_xer29_60", qn = "_editorHeaderActions_xer29_64", Jn = "_saveStatus_xer29_71", Xn = "_saveStatusSaving_xer29_78", Qn = "_saveStatusPending_xer29_79", ea = "_saveStatusError_xer29_83", ta = "_editor_xer29_28", ra = "_placeholder_xer29_105", na = "_messageArea_xer29_116", aa = "_mobileToggle_xer29_152", oa = "_mobileOverlay_xer29_156", ia = "_dockPresentation_xer29_162", la = "_dockDirtyIndicator_xer29_186", sa = "_dockSaveButton_xer29_195", ca = "_sidebarOpen_xer29_250", ae = {
2494
+ container: Hn,
2495
+ content: Un,
2496
+ sidebarWrapper: zn,
2497
+ editorWrapper: Gn,
2498
+ editorHeader: Yn,
2499
+ editorPath: Zn,
2500
+ editorPathPlaceholder: Kn,
2501
+ editorHeaderActions: qn,
2502
+ saveStatus: Jn,
2503
+ saveStatusSaving: Xn,
2504
+ saveStatusPending: Qn,
2505
+ saveStatusError: ea,
2506
+ editor: ta,
2507
+ placeholder: ra,
2508
+ messageArea: na,
2509
+ mobileToggle: aa,
2510
+ mobileOverlay: oa,
2511
+ dockPresentation: ia,
2512
+ dockDirtyIndicator: la,
2513
+ dockSaveButton: sa,
2514
+ sidebarOpen: ca
2515
+ }, ua = 1500, fa = 700, da = 1e3, B = {
2281
2516
  IDLE: "idle",
2282
2517
  PENDING: "pending",
2283
2518
  SAVING: "saving",
2284
2519
  SAVED: "saved",
2285
2520
  ERROR: "error"
2286
2521
  };
2287
- function ya({
2522
+ function $a({
2288
2523
  filesystem: n,
2289
- isVisible: u = !0,
2290
- documentRoot: l,
2291
- initialPath: m = null,
2292
- placeholderText: E = "Select a file to view or edit its contents.",
2293
- onSaveFile: g,
2294
- onBeforeFilesystemChange: k
2524
+ isVisible: c = !0,
2525
+ documentRoot: d,
2526
+ initialPath: l = null,
2527
+ placeholderText: R = "Select a file to view or edit its contents.",
2528
+ dockPresentation: m = !1
2295
2529
  }) {
2296
- const [V, T] = Q(
2297
- l
2298
- ), [y, v] = Q(null), [N, P] = Q(""), [j, Z] = Q(!0), [A, D] = Q(K.IDLE), [p, b] = Q(null), [q, B] = Q(!1), [G, ee] = Q(null), W = M(null), F = M(null), te = M(!1), _ = M(N), H = M(y), de = M(n), ae = M(null), re = M(/* @__PURE__ */ new Map()), ue = M(!1);
2299
- I(() => {
2300
- _.current = N;
2301
- }, [N]), I(() => {
2302
- H.current = y;
2303
- }, [y]), I(() => {
2304
- de.current = n;
2305
- }, [n]), I(() => {
2306
- const S = ae.current;
2307
- S && S !== n && k && k(S), ae.current = n;
2308
- }, [n, k]), I(() => {
2309
- n || (te.current = !0, P(""), v(null), Z(!0), D(K.IDLE), b(null), B(!1), ee(null), ue.current = !1);
2310
- }, [n]), I(() => {
2311
- if (!n || !m || ue.current)
2530
+ const [k, N] = ee(
2531
+ d
2532
+ ), [h, S] = ee(null), [_, T] = ee(""), [P, W] = ee(!0), [F, D] = ee(B.IDLE), [ce, v] = ee(null), [b, K] = ee("idle"), [te, q] = ee(!1), [y, M] = ee(null), I = V(null), $ = V(null), g = V(!1), O = V(h), me = V(
2533
+ n
2534
+ ), A = V(null), J = V(null), fe = V(
2535
+ /* @__PURE__ */ new WeakMap()
2536
+ ), X = V(!0), le = V(/* @__PURE__ */ new Map()), Se = V(!1);
2537
+ me.current = n, H(() => {
2538
+ O.current = h;
2539
+ }, [h]);
2540
+ const be = We(async (u) => {
2541
+ const { filesystem: x, path: z, content: G } = u, Q = J.current === u, de = fe.current, xe = (de.get(x) ?? Promise.resolve()).catch(() => {
2542
+ }).then(() => x.writeFile(z, G));
2543
+ de.set(x, xe);
2544
+ let he = !1;
2545
+ try {
2546
+ await xe;
2547
+ } catch (et) {
2548
+ he = !0, Ke.error("Failed to save file", et);
2549
+ }
2550
+ const Me = X.current && de.get(x) === xe && me.current === x && O.current === z && A.current === null;
2551
+ de.get(x) === xe && de.delete(x), J.current === u && (J.current = null), Me && (D(he ? B.ERROR : B.SAVED), v(
2552
+ he ? "Could not save changes. Try again." : null
2553
+ ), Q && K(he ? "idle" : "saved"));
2554
+ }, []), Ce = We(() => {
2555
+ const u = A.current;
2556
+ u && ($.current !== null && (window.clearTimeout($.current), $.current = null), A.current = null, be(u));
2557
+ }, [be]);
2558
+ H(() => (X.current = !0, () => {
2559
+ X.current = !1;
2560
+ }), []), H(() => () => {
2561
+ var u;
2562
+ ((u = A.current) == null ? void 0 : u.filesystem) === n && Ce();
2563
+ }, [d, n, Ce]), H(() => {
2564
+ g.current = !0, N(d), T(""), S(null), W(!0), D(B.IDLE), v(null), q(!1), M(null), le.current.clear(), Se.current = !1;
2565
+ }, [d, n]), H(() => {
2566
+ if (!n || !l || Se.current)
2312
2567
  return;
2313
- (async () => {
2568
+ let u = !1;
2569
+ return (async () => {
2314
2570
  try {
2315
- if (await n.fileExists(m)) {
2316
- const J = await n.readFileAsText(m);
2317
- te.current = !0, v(m), P(J), Z(!1), D(K.IDLE), b(null), setTimeout(() => {
2318
- var z;
2319
- (z = W.current) == null || z.focus();
2571
+ if (await n.fileExists(l) && !u) {
2572
+ const G = await n.readFileAsText(l);
2573
+ if (u)
2574
+ return;
2575
+ g.current = !0, S(l), T(G), W(!1), D(B.IDLE), v(null), setTimeout(() => {
2576
+ var Q;
2577
+ (Q = I.current) == null || Q.focus();
2320
2578
  }, 100);
2321
2579
  }
2322
- } catch (C) {
2323
- dt.debug("Could not auto-open initial path:", C);
2580
+ } catch (z) {
2581
+ Ke.debug("Could not auto-open initial path:", z);
2324
2582
  } finally {
2325
- ue.current = !0;
2583
+ u || (Se.current = !0);
2326
2584
  }
2327
- })();
2328
- }, [n, m]), I(() => {
2329
- T(l), v(null), P(""), Z(!0), D(K.IDLE), b(null), te.current = !0, ee(null), ue.current = !1;
2330
- }, [l]), I(() => () => {
2331
- F.current !== null && (window.clearTimeout(F.current), F.current = null);
2332
- }, []), I(() => {
2333
- const S = de.current;
2334
- if (!S || !y) {
2335
- F.current !== null && (window.clearTimeout(F.current), F.current = null), y || D(K.IDLE);
2585
+ })(), () => {
2586
+ u = !0;
2587
+ };
2588
+ }, [n, l]), H(() => {
2589
+ if (!n || !h) {
2590
+ $.current !== null && (window.clearTimeout($.current), $.current = null), A.current = null, h || D(B.IDLE);
2336
2591
  return;
2337
2592
  }
2338
- if (te.current) {
2339
- te.current = !1;
2593
+ if (g.current) {
2594
+ g.current = !1, A.current = null;
2340
2595
  return;
2341
2596
  }
2342
- F.current !== null && (window.clearTimeout(F.current), F.current = null), D(K.PENDING);
2343
- const C = window.setTimeout(async () => {
2344
- F.current = null, D(K.SAVING);
2345
- try {
2346
- const J = H.current, z = _.current;
2347
- g ? await g(J, z) : await S.writeFile(J, z), D(K.SAVED), b(null);
2348
- } catch (J) {
2349
- dt.error("Failed to save file", J), D(K.ERROR), b("Could not save changes. Try again.");
2350
- }
2351
- }, Yn);
2352
- return F.current = C, () => {
2353
- F.current === C && (window.clearTimeout(C), F.current = null);
2597
+ $.current !== null && (window.clearTimeout($.current), $.current = null), D(B.PENDING);
2598
+ const u = {
2599
+ filesystem: n,
2600
+ path: h,
2601
+ content: _
2602
+ };
2603
+ A.current = u;
2604
+ const x = window.setTimeout(() => {
2605
+ A.current === u && ($.current = null, A.current = null, D(B.SAVING), be(u));
2606
+ }, ua);
2607
+ return $.current = x, () => {
2608
+ $.current === x && (window.clearTimeout(x), $.current = null);
2354
2609
  };
2355
- }, [N, y, g]), I(() => {
2356
- if (A !== K.SAVED)
2610
+ }, [_, h, n, be]), H(() => {
2611
+ if (F !== B.SAVED)
2357
2612
  return;
2358
- const S = window.setTimeout(() => {
2613
+ const u = window.setTimeout(() => {
2359
2614
  D(
2360
- (C) => C === K.SAVED ? K.IDLE : C
2615
+ (x) => x === B.SAVED ? B.IDLE : x
2361
2616
  );
2362
2617
  }, 2e3);
2363
- return () => window.clearTimeout(S);
2364
- }, [A]);
2365
- const oe = ft(
2366
- async (S, C, J = !0) => {
2367
- var ie;
2368
- const z = (ie = W.current) == null ? void 0 : ie.getCursorPosition();
2369
- z != null && H.current && re.current.set(
2370
- H.current,
2371
- z
2372
- ), te.current = !0, v(S), P(C), ee(null), Z(!1), D(K.IDLE), b(null), B(!1), setTimeout(() => {
2373
- var ve, ce, U;
2374
- const Ee = re.current.get(S);
2375
- Ee !== void 0 && ((ve = W.current) == null || ve.setCursorPosition(Ee)), J ? (ce = W.current) == null || ce.focus() : (U = W.current) == null || U.blur();
2618
+ return () => window.clearTimeout(u);
2619
+ }, [F]), H(() => {
2620
+ b === "idle" || F === B.SAVING || F === B.SAVED || K("idle");
2621
+ }, [b, F]), H(() => {
2622
+ if (b !== "saved")
2623
+ return;
2624
+ const u = window.setTimeout(
2625
+ () => K("idle"),
2626
+ da
2627
+ );
2628
+ return () => window.clearTimeout(u);
2629
+ }, [b]), H(() => {
2630
+ if (b !== "waiting")
2631
+ return;
2632
+ const u = window.setTimeout(
2633
+ () => K(
2634
+ (x) => x === "waiting" ? "saving" : x
2635
+ ),
2636
+ fa
2637
+ );
2638
+ return () => window.clearTimeout(u);
2639
+ }, [b]);
2640
+ const ue = We(
2641
+ async (u, x, z = !0) => {
2642
+ var Q;
2643
+ const G = (Q = I.current) == null ? void 0 : Q.getCursorPosition();
2644
+ G != null && O.current && le.current.set(
2645
+ O.current,
2646
+ G
2647
+ ), g.current = !0, S(u), T(x), M(null), W(!1), D(B.IDLE), v(null), q(!1), setTimeout(() => {
2648
+ var Ae, xe, he;
2649
+ const de = le.current.get(u);
2650
+ de !== void 0 && ((Ae = I.current) == null || Ae.setCursorPosition(de)), z ? (xe = I.current) == null || xe.focus() : (he = I.current) == null || he.blur();
2376
2651
  }, 50);
2377
2652
  },
2378
2653
  []
2379
2654
  );
2380
- I(() => {
2381
- var J;
2382
- if (!y)
2655
+ H(() => {
2656
+ var z;
2657
+ if (!h)
2383
2658
  return;
2384
- const S = setInterval(() => {
2385
- var ie;
2386
- const z = (ie = W.current) == null ? void 0 : ie.getCursorPosition();
2387
- z != null && re.current.set(y, z);
2388
- }, 1e3), C = (J = W.current) == null ? void 0 : J.getCursorPosition();
2389
- return C != null && re.current.set(y, C), () => {
2390
- var ie;
2391
- clearInterval(S);
2392
- const z = (ie = W.current) == null ? void 0 : ie.getCursorPosition();
2393
- z != null && re.current.set(y, z);
2659
+ const u = setInterval(() => {
2660
+ var Q;
2661
+ const G = (Q = I.current) == null ? void 0 : Q.getCursorPosition();
2662
+ G != null && le.current.set(h, G);
2663
+ }, 1e3), x = (z = I.current) == null ? void 0 : z.getCursorPosition();
2664
+ return x != null && le.current.set(h, x), () => {
2665
+ var Q;
2666
+ clearInterval(u);
2667
+ const G = (Q = I.current) == null ? void 0 : Q.getCursorPosition();
2668
+ G != null && le.current.set(h, G);
2394
2669
  };
2395
- }, [y]), I(() => {
2396
- if (!u || !y)
2670
+ }, [h]), H(() => {
2671
+ if (!c || !h)
2397
2672
  return;
2398
- const S = setTimeout(() => {
2399
- var J;
2400
- const C = re.current.get(y);
2401
- C !== void 0 && ((J = W.current) == null || J.setCursorPosition(C));
2673
+ const u = setTimeout(() => {
2674
+ var z;
2675
+ const x = le.current.get(h);
2676
+ x !== void 0 && ((z = I.current) == null || z.setCursorPosition(x));
2402
2677
  }, 100);
2403
- return () => clearTimeout(S);
2404
- }, [u, y]);
2405
- const be = ft(async () => {
2406
- var C;
2407
- const S = (C = W.current) == null ? void 0 : C.getCursorPosition();
2408
- S != null && H.current && re.current.set(H.current, S), te.current = !0, v(null), P(""), ee(null), Z(!0), D(K.IDLE), b(null);
2409
- }, []), Re = ft(
2410
- async (S, C) => {
2411
- te.current = !0, v(null), typeof C == "string" ? (P(C), ee(null)) : (P(""), ee(C)), Z(!0), D(K.IDLE), b(null), B(!1);
2678
+ return () => clearTimeout(u);
2679
+ }, [c, h]);
2680
+ const Fe = We(async () => {
2681
+ var x;
2682
+ const u = (x = I.current) == null ? void 0 : x.getCursorPosition();
2683
+ u != null && O.current && le.current.set(O.current, u), g.current = !0, S(null), T(""), M(null), W(!0), D(B.IDLE), v(null);
2684
+ }, []), re = We(
2685
+ async (u, x) => {
2686
+ g.current = !0, S(null), typeof x == "string" ? (T(x), M(null)) : (T(""), M(x)), W(!0), D(B.IDLE), v(null), q(!1);
2412
2687
  },
2413
2688
  []
2414
- ), Te = ft(async () => {
2415
- if (F.current !== null) {
2416
- if (!de.current || !H.current) {
2417
- window.clearTimeout(F.current), F.current = null;
2418
- return;
2419
- }
2420
- window.clearTimeout(F.current), F.current = null, D(K.SAVING);
2421
- try {
2422
- const S = H.current, C = _.current;
2423
- g ? await g(S, C) : await de.current.writeFile(
2424
- S,
2425
- C
2426
- ), D(K.SAVED), b(null);
2427
- } catch (S) {
2428
- dt.error("Failed to save file", S), D(K.ERROR), b("Could not save changes. Try again.");
2429
- }
2430
- }
2431
- }, [g]), Pe = Zn(A, p), le = Gn(A, fe);
2432
- return n ? /* @__PURE__ */ o.createElement("div", { className: fe.container }, /* @__PURE__ */ o.createElement(
2689
+ ), Pe = We(() => {
2690
+ A.current && (J.current = A.current, K("waiting"), D(B.SAVING), Ce());
2691
+ }, [Ce]), Re = We(() => {
2692
+ !A.current && F === B.ERROR && n && h && (A.current = {
2693
+ filesystem: n,
2694
+ path: h,
2695
+ content: _
2696
+ }), A.current && (v(null), Pe());
2697
+ }, [_, h, n, Pe, F]), ye = ma(F, ce), De = pa(F, ae), _e = ha(F);
2698
+ let oe = "Save";
2699
+ F === B.ERROR ? oe = "Retry" : F === B.SAVED && b === "saved" ? oe = "Saved" : F === B.SAVING && b === "saving" && (oe = "Saving…");
2700
+ const Y = F === B.PENDING || F === B.SAVING || F === B.ERROR;
2701
+ return n ? /* @__PURE__ */ r.createElement(
2433
2702
  "div",
2434
2703
  {
2435
- className: et(fe.content, {
2436
- [fe.sidebarOpen]: q
2704
+ className: Ne(ae.container, {
2705
+ [ae.dockPresentation]: m
2437
2706
  })
2438
2707
  },
2439
- /* @__PURE__ */ o.createElement(
2440
- "div",
2441
- {
2442
- className: fe.mobileOverlay,
2443
- onClick: () => B(!1)
2444
- }
2445
- ),
2446
- /* @__PURE__ */ o.createElement("aside", { className: fe.sidebarWrapper }, /* @__PURE__ */ o.createElement(
2447
- kn,
2448
- {
2449
- filesystem: n,
2450
- currentPath: y,
2451
- selectedDirPath: V,
2452
- setSelectedDirPath: T,
2453
- onFileOpened: oe,
2454
- onSelectionCleared: be,
2455
- onShowMessage: Re,
2456
- documentRoot: l
2457
- }
2458
- )),
2459
- /* @__PURE__ */ o.createElement("section", { className: fe.editorWrapper }, /* @__PURE__ */ o.createElement("div", { className: fe.editorHeader }, /* @__PURE__ */ o.createElement(
2460
- mt,
2461
- {
2462
- className: fe.mobileToggle,
2463
- variant: "secondary",
2464
- onClick: () => B((S) => !S)
2465
- },
2466
- q ? "Hide files" : "Browse files"
2467
- ), /* @__PURE__ */ o.createElement(
2708
+ /* @__PURE__ */ r.createElement(
2468
2709
  "div",
2469
2710
  {
2470
- className: et(fe.editorPath, {
2471
- [fe.editorPathPlaceholder]: !(y != null && y.length)
2711
+ className: Ne(ae.content, {
2712
+ [ae.sidebarOpen]: te
2472
2713
  })
2473
2714
  },
2474
- y != null && y.length ? y : `Browse files under ${l}`
2475
- ), /* @__PURE__ */ o.createElement(
2476
- "div",
2477
- {
2478
- className: et(
2479
- fe.saveStatus,
2480
- le
2481
- )
2482
- },
2483
- Pe
2484
- )), p ? /* @__PURE__ */ o.createElement("div", { style: { padding: "8px 16px" } }, /* @__PURE__ */ o.createElement(tr, { status: "error", isDismissible: !1 }, p)) : null, y || N || G ? G ? /* @__PURE__ */ o.createElement("div", { className: fe.messageArea }, G) : /* @__PURE__ */ o.createElement(
2485
- Ut,
2486
- {
2487
- ref: W,
2488
- code: N,
2489
- onChange: P,
2490
- currentPath: y,
2491
- className: fe.editor,
2492
- onSaveShortcut: Te,
2493
- readOnly: j
2494
- }
2495
- ) : /* @__PURE__ */ o.createElement("div", { className: fe.placeholder }, E))
2496
- )) : /* @__PURE__ */ o.createElement("div", { className: fe.container }, /* @__PURE__ */ o.createElement("div", { className: fe.placeholder }, E));
2715
+ /* @__PURE__ */ r.createElement(
2716
+ "div",
2717
+ {
2718
+ className: ae.mobileOverlay,
2719
+ onClick: () => q(!1)
2720
+ }
2721
+ ),
2722
+ /* @__PURE__ */ r.createElement("aside", { className: ae.sidebarWrapper }, /* @__PURE__ */ r.createElement(
2723
+ Vn,
2724
+ {
2725
+ filesystem: n,
2726
+ currentPath: h,
2727
+ selectedDirPath: k,
2728
+ setSelectedDirPath: N,
2729
+ onFileOpened: ue,
2730
+ onSelectionCleared: Fe,
2731
+ onShowMessage: re,
2732
+ documentRoot: d,
2733
+ dockPresentation: m,
2734
+ useWordPressTooltips: m
2735
+ }
2736
+ )),
2737
+ /* @__PURE__ */ r.createElement("section", { className: ae.editorWrapper }, /* @__PURE__ */ r.createElement("div", { className: ae.editorHeader }, /* @__PURE__ */ r.createElement(
2738
+ Je,
2739
+ {
2740
+ className: ae.mobileToggle,
2741
+ variant: "secondary",
2742
+ onClick: () => q((u) => !u)
2743
+ },
2744
+ te ? "Hide files" : "Browse files"
2745
+ ), /* @__PURE__ */ r.createElement(
2746
+ "div",
2747
+ {
2748
+ className: Ne(ae.editorPath, {
2749
+ [ae.editorPathPlaceholder]: !(h != null && h.length)
2750
+ }),
2751
+ title: h ?? void 0
2752
+ },
2753
+ h != null && h.length ? h : `Browse files under ${d}`
2754
+ ), m && !P && h ? /* @__PURE__ */ r.createElement("div", { className: ae.editorHeaderActions }, Y ? /* @__PURE__ */ r.createElement(
2755
+ "span",
2756
+ {
2757
+ className: ae.dockDirtyIndicator,
2758
+ "aria-hidden": "true"
2759
+ }
2760
+ ) : null, /* @__PURE__ */ r.createElement(Ht, { text: _e, placement: "top" }, /* @__PURE__ */ r.createElement(
2761
+ Je,
2762
+ {
2763
+ variant: "secondary",
2764
+ className: ae.dockSaveButton,
2765
+ isDestructive: F === B.ERROR,
2766
+ onClick: Re
2767
+ },
2768
+ oe
2769
+ ))) : m ? null : /* @__PURE__ */ r.createElement(
2770
+ "div",
2771
+ {
2772
+ className: Ne(
2773
+ ae.saveStatus,
2774
+ De
2775
+ )
2776
+ },
2777
+ ye
2778
+ ), m && !P && h ? /* @__PURE__ */ r.createElement(ir, { role: "status", "aria-live": "polite" }, _e) : null), ce ? /* @__PURE__ */ r.createElement("div", { style: { padding: "8px 16px" } }, /* @__PURE__ */ r.createElement(lr, { status: "error", isDismissible: !1 }, ce)) : null, h || _ || y ? y ? /* @__PURE__ */ r.createElement("div", { className: ae.messageArea }, y) : /* @__PURE__ */ r.createElement(
2779
+ Gt,
2780
+ {
2781
+ ref: I,
2782
+ code: _,
2783
+ onChange: T,
2784
+ currentPath: h,
2785
+ className: ae.editor,
2786
+ onSaveShortcut: Pe,
2787
+ readOnly: P
2788
+ }
2789
+ ) : /* @__PURE__ */ r.createElement("div", { className: ae.placeholder }, R))
2790
+ )
2791
+ ) : /* @__PURE__ */ r.createElement(
2792
+ "div",
2793
+ {
2794
+ className: Ne(ae.container, {
2795
+ [ae.dockPresentation]: m
2796
+ })
2797
+ },
2798
+ /* @__PURE__ */ r.createElement("div", { className: ae.placeholder }, R)
2799
+ );
2497
2800
  }
2498
- function Zn(n, u) {
2801
+ function ma(n, c) {
2499
2802
  switch (n) {
2500
- case K.PENDING:
2501
- case K.SAVING:
2803
+ case B.PENDING:
2804
+ case B.SAVING:
2502
2805
  return "Saving…";
2503
- case K.SAVED:
2806
+ case B.SAVED:
2504
2807
  return "Saved";
2505
- case K.ERROR:
2506
- return u ?? "Save failed";
2808
+ case B.ERROR:
2809
+ return c ?? "Save failed";
2507
2810
  default:
2508
2811
  return "";
2509
2812
  }
2510
2813
  }
2511
- function Gn(n, u) {
2814
+ function pa(n, c) {
2512
2815
  switch (n) {
2513
- case K.PENDING:
2514
- return u.saveStatusPending;
2515
- case K.SAVING:
2516
- return u.saveStatusSaving;
2517
- case K.ERROR:
2518
- return u.saveStatusError;
2816
+ case B.PENDING:
2817
+ return c.saveStatusPending;
2818
+ case B.SAVING:
2819
+ return c.saveStatusSaving;
2820
+ case B.ERROR:
2821
+ return c.saveStatusError;
2519
2822
  default:
2520
2823
  return;
2521
2824
  }
2522
2825
  }
2826
+ function ha(n) {
2827
+ switch (n) {
2828
+ case B.PENDING:
2829
+ return "Unsaved changes. Click to save now.";
2830
+ case B.SAVING:
2831
+ return "Saving changes…";
2832
+ case B.ERROR:
2833
+ return "Saving failed. Click to retry.";
2834
+ default:
2835
+ return "All changes saved.";
2836
+ }
2837
+ }
2523
2838
  export {
2524
- Ea as BinaryFilePreview,
2525
- pa as ClockIcon,
2526
- Ut as CodeEditor,
2527
- kn as FileExplorerSidebar,
2528
- ga as FilePickerControl,
2529
- qr as FilePickerTree,
2530
- xn as MAX_INLINE_FILE_BYTES,
2531
- ya as PlaygroundFileEditor,
2532
- va as SiteManagerIcon,
2533
- ma as WordPressIcon,
2534
- $t as createDownloadUrl,
2535
- Ar as file,
2536
- Or as folder,
2537
- wa as getLogoDataURL,
2538
- Tn as getMimeType,
2539
- Pn as isPreviewableBinary,
2540
- ha as layout,
2541
- fa as playgroundLogo,
2542
- Rn as seemsLikeBinary,
2543
- da as temporaryStorage
2839
+ Va as BinaryFilePreview,
2840
+ La as ClockIcon,
2841
+ Gt as CodeEditor,
2842
+ Vn as FileExplorerSidebar,
2843
+ ja as FilePickerControl,
2844
+ rn as FilePickerTree,
2845
+ Yt as MAX_INLINE_FILE_BYTES,
2846
+ $a as PlaygroundFileEditor,
2847
+ Ma as SiteManagerIcon,
2848
+ Ia as WordPressIcon,
2849
+ Vt as createDownloadUrl,
2850
+ jr as file,
2851
+ Mr as folder,
2852
+ Ba as getLogoDataURL,
2853
+ Mn as getMimeType,
2854
+ jn as isPreviewableBinary,
2855
+ Oa as layout,
2856
+ Na as playgroundLogo,
2857
+ In as seemsLikeBinary,
2858
+ Fa as temporaryStorage
2544
2859
  };
2545
2860
  //# sourceMappingURL=index.js.map