efficient-shell 4.180.0 → 4.181.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +12 -0
  2. package/dist/Browser-QYHW6I6J.js +43 -0
  3. package/dist/Calculator-4K53PFBL.js +29 -0
  4. package/dist/ConfirmDialog-X2DPOYWO.js +1 -0
  5. package/dist/{CurrencyConverter-AMXUOQR2.js → CurrencyConverter-QEG6RFAS.js} +9 -9
  6. package/dist/Documents-SFNMDRYU.js +52 -0
  7. package/dist/Files-OX2UBSQQ.js +87 -0
  8. package/dist/Notepad-CNZEWFCR.js +25 -0
  9. package/dist/PdfViewer-UZGDE4HD.js +1 -0
  10. package/dist/PomodoroTimer-T6YAQFIE.js +91 -0
  11. package/dist/Preview-OOVIIQQG.js +182 -0
  12. package/dist/Sidebar-3NZRIL7F.js +44 -0
  13. package/dist/Spreadsheet-7NUDGOSX.js +37 -0
  14. package/dist/{Stock-GWVG2INU.js → Stock-BZFC2ROU.js} +6 -6
  15. package/dist/{Weather-APBCG4TO.js → Weather-S3N5OWYF.js} +17 -17
  16. package/dist/{WorldClock-2LMZYKWR.js → WorldClock-ACC3S6OA.js} +4 -4
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/{chunk-FORN7LG7.js → chunk-2DX65GOO.js} +1 -1
  20. package/dist/{chunk-6CFBF543.js → chunk-5IWSOLLY.js} +2 -2
  21. package/dist/chunk-FOEVG7RT.js +21 -0
  22. package/dist/chunk-GMMTTWHB.js +3 -0
  23. package/dist/chunk-LMIQV3NB.js +13 -0
  24. package/dist/{chunk-SVO3ES2E.js → chunk-MIAJQGWE.js} +1 -1
  25. package/dist/chunk-MSIN5HKX.js +9 -0
  26. package/dist/chunk-OD5KLVU5.js +1 -0
  27. package/dist/{chunk-ILTSTULF.js → chunk-P4SGJTK3.js} +1 -1
  28. package/dist/chunk-PQLVWCUI.js +11 -0
  29. package/dist/chunk-QRV7RNQX.js +24 -0
  30. package/dist/chunk-R3PCJLQF.js +993 -0
  31. package/dist/chunk-SBDIHKLU.js +108 -0
  32. package/dist/chunk-VJP3R52B.js +6 -0
  33. package/dist/chunk-XUF7VW4U.js +136 -0
  34. package/dist/chunk-ZDF5AR5W.js +10 -0
  35. package/dist/chunk-ZZKIKW62.js +29 -0
  36. package/dist/index.js +639 -656
  37. package/dist/map/index.js +22 -22
  38. package/dist/markdown/index.js +6 -6
  39. package/dist/page-tabs/index.js +5 -5
  40. package/dist/pdf/index.js +1 -1
  41. package/dist/ui/index.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/Browser-RZFOKBSF.js +0 -43
  44. package/dist/Calculator-R5OEHQ67.js +0 -29
  45. package/dist/ConfirmDialog-CMNQZQA3.js +0 -1
  46. package/dist/Documents-VD32HWDQ.js +0 -52
  47. package/dist/Files-NAY3WK6O.js +0 -89
  48. package/dist/Notepad-AHRPMF57.js +0 -25
  49. package/dist/PdfViewer-3SC3LE4U.js +0 -1
  50. package/dist/PomodoroTimer-LE6J2KUU.js +0 -99
  51. package/dist/Preview-OKR5QRQP.js +0 -188
  52. package/dist/Sidebar-BQ4P5LBI.js +0 -44
  53. package/dist/Spreadsheet-RME4IQ43.js +0 -37
  54. package/dist/chunk-4VTHXNGZ.js +0 -1003
  55. package/dist/chunk-5ZDM6WIC.js +0 -24
  56. package/dist/chunk-7WZEFHPS.js +0 -6
  57. package/dist/chunk-AA4TMQOS.js +0 -10
  58. package/dist/chunk-BSJIBRWC.js +0 -1
  59. package/dist/chunk-C2A4PIGZ.js +0 -13
  60. package/dist/chunk-CIXQKCFA.js +0 -11
  61. package/dist/chunk-KVOFUFPP.js +0 -3
  62. package/dist/chunk-N6STBYXR.js +0 -112
  63. package/dist/chunk-RQOP5JAJ.js +0 -9
  64. package/dist/chunk-UAIVAA5X.js +0 -21
  65. package/dist/chunk-ZAE6ROV7.js +0 -29
package/README.md CHANGED
@@ -3410,6 +3410,18 @@ option per registered set by its `label`, with a strip of everyday icons
3410
3410
  drawn in the set that is active. It appears only when a host has registered
3411
3411
  more than one set, since one set is nothing to choose between.
3412
3412
 
3413
+ **The shell's own icons follow the set too.** A window's close button, the
3414
+ sidebar's chevrons, a banner's tone, a number box's steppers: 199 of the icons
3415
+ the shell draws itself are `<Icon name>`, so the chosen set draws them. Each
3416
+ hands `<Icon>` the drawing it had before as its `fallback`
3417
+ (`src/icons/fallbacks.tsx`, not a public entry), which is what a host that
3418
+ registered no set still sees: nothing changes there. Size, colour and stroke
3419
+ width stay with the place, so an icon takes the same box whichever set draws
3420
+ it. What is left inline is not an icon by meaning: charts, spinners,
3421
+ illustrations, an app's tool palette, a path a host supplies.
3422
+ `tests/shellIconFallbacks.test.tsx` holds each file to its count; a new icon in
3423
+ the shell is `<Icon name="…" fallback={…} />`.
3424
+
3413
3425
  **A product's own glyphs.** An editor's block types and settings rows are not
3414
3426
  in the catalogue. Register them and draw them by `glyph`, with no icon package
3415
3427
  imported:
