efficient-shell 7.13.2 → 7.14.2

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
@@ -1080,6 +1080,17 @@ Round 4:
1080
1080
  cell keeps the number at least 40px, where the side-by-side pair left it
1081
1081
  under 16px. They press, hold and Shift like the pair. `stepFrom` is where a
1082
1082
  step from an empty field starts (default: a numeric placeholder, else 0).
1083
+ - **`InputNumber`**: `appearance="bare"` is the field read as a label until
1084
+ it is focused: no box, no steppers, no prefix or suffix drawn, centred, the
1085
+ caller's ink and size (`className`). `display(value)` is what any field
1086
+ reads while not focused ("34%"). Focused, a bare field shows a focus ring
1087
+ and the number, selected, and stays selected after Enter, a step or Escape.
1088
+ A string `suffix` is a unit a typed value may end with ("50%" is 50), and
1089
+ in the bare look it is part of `aria-valuetext`. `reportWhileTyping={false}`
1090
+ reports only on Enter, blur, a step or Escape. `onRevert(was)` takes the
1091
+ value Escape restores instead of `onChange`. `onFocus`, `aria-describedby`
1092
+ and `data-*` reach the field. `WidthsBar` types its widths with it, so the
1093
+ kit has one number input.
1083
1094
  - **`Slider`**: `shiftStep`, `placeholderValue` and `stepFrom` (see `Slider`
1084
1095
  above).
1085
1096
  - **`Select`**: `readOnly` is `Input`'s read-only ground, not the disabled
