efficient-shell 13.6.1 → 13.9.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.
Files changed (67) hide show
  1. package/README.md +6 -4
  2. package/dist/{Browser-T2K6P3YU.js → Browser-ATL2PGT2.js} +16 -16
  3. package/dist/Files-RHEICXXW.js +141 -0
  4. package/dist/{Notepad-2ULPEDIU.js → Notepad-QL5GJZNS.js} +7 -7
  5. package/dist/PomodoroTimer-2MFWO3KK.js +91 -0
  6. package/dist/{Preview-ZBTPZRMP.js → Preview-PP3XS7E7.js} +41 -41
  7. package/dist/{TimelineTrack-DfU_9eo6.d.ts → TimelineTrack-DCTqfW6Z.d.ts} +13 -0
  8. package/dist/Weather-377NKPA5.js +60 -0
  9. package/dist/WorldClock-M6AMXQY2.js +32 -0
  10. package/dist/ai/index.js +30 -30
  11. package/dist/apps/index.js +1 -1
  12. package/dist/bin/browser-check.js +1 -1
  13. package/dist/bin/media-host-check.js +1 -1
  14. package/dist/bin/ui-check.js +1 -1
  15. package/dist/brand.css +1 -1
  16. package/dist/charts/SpecChart.js +1 -1
  17. package/dist/{chunk-GXVWI3U5.js → chunk-5CFERCYW.js} +1 -1
  18. package/dist/{chunk-X4EJUQ6I.js → chunk-AEOCSYKL.js} +1 -1
  19. package/dist/chunk-AJMQ5SHI.js +1 -0
  20. package/dist/{chunk-PDIGCTZD.js → chunk-BKZOTBDP.js} +19 -19
  21. package/dist/{chunk-BRZ55H2G.js → chunk-F3G7S5HO.js} +50 -50
  22. package/dist/chunk-H7CIK74N.js +15 -0
  23. package/dist/chunk-HYHZEQMG.js +1 -0
  24. package/dist/{chunk-RI5QSLX3.js → chunk-IOZSLFGR.js} +1 -1
  25. package/dist/{chunk-H22D2PYM.js → chunk-LOFFHXZ4.js} +9 -9
  26. package/dist/chunk-NHKT5IH6.js +1 -0
  27. package/dist/chunk-OAKXWYZD.js +2 -0
  28. package/dist/{chunk-S6UJKSF3.js → chunk-OJI4ROSD.js} +1 -1
  29. package/dist/{chunk-7I5GD5IB.js → chunk-RK6X56ZC.js} +2 -2
  30. package/dist/{chunk-3MIIXPV6.js → chunk-SC3AQXJY.js} +8 -8
  31. package/dist/chunk-YJGA4LPG.js +2 -0
  32. package/dist/{chunk-ENCZRE3H.js → chunk-Z62HFEFS.js} +7 -7
  33. package/dist/{chunk-77HMTXDR.js → chunk-ZJ34FNRC.js} +1 -1
  34. package/dist/data/Gantt.js +1 -1
  35. package/dist/format/index.d.ts +1 -1
  36. package/dist/format/index.js +1 -1
  37. package/dist/forms/Calendar.js +1 -1
  38. package/dist/forms/DatePicker.js +1 -1
  39. package/dist/forms/DateRangePicker.js +1 -1
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +665 -665
  42. package/dist/shell/MilestoneTimeline.d.ts +1 -1
  43. package/dist/shell/MilestoneTimeline.js +1 -1
  44. package/dist/shell/ProductionTimeline.d.ts +23 -9
  45. package/dist/shell/ProductionTimeline.js +1 -1
  46. package/dist/shell/TimeAgo.js +1 -1
  47. package/dist/shell/TimelineTrack.d.ts +1 -1
  48. package/dist/shell/TimelineTrack.js +1 -1
  49. package/dist/shell/timelineDates.js +1 -1
  50. package/dist/telemetry/index.js +1 -1
  51. package/dist/ui/index.d.ts +2 -2
  52. package/dist/ui/index.js +1 -1
  53. package/dist/utils/date.d.ts +44 -5
  54. package/dist/utils/date.js +1 -1
  55. package/dist/utils/format.js +1 -1
  56. package/dist/version.js +1 -1
  57. package/package.json +1 -1
  58. package/dist/Files-ZFH4CV3R.js +0 -141
  59. package/dist/PomodoroTimer-57XARJRF.js +0 -91
  60. package/dist/Weather-Y4TMYOQB.js +0 -60
  61. package/dist/WorldClock-FY3UCIAW.js +0 -32
  62. package/dist/chunk-7K73G35Z.js +0 -2
  63. package/dist/chunk-COHFFGFE.js +0 -2
  64. package/dist/chunk-ECTLJTOE.js +0 -1
  65. package/dist/chunk-FBDZGO3V.js +0 -1
  66. package/dist/chunk-R3BLTWKE.js +0 -15
  67. package/dist/chunk-ZPJTLNKU.js +0 -1
package/README.md CHANGED
@@ -1717,8 +1717,8 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
1717
1717
  | `MetricBar` | Value + proportional bar with optional `warn` / `crit` threshold ticks — the CPU / memory / disk row. `value={null}` renders "no data" (dashed empty track), never a zero-width bar; with no thresholds the fill stays grey rather than claiming health. `max` must be a positive finite number — given `0`/`NaN` the row prints the value but draws no bar, rather than dividing by zero into a full one. `size` is `sm` (the compact row), `md` (a standalone stat) or `lg` (`md` with its label and detail at the 12px floor in gray-500). |
1718
1718
  | `MetricBarLegend` | One row under a group of `MetricBar`s naming the ticks in words — the lighter mark is the warning bound, the darker the critical — in 12px gray-500, with swatches drawn from the bars' own tick ink. A tick's `title` is hover-only, which a touch screen never shows (UI-17). `link={{ href, label }}` says where the bounds are set. |
1719
1719
  | `BudgetBar` | A run's wall clock, drawn as **budget consumed** — not work done, which nothing here knows. Three states a glance separates: within budget (a solid fill), past the deadline (a hatched band, never the shape of a finished bar; with a `grace` the track spans budget + grace so it is only full when the reaper is due), and **no estimate at all** (no bar — not a zero one, not an empty track). Keeps `MetricBar`'s rule that `elapsed={null}` is no reading and `elapsed={0}` is a measurement. `budgetState(elapsed, budget)` is the same verdict for a list to sort by. |