@@ -0,0 +1,43 @@
1
+ import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-MSIN5HKX.js";import{WindowTitle as r}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-OD5KLVU5.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as a}from"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{ChevronLeftFallback as n,ChevronRightFallback as l,RefreshFallback as s,HomeFallback as i,StarFallback as c,ExternalFallback as m,HelpFallback as d,NoSymbolFallback as u}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as h}from"./chunk-YKZHOXI4.js";import{useRef as p,useEffect as b,useState as g}from"react";import{jsxs as f,jsx as k,Fragment as x}from"react/jsx-runtime";var w="react-os-shell:browser-bookmarks",y="react-os-shell:browser-homepage",v="https://en.wikipedia.org/wiki/Main_Page",N=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],j=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 C(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&&j.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var z=["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 W(){if("undefined"==typeof window)return N;try{const e=localStorage.getItem(w);if(!e)return N;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return N}function S(){return"undefined"==typeof window?v:localStorage.getItem(y)||v}function H(){const u=p(void 0);void 0===u.current&&(u.current=e()),b(()=>{null!=u.current&&t(u.current)},[]);const x=u.current?C(u.current.url):"",[v,N]=g(S),[j,z]=g(x||v),[H,I]=g(j),[D,O]=g([j]),[U,T]=g(0),[E,F]=g(0),[K,M]=g(W),[X,P]=g(!1),[J,Z]=g(null),q=p(null),A=p(null);b(()=>{try{localStorage.setItem(w,JSON.stringify(K))}catch{}},[K]);const Q=e=>{const t=C(e);t&&(z(t),I(t),O(e=>{const o=e.slice(0,U+1);return o.push(t),o}),T(e=>e+1),P(!1))},B=()=>{"undefined"!=typeof window&&window.open(j,"_blank","noopener,noreferrer")},G=()=>{const e=J?.trim();e?(M(t=>[...t,{label:e,url:j}]),Z(null)):Z(null)};b(()=>{if(null===J)return;q.current?.focus(),q.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||Z(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==J]);const $=e=>{M(t=>t.filter((t,o)=>o!==e))},V=U>0,Y=U<D.length-1,_=K.some(e=>e.url===j),ee="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
+ return f("div",{className:"relative flex flex-col h-full bg-white",children:[
3
+ /* @__PURE__ */k(r,{title:`Browser - ${L(j)}`}),
4
+ /* @__PURE__ */k(o,{app:"browser"}),
5
+ /* @__PURE__ */f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
6
+ /* @__PURE__ */k("button",{onClick:()=>{if(U>0){const e=U-1;T(e),z(D[e]),I(D[e]),P(!1)}},disabled:!V,className:ee,title:"Back",children:/* @__PURE__ */k(h,{name:"chevron-left",fallback:n,className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */k("button",{onClick:()=>{if(U<D.length-1){const e=U+1;T(e),z(D[e]),I(D[e]),P(!1)}},disabled:!Y,className:ee,title:"Forward",children:/* @__PURE__ */k(h,{name:"chevron-right",fallback:l,className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */k("button",{onClick:()=>F(e=>e+1),className:ee,title:"Refresh",children:/* @__PURE__ */k(h,{name:"refresh",fallback:s,className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */k("button",{onClick:()=>Q(v),className:ee,title:"Home",children:/* @__PURE__ */k(h,{name:"home",fallback:i,className:"h-4 w-4",strokeWidth:1.8})}),
10
+ /* @__PURE__ */k("form",{onSubmit:e=>{e.preventDefault(),Q(H)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */f("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
+ /* @__PURE__ */k("span",{className:"px-2 text-gray-400 text-xs",children:j.startsWith("https://")?"🔒":"⚠️"}),
12
+ /* @__PURE__ */k("input",{type:"text",value:H,onChange:e=>I(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…"}),j!==H&&/* @__PURE__ */k("button",{type:"button",onClick:()=>I(j),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
13
+ /* @__PURE__ */k("button",{"data-bookmark-popover":!0,onClick:()=>_?$(K.findIndex(e=>e.url===j)):void Z(L(j)),className:ee+" "+(_?"text-yellow-500":""),title:_?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */k(h,{name:"star",fallback:c,className:"h-4 w-4",fill:_?"currentColor":"none",strokeWidth:1.5})}),
14
+ /* @__PURE__ */k("button",{onClick:B,className:ee,title:"Open in new tab",children:/* @__PURE__ */k(h,{name:"external",fallback:m,className:"h-4 w-4",strokeWidth:1.5})}),
15
+ /* @__PURE__ */k("button",{onClick:()=>P(e=>!e),className:ee,title:"Embedding help",children:/* @__PURE__ */k(h,{name:"help",fallback:d,className:"h-4 w-4",strokeWidth:1.5})})]}),null!==J&&/* @__PURE__ */f("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
+ /* @__PURE__ */k("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
17
+ /* @__PURE__ */k("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:j,children:j}),
18
+ /* @__PURE__ */k("input",{ref:q,type:"text",value:J,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key?G():"Escape"===e.key&&Z(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
+ /* @__PURE__ */f("div",{className:"flex justify-end gap-1 mt-2",children:[
20
+ /* @__PURE__ */k("button",{onClick:()=>Z(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */k("button",{onClick:G,disabled:!J.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__ */f("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===K.length&&/* @__PURE__ */k("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),K.map((e,t)=>/* @__PURE__ */f("button",{onClick:()=>Q(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"})&&$(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
23
+ /* @__PURE__ */k("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
+ /* @__PURE__ */k("div",{className:"flex-1"}),
25
+ /* @__PURE__ */k("button",{onClick:()=>{N(j);try{localStorage.setItem(y,j)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
26
+ /* @__PURE__ */k("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */k(R,{url:j,iframeKey:E,iframeRef:A,openExternal:B,showHelp:X,dismissHelp:()=>P(!1)})})]})}function L(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function R({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:n}){const[l,s]=g(!1);b(()=>{s(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return z.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!l?/* @__PURE__ */k("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */f("div",{className:"max-w-md text-center",children:[
27
+ /* @__PURE__ */k(h,{name:"no-symbol",fallback:u,className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
28
+ /* @__PURE__ */f("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[L(e)," can't be embedded"]}),
29
+ /* @__PURE__ */f("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
30
+ /* @__PURE__ */k("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
31
+ /* @__PURE__ */k("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
32
+ /* @__PURE__ */f("div",{className:"flex flex-col items-center gap-2",children:[
33
+ /* @__PURE__ */f("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 inline-flex items-center gap-2",children:[
34
+ /* @__PURE__ */k(h,{name:"external",fallback:m,className:"h-4 w-4",strokeWidth:1.5}),"Open in a new tab"]}),
35
+ /* @__PURE__ */k("button",{onClick:()=>s(!0),className:"text-xs text-gray-500 hover:text-gray-800 underline",children:"Try loading it here anyway"})]})]})}):/* @__PURE__ */f(x,{children:[
36
+ /* @__PURE__ */k("iframe",{ref:o,src:e,className:"absolute inset-0 w-full h-full bg-white",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals",referrerPolicy:"no-referrer-when-downgrade"},t+e),a&&/* @__PURE__ */f("div",{className:"absolute top-2 right-2 max-w-sm bg-white border border-gray-200 rounded-md shadow-lg p-3 text-xs text-gray-700 z-10",children:[
37
+ /* @__PURE__ */k("div",{className:"font-medium text-gray-900 mb-1",children:"Why is this page blank?"}),
38
+ /* @__PURE__ */f("p",{className:"mb-2",children:["Most major sites (Google, GitHub, banks, news) refuse to be embedded in an iframe via ",
39
+ /* @__PURE__ */k("span",{className:"font-mono",children:"X-Frame-Options"})," or Content Security Policy. There's no workaround — the browser blocks the load before our app can do anything."]}),
40
+ /* @__PURE__ */f("p",{children:["Hit the ",
41
+ /* @__PURE__ */k("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
42
+ /* @__PURE__ */k("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
43
+ /* @__PURE__ */k("button",{onClick:n,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{H as default};
@@ -0,0 +1,29 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-MIAJQGWE.js";import{useWidgetSettings as n}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CheckFallbackB as l,CopyFallbackB as r}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as c}from"./chunk-YKZHOXI4.js";import{useState as a,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as u,Fragment as d,jsx as h}from"react/jsx-runtime";var m="calc_appearance";function b(){const[b,k]=a("0"),[p,g]=a(null),[f,y]=a(null),[x,N]=a(!1),[v,C]=a(""),[$,j]=a([]),[w,W]=a(!1),[E,S]=a(()=>e(m)),[T,F]=a(!1),[I,H]=a(E),A=i(null);n(o(()=>{H({...E}),F(!0)},[E]));const D=o(e=>{C(""),k(t=>x||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[x]),J=o(()=>{k("0"),g(null),y(null),N(!1)},[]),L=o((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),O=o(e=>{const t=parseFloat(b);if(null!==p&&f&&!x){const e=L(p,t,f);k(String(e)),g(e),j(n=>[`${p} ${f} ${t} = ${e}`,...n].slice(0,20))}else g(t);y(e),N(!0)},[b,p,f,x,L]),X=o(()=>{if(null===p||!f)return;const e=parseFloat(b),t=L(p,e,f),n=`${p} ${f} ${e} =`;j(e=>[`${n} ${t}`,...e].slice(0,20)),C(n),k(String(t)),g(null),y(null),N(!0)},[b,p,f,L]),Z=o(()=>{k(e=>String(parseFloat(e)/100))},[]),M=o(()=>{k(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);s(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?D(e.key):"."===e.key?D("."):"+"===e.key?O("+"):"-"===e.key?O("-"):"*"===e.key?O("×"):"/"===e.key?(e.preventDefault(),O("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&A.current?.contains(e.target)&&e.preventDefault(),X()):"Escape"===e.key?J():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&Z())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D,O,X,J,Z]);const Q="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",U=`${Q} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,B=`${Q} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,K=`${Q} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,P=`${Q} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
+ return u(d,{children:[
3
+ /* @__PURE__ */u("div",{ref:A,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */u("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
+ /* @__PURE__ */h("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:$.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */h("div",{className:"text-[11px] text-slate-400 text-right font-mono truncate",children:e},t))}),(v||f&&null!==p)&&/* @__PURE__ */h("div",{className:"text-base text-slate-600 text-right font-mono",children:v||`${p} ${f} ${x?"":b}`}),
6
+ /* @__PURE__ */u("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */h("button",{onClick:()=>{navigator.clipboard.writeText(b),W(!0),setTimeout(()=>W(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */h(c,w?{name:"check",fallback:l,className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",fallback:r,className:"h-5 w-5",strokeWidth:2})}),
8
+ /* @__PURE__ */h("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(b)})]})]}),
9
+ /* @__PURE__ */u("div",{className:"grid grid-cols-4 grid-rows-5 gap-1.5 flex-1 min-h-0 p-2",children:[
10
+ /* @__PURE__ */h("button",{onClick:J,className:K,children:"AC"}),
11
+ /* @__PURE__ */h("button",{onClick:M,className:K,children:"+/−"}),
12
+ /* @__PURE__ */h("button",{onClick:Z,className:K,children:"%"}),
13
+ /* @__PURE__ */h("button",{onClick:()=>O("÷"),className:`${B} ${"÷"===f?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */h("button",{onClick:()=>D("7"),className:U,children:"7"}),
15
+ /* @__PURE__ */h("button",{onClick:()=>D("8"),className:U,children:"8"}),
16
+ /* @__PURE__ */h("button",{onClick:()=>D("9"),className:U,children:"9"}),
17
+ /* @__PURE__ */h("button",{onClick:()=>O("×"),className:`${B} ${"×"===f?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */h("button",{onClick:()=>D("4"),className:U,children:"4"}),
19
+ /* @__PURE__ */h("button",{onClick:()=>D("5"),className:U,children:"5"}),
20
+ /* @__PURE__ */h("button",{onClick:()=>D("6"),className:U,children:"6"}),
21
+ /* @__PURE__ */h("button",{onClick:()=>O("-"),className:`${B} ${"-"===f?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */h("button",{onClick:()=>D("1"),className:U,children:"1"}),
23
+ /* @__PURE__ */h("button",{onClick:()=>D("2"),className:U,children:"2"}),
24
+ /* @__PURE__ */h("button",{onClick:()=>D("3"),className:U,children:"3"}),
25
+ /* @__PURE__ */h("button",{onClick:()=>O("+"),className:`${B} ${"+"===f?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */h("button",{onClick:()=>D("0"),className:`${U} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */h("button",{onClick:()=>D("."),className:U,children:"."}),
28
+ /* @__PURE__ */h("button",{onClick:X,className:P,children:"="})]})]}),
29
+ /* @__PURE__ */h(t,{open:T,onClose:()=>F(!1),title:"Calculator Settings",appearance:I,onAppearanceChange:H,onSave:()=>{S(I),localStorage.setItem(m,JSON.stringify(I)),F(!1)}})]})}export{b as default};
@@ -0,0 +1 @@
1
+ export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-ZZKIKW62.js";import"./chunk-AFYQTVZO.js";import"./chunk-X4FJ54PP.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";
@@ -1,6 +1,6 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-SVO3ES2E.js";import{useWidgetSettings as r}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useState as n,useCallback as a,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],u="currency_pairs",p="currency_appearance",d="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(d)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(u)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,d]=n(x),[f,N]=n(()=>e(p)),[b,S]=n({}),[v,k]=n(!1),[D,C]=n(!1),[j,O]=n([]),[A,J]=n(f),[I,U]=n("USD"),[H,R]=n("CNY");r(a(()=>{O([...m]),J({...f}),C(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){k(!0);const r={};for(const t of e){const e=h(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,g(t,n.rates))}catch{}}t&&(S(r),k(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-MIAJQGWE.js";import{useWidgetSettings as r}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useState as n,useCallback as a,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],u="currency_pairs",p="currency_appearance",d="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(d)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(u)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,d]=n(x),[f,N]=n(()=>e(p)),[b,v]=n({}),[S,k]=n(!1),[D,j]=n(!1),[C,I]=n([]),[U,J]=n(f),[H,A]=n("USD"),[O,B]=n("CNY");r(a(()=>{I([...m]),J({...f}),j(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){k(!0);const r={};for(const t of e){const e=h(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,g(t,n.rates))}catch{}}t&&(v(r),k(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
2
2
  return c(o,{children:[
3
- /* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[v&&/* @__PURE__ */i("div",{className:"text-xs text-gray-400 text-center py-4",children:"Loading rates..."}),m.map(([e,t],r)=>{const n=b[e]?.[t];/* @__PURE__ */
3
+ /* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[S&&/* @__PURE__ */i("div",{className:"text-xs text-gray-400 text-center py-4",children:"Loading rates..."}),m.map(([e,t],r)=>{const n=b[e]?.[t];/* @__PURE__ */
4
4
  return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),localStorage.setItem(u,JSON.stringify(e))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
5
5
  /* @__PURE__ */c("div",{className:"flex items-center gap-1.5",children:[
6
6
  /* @__PURE__ */i("span",{className:"text-base",children:y[e]||""}),
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),l
9
9
  /* @__PURE__ */i("span",{className:"text-base",children:y[t]||""}),
10
10
  /* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
11
11
  /* @__PURE__ */i("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
12
- /* @__PURE__ */i(t,{open:D,onClose:()=>C(!1),title:"Currency Settings",appearance:A,onAppearanceChange:J,onSave:()=>{if(0===j.length)return;const e=j.slice(0,4);d(e),N(A),localStorage.setItem(u,JSON.stringify(e)),localStorage.setItem(p,JSON.stringify(A)),C(!1)},children:/* @__PURE__ */c("div",{children:[
12
+ /* @__PURE__ */i(t,{open:D,onClose:()=>j(!1),title:"Currency Settings",appearance:U,onAppearanceChange:J,onSave:()=>{if(0===C.length)return;const e=C.slice(0,4);d(e),N(U),localStorage.setItem(u,JSON.stringify(e)),localStorage.setItem(p,JSON.stringify(U)),j(!1)},children:/* @__PURE__ */c("div",{children:[
13
13
  /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
14
- /* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",j.length,"/",4,")"]})]}),
15
- /* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:j.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
14
+ /* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",C.length,"/",4,")"]})]}),
15
+ /* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:C.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
16
  /* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
17
- /* @__PURE__ */i("button",{onClick:()=>O(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),j.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
18
- /* @__PURE__ */i("select",{value:I,onChange:e=>U(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
17
+ /* @__PURE__ */i("button",{onClick:()=>I(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),C.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
18
+ /* @__PURE__ */i("select",{value:H,onChange:e=>A(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
19
19
  /* @__PURE__ */i("span",{className:"text-gray-400",children:"→"}),
20
- /* @__PURE__ */i("select",{value:H,onChange:e=>R(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
21
- /* @__PURE__ */i("button",{onClick:()=>{I!==H&&j.length<4&&O(e=>[...e,[I,H]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
20
+ /* @__PURE__ */i("select",{value:O,onChange:e=>B(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
21
+ /* @__PURE__ */i("button",{onClick:()=>{H!==O&&C.length<4&&I(e=>[...e,[H,O]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
@@ -0,0 +1,52 @@
1
+ import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-MSIN5HKX.js";import{WindowTitle as n}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-OD5KLVU5.js";import{toast_default as r}from"./chunk-3DGTIWZP.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{FolderOpenFallback as s,ImageFallback as c}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as d}from"./chunk-YKZHOXI4.js";import{useState as m,useRef as h}from"react";import{jsxs as u,jsx as p}from"react/jsx-runtime";var g=/* @__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"]),x=/* @__PURE__ */new Set(["docx"]),f={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function y(){const[y,v]=m(f),[b,k]=m(!1),[w,N]=m(!1),[j,D]=m(!1),[C,L]=m(null),M=h(null),U=h(null),W=h(null),R=(e,t)=>{W.current?.focus(),document.execCommand(e,!1,t),D(!0)},I=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{W.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),D(!0)},e.readAsDataURL(t)}},O=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",D(!0),L(null))},T=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();k(!0);try{if(g.has(n)||!x.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");v({filename:t.name,kind:"text",content:o,ext:n}),D(!1)}else if(x.has(n))try{const e=await(import(
2
+ /* @vite-ignore */
3
+ "mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});v({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),D(!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{k(!1)}},B=y?.filename?(S=y.filename).length>24?`${S.slice(0,23)}…`:S:"Untitled";var S;/* @__PURE__ */
4
+ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),w||N(!0)},onDragLeave:e=>{e.currentTarget===e.target&&N(!1)},onDrop:e=>{e.preventDefault(),N(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?I(t):T(t[0]))},children:[
5
+ /* @__PURE__ */p(n,{title:`${B}${j?" •":""} - Documents`}),
6
+ /* @__PURE__ */p(t,{app:"documents"}),
7
+ /* @__PURE__ */u("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
8
+ /* @__PURE__ */p("input",{ref:M,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&T(t),M.current&&(M.current.value="")},className:"hidden"}),
9
+ /* @__PURE__ */u("button",{onClick:()=>M.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
10
+ /* @__PURE__ */p(d,{name:"folder-open",fallback:s,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
11
+ /* @__PURE__ */p("button",{onClick:()=>{if(!y)return;const t=W.current?.innerHTML??"";if("text"===y.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(y.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${y.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=W.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=y.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(y.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${y.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
12
+ /* @__PURE__ */p("span",{className:"text-[10px] text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
13
+ /* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
14
+ /* @__PURE__ */u("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:y.filename,children:[y.filename,j?" •":""]}),
15
+ /* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
16
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
17
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
18
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
19
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
20
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
21
+ /* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
22
+ /* @__PURE__ */u("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
23
+ /* @__PURE__ */p("option",{value:"",disabled:!0,children:"Size"}),
24
+ /* @__PURE__ */p("option",{value:"1",children:"XS"}),
25
+ /* @__PURE__ */p("option",{value:"2",children:"S"}),
26
+ /* @__PURE__ */p("option",{value:"3",children:"M"}),
27
+ /* @__PURE__ */p("option",{value:"4",children:"L"}),
28
+ /* @__PURE__ */p("option",{value:"5",children:"XL"}),
29
+ /* @__PURE__ */p("option",{value:"6",children:"2XL"})]}),
30
+ /* @__PURE__ */p("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
31
+ /* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
32
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
33
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
34
+ /* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
35
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
36
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
37
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
38
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
+ /* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
40
+ /* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
+ /* @__PURE__ */p("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&I(Array.from(e.target.files)),U.current&&(U.current.value="")}}),
42
+ /* @__PURE__ */u("button",{onClick:()=>U.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
43
+ /* @__PURE__ */p(d,{name:"image",fallback:c,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
44
+ /* @__PURE__ */p("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */p("div",b?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===y.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */p("div",{ref:W,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>D(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),I(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),L({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:y.content},className:"docx"===y.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-[14px] leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-[13px] leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),w&&/* @__PURE__ */p("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__ */p("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),C&&/* @__PURE__ */u(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>L(null),children:[
45
+ /* @__PURE__ */p(l,{children:"Image width"}),
46
+ /* @__PURE__ */p(a,{onClick:()=>O("25%"),children:"25%"}),
47
+ /* @__PURE__ */p(a,{onClick:()=>O("50%"),children:"50%"}),
48
+ /* @__PURE__ */p(a,{onClick:()=>O("75%"),children:"75%"}),
49
+ /* @__PURE__ */p(a,{onClick:()=>O("100%"),children:"100%"}),
50
+ /* @__PURE__ */p(a,{onClick:()=>O(null),children:"Original size"}),
51
+ /* @__PURE__ */p(i,{}),
52
+ /* @__PURE__ */p(a,{danger:!0,onClick:()=>{C?.el.remove(),D(!0),L(null)},children:"Remove image"})]})]})}export{y as default};
@@ -0,0 +1,87 @@
1
+ import{openPreviewFile as e}from"./chunk-NHIGOEZF.js";import{Breadcrumbs as t}from"./chunk-VJP3R52B.js";import{SidebarLayout as a}from"./chunk-PE4F4MJE.js";import{getFilesDemoTree as r}from"./chunk-P4SGJTK3.js";import{AboutApp as n}from"./chunk-MSIN5HKX.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as s,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as c,getDesktopFoldersSnapshot as d,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-LMIQV3NB.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as u}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-OD5KLVU5.js";import{toast_default as x}from"./chunk-3DGTIWZP.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as g,prompt as y}from"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CloseCircleFallback as b,ArrowLeftFallback as k,RefreshFallback as N,TrashFallback as w,FolderPlusFallback as v,UploadFallbackB as j,FolderFallback as $,PageFallback as C}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{formatBytes as D}from"./chunk-W32SKK3D.js";import{Icon as L}from"./chunk-YKZHOXI4.js";import{useState as T,useEffect as E,useSyncExternalStore as R,useRef as I,useCallback as P}from"react";import{jsxs as S,jsx as W,Fragment as F}from"react/jsx-runtime";var O="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",M={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function U(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function A(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 H(){const H=O.replace(/\/$/,""),V=null!==r(),[K,J]=T("/"),[B,z]=T([]),[Z,X]=T([]),[_,Q]=T(null),[G,Y]=T(!0),[q,ee]=T(!1),[te,ae]=T(null),[re,ne]=T(!1),[ie,se]=T(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});E(()=>{s()},[]);const[le,oe]=T([]);E(()=>{const e=()=>{s(),se("trash")},t=e=>{s();const t=e.detail?.folderId;t&&se({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const ce=R(c,d,d),de="object"==typeof ie?ie.desktopFolderId:null,me=de?ce?.folders.find(e=>e.id===de)??null:null,he=de&&ce?.itemsByFolder[de]||[];E(()=>{de&&ce&&!ce.folders.some(e=>e.id===de)&&se("files")},[de,ce]);const pe=I(0),fe=I(null),{openPage:ue,openEntity:xe}=f(),ge=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ue(e)}):"page"===t.entityType?ue(t.entityId):xe(t.entityType,t.entityId,null,t.label)},ye=P((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),be=P(async()=>{try{const e=await ye(`${H}/api/quota`);if(e.ok){const t=await e.json();ae({used:t.used,limit:t.limit})}}catch{}},[ye,H]),ke=P(async e=>{if(Q(null),V){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 z(t),J(e),ee(!1),Y(!1),void("/"===e&&X(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Y(!0);try{const t=await ye(`${H}/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||[];z(r),J(a.path||e),ee(!1),"/"===(a.path||e)&&X(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){ee(!0)}finally{Y(!1)}be()},[ye,H,be,V]),Ne=P(async()=>{if(V)return oe([]),void Y(!1);Y(!0),Q(null);try{const e=await ye(`${H}/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();oe(t.entries||[]),ee(!1)}catch{ee(!0)}finally{Y(!1)}be()},[ye,H,be,V]);E(()=>{"files"===ie?ke(K):"trash"===ie&&Ne()},[K,ie]);const we=async e=>{const t=U(K,e.name);try{const a=await ye(`${H}/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),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},ve=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ye(`${H}/api/upload?path=${encodeURIComponent(K)}`,{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 — ${D(a)} free, ${e.name} is ${D(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ke(K)},je=()=>{pe.current=0,ne(!1)};if(E(()=>{const e=()=>je();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),q)/* @__PURE__ */
2
+ return S("div",{className:"flex flex-col h-full bg-white",children:[
3
+ /* @__PURE__ */W(u,{title:"Files - offline"}),
4
+ /* @__PURE__ */W("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */S("div",{className:"max-w-md",children:[
5
+ /* @__PURE__ */W(L,{name:"close-circle",fallback:b,className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
+ /* @__PURE__ */W("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
+ /* @__PURE__ */S("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
+ /* @__PURE__ */W("span",{className:"font-mono",children:H}),". Make sure the server is running — see ",
9
+ /* @__PURE__ */W("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
+ /* @__PURE__ */W("button",{onClick:()=>ke(K),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const $e="/"===K?[]:K.split("/").filter(Boolean),Ce=te&&te.limit>0?Math.min(100,Math.round(te.used/te.limit*100)):0,De=Ce>90?"bg-red-500":Ce>75?"bg-amber-500":"bg-blue-500",Le=[{label:"My files",onClick:()=>J("/")},...$e.map((e,t)=>({label:e,onClick:()=>J("/"+$e.slice(0,t+1).join("/"))}))],Te=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),Ee=e=>/* @__PURE__ */W("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__ */W("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),Re=/* @__PURE__ */S("nav",{className:"p-2",children:[
11
+ /* @__PURE__ */W("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
+ /* @__PURE__ */S("button",{onClick:()=>{se("files"),J("/")},className:Te("files"===ie&&"/"===K),children:[Ee("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"]}),Z.map(e=>/* @__PURE__ */S("button",{onClick:()=>{se("files"),J("/"+e)},className:Te("files"===ie&&K==="/"+e),children:[Ee("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__ */W("span",{className:"truncate",children:e})]},e)),!V&&/* @__PURE__ */S("button",{onClick:()=>se("trash"),className:Te("trash"===ie),children:[Ee("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"]}),ce&&ce.folders.length>0&&/* @__PURE__ */S(F,{children:[
14
+ /* @__PURE__ */W("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ce.folders.map(e=>/* @__PURE__ */S("button",{onClick:()=>se({desktopFolderId:e.id}),className:Te(de===e.id),children:[
15
+ /* @__PURE__ */W(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
+ /* @__PURE__ */W("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */W("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
+ return S("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{V||"object"==typeof ie||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),pe.current++,re||ne(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{pe.current>0&&pe.current--,0===pe.current&&ne(!1)},onDrop:e=>{e.preventDefault(),je(),V||"object"==typeof ie||e.dataTransfer.files?.length&&ve(e.dataTransfer.files)},children:[
18
+ /* @__PURE__ */W(u,{title:me?`Files - ${me.name}`:"Files"+("/"===K?"":" - "+K)}),
19
+ /* @__PURE__ */W(n,{app:"files"}),
20
+ /* @__PURE__ */W("input",{ref:fe,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ve(e.target.files),fe.current&&(fe.current.value="")}}),
21
+ /* @__PURE__ */W("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */W(a,{sidebar:Re,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */S("div",{className:"flex h-full min-w-0 flex-col",children:[
22
+ /* @__PURE__ */S("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */S(F,"files"===ie?{children:[
23
+ /* @__PURE__ */W("button",{onClick:()=>J(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(K)),disabled:"/"===K,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */W(L,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
24
+ /* @__PURE__ */W("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */W(t,{items:Le,maxItems:5})}),
25
+ /* @__PURE__ */W("button",{onClick:()=>ke(K),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */W(L,{name:"refresh",fallback:N,className:"h-3.5 w-3.5",strokeWidth:1.8})}),!V&&/* @__PURE__ */S(F,{children:[
26
+ /* @__PURE__ */S("button",{onClick:()=>se("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__ */W(L,{name:"trash",fallback:w,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
+ /* @__PURE__ */S("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=U(K,e),a=await ye(`${H}/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})`)}ke(K)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
+ /* @__PURE__ */W(L,{name:"folder-plus",fallback:v,className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
+ /* @__PURE__ */S("button",{onClick:()=>fe.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__ */W(L,{name:"upload",fallback:j,className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ie?{children:[
32
+ /* @__PURE__ */W("button",{onClick:()=>se("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */W(L,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
33
+ /* @__PURE__ */W("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
+ /* @__PURE__ */W("button",{onClick:Ne,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */W(L,{name:"refresh",fallback:N,className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
+ /* @__PURE__ */W("button",{onClick:async()=>{if(0===le.length)return;if(!await g({title:"Empty trash",message:`${le.length} item${1===le.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await ye(`${H}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Empty trash failed (${e.status})`)}Ne()},disabled:0===le.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__ */W("button",{onClick:()=>se("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */W(L,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
37
+ /* @__PURE__ */W(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
+ /* @__PURE__ */W("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:me?.name??"Desktop folder"}),
39
+ /* @__PURE__ */W("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),te&&/* @__PURE__ */S(F,{children:[
40
+ /* @__PURE__ */W("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
+ /* @__PURE__ */S("div",{className:"flex items-center gap-1.5",title:`${D(te.used)} of ${D(te.limit)} used`,children:[
42
+ /* @__PURE__ */W("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */W("div",{className:`h-full ${De} transition-all`,style:{width:`${Ce}%`}})}),
43
+ /* @__PURE__ */S("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[D(te.used)," / ",D(te.limit)]})]})]})]}),
44
+ /* @__PURE__ */W("div",{className:"flex-1 overflow-auto",children:"object"==typeof ie?0===he.length?/* @__PURE__ */W("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__ */S("table",{className:"w-full text-sm",children:[
45
+ /* @__PURE__ */W("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */S("tr",{children:[
46
+ /* @__PURE__ */W("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
47
+ /* @__PURE__ */W("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
48
+ /* @__PURE__ */W("th",{className:"w-56"})]})}),
49
+ /* @__PURE__ */W("tbody",{children:he.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
50
+ return S("tr",{onClick:()=>Q(t),onDoubleClick:()=>ge(e),className:"cursor-default border-b border-gray-100 "+(_===t?"bg-blue-50":"hover:bg-gray-50"),children:[
51
+ /* @__PURE__ */S("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
52
+ /* @__PURE__ */W(h,{item:e}),
53
+ /* @__PURE__ */W("span",{className:"truncate",title:e.label,children:e.label})]}),
54
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-xs text-gray-500",children:p(e)}),
55
+ /* @__PURE__ */S("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
56
+ /* @__PURE__ */W("button",{onClick:t=>{t.stopPropagation(),ge(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
57
+ /* @__PURE__ */W("button",{onClick:t=>{t.stopPropagation(),ce?.moveToDesktop([e])},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Move to desktop"}),
58
+ /* @__PURE__ */W("button",{onClick:t=>{t.stopPropagation(),ce?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===ie?G&&0===le.length?/* @__PURE__ */W("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===le.length?/* @__PURE__ */W("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */S("table",{className:"w-full text-sm",children:[
59
+ /* @__PURE__ */W("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */S("tr",{children:[
60
+ /* @__PURE__ */W("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
61
+ /* @__PURE__ */W("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
62
+ /* @__PURE__ */W("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
63
+ /* @__PURE__ */W("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Deleted"}),
64
+ /* @__PURE__ */W("th",{className:"w-44"})]})}),
65
+ /* @__PURE__ */W("tbody",{children:le.map(e=>/* @__PURE__ */S("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
66
+ /* @__PURE__ */S("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */W(L,{name:"folder",fallback:$,className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */W(L,{name:"page",fallback:C,className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
67
+ /* @__PURE__ */W("span",{className:"truncate",title:e.name,children:e.name})]}),
68
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
69
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:D(e.size)}),
70
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?A(e.deletedAt):"—"}),
71
+ /* @__PURE__ */S("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
72
+ /* @__PURE__ */W("button",{onClick:()=>(async e=>{const t=await ye(`${H}/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}"`),Ne()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
73
+ /* @__PURE__ */W("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 ye(`${H}/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})`)}Ne()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):G&&0===B.length?/* @__PURE__ */W("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===B.length?/* @__PURE__ */S("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!V&&/* @__PURE__ */S(F,{children:[" Drop files here or click ",
74
+ /* @__PURE__ */W("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */S("table",{className:"w-full text-sm",children:[
75
+ /* @__PURE__ */W("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */S("tr",{children:[
76
+ /* @__PURE__ */W("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
77
+ /* @__PURE__ */W("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
78
+ /* @__PURE__ */W("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
79
+ /* @__PURE__ */W("th",{className:"w-32"})]})}),
80
+ /* @__PURE__ */W("tbody",{children:B.map(t=>/* @__PURE__ */S("tr",{onClick:()=>Q(t.name),onDoubleClick:()=>{"folder"===t.kind?J(U(K,t.name)):(async t=>{if(V)return;const a=U(K,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=M[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>ue(e)}):we(t)})(t)},className:"cursor-default border-b border-gray-100 "+(_===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
+ /* @__PURE__ */S("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */W(L,{name:"folder",fallback:$,className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */W(L,{name:"page",fallback:C,className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
+ /* @__PURE__ */W("span",{className:"truncate",title:t.name,children:t.name})]}),
83
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":D(t.size)}),
84
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:A(t.modifiedAt)}),
85
+ /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!V&&/* @__PURE__ */S(F,{children:["file"===t.kind&&/* @__PURE__ */W("button",{onClick:e=>{e.stopPropagation(),we(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
86
+ /* @__PURE__ */W("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=U(K,e.name),r=U(K,t),n=await ye(`${H}/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})`)}ke(K)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
87
+ /* @__PURE__ */W("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=U(K,e.name),a=await ye(`${H}/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})`)}ke(K)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),re&&/* @__PURE__ */W("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__ */W("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{H as default};
@@ -0,0 +1,25 @@
1
+ import{getNumberingConfigs as e}from"./chunk-2DX65GOO.js";import{SidebarLayout as t}from"./chunk-PE4F4MJE.js";import{AboutApp as r}from"./chunk-MSIN5HKX.js";import{useWindowManager as n,client_default as o}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-OD5KLVU5.js";import{toast_default as i}from"./chunk-3DGTIWZP.js";import{useShellPrefs as a}from"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{AddFallback as l,BookmarkFallback as s,BookmarkFallbackB as c,TrashFallback as d,PageFallback as p,CheckFallback as m}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{timeAgo as u}from"./chunk-W32SKK3D.js";import{Icon as h}from"./chunk-YKZHOXI4.js";import{useRef as y,useEffect as g,useState as x,useCallback as b}from"react";import{useQuery as f}from"@tanstack/react-query";import{jsxs as k,Fragment as v,jsx as N}from"react/jsx-runtime";var w=[{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 _={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/"}},T=/\[([ xX]?)\]/g;function j(){const{openEntity:j}=n(),{prefs:W,save:$}=a(),{data:C}=f({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),S=y({});g(()=>{if(!C)return;const e={};for(const t of C){const r=_[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})}}S.current=e},[C]);const X=W.notepad_notes||[],[I,O]=x(null),[D,H]=x(""),[K,P]=x(""),[U,Z]=x("yellow"),[F,M]=x(!1),[q,J]=x(!1),L=y(null),E=y(),Q=X.find(e=>e.id===I);g(()=>{if(!I&&X.length>0){const e=X[0];O(e.id),H(e.title),P(e.content),Z(e.color)}},[X.length]);const R=b(e=>{$({notepad_notes:e})},[$]),V=b(()=>{if(!I||!F)return;const e=X.map(e=>e.id===I?{...e,title:D,content:K,color:U,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);R(e),M(!1)},[I,F,D,K,U,X,R]);g(()=>{if(F)return E.current&&clearTimeout(E.current),E.current=setTimeout(V,800),()=>{E.current&&clearTimeout(E.current)}},[F,V]),g(()=>()=>{F&&V()},[]);const A=e=>{F&&V(),O(e.id),H(e.title),P(e.content),Z(e.color),M(!1),J(!1)},G=e=>{const t=K.slice(0,e),r=K.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=K.slice(e+r[0].length);P(t+n+o),M(!0)},B=async(e,t)=>{const r=S.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?j(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},z="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.)",Y=/* @__PURE__ */k(v,{children:[
2
+ /* @__PURE__ */N("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */k("button",{onClick:()=>{F&&V();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,...X];R(t),O(e.id),H(""),P(""),Z("yellow"),M(!1),J(!0),setTimeout(()=>L.current?.focus(),50)},className:"w-full flex items-center justify-center gap-1.5 rounded-lg bg-blue-600 text-white px-3 py-1.5 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
3
+ /* @__PURE__ */N(h,{name:"add",fallback:l,className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
+ /* @__PURE__ */N("div",{className:"flex-1 overflow-y-auto",children:0===X.length?/* @__PURE__ */N("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):X.map(e=>{const t=(r=e.color,w.find(e=>e.key===r)||w[0]);var r;/* @__PURE__ */
5
+ return k("button",{onClick:()=>A(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(I===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
6
+ /* @__PURE__ */k("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */N("div",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${t.dot}`}),
8
+ /* @__PURE__ */N("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */N(h,{name:"bookmark",fallback:s,className:"h-3 w-3 text-amber-500 shrink-0"})]}),
9
+ /* @__PURE__ */N("p",{className:"text-xs text-gray-400 mt-0.5 truncate ml-4.5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
+ /* @__PURE__ */N("p",{className:"text-[10px] text-gray-300 mt-0.5 ml-4.5",children:u(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
+ return k("div",{className:"h-full",children:[
12
+ /* @__PURE__ */N(r,{app:"notepad"}),
13
+ /* @__PURE__ */N(t,{sidebar:Y,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:I?/* @__PURE__ */k("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
+ /* @__PURE__ */k("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
+ /* @__PURE__ */N("input",{value:D,onChange:e=>{H(e.target.value),M(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */N("div",{className:"flex gap-1",children:w.map(e=>/* @__PURE__ */N("button",{onClick:()=>{Z(e.key),M(!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__ */N("button",{onClick:()=>(e=>{const t=X.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);R(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(I),title:Q?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(Q?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */N(h,{name:"bookmark",fallback:c,className:"h-4 w-4",fill:Q?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
+ /* @__PURE__ */N("button",{onClick:()=>(e=>{const t=X.filter(t=>t.id!==e);if(R(t),I===e){const e=t[0];e?A(e):(O(null),H(""),P(""))}})(I),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */N(h,{name:"trash",fallback:d,className:"h-4 w-4",strokeWidth:1.5})})]}),q?/* @__PURE__ */N("textarea",{ref:L,value:K,onChange:e=>{P(e.target.value),M(!0)},onBlur:()=>{J(!1),F&&V()},placeholder:z,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__ */N("div",{onClick:()=>{J(!0),setTimeout(()=>L.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:K?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],a=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=a.exec(e));){const e=l[1],t=l[2];if(S.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */N("button",{onClick:()=>B(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}T.lastIndex=0;let s=0;for(let e=0;e<r;e++)s+=t[e].length+1;for(;null!==(l=T.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=s+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */N("button",{onClick:()=>G(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__ */N(h,{name:"check",fallback:m,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__ */N("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__ */N("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */N("span",{children:"​"},`empty-${r}`));const c=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
+ return N("div",{className:c?"line-through text-gray-400":"",children:n},r)})})(K):/* @__PURE__ */N("p",{className:"text-gray-300 whitespace-pre-line",children:z})}),
20
+ /* @__PURE__ */k("div",{className:"px-4 py-1.5 border-t border-gray-100 flex items-center gap-4 text-[10px] text-gray-400",children:[
21
+ /* @__PURE__ */N("span",{children:"[] checkbox"}),
22
+ /* @__PURE__ */N("span",{children:"SO#35001 entity link"}),
23
+ /* @__PURE__ */N("span",{className:"ml-auto",children:q?"Editing":"Click to edit"})]})]}):/* @__PURE__ */N("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */k("div",{className:"text-center text-gray-400",children:[
24
+ /* @__PURE__ */N(h,{name:"page",fallback:p,className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
25
+ /* @__PURE__ */N("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{j as default};
@@ -0,0 +1 @@
1
+ export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-QRV7RNQX.js";import"./chunk-3DGTIWZP.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";
@@ -0,0 +1,91 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-MIAJQGWE.js";import{subscribePomo as a,getPomoSnapshot as o,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as l,setPomoBehaviour as s,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as b}from"./chunk-5IWSOLLY.js";import{useWidgetSettings as k}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-3DGTIWZP.js";import{useShellPrefs as x}from"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{MoreVerticalFallback as v,AddCircleFallback as y,ChevronDownFallbackC as N}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as w}from"./chunk-YKZHOXI4.js";import{useSyncExternalStore as C,useEffect as S,useMemo as B,useState as M,useRef as T,useCallback as j}from"react";import{jsxs as I,Fragment as P,jsx as A}from"react/jsx-runtime";var L="pomodoro_appearance",$="pomodoro_active_task_id",D={focus:"Pomodoro",short:"Short Break",long:"Long Break"},V={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var W=25,_=5,F=15,O=!1,R=!1,H=4,E=!0,Z=!0,J="bell",U=100,K=1,Q="none",X=50,z=(e,t,a,o)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(a,Math.round(e))):o;function G(){const t=C(a,o,o),{prefs:g,save:b}=x(),N=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:z(t.focusMinutes,1,120,W),shortBreakMinutes:z(t.shortBreakMinutes,1,120,_),longBreakMinutes:z(t.longBreakMinutes,1,120,F),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:O,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:R,longBreakInterval:z(t.longBreakInterval,1,20,H),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:E,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:Z,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:J,alarmVolume:z(t.alarmVolume,0,100,U),alarmRepeat:z(t.alarmRepeat,1,5,K),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:Q,focusVolume:z(t.focusVolume,0,100,X)}}(g.pomodoro_settings);S(()=>{n({focus:60*N.focusMinutes,short:60*N.shortBreakMinutes,long:60*N.longBreakMinutes})},[N.focusMinutes,N.shortBreakMinutes,N.longBreakMinutes]),S(()=>{r(N.alarmSound),l(N.alarmVolume,N.alarmRepeat)},[N.alarmSound,N.alarmVolume,N.alarmRepeat]),S(()=>{s({autoStartBreaks:N.autoStartBreaks,autoStartPomodoros:N.autoStartPomodoros,longBreakInterval:N.longBreakInterval})},[N.autoStartBreaks,N.autoStartPomodoros,N.longBreakInterval]),S(()=>{i(N.focusSound,N.focusVolume)},[N.focusSound,N.focusVolume]),S(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const G=c(),q=G.tasks,ee=B(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),te=function(e,t){return B(()=>t?(e=>{const t=[],a=[];for(const o of e)(o.done?a:t).push(o);return[...t,...a]})(e):e,[e,t])}(B(()=>q.filter(e=>!!e.dueDate&&(e.dueDate===ee||e.dueDate<ee&&!e.done)),[q,ee]),N.checkToBottom),[ae,oe]=M(()=>localStorage.getItem($)),[ne,re]=M(!1),[le,se]=M(null),ie=T(!1);S(()=>{ie.current||(ie.current=!0,d(q,G.setAllTasks))},[]),S(()=>{try{ae?localStorage.setItem($,ae):localStorage.removeItem($)}catch{}},[ae]),S(()=>{if(!le)return;const e=()=>se(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[le]);const ce=T(t.streak);S(()=>{if(t.streak>ce.current&&ae){const e=q.find(e=>e.id===ae);if(e){const t=(e.completed??0)+1,a=e.estimated??0,o=N.autoCheckTasks&&a>0&&t>=a;G.updateTask(ae,{completed:t,done:e.done||o})}}ce.current=t.streak},[t.streak,ae,N.autoCheckTasks,q,G]);const ue=te.reduce((e,t)=>e+(t.completed??0),0),me=te.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),he=te.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),pe=t.running&&"focus"===t.mode?t.remaining:0,ge=he*N.focusMinutes*60+pe,fe=new Date(Date.now()+1e3*ge).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),be=(ge/3600).toFixed(1),ke=ae?q.find(e=>e.id===ae)??null:null,xe=String(Math.floor(t.remaining/60)).padStart(2,"0"),ve=String(t.remaining%60).padStart(2,"0"),[ye,Ne]=M(()=>e(L)),[we,Ce]=M(!1),[Se,Be]=M(ye),[Me,Te]=M(N);k(j(()=>{Be({...ye}),Te({...N}),Ce(!0)},[ye,N]));const je="focus"!==t.mode,Ie=V[t.mode],Pe=je?(Ae=Ie,Le=ye.activeOpacity/100,`rgba(${parseInt(Ae.slice(1,3),16)}, ${parseInt(Ae.slice(3,5),16)}, ${parseInt(Ae.slice(5,7),16)}, ${Le})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${ye.activeOpacity/100})`;var Ae,Le;const $e={primary:je?"text-white":"text-gray-900",secondary:je?"text-white/85":"text-gray-700",muted:je?"text-white/65":"text-gray-500",tabActive:je?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:je?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:je?"border-white/30":"border-gray-200",softDivider:je?"border-white/20":"border-gray-200",iconBtn:je?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:je?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},De=je?Ie:"#0f172a";/* @__PURE__ */
2
+ return I(P,{children:[
3
+ /* @__PURE__ */I("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${$e.primary}`,style:{backgroundColor:Pe,backdropFilter:ye.activeBlur>0?`blur(${ye.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */A("div",{className:"px-3 pt-3 flex justify-center gap-1.5",children:["focus","short","long"].map(e=>/* @__PURE__ */A("button",{onClick:()=>u(e),className:`px-2.5 py-1 text-[13px] font-bold rounded transition-colors ${t.mode===e?$e.tabActive:$e.tabInactive}`,children:D[e]},e))}),
5
+ /* @__PURE__ */I("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[xe,":",ve]}),
6
+ /* @__PURE__ */A("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */A("button",{onClick:()=>t.running?m():h(),className:"bg-white px-12 py-2.5 rounded-md font-bold text-base shadow-[0_4px_0_rgba(0,0,0,0.12)] hover:shadow-[0_3px_0_rgba(0,0,0,0.12)] active:translate-y-1 active:shadow-none transition-all",style:{color:De,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
7
+ /* @__PURE__ */A("div",{className:"px-3 py-3 text-center",children:ke?/* @__PURE__ */I(P,{children:[
8
+ /* @__PURE__ */I("div",{className:`text-xs leading-tight ${$e.muted}`,children:["#",(ke.completed??0)+1]}),
9
+ /* @__PURE__ */A("div",{className:`text-[15px] font-medium leading-tight truncate mt-0.5 ${$e.primary}`,children:ke.name})]}):/* @__PURE__ */A("div",{className:`text-xs italic ${$e.muted}`,children:"No task selected"})}),
10
+ /* @__PURE__ */I("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
11
+ /* @__PURE__ */A("h3",{className:`text-base font-bold tracking-tight ${$e.primary}`,children:"Tasks"}),
12
+ /* @__PURE__ */A("button",{className:`rounded p-1 transition-colors ${$e.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */A(w,{name:"more-vertical",fallback:v,className:"h-4 w-4"})})]}),
13
+ /* @__PURE__ */A("div",{className:`border-t mx-3 mt-2 ${$e.divider}`}),
14
+ /* @__PURE__ */I("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[te.map(e=>{const t=e.id===ae;/* @__PURE__ */
15
+ return I("div",{onClick:()=>oe(e.id),className:"bg-white text-gray-800 rounded-md flex items-center pr-2 py-2.5 shadow-sm cursor-pointer transition-shadow hover:shadow-md "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
16
+ /* @__PURE__ */A("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,G.toggleDone(a)},className:"shrink-0",children:e.done?/* @__PURE__ */A("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:De},children:/* @__PURE__ */A("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */A("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */A("circle",{cx:"12",cy:"12",r:"10"})})}),
17
+ /* @__PURE__ */A("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
18
+ /* @__PURE__ */I("span",{className:"text-sm tabular-nums mr-1.5 shrink-0",children:[
19
+ /* @__PURE__ */A("span",{className:"font-bold text-gray-500",children:e.completed??0}),
20
+ /* @__PURE__ */A("span",{className:"text-gray-400",children:" / "}),
21
+ /* @__PURE__ */A("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
+ /* @__PURE__ */I("div",{className:"relative",children:[
23
+ /* @__PURE__ */A("button",{onClick:t=>{t.stopPropagation(),se(le===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */A(w,{name:"more-vertical",fallback:v,className:"h-4 w-4 text-gray-500"})}),le===e.id&&/* @__PURE__ */A("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */A("button",{onClick:t=>{var a;t.stopPropagation(),a=e.id,G.removeTask(a),ae===a&&oe(null),se(null)},className:"block w-full px-3 py-1.5 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),ne?/* @__PURE__ */A(de,{onSubmit:(e,t)=>{const a=e.trim();if(!a)return;const o=G.addTask({name:a,estimated:t,completed:0,dueDate:ee});ae||oe(o),re(!1)},onCancel:()=>re(!1),accentColor:De}):/* @__PURE__ */I("button",{onClick:()=>re(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${$e.addTaskBtn}`,children:[
24
+ /* @__PURE__ */A(w,{name:"add-circle",fallback:y,className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
+ /* @__PURE__ */I("div",{className:`border-t px-3 py-2.5 flex items-center justify-center gap-5 text-sm ${$e.softDivider}`,children:[
26
+ /* @__PURE__ */I("span",{className:$e.secondary,children:["Pomos: ",
27
+ /* @__PURE__ */A("span",{className:`font-bold ${$e.primary}`,children:ue}),
28
+ /* @__PURE__ */A("span",{className:$e.muted,children:" / "}),
29
+ /* @__PURE__ */A("span",{className:`font-bold ${$e.primary}`,children:me})]}),ge>0&&/* @__PURE__ */I("span",{className:$e.secondary,children:["Finish At: ",
30
+ /* @__PURE__ */A("span",{className:`font-bold ${$e.primary}`,children:fe}),
31
+ /* @__PURE__ */I("span",{className:$e.muted,children:[" (",be,"h)"]})]})]})]}),
32
+ /* @__PURE__ */A(Y,{open:we,onClose:()=>Ce(!1),onSave:()=>{Ne(Se),localStorage.setItem(L,JSON.stringify(Se)),b({pomodoro_settings:Me}),Ce(!1)},configAppearance:Se,setConfigAppearance:Be,configPrefs:Me,setConfigPrefs:Te})]})}function Y({open:e,onClose:a,onSave:o,configAppearance:n,setConfigAppearance:r,configPrefs:l,setConfigPrefs:s}){const i=(e,t)=>s(a=>({...a,[e]:t}));/* @__PURE__ */
33
+ return I(t,{open:e,onClose:a,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:o,children:[
34
+ /* @__PURE__ */I(q,{icon:/* @__PURE__ */A(se,{}),label:"TIMER",children:[
35
+ /* @__PURE__ */I("div",{children:[
36
+ /* @__PURE__ */A("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
37
+ /* @__PURE__ */I("div",{className:"grid grid-cols-3 gap-3",children:[
38
+ /* @__PURE__ */A(ae,{label:"Pomodoro",value:l.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
39
+ /* @__PURE__ */A(ae,{label:"Short Break",value:l.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
40
+ /* @__PURE__ */A(ae,{label:"Long Break",value:l.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
41
+ /* @__PURE__ */A(ee,{label:"Auto Start Breaks",children:/* @__PURE__ */A(re,{checked:l.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
42
+ /* @__PURE__ */A(ee,{label:"Auto Start Pomodoros",children:/* @__PURE__ */A(re,{checked:l.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
43
+ /* @__PURE__ */A(ee,{label:"Long Break interval",children:/* @__PURE__ */A(oe,{value:l.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
+ /* @__PURE__ */I(q,{icon:/* @__PURE__ */A(ie,{}),label:"TASK",children:[
45
+ /* @__PURE__ */A(ee,{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__ */A(re,{checked:l.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
46
+ /* @__PURE__ */A(ee,{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__ */A(re,{checked:l.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
47
+ /* @__PURE__ */I(q,{icon:/* @__PURE__ */A(ce,{}),label:"SOUND",children:[
48
+ /* @__PURE__ */A(ee,{label:"Alarm Sound",children:/* @__PURE__ */I("div",{className:"flex items-center gap-2",children:[
49
+ /* @__PURE__ */A(ne,{value:l.alarmSound,onChange:e=>i("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==l.alarmSound&&/* @__PURE__ */A("button",{type:"button",onClick:()=>g(l.alarmSound,{volume:l.alarmVolume,repeat:1}),className:"px-2 py-1 text-[11px] rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
50
+ /* @__PURE__ */A(te,{value:l.alarmVolume,onChange:e=>i("alarmVolume",e)}),
51
+ /* @__PURE__ */A(ee,{label:"repeat",children:/* @__PURE__ */A(oe,{value:l.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
+ /* @__PURE__ */A(ee,{label:"Focus Sound",children:/* @__PURE__ */I("div",{className:"flex items-center gap-2",children:[
53
+ /* @__PURE__ */A(ne,{value:l.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==l.focusSound&&/* @__PURE__ */A("button",{type:"button",onClick:()=>b(l.focusSound,l.focusVolume),className:"px-2 py-1 text-[11px] rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
54
+ /* @__PURE__ */A(te,{value:l.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function q({icon:e,label:t,children:a}){/* @__PURE__ */
55
+ return I("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
+ /* @__PURE__ */I("div",{className:"flex items-center gap-1.5 mb-3 text-gray-400",children:[e,
57
+ /* @__PURE__ */A("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
+ /* @__PURE__ */A("div",{className:"space-y-3",children:a})]})}function ee({label:e,info:t,children:a}){/* @__PURE__ */
59
+ return I("div",{className:"flex items-center justify-between gap-3",children:[
60
+ /* @__PURE__ */I("div",{className:"flex items-center gap-1.5 min-w-0",children:[
61
+ /* @__PURE__ */A("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */A(le,{title:t})]}),
62
+ /* @__PURE__ */A("div",{className:"shrink-0",children:a})]})}function te({value:e,onChange:t}){/* @__PURE__ */
63
+ return I("div",{className:"flex items-center justify-end gap-3",children:[
64
+ /* @__PURE__ */A("span",{className:"text-xs text-gray-400 w-7 text-right tabular-nums",children:e}),
65
+ /* @__PURE__ */A("input",{type:"range",min:0,max:100,value:e,onChange:e=>t(parseInt(e.target.value,10)),className:"w-40 accent-blue-500"})]})}function ae({label:e,value:t,onChange:a,min:o=1,max:n=99}){/* @__PURE__ */
66
+ return I("label",{className:"flex flex-col",children:[
67
+ /* @__PURE__ */A("span",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),
68
+ /* @__PURE__ */A(oe,{value:t,onChange:a,min:o,max:n})]})}function oe({value:e,onChange:t,min:a=1,max:o=99,className:n=""}){/* @__PURE__ */
69
+ return A("input",{type:"number",min:a,max:o,value:e,onChange:e=>t(Math.max(a,Math.min(o,parseInt(e.target.value,10)||a))),className:`bg-gray-100 border-0 rounded-md px-2 py-1.5 text-sm font-medium text-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 w-full ${n}`})}function ne({value:e,onChange:t,options:a}){/* @__PURE__ */
70
+ return I("div",{className:"relative",children:[
71
+ /* @__PURE__ */A("select",{value:e,onChange:e=>t(e.target.value),className:"appearance-none bg-gray-100 border-0 rounded-md pl-3 pr-8 py-1.5 text-sm font-medium text-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer",children:a.map(e=>/* @__PURE__ */A("option",{value:e.id,children:e.label},e.id))}),
72
+ /* @__PURE__ */A(w,{name:"chevron-down",fallback:N,className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-400 pointer-events-none",strokeWidth:2.5})]})}function re({checked:e,onChange:t}){/* @__PURE__ */
73
+ return A("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(e?"bg-emerald-500":"bg-gray-300"),children:/* @__PURE__ */A("span",{className:"absolute h-5 w-5 rounded-full bg-white shadow transition-transform "+(e?"translate-x-[22px]":"translate-x-0.5")})})}function le({title:e}){/* @__PURE__ */
74
+ return A("span",{title:e,className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-white text-[10px] font-bold cursor-help",children:"i"})}function se(){/* @__PURE__ */
75
+ return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
76
+ /* @__PURE__ */A("circle",{cx:"12",cy:"12",r:"9"}),
77
+ /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]})}function ie(){/* @__PURE__ */
78
+ return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
79
+ /* @__PURE__ */A("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),
80
+ /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function ce(){/* @__PURE__ */
81
+ return I("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
82
+ /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
83
+ /* @__PURE__ */A("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function de({onSubmit:e,onCancel:t,accentColor:a}){const[o,n]=M(""),[r,l]=M(1),s=()=>e(o,r);/* @__PURE__ */
84
+ return I("div",{className:"bg-white text-gray-800 rounded-md p-3 shadow-md",children:[
85
+ /* @__PURE__ */A("input",{autoFocus:!0,value:o,onChange:e=>n(e.target.value),placeholder:"What are you working on?",onKeyDown:e=>{"Enter"===e.key&&s(),"Escape"===e.key&&t()},className:"w-full text-base font-medium bg-transparent border-0 outline-none placeholder-gray-400"}),
86
+ /* @__PURE__ */I("div",{className:"flex items-center justify-between mt-2",children:[
87
+ /* @__PURE__ */A("span",{className:"text-xs font-semibold text-gray-500",children:"Est Pomodoros"}),
88
+ /* @__PURE__ */A("input",{type:"number",min:1,max:20,value:r,onChange:e=>l(Math.max(1,Math.min(20,parseInt(e.target.value,10)||1))),className:"w-16 bg-gray-100 rounded px-2 py-1 text-sm text-right border-0 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),
89
+ /* @__PURE__ */I("div",{className:"flex gap-2 mt-3 justify-end",children:[
90
+ /* @__PURE__ */A("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
91
+ /* @__PURE__ */A("button",{onClick:s,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:a},children:"Save"})]})]})}export{G as default};