efficient-shell 4.148.0 → 4.149.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -510,7 +510,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
510
510
  | `Banner` | Static in-flow alert (`tone`: info / success / warning / danger). `action` renders a control at the right edge — after the text, so a screen reader reaches the problem before the remedy, and before the dismiss ×, so "Update card" is never past "close this". Vertically centred against the words and `shrink-0`, so a message that wraps does not drag the button down or squeeze it — and on a narrow banner (a phone, a narrow column: the words keep at least 12rem) it drops UNDER the words rather than leave them a column one word wide. A banner that names a condition and leaves the fix three menus away is the usual shape of a notice nobody acts on. |
511
511
  | `Tabs`, `Accordion`, `Tooltip` | Controlled tab strip, collapsible sections, frosted hover/focus tooltip. A tooltip's `side` is a preference: near an edge the bubble slides along that side to stay 8 px clear of it, and flips to the opposite side when its own has no room, keeping inside the screen and inside the shell window that owns its trigger (UI-11). It never leaves that box: a bubble wider than the room wraps, and one taller than the room is cut off at it. A small arrow on the edge facing the trigger points at the trigger's centre wherever the bubble ended up, kept clear of the bubble's corners; it is the bubble's own surface (`.rosh-tooltip-arrow` in `ui.css`), solid and seamless under `rosh-reduce-transparency`, and hidden from assistive technology. |
512
512
  | `Stepper` | A linear wizard's progress strip — numbered circles, connectors, `aria-current="step"`. Controlled like Tabs; completed steps are clickable to go back (when `onChange` is wired), upcoming steps never are — moving forward belongs to the wizard's own Continue button, behind its validation. |
