efficient-shell 8.38.0 → 8.39.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 (45) hide show
  1. package/README.md +2 -2
  2. package/dist/{Browser-5TOAZTHJ.js → Browser-BIGK2F75.js} +14 -14
  3. package/dist/{Calculator-I4P2BWR7.js → Calculator-7O7HXEKH.js} +23 -23
  4. package/dist/{CurrencyConverter-K2IIOVHM.js → CurrencyConverter-IVJJCYZ7.js} +9 -9
  5. package/dist/{Documents-IYGZXCU2.js → Documents-UHTD6M24.js} +17 -17
  6. package/dist/{Files-EMPEGBMQ.js → Files-PWYUTAQW.js} +19 -19
  7. package/dist/{Notepad-VYJZ2XA4.js → Notepad-54N54RYN.js} +9 -9
  8. package/dist/{PomodoroTimer-BEVXP5KG.js → PomodoroTimer-ZCJBTFV5.js} +12 -12
  9. package/dist/{Preview-AVQQI32Z.js → Preview-3LOY6L4G.js} +20 -20
  10. package/dist/{Spreadsheet-EM6OOJ6I.js → Spreadsheet-ANBJSAHB.js} +12 -12
  11. package/dist/{Stock-YJNQMFSV.js → Stock-PHY6Z26A.js} +1 -1
  12. package/dist/{Weather-XDT4ZEHN.js → Weather-YQA5CAFQ.js} +14 -14
  13. package/dist/{WorldClock-7PTVRQ2A.js → WorldClock-J6L7FWI2.js} +6 -6
  14. package/dist/apps/index.js +1 -1
  15. package/dist/bin/media-host-check.js +1 -1
  16. package/dist/bin/ui-check.js +1 -1
  17. package/dist/chunk-5JYBYMZT.js +29 -0
  18. package/dist/chunk-EEHK4IIK.js +14 -0
  19. package/dist/{chunk-J7FZAOKT.js → chunk-EGDJEY4K.js} +18 -18
  20. package/dist/{chunk-MGXE75N5.js → chunk-EIWTOEWV.js} +1 -1
  21. package/dist/{chunk-TZMJEOZA.js → chunk-GCGKPDPN.js} +1 -1
  22. package/dist/chunk-GNPTNAZH.js +4 -0
  23. package/dist/{chunk-RJ4KZGAT.js → chunk-KJY57QPT.js} +23 -23
  24. package/dist/{chunk-K52WWA5G.js → chunk-QDLGU62M.js} +1 -1
  25. package/dist/{chunk-WIW2547G.js → chunk-U4BMS5EV.js} +1 -1
  26. package/dist/chunk-UJOWORTR.js +1 -0
  27. package/dist/forms/MediaLibrary.d.ts +31 -1
  28. package/dist/forms/MediaLibrary.js +1 -1
  29. package/dist/forms/MediaUploadGrid.d.ts +7 -1
  30. package/dist/forms/MediaUploadGrid.js +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.js +84 -84
  33. package/dist/page-tabs/index.js +5 -5
  34. package/dist/shell/ConfirmDialog.js +1 -1
  35. package/dist/shell/Dialog.d.ts +13 -3
  36. package/dist/shell/Dialog.js +1 -1
  37. package/dist/telemetry/index.js +1 -1
  38. package/dist/ui/index.d.ts +1 -1
  39. package/dist/ui/index.js +1 -1
  40. package/dist/version.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-LSISFKKS.js +0 -14
  43. package/dist/chunk-NLWS7HMX.js +0 -29
  44. package/dist/chunk-O4Q475GF.js +0 -1
  45. package/dist/chunk-SG3ILR7W.js +0 -4