1720
- | `TimelineTrack` | The time axis both timelines are drawn on, and the reason they look and move alike rather than merely similar. A 6 px rail with a fill, a **date ruler** (month ticks always, week ticks where they clear 14 px, a month label only where it clears 72 px of the last one), dots whose shape and glyph say what kind of event they are — every one of them in the theme accent at its 600 step, the colour a primary `Button` wears, so a shape survives the greyscale print and the colour-blind reader that a hue never did, and one of two label strategies: `labels="lanes"` packs them into two rows and folds runs of the same kind into `×N` pills, `labels="active"` draws the one label a scrubber needs, `labels="none"` draws none — the bare rail, where an item's `caption` is the only text near its mark, the edge captions flank the rail on its own row, and the `pending` things are one dashed cap past a dashed tail rather than a column. `axis="compressed"` CUTS any stretch holding more than 30% of the window's time down to a fixed notch with a break glyph saying how many days it hides, and shares the rest of the track proportionally; `axis="linear"` keeps time proportional throughout; `axis="spread"` cuts nothing and keeps the 48 px floor, the idle stretches paying for it in proportion. `highlightKeys` lights one band from the leftmost named mark to the rightmost and every mark inside it; `onHoverChange` reports the mark under the pointer or the focus. A `provisional` item is hollow, never current, and outside the fill. `endMark` puts a hollow, dashed mark ON a bare rail's right edge for a day the window already runs to — an estimate, a contractual date — with the label and the date in its popover. An optional `thumb` turns it into a scrubber: give it `stops` and it becomes discrete — a drag follows the pointer but snaps to the nearest stop as it goes, arrows step stop to stop, and `valueText` says which one for a screen reader. An optional `playback` then drives that thumb along the rail by itself: the caller owns the button and the `playing` flag, the track owns the travel, because the distance between two stops is a distance in **pixels of its axis** and nobody outside knows how wide the track is. It is paced by that distance — 350 ms per 100 px, clamped to 450–1400 ms, eased in and out — so a compressed `//` notch costs 48 px of travel like any other 48 px instead of swallowing the glide, and the date chip, read back through the axis's inverse mapping, skips exactly the days the notch hides. `onArrive(key, ms)` fires on arrival and never mid-travel; the thumb then rests 700 ms before setting off again. The timing is the **wall clock**, not the frame rate: the rest is waited out on a timer and the travel is measured against the high-resolution timestamp each animation frame carries, so 700 ms is 700 ms on a throttled or occluded surface that hands out one frame a second instead of sixty — and a page that comes back after an idle stretch walks its backlog forward at one report per frame rather than announcing four at once. `onProgress({ fromKey, toKey, t, ms } | null)` hands out the in-flight position on every frame of a glide and `null` the moment there is none (arrival, pause, cancel, end, and a released drag), so a consumer can interpolate a table under the bar on the same eased `t` that places the disc; a drag reports the pointer's linear fraction between its two neighbouring stops. Flipping `playing` off freezes it where it is — keeping what is left of the rest rather than spending it — and flipping it back on carries on from there; taking hold of the thumb — a drag, a click, an arrow key — ends the playback through `onStop`. Under `prefers-reduced-motion` the walk stays, the travel goes, and `onProgress` only ever says `null`. Hovering a `×N` pill **magnifies** its stretch so the members can carry their own labels (or do it from code with `zoomRange`), and an item's `preview` fills the hover/focus popover with the document in miniature, with an "Open" footer that fires its `onOpen` — the popover has already drawn the mark's label and its date above the preview, so a consumer leaves both out of it. Also `markers` — each one free to name its own `glyph` where its kind's is not specific enough — `phases`, `edgeCaptions`, and a `pending` list for the things that have no date. Every mark takes its own pointer, including on a scrubber: the 24 px hit strip that makes a 6 px rail pressable runs UNDER the dots rather than over them, so hover, focus and click reach a report, an inspection or a shipment, while a press on the bare rail between two of them still starts a drag and a drag crossing a mark is not interrupted by it. No two marks are ever drawn on top of each other: a run whose centres are closer than one mark's width — of any kinds, folded or not — becomes ONE mark carrying `×N`, its kind's own shape and glyph where the run shares a kind and a neutral `×N` pill where it does not, named after every member it stands for. A pointer opens it: the axis magnifies around the run and each member is a mark again with its own popover, the same magnification a `×N` label pill asks for. A run that is all one DATE can never be opened — no magnification separates a coordinate from itself — so its popover lists every member with its date and its own preview instead. Folding is a drawing decision only: the thumb's stops, `onActivate` and playback all still see every mark. The marks are an `<ol>` with exactly one `aria-current="step"` and ONE tab stop — arrows traverse, Home/End jump, Enter/Space activates — and every tooltip and pill popover is hoverable, persistent and Escape-dismissible (WCAG 1.4.13). A popover is kept inside the track and inside the shell window that owns it (UI-11), the first day's mark included, and a mark carries no native `title` — its popover is the tooltip, on hover and on focus alike. Under a 320 px track it stops squeezing the axis and switches to a vertical variant. Motion is `rosh-tl-*` classes in `ui.css` behind one `prefers-reduced-motion` rule, replayed on every mount, total budget 600 ms. |
1721
- | `ProductionTimeline` | The scrubbable production bar, drawn on `TimelineTrack` inside the shared timeline card: a sentence-case heading with the PO as its subject, the window and the lead time as meta, a Play **pill** on the right whose glyph follows its state, and a footer carrying the status line and legend chips drawn with the track's own glyphs — a shipment is a diamond with a truck in it and an inspection a disc with a flask, on the rail and in the chip alike, because every kind is painted in the one accent and the glyph is the only thing left to tell them apart. The thumb only ever rests on a date a report was filed on — drag it and it snaps report to report, arrow it and it steps one report at a time — so the bar never shows an estimate dressed as a fact. Press Play and it **travels** between them: a fresh press rewinds to the first report, the thumb reads each snapshot for 700 ms and then glides to the next with the date chip counting the days it crosses, and the status line under the bar changes on arrival rather than while it is on its way. Pausing freezes it mid-glide and pressing Play again carries on from exactly there; touching the thumb ends the playback and hands it back. The walk keeps time by the clock rather than by the frame rate, so an idle or throttled pane does not stretch it. `onScrubProgress` forwards the track's in-flight fraction — `{ fromKey, toKey, t, ms }` keyed by report id, `null` at a stop — which is how a consumer's items table moves WITH the thumb instead of jumping a whole report's worth of quantities when it lands; it is optional and undefined by default, so a caller that only reads the snapshot needs no change. `onPickReport` selects a report; the optional `onOpenReport` / `onOpenMarker` make the label above the thumb a real button that opens the document behind it. `reportLabel` names a report wherever the bar states its identity — the caption over the thumb, the popover header, each dot's accessible name, the slider's value text and the status line — and defaults to its own `progress_number`, while `resetLabel` replaces the whole of the `Back to …` button: together they are what lets a portal that must not print an internal document number run the same card. A report carries an optional `preview` for its hover/focus popover — the stage row it filed, the note attached to it — and `renderReportPreview` builds one for the reports that carry none, the convenience for a caller whose list arrives straight off an API; the report's own preview wins where both exist, and the popover prints the report number and the date itself. `useProductionTimeline(opts)` owns the slider state and the derived snapshot so the caller's items table and the bar read the same state; `STAGES` / `calcOverall` / `calcReportOverall` are the stage maths it shares with that table. **`variant="rail"`** is the bar alone, for a window whose own header already says what the order is: no card, no heading, no lead-time line, no label under the active report — every report, shipment, inspection and **invoice** (kind `invoice`, a disc with a receipt) is a dot with a popover — the thumb with its date chip, `Start` and `Est. done` flanking the rail, the estimated completion as a hollow mark on the right edge while it is still ahead, and under the rail one row: Play, the return button when the thumb has been moved, and the `<report> · date · N% overall · N pc in stock` line. The rail spreads the reports (the track's `spread` axis) rather than folding two a week apart into a `×2`. `onPlayStart` fires before the thumb moves, on a fresh run and on a resume, so a window that keeps the bar in view while its table shows something else can switch the table first. |
1720
+ | `TimelineTrack` | The time axis both timelines are drawn on, and the reason they look and move alike rather than merely similar. A 6 px rail with a fill, a **date ruler** (month ticks always, week ticks where they clear 14 px, a month label only where it clears 72 px of the last one), dots whose shape and glyph say what kind of event they are — every one of them in the theme accent at its 600 step, the colour a primary `Button` wears, so a shape survives the greyscale print and the colour-blind reader that a hue never did, and one of two label strategies: `labels="lanes"` packs them into two rows and folds runs of the same kind into `×N` pills, `labels="active"` draws the one label a scrubber needs, `labels="none"` draws none — the bare rail, where an item's `caption` is the only text near its mark, the edge captions flank the rail on its own row, and the `pending` things are one dashed cap past a dashed tail rather than a column. `axis="compressed"` CUTS any stretch holding more than 30% of the window's time down to a fixed notch with a break glyph saying how many days it hides, and shares the rest of the track proportionally; `axis="linear"` keeps time proportional throughout; `axis="spread"` cuts nothing and keeps the 48 px floor, the idle stretches paying for it in proportion. `highlightKeys` lights one band from the leftmost named mark to the rightmost and every mark inside it; `onHoverChange` reports the mark under the pointer or the focus. A `provisional` item is hollow, never current, and outside the fill. `endMark` puts a hollow, dashed mark ON a bare rail's right edge for a day the window already runs to — an estimate, a contractual date — with the label and the date in its popover. An optional `thumb` turns it into a scrubber; its `onPreview` hears the day under a hovering mouse (and `null` when it leaves or presses), and `restMs` draws where the thumb rests as a faint fill while a preview has moved it. Give it `stops` and it becomes discrete — a drag follows the pointer but snaps to the nearest stop as it goes, arrows step stop to stop, and `valueText` says which one for a screen reader. An optional `playback` then drives that thumb along the rail by itself: the caller owns the button and the `playing` flag, the track owns the travel, because the distance between two stops is a distance in **pixels of its axis** and nobody outside knows how wide the track is. It is paced by that distance — 350 ms per 100 px, clamped to 450–1400 ms, eased in and out — so a compressed `//` notch costs 48 px of travel like any other 48 px instead of swallowing the glide, and the date chip, read back through the axis's inverse mapping, skips exactly the days the notch hides. `onArrive(key, ms)` fires on arrival and never mid-travel; the thumb then rests 700 ms before setting off again. The timing is the **wall clock**, not the frame rate: the rest is waited out on a timer and the travel is measured against the high-resolution timestamp each animation frame carries, so 700 ms is 700 ms on a throttled or occluded surface that hands out one frame a second instead of sixty — and a page that comes back after an idle stretch walks its backlog forward at one report per frame rather than announcing four at once. `onProgress({ fromKey, toKey, t, ms } | null)` hands out the in-flight position on every frame of a glide and `null` the moment there is none (arrival, pause, cancel, end, and a released drag), so a consumer can interpolate a table under the bar on the same eased `t` that places the disc; a drag reports the pointer's linear fraction between its two neighbouring stops. Flipping `playing` off freezes it where it is — keeping what is left of the rest rather than spending it — and flipping it back on carries on from there; taking hold of the thumb — a drag, a click, an arrow key — ends the playback through `onStop`. Under `prefers-reduced-motion` the walk stays, the travel goes, and `onProgress` only ever says `null`. Hovering a `×N` pill **magnifies** its stretch so the members can carry their own labels (or do it from code with `zoomRange`), and an item's `preview` fills the hover/focus popover with the document in miniature, with an "Open" footer that fires its `onOpen` — the popover has already drawn the mark's label and its date above the preview, so a consumer leaves both out of it. Also `markers` — each one free to name its own `glyph` where its kind's is not specific enough — `phases`, `edgeCaptions`, and a `pending` list for the things that have no date. Every mark takes its own pointer, including on a scrubber: the 24 px hit strip that makes a 6 px rail pressable runs UNDER the dots rather than over them, so hover, focus and click reach a report, an inspection or a shipment, while a press on the bare rail between two of them still starts a drag and a drag crossing a mark is not interrupted by it. No two marks are ever drawn on top of each other: a run whose centres are closer than one mark's width — of any kinds, folded or not — becomes ONE mark carrying `×N`, its kind's own shape and glyph where the run shares a kind and a neutral `×N` pill where it does not, named after every member it stands for. A pointer opens it: the axis magnifies around the run and each member is a mark again with its own popover, the same magnification a `×N` label pill asks for. A run that is all one DATE can never be opened — no magnification separates a coordinate from itself — so its popover lists every member with its date and its own preview instead. Folding is a drawing decision only: the thumb's stops, `onActivate` and playback all still see every mark. The marks are an `<ol>` with exactly one `aria-current="step"` and ONE tab stop — arrows traverse, Home/End jump, Enter/Space activates — and every tooltip and pill popover is hoverable, persistent and Escape-dismissible (WCAG 1.4.13). A popover is kept inside the track and inside the shell window that owns it (UI-11), the first day's mark included, and a mark carries no native `title` — its popover is the tooltip, on hover and on focus alike. Under a 320 px track it stops squeezing the axis and switches to a vertical variant. Motion is `rosh-tl-*` classes in `ui.css` behind one `prefers-reduced-motion` rule, replayed on every mount, total budget 600 ms. |
1721
+ | `ProductionTimeline` | The scrubbable production bar, drawn on `TimelineTrack` inside the shared timeline card: a sentence-case heading with the PO as its subject, the window and the lead time as meta, a Play **pill** on the right whose glyph follows its state, and a footer carrying the status line and legend chips drawn with the track's own glyphs — a shipment is a diamond with a truck in it and an inspection a disc with a flask, on the rail and in the chip alike, because every kind is painted in the one accent and the glyph is the only thing left to tell them apart. The thumb rests on **any day** — drag it, click the rail or arrow it a day at a time (a week with Shift). On a report's day the snapshot is that report; between two reports it is the straight line between them (`isInterpolated`); past the last report it is projected towards the whole order on the estimated completion (`isProjected`); either estimate is labelled `Estimated`, never a report's number. A mouse hovering the rail **previews** the day under it — the thumb, the date chip, the status line and the caller's table (through the snapshot) all follow, the resting fill stays faint underneath — and leaving the rail brings the resting day back; a click commits. The hook's `setPreviewMs`, `previewing` and `committedScrubMs` carry that state for a caller that draws its own bar. Press Play and it **travels** between them: a fresh press rewinds to the first report, the thumb reads each snapshot for 700 ms and then glides to the next with the date chip counting the days it crosses, and the status line under the bar changes on arrival rather than while it is on its way. Pausing freezes it mid-glide and pressing Play again carries on from exactly there; touching the thumb ends the playback and hands it back. The walk keeps time by the clock rather than by the frame rate, so an idle or throttled pane does not stretch it. `onScrubProgress` forwards the track's in-flight fraction — `{ fromKey, toKey, t, ms }` keyed by report id, `null` at a stop — which is how a consumer's items table moves WITH the thumb instead of jumping a whole report's worth of quantities when it lands; it is optional and undefined by default, so a caller that only reads the snapshot needs no change. `onPickReport` selects a report; the optional `onOpenReport` / `onOpenMarker` make the label above the thumb a real button that opens the document behind it. `reportLabel` names a report wherever the bar states its identity — the caption over the thumb, the popover header, each dot's accessible name, the slider's value text and the status line — and defaults to its own `progress_number`, while `resetLabel` replaces the whole of the `Back to …` button: together they are what lets a portal that must not print an internal document number run the same card. A report carries an optional `preview` for its hover/focus popover — the stage row it filed, the note attached to it — and `renderReportPreview` builds one for the reports that carry none, the convenience for a caller whose list arrives straight off an API; the report's own preview wins where both exist, and the popover prints the report number and the date itself. `useProductionTimeline(opts)` owns the slider state and the derived snapshot so the caller's items table and the bar read the same state; `STAGES` / `calcOverall` / `calcReportOverall` are the stage maths it shares with that table. **`variant="rail"`** is the bar alone, for a window whose own header already says what the order is: no card, no heading, no lead-time line, no label under the active report — every report, shipment, inspection and **invoice** (kind `invoice`, a disc with a receipt) is a dot with a popover — the thumb with its date chip, `Start` and `Est. done` flanking the rail, the estimated completion as a hollow mark on the right edge while it is still ahead, and under the rail one row: Play, the return button when the thumb has been moved, and the `<report> · date · N% overall · N pc in stock` line. The rail spreads the reports (the track's `spread` axis) rather than folding two a week apart into a `×2`. `onPlayStart` fires before the thumb moves, on a fresh run and on a resume, so a window that keeps the bar in view while its table shows something else can switch the table first. |
1722
1722
  | `MilestoneTimeline` | The static sibling, on the same `TimelineTrack` and in the same card: one dot per milestone on a date axis, no scrubber. `heading` and `subject` split the title from the record it is about (`Mould development` · **001F/1813**), and the meta line states when it started, how long it has run and how many milestones are dated. The axis **cuts** rather than squeezes: a stretch holding more than 30% of the window's time becomes a fixed notch with a break glyph saying how many days it hides, and every stretch that still keeps time gets at least 48 px. Labels are packed into **two lanes** by their **measured** width, and a run of same-kind revisions folds into one `DFM ×4` pill whose members keep their dots on the rail: hovering it magnifies that stretch until each member can carry its own label, a click pins the popover listing them, Escape closes it. A milestone carries an optional `glyph` (a `default` one that names `doc` is drawn as the signed drawing it is), a `preview` for the popover, and an `onOpen` that the popover's "Open" button fires — `onClick` selects the dot on the bar, `onOpen` opens the drawing behind it, and a card that declares only the first keeps its Open button because the footer falls back to it. Label and date are printed by the popover above the preview, so a consumer supplies neither. A milestone with **no date gets no position**, because the only position available would be a date the record does not have: it is listed beside the bar under "Not yet reached" (two rows, then a real `+N more` button) and takes no part in the range, the fill or a phase bracket. `phase` groups of 2+ get a bracket marking parallel work, the fill never runs past today, and today gets its dashed rule and tag even when it IS the right edge — the commonest case, because a programme with no finish date ends at today. **`variant="rail"`** is the bar alone, for a window whose stepper already names the stages: no card, no heading, no label under any dot — every milestone is a dot with a popover, a revision carries a two-character `caption` over its dot (`v3`; captions that would overprint collapse to `v1–v4`), `edgeCaptions` flank the rail on its own row (`{ start: 'Start', end: 'Ready' }`), nothing is cut (the `spread` axis: every stretch at least 48 px, the idle ones drawn short rather than notched), and what has not happened is one dashed **cap** at the end of a dashed tail — a real button announced as the last undated milestone, naming the rest in its popover. The stepper and the rail then point at each other: `highlightKeys` lights one soft band from the leftmost named milestone to the rightmost and every dot inside it (a single key rings one dot; the cap answers to the pending milestone's key), and `onHoverChange` reports the milestone under the pointer or the focus, `null` on leave. A `provisional` milestone — a sample ORDERED, drawn where the shipment will be — is hollow, never "where we are", and outside the fill. |
1723
1723
  | `SettingRow` | One setting in a settings card: the name with its explanation stacked under it on the left, the control or value on the right (it never shrinks), and an optional body (`children`) that opens beneath behind its own line. Each row draws its own top line (`divider`) and padding, so rows stack in a card. One prop per slot: `label` (the name) and `value` (a control or a read-only fact). Handles a value that is a control (`controlId` labels it; `labelId` puts an id on the name), a read-only fact, a value nobody knows (an em dash in the faint ink, never an empty cell), and a `quiet` row nothing can write yet. A name over a field (children, no value) draws nothing on the right. `DescriptionList` is the record-detail neighbour and stays that. `showWhen` (with `values`, and `context` for where the row is) hides the row while the rule is false — see `ShowWhen` below. **`size="compact"` is the editor-panel row, in the editor's look** (B2 plan C, Lewis 2026-10-26: efficient-easel's `SettingsField`, moved here whole, with its `es-field…` classes, which hosts style and select against): a name line — `icon`, the name (11px, grey; the accent's words while `changed`), the value's word (`readout`) at the right, then `action` (the `SettingReset` ↺, or a switch) — and the control (`value`) on its own line under it at full width, then the hint (`description`) flush left. A row whose only control is its `action` is one line; a row with neither draws nothing. The panel spaces its rows (efficient-easel's panel rhythm: 32px between two settings, 12px between a name and its control). A `Switch` in a compact row with no name of its own takes the row's name (`labelId`) by `aria-labelledby`. **The per-view state** (S7: V2 2026-10-09, D3 2026-10-12): `viewState="auto"` is a value never edited in the view on screen, worked out from the view above — an "auto" tag after the name, and every `InputNumber`, `Select` and `Slider` in the value wears the auto look (dashed edge, sunken ground, grey value) and is described as "auto" to a screen reader, from this one prop (a control's own `auto` wins; `useSettingAuto()` lets a host's own control follow it). `viewState="edited"` is a value set in this view: the kit's blue changed dot (`CountBadge dot tone="accent"`) after the name, heard as "Changed in this view". `readout` in a card row is the value's word ("1600px") with the control in `value` beneath it. |
1724
1724
  | `SettingReset` | The ↺ at the end of a compact `SettingRow`'s name line (`action`), in the editor's look (B2 plan C: efficient-easel's `SettingsDefaultReset`, moved here whole, with its `es-default-reset` classes): while `changed` (default) the 15px ↺ in a 22px button, in the accent's words; while not, the empty 22px slot, so every row's end lines up; `defaultAction` is the one press a row offers while unchanged, in the same slot. `view="desktop"` (default): "Reset Padding", back to the site default. `view="tablet"` / `"phone"`: "Inherit parent layout for Padding", back to auto. `detail` says what it goes back to ("auto, 40px"), in its tooltip and description; `name` and `tip` take a host's own words. A press calls `onReset` and moves focus to the row's own control. A host's right-click item on Tablet and Phone uses the same words: `strings.settingView.inheritParentLayout`, with a `PopupMenuItem` `description` second line. The three views' names are `strings.settingView.viewDesktop`, `viewTablet` and `viewPhone` — Desktop, Tablet, Phone (never "Mobile") — for a host's view switch and notes. |
@@ -4875,11 +4875,13 @@ read a stored focus on a server.
4875
4875
  | Export | Notes |
4876
4876
  |---|---|
4877
4877
  | `formatDate(value, { locale?, style?, timeZone? })` | `02/10/2026` in the reader's format. A bare `YYYY-MM-DD` is written as it is; a timestamp is moved into the reader's zone first (`23:30Z` on the 1st is the 2nd in Sydney). Given a `locale`, written by `Intl` in it (`style` defaults to `{ dateStyle: 'medium' }`). `timeZone` reads the instant in another zone — a signature in the signer's. |
4878
- | `formatDateTime(value, options?)` | `02/10/2026, 9:30 am`, same options. |
4878
+ | `formatDateTime(value, options?)` | `02/10/2026, 9:30 am`, same options. `zoneName: 'short' \| 'long'` labels the time with the zone it is drawn in (`02/10/2026, 9:30 am AEST`); with a `locale` and a `style` of parts (no `dateStyle`) the whole string is one `Intl.DateTimeFormat` in that locale (`Friday, 2 October 2026 at 9:30 am AEST`). For `formatDate`, `formatDateTime` and `formatTime`: a `timeZone` that Intl does not know, or a call on a server (no window) with no `timeZone`, is `—` (`EMPTY_VALUE`), never the runtime's clock (UTC on a server); a stale stored zone in a browser counts as none (the browser's zone). |
4879
4879
  | `dayKeyInZone(value, timeZone?)` | `2026-10-05`: the day an instant falls on in a zone (the user's zone by default, never UTC); what a date field shows for a stored instant. A bare `YYYY-MM-DD` is returned as it is (read by `fromDateKey`, so a day that does not exist is `null`); nothing readable is `null`. On a server (no window) pass `timeZone`: with none the answer is `null`, never the server's own zone. A `timeZone` that Intl does not know is `null` too; a stale stored zone counts as none (the browser's zone). |
4880
4880
  | `instantOnDayKey(day, { hour?, minute?, timeZone? })` | A picked day (and time) as the instant to store: `hour`:`minute` (default 12:00) on that day in the zone (the user's by default), as an ISO string. DST followed: a skipped time moves by the skipped hour and keeps its day; a repeated time is the first. `null` for a day that does not exist, an hour/minute off the clock, or no `timeZone` on a server (no window). Noon leaves twelve hours each way: a day picked in a US account zone reads the same day from UTC-4 to UTC-10 (mainland, Alaska, Hawaii; not Guam or Saipan). `dayKeyInZone(instantOnDayKey(day, { timeZone }), timeZone)` is `day`. |
4881
4881
  | `userToday(now?, timeZone?)` | `2026-10-05`: today on the user's clock (the user's zone by default, never UTC), as a day key. The shell's `Calendar` and `DatePicker` mark and offer it. On a server (no window) pass `timeZone`, or the answer is `null`. `fromDateKey(userToday())` is the local-midnight `Date` of that day. |
4882
- | `formatTime(value, options?)` | `9:30 am` — twelve-hour, small am/pm; a `locale` gives the locale's own clock. |
4882
+ | `formatTime(value, options?)` | `9:30 am` — twelve-hour, small am/pm; a `locale` gives the locale's own clock. `clock` (Intl parts: `{ hour: '2-digit', minute: '2-digit' }`, seconds, `hourCycle: 'h23'`, `timeStyle`; or date parts, `dateStyle`, `day`, `month`, `year`, `weekday`) writes exactly those parts, in `locale` or the runtime's locale and that locale's calendar, on the reader's zone: what `toLocale*String(undefined, …)` wrote, minus the device clock. `formatDateTime` with a `clock` that names date parts writes that one string (the date once). |
4883
+ | `knownZone(zone)` | Whether the runtime knows an IANA zone name (`'Australia/Sydney'`: `true`; a misspelt or retired name, or `''`: `false`). The one zone check: ask it before trusting a stored zone. |
4884
+ | `userZone()` | The user's zone by name: the stored zone when the runtime knows it, else the browser's own (`'Australia/Sydney'`). `undefined` on a server (no window): a server caller passes the zone. The zone every date helper uses when none is given. |
4883
4885
  | `getUserTimezone()`, `setUserTimezone(zone)`, `syncTimezoneFromProfile(zone)`, `TZ_AUTO` | The zone setting. `undefined` / `'auto'` follow the browser. Call `syncTimezoneFromProfile` when the signed-in user loads; a blank value changes nothing. |
4884
4886
  | `getUserDateFormat()`, `setUserDateFormat(key)`, `DATE_FORMAT_OPTIONS` | The format setting and the 16 formats a settings page offers. |
4885
4887
  | `timeAgo(value, { precise? })` | `just now` under a minute, then `5m ago`, `3h ago`, `2d ago`; from seven days on the date (`formatDate`). A future time is `just now`. `precise` counts seconds (`12s ago`) for a status screen. Takes a string, a `Date` or epoch ms. With `locale` (a BCP 47 tag) the words are `Intl.RelativeTimeFormat`'s in that language, and the fallback date is written in it too. |
@@ -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-7I5GD5IB.js";import{WindowTitle as n}from"./chunk-H4LUHKUJ.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-ECTLJTOE.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,L]=l(0),[G,H]=l(x),[U,I]=l(!1),[T,M]=l(null),J=i(null),F=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(G))}catch{}},[G]);const A=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),I(!1))},P=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},Z=()=>{const e=T?.trim();e?(H(t=>[...t,{label:e,url:w}]),M(null)):M(null)};c(()=>{if(null===T)return;J.current?.focus(),J.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||M(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==T]);const O=e=>{H(t=>t.filter((t,o)=>o!==e))},B=W>0,K=W<S.length-1,X=G.some(e=>e.url===w),Q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
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-RK6X56ZC.js";import{WindowTitle as n}from"./chunk-H4LUHKUJ.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-AJMQ5SHI.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,S]=l(w),[R,D]=l([w]),[W,z]=l(0),[H,L]=l(0),[E,G]=l(x),[U,I]=l(!1),[M,J]=l(null),T=i(null),A=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(E))}catch{}},[E]);const F=e=>{const t=f(e);t&&(v(t),S(t),D(e=>{const o=e.slice(0,W+1);return o.push(t),o}),z(e=>e+1),I(!1))},Z=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},P=()=>{const e=M?.trim();e?(G(t=>[...t,{label:e,url:w}]),J(null)):J(null)};c(()=>{if(null===M)return;T.current?.focus(),T.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||J(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==M]);const K=e=>{G(t=>t.filter((t,o)=>o!==e))},X=W>0,O=W<R.length-1,Q=E.some(e=>e.url===w),B="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(S[e]),D(S[e]),I(!1)}},disabled:!B,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]),I(!1)}},disabled:!K,className:Q,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
- /* @__PURE__ */u("button",{onClick:()=>L(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:()=>A(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(),A(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:[
6
+ /* @__PURE__ */u("button",{onClick:()=>{if(W>0){const e=W-1;z(e),v(R[e]),S(R[e]),I(!1)}},disabled:!X,className:B,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */u("button",{onClick:()=>{if(W<R.length-1){const e=W+1;z(e),v(R[e]),S(R[e]),I(!1)}},disabled:!O,className:B,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */u("button",{onClick:()=>L(e=>e+1),className:B,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */u("button",{onClick:()=>F(b),className:B,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
- /* @__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
- /* @__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?O(G.findIndex(e=>e.url===w)):void M(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:P,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:()=>I(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:[
12
+ /* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>S(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
+ /* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>S(w)}})})]})}),
14
+ /* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>Q?K(E.findIndex(e=>e.url===w)):void J(N(w)),className:B+" "+(Q?"text-yellow-500":""),title:Q?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:Q?"currentColor":"none",strokeWidth:1.5})}),
15
+ /* @__PURE__ */u("button",{onClick:Z,className:B,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
16
+ /* @__PURE__ */u("button",{onClick:()=>I(e=>!e),className:B,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==M&&/* @__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:J,type:"text",value:T,onChange:e=>M(e.target.value),onKeyDown:e=>{"Enter"===e.key?Z():"Escape"===e.key&&M(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"}),
19
+ /* @__PURE__ */u("input",{ref:T,type:"text",value:M,onChange:e=>J(e.target.value),onKeyDown:e=>{"Enter"===e.key?P():"Escape"===e.key&&J(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:()=>M(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
22
- /* @__PURE__ */u("button",{onClick:Z,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===G.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),G.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>A(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"})&&O(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:[
21
+ /* @__PURE__ */u("button",{onClick:()=>J(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
22
+ /* @__PURE__ */u("button",{onClick:P,disabled:!M.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===E.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),E.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"})&&K(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:E,iframeRef:F,openExternal:P,showHelp:U,dismissHelp:()=>I(!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:[
27
+ /* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:H,iframeRef:A,openExternal:Z,showHelp:U,dismissHelp:()=>I(!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 ",
@@ -0,0 +1,141 @@
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-OJI4ROSD.js";import{dayKeyInZone as m,formatTime as h,formatDateTime as u,userToday as f,instantOnDayKey as p}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as k}from"./chunk-36BRD5J3.js";import{fromDateKey as g,toDateKey as w}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as y,subscribeFilesChoice as b,getFilesChoice as v,holdFilesChoice as x,answerFilesChoice as N,choiceTakes as C}from"./chunk-4EFIUJ7X.js";import{AboutApp as S}from"./chunk-RK6X56ZC.js";import{getFilesStore as j,peekFilesViewRequest as D,consumeFilesViewRequest as M,FILES_SHOW_TRASH_EVENT as $,FILES_OPEN_DESKTOP_FOLDER_EVENT as T,subscribeDesktopFolders as L,getDesktopFoldersSnapshot as R,hasHostFilesStore as A,FolderGlyph as I,DesktopItemMiniIcon as P,desktopItemTypeLabel as E,FilesQuotaError as F,FILES_OFFICE_EXTENSIONS as z}from"./chunk-WBAWJIVM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as W,WindowTitle as K}from"./chunk-H4LUHKUJ.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 O,prompt as U}from"./chunk-KV6XCHAG.js";import{Dialog as J}from"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import{ItemCount as G}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-AJMQ5SHI.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 V}from"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as Y}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as H}from"./chunk-R2VKEMZH.js";import{TH_ONE_LINE as B}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 Q}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 Z,useRef as X,useEffect as q,useCallback as _,useSyncExternalStore as ee,useMemo as te}from"react";import{jsxs as ne,jsx as ae,Fragment as re}from"react/jsx-runtime";var ie={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 se(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function le(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":ie[se(e.name)]??"other"}var oe={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},ce={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 de(e){const t=e.officeKind?z[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function me(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":d(e.size)}function he(e,t=/* @__PURE__ */new Date){const n=m(e),a=m(t.toISOString());return n&&a?n===a?h(e,{clock:{hour:"numeric",minute:"2-digit"}}):n.slice(0,4)===a.slice(0,4)?u(e,{clock:{day:"numeric",month:"short"}}):u(e,{clock:{day:"numeric",month:"short",year:"numeric"}}):k}function ue(e){return h(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function fe(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var pe=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function ke(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 pe.compare(fe(e),fe(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return pe.compare(de(e),de(n))}})(e,a)||pe.compare(e.name,a.name))}var ge=["folder","document","spreadsheet","slides","pdf","image","video"],we={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function ye(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=f(t),a=g(n);if(!n||!a)return Number.NEGATIVE_INFINITY;"week"===e&&a.setDate(a.getDate()-6),"month"===e&&a.setDate(a.getDate()-29),"year"===e&&a.setMonth(0,1);const r=p(w(a),{hour:0,minute:0});return r?Date.parse(r):Number.NEGATIVE_INFINITY}(t.modified,n):null;return e.filter(e=>{if(t.type&&le(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 be=[{value:"viewer",label:"Viewer"},{value:"editor",label:"Editor"}];function ve({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=Z(null),[o,d]=Z(""),[m,h]=Z([]),[u,f]=Z(!1),[p,k]=Z(""),[g,w]=Z("viewer"),[y,b]=Z(!1),v=X(/* @__PURE__ */new Map),x=t?.id??null;if(q(()=>{if(l(null),k(""),d(""),!x||!e.shares)return;let t=!0;return e.shares(x).then(e=>{t&&l(e)}).catch(e=>{t&&(Q.error(e.message),l([]))}),()=>{t=!1}},[x,e]),q(()=>{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)v.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=>{b(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){Q.error(e.message)}finally{b(!1)}};/* @__PURE__ */
2
+ return ne(J,{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__ */ae(V,{variant:"secondary",onClick:a,children:"Done"}),children:[
3
+ /* @__PURE__ */ne("div",{className:"flex items-center gap-2",children:[
4
+ /* @__PURE__ */ae("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */ae(n,{value:p,onChange:k,onSearchChange:d,loading:u&&0===m.length,options:C,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
5
+ /* @__PURE__ */ae("div",{className:"w-28 shrink-0",children:/* @__PURE__ */ae(r,{value:g,onChange:e=>w(e),options:be,"aria-label":"Access"})}),
6
+ /* @__PURE__ */ae(V,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=v.current.get(p);S(async()=>{await e.share(t.id,p,g),k(""),d(""),n&&Q.success(`Shared with ${n.name}`)})},disabled:!p||y,children:"Add"})]}),
7
+ /* @__PURE__ */ae("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */ae(H,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */ne("ul",{className:"divide-y divide-line-subtle text-sm",children:[
8
+ /* @__PURE__ */ne("li",{className:"flex items-center gap-2 h-10",children:[
9
+ /* @__PURE__ */ae("span",{className:"flex-1 truncate",children:"You"}),
10
+ /* @__PURE__ */ae("span",{className:"text-xs text-ink-faint",children:"Owner"})]}),s.map(n=>/* @__PURE__ */ne("li",{className:"flex items-center gap-2 h-10",children:[
11
+ /* @__PURE__ */ae("span",{className:"flex-1 truncate",title:n.person.name,children:n.person.name}),
12
+ /* @__PURE__ */ae("div",{className:"w-28 shrink-0",children:/* @__PURE__ */ae(r,{value:n.role,onChange:a=>S(()=>e.share(t.id,n.person.id,a)),options:be,"aria-label":`Access for ${n.person.name}`,disabled:y})}),
13
+ /* @__PURE__ */ae(c,{"aria-label":`Remove ${n.person.name}`,variant:"ghost",size:"sm",disabled:y,onClick:()=>S(()=>e.unshare(t.id,n.person.id)),children:/* @__PURE__ */ae(Y,{name:"close",className:"h-4 w-4",strokeWidth:1.8})})]},n.person.id))]})]})}function xe({store:e,items:t,from:n,onClose:a,onMove:r}){const[i,s]=Z(n??null),[l,o]=Z(null),[d,m]=Z(!1);q(()=>{t&&s(n??null)},[t,n]),q(()=>{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,k=l?.folder,g="viewer"!==(k?.role??"owner"),w=void 0!==n&&i===n,y=t?.length??0,b=1===y?`"${t[0].name}"`:`${y} items`;/* @__PURE__ */
14
+ return ne(J,{open:!!t,onClose:a,title:`Move ${b}`,size:"sm",footer:/* @__PURE__ */ne(re,{children:[
15
+ /* @__PURE__ */ae(V,{variant:"secondary",onClick:a,children:"Cancel"}),
16
+ /* @__PURE__ */ae(V,{variant:"primary",onClick:()=>r(i),disabled:d||!g||w,children:"Move here"})]}),children:[
17
+ /* @__PURE__ */ne("div",{className:"flex items-center gap-1 mb-2 min-h-8",children:[null!==i&&/* @__PURE__ */ae(c,{"aria-label":"Back",size:"sm",onClick:()=>s(p),children:/* @__PURE__ */ae(Y,{name:"arrow-left",className:"h-4 w-4"})}),
18
+ /* @__PURE__ */ae("span",{className:"text-sm font-medium text-ink-strong truncate",children:null===i?"My files":k?.name??""})]}),
19
+ /* @__PURE__ */ae("div",{className:"border border-line rounded-(--radius-control) h-64 overflow-auto",children:d?/* @__PURE__ */ae(H,{size:"sm",padding:"p-6",label:"Loading"}):0===u.length?/* @__PURE__ */ae("div",{className:"p-6 text-center text-sm text-ink-faintest",children:"No folders here."}):/* @__PURE__ */ae("ul",{children:u.map(e=>/* @__PURE__ */ae("li",{children:/* @__PURE__ */ne("button",{type:"button",onClick:()=>s(e.id),className:"flex w-full items-center gap-2 px-3 h-9 text-left text-sm hover:bg-row-hover",children:[
20
+ /* @__PURE__ */ae(Y,{name:"folder",look:"solid",tone:"muted",className:"h-4 w-4 shrink-0"}),
21
+ /* @__PURE__ */ae("span",{className:"truncate flex-1",children:e.name}),
22
+ /* @__PURE__ */ae(Y,{name:"chevron-right",tone:"muted",className:"h-4 w-4 shrink-0"})]})},e.id))})}),!g&&/* @__PURE__ */ae("p",{className:"mt-2 text-xs text-ink-faint",children:"You can view this folder but not move things into it."})]})}function Ne({store:e,entry:t,selectedCount:n,onClose:a}){const[r,i]=Z(null),[s,l]=Z(null);q(()=>{if(i(null),l(null),!t)return;let n=!0;return e.info?.(t.id).then(e=>{n&&i(e)}).catch(()=>{}),e.shares?.(t.id).then(e=>{n&&l(e)}).catch(()=>{}),()=>{n=!1}},[e,t]);const o=t?le(t):null,d=o?ce[o]:null,m=r?.path.slice(0,-1).map(e=>e.name||"My files").join(" / "),h=(e,t)=>t?/* @__PURE__ */ne("div",{className:"py-2",children:[
23
+ /* @__PURE__ */ae("dt",{className:"text-2xs text-ink-faint",children:e}),
24
+ /* @__PURE__ */ae("dd",{className:"text-sm text-ink break-words",children:t})]}):null;/* @__PURE__ */
25
+ return ne("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col min-h-0 bg-surface","aria-label":"Details",children:[
26
+ /* @__PURE__ */ne("div",{className:"flex items-center gap-2 px-3 h-12 shrink-0",children:[d&&/* @__PURE__ */ae(Y,{name:d.name,tone:d.tone,className:"h-5 w-5 shrink-0"}),
27
+ /* @__PURE__ */ae("span",{className:"flex-1 truncate text-sm font-medium text-ink-strong",children:t?de(t):n>1?`${n} items selected`:"Details"}),
28
+ /* @__PURE__ */ae(c,{"aria-label":"Close details",size:"sm",onClick:a,children:/* @__PURE__ */ae(Y,{name:"close",className:"h-4 w-4"})})]}),
29
+ /* @__PURE__ */ae("div",{className:"flex-1 overflow-auto px-4 pb-4",children:t?/* @__PURE__ */ne(re,{children:[
30
+ /* @__PURE__ */ae("div",{className:"h-32 rounded-(--radius-control) bg-surface-sunken flex items-center justify-center mb-3",children:d&&/* @__PURE__ */ae(Y,{name:d.name,tone:d.tone,className:"h-12 w-12"})}),s&&/* @__PURE__ */ne("div",{className:"mb-3",children:[
31
+ /* @__PURE__ */ae("div",{className:"text-xs font-medium text-ink-strong mb-1",children:"Who has access"}),0===s.length?/* @__PURE__ */ne("p",{className:"text-sm text-ink-faint",children:["Only ","owner"!==t.role&&t.role?t.owner?.name??"its owner":"you"]}):/* @__PURE__ */ae("ul",{className:"text-sm text-ink",children:s.map(e=>/* @__PURE__ */ne("li",{className:"flex justify-between py-0.5",children:[
32
+ /* @__PURE__ */ae("span",{className:"truncate",children:e.person.name}),
33
+ /* @__PURE__ */ae("span",{className:"text-ink-faint text-xs",children:"editor"===e.role?"Editor":"Viewer"})]},e.person.id))})]}),
34
+ /* @__PURE__ */ne("dl",{className:"border-t border-line pt-2",children:[h("Type",o?oe[o]:null),"file"===t.kind&&h("Size",me(t)),h("Location",m),h("Owner","me"===fe(t)?"me":fe(t)),h("Modified",t.modifiedAt?`${he(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),h("Created",r?.createdAt?he(r.createdAt):null)]})]}):/* @__PURE__ */ae("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 Ce=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,Se="files.layout",je={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"},De=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],Me="application/x-efficient-files";function $e(){try{return"grid"===localStorage.getItem(Se)?"grid":"list"}catch{return"list"}}function Te(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=y()??[];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 Le(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 Re=(e,t)=>e instanceof Error&&e.message||t;function Ae(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 Ie({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=ce[le(e)];/* @__PURE__ */
35
+ return ae(Y,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function Pe({entry:e,read:t}){const[n,a]=Z(null),r="image"===le(e)&&e.size<=5242880;return q(()=>{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__ */ae("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */ae(Ie,{entry:e,className:"h-10 w-10"})}function Ee(){const n=j(),r=n.title??"Files",m=null!==y(),h=!m&&!!n.shares&&!!n.sharedWithMe,[u,f]=Z(null),[p,k]=Z(null),[g,w]=Z([]),[J,ie]=Z(()=>/* @__PURE__ */new Set),le=X(null),[be,Ee]=Z(!0),[Fe,ze]=Z(!1),[We,Ke]=Z(null),[Oe,Ue]=Z(!1),[Je,Ge]=Z(null),[Ve,Ye]=Z(null),[He,Be]=Z(null),[Qe,Ze]=Z($e),[Xe,qe]=Z(!1),[_e,et]=Z(""),[tt,nt]=Z(""),[at,rt]=Z({}),[it,st]=Z({key:"name",dir:"asc"}),[lt,ot]=Z(()=>{const e=D();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),ct=X("files"),dt=X(lt);dt.current=lt,q(()=>{M()},[]);const[mt,ht]=Z([]),ut=e=>{Ze(e);try{localStorage.setItem(Se,e)}catch{}},ft=_(e=>{ot(e),rt({}),st("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(et(""),nt(""))},[]);q(()=>{const e=()=>{M(),ft("trash")},t=e=>{M();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener($,e),window.addEventListener(T,t),()=>{window.removeEventListener($,e),window.removeEventListener(T,t)}},[ft]);const pt=ee(L,R,R),kt="object"==typeof lt?lt.desktopFolderId:null,gt=kt?pt?.folders.find(e=>e.id===kt)??null:null,wt=kt&&pt?.itemsByFolder[kt]||[];q(()=>{kt&&pt&&!pt.folders.some(e=>e.id===kt)&&ft("files")},[kt,pt,ft]);const yt=X(0),bt=X(null),vt=X(null),{openPage:xt,openEntity:Nt}=W(),Ct=i(),St=i(),jt=i(),Dt=ee(b,v,v);q(()=>x(),[]),q(()=>{!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=_(async()=>{if(!m)try{Ke(await n.quota())}catch{}},[n,m]),Tt=_(async(e,t)=>{Ee(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):Q.error(Re(e,t))}finally{Ee(!1)}},[]),Lt=_(async e=>{if(m)return k(Te(e)),ze(!1),void Ee(!1);await Tt(async()=>{k(await n.list(e))},"Failed to list"),$t()},[n,$t,m,Tt]),Rt=_(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=m?Te(u):await n.list(u).catch(()=>null);return w((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()=>{w(await a())},"Failed to list files")},[n,m,u,Tt]),At=_(async()=>{if(m)return ht([]),void Ee(!1);await Tt(async()=>{ht(await n.trash())},"Failed to list trash"),$t()},[n,$t,m,Tt]),It=()=>{"files"===lt?Lt(u):Ce(lt)?Rt(lt,tt):"trash"===lt&&At()};q(()=>{ie(/* @__PURE__ */new Set),le.current=null,It()},[u,lt,tt]),q(()=>{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 Pt=()=>{et(""),"search"===dt.current&&ft(ct.current)},Et=e=>{ft("files"),f(e)},Ft=async(e,t)=>{try{await e()}catch(e){Q.error(Re(e,t))}It()},zt=e=>Ft(async()=>{await n.restore(e.id),Q.success(`Restored "${e.name}"`)},"Restore failed"),Wt=async e=>{await O({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Ft(()=>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){Q.error(Re(e,"Download failed"))}},Ot="files"===lt?p?.folder??null:null,Ut=Ot?.role??"owner",Jt="owner"!==Ut,Gt="files"===lt?u:null,Vt=!m&&("files"!==lt||"viewer"!==Ut),Yt=!m&&"files"===lt&&"viewer"!==Ut,Ht=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(Gt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof F?Q.error(Le(r.name,e)):Q.error(`Upload ${r.name}: ${Re(e,"failed")}`)}}a>1&&Q.success(`Uploaded ${a} files`),"files"===lt?Lt(u):Et(null)},Bt=async e=>{const t=de(e),a=await U({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?Q.error("Names cannot contain slashes"):Ft(()=>n.rename(e.id,function(e,t){const n=e.officeKind?z[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??p?.folder.owner)?.name??"its owner":"their owners";await O({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${de(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 Ft(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),Q.success(t?`"${de(t)}" moved to trash`:`${e.length} items moved to trash`))},Zt=(e,t)=>Ft(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),Xt=async(e,t)=>{Be(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Ft(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),Q.success(1===a.length?`Moved "${de(a[0])}"`:`Moved ${a.length} items`))},qt=()=>{yt.current=0,Ue(!1),Ge(null)};q(()=>{const e=()=>qt();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const _t="files"===lt?p?.entries??[]:Ce(lt)?g:[],en=te(()=>ke(ye(_t,at),it),[_t,at,it]),tn=te(()=>new Map(en.map(e=>[e.id,e])),[en]),nn=[...J].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=>!m&&"viewer"!==rn(e),ln=e=>h&&"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 ie(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&le.current){const t=en.map(e=>e.id),n=t.indexOf(le.current),a=t.indexOf(e);if(n>=0&&a>=0)return void ie(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}le.current=e,t.metaKey||t.ctrlKey?ie(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):ie(/* @__PURE__ */new Set([e]))},dn=()=>{ie(/* @__PURE__ */new Set),le.current=null},mn=e=>!!Dt&&"file"===e.kind&&C(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?p?.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";N(Dt.id,{entry:e,folderId:"files"===lt?u:null,location:n})},fn=Dt&&an&&mn(an)?an:null,pn=t=>{"folder"===t.kind?Et(t.id):Dt?un(t):(async t=>{if(m)return;if(n.open?.(t))return;const a=je[se(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)},kn=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__ */ae(Y,{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(m)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */ae(Y,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const s=e.some(e=>!e.starred);return Ae([...t?[{key:"open",label:a,icon:/* @__PURE__ */ae(Y,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */ae(Y,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */ae(Y,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Bt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */ae(Y,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Ft(async()=>{for(const t of e)await n.copy(t.id);Q.success(1===e.length?`Copied "${de(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&ln(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */ae(Y,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Ye(t)}]:[],...e.every(on)?[{key:"move",label:"Move",icon:/* @__PURE__ */ae(Y,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Be(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */ae(Y,{name:"star",className:"h-4 w-4"}),onSelect:()=>Zt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */ae(Y,{name:"info",className:"h-4 w-4"}),onSelect:()=>{ie(/* @__PURE__ */new Set([t.id])),qe(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */ae(Y,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},gn=(e,t)=>{const n=J.has(t.id)?nn:[t];Ct.open(e,n)&&!J.has(t.id)&&(ie(/* @__PURE__ */new Set([t.id])),le.current=t.id)},wn=e=>on(e)?{draggable:!0,onDragStart:t=>{const n=J.has(e.id)?nn:[e];t.dataTransfer.setData(Me,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(Me)&&(t.preventDefault(),t.stopPropagation(),Je!==e.id&&Ge(e.id))},onDragLeave:()=>{Je===e.id&&Ge(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(Me))return;t.preventDefault(),t.stopPropagation(),Ge(null);const n=JSON.parse(t.dataTransfer.getData(Me)||"[]").map(e=>tn.get(e)).filter(t=>!!t&&t.id!==e.id);Xt(n,e.id)}}:{};if(Fe)/* @__PURE__ */
36
+ return ne("div",{className:"flex flex-col h-full bg-surface",children:[
37
+ /* @__PURE__ */ae(K,{title:`${r} - offline`}),
38
+ /* @__PURE__ */ae("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */ne("div",{className:"max-w-md",children:[
39
+ /* @__PURE__ */ae(Y,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),A()?/* @__PURE__ */ne(re,{children:[
40
+ /* @__PURE__ */ae("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
41
+ /* @__PURE__ */ae("p",{className:"text-sm text-ink-faint mb-3",children:"Check your connection and try again."})]}):/* @__PURE__ */ne(re,{children:[
42
+ /* @__PURE__ */ae("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
43
+ /* @__PURE__ */ne("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
44
+ /* @__PURE__ */ae("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
45
+ /* @__PURE__ */ae(V,{variant:"primary",onClick:It,children:"Retry"})]})})]});const bn=We&&We.limit>0?Math.min(100,Math.round(We.used/We.limit*100)):0,vn=bn>90?"bg-danger":bn>75?"bg-warning":"bg-accent-fill",xn=[Jt?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>Et(null)},...(Ot?.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":gt?gt.name:null,Cn=Dt?`${r} - Choosing`:Nn?`${r} - ${"search"===lt?"Search":Nn}`:Ot&&null!==Ot.id?`${r} - ${Ot.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=Ae([{key:"folder",label:"New folder",icon:/* @__PURE__ */ae(Y,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await U({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?Q.error("Folder names cannot contain slashes"):(await Ft(()=>n.createFolder(Gt,e),"Create folder failed"),"files"!==lt&&Et(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */ae(Y,{name:"upload",className:"h-4 w-4"}),onSelect:()=>bt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */ae(Y,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?De.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=ce["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */ae(Y,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Gt)).catch(e=>Q.error(Re(e,"Could not create it")))}}}):[]]),Dn=/* @__PURE__ */ne("div",{className:"flex h-full flex-col",children:[
46
+ /* @__PURE__ */ae("div",{className:"p-3 pb-2",children:/* @__PURE__ */ae(o,{trigger:/* @__PURE__ */ne(re,{children:[
47
+ /* @__PURE__ */ae(Y,{name:"add",className:"h-5 w-5"}),
48
+ /* @__PURE__ */ae("span",{children:"New"})]}),items:jn,align:"start","aria-label":"New",disabled:!Vt,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
+ /* @__PURE__ */ne("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
50
+ /* @__PURE__ */ne("button",{onClick:()=>Et(null),className:Sn("files"===lt&&!Jt),children:[
51
+ /* @__PURE__ */ae(Y,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!m&&/* @__PURE__ */ne("button",{onClick:()=>ft("recent"),className:Sn("recent"===lt),children:[
52
+ /* @__PURE__ */ae(Y,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!m&&/* @__PURE__ */ne("button",{onClick:()=>ft("starred"),className:Sn("starred"===lt),children:[
53
+ /* @__PURE__ */ae(Y,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),h&&/* @__PURE__ */ne("button",{onClick:()=>ft("shared"),className:Sn("shared"===lt||"files"===lt&&Jt),children:[
54
+ /* @__PURE__ */ae(Y,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!m&&/* @__PURE__ */ne("button",{onClick:()=>ft("trash"),className:Sn("trash"===lt),children:[
55
+ /* @__PURE__ */ae(Y,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),pt&&pt.folders.length>0&&/* @__PURE__ */ne(re,{children:[
56
+ /* @__PURE__ */ae("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__ */ne("button",{onClick:()=>ft({desktopFolderId:e.id}),className:Sn(kt===e.id),children:[
57
+ /* @__PURE__ */ae(I,{className:"h-4 w-4 shrink-0 text-amber-500"}),
58
+ /* @__PURE__ */ae("span",{className:"truncate",children:e.name}),
59
+ /* @__PURE__ */ae(G,{count:e.itemCount,active:kt===e.id,className:"ml-auto"})]},e.id))]})]}),We&&/* @__PURE__ */ne("div",{className:"px-5 py-3 shrink-0",title:`${d(We.used)} of ${d(We.limit)} used`,children:[
60
+ /* @__PURE__ */ae("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */ae("div",{className:`h-full ${vn} transition-all`,style:{width:`${bn}%`}})}),
61
+ /* @__PURE__ */ne("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[d(We.used)," of ",d(We.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */ne("span",{className:"inline-flex items-center gap-1",children:[e,
62
+ /* @__PURE__ */ae(Y,{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=Ce(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)=>pe.compare(e.name,t.name))}(_t),Rn=Tn&&_t.length>0?/* @__PURE__ */ne("div",{className:"flex items-center gap-2 shrink-0",children:[
63
+ /* @__PURE__ */ae(o,{trigger:Mn(at.type?oe[at.type]:"Type",!!at.type),"aria-label":"Type",triggerClassName:$n(!!at.type),items:[...ge.map(e=>({type:"radio",key:e,label:oe[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}))}]:[]]}),h&&/* @__PURE__ */ae(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__ */ae(o,{trigger:Mn(at.modified?we[at.modified]:"Modified",!!at.modified),"aria-label":"Modified",triggerClassName:$n(!!at.modified),items:[...Object.keys(we).map(e=>({type:"radio",key:e,label:we[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,An=Tn&&nn.length>0&&!Dt?/* @__PURE__ */ne("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
65
+ /* @__PURE__ */ae(c,{"aria-label":"Clear selection",size:"sm",onClick:dn,children:/* @__PURE__ */ae(Y,{name:"close",className:"h-4 w-4"})}),
66
+ /* @__PURE__ */ne("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[nn.length," selected"]}),an&&ln(an)&&/* @__PURE__ */ae(c,{"aria-label":"Share",size:"sm",onClick:()=>Ye(an),children:/* @__PURE__ */ae(Y,{name:"add-person",className:"h-4 w-4"})}),!m&&nn.every(e=>"file"===e.kind)&&/* @__PURE__ */ae(c,{"aria-label":"Download",size:"sm",onClick:()=>nn.forEach(Kt),children:/* @__PURE__ */ae(Y,{name:"download",className:"h-4 w-4"})}),nn.every(on)&&/* @__PURE__ */ae(c,{"aria-label":"Move",size:"sm",onClick:()=>Be(nn),children:/* @__PURE__ */ae(Y,{name:"forward",className:"h-4 w-4"})}),!m&&nn.every(sn)&&/* @__PURE__ */ae(c,{"aria-label":"Move to trash",size:"sm",onClick:()=>Qt(nn),children:/* @__PURE__ */ae(Y,{name:"trash",className:"h-4 w-4"})}),
67
+ /* @__PURE__ */ae(o,{trigger:/* @__PURE__ */ae(Y,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:kn(nn)})]}):null,In=/* @__PURE__ */ae("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:An??/* @__PURE__ */ne(re,{children:[
68
+ /* @__PURE__ */ne("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===lt?/* @__PURE__ */ae("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */ae(a,{items:xn,maxItems:5})}):"trash"===lt?/* @__PURE__ */ae("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof lt?/* @__PURE__ */ne(re,{children:[
69
+ /* @__PURE__ */ae(I,{className:"h-4 w-4 text-amber-500 shrink-0"}),
70
+ /* @__PURE__ */ae("span",{className:"text-base font-medium text-ink-strong truncate",children:gt?.name??"Desktop folder"}),
71
+ /* @__PURE__ */ae("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */ae("span",{className:"text-base font-medium text-ink-strong truncate",children:Nn}),"files"===lt&&Jt&&"viewer"===Ut&&/* @__PURE__ */ne("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__ */ae(Y,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===lt&&Jt&&Ot?.owner&&/* @__PURE__ */ne("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Ot.owner.name]})]}),Rn,"trash"===lt&&/* @__PURE__ */ae(V,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===mt.length)return;await O({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"})&&Ft(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===mt.length,children:"Empty trash"})]})}),Pn=(e,t)=>Dt?null:/* @__PURE__ */ne("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[ln(e)&&/* @__PURE__ */ae(c,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Ye(e)},children:/* @__PURE__ */ae(Y,{name:"add-person",className:"h-4 w-4"})}),!m&&"file"===e.kind&&/* @__PURE__ */ae(c,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Kt(e)},children:/* @__PURE__ */ae(Y,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!m&&/* @__PURE__ */ae(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__ */ae(Y,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
+ /* @__PURE__ */ae("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ae(o,{trigger:/* @__PURE__ */ae(Y,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:kn(J.has(e.id)&&nn.length>1?nn:[e])})})]}),En=e=>/* @__PURE__ */ne("span",{className:"flex items-center gap-3 min-w-0",children:[
74
+ /* @__PURE__ */ae(Ie,{entry:e}),
75
+ /* @__PURE__ */ae("span",{className:"truncate",title:e.name,children:de(e)}),!!e.shareCount&&/* @__PURE__ */ae("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__ */ae(Y,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */ae("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */ae(Y,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),Fn=(e,t,n)=>{const a=it.key===e;/* @__PURE__ */
76
+ return ae("th",{className:`${B} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===it.dir?"ascending":"descending":void 0,children:/* @__PURE__ */ne("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__ */ae(Y,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */ae(Y,{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,Wn=0===en.length?be?/* @__PURE__ */ae(H,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */ae("div",{className:"p-10 text-center text-sm text-ink-faintest",children:_t.length>0?"Nothing matches these filters.":zn??/* @__PURE__ */ne(re,{children:["This folder is empty.",Yt&&/* @__PURE__ */ne(re,{children:[" Drop files here or choose ",
77
+ /* @__PURE__ */ae("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Qe?/* @__PURE__ */ae("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__ */ne("section",{className:"mb-4",children:[
78
+ /* @__PURE__ */ae("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
79
+ /* @__PURE__ */ae("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=J.has(t.id);/* @__PURE__ */
80
+ return ne("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":de(t),onClick:e=>cn(t.id,e),onDoubleClick:()=>pn(t),onContextMenu:e=>gn(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||Je===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
81
+ /* @__PURE__ */ne("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
82
+ /* @__PURE__ */ae(Ie,{entry:t,className:"h-4 w-4"}),
83
+ /* @__PURE__ */ae("span",{className:"flex-1 truncate text-sm",title:t.name,children:de(t)}),
84
+ /* @__PURE__ */ae("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ae(o,{trigger:/* @__PURE__ */ae(Y,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:kn(a&&nn.length>1?nn:[t])})})]}),"file"===e&&/* @__PURE__ */ne(re,{children:[
85
+ /* @__PURE__ */ae("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */ae(Pe,{entry:t,read:m?void 0:n.read})}),
86
+ /* @__PURE__ */ne("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===fe(t)?"You":fe(t)," · ",he(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */ne("table",{className:"w-full text-sm table-fixed",children:[
87
+ /* @__PURE__ */ae("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ne("tr",{children:[Fn("name","Name","text-left"),h&&Fn("owner","Owner","text-left w-32"),Fn("modified","Modified","text-left w-28"),Fn("size","Size","text-right w-20"),
88
+ /* @__PURE__ */ae("th",{className:`${B} w-32`,children:/* @__PURE__ */ae("span",{className:"sr-only",children:"Actions"})})]})}),
89
+ /* @__PURE__ */ae("tbody",{children:en.map(e=>{const t=J.has(e.id);/* @__PURE__ */
90
+ return ne("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),onContextMenu:t=>gn(t,e),...wn(e),...yn(e),className:`group cursor-default select-none border-b border-line-subtle ${hn(e)} ${t||Je===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
91
+ /* @__PURE__ */ae("td",{className:"px-3 h-11",children:En(e)}),h&&/* @__PURE__ */ae("td",{className:"px-3 h-11 text-ink-faint truncate",children:fe(e)}),
92
+ /* @__PURE__ */ae("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:ue(e.modifiedAt),children:he(e.modifiedAt)}),
93
+ /* @__PURE__ */ae("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:me(e)}),
94
+ /* @__PURE__ */ae("td",{className:"px-2 h-11",children:Pn(e,t)})]},e.id)})})]}),Kn=be&&0===mt.length?/* @__PURE__ */ae(H,{size:"sm",padding:"p-6",label:"Loading"}):0===mt.length?/* @__PURE__ */ae("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */ne("table",{className:"w-full text-sm table-fixed",children:[
95
+ /* @__PURE__ */ae("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ne("tr",{children:[
96
+ /* @__PURE__ */ae("th",{className:`${B} text-left font-medium px-3 h-9`,children:"Name"}),
97
+ /* @__PURE__ */ae("th",{className:`${B} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
98
+ /* @__PURE__ */ae("th",{className:`${B} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
99
+ /* @__PURE__ */ae("th",{className:`${B} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
100
+ /* @__PURE__ */ae("th",{className:`${B} w-28`,children:/* @__PURE__ */ae("span",{className:"sr-only",children:"Actions"})})]})}),
101
+ /* @__PURE__ */ae("tbody",{children:mt.map(e=>/* @__PURE__ */ne("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
102
+ /* @__PURE__ */ae("td",{className:"px-3 h-11",children:/* @__PURE__ */ne("span",{className:"flex items-center gap-3 min-w-0",children:[
103
+ /* @__PURE__ */ae(Ie,{entry:e}),
104
+ /* @__PURE__ */ae("span",{className:"truncate",title:e.name,children:e.name})]})}),
105
+ /* @__PURE__ */ae("td",{className:"px-3 h-11 text-ink-faint text-xs truncate",title:e.originalPath,children:e.originalPath||"—"}),
106
+ /* @__PURE__ */ae("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:e.deletedAt?ue(e.deletedAt):void 0,children:e.deletedAt?he(e.deletedAt):"—"}),
107
+ /* @__PURE__ */ae("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":d(e.size)}),
108
+ /* @__PURE__ */ae("td",{className:"px-2 h-11",children:/* @__PURE__ */ne("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
109
+ /* @__PURE__ */ae(c,{"aria-label":"Restore",size:"sm",onClick:()=>zt(e),children:/* @__PURE__ */ae(Y,{name:"revert",className:"h-4 w-4"})}),
110
+ /* @__PURE__ */ae(c,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>Wt(e),children:/* @__PURE__ */ae(Y,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),On=0===wt.length?/* @__PURE__ */ae("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__ */ne("table",{className:"w-full text-sm table-fixed",children:[
111
+ /* @__PURE__ */ae("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ne("tr",{children:[
112
+ /* @__PURE__ */ae("th",{className:`${B} text-left font-medium px-3 h-9`,children:"Name"}),
113
+ /* @__PURE__ */ae("th",{className:`${B} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
114
+ /* @__PURE__ */ae("th",{className:`${B} w-32`,children:/* @__PURE__ */ae("span",{className:"sr-only",children:"Actions"})})]})}),
115
+ /* @__PURE__ */ae("tbody",{children:wt.map(e=>/* @__PURE__ */ne("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
+ /* @__PURE__ */ae("td",{className:"px-3 h-11",children:/* @__PURE__ */ne("span",{className:"flex items-center gap-3 min-w-0",children:[
117
+ /* @__PURE__ */ae(P,{item:e}),
118
+ /* @__PURE__ */ae("span",{className:"truncate",title:e.label,children:e.label})]})}),
119
+ /* @__PURE__ */ae("td",{className:"px-3 h-11 text-xs text-ink-faint",children:E(e)}),
120
+ /* @__PURE__ */ae("td",{className:"px-2 h-11",children:/* @__PURE__ */ne("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
121
+ /* @__PURE__ */ae(c,{"aria-label":"Open",size:"sm",onClick:()=>Mt(e),children:/* @__PURE__ */ae(Y,{name:"external",className:"h-4 w-4"})}),
122
+ /* @__PURE__ */ae(c,{"aria-label":"Move to desktop",size:"sm",onClick:()=>pt?.moveToDesktop([e]),children:/* @__PURE__ */ae(Y,{name:"desktop",className:"h-4 w-4"})}),
123
+ /* @__PURE__ */ae(c,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>pt?.removeShortcuts([e]),children:/* @__PURE__ */ae(Y,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
124
+ return ne("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Yt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),yt.current++,Oe||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(),Yt&&e.dataTransfer.files?.length&&Ht(e.dataTransfer.files))},children:[
125
+ /* @__PURE__ */ae(K,{title:Cn}),
126
+ /* @__PURE__ */ae(S,{app:"files"}),
127
+ /* @__PURE__ */ae("input",{ref:bt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Ht(e.target.files),bt.current&&(bt.current.value="")}}),
128
+ /* @__PURE__ */ae("input",{ref:e=>{vt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Ht(e.target.files,{withFolders:!0}),vt.current&&(vt.current.value="")}}),
129
+ /* @__PURE__ */ae("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */ae(t,{sidebar:Dn,storageKey:"files.sidebarWidth",defaultWidth:220,minWidth:170,maxWidth:320,children:/* @__PURE__ */ne("div",{className:"flex h-full min-w-0",children:[
130
+ /* @__PURE__ */ne("div",{className:"flex flex-1 min-w-0 flex-col",children:[Dt&&/* @__PURE__ */ne("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-line bg-accent-tint text-accent-text text-sm shrink-0",role:"status",children:[
131
+ /* @__PURE__ */ae(Y,{name:"cursor",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),
132
+ /* @__PURE__ */ae("span",{className:"flex-1 min-w-0 truncate",children:Dt.request.title}),
133
+ /* @__PURE__ */ae(V,{variant:"secondary",size:"sm",onClick:()=>N(Dt.id,null),children:"Cancel"}),
134
+ /* @__PURE__ */ae(V,{variant:"primary",size:"sm",disabled:!fn,onClick:()=>{fn&&un(fn)},children:"Open"})]}),
135
+ /* @__PURE__ */ne("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
136
+ /* @__PURE__ */ae("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */ae(l,{type:"text",enterKeyHint:"search",value:_e,onChange:e=>{et(e.target.value),e.target.value.trim()||Pt()},onKeyDown:e=>{"Escape"===e.key&&_e&&(e.stopPropagation(),Pt())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */ae(Y,{name:"search",className:"h-4 w-4"}),endAction:_e?{label:"Clear search",icon:/* @__PURE__ */ae(Y,{name:"close",className:"h-4 w-4"}),onClick:Pt}:void 0})}),
137
+ /* @__PURE__ */ae("div",{className:"flex-1"}),"object"!=typeof lt&&"trash"!==lt&&/* @__PURE__ */ne(re,{children:[
138
+ /* @__PURE__ */ae(c,{"aria-label":"List view","aria-pressed":"list"===Qe,onClick:()=>ut("list"),children:/* @__PURE__ */ae(Y,{name:"list",className:"h-4 w-4"})}),
139
+ /* @__PURE__ */ae(c,{"aria-label":"Grid view","aria-pressed":"grid"===Qe,onClick:()=>ut("grid"),children:/* @__PURE__ */ae(Y,{name:"grid",className:"h-4 w-4"})})]}),
140
+ /* @__PURE__ */ae(c,{"aria-label":"Details","aria-pressed":Xe,onClick:()=>qe(e=>!e),children:/* @__PURE__ */ae(Y,{name:"info",className:"h-4 w-4"})})]}),In,
141
+ /* @__PURE__ */ae("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(),ie(new Set(en.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&dn()},children:"object"==typeof lt?On:"trash"===lt?Kn:Wn})]}),Xe&&Tn&&/* @__PURE__ */ae(Ne,{store:n,entry:an,selectedCount:nn.length,onClose:()=>qe(!1)})]})})}),Ct.state&&/* @__PURE__ */ae(s,{...Ct.props,items:kn(Ct.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */ae(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */ae(Y,{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__ */ae(Y,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)}]}),jt.state&&/* @__PURE__ */ae(s,{...jt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */ae(Y,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(jt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */ae(Y,{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__ */ae(Y,{name:"close",className:"h-4 w-4"}),onSelect:()=>pt?.removeShortcuts([jt.state.data])}]}),h&&/* @__PURE__ */ae(ve,{store:n,entry:Ve,onClose:()=>Ye(null),onChanged:It}),n.move&&/* @__PURE__ */ae(xe,{store:n,items:He,from:"files"===lt?u:void 0,onClose:()=>Be(null),onMove:e=>He&&Xt(He,e)}),Oe&&/* @__PURE__ */ae("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__ */ae("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{Ee as default,Le as quotaExceededMessage};
@@ -1,8 +1,8 @@
1
- import{getNumberingConfigs as e}from"./chunk-NVAH2NQI.js";import{SidebarLayout as t}from"./chunk-6D6Q3ZCG.js";import"./chunk-QWK6DRSN.js";import"./chunk-PC3MYH2K.js";import{timeAgo as r}from"./chunk-S6UJKSF3.js";import"./chunk-ZPJTLNKU.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-7I5GD5IB.js";import{useWindowManager as o,client_default as i}from"./chunk-H4LUHKUJ.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"./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{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-ECTLJTOE.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 s}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{toast_default as l}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{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var y=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[v]);const T=j.notepad_notes||[],[_,D]=d(null),[S,C]=d(""),[W,I]=d(""),[U,X]=d("yellow"),[G,J]=d(!1),[$,H]=d(!1),K=a(null),M=a();p(()=>{if(!_&&T.length>0){const e=T[0];D(e.id),C(e.title),I(e.content),X(e.color)}},[T.length]);const E=m(e=>{N({notepad_notes:e})},[N]),R=m(()=>{if(!_||!G)return;const e=T.map(e=>e.id===_?{...e,title:S,content:W,color:U,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);E(e),J(!1)},[_,G,S,W,U,T,E]);p(()=>{if(G)return M.current&&clearTimeout(M.current),M.current=setTimeout(R,800),()=>{M.current&&clearTimeout(M.current)}},[G,R]),p(()=>()=>{G&&R()},[]);const Q=e=>{G&&R(),D(e.id),C(e.title),I(e.content),X(e.color),J(!1),H(!1)},Z=e=>{const t=W.slice(0,e),r=W.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=W.slice(e+r[0].length);I(t+n+o),J(!0)},L=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},O="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",F=/* @__PURE__ */h(g,{children:[
2
- /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{G&&R();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...T];E(t),D(e.id),C(""),I(""),X("yellow"),J(!1),H(!0),setTimeout(()=>K.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
1
+ import{getNumberingConfigs as e}from"./chunk-NVAH2NQI.js";import{SidebarLayout as t}from"./chunk-6D6Q3ZCG.js";import"./chunk-QWK6DRSN.js";import"./chunk-PC3MYH2K.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-RK6X56ZC.js";import{useWindowManager as o,client_default as i}from"./chunk-H4LUHKUJ.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"./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{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-AJMQ5SHI.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 s}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{toast_default as l}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{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var y=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[v]);const T=j.notepad_notes||[],[_,D]=d(null),[S,C]=d(""),[W,H]=d(""),[I,X]=d("yellow"),[M,R]=d(!1),[$,G]=d(!1),J=a(null),K=a();p(()=>{if(!_&&T.length>0){const e=T[0];D(e.id),C(e.title),H(e.content),X(e.color)}},[T.length]);const U=m(e=>{N({notepad_notes:e})},[N]),Q=m(()=>{if(!_||!M)return;const e=T.map(e=>e.id===_?{...e,title:S,content:W,color:I,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);U(e),R(!1)},[_,M,S,W,I,T,U]);p(()=>{if(M)return K.current&&clearTimeout(K.current),K.current=setTimeout(Q,800),()=>{K.current&&clearTimeout(K.current)}},[M,Q]),p(()=>()=>{M&&Q()},[]);const O=e=>{M&&Q(),D(e.id),C(e.title),H(e.content),X(e.color),R(!1),G(!1)},Z=e=>{const t=W.slice(0,e),r=W.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=W.slice(e+r[0].length);H(t+n+o),R(!0)},E=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},A="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",F=/* @__PURE__ */h(g,{children:[
2
+ /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{M&&Q();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...T];U(t),D(e.id),C(""),H(""),X("yellow"),R(!1),G(!0),setTimeout(()=>J.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
3
  /* @__PURE__ */x(s,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
4
  /* @__PURE__ */x("div",{className:"flex-1 overflow-y-auto",children:0===T.length?/* @__PURE__ */x("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):T.map(e=>{const t=(n=e.color,y.find(e=>e.key===n)||y[0]);var n;/* @__PURE__ */
5
- return h("button",{onClick:()=>Q(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
5
+ return h("button",{onClick:()=>O(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
6
  /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
8
  /* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
@@ -12,10 +12,10 @@ return h("div",{className:"h-full",children:[
12
12
  /* @__PURE__ */x(n,{app:"notepad"}),
13
13
  /* @__PURE__ */x(t,{sidebar:F,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
14
  /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */x("input",{value:S,onChange:e=>{C(e.target.value),J(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */x("div",{className:"flex gap-1",children:y.map(e=>/* @__PURE__ */x("button",{onClick:()=>{X(e.key),J(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${U===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(E(t),_===e){const e=t[0];e?Q(e):(D(null),C(""),I(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),$?/* @__PURE__ */x("textarea",{ref:K,value:W,onChange:e=>{I(e.target.value),J(!0)},onBlur:()=>{H(!1),G&&R()},placeholder:O,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{H(!0),setTimeout(()=>K.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:W?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(w.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>L(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>Z(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
- return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(W):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:O})}),
15
+ /* @__PURE__ */x("input",{value:S,onChange:e=>{C(e.target.value),R(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */x("div",{className:"flex gap-1",children:y.map(e=>/* @__PURE__ */x("button",{onClick:()=>{X(e.key),R(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${I===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(U(t),_===e){const e=t[0];e?O(e):(D(null),C(""),H(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),$?/* @__PURE__ */x("textarea",{ref:J,value:W,onChange:e=>{H(e.target.value),R(!0)},onBlur:()=>{G(!1),M&&Q()},placeholder:A,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{G(!0),setTimeout(()=>J.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:W?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(w.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>E(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>Z(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
+ return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(W):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:A})}),
19
19
  /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
20
  /* @__PURE__ */x("span",{children:"[] checkbox"}),
21
21
  /* @__PURE__ */x("span",{children:"SO#35001 entity link"}),