513
- | `DataTable` | Read-only table for server-driven lists: it renders and reports, and never sorts or pages its own `data`. Controlled sort and pager, row selection, column groups, pinned columns, windowed rendering. `onRow` gives a row `onClick`, a `className` and any `data-*` attributes for its `<tr>` — a test's or a stylesheet's hook (`data-testid`, `data-state`). `stackOnNarrow` turns each row into a labelled card on a narrow container — see [DataTable on a narrow screen](#datatable-on-a-narrow-screen). |
513
+ | `DataTable` | Read-only table for server-driven lists: it renders and reports, and never sorts or pages its own `data`. Controlled sort and pager, row selection, column groups, pinned columns, windowed rendering. `onRow` gives a row `onClick`, a `className`, any `data-*` attributes for its `<tr>` — a test's or a stylesheet's hook (`data-testid`, `data-state`) — the pointer and the keyboard coming in and out (`onMouseEnter` … `onBlur`) and `current`. `rowHref` makes each row one real link (`onRowPress` a button) with its controls still pressable — see [DataTable rows that are links](#datatable-rows-that-are-links). `stackOnNarrow` turns each row into a labelled card on a narrow container — see [DataTable on a narrow screen](#datatable-on-a-narrow-screen). |
514
514
  | `Pagination` | Numbered page control (pairs with tables; complements `ListFooter`). |
515
515
  | `Sparkline`, `LineChart`, `BarChart`, `DonutChart`, `ScatterChart` | Dependency-free inline-SVG charts (`currentColor`-themed). `LineChart` is the multi-series trend with optional scale, legend, dots and area fill. `ScatterChart` takes `xDomain` / `yDomain` to override the derived axis, and `xScale` / `yScale` of `'log'` for a long tail; a point outside a supplied domain is dropped and counted in the accessible label. |
516
516
  | `BulkImportGrid` | Paste-or-upload bulk entry with column mapping, duplicate review and optional sum-merge. Hands resolved rows to `onImport`; owns no persistence. The whole panel takes a dropped CSV; the Upload CSV button opens the same dialog. |
@@ -762,7 +762,7 @@ instead — every cell on a line of its own, its column's name beside the value:
762
762
  - **Opt-in.** Without the prop the markup is byte-for-byte what it was.
763
763
  - **Labels** come from each column's `title`, or its `label` when the title is
764
764
  a node; a grouped column's reads "Debit · Amount". Figures columns keep their
765
- values at the card's right edge.
765
+ values at the card's right edge. A cell with nothing in it takes no line.
766
766
  - **Sorting** stays: the sortable headers become a wrapping row of the same
767
767
  sort buttons above the cards, with "select all" first when there is
768
768
  `selection`. Each card carries its own checkbox; `onRow`, `rowClassName`
@@ -775,6 +775,77 @@ instead — every cell on a line of its own, its column's name beside the value:
775
775
  - The wrapper becomes a size container, which takes its width from its parent.
776
776
  In a parent that sizes to its content (`w-fit`, an inline-block, an `auto`
777
777
  grid track) give the table a width.
778
+ - **Another width.** `stackBelow={60}` stacks below 60rem instead — for a list
779
+ of many columns that is cramped long before 40. Still one rule set and a
780
+ right first paint: the query measures a box scaled to 40/60 of the table.
781
+ - **Each layout's own columns.** `only: 'wide'` keeps a column to the strip of
782
+ columns (figures to compare down a page, words the card already says);
783
+ `only: 'stacked'` to the card — one cell that says in two lines what five
784
+ columns spread out. Give a card-only column a `title` for screen readers and
785
+ `label: ''` when the card should print no name beside it.
786
+ - **The card's corner.** `cardCorner: true` puts a small control — a toggle, an
787
+ avatar, up to 1.75rem — in the card's top-left corner, as the selection box
788
+ sits, instead of a line of its own. Not with `selection`.
789
+ - **Cell classes.** A column's `className` goes on its cells
790
+ (`headerClassName` on its header): `@max-[72rem]:hidden` on both drops a
791
+ column from a table under 72rem — Tailwind's container variants measure the
792
+ table, with `stackBelow` too.
793
+
794
+ ### DataTable rows that are links
795
+
796
+ `rowHref` makes each row ONE link — a real `<a href>` (or the host router's,
797
+ `linkAs`) stretched over the whole row. A click anywhere on the row opens it,
798
+ and so do a middle click, "Open in new tab" and the status bar, which a row
799
+ with `onClick` cannot offer. `render`'s third argument, `rowLink`, puts the
800
+ link round the words that name the row:
801
+
802
+ ```tsx
803
+ <DataTable
804
+ stackOnNarrow
805
+ rowHref={lead => `/leads/${lead.id}`}
806
+ linkAs={Link}
807
+ columns={[
808
+ {
809
+ key: 'lead',
810
+ title: 'Lead',
811
+ render: (lead, _i, rowLink) => (
812
+ <>
813
+ {rowLink(lead.name, { className: 'font-medium' })}
814
+ <span className="block text-xs">{lead.suburb}</span>
815
+ </>
816
+ ),
817
+ },
818
+ // Still its own control: pressing it never opens the row.
819
+ { key: 'stage', title: 'Stage', render: lead => <StageSelect lead={lead} /> },
820
+ ]}
821
+ onRow={lead => ({ current: lead.id === chosenId, ...pointAt(lead.id), 'data-testid': 'lead-row' })}
822
+ data={leads}
823
+ rowKey="id"
824
+ />
825
+ ```
826
+
827
+ - **Controls stay pressable.** The link's overlay is the row's bottom layer
828
+ and the cells let the pointer through to it except where it lands on
829
+ something interactive — a link, a button, a form field, `[tabindex]`, the
830
+ ARIA widget roles — so plain text anywhere is the row's link, and a select or
831
+ a button in a cell is pressed as itself. Nothing about those controls is
832
+ moved or restacked. Anything else that must keep its own pointer (a
833
+ tooltip's trigger) sets `pointer-events: auto`.
834
+ - **One tab stop per row** for the link — the row itself is not focusable —
835
+ then the row's controls, in the order they are drawn. Its name is the words
836
+ `rowLink` wrapped. The ring goes round the whole row (under
837
+ `rosh-host-focus`, the host's own rule rings the link).
838
+ - No column calls `rowLink`? The link goes round the first column's content.
839
+ `rowHref` returning `undefined` leaves that row without one.
840
+ - **A row that does something without going anywhere** — choosing a venue's
841
+ pin on the map beside the list — is `onRowPress`: the same, as a `<button>`.
842
+ - **The chosen row:** `onRow`'s `current` puts `aria-current="true"` on the
843
+ row's link and a bar down its leading edge.
844
+ - **Pointing at a row:** `onRow`'s `onMouseEnter` / `onMouseLeave`, and
845
+ `onFocus` / `onBlur` for the keyboard coming into the row and leaving it
846
+ (moving between the row's own controls is neither) — the shape of
847
+ `useMapHighlight`'s `pointAt(key)`, so a row rings its pin on an
848
+ `EntityMap` beside the list by spreading it.
778
849
 
779
850
  ### Server rendering (Next.js App Router)
780
851
 
@@ -1,29 +1,29 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-JIUJNTJA.js";import"./chunk-VUXPSUWI.js";import{WindowTitle as r}from"./chunk-ET5HXDOR.js";import"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import"./chunk-ZBIWNVJS.js";import{confirm as n}from"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useRef as a,useEffect as i,useState as l}from"react";import{jsxs as s,jsx as c,Fragment as m}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",u="react-os-shell:browser-homepage",h="https://en.wikipedia.org/wiki/Main_Page",p=[{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 b(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 k=["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 f(){if("undefined"==typeof window)return p;try{const e=localStorage.getItem(d);if(!e)return p;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return p}function x(){return"undefined"==typeof window?h:localStorage.getItem(u)||h}function w(){const m=a(void 0);void 0===m.current&&(m.current=e()),i(()=>{null!=m.current&&t(m.current)},[]);const h=m.current?b(m.current.url):"",[p,g]=l(x),[k,w]=l(h||p),[N,L]=l(k),[C,j]=l([k]),[z,M]=l(0),[W,B]=l(0),[R,S]=l(f),[H,I]=l(!1),[E,A]=l(null),T=a(null),U=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(R))}catch{}},[R]);const D=e=>{const t=b(e);t&&(w(t),L(t),j(e=>{const o=e.slice(0,z+1);return o.push(t),o}),M(e=>e+1),I(!1))},J=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},P=()=>{const e=E?.trim();e?(S(t=>[...t,{label:e,url:k}]),A(null)):A(null)};i(()=>{if(null===E)return;T.current?.focus(),T.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||A(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==E]);const O=e=>{S(t=>t.filter((t,o)=>o!==e))},V=z>0,q=z<C.length-1,F=R.some(e=>e.url===k),X="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
1
+ import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-ZSDLYYQA.js";import"./chunk-2Q3T5CT3.js";import{WindowTitle as r}from"./chunk-ET5HXDOR.js";import"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import"./chunk-ZBIWNVJS.js";import{confirm as n}from"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useRef as a,useEffect as i,useState as l}from"react";import{jsxs as s,jsx as c,Fragment as m}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",u="react-os-shell:browser-homepage",h="https://en.wikipedia.org/wiki/Main_Page",p=[{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 b(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 k=["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 f(){if("undefined"==typeof window)return p;try{const e=localStorage.getItem(d);if(!e)return p;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return p}function x(){return"undefined"==typeof window?h:localStorage.getItem(u)||h}function w(){const m=a(void 0);void 0===m.current&&(m.current=e()),i(()=>{null!=m.current&&t(m.current)},[]);const h=m.current?b(m.current.url):"",[p,g]=l(x),[k,w]=l(h||p),[N,L]=l(k),[C,j]=l([k]),[z,M]=l(0),[W,B]=l(0),[R,S]=l(f),[H,E]=l(!1),[T,A]=l(null),I=a(null),D=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(R))}catch{}},[R]);const O=e=>{const t=b(e);t&&(w(t),L(t),j(e=>{const o=e.slice(0,z+1);return o.push(t),o}),M(e=>e+1),E(!1))},P=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},U=()=>{const e=T?.trim();e?(S(t=>[...t,{label:e,url:k}]),A(null)):A(null)};i(()=>{if(null===T)return;I.current?.focus(),I.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||A(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==T]);const J=e=>{S(t=>t.filter((t,o)=>o!==e))},V=z>0,q=z<C.length-1,F=R.some(e=>e.url===k),$="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
2
  return s("div",{className:"relative flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */c(r,{title:`Browser - ${v(k)}`}),
4
4
  /* @__PURE__ */c(o,{app:"browser"}),
5
5
  /* @__PURE__ */s("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
6
- /* @__PURE__ */c("button",{onClick:()=>{if(z>0){const e=z-1;M(e),w(C[e]),L(C[e]),I(!1)}},disabled:!V,className:X,title:"Back",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
7
- /* @__PURE__ */c("button",{onClick:()=>{if(z<C.length-1){const e=z+1;M(e),w(C[e]),L(C[e]),I(!1)}},disabled:!q,className:X,title:"Forward",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
8
- /* @__PURE__ */c("button",{onClick:()=>B(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
9
- /* @__PURE__ */c("button",{onClick:()=>D(p),className:X,title:"Home",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0l8.954 8.955M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})})}),
10
- /* @__PURE__ */c("form",{onSubmit:e=>{e.preventDefault(),D(N)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */s("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__ */c("button",{onClick:()=>{if(z>0){const e=z-1;M(e),w(C[e]),L(C[e]),E(!1)}},disabled:!V,className:$,title:"Back",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
7
+ /* @__PURE__ */c("button",{onClick:()=>{if(z<C.length-1){const e=z+1;M(e),w(C[e]),L(C[e]),E(!1)}},disabled:!q,className:$,title:"Forward",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
8
+ /* @__PURE__ */c("button",{onClick:()=>B(e=>e+1),className:$,title:"Refresh",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
9
+ /* @__PURE__ */c("button",{onClick:()=>O(p),className:$,title:"Home",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0l8.954 8.955M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})})}),
10
+ /* @__PURE__ */c("form",{onSubmit:e=>{e.preventDefault(),O(N)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */s("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__ */c("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
12
12
  /* @__PURE__ */c("input",{type:"text",value:N,onChange:e=>L(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…"}),k!==N&&/* @__PURE__ */c("button",{type:"button",onClick:()=>L(k),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
13
- /* @__PURE__ */c("button",{"data-bookmark-popover":!0,onClick:()=>F?O(R.findIndex(e=>e.url===k)):void A(v(k)),className:X+" "+(F?"text-yellow-500":""),title:F?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:F?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),
14
- /* @__PURE__ */c("button",{onClick:J,className:X,title:"Open in new tab",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-7.5-9L21 3m0 0v6m0-6L9.75 14.25"})})}),
15
- /* @__PURE__ */c("button",{onClick:()=>I(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})})]}),null!==E&&/* @__PURE__ */s("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:[
13
+ /* @__PURE__ */c("button",{"data-bookmark-popover":!0,onClick:()=>F?J(R.findIndex(e=>e.url===k)):void A(v(k)),className:$+" "+(F?"text-yellow-500":""),title:F?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:F?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),
14
+ /* @__PURE__ */c("button",{onClick:P,className:$,title:"Open in new tab",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-7.5-9L21 3m0 0v6m0-6L9.75 14.25"})})}),
15
+ /* @__PURE__ */c("button",{onClick:()=>E(e=>!e),className:$,title:"Embedding help",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})})]}),null!==T&&/* @__PURE__ */s("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:[
16
16
  /* @__PURE__ */c("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
17
17
  /* @__PURE__ */c("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
18
- /* @__PURE__ */c("input",{ref:T,type:"text",value:E,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key?P():"Escape"===e.key&&A(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
18
+ /* @__PURE__ */c("input",{ref:I,type:"text",value:T,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key?U():"Escape"===e.key&&A(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
19
  /* @__PURE__ */s("div",{className:"flex justify-end gap-1 mt-2",children:[
20
20
  /* @__PURE__ */c("button",{onClick:()=>A(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
- /* @__PURE__ */c("button",{onClick:P,disabled:!E.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
22
- /* @__PURE__ */s("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===R.length&&/* @__PURE__ */c("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),R.map((e,t)=>/* @__PURE__ */s("button",{onClick:()=>D(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&O(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
21
+ /* @__PURE__ */c("button",{onClick:U,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"})]})]}),
22
+ /* @__PURE__ */s("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===R.length&&/* @__PURE__ */c("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),R.map((e,t)=>/* @__PURE__ */s("button",{onClick:()=>O(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&J(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
23
23
  /* @__PURE__ */c("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)),
24
24
  /* @__PURE__ */c("div",{className:"flex-1"}),
25
25
  /* @__PURE__ */c("button",{onClick:()=>{g(k);try{localStorage.setItem(u,k)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
26
- /* @__PURE__ */c("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */c(y,{url:k,iframeKey:W,iframeRef:U,openExternal:J,showHelp:H,dismissHelp:()=>I(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function y({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,u]=l(!1);i(()=>{u(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */c("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */s("div",{className:"max-w-md text-center",children:[
26
+ /* @__PURE__ */c("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */c(y,{url:k,iframeKey:W,iframeRef:D,openExternal:P,showHelp:H,dismissHelp:()=>E(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function y({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,u]=l(!1);i(()=>{u(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */c("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */s("div",{className:"max-w-md text-center",children:[
27
27
  /* @__PURE__ */c("svg",{className:"h-14 w-14 mx-auto text-gray-300 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728L5.636 5.636m12.728 12.728L21 21M5.636 5.636L3 3m9 9a9 9 0 110-18 9 9 0 010 18z"})}),
28
28
  /* @__PURE__ */s("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
29
  /* @__PURE__ */s("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
@@ -1,12 +1,12 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-JIUJNTJA.js";import{toast_default as n}from"./chunk-KKOHUQPF.js";import"./chunk-VUXPSUWI.js";import{WindowTitle as r}from"./chunk-ET5HXDOR.js";import"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-ZBIWNVJS.js";import"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useState as s,useRef as c}from"react";import{jsxs as d,jsx as h}from"react/jsx-runtime";var m=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),u=/* @__PURE__ */new Set(["docx"]),p={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function g(){const[g,x]=s(p),[f,y]=s(!1),[v,b]=s(!1),[k,w]=s(!1),[N,C]=s(null),j=c(null),D=c(null),L=c(null),M=(e,t)=>{L.current?.focus(),document.execCommand(e,!1,t),w(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{L.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),w(!0)},e.readAsDataURL(t)}},R=e=>{N&&(N.el.removeAttribute("width"),N.el.removeAttribute("height"),N.el.style.width=e??"",N.el.style.height=e?"auto":"",w(!0),C(null))},B=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();y(!0);try{if(m.has(r)||!u.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");x({filename:t.name,kind:"text",content:o,ext:r}),w(!1)}else if(u.has(r))try{const e=await(import(
1
+ import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-ZSDLYYQA.js";import{toast_default as n}from"./chunk-KKOHUQPF.js";import"./chunk-2Q3T5CT3.js";import{WindowTitle as r}from"./chunk-ET5HXDOR.js";import"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-ZBIWNVJS.js";import"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useState as s,useRef as c}from"react";import{jsxs as d,jsx as h}from"react/jsx-runtime";var m=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),u=/* @__PURE__ */new Set(["docx"]),p={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function g(){const[g,x]=s(p),[f,y]=s(!1),[v,b]=s(!1),[k,w]=s(!1),[N,C]=s(null),D=c(null),j=c(null),L=c(null),M=(e,t)=>{L.current?.focus(),document.execCommand(e,!1,t),w(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{L.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),w(!0)},e.readAsDataURL(t)}},R=e=>{N&&(N.el.removeAttribute("width"),N.el.removeAttribute("height"),N.el.style.width=e??"",N.el.style.height=e?"auto":"",w(!0),C(null))},B=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();y(!0);try{if(m.has(r)||!u.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");x({filename:t.name,kind:"text",content:o,ext:r}),w(!1)}else if(u.has(r))try{const e=await(import(
2
2
  /* @vite-ignore */
3
- "mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});x({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),w(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{y(!1)}},I=g?.filename?(T=g.filename).length>24?`${T.slice(0,23)}…`:T:"Untitled";var T;/* @__PURE__ */
3
+ "mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});x({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),w(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{y(!1)}},T=g?.filename?(I=g.filename).length>24?`${I.slice(0,23)}…`:I:"Untitled";var I;/* @__PURE__ */
4
4
  return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),v||b(!0)},onDragLeave:e=>{e.currentTarget===e.target&&b(!1)},onDrop:e=>{e.preventDefault(),b(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?U(t):B(t[0]))},children:[
5
- /* @__PURE__ */h(r,{title:`${I}${k?" •":""} - Documents`}),
5
+ /* @__PURE__ */h(r,{title:`${T}${k?" •":""} - Documents`}),
6
6
  /* @__PURE__ */h(t,{app:"documents"}),
7
7
  /* @__PURE__ */d("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
8
- /* @__PURE__ */h("input",{ref:j,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&B(t),j.current&&(j.current.value="")},className:"hidden"}),
9
- /* @__PURE__ */d("button",{onClick:()=>j.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
8
+ /* @__PURE__ */h("input",{ref:D,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&B(t),D.current&&(D.current.value="")},className:"hidden"}),
9
+ /* @__PURE__ */d("button",{onClick:()=>D.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
10
10
  /* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),"Open"]}),
11
11
  /* @__PURE__ */h("button",{onClick:()=>{if(!g)return;const t=L.current?.innerHTML??"";if("text"===g.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(g.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${g.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=L.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=g.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(g.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${g.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
12
12
  /* @__PURE__ */h("span",{className:"text-[10px] text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
@@ -38,8 +38,8 @@ return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
38
38
  /* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>M("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
39
  /* @__PURE__ */h("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>M("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */h("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
40
40
  /* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */h("input",{ref:D,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(Array.from(e.target.files)),D.current&&(D.current.value="")}}),
42
- /* @__PURE__ */d("button",{onClick:()=>D.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
41
+ /* @__PURE__ */h("input",{ref:j,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(Array.from(e.target.files)),j.current&&(j.current.value="")}}),
42
+ /* @__PURE__ */d("button",{onClick:()=>j.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
43
43
  /* @__PURE__ */h("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),"Image"]})]}),
44
44
  /* @__PURE__ */h("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */h("div",f?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===g.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */h("div",{ref:L,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>w(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),U(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),C({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:g.content},className:"docx"===g.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-[14px] leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-[13px] leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),v&&/* @__PURE__ */h("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */h("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),N&&/* @__PURE__ */d(o,{minWidth:150,style:{left:N.x,top:N.y},onClose:()=>C(null),children:[
45
45
  /* @__PURE__ */h(l,{children:"Image width"}),
@@ -1,4 +1,4 @@
1
- import{openPreviewFile as e}from"./chunk-4FS742BM.js";import{Breadcrumbs as t}from"./chunk-I55UMU3R.js";import{SidebarLayout as r}from"./chunk-SLCR26NK.js";import{getFilesDemoTree as a}from"./chunk-FHTLC7HH.js";import{AboutApp as n}from"./chunk-JIUJNTJA.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as s,FILES_OPEN_DESKTOP_FOLDER_EVENT as l,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-NPJH5MD7.js";import"./chunk-ESL5TDNA.js";import{toast_default as u}from"./chunk-KKOHUQPF.js";import"./chunk-VTVSMRFX.js";import"./chunk-VUXPSUWI.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-ET5HXDOR.js";import"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import"./chunk-ZBIWNVJS.js";import{confirm as g,prompt as y}from"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useState as b,useEffect as k,useSyncExternalStore as v,useRef as w,useCallback as N}from"react";import{jsxs as L,jsx as j,Fragment as C}from"react/jsx-runtime";var $="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",M={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"};function T(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function D(e){if(!e)return"—";const t=["B","KB","MB","GB"];let r=e,a=0;for(;r>=1024&&a<t.length-1;)r/=1024,a++;return`${r<10?r.toFixed(1):Math.round(r)} ${t[a]}`}function E(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function A(){const A=$.replace(/\/$/,""),R=null!==a(),[B,I]=b("/"),[P,S]=b([]),[F,H]=b([]),[U,W]=b(null),[O,V]=b(!0),[z,J]=b(!1),[K,_]=b(null),[X,Q]=b(!1),[q,G]=b(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});k(()=>{o()},[]);const[Z,Y]=b([]);k(()=>{const e=()=>{o(),G("trash")},t=e=>{o();const t=e.detail?.folderId;t&&G({desktopFolderId:t})};return window.addEventListener(s,e),window.addEventListener(l,t),()=>{window.removeEventListener(s,e),window.removeEventListener(l,t)}},[]);const ee=v(d,c,c),te="object"==typeof q?q.desktopFolderId:null,re=te?ee?.folders.find(e=>e.id===te)??null:null,ae=te&&ee?.itemsByFolder[te]||[];k(()=>{te&&ee&&!ee.folders.some(e=>e.id===te)&&G("files")},[te,ee]);const ne=w(0),ie=w(null),{openPage:oe,openEntity:se}=f(),le=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>oe(e)}):"page"===t.entityType?oe(t.entityId):se(t.entityType,t.entityId,null,t.label)},de=N((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ce=N(async()=>{try{const e=await de(`${A}/api/quota`);if(e.ok){const t=await e.json();_({used:t.used,limit:t.limit})}}catch{}},[de,A]),me=N(async e=>{if(W(null),R){const t=function(e){const t=a();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return S(t),I(e),J(!1),V(!1),void("/"===e&&H(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}V(!0);try{const t=await de(`${A}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];S(a),I(r.path||e),J(!1),"/"===(r.path||e)&&H(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){J(!0)}finally{V(!1)}ce()},[de,A,ce,R]),he=N(async()=>{if(R)return Y([]),void V(!1);V(!0),W(null);try{const e=await de(`${A}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();Y(t.entries||[]),J(!1)}catch{J(!0)}finally{V(!1)}ce()},[de,A,ce,R]);k(()=>{"files"===q?me(B):"trash"===q&&he()},[B,q]);const pe=async e=>{const t=T(B,e.name);try{const r=await de(`${A}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void u.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){u.error(e?.message||"Download failed")}},ue=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await de(`${A}/api/upload?path=${encodeURIComponent(B)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));u.error(`Quota exceeded — ${D(r)} free, ${e.name} is ${D(t.attempted||e.size)}`)}else u.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){u.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}me(B)},fe=()=>{ne.current=0,Q(!1)};if(k(()=>{const e=()=>fe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),z)/* @__PURE__ */
1
+ import{openPreviewFile as e}from"./chunk-4FS742BM.js";import{Breadcrumbs as t}from"./chunk-I55UMU3R.js";import{SidebarLayout as r}from"./chunk-SLCR26NK.js";import{getFilesDemoTree as a}from"./chunk-FHTLC7HH.js";import{AboutApp as n}from"./chunk-ZSDLYYQA.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as s,FILES_OPEN_DESKTOP_FOLDER_EVENT as l,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-NPJH5MD7.js";import"./chunk-ESL5TDNA.js";import{toast_default as u}from"./chunk-KKOHUQPF.js";import"./chunk-VTVSMRFX.js";import"./chunk-2Q3T5CT3.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-ET5HXDOR.js";import"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import"./chunk-ZBIWNVJS.js";import{confirm as g,prompt as y}from"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useState as b,useEffect as k,useSyncExternalStore as v,useRef as w,useCallback as N}from"react";import{jsxs as L,jsx as j,Fragment as C}from"react/jsx-runtime";var $="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",M={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"};function T(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function D(e){if(!e)return"—";const t=["B","KB","MB","GB"];let r=e,a=0;for(;r>=1024&&a<t.length-1;)r/=1024,a++;return`${r<10?r.toFixed(1):Math.round(r)} ${t[a]}`}function E(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function A(){const A=$.replace(/\/$/,""),R=null!==a(),[B,P]=b("/"),[I,S]=b([]),[F,H]=b([]),[O,U]=b(null),[W,V]=b(!0),[z,J]=b(!1),[K,_]=b(null),[Q,X]=b(!1),[Y,Z]=b(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});k(()=>{o()},[]);const[q,G]=b([]);k(()=>{const e=()=>{o(),Z("trash")},t=e=>{o();const t=e.detail?.folderId;t&&Z({desktopFolderId:t})};return window.addEventListener(s,e),window.addEventListener(l,t),()=>{window.removeEventListener(s,e),window.removeEventListener(l,t)}},[]);const ee=v(d,c,c),te="object"==typeof Y?Y.desktopFolderId:null,re=te?ee?.folders.find(e=>e.id===te)??null:null,ae=te&&ee?.itemsByFolder[te]||[];k(()=>{te&&ee&&!ee.folders.some(e=>e.id===te)&&Z("files")},[te,ee]);const ne=w(0),ie=w(null),{openPage:oe,openEntity:se}=f(),le=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>oe(e)}):"page"===t.entityType?oe(t.entityId):se(t.entityType,t.entityId,null,t.label)},de=N((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ce=N(async()=>{try{const e=await de(`${A}/api/quota`);if(e.ok){const t=await e.json();_({used:t.used,limit:t.limit})}}catch{}},[de,A]),me=N(async e=>{if(U(null),R){const t=function(e){const t=a();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return S(t),P(e),J(!1),V(!1),void("/"===e&&H(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}V(!0);try{const t=await de(`${A}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];S(a),P(r.path||e),J(!1),"/"===(r.path||e)&&H(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){J(!0)}finally{V(!1)}ce()},[de,A,ce,R]),he=N(async()=>{if(R)return G([]),void V(!1);V(!0),U(null);try{const e=await de(`${A}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();G(t.entries||[]),J(!1)}catch{J(!0)}finally{V(!1)}ce()},[de,A,ce,R]);k(()=>{"files"===Y?me(B):"trash"===Y&&he()},[B,Y]);const pe=async e=>{const t=T(B,e.name);try{const r=await de(`${A}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void u.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){u.error(e?.message||"Download failed")}},ue=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await de(`${A}/api/upload?path=${encodeURIComponent(B)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));u.error(`Quota exceeded — ${D(r)} free, ${e.name} is ${D(t.attempted||e.size)}`)}else u.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){u.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}me(B)},fe=()=>{ne.current=0,X(!1)};if(k(()=>{const e=()=>fe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),z)/* @__PURE__ */
2
2
  return L("div",{className:"flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */j(x,{title:"Files - offline"}),
4
4
  /* @__PURE__ */j("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */L("div",{className:"max-w-md",children:[
@@ -9,33 +9,33 @@ return L("div",{className:"flex flex-col h-full bg-white",children:[
9
9
  /* @__PURE__ */L("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
10
10
  /* @__PURE__ */j("span",{className:"font-mono",children:A}),". Make sure the server is running — see ",
11
11
  /* @__PURE__ */j("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
12
- /* @__PURE__ */j("button",{onClick:()=>me(B),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===B?[]:B.split("/").filter(Boolean),ge=K&&K.limit>0?Math.min(100,Math.round(K.used/K.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",be=[{label:"My files",onClick:()=>I("/")},...xe.map((e,t)=>({label:e,onClick:()=>I("/"+xe.slice(0,t+1).join("/"))}))],ke=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),ve=e=>/* @__PURE__ */j("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),we=/* @__PURE__ */L("nav",{className:"p-2",children:[
12
+ /* @__PURE__ */j("button",{onClick:()=>me(B),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===B?[]:B.split("/").filter(Boolean),ge=K&&K.limit>0?Math.min(100,Math.round(K.used/K.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",be=[{label:"My files",onClick:()=>P("/")},...xe.map((e,t)=>({label:e,onClick:()=>P("/"+xe.slice(0,t+1).join("/"))}))],ke=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),ve=e=>/* @__PURE__ */j("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),we=/* @__PURE__ */L("nav",{className:"p-2",children:[
13
13
  /* @__PURE__ */j("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
14
- /* @__PURE__ */L("button",{onClick:()=>{G("files"),I("/")},className:ke("files"===q&&"/"===B),children:[ve("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),F.map(e=>/* @__PURE__ */L("button",{onClick:()=>{G("files"),I("/"+e)},className:ke("files"===q&&B==="/"+e),children:[ve("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
15
- /* @__PURE__ */j("span",{className:"truncate",children:e})]},e)),!R&&/* @__PURE__ */L("button",{onClick:()=>G("trash"),className:ke("trash"===q),children:[ve("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),ee&&ee.folders.length>0&&/* @__PURE__ */L(C,{children:[
16
- /* @__PURE__ */j("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ee.folders.map(e=>/* @__PURE__ */L("button",{onClick:()=>G({desktopFolderId:e.id}),className:ke(te===e.id),children:[
14
+ /* @__PURE__ */L("button",{onClick:()=>{Z("files"),P("/")},className:ke("files"===Y&&"/"===B),children:[ve("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),F.map(e=>/* @__PURE__ */L("button",{onClick:()=>{Z("files"),P("/"+e)},className:ke("files"===Y&&B==="/"+e),children:[ve("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
15
+ /* @__PURE__ */j("span",{className:"truncate",children:e})]},e)),!R&&/* @__PURE__ */L("button",{onClick:()=>Z("trash"),className:ke("trash"===Y),children:[ve("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),ee&&ee.folders.length>0&&/* @__PURE__ */L(C,{children:[
16
+ /* @__PURE__ */j("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ee.folders.map(e=>/* @__PURE__ */L("button",{onClick:()=>Z({desktopFolderId:e.id}),className:ke(te===e.id),children:[
17
17
  /* @__PURE__ */j(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
18
18
  /* @__PURE__ */j("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */j("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
19
- return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{R||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,X||Q(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&Q(!1)},onDrop:e=>{e.preventDefault(),fe(),R||"object"==typeof q||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
19
+ return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{R||"object"==typeof Y||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,Q||X(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&X(!1)},onDrop:e=>{e.preventDefault(),fe(),R||"object"==typeof Y||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
20
20
  /* @__PURE__ */j(x,{title:re?`Files - ${re.name}`:"Files"+("/"===B?"":" - "+B)}),
21
21
  /* @__PURE__ */j(n,{app:"files"}),
22
22
  /* @__PURE__ */j("input",{ref:ie,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ue(e.target.files),ie.current&&(ie.current.value="")}}),
23
23
  /* @__PURE__ */j("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */j(r,{sidebar:we,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */L("div",{className:"flex h-full min-w-0 flex-col",children:[
24
- /* @__PURE__ */L("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */L(C,"files"===q?{children:[
25
- /* @__PURE__ */j("button",{onClick:()=>I(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(B)),disabled:"/"===B,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
24
+ /* @__PURE__ */L("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */L(C,"files"===Y?{children:[
25
+ /* @__PURE__ */j("button",{onClick:()=>P(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(B)),disabled:"/"===B,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
26
26
  /* @__PURE__ */j("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */j(t,{items:be,maxItems:5})}),
27
27
  /* @__PURE__ */j("button",{onClick:()=>me(B),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),!R&&/* @__PURE__ */L(C,{children:[
28
- /* @__PURE__ */L("button",{onClick:()=>G("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
28
+ /* @__PURE__ */L("button",{onClick:()=>Z("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
29
29
  /* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})}),"Trash"]}),
30
30
  /* @__PURE__ */L("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void u.error("Folder names cannot contain slashes");const t=T(B,e),r=await de(`${A}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void u.error(e.error||`Create folder failed (${r.status})`)}me(B)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
31
31
  /* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 10.5v6m3-3H9m4.06-7.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}),"New Folder"]}),
32
32
  /* @__PURE__ */L("button",{onClick:()=>ie.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
33
- /* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 7.5L12 3m0 0l4.5 4.5M12 3v13.5"})}),"Upload"]})]})]}:"trash"===q?{children:[
34
- /* @__PURE__ */j("button",{onClick:()=>G("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
33
+ /* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 7.5L12 3m0 0l4.5 4.5M12 3v13.5"})}),"Upload"]})]})]}:"trash"===Y?{children:[
34
+ /* @__PURE__ */j("button",{onClick:()=>Z("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
35
35
  /* @__PURE__ */j("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
36
36
  /* @__PURE__ */j("button",{onClick:he,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
37
- /* @__PURE__ */j("button",{onClick:async()=>{if(0===Z.length)return;if(!await g({title:"Empty trash",message:`${Z.length} item${1===Z.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await de(`${A}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Empty trash failed (${e.status})`)}he()},disabled:0===Z.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
38
- /* @__PURE__ */j("button",{onClick:()=>G("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
37
+ /* @__PURE__ */j("button",{onClick:async()=>{if(0===q.length)return;if(!await g({title:"Empty trash",message:`${q.length} item${1===q.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await de(`${A}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void u.error(t.error||`Empty trash failed (${e.status})`)}he()},disabled:0===q.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
38
+ /* @__PURE__ */j("button",{onClick:()=>Z("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */j("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
39
39
  /* @__PURE__ */j(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
40
40
  /* @__PURE__ */j("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:re?.name??"Desktop folder"}),
41
41
  /* @__PURE__ */j("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),K&&/* @__PURE__ */L(C,{children:[
@@ -43,13 +43,13 @@ return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
43
43
  /* @__PURE__ */L("div",{className:"flex items-center gap-1.5",title:`${D(K.used)} of ${D(K.limit)} used`,children:[
44
44
  /* @__PURE__ */j("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */j("div",{className:`h-full ${ye} transition-all`,style:{width:`${ge}%`}})}),
45
45
  /* @__PURE__ */L("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[D(K.used)," / ",D(K.limit)]})]})]})]}),
46
- /* @__PURE__ */j("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ae.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
46
+ /* @__PURE__ */j("div",{className:"flex-1 overflow-auto",children:"object"==typeof Y?0===ae.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
47
47
  /* @__PURE__ */j("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */L("tr",{children:[
48
48
  /* @__PURE__ */j("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
49
49
  /* @__PURE__ */j("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
50
50
  /* @__PURE__ */j("th",{className:"w-56"})]})}),
51
51
  /* @__PURE__ */j("tbody",{children:ae.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
52
- return L("tr",{onClick:()=>W(t),onDoubleClick:()=>le(e),className:"cursor-default border-b border-gray-100 "+(U===t?"bg-blue-50":"hover:bg-gray-50"),children:[
52
+ return L("tr",{onClick:()=>U(t),onDoubleClick:()=>le(e),className:"cursor-default border-b border-gray-100 "+(O===t?"bg-blue-50":"hover:bg-gray-50"),children:[
53
53
  /* @__PURE__ */L("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
54
54
  /* @__PURE__ */j(h,{item:e}),
55
55
  /* @__PURE__ */j("span",{className:"truncate",title:e.label,children:e.label})]}),
@@ -57,14 +57,14 @@ return L("tr",{onClick:()=>W(t),onDoubleClick:()=>le(e),className:"cursor-defaul
57
57
  /* @__PURE__ */L("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
58
58
  /* @__PURE__ */j("button",{onClick:t=>{t.stopPropagation(),le(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
59
59
  /* @__PURE__ */j("button",{onClick:t=>{t.stopPropagation(),ee?.moveToDesktop([e])},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Move to desktop"}),
60
- /* @__PURE__ */j("button",{onClick:t=>{t.stopPropagation(),ee?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?O&&0===Z.length?/* @__PURE__ */j("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===Z.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
60
+ /* @__PURE__ */j("button",{onClick:t=>{t.stopPropagation(),ee?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===Y?W&&0===q.length?/* @__PURE__ */j("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===q.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
61
61
  /* @__PURE__ */j("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */L("tr",{children:[
62
62
  /* @__PURE__ */j("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
63
63
  /* @__PURE__ */j("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
64
64
  /* @__PURE__ */j("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
65
65
  /* @__PURE__ */j("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Deleted"}),
66
66
  /* @__PURE__ */j("th",{className:"w-44"})]})}),
67
- /* @__PURE__ */j("tbody",{children:Z.map(e=>/* @__PURE__ */L("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
67
+ /* @__PURE__ */j("tbody",{children:q.map(e=>/* @__PURE__ */L("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
68
68
  /* @__PURE__ */L("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */j("svg",{className:"h-4 w-4 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */j("path",{d:"M2.25 7.125A2.25 2.25 0 014.5 4.875h4.504c.61 0 1.193.243 1.624.673l1.494 1.494a.75.75 0 00.53.22h7.098A2.25 2.25 0 0122 9.51v8.366A2.25 2.25 0 0119.75 20.125H4.25A2.25 2.25 0 012 17.875V7.125z"})}):/* @__PURE__ */j("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),
69
69
  /* @__PURE__ */j("span",{className:"truncate",title:e.name,children:e.name})]}),
70
70
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
@@ -72,18 +72,18 @@ return L("tr",{onClick:()=>W(t),onDoubleClick:()=>le(e),className:"cursor-defaul
72
72
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?E(e.deletedAt):"—"}),
73
73
  /* @__PURE__ */L("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
74
74
  /* @__PURE__ */j("button",{onClick:()=>(async e=>{const t=await de(`${A}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Restore failed (${t.status})`)}u.success(`Restored "${e.name}"`),he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
75
- /* @__PURE__ */j("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await de(`${A}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${t.status})`)}he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):O&&0===P.length?/* @__PURE__ */j("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===P.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!R&&/* @__PURE__ */L(C,{children:[" Drop files here or click ",
75
+ /* @__PURE__ */j("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await de(`${A}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${t.status})`)}he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):W&&0===I.length?/* @__PURE__ */j("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===I.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!R&&/* @__PURE__ */L(C,{children:[" Drop files here or click ",
76
76
  /* @__PURE__ */j("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
77
77
  /* @__PURE__ */j("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */L("tr",{children:[
78
78
  /* @__PURE__ */j("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
79
79
  /* @__PURE__ */j("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
80
80
  /* @__PURE__ */j("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
81
81
  /* @__PURE__ */j("th",{className:"w-32"})]})}),
82
- /* @__PURE__ */j("tbody",{children:P.map(t=>/* @__PURE__ */L("tr",{onClick:()=>W(t.name),onDoubleClick:()=>{"folder"===t.kind?I(T(B,t.name)):(async t=>{if(R)return;const r=T(B,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=M[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>oe(e)}):pe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(U===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
82
+ /* @__PURE__ */j("tbody",{children:I.map(t=>/* @__PURE__ */L("tr",{onClick:()=>U(t.name),onDoubleClick:()=>{"folder"===t.kind?P(T(B,t.name)):(async t=>{if(R)return;const r=T(B,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=M[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>oe(e)}):pe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(O===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
83
83
  /* @__PURE__ */L("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */j("svg",{className:"h-4 w-4 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */j("path",{d:"M2.25 7.125A2.25 2.25 0 014.5 4.875h4.504c.61 0 1.193.243 1.624.673l1.494 1.494a.75.75 0 00.53.22h7.098A2.25 2.25 0 0122 9.51v8.366A2.25 2.25 0 0119.75 20.125H4.25A2.25 2.25 0 012 17.875V7.125z"})}):/* @__PURE__ */j("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),
84
84
  /* @__PURE__ */j("span",{className:"truncate",title:t.name,children:t.name})]}),
85
85
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":D(t.size)}),
86
86
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:E(t.modifiedAt)}),
87
87
  /* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!R&&/* @__PURE__ */L(C,{children:["file"===t.kind&&/* @__PURE__ */j("button",{onClick:e=>{e.stopPropagation(),pe(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
88
88
  /* @__PURE__ */j("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void u.error("Names cannot contain slashes");const r=T(B,e.name),a=T(B,t),n=await de(`${A}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void u.error(e.error||`Rename failed (${n.status})`)}me(B)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
89
- /* @__PURE__ */j("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=T(B,e.name),r=await de(`${A}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${r.status})`)}me(B)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),X&&/* @__PURE__ */j("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */j("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{A as default};
89
+ /* @__PURE__ */j("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=T(B,e.name),r=await de(`${A}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void u.error(e.error||`Delete failed (${r.status})`)}me(B)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),Q&&/* @__PURE__ */j("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */j("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{A as default};
@@ -1,25 +1,25 @@
1
- import{SidebarLayout as e}from"./chunk-SLCR26NK.js";import{AboutApp as t}from"./chunk-JIUJNTJA.js";import{toast_default as r}from"./chunk-KKOHUQPF.js";import"./chunk-VUXPSUWI.js";import{useWindowManager as n,client_default as o}from"./chunk-ET5HXDOR.js";import{useShellPrefs as i}from"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import"./chunk-ZBIWNVJS.js";import"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useRef as l,useEffect as a,useState as s,useCallback as c}from"react";import{useQuery as d}from"@tanstack/react-query";import{jsxs as p,Fragment as u,jsx as h}from"react/jsx-runtime";var m=[{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 g={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/"}},x=/\[([ xX]?)\]/g;function y(){const{openEntity:y}=n(),{prefs:b,save:f}=i(),{data:k}=d({queryKey:["numbering-configs"],queryFn:()=>o.get("/auth/numbering-configs/").then(e=>e.data?.results??e.data??[]),retry:!1}),v=l({});a(()=>{if(!k)return;const e={};for(const t of k){const r=g[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})}}v.current=e},[k]);const N=b.notepad_notes||[],[w,_]=s(null),[T,j]=s(""),[C,$]=s(""),[L,S]=s("yellow"),[I,W]=s(!1),[M,B]=s(!1),O=l(null),P=l(),U=N.find(e=>e.id===w);a(()=>{if(!w&&N.length>0){const e=N[0];_(e.id),j(e.title),$(e.content),S(e.color)}},[N.length]);const X=c(e=>{f({notepad_notes:e})},[f]),D=c(()=>{if(!w||!I)return;const e=N.map(e=>e.id===w?{...e,title:T,content:C,color:L,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);X(e),W(!1)},[w,I,T,C,L,N,X]);a(()=>{if(I)return P.current&&clearTimeout(P.current),P.current=setTimeout(D,800),()=>{P.current&&clearTimeout(P.current)}},[I,D]),a(()=>()=>{I&&D()},[]);const H=e=>{I&&D(),_(e.id),j(e.title),$(e.content),S(e.color),W(!1),B(!1)},J=e=>{const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);if(n<24)return`${n}h ago`;return`${Math.floor(n/24)}d ago`},V=e=>{const t=C.slice(0,e),r=C.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=C.slice(e+r[0].length);$(t+n+o),W(!0)},q=async(e,t)=>{const n=v.current[e];if(!n)return;const i=`${e}#${t}`;try{const{data:e}=await o.get(n.endpoint,{params:{search:i,page_size:1}}),t=(e?.results??e??[])[0];t?y(n.entityType,t.id,t,i):r.error(`${i} not found`)}catch{r.error(`Failed to look up ${i}`)}},E="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.)",K=/* @__PURE__ */p(u,{children:[
2
- /* @__PURE__ */h("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */p("button",{onClick:()=>{I&&D();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...N];X(t),_(e.id),j(""),$(""),S("yellow"),W(!1),B(!0),setTimeout(()=>O.current?.focus(),50)},className:"w-full flex items-center justify-center gap-1.5 rounded-lg bg-blue-600 text-white px-3 py-1.5 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
1
+ import{SidebarLayout as e}from"./chunk-SLCR26NK.js";import{AboutApp as t}from"./chunk-ZSDLYYQA.js";import{toast_default as r}from"./chunk-KKOHUQPF.js";import"./chunk-2Q3T5CT3.js";import{useWindowManager as n,client_default as o}from"./chunk-ET5HXDOR.js";import{useShellPrefs as i}from"./chunk-V453E4KU.js";import"./chunk-UB4JIOLD.js";import"./chunk-PH3PRIFP.js";import"./chunk-ZBIWNVJS.js";import"./chunk-QOXIUJTN.js";import"./chunk-57MIENLJ.js";import"./chunk-MAIHBBWT.js";import"./chunk-TR6PLN7W.js";import"./chunk-D65T4H6J.js";import{useRef as l,useEffect as a,useState as s,useCallback as c}from"react";import{useQuery as d}from"@tanstack/react-query";import{jsxs as p,Fragment as u,jsx as h}from"react/jsx-runtime";var m=[{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 g={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/"}},x=/\[([ xX]?)\]/g;function y(){const{openEntity:y}=n(),{prefs:b,save:f}=i(),{data:k}=d({queryKey:["numbering-configs"],queryFn:()=>o.get("/auth/numbering-configs/").then(e=>e.data?.results??e.data??[]),retry:!1}),v=l({});a(()=>{if(!k)return;const e={};for(const t of k){const r=g[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})}}v.current=e},[k]);const N=b.notepad_notes||[],[w,_]=s(null),[T,j]=s(""),[C,$]=s(""),[L,S]=s("yellow"),[M,W]=s(!1),[B,I]=s(!1),D=l(null),O=l(),P=N.find(e=>e.id===w);a(()=>{if(!w&&N.length>0){const e=N[0];_(e.id),j(e.title),$(e.content),S(e.color)}},[N.length]);const X=c(e=>{f({notepad_notes:e})},[f]),H=c(()=>{if(!w||!M)return;const e=N.map(e=>e.id===w?{...e,title:T,content:C,color:L,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);X(e),W(!1)},[w,M,T,C,L,N,X]);a(()=>{if(M)return O.current&&clearTimeout(O.current),O.current=setTimeout(H,800),()=>{O.current&&clearTimeout(O.current)}},[M,H]),a(()=>()=>{M&&H()},[]);const U=e=>{M&&H(),_(e.id),j(e.title),$(e.content),S(e.color),W(!1),I(!1)},q=e=>{const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);if(n<24)return`${n}h ago`;return`${Math.floor(n/24)}d ago`},E=e=>{const t=C.slice(0,e),r=C.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=C.slice(e+r[0].length);$(t+n+o),W(!0)},K=async(e,t)=>{const n=v.current[e];if(!n)return;const i=`${e}#${t}`;try{const{data:e}=await o.get(n.endpoint,{params:{search:i,page_size:1}}),t=(e?.results??e??[])[0];t?y(n.entityType,t.id,t,i):r.error(`${i} not found`)}catch{r.error(`Failed to look up ${i}`)}},R="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.)",V=/* @__PURE__ */p(u,{children:[
2
+ /* @__PURE__ */h("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */p("button",{onClick:()=>{M&&H();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...N];X(t),_(e.id),j(""),$(""),S("yellow"),W(!1),I(!0),setTimeout(()=>D.current?.focus(),50)},className:"w-full flex items-center justify-center gap-1.5 rounded-lg bg-blue-600 text-white px-3 py-1.5 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
3
3
  /* @__PURE__ */h("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Note"]})}),
4
4
  /* @__PURE__ */h("div",{className:"flex-1 overflow-y-auto",children:0===N.length?/* @__PURE__ */h("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):N.map(e=>{const t=(r=e.color,m.find(e=>e.key===r)||m[0]);var r;/* @__PURE__ */
5
- return p("button",{onClick:()=>H(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(w===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
5
+ return p("button",{onClick:()=>U(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(w===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
6
6
  /* @__PURE__ */p("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */h("div",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${t.dot}`}),
8
8
  /* @__PURE__ */h("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */h("svg",{className:"h-3 w-3 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */h("path",{d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})]}),
9
9
  /* @__PURE__ */h("p",{className:"text-xs text-gray-400 mt-0.5 truncate ml-4.5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
- /* @__PURE__ */h("p",{className:"text-[10px] text-gray-300 mt-0.5 ml-4.5",children:J(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
10
+ /* @__PURE__ */h("p",{className:"text-[10px] text-gray-300 mt-0.5 ml-4.5",children:q(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
11
  return p("div",{className:"h-full",children:[
12
12
  /* @__PURE__ */h(t,{app:"notepad"}),
13
- /* @__PURE__ */h(e,{sidebar:K,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:w?/* @__PURE__ */p("div",{className:"flex-1 flex flex-col min-w-0",children:[
13
+ /* @__PURE__ */h(e,{sidebar:V,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:w?/* @__PURE__ */p("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
14
  /* @__PURE__ */p("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
15
  /* @__PURE__ */h("input",{value:T,onChange:e=>{j(e.target.value),W(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
16
  /* @__PURE__ */h("div",{className:"flex gap-1",children:m.map(e=>/* @__PURE__ */h("button",{onClick:()=>{S(e.key),W(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${L===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */h("button",{onClick:()=>(e=>{const t=N.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);X(t);const n=t.find(t=>t.id===e);r.success(n?.sticky?"Pinned to desktop":"Removed from desktop")})(w),title:U?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(U?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */h("svg",{className:"h-4 w-4",fill:U?.sticky?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})}),
18
- /* @__PURE__ */h("button",{onClick:()=>(e=>{const t=N.filter(t=>t.id!==e);if(X(t),w===e){const e=t[0];e?H(e):(_(null),j(""),$(""))}})(w),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */h("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})})})]}),M?/* @__PURE__ */h("textarea",{ref:O,value:C,onChange:e=>{$(e.target.value),W(!0)},onBlur:()=>{B(!1),I&&D()},placeholder:E,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__ */h("div",{onClick:()=>{B(!0),setTimeout(()=>O.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:C?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],l=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=l.exec(e));){const e=a[1],t=a[2];if(v.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */h("button",{onClick:()=>q(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}x.lastIndex=0;let s=0;for(let e=0;e<r;e++)s+=t[e].length+1;for(;null!==(a=x.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=s+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */h("button",{onClick:()=>V(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__ */h("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */h("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__ */h("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */h("span",{children:"​"},`empty-${r}`));const c=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
- return h("div",{className:c?"line-through text-gray-400":"",children:n},r)})})(C):/* @__PURE__ */h("p",{className:"text-gray-300 whitespace-pre-line",children:E})}),
17
+ /* @__PURE__ */h("button",{onClick:()=>(e=>{const t=N.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);X(t);const n=t.find(t=>t.id===e);r.success(n?.sticky?"Pinned to desktop":"Removed from desktop")})(w),title:P?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(P?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */h("svg",{className:"h-4 w-4",fill:P?.sticky?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})}),
18
+ /* @__PURE__ */h("button",{onClick:()=>(e=>{const t=N.filter(t=>t.id!==e);if(X(t),w===e){const e=t[0];e?U(e):(_(null),j(""),$(""))}})(w),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */h("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})})})]}),B?/* @__PURE__ */h("textarea",{ref:D,value:C,onChange:e=>{$(e.target.value),W(!0)},onBlur:()=>{I(!1),M&&H()},placeholder:R,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__ */h("div",{onClick:()=>{I(!0),setTimeout(()=>D.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:C?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],l=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=l.exec(e));){const e=a[1],t=a[2];if(v.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */h("button",{onClick:()=>K(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}x.lastIndex=0;let s=0;for(let e=0;e<r;e++)s+=t[e].length+1;for(;null!==(a=x.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=s+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */h("button",{onClick:()=>E(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__ */h("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */h("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__ */h("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */h("span",{children:"​"},`empty-${r}`));const c=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
+ return h("div",{className:c?"line-through text-gray-400":"",children:n},r)})})(C):/* @__PURE__ */h("p",{className:"text-gray-300 whitespace-pre-line",children:R})}),
20
20
  /* @__PURE__ */p("div",{className:"px-4 py-1.5 border-t border-gray-100 flex items-center gap-4 text-[10px] text-gray-400",children:[
21
21
  /* @__PURE__ */h("span",{children:"[] checkbox"}),
22
22
  /* @__PURE__ */h("span",{children:"SO#35001 entity link"}),
23
- /* @__PURE__ */h("span",{className:"ml-auto",children:M?"Editing":"Click to edit"})]})]}):/* @__PURE__ */h("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */p("div",{className:"text-center text-gray-400",children:[
23
+ /* @__PURE__ */h("span",{className:"ml-auto",children:B?"Editing":"Click to edit"})]})]}):/* @__PURE__ */h("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */p("div",{className:"text-center text-gray-400",children:[
24
24
  /* @__PURE__ */h("svg",{className:"h-12 w-12 mx-auto mb-3 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:/* @__PURE__ */h("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),
25
25
  /* @__PURE__ */h("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{y as default};