@@ -1,20 +1,20 @@
1
- import{openPreviewFile as e}from"./chunk-ZTB6EMC7.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{Breadcrumbs as r}from"./chunk-6SMQNPWS.js";import{formatBytes as a}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as n}from"./chunk-TGLHJS3M.js";import{AboutApp as s}from"./chunk-MGXE75N5.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-GSBIJLTD.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-RJ4KZGAT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import{confirm as g,prompt as y}from"./chunk-J7FZAOKT.js";import"./chunk-SG3ILR7W.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as b}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-O4Q475GF.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as k}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as N}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as w}from"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as v,useEffect as j,useSyncExternalStore as $,useRef as C,useCallback as T}from"react";import{jsxs as D,jsx as L,Fragment as E}from"react/jsx-runtime";var R="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",W={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 S(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function M(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function F(){const F=R.replace(/\/$/,""),P=null!==n(),[I,O]=v("/"),[A,U]=v([]),[J,G]=v([]),[V,K]=v(null),[B,Q]=v(!0),[H,X]=v(!1),[z,Z]=v(null),[_,Y]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});j(()=>{o()},[]);const[te,re]=v([]);j(()=>{const e=()=>{o(),ee("trash")},t=e=>{o();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const ae=$(d,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?ae?.folders.find(e=>e.id===ne)??null:null,ie=ne&&ae?.itemsByFolder[ne]||[];j(()=>{ne&&ae&&!ae.folders.some(e=>e.id===ne)&&ee("files")},[ne,ae]);const oe=C(0),le=C(null),{openPage:ce,openEntity:de}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ce(e)}):"page"===t.entityType?ce(t.entityId):de(t.entityType,t.entityId,null,t.label)},he=T((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=T(async()=>{try{const e=await he(`${F}/api/quota`);if(e.ok){const t=await e.json();Z({used:t.used,limit:t.limit})}}catch{}},[he,F]),ue=T(async e=>{if(K(null),P){const t=function(e){const t=n();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return U(t),O(e),X(!1),Q(!1),void("/"===e&&G(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Q(!0);try{const t=await he(`${F}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];U(a),O(r.path||e),X(!1),"/"===(r.path||e)&&G(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){X(!0)}finally{Q(!1)}pe()},[he,F,pe,P]),fe=T(async()=>{if(P)return re([]),void Q(!1);Q(!0),K(null);try{const e=await he(`${F}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();re(t.entries||[]),X(!1)}catch{X(!0)}finally{Q(!1)}pe()},[he,F,pe,P]);j(()=>{"files"===q?ue(I):"trash"===q&&fe()},[I,q]);const xe=async e=>{const t=S(I,e.name);try{const r=await he(`${F}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void b.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){b.error(e?.message||"Download failed")}},ge=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await he(`${F}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));b.error(`Quota exceeded — ${a(r)} free, ${e.name} is ${a(t.attempted||e.size)}`)}else b.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){b.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(I)},ye=()=>{oe.current=0,Y(!1)};if(j(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),H)/* @__PURE__ */
1
+ import{openPreviewFile as e}from"./chunk-ZTB6EMC7.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{Breadcrumbs as r}from"./chunk-6SMQNPWS.js";import{formatBytes as a}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as n}from"./chunk-TGLHJS3M.js";import{AboutApp as s}from"./chunk-EIWTOEWV.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-GSBIJLTD.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import{confirm as g,prompt as y}from"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as b}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-UJOWORTR.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as k}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as N}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as w}from"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useState as v,useEffect as j,useSyncExternalStore as $,useRef as C,useCallback as T}from"react";import{jsxs as D,jsx as L,Fragment as E}from"react/jsx-runtime";var R="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",W={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 S(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function M(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 P(){const P=R.replace(/\/$/,""),F=null!==n(),[I,O]=v("/"),[U,A]=v([]),[J,V]=v([]),[K,B]=v(null),[G,Q]=v(!0),[H,z]=v(!1),[X,Z]=v(null),[_,Y]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});j(()=>{o()},[]);const[te,re]=v([]);j(()=>{const e=()=>{o(),ee("trash")},t=e=>{o();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const ae=$(d,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?ae?.folders.find(e=>e.id===ne)??null:null,ie=ne&&ae?.itemsByFolder[ne]||[];j(()=>{ne&&ae&&!ae.folders.some(e=>e.id===ne)&&ee("files")},[ne,ae]);const oe=C(0),le=C(null),{openPage:ce,openEntity:de}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ce(e)}):"page"===t.entityType?ce(t.entityId):de(t.entityType,t.entityId,null,t.label)},he=T((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=T(async()=>{try{const e=await he(`${P}/api/quota`);if(e.ok){const t=await e.json();Z({used:t.used,limit:t.limit})}}catch{}},[he,P]),ue=T(async e=>{if(B(null),F){const t=function(e){const t=n();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return A(t),O(e),z(!1),Q(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Q(!0);try{const t=await he(`${P}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];A(a),O(r.path||e),z(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){z(!0)}finally{Q(!1)}pe()},[he,P,pe,F]),fe=T(async()=>{if(F)return re([]),void Q(!1);Q(!0),B(null);try{const e=await he(`${P}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();re(t.entries||[]),z(!1)}catch{z(!0)}finally{Q(!1)}pe()},[he,P,pe,F]);j(()=>{"files"===q?ue(I):"trash"===q&&fe()},[I,q]);const xe=async e=>{const t=S(I,e.name);try{const r=await he(`${P}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void b.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){b.error(e?.message||"Download failed")}},ge=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await he(`${P}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));b.error(`Quota exceeded — ${a(r)} free, ${e.name} is ${a(t.attempted||e.size)}`)}else b.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){b.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(I)},ye=()=>{oe.current=0,Y(!1)};if(j(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),H)/* @__PURE__ */
2
2
  return D("div",{className:"flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */L(x,{title:"Files - offline"}),
4
4
  /* @__PURE__ */L("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */D("div",{className:"max-w-md",children:[
5
5
  /* @__PURE__ */L(k,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
6
  /* @__PURE__ */L("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
7
  /* @__PURE__ */D("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
- /* @__PURE__ */L("span",{className:"font-mono",children:F}),". Make sure the server is running — see ",
8
+ /* @__PURE__ */L("span",{className:"font-mono",children:P}),". Make sure the server is running — see ",
9
9
  /* @__PURE__ */L("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
- /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===I?[]:I.split("/").filter(Boolean),ke=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>O("/")},...be.map((e,t)=>({label:e,onClick:()=>O("/"+be.slice(0,t+1).join("/"))}))],ve=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),je=e=>/* @__PURE__ */L("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__ */L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),$e=/* @__PURE__ */D("nav",{className:"p-2",children:[
10
+ /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===I?[]:I.split("/").filter(Boolean),ke=X&&X.limit>0?Math.min(100,Math.round(X.used/X.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>O("/")},...be.map((e,t)=>({label:e,onClick:()=>O("/"+be.slice(0,t+1).join("/"))}))],ve=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),je=e=>/* @__PURE__ */L("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__ */L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),$e=/* @__PURE__ */D("nav",{className:"p-2",children:[
11
11
  /* @__PURE__ */L("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
12
  /* @__PURE__ */D("button",{onClick:()=>{ee("files"),O("/")},className:ve("files"===q&&"/"===I),children:[je("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"]}),J.map(e=>/* @__PURE__ */D("button",{onClick:()=>{ee("files"),O("/"+e)},className:ve("files"===q&&I==="/"+e),children:[je("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__ */L("span",{className:"truncate",children:e})]},e)),!P&&/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[je("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"]}),ae&&ae.folders.length>0&&/* @__PURE__ */D(E,{children:[
13
+ /* @__PURE__ */L("span",{className:"truncate",children:e})]},e)),!F&&/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[je("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"]}),ae&&ae.folders.length>0&&/* @__PURE__ */D(E,{children:[
14
14
  /* @__PURE__ */L("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ae.folders.map(e=>/* @__PURE__ */D("button",{onClick:()=>ee({desktopFolderId:e.id}),className:ve(ne===e.id),children:[
15
15
  /* @__PURE__ */L(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
16
  /* @__PURE__ */L("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */L("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
- return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{P||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),oe.current++,_||Y(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{oe.current>0&&oe.current--,0===oe.current&&Y(!1)},onDrop:e=>{e.preventDefault(),ye(),P||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
17
+ return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{F||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),oe.current++,_||Y(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{oe.current>0&&oe.current--,0===oe.current&&Y(!1)},onDrop:e=>{e.preventDefault(),ye(),F||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
18
18
  /* @__PURE__ */L(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
19
19
  /* @__PURE__ */L(s,{app:"files"}),
20
20
  /* @__PURE__ */L("input",{ref:le,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ge(e.target.files),le.current&&(le.current.value="")}}),
@@ -22,32 +22,32 @@ return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
22
22
  /* @__PURE__ */D("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */D(E,"files"===q?{children:[
23
23
  /* @__PURE__ */L("button",{onClick:()=>O(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(I)),disabled:"/"===I,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
24
24
  /* @__PURE__ */L("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */L(r,{items:we,maxItems:5})}),
25
- /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!P&&/* @__PURE__ */D(E,{children:[
25
+ /* @__PURE__ */L("button",{onClick:()=>ue(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!F&&/* @__PURE__ */D(E,{children:[
26
26
  /* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
27
27
  /* @__PURE__ */L(k,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
- /* @__PURE__ */D("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void b.error("Folder names cannot contain slashes");const t=S(I,e),r=await he(`${F}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Create folder failed (${r.status})`)}ue(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
28
+ /* @__PURE__ */D("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void b.error("Folder names cannot contain slashes");const t=S(I,e),r=await he(`${P}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Create folder failed (${r.status})`)}ue(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
29
  /* @__PURE__ */L(k,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
30
  /* @__PURE__ */D("button",{onClick:()=>le.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
31
31
  /* @__PURE__ */L(k,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===q?{children:[
32
32
  /* @__PURE__ */L("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
33
33
  /* @__PURE__ */L("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
34
  /* @__PURE__ */L("button",{onClick:fe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */L(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
- /* @__PURE__ */L("button",{onClick:async()=>{if(0===te.length)return;if(!await g({title:"Empty trash",message:`${te.length} item${1===te.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await he(`${F}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Empty trash failed (${e.status})`)}fe()},disabled:0===te.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:[
35
+ /* @__PURE__ */L("button",{onClick:async()=>{if(0===te.length)return;if(!await g({title:"Empty trash",message:`${te.length} item${1===te.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await he(`${P}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Empty trash failed (${e.status})`)}fe()},disabled:0===te.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
36
  /* @__PURE__ */L("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */L(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
37
37
  /* @__PURE__ */L(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
38
  /* @__PURE__ */L("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
39
- /* @__PURE__ */L("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),z&&/* @__PURE__ */D(E,{children:[
39
+ /* @__PURE__ */L("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),X&&/* @__PURE__ */D(E,{children:[
40
40
  /* @__PURE__ */L("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */D("div",{className:"flex items-center gap-2",title:`${a(z.used)} of ${a(z.limit)} used`,children:[
41
+ /* @__PURE__ */D("div",{className:"flex items-center gap-2",title:`${a(X.used)} of ${a(X.limit)} used`,children:[
42
42
  /* @__PURE__ */L("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */L("div",{className:`h-full ${Ne} transition-all`,style:{width:`${ke}%`}})}),
43
- /* @__PURE__ */D("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[a(z.used)," / ",a(z.limit)]})]})]})]}),
43
+ /* @__PURE__ */D("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[a(X.used)," / ",a(X.limit)]})]})]})]}),
44
44
  /* @__PURE__ */L("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ie.length?/* @__PURE__ */L("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__ */D("table",{className:"w-full text-sm",children:[
45
45
  /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
46
46
  /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
47
47
  /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
48
48
  /* @__PURE__ */L("th",{className:`${w} w-56`})]})}),
49
49
  /* @__PURE__ */L("tbody",{children:ie.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
50
- return D("tr",{onClick:()=>K(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(V===t?"bg-blue-50":"hover:bg-gray-50"),children:[
50
+ return D("tr",{onClick:()=>B(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(K===t?"bg-blue-50":"hover:bg-gray-50"),children:[
51
51
  /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:[
52
52
  /* @__PURE__ */L(p,{item:e}),
53
53
  /* @__PURE__ */L("span",{className:"truncate",title:e.label,children:e.label})]}),
@@ -55,7 +55,7 @@ return D("tr",{onClick:()=>K(t),onDoubleClick:()=>me(e),className:"cursor-defaul
55
55
  /* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
56
56
  /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),me(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
57
57
  /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Move to desktop"}),
58
- /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?B&&0===te.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
58
+ /* @__PURE__ */L("button",{onClick:t=>{t.stopPropagation(),ae?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?G&&0===te.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
59
59
  /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
60
60
  /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
61
61
  /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Original location"}),
@@ -69,19 +69,19 @@ return D("tr",{onClick:()=>K(t),onDoubleClick:()=>me(e),className:"cursor-defaul
69
69
  /* @__PURE__ */L("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:a(e.size)}),
70
70
  /* @__PURE__ */L("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?M(e.deletedAt):"—"}),
71
71
  /* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
72
- /* @__PURE__ */L("button",{onClick:()=>(async e=>{const t=await he(`${F}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Restore failed (${t.status})`)}b.success(`Restored "${e.name}"`),fe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
73
- /* @__PURE__ */L("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 he(`${F}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):B&&0===A.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===A.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!P&&/* @__PURE__ */D(E,{children:[" Drop files here or click ",
72
+ /* @__PURE__ */L("button",{onClick:()=>(async e=>{const t=await he(`${P}/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 b.error(e.error||`Restore failed (${t.status})`)}b.success(`Restored "${e.name}"`),fe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
73
+ /* @__PURE__ */L("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 he(`${P}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):G&&0===U.length?/* @__PURE__ */L(N,{size:"sm",padding:"p-6",label:"Loading"}):0===U.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!F&&/* @__PURE__ */D(E,{children:[" Drop files here or click ",
74
74
  /* @__PURE__ */L("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
75
75
  /* @__PURE__ */L("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
76
76
  /* @__PURE__ */L("th",{className:`${w} text-left font-medium px-3 h-8`,children:"Name"}),
77
77
  /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
78
78
  /* @__PURE__ */L("th",{className:`${w} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
79
79
  /* @__PURE__ */L("th",{className:`${w} w-32`})]})}),
80
- /* @__PURE__ */L("tbody",{children:A.map(t=>/* @__PURE__ */D("tr",{onClick:()=>K(t.name),onDoubleClick:()=>{"folder"===t.kind?O(S(I,t.name)):(async t=>{if(P)return;const r=S(I,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=W[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>ce(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(V===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
80
+ /* @__PURE__ */L("tbody",{children:U.map(t=>/* @__PURE__ */D("tr",{onClick:()=>B(t.name),onDoubleClick:()=>{"folder"===t.kind?O(S(I,t.name)):(async t=>{if(F)return;const r=S(I,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=W[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>ce(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(K===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
81
  /* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */L(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */L(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
82
  /* @__PURE__ */L("span",{className:"truncate",title:t.name,children:t.name})]}),
83
83
  /* @__PURE__ */L("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":a(t.size)}),
84
84
  /* @__PURE__ */L("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:M(t.modifiedAt)}),
85
- /* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!P&&/* @__PURE__ */D(E,{children:["file"===t.kind&&/* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),xe(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
86
- /* @__PURE__ */L("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 b.error("Names cannot contain slashes");const r=S(I,e.name),a=S(I,t),n=await he(`${F}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void b.error(e.error||`Rename failed (${n.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
87
- /* @__PURE__ */L("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=S(I,e.name),r=await he(`${F}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${r.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */L("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__ */L("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{F as default};
85
+ /* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!F&&/* @__PURE__ */D(E,{children:["file"===t.kind&&/* @__PURE__ */L("button",{onClick:e=>{e.stopPropagation(),xe(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
86
+ /* @__PURE__ */L("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 b.error("Names cannot contain slashes");const r=S(I,e.name),a=S(I,t),n=await he(`${P}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void b.error(e.error||`Rename failed (${n.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
87
+ /* @__PURE__ */L("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=S(I,e.name),r=await he(`${P}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${r.status})`)}ue(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */L("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__ */L("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{P as default};
@@ -1,8 +1,8 @@
1
- import{getNumberingConfigs as e}from"./chunk-K52WWA5G.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-MGXE75N5.js";import{useWindowManager as o,client_default as i}from"./chunk-RJ4KZGAT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-J7FZAOKT.js";import"./chunk-SG3ILR7W.js";import{useShellPrefs as s}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as c}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-O4Q475GF.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as a}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as l,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:v,save:N}=s(),{data:j}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=l({});p(()=>{if(!j)return;const e={};for(const t of j){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[j]);const w=v.notepad_notes||[],[_,W]=d(null),[C,S]=d(""),[R,$]=d(""),[D,G]=d("yellow"),[K,X]=d(!1),[J,M]=d(!1),O=l(null),I=l(),Q=w.find(e=>e.id===_);p(()=>{if(!_&&w.length>0){const e=w[0];W(e.id),S(e.title),$(e.content),G(e.color)}},[w.length]);const U=m(e=>{N({notepad_notes:e})},[N]),F=m(()=>{if(!_||!K)return;const e=w.map(e=>e.id===_?{...e,title:C,content:R,color:D,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);U(e),X(!1)},[_,K,C,R,D,w,U]);p(()=>{if(K)return I.current&&clearTimeout(I.current),I.current=setTimeout(F,800),()=>{I.current&&clearTimeout(I.current)}},[K,F]),p(()=>()=>{K&&F()},[]);const L=e=>{K&&F(),W(e.id),S(e.title),$(e.content),G(e.color),X(!1),M(!1)},P=e=>{const t=R.slice(0,e),r=R.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=R.slice(e+r[0].length);$(t+n+o),X(!0)},V=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):c.error(`${n} not found`)}catch{c.error(`Failed to look up ${n}`)}},A="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",E=/* @__PURE__ */h(y,{children:[
2
- /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{K&&F();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,...w];U(t),W(e.id),S(""),$(""),G("yellow"),X(!1),M(!0),setTimeout(()=>O.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
1
+ import{getNumberingConfigs as e}from"./chunk-QDLGU62M.js";import{SidebarLayout as t}from"./chunk-LGLZTJ2W.js";import"./chunk-QWK6DRSN.js";import"./chunk-KZHPX4FM.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-EIWTOEWV.js";import{useWindowManager as o,client_default as i}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import{useShellPrefs as s}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as c}from"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-UJOWORTR.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as a}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as l,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:v,save:N}=s(),{data:j}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=l({});p(()=>{if(!j)return;const e={};for(const t of j){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[j]);const w=v.notepad_notes||[],[_,W]=d(null),[C,D]=d(""),[R,S]=d(""),[$,K]=d("yellow"),[X,G]=d(!1),[J,O]=d(!1),M=l(null),U=l(),E=w.find(e=>e.id===_);p(()=>{if(!_&&w.length>0){const e=w[0];W(e.id),D(e.title),S(e.content),K(e.color)}},[w.length]);const P=m(e=>{N({notepad_notes:e})},[N]),Q=m(()=>{if(!_||!X)return;const e=w.map(e=>e.id===_?{...e,title:C,content:R,color:$,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);P(e),G(!1)},[_,X,C,R,$,w,P]);p(()=>{if(X)return U.current&&clearTimeout(U.current),U.current=setTimeout(Q,800),()=>{U.current&&clearTimeout(U.current)}},[X,Q]),p(()=>()=>{X&&Q()},[]);const I=e=>{X&&Q(),W(e.id),D(e.title),S(e.content),K(e.color),G(!1),O(!1)},V=e=>{const t=R.slice(0,e),r=R.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=R.slice(e+r[0].length);S(t+n+o),G(!0)},L=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):c.error(`${n} not found`)}catch{c.error(`Failed to look up ${n}`)}},B="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",F=/* @__PURE__ */h(y,{children:[
2
+ /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{X&&Q();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,...w];P(t),W(e.id),D(""),S(""),K("yellow"),G(!1),O(!0),setTimeout(()=>M.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
3
3
  /* @__PURE__ */g(a,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
4
  /* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===w.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):w.map(e=>{const t=(n=e.color,x.find(e=>e.key===n)||x[0]);var n;/* @__PURE__ */
5
- return h("button",{onClick:()=>L(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(_===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
5
+ return h("button",{onClick:()=>I(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(_===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
6
6
  /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */g("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
8
  /* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g(a,{name:"bookmark",look:"solid",className:"h-3 w-3 text-amber-500 shrink-0"})]}),
@@ -10,13 +10,13 @@ return h("button",{onClick:()=>L(e),className:"w-full text-left px-3 py-3 border
10
10
  /* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
11
  return h("div",{className:"h-full",children:[
12
12
  /* @__PURE__ */g(n,{app:"notepad"}),
13
- /* @__PURE__ */g(t,{sidebar:E,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
13
+ /* @__PURE__ */g(t,{sidebar:F,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
14
  /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */g("input",{value:C,onChange:e=>{S(e.target.value),X(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{G(e.key),X(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${D===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);U(t);const r=t.find(t=>t.id===e);c.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(_),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__ */g(a,{name:"bookmark",className:"h-4 w-4",fill:Q?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
- /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(U(t),_===e){const e=t[0];e?L(e):(W(null),S(""),$(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(a,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),J?/* @__PURE__ */g("textarea",{ref:O,value:R,onChange:e=>{$(e.target.value),X(!0)},onBlur:()=>{M(!1),K&&F()},placeholder:A,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{M(!0),setTimeout(()=>O.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:R?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let c;for(;null!==(c=s.exec(e));){const e=c[1],t=c[2];if(T.current[e]){const n=c.index,o=c[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>V(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(c=b.exec(e));){const e="x"===c[1]||"X"===c[1],t=c.index,n=l+t;i.push({idx:t,len:c[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>P(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g(a,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
- return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(R):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:A})}),
15
+ /* @__PURE__ */g("input",{value:C,onChange:e=>{D(e.target.value),G(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{K(e.key),G(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${$===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);P(t);const r=t.find(t=>t.id===e);c.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(_),title:E?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(E?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(a,{name:"bookmark",className:"h-4 w-4",fill:E?.sticky?"currentColor":"none",strokeWidth:1.5})}),
18
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(P(t),_===e){const e=t[0];e?I(e):(W(null),D(""),S(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(a,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),J?/* @__PURE__ */g("textarea",{ref:M,value:R,onChange:e=>{S(e.target.value),G(!0)},onBlur:()=>{O(!1),X&&Q()},placeholder:B,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{O(!0),setTimeout(()=>M.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:R?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let c;for(;null!==(c=s.exec(e));){const e=c[1],t=c[2];if(T.current[e]){const n=c.index,o=c[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>L(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(c=b.exec(e));){const e="x"===c[1]||"X"===c[1],t=c.index,n=l+t;i.push({idx:t,len:c[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>V(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g(a,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
19
+ return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(R):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:B})}),
20
20
  /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
21
21
  /* @__PURE__ */g("span",{children:"[] checkbox"}),
22
22
  /* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
@@ -1,4 +1,4 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-WIW2547G.js";import{subscribePomo as o,getPomoSnapshot as a,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as l,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as k}from"./chunk-ZEKM6HAA.js";import{PLACEHOLDER_INK as b}from"./chunk-PF3ANJFI.js";import{useWidgetSettings as x}from"./chunk-RJ4KZGAT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-J7FZAOKT.js";import"./chunk-SG3ILR7W.js";import{useShellPrefs as v}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as y}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as N,useEffect as C,useMemo as w,useState as S,useRef as B,useCallback as j}from"react";import{jsxs as M,Fragment as T,jsx as P}from"react/jsx-runtime";var I="pomodoro_appearance",A="pomodoro_active_task_id",V={focus:"Pomodoro",short:"Short Break",long:"Long Break"},W={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var D=25,L=5,R=15,$=!1,F=!1,K=4,E=!0,J=!0,G="bell",O=100,U=1,_="none",Q=50,H=(e,t,o,a)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):a;function X(){const t=N(o,a,a),{prefs:g,save:k}=v(),b=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:H(t.focusMinutes,1,120,D),shortBreakMinutes:H(t.shortBreakMinutes,1,120,L),longBreakMinutes:H(t.longBreakMinutes,1,120,R),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:$,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:F,longBreakInterval:H(t.longBreakInterval,1,20,K),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:E,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:J,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:G,alarmVolume:H(t.alarmVolume,0,100,O),alarmRepeat:H(t.alarmRepeat,1,5,U),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:_,focusVolume:H(t.focusVolume,0,100,Q)}}(g.pomodoro_settings);C(()=>{n({focus:60*b.focusMinutes,short:60*b.shortBreakMinutes,long:60*b.longBreakMinutes})},[b.focusMinutes,b.shortBreakMinutes,b.longBreakMinutes]),C(()=>{r(b.alarmSound),s(b.alarmVolume,b.alarmRepeat)},[b.alarmSound,b.alarmVolume,b.alarmRepeat]),C(()=>{l({autoStartBreaks:b.autoStartBreaks,autoStartPomodoros:b.autoStartPomodoros,longBreakInterval:b.longBreakInterval})},[b.autoStartBreaks,b.autoStartPomodoros,b.longBreakInterval]),C(()=>{i(b.focusSound,b.focusVolume)},[b.focusSound,b.focusVolume]),C(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const X=c(),z=X.tasks,Y=w(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return w(()=>t?(e=>{const t=[],o=[];for(const a of e)(a.done?o:t).push(a);return[...t,...o]})(e):e,[e,t])}(w(()=>z.filter(e=>!!e.dueDate&&(e.dueDate===Y||e.dueDate<Y&&!e.done)),[z,Y]),b.checkToBottom),[ee,te]=S(()=>localStorage.getItem(A)),[oe,ae]=S(!1),[ne,re]=S(null),se=B(!1);C(()=>{se.current||(se.current=!0,d(z,X.setAllTasks))},[]),C(()=>{try{ee?localStorage.setItem(A,ee):localStorage.removeItem(A)}catch{}},[ee]),C(()=>{if(!ne)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ne]);const le=B(t.streak);C(()=>{if(t.streak>le.current&&ee){const e=z.find(e=>e.id===ee);if(e){const t=(e.completed??0)+1,o=e.estimated??0,a=b.autoCheckTasks&&o>0&&t>=o;X.updateTask(ee,{completed:t,done:e.done||a})}}le.current=t.streak},[t.streak,ee,b.autoCheckTasks,z,X]);const ce=q.reduce((e,t)=>e+(t.completed??0),0),de=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),ue=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),me=t.running&&"focus"===t.mode?t.remaining:0,he=ue*b.focusMinutes*60+me,pe=new Date(Date.now()+1e3*he).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ge=(he/3600).toFixed(1),fe=ee?z.find(e=>e.id===ee)??null:null,ke=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ve]=S(()=>e(I)),[ye,Ne]=S(!1),[Ce,we]=S(xe),[Se,Be]=S(b);x(j(()=>{we({...xe}),Be({...b}),Ne(!0)},[xe,b]));const je="focus"!==t.mode,Me=W[t.mode],Te=je?(Pe=Me,Ie=xe.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${Ie})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var Pe,Ie;const Ae={primary: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"},Ve=je?Me:"#0f172a";/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-U4BMS5EV.js";import{subscribePomo as o,getPomoSnapshot as a,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as l,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as k}from"./chunk-ZEKM6HAA.js";import{PLACEHOLDER_INK as b}from"./chunk-PF3ANJFI.js";import{useWidgetSettings as x}from"./chunk-KJY57QPT.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BMPBVI7P.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-6WWAQC5V.js";import"./chunk-EGDJEY4K.js";import"./chunk-GNPTNAZH.js";import{useShellPrefs as v}from"./chunk-KC3EX26K.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-4NXMMWL6.js";import"./chunk-UGTRSRIW.js";import"./chunk-ET2EF5CI.js";import"./chunk-CDAJKLGL.js";import"./chunk-DXTKNHWG.js";import"./chunk-QR4RM7PO.js";import"./chunk-5QFPTDQF.js";import"./chunk-D323R2FT.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as y}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-6KO5VTL7.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as N,useEffect as C,useMemo as w,useState as S,useRef as B,useCallback as j}from"react";import{jsxs as M,Fragment as T,jsx as P}from"react/jsx-runtime";var I="pomodoro_appearance",A="pomodoro_active_task_id",V={focus:"Pomodoro",short:"Short Break",long:"Long Break"},D={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var L=25,W=5,R=15,$=!1,E=!1,K=4,F=!0,J=!0,G="bell",U=100,Q=1,_="none",O=50,H=(e,t,o,a)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):a;function X(){const t=N(o,a,a),{prefs:g,save:k}=v(),b=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:H(t.focusMinutes,1,120,L),shortBreakMinutes:H(t.shortBreakMinutes,1,120,W),longBreakMinutes:H(t.longBreakMinutes,1,120,R),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:$,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:E,longBreakInterval:H(t.longBreakInterval,1,20,K),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:F,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:J,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:G,alarmVolume:H(t.alarmVolume,0,100,U),alarmRepeat:H(t.alarmRepeat,1,5,Q),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:_,focusVolume:H(t.focusVolume,0,100,O)}}(g.pomodoro_settings);C(()=>{n({focus:60*b.focusMinutes,short:60*b.shortBreakMinutes,long:60*b.longBreakMinutes})},[b.focusMinutes,b.shortBreakMinutes,b.longBreakMinutes]),C(()=>{r(b.alarmSound),s(b.alarmVolume,b.alarmRepeat)},[b.alarmSound,b.alarmVolume,b.alarmRepeat]),C(()=>{l({autoStartBreaks:b.autoStartBreaks,autoStartPomodoros:b.autoStartPomodoros,longBreakInterval:b.longBreakInterval})},[b.autoStartBreaks,b.autoStartPomodoros,b.longBreakInterval]),C(()=>{i(b.focusSound,b.focusVolume)},[b.focusSound,b.focusVolume]),C(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const X=c(),z=X.tasks,Z=w(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return w(()=>t?(e=>{const t=[],o=[];for(const a of e)(a.done?o:t).push(a);return[...t,...o]})(e):e,[e,t])}(w(()=>z.filter(e=>!!e.dueDate&&(e.dueDate===Z||e.dueDate<Z&&!e.done)),[z,Z]),b.checkToBottom),[ee,te]=S(()=>localStorage.getItem(A)),[oe,ae]=S(!1),[ne,re]=S(null),se=B(!1);C(()=>{se.current||(se.current=!0,d(z,X.setAllTasks))},[]),C(()=>{try{ee?localStorage.setItem(A,ee):localStorage.removeItem(A)}catch{}},[ee]),C(()=>{if(!ne)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ne]);const le=B(t.streak);C(()=>{if(t.streak>le.current&&ee){const e=z.find(e=>e.id===ee);if(e){const t=(e.completed??0)+1,o=e.estimated??0,a=b.autoCheckTasks&&o>0&&t>=o;X.updateTask(ee,{completed:t,done:e.done||a})}}le.current=t.streak},[t.streak,ee,b.autoCheckTasks,z,X]);const ce=q.reduce((e,t)=>e+(t.completed??0),0),de=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),ue=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),me=t.running&&"focus"===t.mode?t.remaining:0,he=ue*b.focusMinutes*60+me,pe=new Date(Date.now()+1e3*he).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ge=(he/3600).toFixed(1),fe=ee?z.find(e=>e.id===ee)??null:null,ke=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ve]=S(()=>e(I)),[ye,Ne]=S(!1),[Ce,we]=S(xe),[Se,Be]=S(b);x(j(()=>{we({...xe}),Be({...b}),Ne(!0)},[xe,b]));const je="focus"!==t.mode,Me=D[t.mode],Te=je?(Pe=Me,Ie=xe.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${Ie})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var Pe,Ie;const Ae={primary: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"},Ve=je?Me:"#0f172a";/* @__PURE__ */
2
2
  return M(T,{children:[
3
3
  /* @__PURE__ */M("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Ae.primary}`,style:{backgroundColor:Te,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
4
4
  /* @__PURE__ */P("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */P("button",{onClick:()=>u(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?Ae.tabActive:Ae.tabInactive}`,children:V[e]},e))}),
@@ -20,7 +20,7 @@ return M("div",{onClick:()=>te(e.id),className:"bg-white text-gray-800 rounded-m
20
20
  /* @__PURE__ */P("span",{className:"text-gray-400",children:" / "}),
21
21
  /* @__PURE__ */P("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
22
22
  /* @__PURE__ */M("div",{className:"relative",children:[
23
- /* @__PURE__ */P("button",{onClick:t=>{t.stopPropagation(),re(ne===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-gray-500"})}),ne===e.id&&/* @__PURE__ */P("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__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,X.removeTask(o),ee===o&&te(null),re(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),oe?/* @__PURE__ */P(ie,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const a=X.addTask({name:o,estimated:t,completed:0,dueDate:Y});ee||te(a),ae(!1)},onCancel:()=>ae(!1),accentColor:Ve}):/* @__PURE__ */M("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ae.addTaskBtn}`,children:[
23
+ /* @__PURE__ */P("button",{onClick:t=>{t.stopPropagation(),re(ne===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-gray-500"})}),ne===e.id&&/* @__PURE__ */P("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__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,X.removeTask(o),ee===o&&te(null),re(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),oe?/* @__PURE__ */P(ie,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const a=X.addTask({name:o,estimated:t,completed:0,dueDate:Z});ee||te(a),ae(!1)},onCancel:()=>ae(!1),accentColor:Ve}):/* @__PURE__ */M("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ae.addTaskBtn}`,children:[
24
24
  /* @__PURE__ */P(y,{name:"add-circle",className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
25
25
  /* @__PURE__ */M("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${Ae.softDivider}`,children:[
26
26
  /* @__PURE__ */M("span",{className:Ae.secondary,children:["Pomos: ",
@@ -29,7 +29,7 @@ return M("div",{onClick:()=>te(e.id),className:"bg-white text-gray-800 rounded-m
29
29
  /* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:de})]}),he>0&&/* @__PURE__ */M("span",{className:Ae.secondary,children:["Finish At: ",
30
30
  /* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:pe}),
31
31
  /* @__PURE__ */M("span",{className:Ae.muted,children:[" (",ge,"h)"]})]})]})]}),
32
- /* @__PURE__ */P(Z,{open:ye,onClose:()=>Ne(!1),onSave:()=>{ve(Ce),localStorage.setItem(I,JSON.stringify(Ce)),k({pomodoro_settings:Se}),Ne(!1)},configAppearance:Ce,setConfigAppearance:we,configPrefs:Se,setConfigPrefs:Be})]})}function Z({open:e,onClose:o,onSave:a,configAppearance:n,setConfigAppearance:r,configPrefs:s,setConfigPrefs:l}){const i=(e,t)=>l(o=>({...o,[e]:t}));/* @__PURE__ */
32
+ /* @__PURE__ */P(Y,{open:ye,onClose:()=>Ne(!1),onSave:()=>{ve(Ce),localStorage.setItem(I,JSON.stringify(Ce)),k({pomodoro_settings:Se}),Ne(!1)},configAppearance:Ce,setConfigAppearance:we,configPrefs:Se,setConfigPrefs:Be})]})}function Y({open:e,onClose:o,onSave:a,configAppearance:n,setConfigAppearance:r,configPrefs:s,setConfigPrefs:l}){const i=(e,t)=>l(o=>({...o,[e]:t}));/* @__PURE__ */
33
33
  return M(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:a,children:[
34
34
  /* @__PURE__ */M(z,{icon:/* @__PURE__ */P(re,{}),label:"TIMER",children:[
35
35
  /* @__PURE__ */M("div",{children:[
@@ -38,24 +38,24 @@ return M(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:n,onAppearance
38
38
  /* @__PURE__ */P(ee,{label:"Pomodoro",value:s.focusMinutes,onChange:e=>i("focusMinutes",e),max:120}),
39
39
  /* @__PURE__ */P(ee,{label:"Short Break",value:s.shortBreakMinutes,onChange:e=>i("shortBreakMinutes",e),max:120}),
40
40
  /* @__PURE__ */P(ee,{label:"Long Break",value:s.longBreakMinutes,onChange:e=>i("longBreakMinutes",e),max:120})]})]}),
41
- /* @__PURE__ */P(Y,{label:"Auto Start Breaks",children:/* @__PURE__ */P(ae,{checked:s.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
42
- /* @__PURE__ */P(Y,{label:"Auto Start Pomodoros",children:/* @__PURE__ */P(ae,{checked:s.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
43
- /* @__PURE__ */P(Y,{label:"Long Break interval",children:/* @__PURE__ */P(te,{value:s.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
41
+ /* @__PURE__ */P(Z,{label:"Auto Start Breaks",children:/* @__PURE__ */P(ae,{checked:s.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
42
+ /* @__PURE__ */P(Z,{label:"Auto Start Pomodoros",children:/* @__PURE__ */P(ae,{checked:s.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
43
+ /* @__PURE__ */P(Z,{label:"Long Break interval",children:/* @__PURE__ */P(te,{value:s.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
44
44
  /* @__PURE__ */M(z,{icon:/* @__PURE__ */P(se,{}),label:"TASK",children:[
45
- /* @__PURE__ */P(Y,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */P(ae,{checked:s.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
46
- /* @__PURE__ */P(Y,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */P(ae,{checked:s.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
45
+ /* @__PURE__ */P(Z,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */P(ae,{checked:s.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
46
+ /* @__PURE__ */P(Z,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */P(ae,{checked:s.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
47
47
  /* @__PURE__ */M(z,{icon:/* @__PURE__ */P(le,{}),label:"SOUND",children:[
48
- /* @__PURE__ */P(Y,{label:"Alarm Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
48
+ /* @__PURE__ */P(Z,{label:"Alarm Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
49
49
  /* @__PURE__ */P(oe,{value:s.alarmSound,onChange:e=>i("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>g(s.alarmSound,{volume:s.alarmVolume,repeat:1}),className:"px-2 py-1 text-2xs rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
50
50
  /* @__PURE__ */P(q,{value:s.alarmVolume,onChange:e=>i("alarmVolume",e)}),
51
- /* @__PURE__ */P(Y,{label:"repeat",children:/* @__PURE__ */P(te,{value:s.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
- /* @__PURE__ */P(Y,{label:"Focus Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
51
+ /* @__PURE__ */P(Z,{label:"repeat",children:/* @__PURE__ */P(te,{value:s.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
52
+ /* @__PURE__ */P(Z,{label:"Focus Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
53
53
  /* @__PURE__ */P(oe,{value:s.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==s.focusSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>k(s.focusSound,s.focusVolume),className:"px-2 py-1 text-2xs rounded border border-gray-300 text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
54
54
  /* @__PURE__ */P(q,{value:s.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function z({icon:e,label:t,children:o}){/* @__PURE__ */
55
55
  return M("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
56
56
  /* @__PURE__ */M("div",{className:"flex items-center gap-2 mb-3 text-gray-400",children:[e,
57
57
  /* @__PURE__ */P("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
58
- /* @__PURE__ */P("div",{className:"space-y-3",children:o})]})}function Y({label:e,info:t,children:o}){/* @__PURE__ */
58
+ /* @__PURE__ */P("div",{className:"space-y-3",children:o})]})}function Z({label:e,info:t,children:o}){/* @__PURE__ */
59
59
  return M("div",{className:"flex items-center justify-between gap-3",children:[
60
60
  /* @__PURE__ */M("div",{className:"flex items-center gap-2 min-w-0",children:[
61
61
  /* @__PURE__ */P("span",{className:"text-sm font-semibold text-gray-800",children:e}),t&&/* @__PURE__ */P(ne,{title:t})]}),