@wp-playground/components 3.1.50 → 3.1.51
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/PlaygroundFileEditor/code-editor.d.ts +2 -0
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.js +827 -820
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { forwardRef as $t, useMemo as Ft, useState as
|
|
1
|
+
import r, { forwardRef as $t, useMemo as Ft, useState as te, useRef as M, useEffect as H, useImperativeHandle as Wt, useLayoutEffect as qt, useCallback as Ue } from "react";
|
|
2
2
|
import { joinPaths as je, dirname as Le, normalizePath as Jt, basename as et, isParentOf as Xt, concatUint8Arrays as Qt } from "@php-wasm/util";
|
|
3
3
|
import { __experimentalTreeGrid as er, Popover as tr, NavigableMenu as rr, MenuItem as it, __experimentalTreeGridRow as nr, __experimentalTreeGridCell as ar, Button as tt, Modal as or, Icon as St, Tooltip as Ht, VisuallyHidden as ir, Notice as lr } from "@wordpress/components";
|
|
4
4
|
import De from "classnames";
|
|
@@ -232,15 +232,15 @@ var Bt;
|
|
|
232
232
|
function $r() {
|
|
233
233
|
if (Bt) return lt;
|
|
234
234
|
Bt = 1;
|
|
235
|
-
var n = r, c = Symbol.for("react.element"), f = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty,
|
|
236
|
-
function
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
for (
|
|
240
|
-
if (
|
|
241
|
-
return { $$typeof: c, type:
|
|
235
|
+
var n = r, c = Symbol.for("react.element"), f = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, R = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
236
|
+
function P(A, T, v) {
|
|
237
|
+
var D, _ = {}, k = null, Z = null;
|
|
238
|
+
v !== void 0 && (k = "" + v), T.key !== void 0 && (k = "" + T.key), T.ref !== void 0 && (Z = T.ref);
|
|
239
|
+
for (D in T) l.call(T, D) && !d.hasOwnProperty(D) && (_[D] = T[D]);
|
|
240
|
+
if (A && A.defaultProps) for (D in T = A.defaultProps, T) _[D] === void 0 && (_[D] = T[D]);
|
|
241
|
+
return { $$typeof: c, type: A, key: k, ref: Z, props: _, _owner: R.current };
|
|
242
242
|
}
|
|
243
|
-
return lt.Fragment = f, lt.jsx =
|
|
243
|
+
return lt.Fragment = f, lt.jsx = P, lt.jsxs = P, lt;
|
|
244
244
|
}
|
|
245
245
|
var st = {};
|
|
246
246
|
/**
|
|
@@ -255,54 +255,54 @@ var st = {};
|
|
|
255
255
|
var Mt;
|
|
256
256
|
function Wr() {
|
|
257
257
|
return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
258
|
-
var n = r, c = Symbol.for("react.element"), f = Symbol.for("react.portal"), l = Symbol.for("react.fragment"),
|
|
259
|
-
function
|
|
258
|
+
var n = r, c = Symbol.for("react.element"), f = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), P = Symbol.for("react.provider"), A = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), Z = Symbol.for("react.offscreen"), j = Symbol.iterator, x = "@@iterator";
|
|
259
|
+
function K(e) {
|
|
260
260
|
if (e === null || typeof e != "object")
|
|
261
261
|
return null;
|
|
262
|
-
var s =
|
|
262
|
+
var s = j && e[j] || e[x];
|
|
263
263
|
return typeof s == "function" ? s : null;
|
|
264
264
|
}
|
|
265
|
-
var
|
|
266
|
-
function
|
|
265
|
+
var W = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
266
|
+
function m(e) {
|
|
267
267
|
{
|
|
268
|
-
for (var s = arguments.length,
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
for (var s = arguments.length, p = new Array(s > 1 ? s - 1 : 0), C = 1; C < s; C++)
|
|
269
|
+
p[C - 1] = arguments[C];
|
|
270
|
+
V("error", e, p);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function V(e, s, p) {
|
|
274
274
|
{
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
var
|
|
278
|
-
return String(
|
|
275
|
+
var C = W.ReactDebugCurrentFrame, z = C.getStackAddendum();
|
|
276
|
+
z !== "" && (s += "%s", p = p.concat([z]));
|
|
277
|
+
var Y = p.map(function(B) {
|
|
278
|
+
return String(B);
|
|
279
279
|
});
|
|
280
|
-
|
|
280
|
+
Y.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, Y);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
var J = !1,
|
|
283
|
+
var J = !1, ce = !1, Q = !1, g = !1, $ = !1, N;
|
|
284
284
|
N = Symbol.for("react.module.reference");
|
|
285
|
-
function
|
|
286
|
-
return !!(typeof e == "string" || typeof e == "function" || e === l || e === d || $ || e ===
|
|
285
|
+
function h(e) {
|
|
286
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === d || $ || e === R || e === v || e === D || g || e === Z || J || ce || Q || typeof e == "object" && e !== null && (e.$$typeof === k || e.$$typeof === _ || e.$$typeof === P || e.$$typeof === A || e.$$typeof === T || // This needs to include all possible module reference object
|
|
287
287
|
// types supported by any Flight configuration anywhere since
|
|
288
288
|
// we don't know which Flight build this will end up being used
|
|
289
289
|
// with.
|
|
290
290
|
e.$$typeof === N || e.getModuleId !== void 0));
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
var
|
|
294
|
-
if (
|
|
295
|
-
return
|
|
296
|
-
var
|
|
297
|
-
return
|
|
292
|
+
function O(e, s, p) {
|
|
293
|
+
var C = e.displayName;
|
|
294
|
+
if (C)
|
|
295
|
+
return C;
|
|
296
|
+
var z = s.displayName || s.name || "";
|
|
297
|
+
return z !== "" ? p + "(" + z + ")" : p;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function G(e) {
|
|
300
300
|
return e.displayName || "Context";
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function re(e) {
|
|
303
303
|
if (e == null)
|
|
304
304
|
return null;
|
|
305
|
-
if (typeof e.tag == "number" &&
|
|
305
|
+
if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
306
306
|
return e.displayName || e.name || null;
|
|
307
307
|
if (typeof e == "string")
|
|
308
308
|
return e;
|
|
@@ -313,30 +313,30 @@ function Wr() {
|
|
|
313
313
|
return "Portal";
|
|
314
314
|
case d:
|
|
315
315
|
return "Profiler";
|
|
316
|
-
case
|
|
316
|
+
case R:
|
|
317
317
|
return "StrictMode";
|
|
318
|
-
case
|
|
318
|
+
case v:
|
|
319
319
|
return "Suspense";
|
|
320
|
-
case
|
|
320
|
+
case D:
|
|
321
321
|
return "SuspenseList";
|
|
322
322
|
}
|
|
323
323
|
if (typeof e == "object")
|
|
324
324
|
switch (e.$$typeof) {
|
|
325
|
-
case D:
|
|
326
|
-
var s = e;
|
|
327
|
-
return Y(s) + ".Consumer";
|
|
328
|
-
case k:
|
|
329
|
-
var m = e;
|
|
330
|
-
return Y(m._context) + ".Provider";
|
|
331
325
|
case A:
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
326
|
+
var s = e;
|
|
327
|
+
return G(s) + ".Consumer";
|
|
328
|
+
case P:
|
|
329
|
+
var p = e;
|
|
330
|
+
return G(p._context) + ".Provider";
|
|
331
|
+
case T:
|
|
332
|
+
return O(e, e.render, "ForwardRef");
|
|
333
|
+
case _:
|
|
334
|
+
var C = e.displayName || null;
|
|
335
|
+
return C !== null ? C : re(e.type) || "Memo";
|
|
336
|
+
case k: {
|
|
337
|
+
var z = e, Y = z._payload, B = z._init;
|
|
338
338
|
try {
|
|
339
|
-
return
|
|
339
|
+
return re(B(Y));
|
|
340
340
|
} catch {
|
|
341
341
|
return null;
|
|
342
342
|
}
|
|
@@ -344,18 +344,18 @@ function Wr() {
|
|
|
344
344
|
}
|
|
345
345
|
return null;
|
|
346
346
|
}
|
|
347
|
-
var
|
|
348
|
-
function
|
|
347
|
+
var I = Object.assign, ee = 0, X, ve, me, Ne, Pe, ne, Oe;
|
|
348
|
+
function ae() {
|
|
349
349
|
}
|
|
350
|
-
|
|
350
|
+
ae.__reactDisabledLog = !0;
|
|
351
351
|
function Me() {
|
|
352
352
|
{
|
|
353
|
-
if (
|
|
354
|
-
X = console.log, ve = console.info, me = console.warn, Ne = console.error, Pe = console.group,
|
|
353
|
+
if (ee === 0) {
|
|
354
|
+
X = console.log, ve = console.info, me = console.warn, Ne = console.error, Pe = console.group, ne = console.groupCollapsed, Oe = console.groupEnd;
|
|
355
355
|
var e = {
|
|
356
356
|
configurable: !0,
|
|
357
357
|
enumerable: !0,
|
|
358
|
-
value:
|
|
358
|
+
value: ae,
|
|
359
359
|
writable: !0
|
|
360
360
|
};
|
|
361
361
|
Object.defineProperties(console, {
|
|
@@ -368,142 +368,142 @@ function Wr() {
|
|
|
368
368
|
groupEnd: e
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
|
-
|
|
371
|
+
ee++;
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
function _e() {
|
|
375
375
|
{
|
|
376
|
-
if (
|
|
376
|
+
if (ee--, ee === 0) {
|
|
377
377
|
var e = {
|
|
378
378
|
configurable: !0,
|
|
379
379
|
enumerable: !0,
|
|
380
380
|
writable: !0
|
|
381
381
|
};
|
|
382
382
|
Object.defineProperties(console, {
|
|
383
|
-
log:
|
|
383
|
+
log: I({}, e, {
|
|
384
384
|
value: X
|
|
385
385
|
}),
|
|
386
|
-
info:
|
|
386
|
+
info: I({}, e, {
|
|
387
387
|
value: ve
|
|
388
388
|
}),
|
|
389
|
-
warn:
|
|
389
|
+
warn: I({}, e, {
|
|
390
390
|
value: me
|
|
391
391
|
}),
|
|
392
|
-
error:
|
|
392
|
+
error: I({}, e, {
|
|
393
393
|
value: Ne
|
|
394
394
|
}),
|
|
395
|
-
group:
|
|
395
|
+
group: I({}, e, {
|
|
396
396
|
value: Pe
|
|
397
397
|
}),
|
|
398
|
-
groupCollapsed:
|
|
399
|
-
value:
|
|
398
|
+
groupCollapsed: I({}, e, {
|
|
399
|
+
value: ne
|
|
400
400
|
}),
|
|
401
|
-
groupEnd:
|
|
401
|
+
groupEnd: I({}, e, {
|
|
402
402
|
value: Oe
|
|
403
403
|
})
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
ee < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
var ke =
|
|
410
|
-
function Se(e, s,
|
|
409
|
+
var ke = W.ReactCurrentDispatcher, Fe;
|
|
410
|
+
function Se(e, s, p) {
|
|
411
411
|
{
|
|
412
412
|
if (Fe === void 0)
|
|
413
413
|
try {
|
|
414
414
|
throw Error();
|
|
415
|
-
} catch (
|
|
416
|
-
var
|
|
417
|
-
Fe =
|
|
415
|
+
} catch (z) {
|
|
416
|
+
var C = z.stack.trim().match(/\n( *(at )?)/);
|
|
417
|
+
Fe = C && C[1] || "";
|
|
418
418
|
}
|
|
419
419
|
return `
|
|
420
420
|
` + Fe + e;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
var
|
|
423
|
+
var de = !1, U;
|
|
424
424
|
{
|
|
425
|
-
var
|
|
426
|
-
|
|
425
|
+
var E = typeof WeakMap == "function" ? WeakMap : Map;
|
|
426
|
+
U = new E();
|
|
427
427
|
}
|
|
428
428
|
function he(e, s) {
|
|
429
|
-
if (!e ||
|
|
429
|
+
if (!e || de)
|
|
430
430
|
return "";
|
|
431
431
|
{
|
|
432
|
-
var
|
|
433
|
-
if (
|
|
434
|
-
return
|
|
432
|
+
var p = U.get(e);
|
|
433
|
+
if (p !== void 0)
|
|
434
|
+
return p;
|
|
435
435
|
}
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
var
|
|
436
|
+
var C;
|
|
437
|
+
de = !0;
|
|
438
|
+
var z = Error.prepareStackTrace;
|
|
439
439
|
Error.prepareStackTrace = void 0;
|
|
440
|
-
var
|
|
441
|
-
|
|
440
|
+
var Y;
|
|
441
|
+
Y = ke.current, ke.current = null, Me();
|
|
442
442
|
try {
|
|
443
443
|
if (s) {
|
|
444
|
-
var
|
|
444
|
+
var B = function() {
|
|
445
445
|
throw Error();
|
|
446
446
|
};
|
|
447
|
-
if (Object.defineProperty(
|
|
447
|
+
if (Object.defineProperty(B.prototype, "props", {
|
|
448
448
|
set: function() {
|
|
449
449
|
throw Error();
|
|
450
450
|
}
|
|
451
451
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
452
452
|
try {
|
|
453
|
-
Reflect.construct(
|
|
453
|
+
Reflect.construct(B, []);
|
|
454
454
|
} catch (Ce) {
|
|
455
|
-
|
|
455
|
+
C = Ce;
|
|
456
456
|
}
|
|
457
|
-
Reflect.construct(e, [],
|
|
457
|
+
Reflect.construct(e, [], B);
|
|
458
458
|
} else {
|
|
459
459
|
try {
|
|
460
|
-
|
|
460
|
+
B.call();
|
|
461
461
|
} catch (Ce) {
|
|
462
|
-
|
|
462
|
+
C = Ce;
|
|
463
463
|
}
|
|
464
|
-
e.call(
|
|
464
|
+
e.call(B.prototype);
|
|
465
465
|
}
|
|
466
466
|
} else {
|
|
467
467
|
try {
|
|
468
468
|
throw Error();
|
|
469
469
|
} catch (Ce) {
|
|
470
|
-
|
|
470
|
+
C = Ce;
|
|
471
471
|
}
|
|
472
472
|
e();
|
|
473
473
|
}
|
|
474
474
|
} catch (Ce) {
|
|
475
|
-
if (Ce &&
|
|
476
|
-
for (var
|
|
477
|
-
`), Ee =
|
|
478
|
-
`), se =
|
|
479
|
-
|
|
480
|
-
for (; se >= 1 &&
|
|
481
|
-
if (
|
|
482
|
-
if (se !== 1 ||
|
|
475
|
+
if (Ce && C && typeof Ce.stack == "string") {
|
|
476
|
+
for (var F = Ce.stack.split(`
|
|
477
|
+
`), Ee = C.stack.split(`
|
|
478
|
+
`), se = F.length - 1, fe = Ee.length - 1; se >= 1 && fe >= 0 && F[se] !== Ee[fe]; )
|
|
479
|
+
fe--;
|
|
480
|
+
for (; se >= 1 && fe >= 0; se--, fe--)
|
|
481
|
+
if (F[se] !== Ee[fe]) {
|
|
482
|
+
if (se !== 1 || fe !== 1)
|
|
483
483
|
do
|
|
484
|
-
if (se--,
|
|
484
|
+
if (se--, fe--, fe < 0 || F[se] !== Ee[fe]) {
|
|
485
485
|
var Te = `
|
|
486
|
-
` +
|
|
487
|
-
return e.displayName && Te.includes("<anonymous>") && (Te = Te.replace("<anonymous>", e.displayName)), typeof e == "function" &&
|
|
486
|
+
` + F[se].replace(" at new ", " at ");
|
|
487
|
+
return e.displayName && Te.includes("<anonymous>") && (Te = Te.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, Te), Te;
|
|
488
488
|
}
|
|
489
|
-
while (se >= 1 &&
|
|
489
|
+
while (se >= 1 && fe >= 0);
|
|
490
490
|
break;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
} finally {
|
|
494
|
-
|
|
494
|
+
de = !1, ke.current = Y, _e(), Error.prepareStackTrace = z;
|
|
495
495
|
}
|
|
496
496
|
var Je = e ? e.displayName || e.name : "", He = Je ? Se(Je) : "";
|
|
497
|
-
return typeof e == "function" &&
|
|
497
|
+
return typeof e == "function" && U.set(e, He), He;
|
|
498
498
|
}
|
|
499
|
-
function pe(e, s,
|
|
499
|
+
function pe(e, s, p) {
|
|
500
500
|
return he(e, !1);
|
|
501
501
|
}
|
|
502
502
|
function we(e) {
|
|
503
503
|
var s = e.prototype;
|
|
504
504
|
return !!(s && s.isReactComponent);
|
|
505
505
|
}
|
|
506
|
-
function b(e, s,
|
|
506
|
+
function b(e, s, p) {
|
|
507
507
|
if (e == null)
|
|
508
508
|
return "";
|
|
509
509
|
if (typeof e == "function")
|
|
@@ -511,51 +511,51 @@ function Wr() {
|
|
|
511
511
|
if (typeof e == "string")
|
|
512
512
|
return Se(e);
|
|
513
513
|
switch (e) {
|
|
514
|
-
case
|
|
514
|
+
case v:
|
|
515
515
|
return Se("Suspense");
|
|
516
|
-
case
|
|
516
|
+
case D:
|
|
517
517
|
return Se("SuspenseList");
|
|
518
518
|
}
|
|
519
519
|
if (typeof e == "object")
|
|
520
520
|
switch (e.$$typeof) {
|
|
521
|
-
case
|
|
521
|
+
case T:
|
|
522
522
|
return pe(e.render);
|
|
523
|
-
case
|
|
524
|
-
return b(e.type, s,
|
|
525
|
-
case
|
|
526
|
-
var
|
|
523
|
+
case _:
|
|
524
|
+
return b(e.type, s, p);
|
|
525
|
+
case k: {
|
|
526
|
+
var C = e, z = C._payload, Y = C._init;
|
|
527
527
|
try {
|
|
528
|
-
return b(
|
|
528
|
+
return b(Y(z), s, p);
|
|
529
529
|
} catch {
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
return "";
|
|
534
534
|
}
|
|
535
|
-
var
|
|
536
|
-
function
|
|
535
|
+
var S = Object.prototype.hasOwnProperty, ie = {}, le = W.ReactDebugCurrentFrame;
|
|
536
|
+
function ue(e) {
|
|
537
537
|
if (e) {
|
|
538
|
-
var s = e._owner,
|
|
539
|
-
le.setExtraStackFrame(
|
|
538
|
+
var s = e._owner, p = b(e.type, e._source, s ? s.type : null);
|
|
539
|
+
le.setExtraStackFrame(p);
|
|
540
540
|
} else
|
|
541
541
|
le.setExtraStackFrame(null);
|
|
542
542
|
}
|
|
543
|
-
function be(e, s,
|
|
543
|
+
function be(e, s, p, C, z) {
|
|
544
544
|
{
|
|
545
|
-
var
|
|
546
|
-
for (var
|
|
547
|
-
if (
|
|
548
|
-
var
|
|
545
|
+
var Y = Function.call.bind(S);
|
|
546
|
+
for (var B in e)
|
|
547
|
+
if (Y(e, B)) {
|
|
548
|
+
var F = void 0;
|
|
549
549
|
try {
|
|
550
|
-
if (typeof e[
|
|
551
|
-
var Ee = Error((
|
|
550
|
+
if (typeof e[B] != "function") {
|
|
551
|
+
var Ee = Error((C || "React class") + ": " + p + " type `" + B + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[B] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
552
552
|
throw Ee.name = "Invariant Violation", Ee;
|
|
553
553
|
}
|
|
554
|
-
|
|
554
|
+
F = e[B](s, B, C, p, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
555
555
|
} catch (se) {
|
|
556
|
-
|
|
556
|
+
F = se;
|
|
557
557
|
}
|
|
558
|
-
|
|
558
|
+
F && !(F instanceof Error) && (ue(z), m("%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, B, typeof F), ue(null)), F instanceof Error && !(F.message in ie) && (ie[F.message] = !0, ue(z), m("Failed %s type: %s", p, F.message), ue(null));
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
}
|
|
@@ -565,8 +565,8 @@ function Wr() {
|
|
|
565
565
|
}
|
|
566
566
|
function Ie(e) {
|
|
567
567
|
{
|
|
568
|
-
var s = typeof Symbol == "function" && Symbol.toStringTag,
|
|
569
|
-
return
|
|
568
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, p = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
569
|
+
return p;
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
function at(e) {
|
|
@@ -581,16 +581,16 @@ function Wr() {
|
|
|
581
581
|
}
|
|
582
582
|
function ft(e) {
|
|
583
583
|
if (at(e))
|
|
584
|
-
return
|
|
584
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ie(e)), Ge(e);
|
|
585
585
|
}
|
|
586
|
-
var dt =
|
|
586
|
+
var dt = W.ReactCurrentOwner, Et = {
|
|
587
587
|
key: !0,
|
|
588
588
|
ref: !0,
|
|
589
589
|
__self: !0,
|
|
590
590
|
__source: !0
|
|
591
591
|
}, mt, We;
|
|
592
592
|
function Ye(e) {
|
|
593
|
-
if (
|
|
593
|
+
if (S.call(e, "ref")) {
|
|
594
594
|
var s = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
595
595
|
if (s && s.isReactWarning)
|
|
596
596
|
return !1;
|
|
@@ -598,7 +598,7 @@ function Wr() {
|
|
|
598
598
|
return e.ref !== void 0;
|
|
599
599
|
}
|
|
600
600
|
function yt(e) {
|
|
601
|
-
if (
|
|
601
|
+
if (S.call(e, "key")) {
|
|
602
602
|
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
603
603
|
if (s && s.isReactWarning)
|
|
604
604
|
return !1;
|
|
@@ -610,78 +610,78 @@ function Wr() {
|
|
|
610
610
|
}
|
|
611
611
|
function bt(e, s) {
|
|
612
612
|
{
|
|
613
|
-
var
|
|
614
|
-
mt || (mt = !0,
|
|
613
|
+
var p = function() {
|
|
614
|
+
mt || (mt = !0, m("%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));
|
|
615
615
|
};
|
|
616
|
-
|
|
617
|
-
get:
|
|
616
|
+
p.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
617
|
+
get: p,
|
|
618
618
|
configurable: !0
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
function xt(e, s) {
|
|
623
623
|
{
|
|
624
|
-
var
|
|
625
|
-
We || (We = !0,
|
|
624
|
+
var p = function() {
|
|
625
|
+
We || (We = !0, m("%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));
|
|
626
626
|
};
|
|
627
|
-
|
|
628
|
-
get:
|
|
627
|
+
p.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
628
|
+
get: p,
|
|
629
629
|
configurable: !0
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
var Ct = function(e, s,
|
|
634
|
-
var
|
|
633
|
+
var Ct = function(e, s, p, C, z, Y, B) {
|
|
634
|
+
var F = {
|
|
635
635
|
// This tag allows us to uniquely identify this as a React Element
|
|
636
636
|
$$typeof: c,
|
|
637
637
|
// Built-in properties that belong on the element
|
|
638
638
|
type: e,
|
|
639
639
|
key: s,
|
|
640
|
-
ref:
|
|
641
|
-
props:
|
|
640
|
+
ref: p,
|
|
641
|
+
props: B,
|
|
642
642
|
// Record the component responsible for creating this element.
|
|
643
|
-
_owner:
|
|
643
|
+
_owner: Y
|
|
644
644
|
};
|
|
645
|
-
return
|
|
645
|
+
return F._store = {}, Object.defineProperty(F._store, "validated", {
|
|
646
646
|
configurable: !1,
|
|
647
647
|
enumerable: !1,
|
|
648
648
|
writable: !0,
|
|
649
649
|
value: !1
|
|
650
|
-
}), Object.defineProperty(
|
|
650
|
+
}), Object.defineProperty(F, "_self", {
|
|
651
651
|
configurable: !1,
|
|
652
652
|
enumerable: !1,
|
|
653
653
|
writable: !1,
|
|
654
|
-
value:
|
|
655
|
-
}), Object.defineProperty(
|
|
654
|
+
value: C
|
|
655
|
+
}), Object.defineProperty(F, "_source", {
|
|
656
656
|
configurable: !1,
|
|
657
657
|
enumerable: !1,
|
|
658
658
|
writable: !1,
|
|
659
|
-
value:
|
|
660
|
-
}), Object.freeze && (Object.freeze(
|
|
659
|
+
value: z
|
|
660
|
+
}), Object.freeze && (Object.freeze(F.props), Object.freeze(F)), F;
|
|
661
661
|
};
|
|
662
|
-
function pt(e, s,
|
|
662
|
+
function pt(e, s, p, C, z) {
|
|
663
663
|
{
|
|
664
|
-
var
|
|
665
|
-
|
|
666
|
-
for (
|
|
667
|
-
|
|
664
|
+
var Y, B = {}, F = null, Ee = null;
|
|
665
|
+
p !== void 0 && (ft(p), F = "" + p), yt(s) && (ft(s.key), F = "" + s.key), Ye(s) && (Ee = s.ref, _t(s, z));
|
|
666
|
+
for (Y in s)
|
|
667
|
+
S.call(s, Y) && !Et.hasOwnProperty(Y) && (B[Y] = s[Y]);
|
|
668
668
|
if (e && e.defaultProps) {
|
|
669
669
|
var se = e.defaultProps;
|
|
670
|
-
for (
|
|
671
|
-
|
|
670
|
+
for (Y in se)
|
|
671
|
+
B[Y] === void 0 && (B[Y] = se[Y]);
|
|
672
672
|
}
|
|
673
|
-
if (
|
|
674
|
-
var
|
|
675
|
-
|
|
673
|
+
if (F || Ee) {
|
|
674
|
+
var fe = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
675
|
+
F && bt(B, fe), Ee && xt(B, fe);
|
|
676
676
|
}
|
|
677
|
-
return Ct(e,
|
|
677
|
+
return Ct(e, F, Ee, z, C, dt.current, B);
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
var Ze =
|
|
680
|
+
var Ze = W.ReactCurrentOwner, ot = W.ReactDebugCurrentFrame;
|
|
681
681
|
function Ve(e) {
|
|
682
682
|
if (e) {
|
|
683
|
-
var s = e._owner,
|
|
684
|
-
ot.setExtraStackFrame(
|
|
683
|
+
var s = e._owner, p = b(e.type, e._source, s ? s.type : null);
|
|
684
|
+
ot.setExtraStackFrame(p);
|
|
685
685
|
} else
|
|
686
686
|
ot.setExtraStackFrame(null);
|
|
687
687
|
}
|
|
@@ -693,7 +693,7 @@ function Wr() {
|
|
|
693
693
|
function ht() {
|
|
694
694
|
{
|
|
695
695
|
if (Ze.current) {
|
|
696
|
-
var e =
|
|
696
|
+
var e = re(Ze.current.type);
|
|
697
697
|
if (e)
|
|
698
698
|
return `
|
|
699
699
|
|
|
@@ -710,10 +710,10 @@ Check the render method of \`` + e + "`.";
|
|
|
710
710
|
{
|
|
711
711
|
var s = ht();
|
|
712
712
|
if (!s) {
|
|
713
|
-
var
|
|
714
|
-
|
|
713
|
+
var p = typeof e == "string" ? e : e.displayName || e.name;
|
|
714
|
+
p && (s = `
|
|
715
715
|
|
|
716
|
-
Check the top-level render call using <` +
|
|
716
|
+
Check the top-level render call using <` + p + ">.");
|
|
717
717
|
}
|
|
718
718
|
return s;
|
|
719
719
|
}
|
|
@@ -723,12 +723,12 @@ Check the top-level render call using <` + m + ">.");
|
|
|
723
723
|
if (!e._store || e._store.validated || e.key != null)
|
|
724
724
|
return;
|
|
725
725
|
e._store.validated = !0;
|
|
726
|
-
var
|
|
727
|
-
if (vt[
|
|
726
|
+
var p = kt(s);
|
|
727
|
+
if (vt[p])
|
|
728
728
|
return;
|
|
729
|
-
vt[
|
|
730
|
-
var
|
|
731
|
-
e && e._owner && e._owner !== Ze.current && (
|
|
729
|
+
vt[p] = !0;
|
|
730
|
+
var C = "";
|
|
731
|
+
e && e._owner && e._owner !== Ze.current && (C = " It was passed a child from " + re(e._owner.type) + "."), Ve(e), m('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), Ve(null);
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
function t(e, s) {
|
|
@@ -736,17 +736,17 @@ Check the top-level render call using <` + m + ">.");
|
|
|
736
736
|
if (typeof e != "object")
|
|
737
737
|
return;
|
|
738
738
|
if (ge(e))
|
|
739
|
-
for (var
|
|
740
|
-
var
|
|
741
|
-
qe(
|
|
739
|
+
for (var p = 0; p < e.length; p++) {
|
|
740
|
+
var C = e[p];
|
|
741
|
+
qe(C) && wt(C, s);
|
|
742
742
|
}
|
|
743
743
|
else if (qe(e))
|
|
744
744
|
e._store && (e._store.validated = !0);
|
|
745
745
|
else if (e) {
|
|
746
|
-
var
|
|
747
|
-
if (typeof
|
|
748
|
-
for (var
|
|
749
|
-
qe(
|
|
746
|
+
var z = K(e);
|
|
747
|
+
if (typeof z == "function" && z !== e.entries)
|
|
748
|
+
for (var Y = z.call(e), B; !(B = Y.next()).done; )
|
|
749
|
+
qe(B.value) && wt(B.value, s);
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
752
|
}
|
|
@@ -755,73 +755,73 @@ Check the top-level render call using <` + m + ">.");
|
|
|
755
755
|
var s = e.type;
|
|
756
756
|
if (s == null || typeof s == "string")
|
|
757
757
|
return;
|
|
758
|
-
var
|
|
758
|
+
var p;
|
|
759
759
|
if (typeof s == "function")
|
|
760
|
-
|
|
761
|
-
else if (typeof s == "object" && (s.$$typeof ===
|
|
760
|
+
p = s.propTypes;
|
|
761
|
+
else if (typeof s == "object" && (s.$$typeof === T || // Note: Memo only checks outer props here.
|
|
762
762
|
// Inner props are checked in the reconciler.
|
|
763
|
-
s.$$typeof ===
|
|
764
|
-
|
|
763
|
+
s.$$typeof === _))
|
|
764
|
+
p = s.propTypes;
|
|
765
765
|
else
|
|
766
766
|
return;
|
|
767
|
-
if (
|
|
768
|
-
var
|
|
769
|
-
be(
|
|
767
|
+
if (p) {
|
|
768
|
+
var C = re(s);
|
|
769
|
+
be(p, e.props, "prop", C, e);
|
|
770
770
|
} else if (s.PropTypes !== void 0 && !Ke) {
|
|
771
771
|
Ke = !0;
|
|
772
|
-
var
|
|
773
|
-
|
|
772
|
+
var z = re(s);
|
|
773
|
+
m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", z || "Unknown");
|
|
774
774
|
}
|
|
775
|
-
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved &&
|
|
775
|
+
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
778
|
function o(e) {
|
|
779
779
|
{
|
|
780
|
-
for (var s = Object.keys(e.props),
|
|
781
|
-
var
|
|
782
|
-
if (
|
|
783
|
-
Ve(e),
|
|
780
|
+
for (var s = Object.keys(e.props), p = 0; p < s.length; p++) {
|
|
781
|
+
var C = s[p];
|
|
782
|
+
if (C !== "children" && C !== "key") {
|
|
783
|
+
Ve(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", C), Ve(null);
|
|
784
784
|
break;
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
e.ref !== null && (Ve(e),
|
|
787
|
+
e.ref !== null && (Ve(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), Ve(null));
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
var i = {};
|
|
791
|
-
function u(e, s,
|
|
791
|
+
function u(e, s, p, C, z, Y) {
|
|
792
792
|
{
|
|
793
|
-
var
|
|
794
|
-
if (!
|
|
795
|
-
var
|
|
796
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
793
|
+
var B = h(e);
|
|
794
|
+
if (!B) {
|
|
795
|
+
var F = "";
|
|
796
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (F += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
797
797
|
var Ee = Rt();
|
|
798
|
-
Ee ?
|
|
798
|
+
Ee ? F += Ee : F += ht();
|
|
799
799
|
var se;
|
|
800
|
-
e === null ? se = "null" : ge(e) ? se = "array" : e !== void 0 && e.$$typeof === c ? (se = "<" + (
|
|
800
|
+
e === null ? se = "null" : ge(e) ? se = "array" : e !== void 0 && e.$$typeof === c ? (se = "<" + (re(e.type) || "Unknown") + " />", F = " Did you accidentally export a JSX literal instead of a component?") : se = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", se, F);
|
|
801
801
|
}
|
|
802
|
-
var
|
|
803
|
-
if (
|
|
804
|
-
return
|
|
805
|
-
if (
|
|
802
|
+
var fe = pt(e, s, p, z, Y);
|
|
803
|
+
if (fe == null)
|
|
804
|
+
return fe;
|
|
805
|
+
if (B) {
|
|
806
806
|
var Te = s.children;
|
|
807
807
|
if (Te !== void 0)
|
|
808
|
-
if (
|
|
808
|
+
if (C)
|
|
809
809
|
if (ge(Te)) {
|
|
810
810
|
for (var Je = 0; Je < Te.length; Je++)
|
|
811
811
|
t(Te[Je], e);
|
|
812
812
|
Object.freeze && Object.freeze(Te);
|
|
813
813
|
} else
|
|
814
|
-
|
|
814
|
+
m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
815
815
|
else
|
|
816
816
|
t(Te, e);
|
|
817
817
|
}
|
|
818
|
-
if (
|
|
819
|
-
var He =
|
|
818
|
+
if (S.call(s, "key")) {
|
|
819
|
+
var He = re(e), Ce = Object.keys(s).filter(function(Kt) {
|
|
820
820
|
return Kt !== "key";
|
|
821
821
|
}), Pt = Ce.length > 0 ? "{key: someKey, " + Ce.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
822
822
|
if (!i[He + Pt]) {
|
|
823
823
|
var Zt = Ce.length > 0 ? "{" + Ce.join(": ..., ") + ": ...}" : "{}";
|
|
824
|
-
|
|
824
|
+
m(`A props object containing a "key" prop is being spread into JSX:
|
|
825
825
|
let props = %s;
|
|
826
826
|
<%s {...props} />
|
|
827
827
|
React keys must be passed directly to JSX without using spread:
|
|
@@ -829,17 +829,17 @@ React keys must be passed directly to JSX without using spread:
|
|
|
829
829
|
<%s key={someKey} {...props} />`, Pt, He, Zt, He), i[He + Pt] = !0;
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
|
-
return e === l ? o(
|
|
832
|
+
return e === l ? o(fe) : a(fe), fe;
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
function
|
|
836
|
-
return u(e, s,
|
|
835
|
+
function w(e, s, p) {
|
|
836
|
+
return u(e, s, p, !0);
|
|
837
837
|
}
|
|
838
|
-
function
|
|
839
|
-
return u(e, s,
|
|
838
|
+
function y(e, s, p) {
|
|
839
|
+
return u(e, s, p, !1);
|
|
840
840
|
}
|
|
841
|
-
var
|
|
842
|
-
st.Fragment = l, st.jsx =
|
|
841
|
+
var oe = y, xe = w;
|
|
842
|
+
st.Fragment = l, st.jsx = oe, st.jsxs = xe;
|
|
843
843
|
}()), st;
|
|
844
844
|
}
|
|
845
845
|
process.env.NODE_ENV === "production" ? It.exports = $r() : It.exports = Wr();
|
|
@@ -852,13 +852,13 @@ var Ae = It.exports, rt = (n) => cr("path", n), nt = Ut(
|
|
|
852
852
|
* @return {React.JSX.Element} Stop component
|
|
853
853
|
*/
|
|
854
854
|
({ className: n, isPressed: c, ...f }, l) => {
|
|
855
|
-
const
|
|
855
|
+
const R = {
|
|
856
856
|
...f,
|
|
857
857
|
className: ur(n, { "is-pressed": c }) || void 0,
|
|
858
858
|
"aria-hidden": !0,
|
|
859
859
|
focusable: !1
|
|
860
860
|
};
|
|
861
|
-
return /* @__PURE__ */ Ae.jsx("svg", { ...
|
|
861
|
+
return /* @__PURE__ */ Ae.jsx("svg", { ...R, ref: l });
|
|
862
862
|
}
|
|
863
863
|
);
|
|
864
864
|
nt.displayName = "SVG";
|
|
@@ -909,12 +909,12 @@ const Hr = /* @__PURE__ */ Ae.jsx(nt, {
|
|
|
909
909
|
};
|
|
910
910
|
function Dt(n) {
|
|
911
911
|
if (!n) return [];
|
|
912
|
-
const c = Jt(n), f = c.startsWith("/"), l = c.split("/").filter(Boolean),
|
|
912
|
+
const c = Jt(n), f = c.startsWith("/"), l = c.split("/").filter(Boolean), R = [];
|
|
913
913
|
let d = f ? "/" : "";
|
|
914
|
-
f &&
|
|
915
|
-
for (const
|
|
916
|
-
!d || d === "/" ? d = d === "/" ? `/${
|
|
917
|
-
return
|
|
914
|
+
f && R.push("/");
|
|
915
|
+
for (const P of l)
|
|
916
|
+
!d || d === "/" ? d = d === "/" ? `/${P}` : P : d = `${d}/${P}`, R.push(d);
|
|
917
|
+
return R;
|
|
918
918
|
}
|
|
919
919
|
function ze(n, c, f) {
|
|
920
920
|
return n && (n === c ? f : n.startsWith(c === "/" ? "/" : `${c}/`) ? f + n.slice(c.length) : n);
|
|
@@ -923,106 +923,106 @@ const nn = $t(function({
|
|
|
923
923
|
withContextMenu: c = !0,
|
|
924
924
|
readOnly: f = !1,
|
|
925
925
|
filesystem: l,
|
|
926
|
-
root:
|
|
926
|
+
root: R = "/wordpress",
|
|
927
927
|
initialSelectedPath: d,
|
|
928
|
-
onSelect:
|
|
928
|
+
onSelect: P = () => {
|
|
929
929
|
},
|
|
930
|
-
onDoubleClickFile:
|
|
931
|
-
},
|
|
932
|
-
const
|
|
930
|
+
onDoubleClickFile: A
|
|
931
|
+
}, T) {
|
|
932
|
+
const v = Ft(() => je("/", R || "/"), [R]), [D, _] = te(() => {
|
|
933
933
|
if (!d)
|
|
934
934
|
return {};
|
|
935
935
|
const t = {};
|
|
936
936
|
for (const a of Dt(d))
|
|
937
937
|
t[a] = !0;
|
|
938
938
|
return t;
|
|
939
|
-
}), [
|
|
939
|
+
}), [k, Z] = te(
|
|
940
940
|
() => d ?? null
|
|
941
|
-
), [
|
|
941
|
+
), [j, x] = te(
|
|
942
942
|
() => d ?? null
|
|
943
|
-
), [
|
|
943
|
+
), [K, W] = te({}), [m, V] = te(
|
|
944
944
|
{}
|
|
945
|
-
), [J,
|
|
945
|
+
), [J, ce] = te(null), [Q, g] = te(
|
|
946
946
|
null
|
|
947
|
-
), $ =
|
|
947
|
+
), $ = M({}), N = M(!1), h = M(null), O = M(null), G = M(m), re = M(K), I = () => {
|
|
948
948
|
for (const t of Object.keys($.current))
|
|
949
949
|
clearTimeout($.current[t]), delete $.current[t];
|
|
950
|
-
},
|
|
950
|
+
}, ee = (t) => {
|
|
951
951
|
const a = $.current[t];
|
|
952
952
|
a && (clearTimeout(a), delete $.current[t]);
|
|
953
953
|
};
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}, [
|
|
957
|
-
|
|
958
|
-
}, [
|
|
954
|
+
H(() => {
|
|
955
|
+
G.current = m;
|
|
956
|
+
}, [m]), H(() => {
|
|
957
|
+
re.current = K;
|
|
958
|
+
}, [K]);
|
|
959
959
|
const X = (t) => {
|
|
960
960
|
var o;
|
|
961
|
-
const a = (o =
|
|
961
|
+
const a = (o = h.current) == null ? void 0 : o.querySelector(
|
|
962
962
|
`[data-path="${CSS.escape(t)}"]`
|
|
963
963
|
);
|
|
964
964
|
a && typeof a.focus == "function" && (a.focus(), a.scrollIntoView({
|
|
965
965
|
behavior: "smooth",
|
|
966
966
|
block: "nearest"
|
|
967
967
|
}));
|
|
968
|
-
}, ve = (t, a = "") => a ? je(a, t.name) : je("/", t.name), me = (t, a) => t.children ? t.children :
|
|
968
|
+
}, ve = (t, a = "") => a ? je(a, t.name) : je("/", t.name), me = (t, a) => t.children ? t.children : K[a], Ne = async (t, a) => {
|
|
969
969
|
const o = await t.listFiles(a), i = [];
|
|
970
970
|
for (const u of o) {
|
|
971
|
-
const
|
|
972
|
-
i.push({ name: u, type:
|
|
971
|
+
const w = a === "/" ? `/${u}` : `${a}/${u}`, y = await t.isDir(w);
|
|
972
|
+
i.push({ name: u, type: y ? "folder" : "file" });
|
|
973
973
|
}
|
|
974
|
-
return i.sort((u,
|
|
974
|
+
return i.sort((u, w) => {
|
|
975
975
|
var e;
|
|
976
|
-
if (u.type !==
|
|
977
|
-
const
|
|
976
|
+
if (u.type !== w.type) return u.type === "folder" ? -1 : 1;
|
|
977
|
+
const y = a === "/" ? `/${u.name}` : `${a}/${u.name}`, oe = a === "/" ? `/${w.name}` : `${a}/${w.name}`, xe = (e = we.current) == null ? void 0 : e.tempPath;
|
|
978
978
|
if (xe) {
|
|
979
|
-
if (
|
|
980
|
-
if (
|
|
979
|
+
if (y === xe) return -1;
|
|
980
|
+
if (oe === xe) return 1;
|
|
981
981
|
}
|
|
982
|
-
return u.name.localeCompare(
|
|
982
|
+
return u.name.localeCompare(w.name);
|
|
983
983
|
}), i;
|
|
984
|
-
}, Pe = async (t) => await Ne(l, t),
|
|
984
|
+
}, Pe = async (t) => await Ne(l, t), ne = (t, a) => {
|
|
985
985
|
if (a.type !== "folder")
|
|
986
986
|
return a.children;
|
|
987
|
-
const o = a.children ??
|
|
988
|
-
return o ||
|
|
987
|
+
const o = a.children ?? re.current[t];
|
|
988
|
+
return o || G.current[t] ? o : (V((i) => ({ ...i, [t]: !0 })), new Promise((i) => {
|
|
989
989
|
Pe(t).then((u) => {
|
|
990
|
-
|
|
991
|
-
...
|
|
990
|
+
W((w) => ({
|
|
991
|
+
...w,
|
|
992
992
|
[t]: u ?? []
|
|
993
993
|
})), i(u ?? []);
|
|
994
994
|
}).catch(() => {
|
|
995
995
|
i([]);
|
|
996
996
|
}).finally(() => {
|
|
997
|
-
|
|
998
|
-
const
|
|
999
|
-
return delete
|
|
997
|
+
V((u) => {
|
|
998
|
+
const w = { ...u };
|
|
999
|
+
return delete w[t], w;
|
|
1000
1000
|
});
|
|
1001
1001
|
});
|
|
1002
1002
|
}));
|
|
1003
1003
|
}, Oe = (t, a) => {
|
|
1004
1004
|
a.type === "folder" && (typeof window > "u" || $.current[t] || ($.current[t] = window.setTimeout(() => {
|
|
1005
|
-
|
|
1005
|
+
_((o) => o[t] ? o : { ...o, [t]: !0 }), ne(t, a), delete $.current[t];
|
|
1006
1006
|
}, 600)));
|
|
1007
|
-
},
|
|
1007
|
+
}, ae = (t) => (V((a) => ({ ...a, [t]: !0 })), new Promise((a) => {
|
|
1008
1008
|
Pe(t).then((o) => {
|
|
1009
|
-
|
|
1009
|
+
W((i) => ({
|
|
1010
1010
|
...i,
|
|
1011
1011
|
[t]: o ?? []
|
|
1012
1012
|
})), a(o ?? []);
|
|
1013
1013
|
}).catch(() => {
|
|
1014
1014
|
a([]);
|
|
1015
1015
|
}).finally(() => {
|
|
1016
|
-
|
|
1016
|
+
V((o) => {
|
|
1017
1017
|
const i = { ...o };
|
|
1018
1018
|
return delete i[t], i;
|
|
1019
1019
|
});
|
|
1020
1020
|
});
|
|
1021
1021
|
})), Me = (t, a, o) => {
|
|
1022
|
-
|
|
1022
|
+
_((i) => ({
|
|
1023
1023
|
...i,
|
|
1024
1024
|
[t]: o
|
|
1025
|
-
})), o ?
|
|
1025
|
+
})), o ? ne(t, a) : W((i) => {
|
|
1026
1026
|
if (i[t] === void 0)
|
|
1027
1027
|
return i;
|
|
1028
1028
|
const u = { ...i };
|
|
@@ -1032,48 +1032,48 @@ const nn = $t(function({
|
|
|
1032
1032
|
if (!t) return;
|
|
1033
1033
|
const a = Dt(t);
|
|
1034
1034
|
if (a.length === 0) return;
|
|
1035
|
-
|
|
1036
|
-
const
|
|
1037
|
-
for (const
|
|
1038
|
-
|
|
1039
|
-
return
|
|
1035
|
+
_((u) => {
|
|
1036
|
+
const w = { ...u };
|
|
1037
|
+
for (const y of a)
|
|
1038
|
+
w[y] = !0;
|
|
1039
|
+
return w;
|
|
1040
1040
|
});
|
|
1041
1041
|
let o = [
|
|
1042
|
-
{ name:
|
|
1042
|
+
{ name: v, type: "folder" }
|
|
1043
1043
|
], i = "";
|
|
1044
1044
|
for (const u of a) {
|
|
1045
|
-
const
|
|
1046
|
-
if (!
|
|
1045
|
+
const w = o == null ? void 0 : o.find((oe) => ve(oe, i) === u);
|
|
1046
|
+
if (!w || w.type !== "folder") {
|
|
1047
1047
|
i = u, o = [];
|
|
1048
1048
|
continue;
|
|
1049
1049
|
}
|
|
1050
|
-
o = await
|
|
1050
|
+
o = await ne(u, w) ?? re.current[u], i = u;
|
|
1051
1051
|
}
|
|
1052
1052
|
}, ke = (t, a) => {
|
|
1053
|
-
!t || !a || t === a || (
|
|
1053
|
+
!t || !a || t === a || (_((o) => {
|
|
1054
1054
|
let i = !1;
|
|
1055
1055
|
const u = { ...o };
|
|
1056
|
-
for (const
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1056
|
+
for (const w of Object.keys(o)) {
|
|
1057
|
+
const y = ze(w, t, a);
|
|
1058
|
+
y && y !== w && (u[y] = o[w], delete u[w], i = !0);
|
|
1059
1059
|
}
|
|
1060
1060
|
return i ? u : o;
|
|
1061
|
-
}),
|
|
1061
|
+
}), W((o) => {
|
|
1062
1062
|
let i = !1;
|
|
1063
1063
|
const u = { ...o };
|
|
1064
|
-
for (const
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1064
|
+
for (const w of Object.keys(o)) {
|
|
1065
|
+
const y = ze(w, t, a);
|
|
1066
|
+
y && y !== w && (u[y] = o[w], delete u[w], i = !0);
|
|
1067
1067
|
}
|
|
1068
1068
|
return i ? u : o;
|
|
1069
|
-
}),
|
|
1069
|
+
}), Z((o) => ze(o, t, a)), x((o) => ze(o, t, a)));
|
|
1070
1070
|
}, Fe = () => {
|
|
1071
|
-
|
|
1071
|
+
ce(null), g(null), I();
|
|
1072
1072
|
}, Se = (t, a = !0) => {
|
|
1073
|
-
|
|
1074
|
-
},
|
|
1073
|
+
Z(t), a && P(t);
|
|
1074
|
+
}, de = Ft(() => [{ name: v, type: "folder" }], [v]), [U, E] = te(null), [he, pe] = te(null), we = M(null), b = f ? null : he;
|
|
1075
1075
|
Wt(
|
|
1076
|
-
|
|
1076
|
+
T,
|
|
1077
1077
|
() => ({
|
|
1078
1078
|
focusPath: (t, a = {}) => {
|
|
1079
1079
|
if (!t) return;
|
|
@@ -1082,14 +1082,14 @@ const nn = $t(function({
|
|
|
1082
1082
|
domFocus: i = !0,
|
|
1083
1083
|
notify: u = !1
|
|
1084
1084
|
} = a;
|
|
1085
|
-
o && Se(t, u),
|
|
1085
|
+
o && Se(t, u), x(t), i && X(t);
|
|
1086
1086
|
},
|
|
1087
1087
|
selectPath: (t) => {
|
|
1088
|
-
t && (Se(t),
|
|
1088
|
+
t && (Se(t), x(t), X(t));
|
|
1089
1089
|
},
|
|
1090
|
-
getSelectedPath: () =>
|
|
1090
|
+
getSelectedPath: () => k,
|
|
1091
1091
|
expandToPath: async (t) => await _e(t),
|
|
1092
|
-
refresh: async (t) => await
|
|
1092
|
+
refresh: async (t) => await ae(t),
|
|
1093
1093
|
remapPath: ke,
|
|
1094
1094
|
createFile: async (t) => {
|
|
1095
1095
|
f || await Ye(t, "file", "untitled.php");
|
|
@@ -1104,61 +1104,61 @@ const nn = $t(function({
|
|
|
1104
1104
|
f || await Ke(t, a);
|
|
1105
1105
|
}
|
|
1106
1106
|
}),
|
|
1107
|
-
[
|
|
1107
|
+
[k, ae, ke, _e, f]
|
|
1108
1108
|
);
|
|
1109
|
-
const
|
|
1109
|
+
const S = M(!1), ie = M(
|
|
1110
1110
|
d ?? null
|
|
1111
|
-
), le =
|
|
1112
|
-
|
|
1111
|
+
), le = M(d);
|
|
1112
|
+
H(() => {
|
|
1113
1113
|
N.current = !1;
|
|
1114
|
-
}, [
|
|
1114
|
+
}, [v]), H(() => {
|
|
1115
1115
|
d && d !== le.current ? ie.current = d : d || (ie.current = null), le.current = d;
|
|
1116
|
-
}, [d]),
|
|
1117
|
-
if (!d ||
|
|
1116
|
+
}, [d]), H(() => {
|
|
1117
|
+
if (!d || S.current)
|
|
1118
1118
|
return;
|
|
1119
|
-
|
|
1119
|
+
S.current = !0;
|
|
1120
1120
|
const t = Dt(d);
|
|
1121
|
-
|
|
1121
|
+
_((o) => {
|
|
1122
1122
|
const i = { ...o };
|
|
1123
1123
|
for (const u of t)
|
|
1124
1124
|
i[u] = !0;
|
|
1125
1125
|
return i;
|
|
1126
1126
|
});
|
|
1127
1127
|
const a = t[t.length - 1] || d;
|
|
1128
|
-
|
|
1129
|
-
}, [d, _e]),
|
|
1128
|
+
x(a), Z(a), _e(d);
|
|
1129
|
+
}, [d, _e]), H(() => {
|
|
1130
1130
|
const t = ie.current;
|
|
1131
|
-
!t ||
|
|
1132
|
-
}, [
|
|
1133
|
-
if (!
|
|
1134
|
-
if (
|
|
1135
|
-
const t = ve(
|
|
1136
|
-
|
|
1131
|
+
!t || de.length === 0 || (ie.current = null, _e(t));
|
|
1132
|
+
}, [de, _e]), H(() => {
|
|
1133
|
+
if (!j) {
|
|
1134
|
+
if (de.length > 0) {
|
|
1135
|
+
const t = ve(de[0]);
|
|
1136
|
+
x(t);
|
|
1137
1137
|
}
|
|
1138
1138
|
return;
|
|
1139
1139
|
}
|
|
1140
|
-
b && b ===
|
|
1141
|
-
}, [
|
|
1142
|
-
if (
|
|
1140
|
+
b && b === j || X(j);
|
|
1141
|
+
}, [de, j, b]), H(() => {
|
|
1142
|
+
if (de.length === 0)
|
|
1143
1143
|
return;
|
|
1144
|
-
const t =
|
|
1144
|
+
const t = de[0];
|
|
1145
1145
|
if ((t == null ? void 0 : t.type) !== "folder" || N.current)
|
|
1146
1146
|
return;
|
|
1147
1147
|
const a = t.name;
|
|
1148
|
-
N.current = !0,
|
|
1148
|
+
N.current = !0, _(
|
|
1149
1149
|
(o) => o[a] ? o : { ...o, [a]: !0 }
|
|
1150
|
-
), !
|
|
1151
|
-
}, [
|
|
1152
|
-
|
|
1153
|
-
}, []),
|
|
1154
|
-
|
|
1150
|
+
), !re.current[a] && !G.current[a] && ne(a, t);
|
|
1151
|
+
}, [de, ne, v]), H(() => () => {
|
|
1152
|
+
O.current && clearTimeout(O.current), I();
|
|
1153
|
+
}, []), H(() => {
|
|
1154
|
+
U && setTimeout(() => {
|
|
1155
1155
|
const t = document.querySelector(
|
|
1156
1156
|
'[role="menu"] [role="menuitem"]'
|
|
1157
1157
|
);
|
|
1158
1158
|
t && typeof t.focus == "function" && t.focus();
|
|
1159
1159
|
}, 0);
|
|
1160
|
-
}, [
|
|
1161
|
-
const [
|
|
1160
|
+
}, [U]);
|
|
1161
|
+
const [ue, be] = te(""), $e = (t, a) => {
|
|
1162
1162
|
if (t.type === "folder")
|
|
1163
1163
|
return a;
|
|
1164
1164
|
const o = Le(a);
|
|
@@ -1167,7 +1167,7 @@ const nn = $t(function({
|
|
|
1167
1167
|
const i = $e(t, a);
|
|
1168
1168
|
return i ? o && Xt(o, i) ? { allowed: !1, state: "invalid", destination: null } : { allowed: !0, state: "valid", destination: i } : { allowed: !1, state: "invalid", destination: null };
|
|
1169
1169
|
}, Ie = (t, a, o) => {
|
|
1170
|
-
a.type !== "folder" && a.type !== "file" || (
|
|
1170
|
+
a.type !== "folder" && a.type !== "file" || (ce(o), g(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
|
|
1171
1171
|
"application/x-wp-playground-path",
|
|
1172
1172
|
o
|
|
1173
1173
|
), t.dataTransfer.setData("text/plain", o)));
|
|
@@ -1178,9 +1178,9 @@ const nn = $t(function({
|
|
|
1178
1178
|
i.allowed && a.type === "folder" && Oe(o, a), g((u) => (u == null ? void 0 : u.path) === o && u.state === i.state ? u : { path: o, state: i.state });
|
|
1179
1179
|
}, ft = (t, a, o) => {
|
|
1180
1180
|
const i = ge(a, o, J);
|
|
1181
|
-
i.allowed && i.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = J ? "move" : "copy"), a.type === "folder" && Oe(o, a), g((u) => (u == null ? void 0 : u.path) === o && u.state === i.state ? u : { path: o, state: i.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"),
|
|
1181
|
+
i.allowed && i.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = J ? "move" : "copy"), a.type === "folder" && Oe(o, a), g((u) => (u == null ? void 0 : u.path) === o && u.state === i.state ? u : { path: o, state: i.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), ee(o), g((u) => (u == null ? void 0 : u.path) === o && u.state === "invalid" ? u : { path: o, state: "invalid" }));
|
|
1182
1182
|
}, dt = (t, a, o) => {
|
|
1183
|
-
|
|
1183
|
+
ee(o);
|
|
1184
1184
|
const i = t.relatedTarget;
|
|
1185
1185
|
i && t.currentTarget.contains(i) || g((u) => (u == null ? void 0 : u.path) === o ? null : u);
|
|
1186
1186
|
}, Et = async (t, a, o) => {
|
|
@@ -1189,7 +1189,7 @@ const nn = $t(function({
|
|
|
1189
1189
|
Fe();
|
|
1190
1190
|
return;
|
|
1191
1191
|
}
|
|
1192
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1192
|
+
t.preventDefault(), t.stopPropagation(), ee(o), g(null);
|
|
1193
1193
|
try {
|
|
1194
1194
|
i ? await bt(i, u.destination) : await Ke(
|
|
1195
1195
|
t.dataTransfer,
|
|
@@ -1199,7 +1199,7 @@ const nn = $t(function({
|
|
|
1199
1199
|
Fe();
|
|
1200
1200
|
}
|
|
1201
1201
|
}, mt = (t, a, o) => {
|
|
1202
|
-
c && (t.preventDefault(), t.stopPropagation(), pe(null),
|
|
1202
|
+
c && (t.preventDefault(), t.stopPropagation(), pe(null), E({
|
|
1203
1203
|
absPath: o,
|
|
1204
1204
|
type: a.type,
|
|
1205
1205
|
x: t.clientX,
|
|
@@ -1207,27 +1207,27 @@ const nn = $t(function({
|
|
|
1207
1207
|
}));
|
|
1208
1208
|
}, We = async (t, a) => {
|
|
1209
1209
|
let o = a, i = 0;
|
|
1210
|
-
const u = (
|
|
1211
|
-
const
|
|
1212
|
-
return
|
|
1213
|
-
},
|
|
1214
|
-
for (; await (l == null ? void 0 : l.fileExists(`${
|
|
1210
|
+
const u = (y) => {
|
|
1211
|
+
const oe = y.lastIndexOf(".");
|
|
1212
|
+
return oe > 0 ? { stem: y.slice(0, oe), ext: y.slice(oe) } : { stem: y, ext: "" };
|
|
1213
|
+
}, w = t === "/" ? "" : t;
|
|
1214
|
+
for (; await (l == null ? void 0 : l.fileExists(`${w}/${o}`)) || await (l == null ? void 0 : l.isDir(`${w}/${o}`)); ) {
|
|
1215
1215
|
i += 1;
|
|
1216
|
-
const { stem:
|
|
1217
|
-
o = `${
|
|
1216
|
+
const { stem: y, ext: oe } = u(a);
|
|
1217
|
+
o = `${y} (${i})${oe}`;
|
|
1218
1218
|
}
|
|
1219
1219
|
return o;
|
|
1220
1220
|
}, Ye = async (t, a, o) => {
|
|
1221
1221
|
if (!l) return;
|
|
1222
|
-
let i = t ||
|
|
1222
|
+
let i = t || k || v;
|
|
1223
1223
|
try {
|
|
1224
1224
|
await l.isDir(i) || (i = Le(i));
|
|
1225
1225
|
} catch {
|
|
1226
1226
|
i = Le(i);
|
|
1227
1227
|
}
|
|
1228
|
-
const u = i,
|
|
1229
|
-
a === "folder" ? await l.mkdir(
|
|
1230
|
-
|
|
1228
|
+
const u = i, w = await We(u, o), y = je(u, w);
|
|
1229
|
+
a === "folder" ? await l.mkdir(y) : await l.writeFile(y, ""), we.current = { type: a, tempPath: y }, pe(y), await ae(u), setTimeout(() => {
|
|
1230
|
+
x(y), X(y);
|
|
1231
1231
|
}, 0);
|
|
1232
1232
|
}, yt = async (t) => {
|
|
1233
1233
|
if (!l) return !1;
|
|
@@ -1258,21 +1258,21 @@ const nn = $t(function({
|
|
|
1258
1258
|
const u = Le(t);
|
|
1259
1259
|
try {
|
|
1260
1260
|
await l.mv(t, i), ke(t, i);
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1261
|
+
const w = ze(
|
|
1262
|
+
k,
|
|
1263
1263
|
t,
|
|
1264
1264
|
i
|
|
1265
1265
|
);
|
|
1266
|
-
|
|
1267
|
-
(
|
|
1268
|
-
),
|
|
1269
|
-
...
|
|
1266
|
+
k && (k === t || k.startsWith(`${t}/`)) && P(w), x(
|
|
1267
|
+
(y) => ze(y, t, i)
|
|
1268
|
+
), _((y) => ({
|
|
1269
|
+
...y,
|
|
1270
1270
|
[a]: !0
|
|
1271
1271
|
})), await Promise.all([
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
]),
|
|
1275
|
-
(
|
|
1272
|
+
ae(u),
|
|
1273
|
+
ae(a)
|
|
1274
|
+
]), Z(
|
|
1275
|
+
(y) => ze(y, t, i)
|
|
1276
1276
|
), X(i);
|
|
1277
1277
|
} catch {
|
|
1278
1278
|
}
|
|
@@ -1283,8 +1283,8 @@ const nn = $t(function({
|
|
|
1283
1283
|
t.file(a, o);
|
|
1284
1284
|
}), pt = async (t, a) => {
|
|
1285
1285
|
if (!l) return;
|
|
1286
|
-
const o = t.name || "untitled", i = await We(a, o), u = je(a, i),
|
|
1287
|
-
await l.writeFile(u,
|
|
1286
|
+
const o = t.name || "untitled", i = await We(a, o), u = je(a, i), w = new Uint8Array(await t.arrayBuffer());
|
|
1287
|
+
await l.writeFile(u, w);
|
|
1288
1288
|
}, Ze = async (t, a) => {
|
|
1289
1289
|
const o = await Ct(t);
|
|
1290
1290
|
await pt(o, a);
|
|
@@ -1294,27 +1294,27 @@ const nn = $t(function({
|
|
|
1294
1294
|
t.name || "New Folder"
|
|
1295
1295
|
), i = je(a, o);
|
|
1296
1296
|
await _t(i);
|
|
1297
|
-
const u = t.createReader(),
|
|
1297
|
+
const u = t.createReader(), w = () => new Promise((y, oe) => {
|
|
1298
1298
|
u.readEntries(
|
|
1299
|
-
(xe) =>
|
|
1300
|
-
|
|
1299
|
+
(xe) => y(Array.from(xe)),
|
|
1300
|
+
oe
|
|
1301
1301
|
);
|
|
1302
1302
|
});
|
|
1303
1303
|
for (; ; ) {
|
|
1304
|
-
const
|
|
1305
|
-
if (!
|
|
1304
|
+
const y = await w();
|
|
1305
|
+
if (!y.length)
|
|
1306
1306
|
break;
|
|
1307
|
-
for (const
|
|
1308
|
-
|
|
1309
|
-
|
|
1307
|
+
for (const oe of y)
|
|
1308
|
+
oe.isFile ? await Ze(
|
|
1309
|
+
oe,
|
|
1310
1310
|
i
|
|
1311
|
-
) :
|
|
1312
|
-
|
|
1311
|
+
) : oe.isDirectory && await ot(
|
|
1312
|
+
oe,
|
|
1313
1313
|
i
|
|
1314
1314
|
);
|
|
1315
1315
|
}
|
|
1316
1316
|
}, Ve = (t, a) => qe([], t, a), Ke = (t, a) => {
|
|
1317
|
-
const i = Array.from(t.items).filter((
|
|
1317
|
+
const i = Array.from(t.items).filter((w) => w.kind === "file").map((w) => xt(w)).filter((w) => !!w), u = Array.from(t.files);
|
|
1318
1318
|
return qe(i, u, a);
|
|
1319
1319
|
}, qe = async (t, a, o) => {
|
|
1320
1320
|
if (l) {
|
|
@@ -1330,7 +1330,7 @@ const nn = $t(function({
|
|
|
1330
1330
|
else
|
|
1331
1331
|
for (const i of a)
|
|
1332
1332
|
await pt(i, o);
|
|
1333
|
-
await
|
|
1333
|
+
await ae(o), _((i) => ({
|
|
1334
1334
|
...i,
|
|
1335
1335
|
[o]: !0
|
|
1336
1336
|
}));
|
|
@@ -1338,20 +1338,20 @@ const nn = $t(function({
|
|
|
1338
1338
|
}, ht = async (t, a) => {
|
|
1339
1339
|
if (!l) return;
|
|
1340
1340
|
const o = t;
|
|
1341
|
-
|
|
1341
|
+
E(null);
|
|
1342
1342
|
try {
|
|
1343
1343
|
a === "folder" ? await l.rmdir(o, { recursive: !0 }) : await l.unlink(o);
|
|
1344
1344
|
} catch {
|
|
1345
1345
|
} finally {
|
|
1346
1346
|
pe(null);
|
|
1347
1347
|
const i = Le(o);
|
|
1348
|
-
await
|
|
1348
|
+
await ae(i), k && (k === o || k.startsWith(`${o}/`)) && P(null);
|
|
1349
1349
|
}
|
|
1350
1350
|
}, Rt = async (t) => {
|
|
1351
1351
|
if (l)
|
|
1352
1352
|
try {
|
|
1353
|
-
const o = await (await l.read(t)).arrayBuffer(), i = new Blob([o]), u = URL.createObjectURL(i),
|
|
1354
|
-
|
|
1353
|
+
const o = await (await l.read(t)).arrayBuffer(), i = new Blob([o]), u = URL.createObjectURL(i), w = document.createElement("a");
|
|
1354
|
+
w.href = u, w.download = et(t) || "download", document.body.appendChild(w), w.click(), document.body.removeChild(w), setTimeout(() => URL.revokeObjectURL(u), 6e4);
|
|
1355
1355
|
} catch (a) {
|
|
1356
1356
|
console.error("Failed to download file", a);
|
|
1357
1357
|
}
|
|
@@ -1359,29 +1359,29 @@ const nn = $t(function({
|
|
|
1359
1359
|
var a;
|
|
1360
1360
|
if (!he)
|
|
1361
1361
|
if (t.key.length === 1 && t.key.match(/\S/)) {
|
|
1362
|
-
const o =
|
|
1363
|
-
if (be(o),
|
|
1362
|
+
const o = ue + t.key.toLowerCase();
|
|
1363
|
+
if (be(o), O.current && clearTimeout(O.current), O.current = setTimeout(() => {
|
|
1364
1364
|
be("");
|
|
1365
|
-
}, 1e3), !
|
|
1365
|
+
}, 1e3), !h.current)
|
|
1366
1366
|
return;
|
|
1367
1367
|
const i = Array.from(
|
|
1368
|
-
|
|
1368
|
+
h.current.querySelectorAll(".file-node-button")
|
|
1369
1369
|
), u = document.activeElement;
|
|
1370
|
-
let
|
|
1371
|
-
u && i.includes(u) && (
|
|
1370
|
+
let w = 0;
|
|
1371
|
+
u && i.includes(u) && (w = i.indexOf(
|
|
1372
1372
|
u
|
|
1373
1373
|
));
|
|
1374
|
-
for (let
|
|
1375
|
-
const
|
|
1374
|
+
for (let y = 0; y < i.length; y++) {
|
|
1375
|
+
const oe = (w + y) % i.length, xe = i[oe];
|
|
1376
1376
|
if ((a = xe.textContent) != null && a.toLowerCase().trim().startsWith(o)) {
|
|
1377
1377
|
xe.focus();
|
|
1378
1378
|
const e = xe.getAttribute("data-path");
|
|
1379
|
-
e &&
|
|
1379
|
+
e && x(e);
|
|
1380
1380
|
break;
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
} else
|
|
1384
|
-
be(""),
|
|
1384
|
+
be(""), O.current && clearTimeout(O.current);
|
|
1385
1385
|
}, kt = async (t, a) => {
|
|
1386
1386
|
if (f) return;
|
|
1387
1387
|
const o = we.current, i = (o == null ? void 0 : o.tempPath) === t, u = Le(t);
|
|
@@ -1398,24 +1398,24 @@ const nn = $t(function({
|
|
|
1398
1398
|
pe(i ? null : t);
|
|
1399
1399
|
return;
|
|
1400
1400
|
}
|
|
1401
|
-
let
|
|
1402
|
-
if (
|
|
1401
|
+
let w = je(u, a), y = w;
|
|
1402
|
+
if (y === t) {
|
|
1403
1403
|
pe(null);
|
|
1404
1404
|
const s = i && (o == null ? void 0 : o.type) === "file";
|
|
1405
1405
|
i && (we.current = null), setTimeout(() => {
|
|
1406
|
-
|
|
1406
|
+
x(y), X(y), s && A && A(y);
|
|
1407
1407
|
}, 0);
|
|
1408
1408
|
return;
|
|
1409
1409
|
}
|
|
1410
|
-
const
|
|
1411
|
-
if ((
|
|
1410
|
+
const oe = await l.fileExists(y), xe = await l.isDir(y);
|
|
1411
|
+
if ((oe || xe) && y !== t)
|
|
1412
1412
|
if (i)
|
|
1413
1413
|
try {
|
|
1414
1414
|
const s = await We(
|
|
1415
1415
|
u === "/" ? "/" : u,
|
|
1416
1416
|
a
|
|
1417
1417
|
);
|
|
1418
|
-
|
|
1418
|
+
w = je(u, s), y = w;
|
|
1419
1419
|
} catch {
|
|
1420
1420
|
}
|
|
1421
1421
|
else {
|
|
@@ -1424,7 +1424,7 @@ const nn = $t(function({
|
|
|
1424
1424
|
}
|
|
1425
1425
|
let e = (o == null ? void 0 : o.type) === "folder";
|
|
1426
1426
|
try {
|
|
1427
|
-
await l.mv(t,
|
|
1427
|
+
await l.mv(t, w), o || (e = await l.isDir(w)), e && ke(t, y), k === t && P(y), await ae(u), x(y), X(y), i && !e && A && A(y);
|
|
1428
1428
|
} catch {
|
|
1429
1429
|
if (i)
|
|
1430
1430
|
try {
|
|
@@ -1448,21 +1448,21 @@ const nn = $t(function({
|
|
|
1448
1448
|
}
|
|
1449
1449
|
we.current = null, pe(null);
|
|
1450
1450
|
const o = Le(t);
|
|
1451
|
-
await
|
|
1451
|
+
await ae(o), x(o), X(o);
|
|
1452
1452
|
};
|
|
1453
|
-
return /* @__PURE__ */ r.createElement("div", { onKeyDown: vt, ref:
|
|
1453
|
+
return /* @__PURE__ */ r.createElement("div", { onKeyDown: vt, ref: h }, /* @__PURE__ */ r.createElement(er, { className: Re.filePickerTree }, de.map((t, a) => /* @__PURE__ */ r.createElement(
|
|
1454
1454
|
zt,
|
|
1455
1455
|
{
|
|
1456
1456
|
key: t.name,
|
|
1457
1457
|
node: t,
|
|
1458
1458
|
level: 0,
|
|
1459
1459
|
position: a + 1,
|
|
1460
|
-
setSize:
|
|
1461
|
-
expandedNodePaths:
|
|
1460
|
+
setSize: de.length,
|
|
1461
|
+
expandedNodePaths: D,
|
|
1462
1462
|
onToggle: Me,
|
|
1463
|
-
selectedNode:
|
|
1464
|
-
focusPath: (o) =>
|
|
1465
|
-
focusedNode:
|
|
1463
|
+
selectedNode: k,
|
|
1464
|
+
focusPath: (o) => x(o),
|
|
1465
|
+
focusedNode: j,
|
|
1466
1466
|
selectPath: Se,
|
|
1467
1467
|
generatePath: ve,
|
|
1468
1468
|
getChildren: me,
|
|
@@ -1470,31 +1470,31 @@ const nn = $t(function({
|
|
|
1470
1470
|
renamingPath: b,
|
|
1471
1471
|
onRename: kt,
|
|
1472
1472
|
onRenameCancel: wt,
|
|
1473
|
-
dropIndicator:
|
|
1473
|
+
dropIndicator: Q,
|
|
1474
1474
|
onDragStart: f ? void 0 : Ie,
|
|
1475
1475
|
onDragEnd: f ? void 0 : at,
|
|
1476
1476
|
onDragEnter: f ? void 0 : Ge,
|
|
1477
1477
|
onDragOver: f ? void 0 : ft,
|
|
1478
1478
|
onDragLeave: f ? void 0 : dt,
|
|
1479
1479
|
onDrop: f ? void 0 : Et,
|
|
1480
|
-
rootPath:
|
|
1481
|
-
onDoubleClickFile:
|
|
1480
|
+
rootPath: v,
|
|
1481
|
+
onDoubleClickFile: A
|
|
1482
1482
|
}
|
|
1483
|
-
))), !f &&
|
|
1483
|
+
))), !f && U && /* @__PURE__ */ r.createElement(
|
|
1484
1484
|
tr,
|
|
1485
1485
|
{
|
|
1486
1486
|
placement: "bottom-start",
|
|
1487
|
-
onClose: () =>
|
|
1487
|
+
onClose: () => E(null),
|
|
1488
1488
|
anchor: {
|
|
1489
1489
|
getBoundingClientRect: () => ({
|
|
1490
|
-
x:
|
|
1491
|
-
y:
|
|
1490
|
+
x: U.x,
|
|
1491
|
+
y: U.y,
|
|
1492
1492
|
width: 0,
|
|
1493
1493
|
height: 0,
|
|
1494
|
-
top:
|
|
1495
|
-
left:
|
|
1496
|
-
right:
|
|
1497
|
-
bottom:
|
|
1494
|
+
top: U.y,
|
|
1495
|
+
left: U.x,
|
|
1496
|
+
right: U.x,
|
|
1497
|
+
bottom: U.y,
|
|
1498
1498
|
toJSON: () => ({})
|
|
1499
1499
|
}),
|
|
1500
1500
|
ownerDocument: document
|
|
@@ -1503,26 +1503,26 @@ const nn = $t(function({
|
|
|
1503
1503
|
resize: !1,
|
|
1504
1504
|
focusOnMount: "firstElement"
|
|
1505
1505
|
},
|
|
1506
|
-
/* @__PURE__ */ r.createElement(rr, { role: "menu" },
|
|
1506
|
+
/* @__PURE__ */ r.createElement(rr, { role: "menu" }, U.type === "folder" && /* @__PURE__ */ r.createElement(
|
|
1507
1507
|
it,
|
|
1508
1508
|
{
|
|
1509
1509
|
role: "menuitem",
|
|
1510
1510
|
onClick: async () => {
|
|
1511
|
-
|
|
1512
|
-
|
|
1511
|
+
E(null), await Ye(
|
|
1512
|
+
U.absPath,
|
|
1513
1513
|
"file",
|
|
1514
1514
|
"untitled.php"
|
|
1515
1515
|
);
|
|
1516
1516
|
}
|
|
1517
1517
|
},
|
|
1518
1518
|
"Create file"
|
|
1519
|
-
),
|
|
1519
|
+
), U.type === "folder" && /* @__PURE__ */ r.createElement(
|
|
1520
1520
|
it,
|
|
1521
1521
|
{
|
|
1522
1522
|
role: "menuitem",
|
|
1523
1523
|
onClick: async () => {
|
|
1524
|
-
|
|
1525
|
-
|
|
1524
|
+
E(null), await Ye(
|
|
1525
|
+
U.absPath,
|
|
1526
1526
|
"folder",
|
|
1527
1527
|
"New Folder"
|
|
1528
1528
|
);
|
|
@@ -1534,17 +1534,17 @@ const nn = $t(function({
|
|
|
1534
1534
|
{
|
|
1535
1535
|
role: "menuitem",
|
|
1536
1536
|
onClick: () => {
|
|
1537
|
-
|
|
1537
|
+
E(null), pe(U.absPath);
|
|
1538
1538
|
}
|
|
1539
1539
|
},
|
|
1540
1540
|
"Rename"
|
|
1541
|
-
),
|
|
1541
|
+
), U.type === "file" && /* @__PURE__ */ r.createElement(
|
|
1542
1542
|
it,
|
|
1543
1543
|
{
|
|
1544
1544
|
role: "menuitem",
|
|
1545
1545
|
onClick: async () => {
|
|
1546
|
-
|
|
1547
|
-
|
|
1546
|
+
E(null), await Rt(
|
|
1547
|
+
U.absPath
|
|
1548
1548
|
);
|
|
1549
1549
|
}
|
|
1550
1550
|
},
|
|
@@ -1554,8 +1554,8 @@ const nn = $t(function({
|
|
|
1554
1554
|
{
|
|
1555
1555
|
role: "menuitem",
|
|
1556
1556
|
onClick: () => ht(
|
|
1557
|
-
|
|
1558
|
-
|
|
1557
|
+
U.absPath,
|
|
1558
|
+
U.type
|
|
1559
1559
|
)
|
|
1560
1560
|
},
|
|
1561
1561
|
"Delete"
|
|
@@ -1566,56 +1566,56 @@ const nn = $t(function({
|
|
|
1566
1566
|
level: c,
|
|
1567
1567
|
position: f,
|
|
1568
1568
|
setSize: l,
|
|
1569
|
-
expandedNodePaths:
|
|
1569
|
+
expandedNodePaths: R,
|
|
1570
1570
|
onToggle: d,
|
|
1571
|
-
selectedNode:
|
|
1572
|
-
focusPath:
|
|
1573
|
-
focusedNode:
|
|
1574
|
-
selectPath:
|
|
1575
|
-
generatePath:
|
|
1576
|
-
getChildren:
|
|
1577
|
-
onContextMenu:
|
|
1578
|
-
renamingPath:
|
|
1579
|
-
onRename:
|
|
1580
|
-
onRenameCancel:
|
|
1581
|
-
parentPath:
|
|
1582
|
-
dropIndicator:
|
|
1583
|
-
onDragStart:
|
|
1584
|
-
onDragEnd:
|
|
1571
|
+
selectedNode: P,
|
|
1572
|
+
focusPath: A,
|
|
1573
|
+
focusedNode: T,
|
|
1574
|
+
selectPath: v,
|
|
1575
|
+
generatePath: D,
|
|
1576
|
+
getChildren: _,
|
|
1577
|
+
onContextMenu: k,
|
|
1578
|
+
renamingPath: Z,
|
|
1579
|
+
onRename: j,
|
|
1580
|
+
onRenameCancel: x,
|
|
1581
|
+
parentPath: K = "",
|
|
1582
|
+
dropIndicator: W,
|
|
1583
|
+
onDragStart: m,
|
|
1584
|
+
onDragEnd: V,
|
|
1585
1585
|
onDragEnter: J,
|
|
1586
|
-
onDragOver:
|
|
1587
|
-
onDragLeave:
|
|
1586
|
+
onDragOver: ce,
|
|
1587
|
+
onDragLeave: Q,
|
|
1588
1588
|
onDrop: g,
|
|
1589
1589
|
rootPath: $,
|
|
1590
1590
|
onDoubleClickFile: N
|
|
1591
1591
|
}) => {
|
|
1592
|
-
const
|
|
1593
|
-
onDragEnter: (
|
|
1594
|
-
onDragOver: (
|
|
1595
|
-
onDragLeave: (
|
|
1596
|
-
onDrop: (
|
|
1597
|
-
},
|
|
1598
|
-
|
|
1599
|
-
var
|
|
1600
|
-
|
|
1592
|
+
const h = D(n, K), O = R[h], G = Z === h, re = M(null), [I, ee] = te(n.name), X = M(!1), ve = (W == null ? void 0 : W.path) === h, me = ve && (W == null ? void 0 : W.state) === "valid", Ne = ve && (W == null ? void 0 : W.state) === "invalid", Pe = !!m && !G && h !== $, ne = M(null), Oe = {
|
|
1593
|
+
onDragEnter: (E) => J == null ? void 0 : J(E, n, h),
|
|
1594
|
+
onDragOver: (E) => ce == null ? void 0 : ce(E, n, h),
|
|
1595
|
+
onDragLeave: (E) => Q == null ? void 0 : Q(E, n, h),
|
|
1596
|
+
onDrop: (E) => g == null ? void 0 : g(E, n, h)
|
|
1597
|
+
}, ae = _(n, h) ?? [];
|
|
1598
|
+
H(() => {
|
|
1599
|
+
var E;
|
|
1600
|
+
G ? (ee(n.name), X.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
|
|
1601
1601
|
var he;
|
|
1602
|
-
(he =
|
|
1603
|
-
}) : (
|
|
1604
|
-
}, [
|
|
1602
|
+
(he = re.current) == null || he.select();
|
|
1603
|
+
}) : (E = re.current) == null || E.select()) : X.current = !1;
|
|
1604
|
+
}, [G, n.name]);
|
|
1605
1605
|
const Me = () => {
|
|
1606
|
-
n.type === "folder" && d(
|
|
1607
|
-
}, _e = (
|
|
1606
|
+
n.type === "folder" && d(h, n, !O);
|
|
1607
|
+
}, _e = (E) => {
|
|
1608
1608
|
var he, pe;
|
|
1609
|
-
if (
|
|
1610
|
-
|
|
1611
|
-
`[data-path="${CSS.escape(
|
|
1612
|
-
)) == null || he.focus(),
|
|
1613
|
-
else if (
|
|
1614
|
-
if (
|
|
1615
|
-
if (
|
|
1616
|
-
const we =
|
|
1617
|
-
|
|
1618
|
-
|
|
1609
|
+
if (E.key === "ArrowLeft")
|
|
1610
|
+
O ? Me() : (he = document.querySelector(
|
|
1611
|
+
`[data-path="${CSS.escape(K)}"]`
|
|
1612
|
+
)) == null || he.focus(), E.preventDefault(), E.stopPropagation();
|
|
1613
|
+
else if (E.key === "ArrowRight") {
|
|
1614
|
+
if (O) {
|
|
1615
|
+
if (ae != null && ae.length) {
|
|
1616
|
+
const we = D(
|
|
1617
|
+
ae[0],
|
|
1618
|
+
h
|
|
1619
1619
|
);
|
|
1620
1620
|
(pe = document.querySelector(
|
|
1621
1621
|
`[data-path="${CSS.escape(we)}"]`
|
|
@@ -1623,36 +1623,36 @@ const nn = $t(function({
|
|
|
1623
1623
|
}
|
|
1624
1624
|
} else
|
|
1625
1625
|
Me();
|
|
1626
|
-
|
|
1627
|
-
} else
|
|
1628
|
-
}, ke = (
|
|
1629
|
-
|
|
1630
|
-
}, Fe = (
|
|
1631
|
-
|
|
1632
|
-
}, Se = (
|
|
1633
|
-
if (
|
|
1634
|
-
|
|
1626
|
+
E.preventDefault(), E.stopPropagation();
|
|
1627
|
+
} else E.key === " " || E.key === "Space" || E.key === "Spacebar" ? (n.type === "folder" && d(h, n, !O), E.preventDefault()) : E.key === "Enter" && (n.type === "folder" ? d(h, n, !O) : (v(h, !1), A(h), N ? N(h) : v(h, !0)), E.preventDefault());
|
|
1628
|
+
}, ke = (E) => {
|
|
1629
|
+
k == null || k(E, n, h);
|
|
1630
|
+
}, Fe = (E) => {
|
|
1631
|
+
E.preventDefault(), X.current = !0, j == null || j(h, I);
|
|
1632
|
+
}, Se = (E) => {
|
|
1633
|
+
if (E.key === "Escape") {
|
|
1634
|
+
E.preventDefault(), E.stopPropagation(), X.current = !0, x == null || x(h);
|
|
1635
1635
|
return;
|
|
1636
1636
|
}
|
|
1637
|
-
(
|
|
1638
|
-
},
|
|
1639
|
-
X.current ||
|
|
1640
|
-
},
|
|
1637
|
+
(E.key === "ArrowLeft" || E.key === "ArrowRight" || E.key === "ArrowUp" || E.key === "ArrowDown") && E.stopPropagation();
|
|
1638
|
+
}, de = () => {
|
|
1639
|
+
X.current || x == null || x(h), X.current = !1;
|
|
1640
|
+
}, U = () => {
|
|
1641
1641
|
if (n.type === "folder") {
|
|
1642
|
-
Me(), h
|
|
1642
|
+
Me(), v(h), A(h);
|
|
1643
1643
|
return;
|
|
1644
1644
|
}
|
|
1645
|
-
const
|
|
1646
|
-
if (
|
|
1647
|
-
N ? N(
|
|
1645
|
+
const E = ne.current !== null;
|
|
1646
|
+
if (E && ne.current && clearTimeout(ne.current), ne.current = null, E) {
|
|
1647
|
+
N ? N(h) : v(h, !0);
|
|
1648
1648
|
return;
|
|
1649
1649
|
}
|
|
1650
|
-
h
|
|
1651
|
-
|
|
1650
|
+
v(h, !1), A(h), v(h, !0), ne.current = window.setTimeout(() => {
|
|
1651
|
+
ne.current = null;
|
|
1652
1652
|
}, 300);
|
|
1653
1653
|
};
|
|
1654
|
-
return
|
|
1655
|
-
|
|
1654
|
+
return H(() => () => {
|
|
1655
|
+
ne.current !== null && typeof window < "u" && clearTimeout(ne.current);
|
|
1656
1656
|
}, []), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
1657
1657
|
nr,
|
|
1658
1658
|
{
|
|
@@ -1660,7 +1660,7 @@ const nn = $t(function({
|
|
|
1660
1660
|
positionInSet: f,
|
|
1661
1661
|
setSize: l
|
|
1662
1662
|
},
|
|
1663
|
-
/* @__PURE__ */ r.createElement(ar, null, () => /* @__PURE__ */ r.createElement(r.Fragment, null,
|
|
1663
|
+
/* @__PURE__ */ r.createElement(ar, null, () => /* @__PURE__ */ r.createElement(r.Fragment, null, G ? /* @__PURE__ */ r.createElement(
|
|
1664
1664
|
"form",
|
|
1665
1665
|
{
|
|
1666
1666
|
onSubmit: Fe,
|
|
@@ -1669,13 +1669,13 @@ const nn = $t(function({
|
|
|
1669
1669
|
Re.renaming,
|
|
1670
1670
|
"file-node-button",
|
|
1671
1671
|
{
|
|
1672
|
-
[Re.selected]:
|
|
1673
|
-
[Re.focused]:
|
|
1672
|
+
[Re.selected]: P === h,
|
|
1673
|
+
[Re.focused]: T === h,
|
|
1674
1674
|
[Re.dropTarget]: me,
|
|
1675
1675
|
[Re.dropTargetInvalid]: Ne
|
|
1676
1676
|
}
|
|
1677
1677
|
),
|
|
1678
|
-
"data-path":
|
|
1678
|
+
"data-path": h,
|
|
1679
1679
|
onContextMenu: ke,
|
|
1680
1680
|
...Oe
|
|
1681
1681
|
},
|
|
@@ -1683,7 +1683,7 @@ const nn = $t(function({
|
|
|
1683
1683
|
jt,
|
|
1684
1684
|
{
|
|
1685
1685
|
node: n,
|
|
1686
|
-
isOpen: n.type === "folder" &&
|
|
1686
|
+
isOpen: n.type === "folder" && O,
|
|
1687
1687
|
level: c,
|
|
1688
1688
|
hideName: !0
|
|
1689
1689
|
}
|
|
@@ -1691,12 +1691,12 @@ const nn = $t(function({
|
|
|
1691
1691
|
/* @__PURE__ */ r.createElement(
|
|
1692
1692
|
"input",
|
|
1693
1693
|
{
|
|
1694
|
-
ref:
|
|
1694
|
+
ref: re,
|
|
1695
1695
|
className: Re.renameInput,
|
|
1696
|
-
value:
|
|
1697
|
-
onChange: (
|
|
1698
|
-
onBlur:
|
|
1699
|
-
onFocus: () =>
|
|
1696
|
+
value: I,
|
|
1697
|
+
onChange: (E) => ee(E.target.value),
|
|
1698
|
+
onBlur: de,
|
|
1699
|
+
onFocus: () => A(h),
|
|
1700
1700
|
onKeyDown: Se
|
|
1701
1701
|
}
|
|
1702
1702
|
)
|
|
@@ -1705,77 +1705,77 @@ const nn = $t(function({
|
|
|
1705
1705
|
{
|
|
1706
1706
|
...Oe,
|
|
1707
1707
|
draggable: Pe,
|
|
1708
|
-
onDragStart: (
|
|
1709
|
-
onDragEnd: (
|
|
1710
|
-
onClick:
|
|
1708
|
+
onDragStart: (E) => m == null ? void 0 : m(E, n, h),
|
|
1709
|
+
onDragEnd: (E) => V == null ? void 0 : V(E, n, h),
|
|
1710
|
+
onClick: U,
|
|
1711
1711
|
onKeyDown: _e,
|
|
1712
1712
|
onFocus: () => {
|
|
1713
|
-
|
|
1713
|
+
A(h);
|
|
1714
1714
|
},
|
|
1715
1715
|
onContextMenu: ke,
|
|
1716
1716
|
className: De(
|
|
1717
1717
|
Re.fileNodeButton,
|
|
1718
1718
|
"file-node-button",
|
|
1719
1719
|
{
|
|
1720
|
-
[Re.selected]:
|
|
1721
|
-
[Re.focused]:
|
|
1720
|
+
[Re.selected]: P === h,
|
|
1721
|
+
[Re.focused]: T === h,
|
|
1722
1722
|
[Re.dropTarget]: me,
|
|
1723
1723
|
[Re.dropTargetInvalid]: Ne
|
|
1724
1724
|
}
|
|
1725
1725
|
),
|
|
1726
|
-
"data-path":
|
|
1727
|
-
"data-expanded":
|
|
1726
|
+
"data-path": h,
|
|
1727
|
+
"data-expanded": O ? "true" : "false"
|
|
1728
1728
|
},
|
|
1729
1729
|
/* @__PURE__ */ r.createElement(
|
|
1730
1730
|
jt,
|
|
1731
1731
|
{
|
|
1732
1732
|
node: n,
|
|
1733
|
-
isOpen: n.type === "folder" &&
|
|
1733
|
+
isOpen: n.type === "folder" && O,
|
|
1734
1734
|
level: c
|
|
1735
1735
|
}
|
|
1736
1736
|
)
|
|
1737
1737
|
)))
|
|
1738
|
-
),
|
|
1738
|
+
), O && ae && ae.map((E, he) => /* @__PURE__ */ r.createElement(
|
|
1739
1739
|
zt,
|
|
1740
1740
|
{
|
|
1741
|
-
key:
|
|
1742
|
-
node:
|
|
1741
|
+
key: E.name,
|
|
1742
|
+
node: E,
|
|
1743
1743
|
level: c + 1,
|
|
1744
1744
|
position: he + 1,
|
|
1745
|
-
setSize:
|
|
1746
|
-
expandedNodePaths:
|
|
1745
|
+
setSize: ae.length,
|
|
1746
|
+
expandedNodePaths: R,
|
|
1747
1747
|
onToggle: d,
|
|
1748
|
-
selectedNode:
|
|
1749
|
-
focusPath:
|
|
1750
|
-
focusedNode:
|
|
1751
|
-
selectPath:
|
|
1752
|
-
generatePath:
|
|
1753
|
-
getChildren:
|
|
1754
|
-
onContextMenu:
|
|
1755
|
-
renamingPath:
|
|
1756
|
-
onRename:
|
|
1757
|
-
onRenameCancel:
|
|
1758
|
-
parentPath:
|
|
1759
|
-
dropIndicator:
|
|
1760
|
-
onDragStart:
|
|
1761
|
-
onDragEnd:
|
|
1748
|
+
selectedNode: P,
|
|
1749
|
+
focusPath: A,
|
|
1750
|
+
focusedNode: T,
|
|
1751
|
+
selectPath: v,
|
|
1752
|
+
generatePath: D,
|
|
1753
|
+
getChildren: _,
|
|
1754
|
+
onContextMenu: k,
|
|
1755
|
+
renamingPath: Z,
|
|
1756
|
+
onRename: j,
|
|
1757
|
+
onRenameCancel: x,
|
|
1758
|
+
parentPath: h,
|
|
1759
|
+
dropIndicator: W,
|
|
1760
|
+
onDragStart: m,
|
|
1761
|
+
onDragEnd: V,
|
|
1762
1762
|
onDragEnter: J,
|
|
1763
|
-
onDragOver:
|
|
1764
|
-
onDragLeave:
|
|
1763
|
+
onDragOver: ce,
|
|
1764
|
+
onDragLeave: Q,
|
|
1765
1765
|
onDrop: g,
|
|
1766
1766
|
rootPath: $,
|
|
1767
1767
|
onDoubleClickFile: N
|
|
1768
1768
|
}
|
|
1769
1769
|
)));
|
|
1770
1770
|
}, jt = ({ node: n, level: c, isOpen: f, hideName: l = !1 }) => {
|
|
1771
|
-
const
|
|
1771
|
+
const R = [];
|
|
1772
1772
|
for (let d = 0; d < c; d++)
|
|
1773
|
-
|
|
1773
|
+
R.push(" ");
|
|
1774
1774
|
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
1775
1775
|
"span",
|
|
1776
1776
|
{
|
|
1777
1777
|
"aria-hidden": "true",
|
|
1778
|
-
dangerouslySetInnerHTML: { __html:
|
|
1778
|
+
dangerouslySetInnerHTML: { __html: R.join("") }
|
|
1779
1779
|
}
|
|
1780
1780
|
), n.type === "folder" ? /* @__PURE__ */ r.createElement(Ot, { width: 16, icon: f ? Hr : Ur }) : /* @__PURE__ */ r.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ r.createElement(Ot, { width: 16, icon: n.type === "folder" ? jr : Vr }), !l && /* @__PURE__ */ r.createElement("span", { className: Re.fileName }, n.name));
|
|
1781
1781
|
}, an = "_control_kp9d9_1", on = "_browse-label_kp9d9_11", ln = "_path-preview_kp9d9_37", sn = "_modal_kp9d9_43", cn = "_modal-footer_kp9d9_48", Qe = {
|
|
@@ -1809,11 +1809,11 @@ function Ga({
|
|
|
1809
1809
|
onChange: c,
|
|
1810
1810
|
filesystem: f
|
|
1811
1811
|
}) {
|
|
1812
|
-
const [l,
|
|
1812
|
+
const [l, R] = te(!1), d = () => R(!0), P = () => R(!1), [A, T] = te(
|
|
1813
1813
|
n || null
|
|
1814
1814
|
);
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1815
|
+
function v(D) {
|
|
1816
|
+
D == null || D.preventDefault(), c(A || ""), P();
|
|
1817
1817
|
}
|
|
1818
1818
|
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
1819
1819
|
tt,
|
|
@@ -1828,15 +1828,15 @@ function Ga({
|
|
|
1828
1828
|
or,
|
|
1829
1829
|
{
|
|
1830
1830
|
title: "Select a path ",
|
|
1831
|
-
onRequestClose:
|
|
1831
|
+
onRequestClose: P,
|
|
1832
1832
|
className: Qe.modal
|
|
1833
1833
|
},
|
|
1834
|
-
/* @__PURE__ */ r.createElement("form", { onSubmit:
|
|
1834
|
+
/* @__PURE__ */ r.createElement("form", { onSubmit: v }, /* @__PURE__ */ r.createElement(
|
|
1835
1835
|
nn,
|
|
1836
1836
|
{
|
|
1837
1837
|
filesystem: f,
|
|
1838
1838
|
initialSelectedPath: n,
|
|
1839
|
-
onSelect:
|
|
1839
|
+
onSelect: T
|
|
1840
1840
|
}
|
|
1841
1841
|
), /* @__PURE__ */ r.createElement("div", { className: Qe.modalFooter }, /* @__PURE__ */ r.createElement(tt, { type: "submit", variant: "primary" }, "Select Path")))
|
|
1842
1842
|
));
|
|
@@ -1871,9 +1871,9 @@ function Ya({
|
|
|
1871
1871
|
mimeType: c,
|
|
1872
1872
|
dataUrl: f,
|
|
1873
1873
|
downloadUrl: l,
|
|
1874
|
-
showHeader:
|
|
1874
|
+
showHeader: R = !0
|
|
1875
1875
|
}) {
|
|
1876
|
-
const { isImage: d, isVideo:
|
|
1876
|
+
const { isImage: d, isVideo: P, isAudio: A } = _n(c), T = R !== !1, v = !!(l && n), D = () => v ? /* @__PURE__ */ r.createElement(
|
|
1877
1877
|
"a",
|
|
1878
1878
|
{
|
|
1879
1879
|
className: Be.downloadLink,
|
|
@@ -1881,14 +1881,14 @@ function Ya({
|
|
|
1881
1881
|
download: n
|
|
1882
1882
|
},
|
|
1883
1883
|
"Download"
|
|
1884
|
-
) : null,
|
|
1884
|
+
) : null, _ = () => d ? /* @__PURE__ */ r.createElement(
|
|
1885
1885
|
"img",
|
|
1886
1886
|
{
|
|
1887
1887
|
className: Be.imagePreview,
|
|
1888
1888
|
src: f,
|
|
1889
1889
|
alt: n || "Preview"
|
|
1890
1890
|
}
|
|
1891
|
-
) :
|
|
1891
|
+
) : P ? /* @__PURE__ */ r.createElement(
|
|
1892
1892
|
"video",
|
|
1893
1893
|
{
|
|
1894
1894
|
className: Be.videoPreview,
|
|
@@ -1897,14 +1897,14 @@ function Ya({
|
|
|
1897
1897
|
},
|
|
1898
1898
|
/* @__PURE__ */ r.createElement("source", { src: f, type: c }),
|
|
1899
1899
|
"Your browser does not support the video tag."
|
|
1900
|
-
) :
|
|
1901
|
-
return /* @__PURE__ */ r.createElement("div", { className: Be.container },
|
|
1900
|
+
) : A ? /* @__PURE__ */ r.createElement("audio", { className: Be.audioPreview, controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: f, type: c }), "Your browser does not support the audio tag.") : /* @__PURE__ */ r.createElement("div", { className: Be.unsupportedMessage }, /* @__PURE__ */ r.createElement("p", null, "Preview unavailable for this file type."), v ? /* @__PURE__ */ r.createElement("p", null, D()) : /* @__PURE__ */ r.createElement("p", null, "Download the file to inspect its contents."));
|
|
1901
|
+
return /* @__PURE__ */ r.createElement("div", { className: Be.container }, T && /* @__PURE__ */ r.createElement("div", { className: Be.header }, /* @__PURE__ */ r.createElement("span", { className: Be.filename, title: n }, n), D()), /* @__PURE__ */ r.createElement("div", { className: Be.previewArea }, _()), !T && v && /* @__PURE__ */ r.createElement("div", { className: Be.actions }, D()));
|
|
1902
1902
|
}
|
|
1903
1903
|
const At = /* @__PURE__ */ new Map(), bn = async (n) => {
|
|
1904
|
-
var
|
|
1904
|
+
var R;
|
|
1905
1905
|
if (!n)
|
|
1906
1906
|
return ut();
|
|
1907
|
-
const c = (
|
|
1907
|
+
const c = (R = n.split(".").pop()) == null ? void 0 : R.toLowerCase();
|
|
1908
1908
|
if (!c || c === "php")
|
|
1909
1909
|
return ut();
|
|
1910
1910
|
const f = n;
|
|
@@ -1960,12 +1960,12 @@ class xn {
|
|
|
1960
1960
|
x: c.clientX,
|
|
1961
1961
|
y: c.clientY
|
|
1962
1962
|
}) === null) {
|
|
1963
|
-
const
|
|
1964
|
-
gt.range(
|
|
1963
|
+
const R = this.view.state.doc.length, d = gt.create([
|
|
1964
|
+
gt.range(R, R)
|
|
1965
1965
|
]);
|
|
1966
1966
|
this.view.dispatch({
|
|
1967
1967
|
selection: d,
|
|
1968
|
-
effects: ct.scrollIntoView(
|
|
1968
|
+
effects: ct.scrollIntoView(R, {
|
|
1969
1969
|
y: "center"
|
|
1970
1970
|
})
|
|
1971
1971
|
}), this.view.focus(), c.preventDefault();
|
|
@@ -1982,52 +1982,53 @@ const Cn = dr.define(
|
|
|
1982
1982
|
code: c,
|
|
1983
1983
|
onChange: f,
|
|
1984
1984
|
currentPath: l,
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1985
|
+
language: R,
|
|
1986
|
+
className: d,
|
|
1987
|
+
onSaveShortcut: P,
|
|
1988
|
+
readOnly: A = !1,
|
|
1989
|
+
additionalExtensions: T
|
|
1990
|
+
}, v) {
|
|
1991
|
+
const D = M(
|
|
1991
1992
|
null
|
|
1992
|
-
), _ =
|
|
1993
|
-
return Wt(
|
|
1993
|
+
), _ = M(null), k = M(new Tt()), Z = M(new Tt()), j = M(new Tt()), x = M(c), K = M(f), W = M(!1);
|
|
1994
|
+
return Wt(v, () => ({
|
|
1994
1995
|
focus: () => {
|
|
1995
|
-
var
|
|
1996
|
-
(
|
|
1996
|
+
var m;
|
|
1997
|
+
(m = _.current) == null || m.focus();
|
|
1997
1998
|
},
|
|
1998
1999
|
blur: () => {
|
|
1999
|
-
const
|
|
2000
|
-
|
|
2000
|
+
const m = _.current;
|
|
2001
|
+
m && m.contentDOM.blur();
|
|
2001
2002
|
},
|
|
2002
2003
|
getCursorPosition: () => _.current ? _.current.state.selection.main.anchor : null,
|
|
2003
|
-
setCursorPosition: (
|
|
2004
|
+
setCursorPosition: (m) => {
|
|
2004
2005
|
if (!_.current)
|
|
2005
2006
|
return;
|
|
2006
|
-
const
|
|
2007
|
-
|
|
2007
|
+
const V = Math.min(
|
|
2008
|
+
m,
|
|
2008
2009
|
_.current.state.doc.length
|
|
2009
|
-
),
|
|
2010
|
-
gt.range(
|
|
2010
|
+
), J = gt.create([
|
|
2011
|
+
gt.range(V, V)
|
|
2011
2012
|
]);
|
|
2012
2013
|
_.current.dispatch({
|
|
2013
|
-
selection:
|
|
2014
|
+
selection: J,
|
|
2014
2015
|
scrollIntoView: !0
|
|
2015
2016
|
});
|
|
2016
2017
|
}
|
|
2017
|
-
})),
|
|
2018
|
-
|
|
2019
|
-
}, [c]),
|
|
2020
|
-
|
|
2021
|
-
}, [f]),
|
|
2018
|
+
})), H(() => {
|
|
2019
|
+
x.current = c;
|
|
2020
|
+
}, [c]), H(() => {
|
|
2021
|
+
K.current = f;
|
|
2022
|
+
}, [f]), H(() => {
|
|
2022
2023
|
if (_.current)
|
|
2023
2024
|
return;
|
|
2024
|
-
const
|
|
2025
|
-
if (!
|
|
2025
|
+
const m = D.current;
|
|
2026
|
+
if (!m)
|
|
2026
2027
|
return;
|
|
2027
|
-
const
|
|
2028
|
+
const V = fr.create({
|
|
2028
2029
|
doc: c,
|
|
2029
2030
|
extensions: [
|
|
2030
|
-
|
|
2031
|
+
j.current.of(T ?? []),
|
|
2031
2032
|
mr(),
|
|
2032
2033
|
pr(),
|
|
2033
2034
|
hr(),
|
|
@@ -2036,9 +2037,9 @@ const Cn = dr.define(
|
|
|
2036
2037
|
wr(),
|
|
2037
2038
|
gr(),
|
|
2038
2039
|
Cn,
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
ct.editable.of(!
|
|
2040
|
+
k.current.of(R ?? ut()),
|
|
2041
|
+
Z.current.of(
|
|
2042
|
+
ct.editable.of(!A)
|
|
2042
2043
|
),
|
|
2043
2044
|
Ar(Nr),
|
|
2044
2045
|
Fr(),
|
|
@@ -2047,17 +2048,17 @@ const Cn = dr.define(
|
|
|
2047
2048
|
yr(),
|
|
2048
2049
|
Cr(),
|
|
2049
2050
|
Pr(),
|
|
2050
|
-
ct.updateListener.of((
|
|
2051
|
-
if (!
|
|
2051
|
+
ct.updateListener.of((ce) => {
|
|
2052
|
+
if (!ce.docChanged)
|
|
2052
2053
|
return;
|
|
2053
|
-
const
|
|
2054
|
-
|
|
2054
|
+
const Q = ce.state.doc.toString();
|
|
2055
|
+
Q !== x.current && (x.current = Q, K.current(Q));
|
|
2055
2056
|
}),
|
|
2056
2057
|
Er.of([
|
|
2057
2058
|
{
|
|
2058
2059
|
key: "Mod-s",
|
|
2059
2060
|
preventDefault: !0,
|
|
2060
|
-
run: () => (
|
|
2061
|
+
run: () => (P == null || P(), !0)
|
|
2061
2062
|
},
|
|
2062
2063
|
...Sr,
|
|
2063
2064
|
...Tr,
|
|
@@ -2068,53 +2069,59 @@ const Cn = dr.define(
|
|
|
2068
2069
|
xr
|
|
2069
2070
|
])
|
|
2070
2071
|
]
|
|
2071
|
-
}),
|
|
2072
|
-
return _.current =
|
|
2073
|
-
|
|
2072
|
+
}), J = new ct({ state: V, parent: m });
|
|
2073
|
+
return _.current = J, () => {
|
|
2074
|
+
J.destroy(), _.current = null;
|
|
2074
2075
|
};
|
|
2075
|
-
}, []),
|
|
2076
|
-
const
|
|
2077
|
-
|
|
2078
|
-
effects:
|
|
2079
|
-
|
|
2076
|
+
}, []), H(() => {
|
|
2077
|
+
const m = _.current;
|
|
2078
|
+
m && m.dispatch({
|
|
2079
|
+
effects: j.current.reconfigure(
|
|
2080
|
+
T ?? []
|
|
2080
2081
|
)
|
|
2081
2082
|
});
|
|
2082
|
-
}, [
|
|
2083
|
-
const
|
|
2084
|
-
if (!
|
|
2083
|
+
}, [T]), H(() => {
|
|
2084
|
+
const m = _.current;
|
|
2085
|
+
if (!m)
|
|
2085
2086
|
return;
|
|
2086
|
-
const
|
|
2087
|
-
c !==
|
|
2088
|
-
changes: { from: 0, to:
|
|
2087
|
+
const V = m.state.doc.toString();
|
|
2088
|
+
c !== V && m.dispatch({
|
|
2089
|
+
changes: { from: 0, to: m.state.doc.length, insert: c }
|
|
2089
2090
|
});
|
|
2090
|
-
}, [c]),
|
|
2091
|
-
var
|
|
2092
|
-
const
|
|
2093
|
-
if (!
|
|
2091
|
+
}, [c]), H(() => {
|
|
2092
|
+
var Q;
|
|
2093
|
+
const m = _.current;
|
|
2094
|
+
if (!m)
|
|
2094
2095
|
return;
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2096
|
+
if (R) {
|
|
2097
|
+
m.dispatch({
|
|
2098
|
+
effects: k.current.reconfigure(R)
|
|
2099
|
+
});
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
const V = (Q = l == null ? void 0 : l.split(".").pop()) == null ? void 0 : Q.toLowerCase();
|
|
2103
|
+
(!V || V === "php") && m.dispatch({
|
|
2104
|
+
effects: k.current.reconfigure(ut())
|
|
2098
2105
|
});
|
|
2099
|
-
let
|
|
2100
|
-
return bn(l).then((
|
|
2101
|
-
|
|
2102
|
-
effects:
|
|
2106
|
+
let ce = !1;
|
|
2107
|
+
return bn(l).then((g) => {
|
|
2108
|
+
ce || !_.current || _.current.dispatch({
|
|
2109
|
+
effects: k.current.reconfigure(g)
|
|
2103
2110
|
});
|
|
2104
2111
|
}), () => {
|
|
2105
|
-
|
|
2112
|
+
ce = !0;
|
|
2106
2113
|
};
|
|
2107
|
-
}, [l]),
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
effects:
|
|
2111
|
-
ct.editable.of(!
|
|
2114
|
+
}, [l, R]), H(() => {
|
|
2115
|
+
const m = _.current;
|
|
2116
|
+
m && (m.hasFocus && (W.current = !0), m.dispatch({
|
|
2117
|
+
effects: Z.current.reconfigure(
|
|
2118
|
+
ct.editable.of(!A)
|
|
2112
2119
|
)
|
|
2113
2120
|
}));
|
|
2114
|
-
}, [
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2117
|
-
}, [l,
|
|
2121
|
+
}, [A]), qt(() => {
|
|
2122
|
+
const m = _.current;
|
|
2123
|
+
m && W.current && !m.hasFocus && (m.focus(), W.current = !1);
|
|
2124
|
+
}, [l, A]), /* @__PURE__ */ r.createElement("div", { ref: D, className: d });
|
|
2118
2125
|
}
|
|
2119
2126
|
);
|
|
2120
2127
|
Gt.displayName = "CodeEditor";
|
|
@@ -2161,20 +2168,20 @@ function Mn(n) {
|
|
|
2161
2168
|
}
|
|
2162
2169
|
async function jn(n, c) {
|
|
2163
2170
|
const f = n.stream().getReader(), l = [];
|
|
2164
|
-
let
|
|
2171
|
+
let R = 0;
|
|
2165
2172
|
try {
|
|
2166
2173
|
for (; ; ) {
|
|
2167
|
-
const { done: d, value:
|
|
2174
|
+
const { done: d, value: P } = await f.read();
|
|
2168
2175
|
if (d)
|
|
2169
2176
|
return {
|
|
2170
2177
|
type: "inline",
|
|
2171
2178
|
data: Qt(l)
|
|
2172
2179
|
};
|
|
2173
|
-
if (
|
|
2174
|
-
if (
|
|
2180
|
+
if (P) {
|
|
2181
|
+
if (R += P.byteLength, R > c)
|
|
2175
2182
|
return await f.cancel().catch(() => {
|
|
2176
2183
|
}), { type: "too-large" };
|
|
2177
|
-
l.push(
|
|
2184
|
+
l.push(P);
|
|
2178
2185
|
}
|
|
2179
2186
|
}
|
|
2180
2187
|
} finally {
|
|
@@ -2190,107 +2197,107 @@ function Wn({
|
|
|
2190
2197
|
currentPath: c,
|
|
2191
2198
|
selectedDirPath: f,
|
|
2192
2199
|
setSelectedDirPath: l,
|
|
2193
|
-
onFileOpened:
|
|
2200
|
+
onFileOpened: R,
|
|
2194
2201
|
onSelectionCleared: d,
|
|
2195
|
-
onShowMessage:
|
|
2196
|
-
documentRoot:
|
|
2197
|
-
readOnly:
|
|
2198
|
-
title:
|
|
2199
|
-
mobileSubsectionTitle:
|
|
2200
|
-
showBinaryPreviewHeader:
|
|
2201
|
-
dockPresentation:
|
|
2202
|
-
useWordPressTooltips:
|
|
2202
|
+
onShowMessage: P,
|
|
2203
|
+
documentRoot: A,
|
|
2204
|
+
readOnly: T = !1,
|
|
2205
|
+
title: v = "Files",
|
|
2206
|
+
mobileSubsectionTitle: D,
|
|
2207
|
+
showBinaryPreviewHeader: _ = !0,
|
|
2208
|
+
dockPresentation: k = !1,
|
|
2209
|
+
useWordPressTooltips: Z = !1
|
|
2203
2210
|
}) {
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
!c || !
|
|
2211
|
+
const j = M(null), x = M(null), K = Ft(() => c ? Le(c) : f ?? A, [c, A]), [W, m] = te(!1);
|
|
2212
|
+
H(() => {
|
|
2213
|
+
!c || !j.current || (l(Le(c)), j.current.focusPath(c, {
|
|
2207
2214
|
select: !0,
|
|
2208
2215
|
domFocus: !1,
|
|
2209
2216
|
notify: !1
|
|
2210
|
-
}),
|
|
2217
|
+
}), j.current.expandToPath(c));
|
|
2211
2218
|
}, [c, l]);
|
|
2212
|
-
const
|
|
2219
|
+
const V = async (g, $) => {
|
|
2213
2220
|
try {
|
|
2214
|
-
const N = await n.read(g),
|
|
2215
|
-
if (
|
|
2216
|
-
const
|
|
2217
|
-
if (!
|
|
2218
|
-
await
|
|
2221
|
+
const N = await n.read(g), h = await Bn(N);
|
|
2222
|
+
if (h.type === "too-large") {
|
|
2223
|
+
const I = Yt / 1024 / 1024;
|
|
2224
|
+
if (!k) {
|
|
2225
|
+
await P(
|
|
2219
2226
|
g,
|
|
2220
|
-
/* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${
|
|
2227
|
+
/* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${I}MB).`), /* @__PURE__ */ r.createElement("p", null, "Open or download it outside the in-browser editor."))
|
|
2221
2228
|
);
|
|
2222
2229
|
return;
|
|
2223
2230
|
}
|
|
2224
|
-
const
|
|
2225
|
-
await
|
|
2231
|
+
const ee = et(g) || "download";
|
|
2232
|
+
await P(
|
|
2226
2233
|
g,
|
|
2227
|
-
/* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${
|
|
2234
|
+
/* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${I}MB).`), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement(
|
|
2228
2235
|
tt,
|
|
2229
2236
|
{
|
|
2230
2237
|
type: "button",
|
|
2231
2238
|
variant: "link",
|
|
2232
2239
|
onClick: () => {
|
|
2233
|
-
J(g,
|
|
2240
|
+
J(g, ee);
|
|
2234
2241
|
}
|
|
2235
2242
|
},
|
|
2236
2243
|
"Download ",
|
|
2237
|
-
|
|
2244
|
+
ee
|
|
2238
2245
|
)))
|
|
2239
2246
|
);
|
|
2240
2247
|
return;
|
|
2241
2248
|
}
|
|
2242
|
-
const
|
|
2243
|
-
if (On(
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
|
|
2249
|
+
const O = h.data, G = et(g) || "download";
|
|
2250
|
+
if (On(O)) {
|
|
2251
|
+
const I = Vn(G), { url: ee, filename: X } = Vt(
|
|
2252
|
+
O,
|
|
2253
|
+
G
|
|
2247
2254
|
);
|
|
2248
|
-
if ($n(
|
|
2249
|
-
const ve = new Blob([
|
|
2250
|
-
await
|
|
2255
|
+
if ($n(I)) {
|
|
2256
|
+
const ve = new Blob([O], { type: I }), me = URL.createObjectURL(ve);
|
|
2257
|
+
await P(
|
|
2251
2258
|
g,
|
|
2252
2259
|
/* @__PURE__ */ r.createElement(
|
|
2253
2260
|
Br,
|
|
2254
2261
|
{
|
|
2255
2262
|
filename: X,
|
|
2256
|
-
mimeType:
|
|
2263
|
+
mimeType: I,
|
|
2257
2264
|
dataUrl: me,
|
|
2258
|
-
downloadUrl:
|
|
2259
|
-
showHeader:
|
|
2265
|
+
downloadUrl: ee,
|
|
2266
|
+
showHeader: _
|
|
2260
2267
|
}
|
|
2261
2268
|
)
|
|
2262
2269
|
);
|
|
2263
2270
|
return;
|
|
2264
2271
|
}
|
|
2265
|
-
await
|
|
2272
|
+
await P(
|
|
2266
2273
|
g,
|
|
2267
|
-
/* @__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:
|
|
2274
|
+
/* @__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: ee, download: X }, "Download ", X)))
|
|
2268
2275
|
);
|
|
2269
2276
|
return;
|
|
2270
2277
|
}
|
|
2271
|
-
const
|
|
2272
|
-
await
|
|
2278
|
+
const re = new TextDecoder("utf-8").decode(O);
|
|
2279
|
+
await R(g, re, $);
|
|
2273
2280
|
} catch (N) {
|
|
2274
|
-
Xe.error("Could not open file", N), await
|
|
2281
|
+
Xe.error("Could not open file", N), await P(null, "Could not open file.");
|
|
2275
2282
|
}
|
|
2276
2283
|
}, J = async (g, $) => {
|
|
2277
2284
|
try {
|
|
2278
|
-
const N = await n.read(g),
|
|
2279
|
-
|
|
2285
|
+
const N = await n.read(g), h = new Uint8Array(await N.arrayBuffer()), { url: O } = Vt(h, $), G = document.createElement("a");
|
|
2286
|
+
G.href = O, G.download = $, document.body.appendChild(G), G.click(), document.body.removeChild(G);
|
|
2280
2287
|
} catch (N) {
|
|
2281
|
-
Xe.error("Could not download file", N), await
|
|
2288
|
+
Xe.error("Could not download file", N), await P(g, "Could not download file.");
|
|
2282
2289
|
}
|
|
2283
|
-
},
|
|
2290
|
+
}, ce = (g) => {
|
|
2284
2291
|
var N;
|
|
2285
2292
|
const $ = Array.from(g.target.files ?? []);
|
|
2286
|
-
g.target.value = "", $.length !== 0 && ((N =
|
|
2287
|
-
},
|
|
2293
|
+
g.target.value = "", $.length !== 0 && ((N = j.current) == null || N.importFiles($, f ?? A).catch((h) => Xe.error("Failed to import files", h)));
|
|
2294
|
+
}, Q = (g) => {
|
|
2288
2295
|
var $;
|
|
2289
2296
|
g.dataTransfer.types.includes(
|
|
2290
2297
|
"application/x-wp-playground-path"
|
|
2291
|
-
) || (g.preventDefault(), !
|
|
2298
|
+
) || (g.preventDefault(), !T && (($ = j.current) == null || $.importDataTransfer(
|
|
2292
2299
|
g.dataTransfer,
|
|
2293
|
-
f ??
|
|
2300
|
+
f ?? A
|
|
2294
2301
|
).catch(
|
|
2295
2302
|
(N) => Xe.error("Failed to import dropped files", N)
|
|
2296
2303
|
)));
|
|
@@ -2299,31 +2306,31 @@ function Wn({
|
|
|
2299
2306
|
"div",
|
|
2300
2307
|
{
|
|
2301
2308
|
className: De(ye.fileExplorerContainer, {
|
|
2302
|
-
[ye.dropActive]:
|
|
2303
|
-
[ye.dockPresentation]:
|
|
2309
|
+
[ye.dropActive]: W,
|
|
2310
|
+
[ye.dockPresentation]: k
|
|
2304
2311
|
}),
|
|
2305
2312
|
onDragEnter: (g) => {
|
|
2306
2313
|
g.dataTransfer.types.includes(
|
|
2307
2314
|
"application/x-wp-playground-path"
|
|
2308
|
-
) || (g.preventDefault(),
|
|
2315
|
+
) || (g.preventDefault(), T || m(!0));
|
|
2309
2316
|
},
|
|
2310
2317
|
onDragOver: (g) => {
|
|
2311
2318
|
g.dataTransfer.types.includes(
|
|
2312
2319
|
"application/x-wp-playground-path"
|
|
2313
|
-
) || (g.preventDefault(), g.dataTransfer.dropEffect =
|
|
2320
|
+
) || (g.preventDefault(), g.dataTransfer.dropEffect = T ? "none" : "copy");
|
|
2314
2321
|
},
|
|
2315
2322
|
onDragLeave: (g) => {
|
|
2316
2323
|
const $ = g.relatedTarget;
|
|
2317
|
-
(!$ || !g.currentTarget.contains($)) &&
|
|
2324
|
+
(!$ || !g.currentTarget.contains($)) && m(!1);
|
|
2318
2325
|
},
|
|
2319
|
-
onDropCapture: () =>
|
|
2320
|
-
onDrop:
|
|
2326
|
+
onDropCapture: () => m(!1),
|
|
2327
|
+
onDrop: Q
|
|
2321
2328
|
},
|
|
2322
|
-
/* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerHeader }, /* @__PURE__ */ r.createElement("span", { className: ye.fileExplorerTitle },
|
|
2329
|
+
/* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerHeader }, /* @__PURE__ */ r.createElement("span", { className: ye.fileExplorerTitle }, v), D ? /* @__PURE__ */ r.createElement("span", { className: ye.fileExplorerSubsectionTitle }, D) : null, T ? null : /* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerActions }, /* @__PURE__ */ r.createElement(
|
|
2323
2330
|
Nt,
|
|
2324
2331
|
{
|
|
2325
2332
|
label: "Create new file",
|
|
2326
|
-
useWordPressTooltip:
|
|
2333
|
+
useWordPressTooltip: Z
|
|
2327
2334
|
},
|
|
2328
2335
|
/* @__PURE__ */ r.createElement(
|
|
2329
2336
|
"button",
|
|
@@ -2334,18 +2341,18 @@ function Wn({
|
|
|
2334
2341
|
),
|
|
2335
2342
|
type: "button",
|
|
2336
2343
|
onClick: () => {
|
|
2337
|
-
|
|
2344
|
+
j.current && j.current.createFile();
|
|
2338
2345
|
},
|
|
2339
2346
|
"aria-label": "Create new file",
|
|
2340
|
-
title:
|
|
2347
|
+
title: Z ? void 0 : "Create new file"
|
|
2341
2348
|
},
|
|
2342
|
-
|
|
2349
|
+
k ? /* @__PURE__ */ r.createElement(Hn, null) : /* @__PURE__ */ r.createElement(St, { icon: Gr, size: 20 })
|
|
2343
2350
|
)
|
|
2344
2351
|
), /* @__PURE__ */ r.createElement(
|
|
2345
2352
|
Nt,
|
|
2346
2353
|
{
|
|
2347
2354
|
label: "Create new folder",
|
|
2348
|
-
useWordPressTooltip:
|
|
2355
|
+
useWordPressTooltip: Z
|
|
2349
2356
|
},
|
|
2350
2357
|
/* @__PURE__ */ r.createElement(
|
|
2351
2358
|
"button",
|
|
@@ -2356,18 +2363,18 @@ function Wn({
|
|
|
2356
2363
|
),
|
|
2357
2364
|
type: "button",
|
|
2358
2365
|
onClick: () => {
|
|
2359
|
-
|
|
2366
|
+
j.current && j.current.createFolder();
|
|
2360
2367
|
},
|
|
2361
2368
|
"aria-label": "Create new folder",
|
|
2362
|
-
title:
|
|
2369
|
+
title: Z ? void 0 : "Create new folder"
|
|
2363
2370
|
},
|
|
2364
|
-
|
|
2371
|
+
k ? /* @__PURE__ */ r.createElement(Un, null) : /* @__PURE__ */ r.createElement(St, { icon: zr, size: 20 })
|
|
2365
2372
|
)
|
|
2366
2373
|
), /* @__PURE__ */ r.createElement(
|
|
2367
2374
|
Nt,
|
|
2368
2375
|
{
|
|
2369
2376
|
label: "Upload files",
|
|
2370
|
-
useWordPressTooltip:
|
|
2377
|
+
useWordPressTooltip: Z
|
|
2371
2378
|
},
|
|
2372
2379
|
/* @__PURE__ */ r.createElement(
|
|
2373
2380
|
"button",
|
|
@@ -2380,40 +2387,40 @@ function Wn({
|
|
|
2380
2387
|
type: "button",
|
|
2381
2388
|
onClick: () => {
|
|
2382
2389
|
var g;
|
|
2383
|
-
return (g =
|
|
2390
|
+
return (g = x.current) == null ? void 0 : g.click();
|
|
2384
2391
|
},
|
|
2385
2392
|
"aria-label": "Upload files",
|
|
2386
|
-
title:
|
|
2393
|
+
title: Z ? void 0 : "Upload files"
|
|
2387
2394
|
},
|
|
2388
2395
|
/* @__PURE__ */ r.createElement(
|
|
2389
2396
|
St,
|
|
2390
2397
|
{
|
|
2391
2398
|
icon: Yr,
|
|
2392
|
-
size:
|
|
2399
|
+
size: k ? 16 : 20
|
|
2393
2400
|
}
|
|
2394
2401
|
)
|
|
2395
2402
|
)
|
|
2396
2403
|
), /* @__PURE__ */ r.createElement(
|
|
2397
2404
|
"input",
|
|
2398
2405
|
{
|
|
2399
|
-
ref:
|
|
2406
|
+
ref: x,
|
|
2400
2407
|
type: "file",
|
|
2401
2408
|
multiple: !0,
|
|
2402
2409
|
style: { display: "none" },
|
|
2403
|
-
onChange:
|
|
2410
|
+
onChange: ce
|
|
2404
2411
|
}
|
|
2405
2412
|
))),
|
|
2406
2413
|
/* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerTree }, /* @__PURE__ */ r.createElement(
|
|
2407
2414
|
Or,
|
|
2408
2415
|
{
|
|
2409
|
-
ref:
|
|
2410
|
-
readOnly:
|
|
2416
|
+
ref: j,
|
|
2417
|
+
readOnly: T,
|
|
2411
2418
|
filesystem: n,
|
|
2412
|
-
root:
|
|
2413
|
-
initialSelectedPath:
|
|
2419
|
+
root: A,
|
|
2420
|
+
initialSelectedPath: K,
|
|
2414
2421
|
onSelect: async (g) => {
|
|
2415
2422
|
if (!g) {
|
|
2416
|
-
l(
|
|
2423
|
+
l(A), await d();
|
|
2417
2424
|
return;
|
|
2418
2425
|
}
|
|
2419
2426
|
try {
|
|
@@ -2423,10 +2430,10 @@ function Wn({
|
|
|
2423
2430
|
}
|
|
2424
2431
|
} catch {
|
|
2425
2432
|
}
|
|
2426
|
-
l(Le(g)), await
|
|
2433
|
+
l(Le(g)), await V(g, !1);
|
|
2427
2434
|
},
|
|
2428
2435
|
onDoubleClickFile: async (g) => {
|
|
2429
|
-
await
|
|
2436
|
+
await V(g, !0);
|
|
2430
2437
|
}
|
|
2431
2438
|
}
|
|
2432
2439
|
))
|
|
@@ -2519,7 +2526,7 @@ const Hn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32",
|
|
|
2519
2526
|
dockSaveButton: ma,
|
|
2520
2527
|
sidebarOpen: pa,
|
|
2521
2528
|
editorHeaderPathPortaled: ha
|
|
2522
|
-
}, va = 1500, wa = 700, ga = 1e3,
|
|
2529
|
+
}, va = 1500, wa = 700, ga = 1e3, L = {
|
|
2523
2530
|
IDLE: "idle",
|
|
2524
2531
|
PENDING: "pending",
|
|
2525
2532
|
SAVING: "saving",
|
|
@@ -2531,46 +2538,46 @@ function Za({
|
|
|
2531
2538
|
isVisible: c = !0,
|
|
2532
2539
|
documentRoot: f,
|
|
2533
2540
|
initialPath: l = null,
|
|
2534
|
-
placeholderText:
|
|
2541
|
+
placeholderText: R = "Select a file to view or edit its contents.",
|
|
2535
2542
|
dockPresentation: d = !1,
|
|
2536
|
-
mobileHeaderTarget:
|
|
2543
|
+
mobileHeaderTarget: P = null
|
|
2537
2544
|
}) {
|
|
2538
|
-
const [
|
|
2545
|
+
const [A, T] = te(
|
|
2539
2546
|
f
|
|
2540
|
-
), [
|
|
2547
|
+
), [v, D] = te(null), [_, k] = te(""), [Z, j] = te(!0), [x, K] = te(L.IDLE), [W, m] = te(null), [V, J] = te("idle"), [ce, Q] = te(!1), [g, $] = te(null), N = M(null), h = M(null), O = M(!1), G = M(v), re = M(
|
|
2541
2548
|
n
|
|
2542
|
-
),
|
|
2549
|
+
), I = M(null), ee = M(null), X = M(
|
|
2543
2550
|
/* @__PURE__ */ new WeakMap()
|
|
2544
|
-
), ve =
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
}, [
|
|
2551
|
+
), ve = M(!0), me = M(/* @__PURE__ */ new Map()), Ne = M(!1);
|
|
2552
|
+
re.current = n, H(() => {
|
|
2553
|
+
G.current = v;
|
|
2554
|
+
}, [v]);
|
|
2548
2555
|
const Pe = Ue(async (b) => {
|
|
2549
|
-
const { filesystem:
|
|
2550
|
-
}).then(() =>
|
|
2551
|
-
be.set(
|
|
2556
|
+
const { filesystem: S, path: ie, content: le } = b, ue = ee.current === b, be = X.current, ge = (be.get(S) ?? Promise.resolve()).catch(() => {
|
|
2557
|
+
}).then(() => S.writeFile(ie, le));
|
|
2558
|
+
be.set(S, ge);
|
|
2552
2559
|
let Ie = !1;
|
|
2553
2560
|
try {
|
|
2554
2561
|
await ge;
|
|
2555
2562
|
} catch (Ge) {
|
|
2556
2563
|
Ie = !0, Xe.error("Failed to save file", Ge);
|
|
2557
2564
|
}
|
|
2558
|
-
const at = ve.current && be.get(
|
|
2559
|
-
be.get(
|
|
2565
|
+
const at = ve.current && be.get(S) === ge && re.current === S && G.current === ie && I.current === null;
|
|
2566
|
+
be.get(S) === ge && be.delete(S), ee.current === b && (ee.current = null), at && (K(Ie ? L.ERROR : L.SAVED), m(
|
|
2560
2567
|
Ie ? "Could not save changes. Try again." : null
|
|
2561
|
-
),
|
|
2562
|
-
}, []),
|
|
2563
|
-
const b =
|
|
2564
|
-
b && (
|
|
2568
|
+
), ue && J(Ie ? "idle" : "saved"));
|
|
2569
|
+
}, []), ne = Ue(() => {
|
|
2570
|
+
const b = I.current;
|
|
2571
|
+
b && (h.current !== null && (window.clearTimeout(h.current), h.current = null), I.current = null, Pe(b));
|
|
2565
2572
|
}, [Pe]);
|
|
2566
|
-
|
|
2573
|
+
H(() => (ve.current = !0, () => {
|
|
2567
2574
|
ve.current = !1;
|
|
2568
|
-
}), []),
|
|
2575
|
+
}), []), H(() => () => {
|
|
2569
2576
|
var b;
|
|
2570
|
-
((b =
|
|
2571
|
-
}, [f, n,
|
|
2572
|
-
|
|
2573
|
-
}, [f, n]),
|
|
2577
|
+
((b = I.current) == null ? void 0 : b.filesystem) === n && ne();
|
|
2578
|
+
}, [f, n, ne]), H(() => {
|
|
2579
|
+
O.current = !0, T(f), k(""), D(null), j(!0), K(L.IDLE), m(null), Q(!1), $(null), me.current.clear(), Ne.current = !1;
|
|
2580
|
+
}, [f, n]), H(() => {
|
|
2574
2581
|
if (!n || !l || Ne.current)
|
|
2575
2582
|
return;
|
|
2576
2583
|
let b = !1;
|
|
@@ -2580,9 +2587,9 @@ function Za({
|
|
|
2580
2587
|
const le = await n.readFileAsText(l);
|
|
2581
2588
|
if (b)
|
|
2582
2589
|
return;
|
|
2583
|
-
|
|
2584
|
-
var
|
|
2585
|
-
(
|
|
2590
|
+
O.current = !0, D(l), k(le), j(!1), K(L.IDLE), m(null), setTimeout(() => {
|
|
2591
|
+
var ue;
|
|
2592
|
+
(ue = N.current) == null || ue.focus();
|
|
2586
2593
|
}, 100);
|
|
2587
2594
|
}
|
|
2588
2595
|
} catch (ie) {
|
|
@@ -2593,66 +2600,66 @@ function Za({
|
|
|
2593
2600
|
})(), () => {
|
|
2594
2601
|
b = !0;
|
|
2595
2602
|
};
|
|
2596
|
-
}, [n, l]),
|
|
2597
|
-
if (!n || !
|
|
2598
|
-
|
|
2603
|
+
}, [n, l]), H(() => {
|
|
2604
|
+
if (!n || !v) {
|
|
2605
|
+
h.current !== null && (window.clearTimeout(h.current), h.current = null), I.current = null, v || K(L.IDLE);
|
|
2599
2606
|
return;
|
|
2600
2607
|
}
|
|
2601
|
-
if (
|
|
2602
|
-
|
|
2608
|
+
if (O.current) {
|
|
2609
|
+
O.current = !1, I.current = null;
|
|
2603
2610
|
return;
|
|
2604
2611
|
}
|
|
2605
|
-
|
|
2612
|
+
h.current !== null && (window.clearTimeout(h.current), h.current = null), K(L.PENDING);
|
|
2606
2613
|
const b = {
|
|
2607
2614
|
filesystem: n,
|
|
2608
|
-
path:
|
|
2609
|
-
content:
|
|
2615
|
+
path: v,
|
|
2616
|
+
content: _
|
|
2610
2617
|
};
|
|
2611
|
-
|
|
2612
|
-
const
|
|
2613
|
-
|
|
2618
|
+
I.current = b;
|
|
2619
|
+
const S = window.setTimeout(() => {
|
|
2620
|
+
I.current === b && (h.current = null, I.current = null, K(L.SAVING), Pe(b));
|
|
2614
2621
|
}, va);
|
|
2615
|
-
return
|
|
2616
|
-
|
|
2622
|
+
return h.current = S, () => {
|
|
2623
|
+
h.current === S && (window.clearTimeout(S), h.current = null);
|
|
2617
2624
|
};
|
|
2618
|
-
}, [
|
|
2619
|
-
if (
|
|
2625
|
+
}, [_, v, n, Pe]), H(() => {
|
|
2626
|
+
if (x !== L.SAVED)
|
|
2620
2627
|
return;
|
|
2621
2628
|
const b = window.setTimeout(() => {
|
|
2622
|
-
|
|
2623
|
-
(
|
|
2629
|
+
K(
|
|
2630
|
+
(S) => S === L.SAVED ? L.IDLE : S
|
|
2624
2631
|
);
|
|
2625
2632
|
}, 2e3);
|
|
2626
2633
|
return () => window.clearTimeout(b);
|
|
2627
|
-
}, [
|
|
2628
|
-
|
|
2629
|
-
}, [
|
|
2630
|
-
if (
|
|
2634
|
+
}, [x]), H(() => {
|
|
2635
|
+
V === "idle" || x === L.SAVING || x === L.SAVED || J("idle");
|
|
2636
|
+
}, [V, x]), H(() => {
|
|
2637
|
+
if (V !== "saved")
|
|
2631
2638
|
return;
|
|
2632
2639
|
const b = window.setTimeout(
|
|
2633
2640
|
() => J("idle"),
|
|
2634
2641
|
ga
|
|
2635
2642
|
);
|
|
2636
2643
|
return () => window.clearTimeout(b);
|
|
2637
|
-
}, [
|
|
2638
|
-
if (
|
|
2644
|
+
}, [V]), H(() => {
|
|
2645
|
+
if (V !== "waiting")
|
|
2639
2646
|
return;
|
|
2640
2647
|
const b = window.setTimeout(
|
|
2641
2648
|
() => J(
|
|
2642
|
-
(
|
|
2649
|
+
(S) => S === "waiting" ? "saving" : S
|
|
2643
2650
|
),
|
|
2644
2651
|
wa
|
|
2645
2652
|
);
|
|
2646
2653
|
return () => window.clearTimeout(b);
|
|
2647
|
-
}, [
|
|
2654
|
+
}, [V]);
|
|
2648
2655
|
const Oe = Ue(
|
|
2649
|
-
async (b,
|
|
2650
|
-
var
|
|
2651
|
-
const le = (
|
|
2652
|
-
le != null &&
|
|
2653
|
-
|
|
2656
|
+
async (b, S, ie = !0) => {
|
|
2657
|
+
var ue;
|
|
2658
|
+
const le = (ue = N.current) == null ? void 0 : ue.getCursorPosition();
|
|
2659
|
+
le != null && G.current && me.current.set(
|
|
2660
|
+
G.current,
|
|
2654
2661
|
le
|
|
2655
|
-
),
|
|
2662
|
+
), O.current = !0, D(b), k(S), $(null), j(!1), K(L.IDLE), m(null), Q(!1), setTimeout(() => {
|
|
2656
2663
|
var $e, ge, Ie;
|
|
2657
2664
|
const be = me.current.get(b);
|
|
2658
2665
|
be !== void 0 && (($e = N.current) == null || $e.setCursorPosition(be)), ie ? (ge = N.current) == null || ge.focus() : (Ie = N.current) == null || Ie.blur();
|
|
@@ -2660,52 +2667,52 @@ function Za({
|
|
|
2660
2667
|
},
|
|
2661
2668
|
[]
|
|
2662
2669
|
);
|
|
2663
|
-
|
|
2670
|
+
H(() => {
|
|
2664
2671
|
var ie;
|
|
2665
|
-
if (!
|
|
2672
|
+
if (!v)
|
|
2666
2673
|
return;
|
|
2667
2674
|
const b = setInterval(() => {
|
|
2668
|
-
var
|
|
2669
|
-
const le = (
|
|
2670
|
-
le != null && me.current.set(
|
|
2671
|
-
}, 1e3),
|
|
2672
|
-
return
|
|
2673
|
-
var
|
|
2675
|
+
var ue;
|
|
2676
|
+
const le = (ue = N.current) == null ? void 0 : ue.getCursorPosition();
|
|
2677
|
+
le != null && me.current.set(v, le);
|
|
2678
|
+
}, 1e3), S = (ie = N.current) == null ? void 0 : ie.getCursorPosition();
|
|
2679
|
+
return S != null && me.current.set(v, S), () => {
|
|
2680
|
+
var ue;
|
|
2674
2681
|
clearInterval(b);
|
|
2675
|
-
const le = (
|
|
2676
|
-
le != null && me.current.set(
|
|
2682
|
+
const le = (ue = N.current) == null ? void 0 : ue.getCursorPosition();
|
|
2683
|
+
le != null && me.current.set(v, le);
|
|
2677
2684
|
};
|
|
2678
|
-
}, [
|
|
2679
|
-
if (!c || !
|
|
2685
|
+
}, [v]), H(() => {
|
|
2686
|
+
if (!c || !v)
|
|
2680
2687
|
return;
|
|
2681
2688
|
const b = setTimeout(() => {
|
|
2682
2689
|
var ie;
|
|
2683
|
-
const
|
|
2684
|
-
|
|
2690
|
+
const S = me.current.get(v);
|
|
2691
|
+
S !== void 0 && ((ie = N.current) == null || ie.setCursorPosition(S));
|
|
2685
2692
|
}, 100);
|
|
2686
2693
|
return () => clearTimeout(b);
|
|
2687
|
-
}, [c,
|
|
2688
|
-
const
|
|
2689
|
-
var
|
|
2690
|
-
const b = (
|
|
2691
|
-
b != null &&
|
|
2694
|
+
}, [c, v]);
|
|
2695
|
+
const ae = Ue(async () => {
|
|
2696
|
+
var S;
|
|
2697
|
+
const b = (S = N.current) == null ? void 0 : S.getCursorPosition();
|
|
2698
|
+
b != null && G.current && me.current.set(G.current, b), O.current = !0, D(null), k(""), $(null), j(!0), K(L.IDLE), m(null);
|
|
2692
2699
|
}, []), Me = Ue(
|
|
2693
|
-
async (b,
|
|
2694
|
-
|
|
2700
|
+
async (b, S) => {
|
|
2701
|
+
O.current = !0, D(null), typeof S == "string" ? (k(S), $(null)) : (k(""), $(S)), j(!0), K(L.IDLE), m(null), Q(!1);
|
|
2695
2702
|
},
|
|
2696
2703
|
[]
|
|
2697
2704
|
), _e = Ue(() => {
|
|
2698
|
-
|
|
2699
|
-
}, [
|
|
2700
|
-
!
|
|
2705
|
+
I.current && (ee.current = I.current, J("waiting"), K(L.SAVING), ne());
|
|
2706
|
+
}, [ne]), ke = Ue(() => {
|
|
2707
|
+
!I.current && x === L.ERROR && n && v && (I.current = {
|
|
2701
2708
|
filesystem: n,
|
|
2702
|
-
path:
|
|
2703
|
-
content:
|
|
2704
|
-
}),
|
|
2705
|
-
}, [
|
|
2706
|
-
let
|
|
2707
|
-
|
|
2708
|
-
const
|
|
2709
|
+
path: v,
|
|
2710
|
+
content: _
|
|
2711
|
+
}), I.current && (m(null), _e());
|
|
2712
|
+
}, [_, v, n, _e, x]), Fe = Ea(x, W), Se = ya(x, q), de = _a(x);
|
|
2713
|
+
let U = "Save";
|
|
2714
|
+
x === L.ERROR ? U = "Retry" : x === L.SAVED && V === "saved" ? U = "Saved" : x === L.SAVING && V === "saving" && (U = "Saving…");
|
|
2715
|
+
const E = x === L.PENDING || x === L.SAVING || x === L.ERROR;
|
|
2709
2716
|
if (!n)
|
|
2710
2717
|
return /* @__PURE__ */ r.createElement(
|
|
2711
2718
|
"div",
|
|
@@ -2714,16 +2721,16 @@ function Za({
|
|
|
2714
2721
|
[q.dockPresentation]: d
|
|
2715
2722
|
})
|
|
2716
2723
|
},
|
|
2717
|
-
/* @__PURE__ */ r.createElement("div", { className: q.placeholder },
|
|
2724
|
+
/* @__PURE__ */ r.createElement("div", { className: q.placeholder }, R)
|
|
2718
2725
|
);
|
|
2719
|
-
const he =
|
|
2726
|
+
const he = v ? Le(v) : null, pe = v ? et(v) : null, we = /* @__PURE__ */ r.createElement(
|
|
2720
2727
|
"div",
|
|
2721
2728
|
{
|
|
2722
2729
|
className: De(q.editorPath, {
|
|
2723
|
-
[q.editorPathPlaceholder]: !(
|
|
2724
|
-
[q.editorPathPortaled]:
|
|
2730
|
+
[q.editorPathPlaceholder]: !(v != null && v.length),
|
|
2731
|
+
[q.editorPathPortaled]: P
|
|
2725
2732
|
}),
|
|
2726
|
-
title:
|
|
2733
|
+
title: v ?? void 0
|
|
2727
2734
|
},
|
|
2728
2735
|
he && pe ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("span", { className: q.editorPathDirectory }, he === "/" ? "" : he), /* @__PURE__ */ r.createElement("span", { className: q.editorPathFilename }, "/", pe)) : `Browse files under ${f}`
|
|
2729
2736
|
);
|
|
@@ -2738,25 +2745,25 @@ function Za({
|
|
|
2738
2745
|
"div",
|
|
2739
2746
|
{
|
|
2740
2747
|
className: De(q.content, {
|
|
2741
|
-
[q.sidebarOpen]:
|
|
2748
|
+
[q.sidebarOpen]: ce
|
|
2742
2749
|
})
|
|
2743
2750
|
},
|
|
2744
2751
|
/* @__PURE__ */ r.createElement(
|
|
2745
2752
|
"div",
|
|
2746
2753
|
{
|
|
2747
2754
|
className: q.mobileOverlay,
|
|
2748
|
-
onClick: () =>
|
|
2755
|
+
onClick: () => Q(!1)
|
|
2749
2756
|
}
|
|
2750
2757
|
),
|
|
2751
2758
|
/* @__PURE__ */ r.createElement("aside", { className: q.sidebarWrapper }, /* @__PURE__ */ r.createElement(
|
|
2752
2759
|
Wn,
|
|
2753
2760
|
{
|
|
2754
2761
|
filesystem: n,
|
|
2755
|
-
currentPath:
|
|
2756
|
-
selectedDirPath:
|
|
2757
|
-
setSelectedDirPath:
|
|
2762
|
+
currentPath: v,
|
|
2763
|
+
selectedDirPath: A,
|
|
2764
|
+
setSelectedDirPath: T,
|
|
2758
2765
|
onFileOpened: Oe,
|
|
2759
|
-
onSelectionCleared:
|
|
2766
|
+
onSelectionCleared: ae,
|
|
2760
2767
|
onShowMessage: Me,
|
|
2761
2768
|
documentRoot: f,
|
|
2762
2769
|
dockPresentation: d,
|
|
@@ -2767,7 +2774,7 @@ function Za({
|
|
|
2767
2774
|
"div",
|
|
2768
2775
|
{
|
|
2769
2776
|
className: De(q.editorHeader, {
|
|
2770
|
-
[q.editorHeaderPathPortaled]:
|
|
2777
|
+
[q.editorHeaderPathPortaled]: P
|
|
2771
2778
|
})
|
|
2772
2779
|
},
|
|
2773
2780
|
/* @__PURE__ */ r.createElement(
|
|
@@ -2775,26 +2782,26 @@ function Za({
|
|
|
2775
2782
|
{
|
|
2776
2783
|
className: q.mobileToggle,
|
|
2777
2784
|
variant: "secondary",
|
|
2778
|
-
onClick: () =>
|
|
2785
|
+
onClick: () => Q((b) => !b)
|
|
2779
2786
|
},
|
|
2780
|
-
|
|
2787
|
+
ce ? "Hide files" : "Browse files"
|
|
2781
2788
|
),
|
|
2782
|
-
|
|
2783
|
-
d && !
|
|
2789
|
+
P ? Mr(we, P) : we,
|
|
2790
|
+
d && !Z && v ? /* @__PURE__ */ r.createElement("div", { className: q.editorHeaderActions }, E ? /* @__PURE__ */ r.createElement(
|
|
2784
2791
|
"span",
|
|
2785
2792
|
{
|
|
2786
2793
|
className: q.dockDirtyIndicator,
|
|
2787
2794
|
"aria-hidden": "true"
|
|
2788
2795
|
}
|
|
2789
|
-
) : null, /* @__PURE__ */ r.createElement(Ht, { text:
|
|
2796
|
+
) : null, /* @__PURE__ */ r.createElement(Ht, { text: de, placement: "top" }, /* @__PURE__ */ r.createElement(
|
|
2790
2797
|
tt,
|
|
2791
2798
|
{
|
|
2792
2799
|
variant: "secondary",
|
|
2793
2800
|
className: q.dockSaveButton,
|
|
2794
|
-
isDestructive:
|
|
2801
|
+
isDestructive: x === L.ERROR,
|
|
2795
2802
|
onClick: ke
|
|
2796
2803
|
},
|
|
2797
|
-
|
|
2804
|
+
U
|
|
2798
2805
|
))) : d ? null : /* @__PURE__ */ r.createElement(
|
|
2799
2806
|
"div",
|
|
2800
2807
|
{
|
|
@@ -2805,30 +2812,30 @@ function Za({
|
|
|
2805
2812
|
},
|
|
2806
2813
|
Fe
|
|
2807
2814
|
),
|
|
2808
|
-
d && !
|
|
2809
|
-
),
|
|
2815
|
+
d && !Z && v ? /* @__PURE__ */ r.createElement(ir, { role: "status", "aria-live": "polite" }, de) : null
|
|
2816
|
+
), W ? /* @__PURE__ */ r.createElement("div", { style: { padding: "8px 16px" } }, /* @__PURE__ */ r.createElement(lr, { status: "error", isDismissible: !1 }, W)) : null, v || _ || g ? g ? /* @__PURE__ */ r.createElement("div", { className: q.messageArea }, g) : /* @__PURE__ */ r.createElement(
|
|
2810
2817
|
Gt,
|
|
2811
2818
|
{
|
|
2812
2819
|
ref: N,
|
|
2813
|
-
code:
|
|
2814
|
-
onChange:
|
|
2815
|
-
currentPath:
|
|
2820
|
+
code: _,
|
|
2821
|
+
onChange: k,
|
|
2822
|
+
currentPath: v,
|
|
2816
2823
|
className: q.editor,
|
|
2817
2824
|
onSaveShortcut: _e,
|
|
2818
|
-
readOnly:
|
|
2825
|
+
readOnly: Z
|
|
2819
2826
|
}
|
|
2820
|
-
) : /* @__PURE__ */ r.createElement("div", { className: q.placeholder },
|
|
2827
|
+
) : /* @__PURE__ */ r.createElement("div", { className: q.placeholder }, R))
|
|
2821
2828
|
)
|
|
2822
2829
|
);
|
|
2823
2830
|
}
|
|
2824
2831
|
function Ea(n, c) {
|
|
2825
2832
|
switch (n) {
|
|
2826
|
-
case
|
|
2827
|
-
case
|
|
2833
|
+
case L.PENDING:
|
|
2834
|
+
case L.SAVING:
|
|
2828
2835
|
return "Saving…";
|
|
2829
|
-
case
|
|
2836
|
+
case L.SAVED:
|
|
2830
2837
|
return "Saved";
|
|
2831
|
-
case
|
|
2838
|
+
case L.ERROR:
|
|
2832
2839
|
return c ?? "Save failed";
|
|
2833
2840
|
default:
|
|
2834
2841
|
return "";
|
|
@@ -2836,11 +2843,11 @@ function Ea(n, c) {
|
|
|
2836
2843
|
}
|
|
2837
2844
|
function ya(n, c) {
|
|
2838
2845
|
switch (n) {
|
|
2839
|
-
case
|
|
2846
|
+
case L.PENDING:
|
|
2840
2847
|
return c.saveStatusPending;
|
|
2841
|
-
case
|
|
2848
|
+
case L.SAVING:
|
|
2842
2849
|
return c.saveStatusSaving;
|
|
2843
|
-
case
|
|
2850
|
+
case L.ERROR:
|
|
2844
2851
|
return c.saveStatusError;
|
|
2845
2852
|
default:
|
|
2846
2853
|
return;
|
|
@@ -2848,11 +2855,11 @@ function ya(n, c) {
|
|
|
2848
2855
|
}
|
|
2849
2856
|
function _a(n) {
|
|
2850
2857
|
switch (n) {
|
|
2851
|
-
case
|
|
2858
|
+
case L.PENDING:
|
|
2852
2859
|
return "Unsaved changes. Click to save now.";
|
|
2853
|
-
case
|
|
2860
|
+
case L.SAVING:
|
|
2854
2861
|
return "Saving changes…";
|
|
2855
|
-
case
|
|
2862
|
+
case L.ERROR:
|
|
2856
2863
|
return "Saving failed. Click to retry.";
|
|
2857
2864
|
default:
|
|
2858
2865
|
return "All changes saved.";
|