efficient-shell 12.40.1 → 12.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -24
- package/dist/{Browser-2KAKTRNM.js → Browser-IFUHNT4S.js} +14 -14
- package/dist/{Files-TDFKJDFL.js → Files-OH2I2U2F.js} +36 -36
- package/dist/{Notepad-AP35IJOS.js → Notepad-7THWUIP4.js} +8 -8
- package/dist/{Preview-MWTFD5UE.js → Preview-DG3UMMTS.js} +28 -28
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-EUKTGRUD.js → chunk-2UMOTGAK.js} +3 -3
- package/dist/{chunk-VNROPHRY.js → chunk-53GA6ZWG.js} +2 -2
- package/dist/chunk-DTBSN6HE.js +1 -0
- package/dist/{chunk-JTMR3EH3.js → chunk-JZY2RBPX.js} +6 -6
- package/dist/{chunk-E6PDAYBR.js → chunk-O5UD3ZWM.js} +4 -4
- package/dist/{chunk-GFM6O57V.js → chunk-OBTVP55E.js} +1 -1
- package/dist/data/Gantt.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.js +79 -79
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/tokens/colour.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-YGWFOKBT.js +0 -1
package/README.md
CHANGED
|
@@ -5296,31 +5296,74 @@ and reviewed:
|
|
|
5296
5296
|
this branch does not (dropped from `kinds` or from the baseline, `--update`
|
|
5297
5297
|
included), and a file the base branch counted that is a symbolic link now,
|
|
5298
5298
|
or sits under one, and that the walk no longer reads for a kind counted in
|
|
5299
|
-
it
|
|
5300
|
-
|
|
5301
|
-
|
|
5299
|
+
it. Not yet seen by this check: a file the base branch held only in
|
|
5300
|
+
`allow`, with no baseline line, that is a symbolic link now (a dated
|
|
5301
|
+
follow-up, due 2026-11-25). A linked folder is followed only when it is the start of every glob
|
|
5302
|
+
that reads it; a file that only `includeCopies` reads now is read for the
|
|
5303
|
+
copied-value kinds alone.
|
|
5304
|
+
For each counted file that is gone or now counts less for a counted kind,
|
|
5305
|
+
the lock reads
|
|
5306
|
+
`git diff -M30% -C30% --find-copies-harder -l0 --no-relative --name-status -z`
|
|
5307
|
+
against the base, from the repository root under any `diff.relative`
|
|
5308
|
+
setting, with no rename limit. A rename or a copy of that file fails when
|
|
5309
|
+
the check does not read the new path for a kind that left the file (every
|
|
5310
|
+
kind of a file that is gone; the kinds that count less in a file that is
|
|
5311
|
+
still here, its baseline line and its `allow` entries together), or when
|
|
5312
|
+
the new path is outside the folder the check runs in;
|
|
5313
|
+
a move inside the scope, a delete, and a burn-down with no copy pass. A
|
|
5314
|
+
copy catches a file moved with
|
|
5315
|
+
a new file put at its old path. git pairs at 30% similarity, not its
|
|
5316
|
+
default 50%, so code moved and changed a lot is still paired with where it
|
|
5317
|
+
came from. git pairs on shared lines (imports, boilerplate), so a pair fails
|
|
5318
|
+
only for a kind that left the file and that the new file still holds: a
|
|
5319
|
+
story or a test that shares a burned-down file's imports passes unless it
|
|
5320
|
+
holds a kind that was burned down (padding in the test of a file whose
|
|
5321
|
+
buttons were burned down passes). The new file is read in the working tree,
|
|
5322
|
+
by its own rules and by the rules of the file it came from (`hex` counts
|
|
5323
|
+
only in JSX files, so a `.tsx` renamed to `.ts` still holds its hex, and a
|
|
5324
|
+
raw `<button>` in it still counts). A stylesheet paired with a stylesheet is
|
|
5325
|
+
read by the stylesheet rules. A file the check cannot scan (`.mdx`, `.d.ts`,
|
|
5326
|
+
a stylesheet paired with a script, anything else not a script) or cannot
|
|
5327
|
+
read is taken to hold every kind.
|
|
5328
|
+
If git cannot list the renames, the check fails.
|
|
5329
|
+
A file new to a scope (a widened `include`, `includeImporting` or
|
|
5330
|
+
`includeCopies`, or an `exclude` line taken out) may hold what it held for
|
|
5331
|
+
those kinds on the base, in the baseline or in `allow`: no more than it held
|
|
5332
|
+
there, and no more than it holds now, so an emptied file gives no room to
|
|
5333
|
+
another.
|
|
5334
|
+
When the base has no baseline in this folder, the lock lists the base's
|
|
5335
|
+
files (`git ls-tree`). A baseline there in a folder that is gone here means
|
|
5336
|
+
the check moved, and it fails; a baseline in a folder that is still here (a
|
|
5337
|
+
second app adopting) is an adoption.
|
|
5338
|
+
A base config or baseline that does not parse is repaired by this change:
|
|
5339
|
+
a run that reaches the comparison has read its own copies, so they parse.
|
|
5340
|
+
The comparison (for the baseline) or the shrink check (for the config) is
|
|
5341
|
+
skipped, and a GitHub Actions warning names the file. The next change is
|
|
5342
|
+
compared against the repaired file as usual.
|
|
5302
5343
|
Not seen by the lock, each with its reason:
|
|
5303
|
-
- A file moved
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
- The check pinned back to a release without this lock (the checker alias,
|
|
5317
|
-
or efficient-shell itself). The lock is code in the version the repository
|
|
5318
|
-
installs, so an older version runs the older check. Only a check outside
|
|
5319
|
-
the package can see it.
|
|
5344
|
+
- A file moved and changed so much that git finds under 30% of it in the
|
|
5345
|
+
new file. It counts as deleted.
|
|
5346
|
+
- A push of several commits at once, or a rebase merge: the lock compares
|
|
5347
|
+
the last commit with the one before it, not with the commit before the
|
|
5348
|
+
push. A pull request is compared as a whole.
|
|
5349
|
+
- No baseline anywhere on the base branch. The change is taken as the one
|
|
5350
|
+
adopting the check, and passes with a note.
|
|
5351
|
+
- A local run (no `GITHUB_BASE_REF`, and `GITHUB_EVENT_NAME` is not
|
|
5352
|
+
`push`). There is no base to compare. An empty `GITHUB_BASE_REF` counts
|
|
5353
|
+
as not set.
|
|
5354
|
+
- The check pinned back to a release without this lock, in a repository
|
|
5355
|
+
that does not run it with `--base-lock`, or in a change that also removes
|
|
5356
|
+
the flag from the script (the reviewer sees that line).
|
|
5320
5357
|
- Copies are counted only in a repository that sets `includeCopies`. Without
|
|
5321
5358
|
it, the copied-value kinds read the operator UI alone.
|
|
5322
5359
|
- `allow` is a count that is meant to stay, with its reason. It is exact too:
|
|
5323
|
-
when the element goes, the entry goes.
|
|
5360
|
+
when the element goes, the entry goes. The lock adds `allow` to the
|
|
5361
|
+
baseline: per kind, the two together may not rise against the base. So a
|
|
5362
|
+
count moved from the baseline into `allow` passes, and a new count that must
|
|
5363
|
+
stay goes in `allow` with its reason while the same count of that kind is
|
|
5364
|
+
burned down in the same change. Each `allow` entry that is new or raised
|
|
5365
|
+
against the base config prints a GitHub Actions warning with its file,
|
|
5366
|
+
kind, count and reason, so the reviewer reads it.
|
|
5324
5367
|
- A glob that matches no file fails. A line that outlived its files is deleted.
|
|
5325
5368
|
|
|
5326
5369
|
`ui-kit.baseline.json` is written only by the command: one sorted line per
|
|
@@ -5336,9 +5379,22 @@ repository would rise. `--init` writes the first baseline and refuses to
|
|
|
5336
5379
|
overwrite one; `--init --kind <kind>` takes the baseline for a kind just added
|
|
5337
5380
|
to `kinds`.
|
|
5338
5381
|
|
|
5339
|
-
On a pull request (`GITHUB_BASE_REF` set) it also compares with
|
|
5340
|
-
branch's baseline: no kind's total may be higher there.
|
|
5341
|
-
|
|
5382
|
+
On a pull request (`GITHUB_BASE_REF` set and not empty) it also compares with
|
|
5383
|
+
the base branch's baseline: no kind's total may be higher there. It fetches
|
|
5384
|
+
`origin/<base>` when the checkout lacks it; when that fails, the check fails.
|
|
5385
|
+
When git cannot read the checkout (no git, not a checkout, or a folder git
|
|
5386
|
+
does not trust), the check fails too.
|
|
5387
|
+
On a push (`GITHUB_EVENT_NAME` is `push`, no `GITHUB_BASE_REF`: main after a
|
|
5388
|
+
merge) it compares with the commit before this one (`HEAD^1`), and deepens a
|
|
5389
|
+
shallow checkout by one commit to read it; when that fails, the check fails.
|
|
5390
|
+
Give that job `fetch-depth: 2` in `actions/checkout`, so the commit is there
|
|
5391
|
+
without a fetch.
|
|
5392
|
+
`--no-base` skips the comparison where `GITHUB_BASE_REF` is not set; on a pull
|
|
5393
|
+
request it is refused.
|
|
5394
|
+
`--base-lock` changes nothing. Every release before the one that adds it
|
|
5395
|
+
stops on it as an unknown argument, so a repository that runs
|
|
5396
|
+
`efficient-shell-ui-check --base-lock` fails in its own CI when the shell or the
|
|
5397
|
+
checker alias is pinned back to such a release.
|
|
5342
5398
|
|
|
5343
5399
|
Wire it into the job that already gates a merge, for example at the front of
|
|
5344
5400
|
the `test` script: `"test": "efficient-shell-ui-check && vitest run"`.
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import{InputEndActionButton as e}from"./chunk-PT4GMPUB.js";import"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-
|
|
1
|
+
import{InputEndActionButton as e}from"./chunk-PT4GMPUB.js";import"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-2UMOTGAK.js";import{WindowTitle as n}from"./chunk-PDOPU3KN.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import{confirm as s}from"./chunk-KV6XCHAG.js";import"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-DTBSN6HE.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as a}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useRef as i,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",p="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(p)||k}function v(){const h=i(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,v]=l(k||b),[C,D]=l(w),[S,R]=l([w]),[W,z]=l(0),[E,G]=l(0),[L,U]=l(x),[H,M]=l(!1),[T,I]=l(null),P=i(null),A=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(L))}catch{}},[L]);const F=e=>{const t=f(e);t&&(v(t),D(t),R(e=>{const o=e.slice(0,W+1);return o.push(t),o}),z(e=>e+1),M(!1))},J=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},O=()=>{const e=T?.trim();e?(U(t=>[...t,{label:e,url:w}]),I(null)):I(null)};c(()=>{if(null===T)return;P.current?.focus(),P.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||I(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==T]);const Z=e=>{U(t=>t.filter((t,o)=>o!==e))},K=W>0,B=W<S.length-1,X=L.some(e=>e.url===w),Q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */u(n,{title:`Browser - ${N(w)}`}),
|
|
4
4
|
/* @__PURE__ */u(r,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(W>0){const e=W-1;z(e),v(
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(W<
|
|
8
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(W>0){const e=W-1;z(e),v(S[e]),D(S[e]),M(!1)}},disabled:!K,className:Q,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(W<S.length-1){const e=W+1;z(e),v(S[e]),D(S[e]),M(!1)}},disabled:!B,className:Q,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("button",{onClick:()=>G(e=>e+1),className:Q,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */u("button",{onClick:()=>F(b),className:Q,title:"Home",children:/* @__PURE__ */u(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),F(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>D(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),w!==C&&
|
|
13
13
|
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>D(w)}})})]})}),
|
|
14
|
-
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>X?
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:J,className:
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
14
|
+
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>X?Z(L.findIndex(e=>e.url===w)):void I(N(w)),className:Q+" "+(X?"text-yellow-500":""),title:X?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:X?"currentColor":"none",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:J,className:Q,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>M(e=>!e),className:Q,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==T&&/* @__PURE__ */m("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
17
17
|
/* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
18
18
|
/* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
|
|
19
|
-
/* @__PURE__ */u("input",{ref:
|
|
19
|
+
/* @__PURE__ */u("input",{ref:P,type:"text",value:T,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key?O():"Escape"===e.key&&I(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:
|
|
23
|
-
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>I(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:O,disabled:!T.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
23
|
+
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===L.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),L.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>F(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&Z(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
24
24
|
/* @__PURE__ */u("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
25
25
|
/* @__PURE__ */u("div",{className:"flex-1"}),
|
|
26
26
|
/* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(p,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
27
|
-
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:
|
|
27
|
+
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:E,iframeRef:A,openExternal:J,showHelp:H,dismissHelp:()=>M(!1)})})]})}function N(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function j({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[i,d]=l(!1);c(()=>{d(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!i?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
|
|
28
28
|
/* @__PURE__ */u(a,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
29
29
|
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[N(e)," can't be embedded"]}),
|
|
30
30
|
/* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-SQ4ZFG2B.js";import{SidebarLayout as t}from"./chunk-6D6Q3ZCG.js";import"./chunk-QWK6DRSN.js";import"./chunk-PC3MYH2K.js";import{SearchableSelect as n}from"./chunk-P62QGXRW.js";import{Breadcrumbs as a}from"./chunk-YM7AWNMY.js";import{Select_default as r}from"./chunk-KITSIQCV.js";import"./chunk-EO5RLFRX.js";import"./chunk-K5YT5PMJ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-QMBMK6PP.js";import{Input_default as l}from"./chunk-PT4GMPUB.js";import{DropdownMenu as o}from"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import{IconButton_default as c}from"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{formatBytes as d}from"./chunk-GEYM4WN3.js";import"./chunk-Y3JW2GW5.js";import"./chunk-36BRD5J3.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as m,subscribeFilesChoice as h,getFilesChoice as u,holdFilesChoice as f,answerFilesChoice as p,choiceTakes as g}from"./chunk-4EFIUJ7X.js";import{AboutApp as k}from"./chunk-
|
|
2
|
-
return H(
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-SQ4ZFG2B.js";import{SidebarLayout as t}from"./chunk-6D6Q3ZCG.js";import"./chunk-QWK6DRSN.js";import"./chunk-PC3MYH2K.js";import{SearchableSelect as n}from"./chunk-P62QGXRW.js";import{Breadcrumbs as a}from"./chunk-YM7AWNMY.js";import{Select_default as r}from"./chunk-KITSIQCV.js";import"./chunk-EO5RLFRX.js";import"./chunk-K5YT5PMJ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-QMBMK6PP.js";import{Input_default as l}from"./chunk-PT4GMPUB.js";import{DropdownMenu as o}from"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import{IconButton_default as c}from"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{formatBytes as d}from"./chunk-GEYM4WN3.js";import"./chunk-Y3JW2GW5.js";import"./chunk-36BRD5J3.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as m,subscribeFilesChoice as h,getFilesChoice as u,holdFilesChoice as f,answerFilesChoice as p,choiceTakes as g}from"./chunk-4EFIUJ7X.js";import{AboutApp as k}from"./chunk-2UMOTGAK.js";import{getFilesStore as w,peekFilesViewRequest as y,consumeFilesViewRequest as v,FILES_SHOW_TRASH_EVENT as b,FILES_OPEN_DESKTOP_FOLDER_EVENT as x,subscribeDesktopFolders as N,getDesktopFoldersSnapshot as C,hasHostFilesStore as S,FolderGlyph as j,DesktopItemMiniIcon as D,desktopItemTypeLabel as M,FilesQuotaError as $,FILES_OFFICE_EXTENSIONS as T}from"./chunk-WBAWJIVM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as L,WindowTitle as P}from"./chunk-PDOPU3KN.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import{confirm as R,prompt as A}from"./chunk-KV6XCHAG.js";import{Dialog as F}from"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import{ItemCount as E}from"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-DTBSN6HE.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as W}from"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as z}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as I}from"./chunk-R2VKEMZH.js";import{TH_ONE_LINE as O}from"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import{toast_default as K}from"./chunk-TMSSR5UH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useState as U,useRef as G,useEffect as Y,useCallback as J,useSyncExternalStore as B,useMemo as V}from"react";import{jsxs as H,jsx as Q,Fragment as Z}from"react/jsx-runtime";var X={doc:"document",docx:"document",odt:"document",rtf:"document",txt:"document",md:"document",xls:"spreadsheet",xlsx:"spreadsheet",ods:"spreadsheet",csv:"spreadsheet",sheet:"spreadsheet",ppt:"slides",pptx:"slides",odp:"slides",key:"slides",slides:"slides",pdf:"pdf",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",heic:"image",tif:"image",tiff:"image",mp4:"video",mov:"video",webm:"video",avi:"video",mkv:"video",mp3:"audio",wav:"audio",m4a:"audio",ogg:"audio",flac:"audio",zip:"archive",rar:"archive","7z":"archive",gz:"archive",tar:"archive",dxf:"drawing",dwg:"drawing",stp:"drawing",step:"drawing",stl:"drawing",obj:"drawing",iges:"drawing",igs:"drawing","3mf":"drawing",glb:"drawing",gltf:"drawing"};function q(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function _(e){if("folder"===e.kind)return"folder";if("document"===e.officeKind)return"document";if("spreadsheet"===e.officeKind)return"spreadsheet";if("deck"===e.officeKind)return"slides";const t=e.contentType??"";return"application/pdf"===t?"pdf":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":X[q(e.name)]??"other"}var ee={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},te={folder:{name:"folder",tone:"muted"},document:{name:"document",tone:"accent"},spreadsheet:{name:"table",tone:"success"},slides:{name:"presentation-chart-bar",tone:"warning"},pdf:{name:"document",tone:"danger"},image:{name:"image",tone:"muted"},video:{name:"play",tone:"muted"},audio:{name:"speaker-wave",tone:"muted"},archive:{name:"archive-box",tone:"muted"},drawing:{name:"cube-transparent",tone:"muted"},other:{name:"page",tone:"muted"}};function ne(e){const t=e.officeKind?T[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function ae(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":d(e.size)}function re(e,t=/* @__PURE__ */new Date){if(!e)return"—";const n=new Date(e);return isNaN(n.getTime())?"—":n.toDateString()===t.toDateString()?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.getFullYear()===t.getFullYear()?n.toLocaleDateString(void 0,{day:"numeric",month:"short"}):n.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function ie(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var se=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function le(e,t){const n="asc"===t.dir?1:-1;return[...e].sort((e,a)=>e.kind!==a.kind?"folder"===e.kind?-1:1:n*((e,n)=>{switch(t.key){case"owner":return se.compare(ie(e),ie(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return se.compare(ne(e),ne(n))}})(e,a)||se.compare(e.name,a.name))}var oe=["folder","document","spreadsheet","slides","pdf","image","video"],ce={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function de(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=new Date(t);return n.setHours(0,0,0,0),"week"===e&&n.setDate(n.getDate()-6),"month"===e&&n.setDate(n.getDate()-29),"year"===e&&n.setMonth(0,1),n.getTime()}(t.modified,n):null;return e.filter(e=>{if(t.type&&_(e)!==t.type)return!1;if(t.person){const n="owner"===(e.role??"owner");if("me"===t.person?!n:n||e.owner?.id!==t.person)return!1}return null===a||(Date.parse(e.modifiedAt)||0)>=a})}var me=[{value:"viewer",label:"Viewer"},{value:"editor",label:"Editor"}];function he({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=U(null),[o,d]=U(""),[m,h]=U([]),[u,f]=U(!1),[p,g]=U(""),[k,w]=U("viewer"),[y,v]=U(!1),b=G(/* @__PURE__ */new Map),x=t?.id??null;if(Y(()=>{if(l(null),g(""),d(""),!x||!e.shares)return;let t=!0;return e.shares(x).then(e=>{t&&l(e)}).catch(e=>{t&&(K.error(e.message),l([]))}),()=>{t=!1}},[x,e]),Y(()=>{if(!e.searchPeople||!x)return;let t=!0;f(!0);const n=setTimeout(()=>{e.searchPeople(o).then(e=>{if(t){for(const t of e)b.current.set(t.id,t);h(e)}}).catch(()=>{t&&h([])}).finally(()=>{t&&f(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[o,x,e]),!t)return null;const N=new Set((s??[]).map(e=>e.person.id)),C=m.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),S=async n=>{v(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){K.error(e.message)}finally{v(!1)}};/* @__PURE__ */
|
|
2
|
+
return H(F,{open:!0,onClose:a,size:"md",title:`Share “${t.name}”`,description:"folder"===t.kind?"Everything inside this folder is shared too. Editors’ uploads count toward your quota.":"Viewers can open and download it. Editors can also replace, rename and delete it.",footer:/* @__PURE__ */Q(W,{variant:"secondary",onClick:a,children:"Done"}),children:[
|
|
3
3
|
/* @__PURE__ */H("div",{className:"flex items-center gap-2",children:[
|
|
4
4
|
/* @__PURE__ */Q("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */Q(n,{value:p,onChange:g,onSearchChange:d,loading:u&&0===m.length,options:C,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
|
|
5
5
|
/* @__PURE__ */Q("div",{className:"w-28 shrink-0",children:/* @__PURE__ */Q(r,{value:k,onChange:e=>w(e),options:me,"aria-label":"Access"})}),
|
|
6
|
-
/* @__PURE__ */Q(W,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=b.current.get(p);S(async()=>{await e.share(t.id,p,k),g(""),d(""),n&&
|
|
6
|
+
/* @__PURE__ */Q(W,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=b.current.get(p);S(async()=>{await e.share(t.id,p,k),g(""),d(""),n&&K.success(`Shared with ${n.name}`)})},disabled:!p||y,children:"Add"})]}),
|
|
7
7
|
/* @__PURE__ */Q("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */Q(I,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */H("ul",{className:"divide-y divide-line-subtle text-sm",children:[
|
|
8
8
|
/* @__PURE__ */H("li",{className:"flex items-center gap-2 h-10",children:[
|
|
9
9
|
/* @__PURE__ */Q("span",{className:"flex-1 truncate",children:"You"}),
|
|
@@ -11,7 +11,7 @@ return H(A,{open:!0,onClose:a,size:"md",title:`Share “${t.name}”`,descriptio
|
|
|
11
11
|
/* @__PURE__ */Q("span",{className:"flex-1 truncate",title:n.person.name,children:n.person.name}),
|
|
12
12
|
/* @__PURE__ */Q("div",{className:"w-28 shrink-0",children:/* @__PURE__ */Q(r,{value:n.role,onChange:a=>S(()=>e.share(t.id,n.person.id,a)),options:me,"aria-label":`Access for ${n.person.name}`,disabled:y})}),
|
|
13
13
|
/* @__PURE__ */Q(c,{"aria-label":`Remove ${n.person.name}`,variant:"ghost",size:"sm",disabled:y,onClick:()=>S(()=>e.unshare(t.id,n.person.id)),children:/* @__PURE__ */Q(z,{name:"close",className:"h-4 w-4",strokeWidth:1.8})})]},n.person.id))]})]})}function ue({store:e,items:t,from:n,onClose:a,onMove:r}){const[i,s]=U(n??null),[l,o]=U(null),[d,m]=U(!1);Y(()=>{t&&s(n??null)},[t,n]),Y(()=>{if(!t)return;let n=!0;return m(!0),e.list(i).then(e=>{n&&o(e)}).catch(()=>{n&&o(null)}).finally(()=>{n&&m(!1)}),()=>{n=!1}},[e,i,t]);const h=new Set((t??[]).map(e=>e.id)),u=(l?.entries??[]).filter(e=>"folder"===e.kind&&!h.has(e.id)),f=(l?.folder.path??[]).filter(e=>null!==e.id),p=f.length>1?f[f.length-2].id:null,g=l?.folder,k="viewer"!==(g?.role??"owner"),w=void 0!==n&&i===n,y=t?.length??0,v=1===y?`"${t[0].name}"`:`${y} items`;/* @__PURE__ */
|
|
14
|
-
return H(
|
|
14
|
+
return H(F,{open:!!t,onClose:a,title:`Move ${v}`,size:"sm",footer:/* @__PURE__ */H(Z,{children:[
|
|
15
15
|
/* @__PURE__ */Q(W,{variant:"secondary",onClick:a,children:"Cancel"}),
|
|
16
16
|
/* @__PURE__ */Q(W,{variant:"primary",onClick:()=>r(i),disabled:d||!k||w,children:"Move here"})]}),children:[
|
|
17
17
|
/* @__PURE__ */H("div",{className:"flex items-center gap-1 mb-2 min-h-8",children:[null!==i&&/* @__PURE__ */Q(c,{"aria-label":"Back",size:"sm",onClick:()=>s(p),children:/* @__PURE__ */Q(z,{name:"arrow-left",className:"h-4 w-4"})}),
|
|
@@ -32,9 +32,9 @@ return H("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col mi
|
|
|
32
32
|
/* @__PURE__ */Q("span",{className:"truncate",children:e.person.name}),
|
|
33
33
|
/* @__PURE__ */Q("span",{className:"text-ink-faint text-xs",children:"editor"===e.role?"Editor":"Viewer"})]},e.person.id))})]}),
|
|
34
34
|
/* @__PURE__ */H("dl",{className:"border-t border-line pt-2",children:[h("Type",o?ee[o]:null),"file"===t.kind&&h("Size",ae(t)),h("Location",m),h("Owner","me"===ie(t)?"me":ie(t)),h("Modified",t.modifiedAt?`${re(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),h("Created",r?.createdAt?re(r.createdAt):null)]})]}):/* @__PURE__ */Q("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var pe=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,ge="files.layout",ke={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"},we=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],ye="application/x-efficient-files";function ve(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function be(){try{return"grid"===localStorage.getItem(ge)?"grid":"list"}catch{return"list"}}function xe(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=m()??[];for(const e of n){const t=a.find(t=>"folder"===t.kind&&t.name===e);a=t?.children??[]}return{folder:{id:e,name:n[n.length-1]??"",role:"owner",path:[{id:null,name:""},...n.map((e,t)=>({id:"/"+n.slice(0,t+1).join("/"),name:e}))]},entries:a.map(e=>({id:("/"===t?"":t)+"/"+e.name,name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}}function Ne(e,t){return`Not enough space for “${e}” (${d(t.attempted)}). You've used ${d(t.used)} of ${d(t.limit)}. Empty Trash or ask an administrator for more space.`}var Ce=(e,t)=>e instanceof Error&&e.message||t;function Se(e){const t=[];for(const n of e)("divider"!==n.type||0!==t.length&&"divider"!==t[t.length-1].type)&&t.push(n);for(;t.length&&"divider"===t[t.length-1].type;)t.pop();return t}function je({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=te[_(e)];/* @__PURE__ */
|
|
35
|
-
return Q(z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function De({entry:e,read:t}){const[n,a]=U(null),r="image"===_(e)&&e.size<=5242880;return Y(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */Q("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */Q(je,{entry:e,className:"h-10 w-10"})}function Me(){const n=w(),r=n.title??"Files",A=null!==m(),X=!A&&!!n.shares&&!!n.sharedWithMe,[_,me]=U(null),[Me,$e]=U(null),[Te,Le]=U([]),[Re,Pe]=U(()=>/* @__PURE__ */new Set),Fe=G(null),[Ae,Ee]=U(!0),[We,ze]=U(!1),[Ie,Ke]=U(null),[Oe,Ue]=U(!1),[Ge,Ye]=U(null),[Je,Be]=U(null),[Ve,He]=U(null),[Qe,Ze]=U(be),[Xe,qe]=U(!1),[_e,et]=U(""),[tt,nt]=U(""),[at,rt]=U({}),[it,st]=U({key:"name",dir:"asc"}),[lt,ot]=U(()=>{const e=y();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),ct=G("files"),dt=G(lt);dt.current=lt,Y(()=>{v()},[]);const[mt,ht]=U([]),ut=e=>{Ze(e);try{localStorage.setItem(ge,e)}catch{}},ft=J(e=>{ot(e),rt({}),st("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(et(""),nt(""))},[]);Y(()=>{const e=()=>{v(),ft("trash")},t=e=>{v();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(b,e),window.addEventListener(x,t),()=>{window.removeEventListener(b,e),window.removeEventListener(x,t)}},[ft]);const pt=B(N,C,C),gt="object"==typeof lt?lt.desktopFolderId:null,kt=gt?pt?.folders.find(e=>e.id===gt)??null:null,wt=gt&&pt?.itemsByFolder[gt]||[];Y(()=>{gt&&pt&&!pt.folders.some(e=>e.id===gt)&&ft("files")},[gt,pt,ft]);const yt=G(0),vt=G(null),bt=G(null),{openPage:xt,openEntity:Nt}=L(),Ct=i(),St=i(),jt=i(),Dt=B(h,u,u);Y(()=>f(),[]),Y(()=>{!Dt||"trash"!==lt&&"object"!=typeof lt||ft("files")},[Dt,lt,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>xt(e)}):"page"===t.entityType?xt(t.entityId):Nt(t.entityType,t.entityId,null,t.label)},$t=J(async()=>{if(!A)try{Ke(await n.quota())}catch{}},[n,A]),Tt=J(async(e,t)=>{Ee(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):O.error(Ce(e,t))}finally{Ee(!1)}},[]),Lt=J(async e=>{if(A)return $e(xe(e)),ze(!1),void Ee(!1);await Tt(async()=>{$e(await n.list(e))},"Failed to list"),$t()},[n,$t,A,Tt]),Rt=J(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=A?xe(_):await n.list(_).catch(()=>null);return Le((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void Ee(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await Tt(async()=>{Le(await a())},"Failed to list files")},[n,A,_,Tt]),Pt=J(async()=>{if(A)return ht([]),void Ee(!1);await Tt(async()=>{ht(await n.trash())},"Failed to list trash"),$t()},[n,$t,A,Tt]),Ft=()=>{"files"===lt?Lt(_):pe(lt)?Rt(lt,tt):"trash"===lt&&Pt()};Y(()=>{Pe(/* @__PURE__ */new Set),Fe.current=null,Ft()},[_,lt,tt]),Y(()=>{const e=_e.trim();if(!e)return;const t=setTimeout(()=>{e===tt&&"search"===dt.current||("search"!==dt.current&&(ct.current=dt.current),ot("search"),rt({}),nt(e))},300);return()=>clearTimeout(t)},[_e]);const At=()=>{et(""),"search"===dt.current&&ft(ct.current)},Et=e=>{ft("files"),me(e)},Wt=async(e,t)=>{try{await e()}catch(e){O.error(Ce(e,t))}Ft()},zt=e=>Wt(async()=>{await n.restore(e.id),O.success(`Restored "${e.name}"`)},"Restore failed"),It=async e=>{await P({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Wt(()=>n.purge(e.id),"Delete failed")},Kt=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){O.error(Ce(e,"Download failed"))}},Ot="files"===lt?Me?.folder??null:null,Ut=Ot?.role??"owner",Gt="owner"!==Ut,Yt="files"===lt?_:null,Jt=!A&&("files"!==lt||"viewer"!==Ut),Bt=!A&&"files"===lt&&"viewer"!==Ut,Vt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Yt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof $?O.error(Ne(r.name,e)):O.error(`Upload ${r.name}: ${Ce(e,"failed")}`)}}a>1&&O.success(`Uploaded ${a} files`),"files"===lt?Lt(_):Et(null)},Ht=async e=>{const t=ne(e),a=await F({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?O.error("Names cannot contain slashes"):Wt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?T[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??Me?.folder.owner)?.name??"its owner":"their owners";await P({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ne(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await Wt(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),O.success(t?`"${ne(t)}" moved to trash`:`${e.length} items moved to trash`))},Zt=(e,t)=>Wt(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),Xt=async(e,t)=>{He(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Wt(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),O.success(1===a.length?`Moved "${ne(a[0])}"`:`Moved ${a.length} items`))},qt=()=>{yt.current=0,Ue(!1),Ye(null)};Y(()=>{const e=()=>qt();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const _t="files"===lt?Me?.entries??[]:pe(lt)?Te:[],en=V(()=>le(de(_t,at),it),[_t,at,it]),tn=V(()=>new Map(en.map(e=>[e.id,e])),[en]),nn=[...Re].map(e=>tn.get(e)).filter(e=>!!e),an=1===nn.length?nn[0]:null,rn=e=>e.role??("files"===lt?Ut:"owner"),sn=e=>!A&&"viewer"!==rn(e),ln=e=>X&&"owner"===rn(e),on=e=>!!n.move&&sn(e),cn=(e,t)=>{if(Dt){const t=tn.get(e);if(t&&"file"===t.kind&&!mn(t))return;return void Pe(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&Fe.current){const t=en.map(e=>e.id),n=t.indexOf(Fe.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Pe(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}Fe.current=e,t.metaKey||t.ctrlKey?Pe(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Pe(/* @__PURE__ */new Set([e]))},dn=()=>{Pe(/* @__PURE__ */new Set),Fe.current=null},mn=e=>!!Dt&&"file"===e.kind&&g(Dt.request,e.name),hn=e=>Dt&&"file"===e.kind&&!mn(e)?"text-ink-faintest":"",un=e=>{if(!Dt||!mn(e))return;const t="files"===lt?Me?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===lt?"Shared with me":"My files";p(Dt.id,{entry:e,folderId:"files"===lt?_:null,location:n})},fn=Dt&&an&&mn(an)?an:null,pn=t=>{"folder"===t.kind?Et(t.id):Dt?un(t):(async t=>{if(A)return;if(n.open?.(t))return;const a=ke[q(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>xt(e)}):Kt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Dt)return t&&("folder"===t.kind||mn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(sn);if(A)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const s=e.some(e=>!e.starred);return Se([...t?[{key:"open",label:a,icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */Q(z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */Q(z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Ht(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */Q(z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Wt(async()=>{for(const t of e)await n.copy(t.id);O.success(1===e.length?`Copied "${ne(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&ln(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */Q(z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Be(t)}]:[],...e.every(on)?[{key:"move",label:"Move",icon:/* @__PURE__ */Q(z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>He(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */Q(z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Zt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */Q(z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Pe(/* @__PURE__ */new Set([t.id])),qe(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},kn=(e,t)=>{const n=Re.has(t.id)?nn:[t];Ct.open(e,n)&&!Re.has(t.id)&&(Pe(/* @__PURE__ */new Set([t.id])),Fe.current=t.id)},wn=e=>on(e)?{draggable:!0,onDragStart:t=>{const n=Re.has(e.id)?nn:[e];t.dataTransfer.setData(ye,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},yn=e=>"folder"===e.kind&&sn(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(ye)&&(t.preventDefault(),t.stopPropagation(),Ge!==e.id&&Ye(e.id))},onDragLeave:()=>{Ge===e.id&&Ye(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(ye))return;t.preventDefault(),t.stopPropagation(),Ye(null);const n=JSON.parse(t.dataTransfer.getData(ye)||"[]").map(e=>tn.get(e)).filter(t=>!!t&&t.id!==e.id);Xt(n,e.id)}}:{};if(We)/* @__PURE__ */
|
|
35
|
+
return Q(z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function De({entry:e,read:t}){const[n,a]=U(null),r="image"===_(e)&&e.size<=5242880;return Y(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */Q("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */Q(je,{entry:e,className:"h-10 w-10"})}function Me(){const n=w(),r=n.title??"Files",F=null!==m(),X=!F&&!!n.shares&&!!n.sharedWithMe,[_,me]=U(null),[Me,$e]=U(null),[Te,Le]=U([]),[Pe,Re]=U(()=>/* @__PURE__ */new Set),Ae=G(null),[Fe,Ee]=U(!0),[We,ze]=U(!1),[Ie,Oe]=U(null),[Ke,Ue]=U(!1),[Ge,Ye]=U(null),[Je,Be]=U(null),[Ve,He]=U(null),[Qe,Ze]=U(be),[Xe,qe]=U(!1),[_e,et]=U(""),[tt,nt]=U(""),[at,rt]=U({}),[it,st]=U({key:"name",dir:"asc"}),[lt,ot]=U(()=>{const e=y();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),ct=G("files"),dt=G(lt);dt.current=lt,Y(()=>{v()},[]);const[mt,ht]=U([]),ut=e=>{Ze(e);try{localStorage.setItem(ge,e)}catch{}},ft=J(e=>{ot(e),rt({}),st("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(et(""),nt(""))},[]);Y(()=>{const e=()=>{v(),ft("trash")},t=e=>{v();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(b,e),window.addEventListener(x,t),()=>{window.removeEventListener(b,e),window.removeEventListener(x,t)}},[ft]);const pt=B(N,C,C),gt="object"==typeof lt?lt.desktopFolderId:null,kt=gt?pt?.folders.find(e=>e.id===gt)??null:null,wt=gt&&pt?.itemsByFolder[gt]||[];Y(()=>{gt&&pt&&!pt.folders.some(e=>e.id===gt)&&ft("files")},[gt,pt,ft]);const yt=G(0),vt=G(null),bt=G(null),{openPage:xt,openEntity:Nt}=L(),Ct=i(),St=i(),jt=i(),Dt=B(h,u,u);Y(()=>f(),[]),Y(()=>{!Dt||"trash"!==lt&&"object"!=typeof lt||ft("files")},[Dt,lt,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>xt(e)}):"page"===t.entityType?xt(t.entityId):Nt(t.entityType,t.entityId,null,t.label)},$t=J(async()=>{if(!F)try{Oe(await n.quota())}catch{}},[n,F]),Tt=J(async(e,t)=>{Ee(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):K.error(Ce(e,t))}finally{Ee(!1)}},[]),Lt=J(async e=>{if(F)return $e(xe(e)),ze(!1),void Ee(!1);await Tt(async()=>{$e(await n.list(e))},"Failed to list"),$t()},[n,$t,F,Tt]),Pt=J(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=F?xe(_):await n.list(_).catch(()=>null);return Le((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void Ee(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await Tt(async()=>{Le(await a())},"Failed to list files")},[n,F,_,Tt]),Rt=J(async()=>{if(F)return ht([]),void Ee(!1);await Tt(async()=>{ht(await n.trash())},"Failed to list trash"),$t()},[n,$t,F,Tt]),At=()=>{"files"===lt?Lt(_):pe(lt)?Pt(lt,tt):"trash"===lt&&Rt()};Y(()=>{Re(/* @__PURE__ */new Set),Ae.current=null,At()},[_,lt,tt]),Y(()=>{const e=_e.trim();if(!e)return;const t=setTimeout(()=>{e===tt&&"search"===dt.current||("search"!==dt.current&&(ct.current=dt.current),ot("search"),rt({}),nt(e))},300);return()=>clearTimeout(t)},[_e]);const Ft=()=>{et(""),"search"===dt.current&&ft(ct.current)},Et=e=>{ft("files"),me(e)},Wt=async(e,t)=>{try{await e()}catch(e){K.error(Ce(e,t))}At()},zt=e=>Wt(async()=>{await n.restore(e.id),K.success(`Restored "${e.name}"`)},"Restore failed"),It=async e=>{await R({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Wt(()=>n.purge(e.id),"Delete failed")},Ot=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){K.error(Ce(e,"Download failed"))}},Kt="files"===lt?Me?.folder??null:null,Ut=Kt?.role??"owner",Gt="owner"!==Ut,Yt="files"===lt?_:null,Jt=!F&&("files"!==lt||"viewer"!==Ut),Bt=!F&&"files"===lt&&"viewer"!==Ut,Vt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Yt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof $?K.error(Ne(r.name,e)):K.error(`Upload ${r.name}: ${Ce(e,"failed")}`)}}a>1&&K.success(`Uploaded ${a} files`),"files"===lt?Lt(_):Et(null)},Ht=async e=>{const t=ne(e),a=await A({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?K.error("Names cannot contain slashes"):Wt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?T[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??Me?.folder.owner)?.name??"its owner":"their owners";await R({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ne(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await Wt(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),K.success(t?`"${ne(t)}" moved to trash`:`${e.length} items moved to trash`))},Zt=(e,t)=>Wt(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),Xt=async(e,t)=>{He(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Wt(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),K.success(1===a.length?`Moved "${ne(a[0])}"`:`Moved ${a.length} items`))},qt=()=>{yt.current=0,Ue(!1),Ye(null)};Y(()=>{const e=()=>qt();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const _t="files"===lt?Me?.entries??[]:pe(lt)?Te:[],en=V(()=>le(de(_t,at),it),[_t,at,it]),tn=V(()=>new Map(en.map(e=>[e.id,e])),[en]),nn=[...Pe].map(e=>tn.get(e)).filter(e=>!!e),an=1===nn.length?nn[0]:null,rn=e=>e.role??("files"===lt?Ut:"owner"),sn=e=>!F&&"viewer"!==rn(e),ln=e=>X&&"owner"===rn(e),on=e=>!!n.move&&sn(e),cn=(e,t)=>{if(Dt){const t=tn.get(e);if(t&&"file"===t.kind&&!mn(t))return;return void Re(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&Ae.current){const t=en.map(e=>e.id),n=t.indexOf(Ae.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Re(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}Ae.current=e,t.metaKey||t.ctrlKey?Re(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Re(/* @__PURE__ */new Set([e]))},dn=()=>{Re(/* @__PURE__ */new Set),Ae.current=null},mn=e=>!!Dt&&"file"===e.kind&&g(Dt.request,e.name),hn=e=>Dt&&"file"===e.kind&&!mn(e)?"text-ink-faintest":"",un=e=>{if(!Dt||!mn(e))return;const t="files"===lt?Me?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===lt?"Shared with me":"My files";p(Dt.id,{entry:e,folderId:"files"===lt?_:null,location:n})},fn=Dt&&an&&mn(an)?an:null,pn=t=>{"folder"===t.kind?Et(t.id):Dt?un(t):(async t=>{if(F)return;if(n.open?.(t))return;const a=ke[q(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>xt(e)}):Ot(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Dt)return t&&("folder"===t.kind||mn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(sn);if(F)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const s=e.some(e=>!e.starred);return Se([...t?[{key:"open",label:a,icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */Q(z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Ot)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */Q(z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Ht(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */Q(z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Wt(async()=>{for(const t of e)await n.copy(t.id);K.success(1===e.length?`Copied "${ne(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&ln(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */Q(z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Be(t)}]:[],...e.every(on)?[{key:"move",label:"Move",icon:/* @__PURE__ */Q(z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>He(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */Q(z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Zt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */Q(z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Re(/* @__PURE__ */new Set([t.id])),qe(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},kn=(e,t)=>{const n=Pe.has(t.id)?nn:[t];Ct.open(e,n)&&!Pe.has(t.id)&&(Re(/* @__PURE__ */new Set([t.id])),Ae.current=t.id)},wn=e=>on(e)?{draggable:!0,onDragStart:t=>{const n=Pe.has(e.id)?nn:[e];t.dataTransfer.setData(ye,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},yn=e=>"folder"===e.kind&&sn(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(ye)&&(t.preventDefault(),t.stopPropagation(),Ge!==e.id&&Ye(e.id))},onDragLeave:()=>{Ge===e.id&&Ye(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(ye))return;t.preventDefault(),t.stopPropagation(),Ye(null);const n=JSON.parse(t.dataTransfer.getData(ye)||"[]").map(e=>tn.get(e)).filter(t=>!!t&&t.id!==e.id);Xt(n,e.id)}}:{};if(We)/* @__PURE__ */
|
|
36
36
|
return H("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
37
|
-
/* @__PURE__ */Q(
|
|
37
|
+
/* @__PURE__ */Q(P,{title:`${r} - offline`}),
|
|
38
38
|
/* @__PURE__ */Q("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */H("div",{className:"max-w-md",children:[
|
|
39
39
|
/* @__PURE__ */Q(z,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),S()?/* @__PURE__ */H(Z,{children:[
|
|
40
40
|
/* @__PURE__ */Q("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
|
|
@@ -42,16 +42,16 @@ return H("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
|
42
42
|
/* @__PURE__ */Q("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
|
|
43
43
|
/* @__PURE__ */H("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
|
|
44
44
|
/* @__PURE__ */Q("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
|
|
45
|
-
/* @__PURE__ */Q(W,{variant:"primary",onClick:
|
|
45
|
+
/* @__PURE__ */Q(W,{variant:"primary",onClick:At,children:"Retry"})]})})]});const vn=Ie&&Ie.limit>0?Math.min(100,Math.round(Ie.used/Ie.limit*100)):0,bn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",xn=[Gt?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>Et(null)},...(Kt?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>Et(e.id)}))],Nn="recent"===lt?"Recent":"starred"===lt?"Starred":"shared"===lt?"Shared with me":"search"===lt?`Results for “${tt}”`:"trash"===lt?"Trash":kt?kt.name:null,Cn=Dt?`${r} - Choosing`:Nn?`${r} - ${"search"===lt?"Search":Nn}`:Kt&&null!==Kt.id?`${r} - ${Kt.name}`:r,Sn=e=>"flex w-full items-center gap-3 rounded-full px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-accent-tint font-medium text-accent-text":"text-ink hover:bg-row-hover"),jn=Se([{key:"folder",label:"New folder",icon:/* @__PURE__ */Q(z,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await A({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?K.error("Folder names cannot contain slashes"):(await Wt(()=>n.createFolder(Yt,e),"Create folder failed"),"files"!==lt&&Et(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */Q(z,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */Q(z,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>bt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?we.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=te["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */Q(z,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Yt)).catch(e=>K.error(Ce(e,"Could not create it")))}}}):[]]),Dn=/* @__PURE__ */H("div",{className:"flex h-full flex-col",children:[
|
|
46
46
|
/* @__PURE__ */Q("div",{className:"p-3 pb-2",children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */H(Z,{children:[
|
|
47
47
|
/* @__PURE__ */Q(z,{name:"add",className:"h-5 w-5"}),
|
|
48
48
|
/* @__PURE__ */Q("span",{children:"New"})]}),items:jn,align:"start","aria-label":"New",disabled:!Jt,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
|
|
49
49
|
/* @__PURE__ */H("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
|
|
50
50
|
/* @__PURE__ */H("button",{onClick:()=>Et(null),className:Sn("files"===lt&&!Gt),children:[
|
|
51
|
-
/* @__PURE__ */Q(z,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!
|
|
52
|
-
/* @__PURE__ */Q(z,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!
|
|
51
|
+
/* @__PURE__ */Q(z,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!F&&/* @__PURE__ */H("button",{onClick:()=>ft("recent"),className:Sn("recent"===lt),children:[
|
|
52
|
+
/* @__PURE__ */Q(z,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!F&&/* @__PURE__ */H("button",{onClick:()=>ft("starred"),className:Sn("starred"===lt),children:[
|
|
53
53
|
/* @__PURE__ */Q(z,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),X&&/* @__PURE__ */H("button",{onClick:()=>ft("shared"),className:Sn("shared"===lt||"files"===lt&&Gt),children:[
|
|
54
|
-
/* @__PURE__ */Q(z,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!
|
|
54
|
+
/* @__PURE__ */Q(z,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!F&&/* @__PURE__ */H("button",{onClick:()=>ft("trash"),className:Sn("trash"===lt),children:[
|
|
55
55
|
/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),pt&&pt.folders.length>0&&/* @__PURE__ */H(Z,{children:[
|
|
56
56
|
/* @__PURE__ */Q("div",{className:"px-3 pt-4 pb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),pt.folders.map(e=>/* @__PURE__ */H("button",{onClick:()=>ft({desktopFolderId:e.id}),className:Sn(gt===e.id),children:[
|
|
57
57
|
/* @__PURE__ */Q(j,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
@@ -59,45 +59,45 @@ return H("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
|
59
59
|
/* @__PURE__ */Q(E,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),Ie&&/* @__PURE__ */H("div",{className:"px-5 py-3 shrink-0",title:`${d(Ie.used)} of ${d(Ie.limit)} used`,children:[
|
|
60
60
|
/* @__PURE__ */Q("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */Q("div",{className:`h-full ${bn} transition-all`,style:{width:`${vn}%`}})}),
|
|
61
61
|
/* @__PURE__ */H("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[d(Ie.used)," of ",d(Ie.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */H("span",{className:"inline-flex items-center gap-1",children:[e,
|
|
62
|
-
/* @__PURE__ */Q(z,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),$n=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),Tn=pe(lt)||"files"===lt,Ln=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>se.compare(e.name,t.name))}(_t),
|
|
62
|
+
/* @__PURE__ */Q(z,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),$n=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),Tn=pe(lt)||"files"===lt,Ln=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>se.compare(e.name,t.name))}(_t),Pn=Tn&&_t.length>0?/* @__PURE__ */H("div",{className:"flex items-center gap-2 shrink-0",children:[
|
|
63
63
|
/* @__PURE__ */Q(o,{trigger:Mn(at.type?ee[at.type]:"Type",!!at.type),"aria-label":"Type",triggerClassName:$n(!!at.type),items:[...oe.map(e=>({type:"radio",key:e,label:ee[e],checked:at.type===e,onSelect:()=>rt(t=>({...t,type:t.type===e?null:e}))})),...at.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,type:null}))}]:[]]}),X&&/* @__PURE__ */Q(o,{trigger:Mn(at.person?"me"===at.person?"Owned by me":Ln.find(e=>e.id===at.person)?.name??"People":"People",!!at.person),"aria-label":"People",triggerClassName:$n(!!at.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===at.person,onSelect:()=>rt(e=>({...e,person:"me"===e.person?null:"me"}))},...Ln.map(e=>({type:"radio",key:e.id,label:e.name,checked:at.person===e.id,onSelect:()=>rt(t=>({...t,person:t.person===e.id?null:e.id}))})),...at.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,person:null}))}]:[]]}),
|
|
64
|
-
/* @__PURE__ */Q(o,{trigger:Mn(at.modified?ce[at.modified]:"Modified",!!at.modified),"aria-label":"Modified",triggerClassName:$n(!!at.modified),items:[...Object.keys(ce).map(e=>({type:"radio",key:e,label:ce[e],checked:at.modified===e,onSelect:()=>rt(t=>({...t,modified:t.modified===e?null:e}))})),...at.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,modified:null}))}]:[]]})]}):null,
|
|
64
|
+
/* @__PURE__ */Q(o,{trigger:Mn(at.modified?ce[at.modified]:"Modified",!!at.modified),"aria-label":"Modified",triggerClassName:$n(!!at.modified),items:[...Object.keys(ce).map(e=>({type:"radio",key:e,label:ce[e],checked:at.modified===e,onSelect:()=>rt(t=>({...t,modified:t.modified===e?null:e}))})),...at.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,modified:null}))}]:[]]})]}):null,Rn=Tn&&nn.length>0&&!Dt?/* @__PURE__ */H("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
|
|
65
65
|
/* @__PURE__ */Q(c,{"aria-label":"Clear selection",size:"sm",onClick:dn,children:/* @__PURE__ */Q(z,{name:"close",className:"h-4 w-4"})}),
|
|
66
|
-
/* @__PURE__ */H("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[nn.length," selected"]}),an&&ln(an)&&/* @__PURE__ */Q(c,{"aria-label":"Share",size:"sm",onClick:()=>Be(an),children:/* @__PURE__ */Q(z,{name:"add-person",className:"h-4 w-4"})}),!
|
|
67
|
-
/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(nn)})]}):null,
|
|
66
|
+
/* @__PURE__ */H("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[nn.length," selected"]}),an&&ln(an)&&/* @__PURE__ */Q(c,{"aria-label":"Share",size:"sm",onClick:()=>Be(an),children:/* @__PURE__ */Q(z,{name:"add-person",className:"h-4 w-4"})}),!F&&nn.every(e=>"file"===e.kind)&&/* @__PURE__ */Q(c,{"aria-label":"Download",size:"sm",onClick:()=>nn.forEach(Ot),children:/* @__PURE__ */Q(z,{name:"download",className:"h-4 w-4"})}),nn.every(on)&&/* @__PURE__ */Q(c,{"aria-label":"Move",size:"sm",onClick:()=>He(nn),children:/* @__PURE__ */Q(z,{name:"forward",className:"h-4 w-4"})}),!F&&nn.every(sn)&&/* @__PURE__ */Q(c,{"aria-label":"Move to trash",size:"sm",onClick:()=>Qt(nn),children:/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4"})}),
|
|
67
|
+
/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(nn)})]}):null,An=/* @__PURE__ */Q("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:Rn??/* @__PURE__ */H(Z,{children:[
|
|
68
68
|
/* @__PURE__ */H("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===lt?/* @__PURE__ */Q("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */Q(a,{items:xn,maxItems:5})}):"trash"===lt?/* @__PURE__ */Q("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof lt?/* @__PURE__ */H(Z,{children:[
|
|
69
69
|
/* @__PURE__ */Q(j,{className:"h-4 w-4 text-amber-500 shrink-0"}),
|
|
70
70
|
/* @__PURE__ */Q("span",{className:"text-base font-medium text-ink-strong truncate",children:kt?.name??"Desktop folder"}),
|
|
71
71
|
/* @__PURE__ */Q("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */Q("span",{className:"text-base font-medium text-ink-strong truncate",children:Nn}),"files"===lt&&Gt&&"viewer"===Ut&&/* @__PURE__ */H("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-2xs text-ink-faint whitespace-nowrap",children:[
|
|
72
|
-
/* @__PURE__ */Q(z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===lt&&Gt&&
|
|
73
|
-
/* @__PURE__ */Q("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(
|
|
72
|
+
/* @__PURE__ */Q(z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===lt&&Gt&&Kt?.owner&&/* @__PURE__ */H("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Kt.owner.name]})]}),Pn,"trash"===lt&&/* @__PURE__ */Q(W,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===mt.length)return;await R({title:"Empty trash",message:`${mt.length} item${1===mt.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&Wt(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===mt.length,children:"Empty trash"})]})}),Fn=(e,t)=>Dt?null:/* @__PURE__ */H("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[ln(e)&&/* @__PURE__ */Q(c,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Be(e)},children:/* @__PURE__ */Q(z,{name:"add-person",className:"h-4 w-4"})}),!F&&"file"===e.kind&&/* @__PURE__ */Q(c,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Ot(e)},children:/* @__PURE__ */Q(z,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!F&&/* @__PURE__ */Q(c,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Zt([e],!e.starred)},children:/* @__PURE__ */Q(z,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
|
|
73
|
+
/* @__PURE__ */Q("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(Pe.has(e.id)&&nn.length>1?nn:[e])})})]}),En=e=>/* @__PURE__ */H("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
74
74
|
/* @__PURE__ */Q(je,{entry:e}),
|
|
75
75
|
/* @__PURE__ */Q("span",{className:"truncate",title:e.name,children:ne(e)}),!!e.shareCount&&/* @__PURE__ */Q("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */Q(z,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */Q("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */Q(z,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),Wn=(e,t,n)=>{const a=it.key===e;/* @__PURE__ */
|
|
76
|
-
return Q("th",{className:`${
|
|
76
|
+
return Q("th",{className:`${O} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===it.dir?"ascending":"descending":void 0,children:/* @__PURE__ */H("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>st(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===it.dir?/* @__PURE__ */Q(z,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */Q(z,{name:"arrow-down",className:"h-3 w-3"}))]})})},zn="recent"===lt?"Files you and your colleagues change show here.":"starred"===lt?"Star the files and folders you want to find quickly.":"shared"===lt?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===lt?`Nothing matches “${tt}”.`:null,In=0===en.length?Fe?/* @__PURE__ */Q(I,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */Q("div",{className:"p-10 text-center text-sm text-ink-faintest",children:_t.length>0?"Nothing matches these filters.":zn??/* @__PURE__ */H(Z,{children:["This folder is empty.",Bt&&/* @__PURE__ */H(Z,{children:[" Drop files here or choose ",
|
|
77
77
|
/* @__PURE__ */Q("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Qe?/* @__PURE__ */Q("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=en.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */H("section",{className:"mb-4",children:[
|
|
78
78
|
/* @__PURE__ */Q("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
|
|
79
|
-
/* @__PURE__ */Q("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=
|
|
79
|
+
/* @__PURE__ */Q("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=Pe.has(t.id);/* @__PURE__ */
|
|
80
80
|
return H("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":ne(t),onClick:e=>cn(t.id,e),onDoubleClick:()=>pn(t),onContextMenu:e=>kn(e,t),...wn(t),...yn(t),className:"group rounded-xl border cursor-default select-none outline-none focus-visible:ring-2 focus-visible:ring-accent-border "+(a||Ge===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
|
|
81
81
|
/* @__PURE__ */H("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
|
|
82
82
|
/* @__PURE__ */Q(je,{entry:t,className:"h-4 w-4"}),
|
|
83
83
|
/* @__PURE__ */Q("span",{className:"flex-1 truncate text-sm",title:t.name,children:ne(t)}),
|
|
84
84
|
/* @__PURE__ */Q("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */Q(o,{trigger:/* @__PURE__ */Q(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&nn.length>1?nn:[t])})})]}),"file"===e&&/* @__PURE__ */H(Z,{children:[
|
|
85
|
-
/* @__PURE__ */Q("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */Q(De,{entry:t,read:
|
|
85
|
+
/* @__PURE__ */Q("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */Q(De,{entry:t,read:F?void 0:n.read})}),
|
|
86
86
|
/* @__PURE__ */H("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ie(t)?"You":ie(t)," · ",re(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */H("table",{className:"w-full text-sm table-fixed",children:[
|
|
87
87
|
/* @__PURE__ */Q("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */H("tr",{children:[Wn("name","Name","text-left"),X&&Wn("owner","Owner","text-left w-32"),Wn("modified","Modified","text-left w-28"),Wn("size","Size","text-right w-20"),
|
|
88
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
89
|
-
/* @__PURE__ */Q("tbody",{children:en.map(e=>{const t=
|
|
88
|
+
/* @__PURE__ */Q("th",{className:`${O} w-32`,children:/* @__PURE__ */Q("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
89
|
+
/* @__PURE__ */Q("tbody",{children:en.map(e=>{const t=Pe.has(e.id);/* @__PURE__ */
|
|
90
90
|
return H("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),onContextMenu:t=>kn(t,e),...wn(e),...yn(e),className:`group cursor-default select-none border-b border-line-subtle ${hn(e)} ${t||Ge===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
|
|
91
91
|
/* @__PURE__ */Q("td",{className:"px-3 h-11",children:En(e)}),X&&/* @__PURE__ */Q("td",{className:"px-3 h-11 text-ink-faint truncate",children:ie(e)}),
|
|
92
92
|
/* @__PURE__ */Q("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:ve(e.modifiedAt),children:re(e.modifiedAt)}),
|
|
93
93
|
/* @__PURE__ */Q("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint whitespace-nowrap",children:Dt&&"file"===e.kind&&!mn(e)&&Dt.request.otherLabel?Dt.request.otherLabel:ae(e)}),
|
|
94
|
-
/* @__PURE__ */Q("td",{className:"px-2 h-11",children:
|
|
94
|
+
/* @__PURE__ */Q("td",{className:"px-2 h-11",children:Fn(e,t)})]},e.id)})})]}),On=Fe&&0===mt.length?/* @__PURE__ */Q(I,{size:"sm",padding:"p-6",label:"Loading"}):0===mt.length?/* @__PURE__ */Q("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */H("table",{className:"w-full text-sm table-fixed",children:[
|
|
95
95
|
/* @__PURE__ */Q("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */H("tr",{children:[
|
|
96
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
97
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
98
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
99
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
100
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
96
|
+
/* @__PURE__ */Q("th",{className:`${O} text-left font-medium px-3 h-9`,children:"Name"}),
|
|
97
|
+
/* @__PURE__ */Q("th",{className:`${O} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
|
|
98
|
+
/* @__PURE__ */Q("th",{className:`${O} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
|
|
99
|
+
/* @__PURE__ */Q("th",{className:`${O} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
|
|
100
|
+
/* @__PURE__ */Q("th",{className:`${O} w-28`,children:/* @__PURE__ */Q("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
101
101
|
/* @__PURE__ */Q("tbody",{children:mt.map(e=>/* @__PURE__ */H("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
|
|
102
102
|
/* @__PURE__ */Q("td",{className:"px-3 h-11",children:/* @__PURE__ */H("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
103
103
|
/* @__PURE__ */Q(je,{entry:e}),
|
|
@@ -107,11 +107,11 @@ return H("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),o
|
|
|
107
107
|
/* @__PURE__ */Q("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":d(e.size)}),
|
|
108
108
|
/* @__PURE__ */Q("td",{className:"px-2 h-11",children:/* @__PURE__ */H("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
|
|
109
109
|
/* @__PURE__ */Q(c,{"aria-label":"Restore",size:"sm",onClick:()=>zt(e),children:/* @__PURE__ */Q(z,{name:"revert",className:"h-4 w-4"})}),
|
|
110
|
-
/* @__PURE__ */Q(c,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>It(e),children:/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),
|
|
110
|
+
/* @__PURE__ */Q(c,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>It(e),children:/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),Kn=0===wt.length?/* @__PURE__ */Q("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */H("table",{className:"w-full text-sm table-fixed",children:[
|
|
111
111
|
/* @__PURE__ */Q("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */H("tr",{children:[
|
|
112
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
113
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
114
|
-
/* @__PURE__ */Q("th",{className:`${
|
|
112
|
+
/* @__PURE__ */Q("th",{className:`${O} text-left font-medium px-3 h-9`,children:"Name"}),
|
|
113
|
+
/* @__PURE__ */Q("th",{className:`${O} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
|
|
114
|
+
/* @__PURE__ */Q("th",{className:`${O} w-32`,children:/* @__PURE__ */Q("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
115
115
|
/* @__PURE__ */Q("tbody",{children:wt.map(e=>/* @__PURE__ */H("tr",{onDoubleClick:()=>Mt(e),onContextMenu:t=>jt.open(t,e),className:"group cursor-default border-b border-line-subtle hover:bg-row-hover",children:[
|
|
116
116
|
/* @__PURE__ */Q("td",{className:"px-3 h-11",children:/* @__PURE__ */H("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
117
117
|
/* @__PURE__ */Q(D,{item:e}),
|
|
@@ -121,8 +121,8 @@ return H("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),o
|
|
|
121
121
|
/* @__PURE__ */Q(c,{"aria-label":"Open",size:"sm",onClick:()=>Mt(e),children:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"})}),
|
|
122
122
|
/* @__PURE__ */Q(c,{"aria-label":"Move to desktop",size:"sm",onClick:()=>pt?.moveToDesktop([e]),children:/* @__PURE__ */Q(z,{name:"desktop",className:"h-4 w-4"})}),
|
|
123
123
|
/* @__PURE__ */Q(c,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>pt?.removeShortcuts([e]),children:/* @__PURE__ */Q(z,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
|
|
124
|
-
return H("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Bt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),yt.current++,
|
|
125
|
-
/* @__PURE__ */Q(
|
|
124
|
+
return H("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Bt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),yt.current++,Ke||Ue(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{yt.current>0&&yt.current--,0===yt.current&&Ue(!1)},onDrop:e=>{e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),qt(),Bt&&e.dataTransfer.files?.length&&Vt(e.dataTransfer.files))},children:[
|
|
125
|
+
/* @__PURE__ */Q(P,{title:Cn}),
|
|
126
126
|
/* @__PURE__ */Q(k,{app:"files"}),
|
|
127
127
|
/* @__PURE__ */Q("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Vt(e.target.files),vt.current&&(vt.current.value="")}}),
|
|
128
128
|
/* @__PURE__ */Q("input",{ref:e=>{bt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Vt(e.target.files,{withFolders:!0}),bt.current&&(bt.current.value="")}}),
|
|
@@ -133,9 +133,9 @@ return H("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter
|
|
|
133
133
|
/* @__PURE__ */Q(W,{variant:"secondary",size:"sm",onClick:()=>p(Dt.id,null),children:"Cancel"}),
|
|
134
134
|
/* @__PURE__ */Q(W,{variant:"primary",size:"sm",disabled:!fn,onClick:()=>{fn&&un(fn)},children:"Open"})]}),
|
|
135
135
|
/* @__PURE__ */H("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
|
|
136
|
-
/* @__PURE__ */Q("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */Q(l,{type:"text",enterKeyHint:"search",value:_e,onChange:e=>{et(e.target.value),e.target.value.trim()||
|
|
136
|
+
/* @__PURE__ */Q("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */Q(l,{type:"text",enterKeyHint:"search",value:_e,onChange:e=>{et(e.target.value),e.target.value.trim()||Ft()},onKeyDown:e=>{"Escape"===e.key&&_e&&(e.stopPropagation(),Ft())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */Q(z,{name:"search",className:"h-4 w-4"}),endAction:_e?{label:"Clear search",icon:/* @__PURE__ */Q(z,{name:"close",className:"h-4 w-4"}),onClick:Ft}:void 0})}),
|
|
137
137
|
/* @__PURE__ */Q("div",{className:"flex-1"}),"object"!=typeof lt&&"trash"!==lt&&/* @__PURE__ */H(Z,{children:[
|
|
138
138
|
/* @__PURE__ */Q(c,{"aria-label":"List view","aria-pressed":"list"===Qe,onClick:()=>ut("list"),children:/* @__PURE__ */Q(z,{name:"list",className:"h-4 w-4"})}),
|
|
139
139
|
/* @__PURE__ */Q(c,{"aria-label":"Grid view","aria-pressed":"grid"===Qe,onClick:()=>ut("grid"),children:/* @__PURE__ */Q(z,{name:"grid",className:"h-4 w-4"})})]}),
|
|
140
|
-
/* @__PURE__ */Q(c,{"aria-label":"Details","aria-pressed":Xe,onClick:()=>qe(e=>!e),children:/* @__PURE__ */Q(z,{name:"info",className:"h-4 w-4"})})]}),
|
|
141
|
-
/* @__PURE__ */Q("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Dt?"Enter"===e.key&&fn&&(e.preventDefault(),un(fn)):("Delete"===e.key||"Backspace"===e.key)&&nn.length&&nn.every(sn)?(e.preventDefault(),Qt(nn)):"Enter"===e.key&&an?(e.preventDefault(),pn(an)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&en.length&&(e.preventDefault(),
|
|
140
|
+
/* @__PURE__ */Q(c,{"aria-label":"Details","aria-pressed":Xe,onClick:()=>qe(e=>!e),children:/* @__PURE__ */Q(z,{name:"info",className:"h-4 w-4"})})]}),An,
|
|
141
|
+
/* @__PURE__ */Q("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Dt?"Enter"===e.key&&fn&&(e.preventDefault(),un(fn)):("Delete"===e.key||"Backspace"===e.key)&&nn.length&&nn.every(sn)?(e.preventDefault(),Qt(nn)):"Enter"===e.key&&an?(e.preventDefault(),pn(an)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&en.length&&(e.preventDefault(),Re(new Set(en.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&dn()},children:"object"==typeof lt?Kn:"trash"===lt?On:In})]}),Xe&&Tn&&/* @__PURE__ */Q(fe,{store:n,entry:an,selectedCount:nn.length,onClose:()=>qe(!1)})]})})}),Ct.state&&/* @__PURE__ */Q(s,{...Ct.props,items:gn(Ct.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */Q(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */Q(z,{name:"revert",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */Q(z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>It(St.state.data)}]}),jt.state&&/* @__PURE__ */Q(s,{...jt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */Q(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(jt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */Q(z,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>pt?.moveToDesktop([jt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */Q(z,{name:"close",className:"h-4 w-4"}),onSelect:()=>pt?.removeShortcuts([jt.state.data])}]}),X&&/* @__PURE__ */Q(he,{store:n,entry:Je,onClose:()=>Be(null),onChanged:At}),n.move&&/* @__PURE__ */Q(ue,{store:n,items:Ve,from:"files"===lt?_:void 0,onClose:()=>He(null),onMove:e=>Ve&&Xt(Ve,e)}),Ke&&/* @__PURE__ */Q("div",{className:"absolute inset-0 bg-accent-tint border-4 border-dashed border-accent-border pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */Q("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{Me as default,Ne as quotaExceededMessage};
|