@@ -1,29 +1,29 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-YNKJZKFF.js";import{WindowTitle as r}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import{confirm as a}from"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-PM4GMFN3.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as n}from"./chunk-ZGUQLVY4.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&b.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 x(){if("undefined"==typeof window)return g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[C,j]=i(k),[z,R]=i([k]),[S,W]=i(0),[L,E]=i(0),[T,U]=i(x),[D,A]=i(!1),[X,F]=i(null),H=s(null),I=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(T))}catch{}},[T]);const K=e=>{const t=f(e);t&&(y(t),j(t),R(e=>{const o=e.slice(0,S+1);return o.push(t),o}),W(e=>e+1),A(!1))},O=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},P=()=>{const e=X?.trim();e?(U(t=>[...t,{label:e,url:k}]),F(null)):F(null)};l(()=>{if(null===X)return;H.current?.focus(),H.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||F(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==X]);const Q=e=>{U(t=>t.filter((t,o)=>o!==e))},G=S>0,M=S<z.length-1,B=T.some(e=>e.url===k),J="p-2 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-M6FR6OFL.js";import{WindowTitle as r}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import{confirm as a}from"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SZ3VBHNO.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as n}from"./chunk-ZGUQLVY4.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&b.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 x(){if("undefined"==typeof window)return g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[C,j]=i(k),[z,R]=i([k]),[S,W]=i(0),[L,E]=i(0),[T,U]=i(x),[D,A]=i(!1),[H,O]=i(null),X=s(null),F=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(T))}catch{}},[T]);const I=e=>{const t=f(e);t&&(y(t),j(t),R(e=>{const o=e.slice(0,S+1);return o.push(t),o}),W(e=>e+1),A(!1))},Q=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},B=()=>{const e=H?.trim();e?(U(t=>[...t,{label:e,url:k}]),O(null)):O(null)};l(()=>{if(null===H)return;X.current?.focus(),X.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||O(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==H]);const P=e=>{U(t=>t.filter((t,o)=>o!==e))},G=S>0,K=S<z.length-1,M=T.some(e=>e.url===k),q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
2
  return c("div",{className:"relative flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */m(r,{title:`Browser - ${v(k)}`}),
4
4
  /* @__PURE__ */m(o,{app:"browser"}),
5
5
  /* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
6
- /* @__PURE__ */m("button",{onClick:()=>{if(S>0){const e=S-1;W(e),y(z[e]),j(z[e]),A(!1)}},disabled:!G,className:J,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
- /* @__PURE__ */m("button",{onClick:()=>{if(S<z.length-1){const e=S+1;W(e),y(z[e]),j(z[e]),A(!1)}},disabled:!M,className:J,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
- /* @__PURE__ */m("button",{onClick:()=>E(e=>e+1),className:J,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
- /* @__PURE__ */m("button",{onClick:()=>K(g),className:J,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
- /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),K(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("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__ */m("button",{onClick:()=>{if(S>0){const e=S-1;W(e),y(z[e]),j(z[e]),A(!1)}},disabled:!G,className:q,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */m("button",{onClick:()=>{if(S<z.length-1){const e=S+1;W(e),y(z[e]),j(z[e]),A(!1)}},disabled:!K,className:q,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */m("button",{onClick:()=>E(e=>e+1),className:q,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */m("button",{onClick:()=>I(g),className:q,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
+ /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),I(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("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__ */m("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
12
12
  /* @__PURE__ */m("input",{type:"text",value:C,onChange:e=>j(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!==C&&/* @__PURE__ */m("button",{type:"button",onClick:()=>j(k),className:"px-2 text-2xs text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
13
- /* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>B?Q(T.findIndex(e=>e.url===k)):void F(v(k)),className:J+" "+(B?"text-yellow-500":""),title:B?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:B?"currentColor":"none",strokeWidth:1.5})}),
14
- /* @__PURE__ */m("button",{onClick:O,className:J,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
- /* @__PURE__ */m("button",{onClick:()=>A(e=>!e),className:J,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==X&&/* @__PURE__ */c("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__ */m("button",{"data-bookmark-popover":!0,onClick:()=>M?P(T.findIndex(e=>e.url===k)):void O(v(k)),className:q+" "+(M?"text-yellow-500":""),title:M?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:M?"currentColor":"none",strokeWidth:1.5})}),
14
+ /* @__PURE__ */m("button",{onClick:Q,className:q,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
+ /* @__PURE__ */m("button",{onClick:()=>A(e=>!e),className:q,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==H&&/* @__PURE__ */c("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__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
17
17
  /* @__PURE__ */m("div",{className:"text-2xs text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
18
- /* @__PURE__ */m("input",{ref:H,type:"text",value:X,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key?P():"Escape"===e.key&&F(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
18
+ /* @__PURE__ */m("input",{ref:X,type:"text",value:H,onChange:e=>O(e.target.value),onKeyDown:e=>{"Enter"===e.key?B():"Escape"===e.key&&O(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
19
  /* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
20
- /* @__PURE__ */m("button",{onClick:()=>F(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
- /* @__PURE__ */m("button",{onClick:P,disabled:!X.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__ */c("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===T.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),T.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>K(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&Q(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
20
+ /* @__PURE__ */m("button",{onClick:()=>O(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */m("button",{onClick:B,disabled:!H.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__ */c("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===T.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),T.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>I(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&P(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
23
23
  /* @__PURE__ */m("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__ */m("div",{className:"flex-1"}),
25
25
  /* @__PURE__ */m("button",{onClick:()=>{b(k);try{localStorage.setItem(h,k)}catch{}},className:"px-2 py-0.5 text-2xs text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
26
- /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:L,iframeRef:I,openExternal:O,showHelp:D,dismissHelp:()=>A(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!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)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
26
+ /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:L,iframeRef:F,openExternal:Q,showHelp:D,dismissHelp:()=>A(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!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)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
27
27
  /* @__PURE__ */m(n,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
28
28
  /* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
29
  /* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
@@ -1,6 +1,6 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-YNKJZKFF.js";import{WindowTitle as n}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as r}from"./chunk-RUHUTZN4.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import"./chunk-QBXX5A7U.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-PM4GMFN3.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as s}from"./chunk-ZGUQLVY4.js";import{useState as c,useRef as d}from"react";import{jsxs as m,jsx as h}from"react/jsx-runtime";var u=/* @__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"]),p=/* @__PURE__ */new Set(["docx"]),g={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function x(){const[x,f]=c(g),[y,v]=c(!1),[b,k]=c(!1),[w,N]=c(!1),[C,j]=c(null),D=d(null),L=d(null),M=d(null),U=(e,t)=>{M.current?.focus(),document.execCommand(e,!1,t),N(!0)},R=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{M.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),N(!0)},e.readAsDataURL(t)}},T=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",N(!0),j(null))},A=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!0);try{if(u.has(n)||!p.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");f({filename:t.name,kind:"text",content:o,ext:n}),N(!1)}else if(p.has(n))try{const e=await(import(
1
+ import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-M6FR6OFL.js";import{WindowTitle as n}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as r}from"./chunk-RUHUTZN4.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import"./chunk-QBXX5A7U.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SZ3VBHNO.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as s}from"./chunk-ZGUQLVY4.js";import{useState as c,useRef as d}from"react";import{jsxs as m,jsx as h}from"react/jsx-runtime";var u=/* @__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"]),p=/* @__PURE__ */new Set(["docx"]),g={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function x(){const[x,f]=c(g),[y,v]=c(!1),[b,k]=c(!1),[w,N]=c(!1),[C,j]=c(null),D=d(null),L=d(null),M=d(null),U=(e,t)=>{M.current?.focus(),document.execCommand(e,!1,t),N(!0)},R=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{M.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),N(!0)},e.readAsDataURL(t)}},T=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",N(!0),j(null))},A=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!0);try{if(u.has(n)||!p.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");f({filename:t.name,kind:"text",content:o,ext:n}),N(!1)}else if(p.has(n))try{const e=await(import(
2
2
  /* @vite-ignore */
3
- "mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});f({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},B=x?.filename?(X=x.filename).length>24?`${X.slice(0,23)}…`:X:"Untitled";var X;/* @__PURE__ */
3
+ "mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});f({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},B=x?.filename?(O=x.filename).length>24?`${O.slice(0,23)}…`:O:"Untitled";var O;/* @__PURE__ */
4
4
  return m("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||k(!0)},onDragLeave:e=>{e.currentTarget===e.target&&k(!1)},onDrop:e=>{e.preventDefault(),k(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?R(t):A(t[0]))},children:[
5
5
  /* @__PURE__ */h(n,{title:`${B}${w?" •":""} - Documents`}),
6
6
  /* @__PURE__ */h(t,{app:"documents"}),
@@ -1,47 +1,47 @@
1
- import{openPreviewFile as e}from"./chunk-B4PGVDB6.js";import{Breadcrumbs as t}from"./chunk-Z2TTHY7G.js";import{SidebarLayout as a}from"./chunk-OV7F663H.js";import{getFilesDemoTree as r}from"./chunk-7HLTPMQV.js";import{AboutApp as n}from"./chunk-YNKJZKFF.js";import{peekFilesViewRequest as s,consumeFilesViewRequest as i,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-XN7CAWSZ.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as u,WindowTitle as f}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as x}from"./chunk-RUHUTZN4.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import{confirm as g,prompt as y}from"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-PM4GMFN3.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{formatBytes as b}from"./chunk-W32SKK3D.js";import{Icon as N}from"./chunk-ZGUQLVY4.js";import{useState as k,useEffect as w,useSyncExternalStore as v,useRef as j,useCallback as C}from"react";import{jsxs as $,jsx as T,Fragment as D}from"react/jsx-runtime";var L="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",E={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 R(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function S(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 F(){const F=L.replace(/\/$/,""),P=null!==r(),[A,U]=k("/"),[I,W]=k([]),[M,O]=k([]),[V,B]=k(null),[H,K]=k(!0),[X,Q]=k(!1),[z,J]=k(null),[_,G]=k(!1),[Y,Z]=k(()=>{const e=s();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});w(()=>{i()},[]);const[q,ee]=k([]);w(()=>{const e=()=>{i(),Z("trash")},t=e=>{i();const t=e.detail?.folderId;t&&Z({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const te=v(d,c,c),ae="object"==typeof Y?Y.desktopFolderId:null,re=ae?te?.folders.find(e=>e.id===ae)??null:null,ne=ae&&te?.itemsByFolder[ae]||[];w(()=>{ae&&te&&!te.folders.some(e=>e.id===ae)&&Z("files")},[ae,te]);const se=j(0),ie=j(null),{openPage:le,openEntity:oe}=u(),de=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>le(e)}):"page"===t.entityType?le(t.entityId):oe(t.entityType,t.entityId,null,t.label)},ce=C((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),me=C(async()=>{try{const e=await ce(`${F}/api/quota`);if(e.ok){const t=await e.json();J({used:t.used,limit:t.limit})}}catch{}},[ce,F]),he=C(async e=>{if(B(null),P){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return W(t),U(e),Q(!1),K(!1),void("/"===e&&O(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}K(!0);try{const t=await ce(`${F}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];W(r),U(a.path||e),Q(!1),"/"===(a.path||e)&&O(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Q(!0)}finally{K(!1)}me()},[ce,F,me,P]),pe=C(async()=>{if(P)return ee([]),void K(!1);K(!0),B(null);try{const e=await ce(`${F}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ee(t.entries||[]),Q(!1)}catch{Q(!0)}finally{K(!1)}me()},[ce,F,me,P]);w(()=>{"files"===Y?he(A):"trash"===Y&&pe()},[A,Y]);const ue=async e=>{const t=R(A,e.name);try{const a=await ce(`${F}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void x.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},fe=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ce(`${F}/api/upload?path=${encodeURIComponent(A)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${b(a)} free, ${e.name} is ${b(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}he(A)},xe=()=>{se.current=0,G(!1)};if(w(()=>{const e=()=>xe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),X)/* @__PURE__ */
1
+ import{openPreviewFile as e}from"./chunk-B4PGVDB6.js";import{Breadcrumbs as t}from"./chunk-Z2TTHY7G.js";import{SidebarLayout as a}from"./chunk-OV7F663H.js";import{getFilesDemoTree as r}from"./chunk-7HLTPMQV.js";import{AboutApp as n}from"./chunk-M6FR6OFL.js";import{peekFilesViewRequest as s,consumeFilesViewRequest as i,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-XN7CAWSZ.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as u,WindowTitle as f}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as x}from"./chunk-RUHUTZN4.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import{confirm as g,prompt as y}from"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SZ3VBHNO.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{formatBytes as b}from"./chunk-W32SKK3D.js";import{Icon as k}from"./chunk-ZGUQLVY4.js";import{useState as N,useEffect as w,useSyncExternalStore as v,useRef as j,useCallback as C}from"react";import{jsxs as $,jsx as T,Fragment as D}from"react/jsx-runtime";var L="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",E={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 R(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function S(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 F(){const F=L.replace(/\/$/,""),P=null!==r(),[A,U]=N("/"),[O,I]=N([]),[W,M]=N([]),[V,B]=N(null),[H,X]=N(!0),[Q,z]=N(!1),[K,_]=N(null),[J,G]=N(!1),[Z,Y]=N(()=>{const e=s();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});w(()=>{i()},[]);const[q,ee]=N([]);w(()=>{const e=()=>{i(),Y("trash")},t=e=>{i();const t=e.detail?.folderId;t&&Y({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const te=v(d,c,c),ae="object"==typeof Z?Z.desktopFolderId:null,re=ae?te?.folders.find(e=>e.id===ae)??null:null,ne=ae&&te?.itemsByFolder[ae]||[];w(()=>{ae&&te&&!te.folders.some(e=>e.id===ae)&&Y("files")},[ae,te]);const se=j(0),ie=j(null),{openPage:le,openEntity:oe}=u(),de=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>le(e)}):"page"===t.entityType?le(t.entityId):oe(t.entityType,t.entityId,null,t.label)},ce=C((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),me=C(async()=>{try{const e=await ce(`${F}/api/quota`);if(e.ok){const t=await e.json();_({used:t.used,limit:t.limit})}}catch{}},[ce,F]),he=C(async e=>{if(B(null),P){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return I(t),U(e),z(!1),X(!1),void("/"===e&&M(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}X(!0);try{const t=await ce(`${F}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];I(r),U(a.path||e),z(!1),"/"===(a.path||e)&&M(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){z(!0)}finally{X(!1)}me()},[ce,F,me,P]),pe=C(async()=>{if(P)return ee([]),void X(!1);X(!0),B(null);try{const e=await ce(`${F}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ee(t.entries||[]),z(!1)}catch{z(!0)}finally{X(!1)}me()},[ce,F,me,P]);w(()=>{"files"===Z?he(A):"trash"===Z&&pe()},[A,Z]);const ue=async e=>{const t=R(A,e.name);try{const a=await ce(`${F}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void x.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},fe=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ce(`${F}/api/upload?path=${encodeURIComponent(A)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${b(a)} free, ${e.name} is ${b(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}he(A)},xe=()=>{se.current=0,G(!1)};if(w(()=>{const e=()=>xe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),Q)/* @__PURE__ */
2
2
  return $("div",{className:"flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */T(f,{title:"Files - offline"}),
4
4
  /* @__PURE__ */T("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */$("div",{className:"max-w-md",children:[
5
- /* @__PURE__ */T(N,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
5
+ /* @__PURE__ */T(k,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
6
  /* @__PURE__ */T("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
7
  /* @__PURE__ */$("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
8
  /* @__PURE__ */T("span",{className:"font-mono",children:F}),". Make sure the server is running — see ",
9
9
  /* @__PURE__ */T("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
- /* @__PURE__ */T("button",{onClick:()=>he(A),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const ge="/"===A?[]:A.split("/").filter(Boolean),ye=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,be=ye>90?"bg-red-500":ye>75?"bg-amber-500":"bg-blue-500",Ne=[{label:"My files",onClick:()=>U("/")},...ge.map((e,t)=>({label:e,onClick:()=>U("/"+ge.slice(0,t+1).join("/"))}))],ke=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),we=e=>/* @__PURE__ */T("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__ */T("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),ve=/* @__PURE__ */$("nav",{className:"p-2",children:[
10
+ /* @__PURE__ */T("button",{onClick:()=>he(A),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const ge="/"===A?[]:A.split("/").filter(Boolean),ye=K&&K.limit>0?Math.min(100,Math.round(K.used/K.limit*100)):0,be=ye>90?"bg-red-500":ye>75?"bg-amber-500":"bg-blue-500",ke=[{label:"My files",onClick:()=>U("/")},...ge.map((e,t)=>({label:e,onClick:()=>U("/"+ge.slice(0,t+1).join("/"))}))],Ne=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),we=e=>/* @__PURE__ */T("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__ */T("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),ve=/* @__PURE__ */$("nav",{className:"p-2",children:[
11
11
  /* @__PURE__ */T("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
- /* @__PURE__ */$("button",{onClick:()=>{Z("files"),U("/")},className:ke("files"===Y&&"/"===A),children:[we("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"]}),M.map(e=>/* @__PURE__ */$("button",{onClick:()=>{Z("files"),U("/"+e)},className:ke("files"===Y&&A==="/"+e),children:[we("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"),
13
- /* @__PURE__ */T("span",{className:"truncate",children:e})]},e)),!P&&/* @__PURE__ */$("button",{onClick:()=>Z("trash"),className:ke("trash"===Y),children:[we("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"]}),te&&te.folders.length>0&&/* @__PURE__ */$(D,{children:[
14
- /* @__PURE__ */T("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),te.folders.map(e=>/* @__PURE__ */$("button",{onClick:()=>Z({desktopFolderId:e.id}),className:ke(ae===e.id),children:[
12
+ /* @__PURE__ */$("button",{onClick:()=>{Y("files"),U("/")},className:Ne("files"===Z&&"/"===A),children:[we("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"]}),W.map(e=>/* @__PURE__ */$("button",{onClick:()=>{Y("files"),U("/"+e)},className:Ne("files"===Z&&A==="/"+e),children:[we("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"),
13
+ /* @__PURE__ */T("span",{className:"truncate",children:e})]},e)),!P&&/* @__PURE__ */$("button",{onClick:()=>Y("trash"),className:Ne("trash"===Z),children:[we("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"]}),te&&te.folders.length>0&&/* @__PURE__ */$(D,{children:[
14
+ /* @__PURE__ */T("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),te.folders.map(e=>/* @__PURE__ */$("button",{onClick:()=>Y({desktopFolderId:e.id}),className:Ne(ae===e.id),children:[
15
15
  /* @__PURE__ */T(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
16
  /* @__PURE__ */T("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */T("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
- return $("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{P||"object"==typeof Y||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),se.current++,_||G(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{se.current>0&&se.current--,0===se.current&&G(!1)},onDrop:e=>{e.preventDefault(),xe(),P||"object"==typeof Y||e.dataTransfer.files?.length&&fe(e.dataTransfer.files)},children:[
17
+ return $("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{P||"object"==typeof Z||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),se.current++,J||G(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{se.current>0&&se.current--,0===se.current&&G(!1)},onDrop:e=>{e.preventDefault(),xe(),P||"object"==typeof Z||e.dataTransfer.files?.length&&fe(e.dataTransfer.files)},children:[
18
18
  /* @__PURE__ */T(f,{title:re?`Files - ${re.name}`:"Files"+("/"===A?"":" - "+A)}),
19
19
  /* @__PURE__ */T(n,{app:"files"}),
20
20
  /* @__PURE__ */T("input",{ref:ie,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&fe(e.target.files),ie.current&&(ie.current.value="")}}),
21
21
  /* @__PURE__ */T("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */T(a,{sidebar:ve,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */$("div",{className:"flex h-full min-w-0 flex-col",children:[
22
- /* @__PURE__ */$("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */$(D,"files"===Y?{children:[
23
- /* @__PURE__ */T("button",{onClick:()=>U(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(A)),disabled:"/"===A,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
24
- /* @__PURE__ */T("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */T(t,{items:Ne,maxItems:5})}),
25
- /* @__PURE__ */T("button",{onClick:()=>he(A),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!P&&/* @__PURE__ */$(D,{children:[
26
- /* @__PURE__ */$("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:[
27
- /* @__PURE__ */T(N,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
22
+ /* @__PURE__ */$("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */$(D,"files"===Z?{children:[
23
+ /* @__PURE__ */T("button",{onClick:()=>U(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(A)),disabled:"/"===A,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */T(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
24
+ /* @__PURE__ */T("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */T(t,{items:ke,maxItems:5})}),
25
+ /* @__PURE__ */T("button",{onClick:()=>he(A),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!P&&/* @__PURE__ */$(D,{children:[
26
+ /* @__PURE__ */$("button",{onClick:()=>Y("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
27
+ /* @__PURE__ */T(k,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
28
  /* @__PURE__ */$("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void x.error("Folder names cannot contain slashes");const t=R(A,e),a=await ce(`${F}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Create folder failed (${a.status})`)}he(A)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
- /* @__PURE__ */T(N,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
29
+ /* @__PURE__ */T(k,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
30
  /* @__PURE__ */$("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:[
31
- /* @__PURE__ */T(N,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===Y?{children:[
32
- /* @__PURE__ */T("button",{onClick:()=>Z("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
31
+ /* @__PURE__ */T(k,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===Z?{children:[
32
+ /* @__PURE__ */T("button",{onClick:()=>Y("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
33
33
  /* @__PURE__ */T("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
- /* @__PURE__ */T("button",{onClick:pe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
34
+ /* @__PURE__ */T("button",{onClick:pe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
35
  /* @__PURE__ */T("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 ce(`${F}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Empty trash failed (${e.status})`)}pe()},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:[
36
- /* @__PURE__ */T("button",{onClick:()=>Z("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
36
+ /* @__PURE__ */T("button",{onClick:()=>Y("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
37
37
  /* @__PURE__ */T(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
38
  /* @__PURE__ */T("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:re?.name??"Desktop folder"}),
39
- /* @__PURE__ */T("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),z&&/* @__PURE__ */$(D,{children:[
39
+ /* @__PURE__ */T("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),K&&/* @__PURE__ */$(D,{children:[
40
40
  /* @__PURE__ */T("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */$("div",{className:"flex items-center gap-2",title:`${b(z.used)} of ${b(z.limit)} used`,children:[
41
+ /* @__PURE__ */$("div",{className:"flex items-center gap-2",title:`${b(K.used)} of ${b(K.limit)} used`,children:[
42
42
  /* @__PURE__ */T("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */T("div",{className:`h-full ${be} transition-all`,style:{width:`${ye}%`}})}),
43
- /* @__PURE__ */$("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[b(z.used)," / ",b(z.limit)]})]})]})]}),
44
- /* @__PURE__ */T("div",{className:"flex-1 overflow-auto",children:"object"==typeof Y?0===ne.length?/* @__PURE__ */T("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__ */$("table",{className:"w-full text-sm",children:[
43
+ /* @__PURE__ */$("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[b(K.used)," / ",b(K.limit)]})]})]})]}),
44
+ /* @__PURE__ */T("div",{className:"flex-1 overflow-auto",children:"object"==typeof Z?0===ne.length?/* @__PURE__ */T("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__ */$("table",{className:"w-full text-sm",children:[
45
45
  /* @__PURE__ */T("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
46
46
  /* @__PURE__ */T("th",{className:"text-left font-medium px-3 h-8",children:"Name"}),
47
47
  /* @__PURE__ */T("th",{className:"text-left font-medium px-3 h-8 w-28",children:"Type"}),
@@ -55,7 +55,7 @@ return $("tr",{onClick:()=>B(t),onDoubleClick:()=>de(e),className:"cursor-defaul
55
55
  /* @__PURE__ */$("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
56
56
  /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),de(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
57
57
  /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),te?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Move to desktop"}),
58
- /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),te?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===Y?H&&0===q.length?/* @__PURE__ */T("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===q.length?/* @__PURE__ */T("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
58
+ /* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),te?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===Z?H&&0===q.length?/* @__PURE__ */T("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===q.length?/* @__PURE__ */T("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
59
59
  /* @__PURE__ */T("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
60
60
  /* @__PURE__ */T("th",{className:"text-left font-medium px-3 h-8",children:"Name"}),
61
61
  /* @__PURE__ */T("th",{className:"text-left font-medium px-3 h-8",children:"Original location"}),
@@ -63,25 +63,25 @@ return $("tr",{onClick:()=>B(t),onDoubleClick:()=>de(e),className:"cursor-defaul
63
63
  /* @__PURE__ */T("th",{className:"text-right font-medium px-3 h-8 w-40",children:"Deleted"}),
64
64
  /* @__PURE__ */T("th",{className:"w-44"})]})}),
65
65
  /* @__PURE__ */T("tbody",{children:q.map(e=>/* @__PURE__ */$("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
66
- /* @__PURE__ */$("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */T(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(N,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
66
+ /* @__PURE__ */$("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */T(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
67
67
  /* @__PURE__ */T("span",{className:"truncate",title:e.name,children:e.name})]}),
68
68
  /* @__PURE__ */T("td",{className:"px-3 h-8 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
69
69
  /* @__PURE__ */T("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:b(e.size)}),
70
70
  /* @__PURE__ */T("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?S(e.deletedAt):"—"}),
71
71
  /* @__PURE__ */$("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
72
72
  /* @__PURE__ */T("button",{onClick:()=>(async e=>{const t=await ce(`${F}/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 x.error(e.error||`Restore failed (${t.status})`)}x.success(`Restored "${e.name}"`),pe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
73
- /* @__PURE__ */T("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 ce(`${F}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}pe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):H&&0===I.length?/* @__PURE__ */T("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===I.length?/* @__PURE__ */$("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!P&&/* @__PURE__ */$(D,{children:[" Drop files here or click ",
73
+ /* @__PURE__ */T("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 ce(`${F}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}pe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):H&&0===O.length?/* @__PURE__ */T("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===O.length?/* @__PURE__ */$("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!P&&/* @__PURE__ */$(D,{children:[" Drop files here or click ",
74
74
  /* @__PURE__ */T("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
75
75
  /* @__PURE__ */T("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
76
76
  /* @__PURE__ */T("th",{className:"text-left font-medium px-3 h-8",children:"Name"}),
77
77
  /* @__PURE__ */T("th",{className:"text-right font-medium px-3 h-8 w-24",children:"Size"}),
78
78
  /* @__PURE__ */T("th",{className:"text-right font-medium px-3 h-8 w-40",children:"Modified"}),
79
79
  /* @__PURE__ */T("th",{className:"w-32"})]})}),
80
- /* @__PURE__ */T("tbody",{children:I.map(t=>/* @__PURE__ */$("tr",{onClick:()=>B(t.name),onDoubleClick:()=>{"folder"===t.kind?U(R(A,t.name)):(async t=>{if(P)return;const a=R(A,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=E[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>le(e)}):ue(t)})(t)},className:"cursor-default border-b border-gray-100 "+(V===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
- /* @__PURE__ */$("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */T(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(N,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
80
+ /* @__PURE__ */T("tbody",{children:O.map(t=>/* @__PURE__ */$("tr",{onClick:()=>B(t.name),onDoubleClick:()=>{"folder"===t.kind?U(R(A,t.name)):(async t=>{if(P)return;const a=R(A,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=E[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>le(e)}):ue(t)})(t)},className:"cursor-default border-b border-gray-100 "+(V===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
+ /* @__PURE__ */$("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */T(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
82
  /* @__PURE__ */T("span",{className:"truncate",title:t.name,children:t.name})]}),
83
83
  /* @__PURE__ */T("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":b(t.size)}),
84
84
  /* @__PURE__ */T("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:S(t.modifiedAt)}),
85
85
  /* @__PURE__ */T("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!P&&/* @__PURE__ */$(D,{children:["file"===t.kind&&/* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),ue(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
86
86
  /* @__PURE__ */T("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 x.error("Names cannot contain slashes");const a=R(A,e.name),r=R(A,t),n=await ce(`${F}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:r})});if(!n.ok){const e=await n.json().catch(()=>({}));return void x.error(e.error||`Rename failed (${n.status})`)}he(A)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
87
- /* @__PURE__ */T("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=R(A,e.name),a=await ce(`${F}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${a.status})`)}he(A)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */T("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__ */T("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{F as default};
87
+ /* @__PURE__ */T("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=R(A,e.name),a=await ce(`${F}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${a.status})`)}he(A)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),J&&/* @__PURE__ */T("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__ */T("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{F as default};
@@ -1,5 +1,5 @@
1
- import{getNumberingConfigs as e}from"./chunk-E3FQXACV.js";import{SidebarLayout as t}from"./chunk-OV7F663H.js";import{AboutApp as r}from"./chunk-YNKJZKFF.js";import{useWindowManager as n,client_default as o}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as i}from"./chunk-RUHUTZN4.js";import{useShellPrefs as s}from"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-PM4GMFN3.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{timeAgo as a}from"./chunk-W32SKK3D.js";import{Icon as l}from"./chunk-ZGUQLVY4.js";import{useRef as c,useEffect as d,useState as p,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{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 b={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/"}},f=/\[([ xX]?)\]/g;function k(){const{openEntity:k}=n(),{prefs:v,save:N}=s(),{data:w}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),_=c({});d(()=>{if(!w)return;const e={};for(const t of w){const r=b[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})}}_.current=e},[w]);const T=v.notepad_notes||[],[j,C]=p(null),[$,X]=p(""),[S,U]=p(""),[W,A]=p("yellow"),[D,F]=p(!1),[K,O]=p(!1),Q=c(null),R=c(),I=T.find(e=>e.id===j);d(()=>{if(!j&&T.length>0){const e=T[0];C(e.id),X(e.title),U(e.content),A(e.color)}},[T.length]);const P=m(e=>{N({notepad_notes:e})},[N]),E=m(()=>{if(!j||!D)return;const e=T.map(e=>e.id===j?{...e,title:$,content:S,color:W,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);P(e),F(!1)},[j,D,$,S,W,T,P]);d(()=>{if(D)return R.current&&clearTimeout(R.current),R.current=setTimeout(E,800),()=>{R.current&&clearTimeout(R.current)}},[D,E]),d(()=>()=>{D&&E()},[]);const q=e=>{D&&E(),C(e.id),X(e.title),U(e.content),A(e.color),F(!1),O(!1)},B=e=>{const t=S.slice(0,e),r=S.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=S.slice(e+r[0].length);U(t+n+o),F(!0)},G=async(e,t)=>{const r=_.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?k(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},H="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.)",J=/* @__PURE__ */h(y,{children:[
2
- /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{D&&E();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,...T];P(t),C(e.id),X(""),U(""),A("yellow"),F(!1),O(!0),setTimeout(()=>Q.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
1
+ import{getNumberingConfigs as e}from"./chunk-E3FQXACV.js";import{SidebarLayout as t}from"./chunk-OV7F663H.js";import{AboutApp as r}from"./chunk-M6FR6OFL.js";import{useWindowManager as n,client_default as o}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as i}from"./chunk-RUHUTZN4.js";import{useShellPrefs as s}from"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SZ3VBHNO.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{timeAgo as a}from"./chunk-W32SKK3D.js";import{Icon as l}from"./chunk-ZGUQLVY4.js";import{useRef as c,useEffect as d,useState as p,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{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 b={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/"}},f=/\[([ xX]?)\]/g;function k(){const{openEntity:k}=n(),{prefs:v,save:N}=s(),{data:w}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),_=c({});d(()=>{if(!w)return;const e={};for(const t of w){const r=b[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})}}_.current=e},[w]);const T=v.notepad_notes||[],[j,C]=p(null),[$,S]=p(""),[X,O]=p(""),[U,W]=p("yellow"),[A,D]=p(!1),[R,F]=p(!1),Q=c(null),I=c(),K=T.find(e=>e.id===j);d(()=>{if(!j&&T.length>0){const e=T[0];C(e.id),S(e.title),O(e.content),W(e.color)}},[T.length]);const E=m(e=>{N({notepad_notes:e})},[N]),P=m(()=>{if(!j||!A)return;const e=T.map(e=>e.id===j?{...e,title:$,content:X,color:U,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);E(e),D(!1)},[j,A,$,X,U,T,E]);d(()=>{if(A)return I.current&&clearTimeout(I.current),I.current=setTimeout(P,800),()=>{I.current&&clearTimeout(I.current)}},[A,P]),d(()=>()=>{A&&P()},[]);const q=e=>{A&&P(),C(e.id),S(e.title),O(e.content),W(e.color),D(!1),F(!1)},B=e=>{const t=X.slice(0,e),r=X.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=X.slice(e+r[0].length);O(t+n+o),D(!0)},H=async(e,t)=>{const r=_.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?k(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},V="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.)",Z=/* @__PURE__ */h(y,{children:[
2
+ /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{A&&P();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,...T];E(t),C(e.id),S(""),O(""),W("yellow"),D(!1),F(!0),setTimeout(()=>Q.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
3
3
  /* @__PURE__ */g(l,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
4
  /* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===T.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):T.map(e=>{const t=(r=e.color,x.find(e=>e.key===r)||x[0]);var r;/* @__PURE__ */
5
5
  return h("button",{onClick:()=>q(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(j===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
@@ -10,16 +10,16 @@ return h("button",{onClick:()=>q(e),className:"w-full text-left px-3 py-3 border
10
10
  /* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:a(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
11
  return h("div",{className:"h-full",children:[
12
12
  /* @__PURE__ */g(r,{app:"notepad"}),
13
- /* @__PURE__ */g(t,{sidebar:J,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:j?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
13
+ /* @__PURE__ */g(t,{sidebar:Z,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:j?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
14
  /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */g("input",{value:$,onChange:e=>{X(e.target.value),F(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{A(e.key),F(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${W===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);P(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(j),title:I?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(I?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(l,{name:"bookmark",className:"h-4 w-4",fill:I?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
- /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(P(t),j===e){const e=t[0];e?q(e):(C(null),X(""),U(""))}})(j),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(l,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),K?/* @__PURE__ */g("textarea",{ref:Q,value:S,onChange:e=>{U(e.target.value),F(!0)},onBlur:()=>{O(!1),D&&E()},placeholder:H,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__ */g("div",{onClick:()=>{O(!0),setTimeout(()=>Q.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:S?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=s.exec(e));){const e=a[1],t=a[2];if(_.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>G(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}f.lastIndex=0;let c=0;for(let e=0;e<r;e++)c+=t[e].length+1;for(;null!==(a=f.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=c+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>B(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__ */g(l,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("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__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:"​"},`empty-${r}`));const d=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
- return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(S):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:H})}),
15
+ /* @__PURE__ */g("input",{value:$,onChange:e=>{S(e.target.value),D(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{W(e.key),D(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${U===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);E(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(j),title:K?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(K?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(l,{name:"bookmark",className:"h-4 w-4",fill:K?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(E(t),j===e){const e=t[0];e?q(e):(C(null),S(""),O(""))}})(j),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(l,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),R?/* @__PURE__ */g("textarea",{ref:Q,value:X,onChange:e=>{O(e.target.value),D(!0)},onBlur:()=>{F(!1),A&&P()},placeholder:V,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__ */g("div",{onClick:()=>{F(!0),setTimeout(()=>Q.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:X?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=s.exec(e));){const e=a[1],t=a[2];if(_.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>H(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}f.lastIndex=0;let c=0;for(let e=0;e<r;e++)c+=t[e].length+1;for(;null!==(a=f.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=c+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>B(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__ */g(l,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("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__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:"​"},`empty-${r}`));const d=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
+ return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(X):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:V})}),
20
20
  /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
21
21
  /* @__PURE__ */g("span",{children:"[] checkbox"}),
22
22
  /* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
23
- /* @__PURE__ */g("span",{className:"ml-auto",children:K?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
+ /* @__PURE__ */g("span",{className:"ml-auto",children:R?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
24
24
  /* @__PURE__ */g(l,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
25
25
  /* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{k as default};
@@ -1,4 +1,4 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-HDGFEYPU.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as l,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as g,playAlarm as p,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-ITCBLL72.js";import{PLACEHOLDER_INK as k}from"./chunk-OESIYQSY.js";import{useWidgetSettings as x}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import"./chunk-RUHUTZN4.js";import{useShellPrefs as v}from"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as y}from"./chunk-ZGUQLVY4.js";import{useSyncExternalStore as N,useEffect as C,useMemo as w,useState as S,useRef as B,useCallback as T}from"react";import{jsxs as M,Fragment as j,jsx as P}from"react/jsx-runtime";var I="pomodoro_appearance",A="pomodoro_active_task_id",$={focus:"Pomodoro",short:"Short Break",long:"Long Break"},D={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var L=25,V=5,R=15,E=!1,U=!1,_=4,F=!0,O=!0,Q="bell",W=100,X=1,Y="none",H=50,K=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function z(){const t=N(a,o,o),{prefs:p,save:b}=v(),k=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:K(t.focusMinutes,1,120,L),shortBreakMinutes:K(t.shortBreakMinutes,1,120,V),longBreakMinutes:K(t.longBreakMinutes,1,120,R),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:E,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:U,longBreakInterval:K(t.longBreakInterval,1,20,_),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:F,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:O,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:Q,alarmVolume:K(t.alarmVolume,0,100,W),alarmRepeat:K(t.alarmRepeat,1,5,X),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:Y,focusVolume:K(t.focusVolume,0,100,H)}}(p.pomodoro_settings);C(()=>{n({focus:60*k.focusMinutes,short:60*k.shortBreakMinutes,long:60*k.longBreakMinutes})},[k.focusMinutes,k.shortBreakMinutes,k.longBreakMinutes]),C(()=>{r(k.alarmSound),s(k.alarmVolume,k.alarmRepeat)},[k.alarmSound,k.alarmVolume,k.alarmRepeat]),C(()=>{l({autoStartBreaks:k.autoStartBreaks,autoStartPomodoros:k.autoStartPomodoros,longBreakInterval:k.longBreakInterval})},[k.autoStartBreaks,k.autoStartPomodoros,k.longBreakInterval]),C(()=>{i(k.focusSound,k.focusVolume)},[k.focusSound,k.focusVolume]),C(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const z=c(),J=z.tasks,Z=w(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return w(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(w(()=>J.filter(e=>!!e.dueDate&&(e.dueDate===Z||e.dueDate<Z&&!e.done)),[J,Z]),k.checkToBottom),[ee,te]=S(()=>localStorage.getItem(A)),[ae,oe]=S(!1),[ne,re]=S(null),se=B(!1);C(()=>{se.current||(se.current=!0,d(J,z.setAllTasks))},[]),C(()=>{try{ee?localStorage.setItem(A,ee):localStorage.removeItem(A)}catch{}},[ee]),C(()=>{if(!ne)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ne]);const le=B(t.streak);C(()=>{if(t.streak>le.current&&ee){const e=J.find(e=>e.id===ee);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=k.autoCheckTasks&&a>0&&t>=a;z.updateTask(ee,{completed:t,done:e.done||o})}}le.current=t.streak},[t.streak,ee,k.autoCheckTasks,J,z]);const ce=q.reduce((e,t)=>e+(t.completed??0),0),de=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),ue=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),me=t.running&&"focus"===t.mode?t.remaining:0,he=ue*k.focusMinutes*60+me,ge=new Date(Date.now()+1e3*he).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),pe=(he/3600).toFixed(1),fe=ee?J.find(e=>e.id===ee)??null:null,be=String(Math.floor(t.remaining/60)).padStart(2,"0"),ke=String(t.remaining%60).padStart(2,"0"),[xe,ve]=S(()=>e(I)),[ye,Ne]=S(!1),[Ce,we]=S(xe),[Se,Be]=S(k);x(T(()=>{we({...xe}),Be({...k}),Ne(!0)},[xe,k]));const Te="focus"!==t.mode,Me=D[t.mode],je=Te?(Pe=Me,Ie=xe.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${Ie})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var Pe,Ie;const Ae={primary:Te?"text-white":"text-gray-900",secondary:Te?"text-white/85":"text-gray-700",muted:Te?"text-white/65":"text-gray-500",tabActive:Te?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Te?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Te?"border-white/30":"border-gray-200",softDivider:Te?"border-white/20":"border-gray-200",iconBtn:Te?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Te?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},$e=Te?Me:"#0f172a";/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-HDGFEYPU.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as l,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as g,playAlarm as p,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-ITCBLL72.js";import{PLACEHOLDER_INK as k}from"./chunk-HJQAE6SP.js";import{useWidgetSettings as x}from"./chunk-AEAPCPOG.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import"./chunk-RUHUTZN4.js";import{useShellPrefs as v}from"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-A7TXAKTX.js";import"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as y}from"./chunk-ZGUQLVY4.js";import{useSyncExternalStore as N,useEffect as C,useMemo as w,useState as S,useRef as B,useCallback as T}from"react";import{jsxs as M,Fragment as j,jsx as P}from"react/jsx-runtime";var I="pomodoro_appearance",A="pomodoro_active_task_id",$={focus:"Pomodoro",short:"Short Break",long:"Long Break"},D={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var L=25,V=5,R=15,E=!1,U=!1,_=4,F=!0,Q=!0,W="bell",X=100,O=1,H="none",J=50,K=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function z(){const t=N(a,o,o),{prefs:p,save:b}=v(),k=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:K(t.focusMinutes,1,120,L),shortBreakMinutes:K(t.shortBreakMinutes,1,120,V),longBreakMinutes:K(t.longBreakMinutes,1,120,R),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:E,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:U,longBreakInterval:K(t.longBreakInterval,1,20,_),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:F,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:Q,alarmSound:g.some(e=>e.id===t.alarmSound)?t.alarmSound:W,alarmVolume:K(t.alarmVolume,0,100,X),alarmRepeat:K(t.alarmRepeat,1,5,O),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:H,focusVolume:K(t.focusVolume,0,100,J)}}(p.pomodoro_settings);C(()=>{n({focus:60*k.focusMinutes,short:60*k.shortBreakMinutes,long:60*k.longBreakMinutes})},[k.focusMinutes,k.shortBreakMinutes,k.longBreakMinutes]),C(()=>{r(k.alarmSound),s(k.alarmVolume,k.alarmRepeat)},[k.alarmSound,k.alarmVolume,k.alarmRepeat]),C(()=>{l({autoStartBreaks:k.autoStartBreaks,autoStartPomodoros:k.autoStartPomodoros,longBreakInterval:k.longBreakInterval})},[k.autoStartBreaks,k.autoStartPomodoros,k.longBreakInterval]),C(()=>{i(k.focusSound,k.focusVolume)},[k.focusSound,k.focusVolume]),C(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const z=c(),Y=z.tasks,Z=w(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return w(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(w(()=>Y.filter(e=>!!e.dueDate&&(e.dueDate===Z||e.dueDate<Z&&!e.done)),[Y,Z]),k.checkToBottom),[ee,te]=S(()=>localStorage.getItem(A)),[ae,oe]=S(!1),[ne,re]=S(null),se=B(!1);C(()=>{se.current||(se.current=!0,d(Y,z.setAllTasks))},[]),C(()=>{try{ee?localStorage.setItem(A,ee):localStorage.removeItem(A)}catch{}},[ee]),C(()=>{if(!ne)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ne]);const le=B(t.streak);C(()=>{if(t.streak>le.current&&ee){const e=Y.find(e=>e.id===ee);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=k.autoCheckTasks&&a>0&&t>=a;z.updateTask(ee,{completed:t,done:e.done||o})}}le.current=t.streak},[t.streak,ee,k.autoCheckTasks,Y,z]);const ce=q.reduce((e,t)=>e+(t.completed??0),0),de=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),ue=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),me=t.running&&"focus"===t.mode?t.remaining:0,he=ue*k.focusMinutes*60+me,ge=new Date(Date.now()+1e3*he).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),pe=(he/3600).toFixed(1),fe=ee?Y.find(e=>e.id===ee)??null:null,be=String(Math.floor(t.remaining/60)).padStart(2,"0"),ke=String(t.remaining%60).padStart(2,"0"),[xe,ve]=S(()=>e(I)),[ye,Ne]=S(!1),[Ce,we]=S(xe),[Se,Be]=S(k);x(T(()=>{we({...xe}),Be({...k}),Ne(!0)},[xe,k]));const Te="focus"!==t.mode,Me=D[t.mode],je=Te?(Pe=Me,Ie=xe.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${Ie})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var Pe,Ie;const Ae={primary:Te?"text-white":"text-gray-900",secondary:Te?"text-white/85":"text-gray-700",muted:Te?"text-white/65":"text-gray-500",tabActive:Te?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:Te?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:Te?"border-white/30":"border-gray-200",softDivider:Te?"border-white/20":"border-gray-200",iconBtn:Te?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:Te?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},$e=Te?Me:"#0f172a";/* @__PURE__ */
2
2
  return M(j,{children:[
3
3
  /* @__PURE__ */M("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Ae.primary}`,style:{backgroundColor:je,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
4
4
  /* @__PURE__ */P("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */P("button",{onClick:()=>u(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?Ae.tabActive:Ae.tabInactive}`,children:$[e]},e))}),
@@ -31,7 +31,7 @@ return M("div",{onClick:()=>te(e.id),className:"bg-white text-gray-800 rounded-m
31
31
  /* @__PURE__ */M("span",{className:Ae.muted,children:[" (",pe,"h)"]})]})]})]}),
32
32
  /* @__PURE__ */P(G,{open:ye,onClose:()=>Ne(!1),onSave:()=>{ve(Ce),localStorage.setItem(I,JSON.stringify(Ce)),b({pomodoro_settings:Se}),Ne(!1)},configAppearance:Ce,setConfigAppearance:we,configPrefs:Se,setConfigPrefs:Be})]})}function G({open:e,onClose:a,onSave:o,configAppearance:n,setConfigAppearance:r,configPrefs:s,setConfigPrefs:l}){const i=(e,t)=>l(a=>({...a,[e]:t}));/* @__PURE__ */
33
33
  return M(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:o,children:[
34
- /* @__PURE__ */M(J,{icon:/* @__PURE__ */P(re,{}),label:"TIMER",children:[
34
+ /* @__PURE__ */M(Y,{icon:/* @__PURE__ */P(re,{}),label:"TIMER",children:[
35
35
  /* @__PURE__ */M("div",{children:[
36
36
  /* @__PURE__ */P("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
37
  /* @__PURE__ */M("div",{className:"grid grid-cols-3 gap-3",children:[
@@ -41,17 +41,17 @@ return M(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:n,onAppearance
41
41
  /* @__PURE__ */P(Z,{label:"Auto Start Breaks",children:/* @__PURE__ */P(oe,{checked:s.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
42
42
  /* @__PURE__ */P(Z,{label:"Auto Start Pomodoros",children:/* @__PURE__ */P(oe,{checked:s.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
43
43
  /* @__PURE__ */P(Z,{label:"Long Break interval",children:/* @__PURE__ */P(te,{value:s.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
- /* @__PURE__ */M(J,{icon:/* @__PURE__ */P(se,{}),label:"TASK",children:[
44
+ /* @__PURE__ */M(Y,{icon:/* @__PURE__ */P(se,{}),label:"TASK",children:[
45
45
  /* @__PURE__ */P(Z,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */P(oe,{checked:s.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
46
46
  /* @__PURE__ */P(Z,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */P(oe,{checked:s.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
47
- /* @__PURE__ */M(J,{icon:/* @__PURE__ */P(le,{}),label:"SOUND",children:[
47
+ /* @__PURE__ */M(Y,{icon:/* @__PURE__ */P(le,{}),label:"SOUND",children:[
48
48
  /* @__PURE__ */P(Z,{label:"Alarm Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
49
49
  /* @__PURE__ */P(ae,{value:s.alarmSound,onChange:e=>i("alarmSound",e),options:g.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>p(s.alarmSound,{volume:s.alarmVolume,repeat:1}),className:"px-2 py-1 text-2xs rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
50
50
  /* @__PURE__ */P(q,{value:s.alarmVolume,onChange:e=>i("alarmVolume",e)}),
51
51
  /* @__PURE__ */P(Z,{label:"repeat",children:/* @__PURE__ */P(te,{value:s.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
52
  /* @__PURE__ */P(Z,{label:"Focus Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
53
53
  /* @__PURE__ */P(ae,{value:s.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==s.focusSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>b(s.focusSound,s.focusVolume),className:"px-2 py-1 text-2xs rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
54
- /* @__PURE__ */P(q,{value:s.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function J({icon:e,label:t,children:a}){/* @__PURE__ */
54
+ /* @__PURE__ */P(q,{value:s.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function Y({icon:e,label:t,children:a}){/* @__PURE__ */
55
55
  return M("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
56
  /* @__PURE__ */M("div",{className:"flex items-center gap-2 mb-3 text-gray-400",children:[e,
57
57
  /* @__PURE__ */P("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),