efficient-shell 15.6.0 → 15.8.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 (52) hide show
  1. package/README.md +11 -5
  2. package/dist/{Browser-MBT76EKF.js → Browser-5QLDJ74Z.js} +13 -13
  3. package/dist/Calculator-6WNTZLWL.js +29 -0
  4. package/dist/{CurrencyConverter-UAZYLLHT.js → CurrencyConverter-C4KCZWUM.js} +10 -10
  5. package/dist/{Files-G5VBN3GD.js → Files-VFRXPQLV.js} +46 -46
  6. package/dist/{Notepad-23YBRLDH.js → Notepad-S5JMXH2O.js} +9 -9
  7. package/dist/PomodoroTimer-BGTCWT53.js +91 -0
  8. package/dist/{Preview-4VKAQ4TY.js → Preview-HTFTEL7K.js} +19 -19
  9. package/dist/{Stock-6YYK6VWP.js → Stock-LIOPTQG5.js} +6 -6
  10. package/dist/{Weather-2OU3LEWQ.js → Weather-K3BVAFRV.js} +18 -18
  11. package/dist/{WorldClock-PYJ4762U.js → WorldClock-RHAHXLW4.js} +6 -6
  12. package/dist/ai/index.js +8 -8
  13. package/dist/apps/ImageAnnotator.js +1 -1
  14. package/dist/apps/index.js +1 -1
  15. package/dist/bin/browser-check.js +1 -1
  16. package/dist/bin/media-host-check.js +1 -1
  17. package/dist/bin/ui-check.js +1 -1
  18. package/dist/brand.css +1 -1
  19. package/dist/chunk-3AUPCKBR.js +1 -0
  20. package/dist/chunk-6FOLK4HD.js +1 -0
  21. package/dist/{chunk-6ZNJ6JU5.js → chunk-E4WVF6AS.js} +6 -6
  22. package/dist/{chunk-OQAGCYR7.js → chunk-EA423N2F.js} +3 -3
  23. package/dist/chunk-GD5NGS6D.js +89 -0
  24. package/dist/chunk-GZ4AMXEU.js +1 -0
  25. package/dist/{chunk-N3T5BE2T.js → chunk-OHPDB4UN.js} +4 -4
  26. package/dist/{chunk-3C2VY2VF.js → chunk-RRWQBWLW.js} +1 -1
  27. package/dist/chunk-WGDVYCQX.js +69 -0
  28. package/dist/{chunk-OZNCUWYB.js → chunk-XZKVGJIB.js} +1 -1
  29. package/dist/{chunk-NICH2O4C.js → chunk-YFVQKS5U.js} +1 -1
  30. package/dist/chunk-ZLB5GRL6.js +1 -0
  31. package/dist/format/index.d.ts +15 -1
  32. package/dist/format/index.js +1 -1
  33. package/dist/forms/LinkPicker.js +1 -1
  34. package/dist/forms/MediaLibrary.js +1 -1
  35. package/dist/hooks/index.d.ts +42 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/icons/index.js +1 -1
  38. package/dist/index.d.ts +117 -75
  39. package/dist/index.js +662 -662
  40. package/dist/motion.css +9 -4
  41. package/dist/routine-index.json +1 -1
  42. package/dist/shell/LanguageSelect.js +1 -1
  43. package/dist/telemetry/index.js +1 -1
  44. package/dist/ui/index.js +1 -1
  45. package/dist/value-index.json +1 -1
  46. package/dist/version.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/Calculator-PAMITD4N.js +0 -29
  49. package/dist/PomodoroTimer-QFF2FTAG.js +0 -91
  50. package/dist/chunk-IN36HWJK.js +0 -1
  51. package/dist/chunk-TDUOBP55.js +0 -69
  52. package/dist/chunk-XRWUNOI3.js +0 -92
@@ -1,7 +1,7 @@
1
- import{openPreviewFile as e}from"./chunk-UMIRPFQJ.js";import{SidebarLayout as t}from"./chunk-FUUUPTVN.js";import"./chunk-QWK6DRSN.js";import"./chunk-WNHDYTTI.js";import{SearchableSelect as n}from"./chunk-DVKOVZJ2.js";import{Breadcrumbs as a}from"./chunk-WREUA43Q.js";import{Select_default as r}from"./chunk-W7HTHKN2.js";import"./chunk-EO5RLFRX.js";import"./chunk-GML6FVPA.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-MF7OELXP.js";import{Input_default as l}from"./chunk-D7MRZZVV.js";import"./chunk-AYZY3YNC.js";import{formatBytes as o}from"./chunk-OJI4ROSD.js";import{dayKeyInZone as c,formatTime as d,formatDateTime as m,userToday as h,instantOnDayKey as u}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as p}from"./chunk-36BRD5J3.js";import{fromDateKey as f,toDateKey as k}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as g,subscribeFilesChoice as w,getFilesChoice as y,holdFilesChoice as b,answerFilesChoice as v,choiceTakes as x}from"./chunk-CUNYWXUT.js";import{AboutApp as N}from"./chunk-OQAGCYR7.js";import{getFilesStore as C,peekFilesViewRequest as j,consumeFilesViewRequest as S,FILES_SHOW_TRASH_EVENT as D,FILES_OPEN_DESKTOP_FOLDER_EVENT as T,subscribeDesktopFolders as M,getDesktopFoldersSnapshot as $,filesRoleWrites as P,hasHostFilesStore as R,FolderGlyph as L,DesktopItemMiniIcon as A,desktopItemTypeLabel as F,FilesQuotaError as E,FILES_OFFICE_EXTENSIONS as I,FILES_ROLE_LABELS as O}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as W,WindowTitle as z}from"./chunk-XRWUNOI3.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as K,prompt as U}from"./chunk-JRKD7SD3.js";import{Dialog as V}from"./chunk-5RCKE4X2.js";import"./chunk-EIFNESXS.js";import{ItemCount as J}from"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import{parseOption as Y}from"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-IN36HWJK.js";import{DropdownMenu as H}from"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import{IconButton_default as Z}from"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as G}from"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as B}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as Q}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import{TH_ONE_LINE as X}from"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as q}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as _,useRef as ee,useEffect as te,useCallback as ne,useSyncExternalStore as ae,useMemo as re}from"react";import{jsxs as ie,jsx as se,Fragment as le}from"react/jsx-runtime";var oe={doc:"document",docx:"document",odt:"document",rtf:"document",txt:"document",md:"document",xls:"spreadsheet",xlsx:"spreadsheet",ods:"spreadsheet",csv:"spreadsheet",sheet:"spreadsheet",ppt:"slides",pptx:"slides",odp:"slides",key:"slides",slides:"slides",pdf:"pdf",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",heic:"image",tif:"image",tiff:"image",mp4:"video",mov:"video",webm:"video",avi:"video",mkv:"video",mp3:"audio",wav:"audio",m4a:"audio",ogg:"audio",flac:"audio",zip:"archive",rar:"archive","7z":"archive",gz:"archive",tar:"archive",dxf:"drawing",dwg:"drawing",stp:"drawing",step:"drawing",stl:"drawing",obj:"drawing",iges:"drawing",igs:"drawing","3mf":"drawing",glb:"drawing",gltf:"drawing"};function ce(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function de(e){if("folder"===e.kind)return"folder";if("document"===e.officeKind)return"document";if("spreadsheet"===e.officeKind)return"spreadsheet";if("deck"===e.officeKind)return"slides";const t=e.contentType??"";return"application/pdf"===t?"pdf":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":oe[ce(e.name)]??"other"}var me={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},he={folder:{name:"folder",tone:"muted"},document:{name:"document",tone:"accent"},spreadsheet:{name:"table",tone:"success"},slides:{name:"presentation-chart-bar",tone:"warning"},pdf:{name:"document",tone:"danger"},image:{name:"image",tone:"muted"},video:{name:"play",tone:"muted"},audio:{name:"speaker-wave",tone:"muted"},archive:{name:"archive-box",tone:"muted"},drawing:{name:"cube-transparent",tone:"muted"},other:{name:"page",tone:"muted"}};function ue(e){const t=e.officeKind?I[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function pe(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":o(e.size)}function fe(e,t=/* @__PURE__ */new Date){const n=c(e),a=c(t.toISOString());return n&&a?n===a?d(e,{clock:{hour:"numeric",minute:"2-digit"}}):n.slice(0,4)===a.slice(0,4)?m(e,{clock:{day:"numeric",month:"short"}}):m(e,{clock:{day:"numeric",month:"short",year:"numeric"}}):p}function ke(e){return d(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function ge(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var we=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function ye(e,t){const n="asc"===t.dir?1:-1;return[...e].sort((e,a)=>e.kind!==a.kind?"folder"===e.kind?-1:1:n*((e,n)=>{switch(t.key){case"owner":return we.compare(ge(e),ge(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return we.compare(ue(e),ue(n))}})(e,a)||we.compare(e.name,a.name))}var be=["folder","document","spreadsheet","slides","pdf","image","video"],ve={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function xe(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=h(t),a=f(n);if(!n||!a)return Number.NEGATIVE_INFINITY;"week"===e&&a.setDate(a.getDate()-6),"month"===e&&a.setDate(a.getDate()-29),"year"===e&&a.setMonth(0,1);const r=u(k(a),{hour:0,minute:0});return r?Date.parse(r):Number.NEGATIVE_INFINITY}(t.modified,n):null;return e.filter(e=>{if(t.type&&de(e)!==t.type)return!1;if(t.person){const n="owner"===(e.role??"owner");if("me"===t.person?!n:n||e.owner?.id!==t.person)return!1}return null===a||(Date.parse(e.modifiedAt)||0)>=a})}var Ne=[{value:"viewer",label:"Viewer"},{value:"commenter",label:"Commenter"},{value:"editor",label:"Editor"}];function Ce({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=_(null),[o,c]=_(""),[d,m]=_([]),[h,u]=_(!1),[p,f]=_(""),[k,g]=_("viewer"),[w,y]=_(!1),b=ee(/* @__PURE__ */new Map),v=t?.id??null;if(te(()=>{if(l(null),f(""),c(""),!v||!e.shares)return;let t=!0;return e.shares(v).then(e=>{t&&l(e)}).catch(e=>{t&&(q.error(e.message),l([]))}),()=>{t=!1}},[v,e]),te(()=>{if(!e.searchPeople||!v)return;let t=!0;u(!0);const n=setTimeout(()=>{e.searchPeople(o).then(e=>{if(t){for(const t of e)b.current.set(t.id,t);m(e)}}).catch(()=>{t&&m([])}).finally(()=>{t&&u(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[o,v,e]),!t)return null;const x=new Set((s??[]).map(e=>e.person.id)),N=d.filter(e=>!x.has(e.id)).map(e=>({value:e.id,label:e.name})),C=async n=>{y(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){q.error(e.message)}finally{y(!1)}};/* @__PURE__ */
2
- return ie(V,{open:!0,onClose:a,size:"md",title:`Share “${t.name}”`,description:"folder"===t.kind?"Everything inside this folder is shared too. Editors’ uploads count toward your quota.":"Viewers can open and download it. Editors can also replace, rename and delete it.",footer:/* @__PURE__ */se(G,{variant:"secondary",onClick:a,children:"Done"}),children:[
1
+ import{openPreviewFile as e}from"./chunk-UMIRPFQJ.js";import{SidebarLayout as t}from"./chunk-FUUUPTVN.js";import"./chunk-QWK6DRSN.js";import"./chunk-WNHDYTTI.js";import{Breadcrumbs as n}from"./chunk-WREUA43Q.js";import{SearchableSelect as a}from"./chunk-DVKOVZJ2.js";import{Select_default as r}from"./chunk-W7HTHKN2.js";import"./chunk-EO5RLFRX.js";import"./chunk-GML6FVPA.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-MF7OELXP.js";import{Input_default as l}from"./chunk-D7MRZZVV.js";import"./chunk-AYZY3YNC.js";import{formatBytes as o}from"./chunk-OJI4ROSD.js";import{dayKeyInZone as c,formatTime as d,formatDateTime as m,userToday as h,instantOnDayKey as u}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as p}from"./chunk-36BRD5J3.js";import{fromDateKey as f,toDateKey as k}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as g,subscribeFilesChoice as w,getFilesChoice as y,holdFilesChoice as b,answerFilesChoice as v,choiceTakes as x}from"./chunk-CUNYWXUT.js";import{AboutApp as N}from"./chunk-EA423N2F.js";import{getFilesStore as C,peekFilesViewRequest as j,consumeFilesViewRequest as S,FILES_SHOW_TRASH_EVENT as D,FILES_OPEN_DESKTOP_FOLDER_EVENT as T,subscribeDesktopFolders as M,getDesktopFoldersSnapshot as $,filesRoleWrites as P,hasHostFilesStore as L,FolderGlyph as R,DesktopItemMiniIcon as A,desktopItemTypeLabel as F,FilesQuotaError as E,FILES_OFFICE_EXTENSIONS as O,FILES_ROLE_LABELS as I}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as K,WindowTitle as W}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as z,prompt as U}from"./chunk-JRKD7SD3.js";import{Dialog as V}from"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import{ItemCount as H}from"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import{parseOption as J}from"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-6FOLK4HD.js";import{DropdownMenu as Y}from"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import{IconButton_default as Z}from"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as G}from"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as B}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as Q}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import{TH_ONE_LINE as X}from"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import{toast_default as q}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as _,useRef as ee,useEffect as te,useCallback as ne,useSyncExternalStore as ae,useMemo as re}from"react";import{jsxs as ie,jsx as se,Fragment as le}from"react/jsx-runtime";var oe={doc:"document",docx:"document",odt:"document",rtf:"document",txt:"document",md:"document",xls:"spreadsheet",xlsx:"spreadsheet",ods:"spreadsheet",csv:"spreadsheet",sheet:"spreadsheet",ppt:"slides",pptx:"slides",odp:"slides",key:"slides",slides:"slides",pdf:"pdf",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",heic:"image",tif:"image",tiff:"image",mp4:"video",mov:"video",webm:"video",avi:"video",mkv:"video",mp3:"audio",wav:"audio",m4a:"audio",ogg:"audio",flac:"audio",zip:"archive",rar:"archive","7z":"archive",gz:"archive",tar:"archive",dxf:"drawing",dwg:"drawing",stp:"drawing",step:"drawing",stl:"drawing",obj:"drawing",iges:"drawing",igs:"drawing","3mf":"drawing",glb:"drawing",gltf:"drawing"};function ce(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function de(e){if("folder"===e.kind)return"folder";if("document"===e.officeKind)return"document";if("spreadsheet"===e.officeKind)return"spreadsheet";if("deck"===e.officeKind)return"slides";const t=e.contentType??"";return"application/pdf"===t?"pdf":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":oe[ce(e.name)]??"other"}var me={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},he={folder:{name:"folder",tone:"muted"},document:{name:"document",tone:"accent"},spreadsheet:{name:"table",tone:"success"},slides:{name:"presentation-chart-bar",tone:"warning"},pdf:{name:"document",tone:"danger"},image:{name:"image",tone:"muted"},video:{name:"play",tone:"muted"},audio:{name:"speaker-wave",tone:"muted"},archive:{name:"archive-box",tone:"muted"},drawing:{name:"cube-transparent",tone:"muted"},other:{name:"page",tone:"muted"}};function ue(e){const t=e.officeKind?O[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function pe(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":o(e.size)}function fe(e,t=/* @__PURE__ */new Date){const n=c(e),a=c(t.toISOString());return n&&a?n===a?d(e,{clock:{hour:"numeric",minute:"2-digit"}}):n.slice(0,4)===a.slice(0,4)?m(e,{clock:{day:"numeric",month:"short"}}):m(e,{clock:{day:"numeric",month:"short",year:"numeric"}}):p}function ke(e){return d(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function ge(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var we=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function ye(e,t){const n="asc"===t.dir?1:-1;return[...e].sort((e,a)=>e.kind!==a.kind?"folder"===e.kind?-1:1:n*((e,n)=>{switch(t.key){case"owner":return we.compare(ge(e),ge(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return we.compare(ue(e),ue(n))}})(e,a)||we.compare(e.name,a.name))}var be=["folder","document","spreadsheet","slides","pdf","image","video"],ve={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function xe(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=h(t),a=f(n);if(!n||!a)return Number.NEGATIVE_INFINITY;"week"===e&&a.setDate(a.getDate()-6),"month"===e&&a.setDate(a.getDate()-29),"year"===e&&a.setMonth(0,1);const r=u(k(a),{hour:0,minute:0});return r?Date.parse(r):Number.NEGATIVE_INFINITY}(t.modified,n):null;return e.filter(e=>{if(t.type&&de(e)!==t.type)return!1;if(t.person){const n="owner"===(e.role??"owner");if("me"===t.person?!n:n||e.owner?.id!==t.person)return!1}return null===a||(Date.parse(e.modifiedAt)||0)>=a})}var Ne=[{value:"viewer",label:"Viewer"},{value:"commenter",label:"Commenter"},{value:"editor",label:"Editor"}];function Ce({store:e,entry:t,onClose:n,onChanged:i}){const[s,l]=_(null),[o,c]=_(""),[d,m]=_([]),[h,u]=_(!1),[p,f]=_(""),[k,g]=_("viewer"),[w,y]=_(!1),b=ee(/* @__PURE__ */new Map),v=t?.id??null;if(te(()=>{if(l(null),f(""),c(""),!v||!e.shares)return;let t=!0;return e.shares(v).then(e=>{t&&l(e)}).catch(e=>{t&&(q.error(e.message),l([]))}),()=>{t=!1}},[v,e]),te(()=>{if(!e.searchPeople||!v)return;let t=!0;u(!0);const n=setTimeout(()=>{e.searchPeople(o).then(e=>{if(t){for(const t of e)b.current.set(t.id,t);m(e)}}).catch(()=>{t&&m([])}).finally(()=>{t&&u(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[o,v,e]),!t)return null;const x=new Set((s??[]).map(e=>e.person.id)),N=d.filter(e=>!x.has(e.id)).map(e=>({value:e.id,label:e.name})),C=async n=>{y(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){q.error(e.message)}finally{y(!1)}};/* @__PURE__ */
2
+ return ie(V,{open:!0,onClose:n,size:"md",title:`Share “${t.name}”`,description:"folder"===t.kind?"Everything inside this folder is shared too. Editors’ uploads count toward your quota.":"Viewers can open and download it. Editors can also replace, rename and delete it.",footer:/* @__PURE__ */se(G,{variant:"secondary",onClick:n,children:"Done"}),children:[
3
3
  /* @__PURE__ */ie("div",{className:"flex items-center gap-2",children:[
4
- /* @__PURE__ */se("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */se(n,{value:p,onChange:f,onSearchChange:c,loading:h&&0===d.length,options:N,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
4
+ /* @__PURE__ */se("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */se(a,{value:p,onChange:f,onSearchChange:c,loading:h&&0===d.length,options:N,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
5
5
  /* @__PURE__ */se("div",{className:"w-28 shrink-0",children:/* @__PURE__ */se(r,{value:k,onChange:e=>g(e),options:Ne,"aria-label":"Access"})}),
6
6
  /* @__PURE__ */se(G,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=b.current.get(p);C(async()=>{await e.share(t.id,p,k),f(""),c(""),n&&q.success(`Shared with ${n.name}`)})},disabled:!p||w,children:"Add"})]}),
7
7
  /* @__PURE__ */se("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */se(Q,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */ie("ul",{className:"divide-y divide-line-subtle text-sm",children:[
@@ -30,68 +30,68 @@ return ie("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col m
30
30
  /* @__PURE__ */se("div",{className:"h-32 rounded-(--radius-control) bg-surface-sunken flex items-center justify-center mb-3",children:c&&/* @__PURE__ */se(B,{name:c.name,tone:c.tone,className:"h-12 w-12"})}),s&&/* @__PURE__ */ie("div",{className:"mb-3",children:[
31
31
  /* @__PURE__ */se("div",{className:"text-xs font-medium text-ink-strong mb-1",children:"Who has access"}),0===s.length?/* @__PURE__ */ie("p",{className:"text-sm text-ink-faint",children:["Only ","owner"!==t.role&&t.role?t.owner?.name??"its owner":"you"]}):/* @__PURE__ */se("ul",{className:"text-sm text-ink",children:s.map(e=>/* @__PURE__ */ie("li",{className:"flex justify-between py-0.5",children:[
32
32
  /* @__PURE__ */se("span",{className:"truncate",children:e.person.name}),
33
- /* @__PURE__ */se("span",{className:"text-ink-faint text-xs",children:O[e.role]})]},e.person.id))})]}),
34
- /* @__PURE__ */ie("dl",{className:"border-t border-line pt-2",children:[m("Type",o?me[o]:null),"file"===t.kind&&m("Size",pe(t)),m("Location",d),m("Owner","me"===ge(t)?"me":ge(t)),m("Modified",t.modifiedAt?`${fe(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),m("Created",r?.createdAt?fe(r.createdAt):null)]})]}):/* @__PURE__ */se("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var De=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,Te=["list","grid"],Me="files.layout",$e={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"},Pe=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],Re="application/x-efficient-files";function Le(){try{return Y(Te,"list",localStorage.getItem(Me))}catch{return"list"}}function Ae(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=g()??[];for(const e of n){const t=a.find(t=>"folder"===t.kind&&t.name===e);a=t?.children??[]}return{folder:{id:e,name:n[n.length-1]??"",role:"owner",path:[{id:null,name:""},...n.map((e,t)=>({id:"/"+n.slice(0,t+1).join("/"),name:e}))]},entries:a.map(e=>({id:("/"===t?"":t)+"/"+e.name,name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}}function Fe(e,t){return`Not enough space for “${e}” (${o(t.attempted)}). You've used ${o(t.used)} of ${o(t.limit)}. Empty Trash or ask an administrator for more space.`}var Ee=(e,t)=>e instanceof Error&&e.message||t;function Ie(e){const t=[];for(const n of e)("divider"!==n.type||0!==t.length&&"divider"!==t[t.length-1].type)&&t.push(n);for(;t.length&&"divider"===t[t.length-1].type;)t.pop();return t}function Oe({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=he[de(e)];/* @__PURE__ */
35
- return se(B,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function We({entry:e,read:t}){const[n,a]=_(null),r="image"===de(e)&&e.size<=5242880;return te(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */se("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */se(Oe,{entry:e,className:"h-10 w-10"})}function ze(){const n=C(),r=n.title??"Files",c=null!==g(),d=!c&&!!n.shares&&!!n.sharedWithMe,[m,h]=_(null),[u,p]=_(null),[f,k]=_([]),[O,V]=_(()=>/* @__PURE__ */new Set),Y=ee(null),[oe,de]=_(!0),[Ne,Te]=_(!1),[ze,Ke]=_(null),[Ue,Ve]=_(!1),[Je,Ye]=_(null),[He,Ze]=_(null),[Ge,Be]=_(null),[Qe,Xe]=_(Le),[qe,_e]=_(!1),[et,tt]=_(""),[nt,at]=_(""),[rt,it]=_({}),[st,lt]=_({key:"name",dir:"asc"}),[ot,ct]=_(()=>{const e=j();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=ee("files"),mt=ee(ot);mt.current=ot,te(()=>{S()},[]);const[ht,ut]=_([]),pt=e=>{Xe(e);try{localStorage.setItem(Me,e)}catch{}},ft=ne(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);te(()=>{const e=()=>{S(),ft("trash")},t=e=>{S();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(D,e),window.addEventListener(T,t),()=>{window.removeEventListener(D,e),window.removeEventListener(T,t)}},[ft]);const kt=ae(M,$,$),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];te(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&ft("files")},[gt,kt,ft]);const bt=ee(0),vt=ee(null),xt=ee(null),{openPage:Nt,openEntity:Ct}=W(),jt=i(),St=i(),Dt=i(),Tt=ae(w,y,y);te(()=>b(),[]),te(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||ft("files")},[Tt,ot,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>Nt(e)}):"page"===t.entityType?Nt(t.entityId):Ct(t.entityType,t.entityId,null,t.label)},$t=ne(async()=>{if(!c)try{Ke(await n.quota())}catch{}},[n,c]),Pt=ne(async(e,t)=>{de(!0);try{await e(),Te(!1)}catch(e){e instanceof TypeError?Te(!0):q.error(Ee(e,t))}finally{de(!1)}},[]),Rt=ne(async e=>{if(c)return p(Ae(e)),Te(!1),void de(!1);await Pt(async()=>{p(await n.list(e))},"Failed to list"),$t()},[n,$t,c,Pt]),Lt=ne(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=c?Ae(m):await n.list(m).catch(()=>null);return k((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void de(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await Pt(async()=>{k(await a())},"Failed to list files")},[n,c,m,Pt]),At=ne(async()=>{if(c)return ut([]),void de(!1);await Pt(async()=>{ut(await n.trash())},"Failed to list trash"),$t()},[n,$t,c,Pt]),Ft=()=>{"files"===ot?Rt(m):De(ot)?Lt(ot,nt):"trash"===ot&&At()};te(()=>{V(/* @__PURE__ */new Set),Y.current=null,Ft()},[m,ot,nt]),te(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Et=()=>{tt(""),"search"===mt.current&&ft(dt.current)},It=e=>{ft("files"),h(e)},Ot=async(e,t)=>{try{await e()}catch(e){q.error(Ee(e,t))}Ft()},Wt=e=>Ot(async()=>{await n.restore(e.id),q.success(`Restored "${e.name}"`)},"Restore failed"),zt=async e=>{await K({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Ot(()=>n.purge(e.id),"Delete failed")},Kt=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){q.error(Ee(e,"Download failed"))}},Ut="files"===ot?u?.folder??null:null,Vt=Ut?.role??"owner",Jt="owner"!==Vt,Yt="files"===ot?m:null,Ht=!c&&("files"!==ot||P(Vt)),Zt=!c&&"files"===ot&&P(Vt),Gt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Yt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof E?q.error(Fe(r.name,e)):q.error(`Upload ${r.name}: ${Ee(e,"failed")}`)}}a>1&&q.success(`Uploaded ${a} files`),"files"===ot?Rt(m):It(null)},Bt=async e=>{const t=ue(e),a=await U({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?q.error("Names cannot contain slashes"):Ot(()=>n.rename(e.id,function(e,t){const n=e.officeKind?I[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??u?.folder.owner)?.name??"its owner":"their owners";await K({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ue(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await Ot(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),q.success(t?`"${ue(t)}" moved to trash`:`${e.length} items moved to trash`))},Xt=(e,t)=>Ot(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),qt=async(e,t)=>{Be(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Ot(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),q.success(1===a.length?`Moved "${ue(a[0])}"`:`Moved ${a.length} items`))},_t=()=>{bt.current=0,Ve(!1),Ye(null)};te(()=>{const e=()=>_t();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const en="files"===ot?u?.entries??[]:De(ot)?f:[],tn=re(()=>ye(xe(en,rt),st),[en,rt,st]),nn=re(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...O].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Vt:"owner"),ln=e=>!c&&P(sn(e)),on=e=>d&&"owner"===sn(e),cn=e=>!!n.move&&ln(e),dn=(e,t)=>{if(Tt){const t=nn.get(e);if(t&&"file"===t.kind&&!hn(t))return;return void V(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&Y.current){const t=tn.map(e=>e.id),n=t.indexOf(Y.current),a=t.indexOf(e);if(n>=0&&a>=0)return void V(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}Y.current=e,t.metaKey||t.ctrlKey?V(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):V(/* @__PURE__ */new Set([e]))},mn=()=>{V(/* @__PURE__ */new Set),Y.current=null},hn=e=>!!Tt&&"file"===e.kind&&x(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",pn=e=>{if(!Tt||!hn(e))return;const t="files"===ot?u?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===ot?"Shared with me":"My files";v(Tt.id,{entry:e,folderId:"files"===ot?m:null,location:n})},fn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?It(t.id):Tt?pn(t):(async t=>{if(c)return;if(n.open?.(t))return;const a=$e[ce(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>Nt(e)}):Kt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Tt)return t&&("folder"===t.kind||hn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(ln);if(c)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Ie([...t?[{key:"open",label:a,icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */se(B,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */se(B,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Bt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */se(B,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Ot(async()=>{for(const t of e)await n.copy(t.id);q.success(1===e.length?`Copied "${ue(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */se(B,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Ze(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */se(B,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Be(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */se(B,{name:"star",className:"h-4 w-4"}),onSelect:()=>Xt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */se(B,{name:"info",className:"h-4 w-4"}),onSelect:()=>{V(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},wn=(e,t)=>{const n=O.has(t.id)?an:[t];jt.open(e,n)&&!O.has(t.id)&&(V(/* @__PURE__ */new Set([t.id])),Y.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=O.has(e.id)?an:[e];t.dataTransfer.setData(Re,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},bn=e=>"folder"===e.kind&&ln(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(Re)&&(t.preventDefault(),t.stopPropagation(),Je!==e.id&&Ye(e.id))},onDragLeave:()=>{Je===e.id&&Ye(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(Re))return;t.preventDefault(),t.stopPropagation(),Ye(null);const n=JSON.parse(t.dataTransfer.getData(Re)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(Ne)/* @__PURE__ */
33
+ /* @__PURE__ */se("span",{className:"text-ink-faint text-xs",children:I[e.role]})]},e.person.id))})]}),
34
+ /* @__PURE__ */ie("dl",{className:"border-t border-line pt-2",children:[m("Type",o?me[o]:null),"file"===t.kind&&m("Size",pe(t)),m("Location",d),m("Owner","me"===ge(t)?"me":ge(t)),m("Modified",t.modifiedAt?`${fe(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),m("Created",r?.createdAt?fe(r.createdAt):null)]})]}):/* @__PURE__ */se("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var De=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,Te=["list","grid"],Me="files.layout",$e={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"},Pe=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],Le="application/x-efficient-files";function Re(){try{return J(Te,"list",localStorage.getItem(Me))}catch{return"list"}}function Ae(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=g()??[];for(const e of n){const t=a.find(t=>"folder"===t.kind&&t.name===e);a=t?.children??[]}return{folder:{id:e,name:n[n.length-1]??"",role:"owner",path:[{id:null,name:""},...n.map((e,t)=>({id:"/"+n.slice(0,t+1).join("/"),name:e}))]},entries:a.map(e=>({id:("/"===t?"":t)+"/"+e.name,name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}}function Fe(e,t){return`Not enough space for “${e}” (${o(t.attempted)}). You've used ${o(t.used)} of ${o(t.limit)}. Empty Trash or ask an administrator for more space.`}var Ee=(e,t)=>e instanceof Error&&e.message||t;function Oe(e){const t=[];for(const n of e)("divider"!==n.type||0!==t.length&&"divider"!==t[t.length-1].type)&&t.push(n);for(;t.length&&"divider"===t[t.length-1].type;)t.pop();return t}function Ie({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=he[de(e)];/* @__PURE__ */
35
+ return se(B,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function Ke({entry:e,read:t}){const[n,a]=_(null),r="image"===de(e)&&e.size<=5242880;return te(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */se("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */se(Ie,{entry:e,className:"h-10 w-10"})}function We(){const a=C(),r=a.title??"Files",c=null!==g(),d=!c&&!!a.shares&&!!a.sharedWithMe,[m,h]=_(null),[u,p]=_(null),[f,k]=_([]),[I,V]=_(()=>/* @__PURE__ */new Set),J=ee(null),[oe,de]=_(!0),[Ne,Te]=_(!1),[We,ze]=_(null),[Ue,Ve]=_(!1),[He,Je]=_(null),[Ye,Ze]=_(null),[Ge,Be]=_(null),[Qe,Xe]=_(Re),[qe,_e]=_(!1),[et,tt]=_(""),[nt,at]=_(""),[rt,it]=_({}),[st,lt]=_({key:"name",dir:"asc"}),[ot,ct]=_(()=>{const e=j();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=ee("files"),mt=ee(ot);mt.current=ot,te(()=>{S()},[]);const[ht,ut]=_([]),pt=e=>{Xe(e);try{localStorage.setItem(Me,e)}catch{}},ft=ne(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);te(()=>{const e=()=>{S(),ft("trash")},t=e=>{S();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(D,e),window.addEventListener(T,t),()=>{window.removeEventListener(D,e),window.removeEventListener(T,t)}},[ft]);const kt=ae(M,$,$),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];te(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&ft("files")},[gt,kt,ft]);const bt=ee(0),vt=ee(null),xt=ee(null),{openPage:Nt,openEntity:Ct}=K(),jt=i(),St=i(),Dt=i(),Tt=ae(w,y,y);te(()=>b(),[]),te(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||ft("files")},[Tt,ot,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>Nt(e)}):"page"===t.entityType?Nt(t.entityId):Ct(t.entityType,t.entityId,null,t.label)},$t=ne(async()=>{if(!c)try{ze(await a.quota())}catch{}},[a,c]),Pt=ne(async(e,t)=>{de(!0);try{await e(),Te(!1)}catch(e){e instanceof TypeError?Te(!0):q.error(Ee(e,t))}finally{de(!1)}},[]),Lt=ne(async e=>{if(c)return p(Ae(e)),Te(!1),void de(!1);await Pt(async()=>{p(await a.list(e))},"Failed to list"),$t()},[a,$t,c,Pt]),Rt=ne(async(e,t)=>{if("search"===e&&!a.search){const e=t.toLowerCase(),n=c?Ae(m):await a.list(m).catch(()=>null);return k((n?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void de(!1)}const n={recent:()=>a.recent?.()??Promise.resolve([]),starred:()=>a.starred?.()??Promise.resolve([]),shared:()=>a.sharedWithMe?.()??Promise.resolve([]),search:()=>a.search?.(t)??Promise.resolve([])}[e];await Pt(async()=>{k(await n())},"Failed to list files")},[a,c,m,Pt]),At=ne(async()=>{if(c)return ut([]),void de(!1);await Pt(async()=>{ut(await a.trash())},"Failed to list trash"),$t()},[a,$t,c,Pt]),Ft=()=>{"files"===ot?Lt(m):De(ot)?Rt(ot,nt):"trash"===ot&&At()};te(()=>{V(/* @__PURE__ */new Set),J.current=null,Ft()},[m,ot,nt]),te(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Et=()=>{tt(""),"search"===mt.current&&ft(dt.current)},Ot=e=>{ft("files"),h(e)},It=async(e,t)=>{try{await e()}catch(e){q.error(Ee(e,t))}Ft()},Kt=e=>It(async()=>{await a.restore(e.id),q.success(`Restored "${e.name}"`)},"Restore failed"),Wt=async e=>{await z({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&It(()=>a.purge(e.id),"Delete failed")},zt=async e=>{try{const t=await a.read(e.id),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){q.error(Ee(e,"Download failed"))}},Ut="files"===ot?u?.folder??null:null,Vt=Ut?.role??"owner",Ht="owner"!==Vt,Jt="files"===ot?m:null,Yt=!c&&("files"!==ot||P(Vt)),Zt=!c&&"files"===ot&&P(Vt),Gt=async(e,{withFolders:t=!1}={})=>{let n=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await a.upload(Jt,r,i?{folderPath:i}:void 0),n++}catch(e){e instanceof E?q.error(Fe(r.name,e)):q.error(`Upload ${r.name}: ${Ee(e,"failed")}`)}}n>1&&q.success(`Uploaded ${n} files`),"files"===ot?Lt(m):Ot(null)},Bt=async e=>{const t=ue(e),n=await U({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});n&&n!==t&&(/[\\/]/.test(n)?q.error("Names cannot contain slashes"):It(()=>a.rename(e.id,function(e,t){const n=e.officeKind?O[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,n)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,n=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??u?.folder.owner)?.name??"its owner":"their owners";await z({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ue(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(n?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await It(async()=>{for(const t of e)await a.remove(t.id)},"Delete failed"),q.success(t?`"${ue(t)}" moved to trash`:`${e.length} items moved to trash`))},Xt=(e,t)=>It(async()=>{for(const n of e)await a.setStarred(n.id,t)},t?"Star failed":"Unstar failed"),qt=async(e,t)=>{Be(null);const n=e.filter(e=>e.id!==t);0!==n.length&&(await It(async()=>{for(const e of n)await a.move(e.id,t)},"Move failed"),q.success(1===n.length?`Moved "${ue(n[0])}"`:`Moved ${n.length} items`))},_t=()=>{bt.current=0,Ve(!1),Je(null)};te(()=>{const e=()=>_t();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const en="files"===ot?u?.entries??[]:De(ot)?f:[],tn=re(()=>ye(xe(en,rt),st),[en,rt,st]),nn=re(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...I].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Vt:"owner"),ln=e=>!c&&P(sn(e)),on=e=>d&&"owner"===sn(e),cn=e=>!!a.move&&ln(e),dn=(e,t)=>{if(Tt){const t=nn.get(e);if(t&&"file"===t.kind&&!hn(t))return;return void V(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&J.current){const t=tn.map(e=>e.id),n=t.indexOf(J.current),a=t.indexOf(e);if(n>=0&&a>=0)return void V(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}J.current=e,t.metaKey||t.ctrlKey?V(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):V(/* @__PURE__ */new Set([e]))},mn=()=>{V(/* @__PURE__ */new Set),J.current=null},hn=e=>!!Tt&&"file"===e.kind&&x(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",pn=e=>{if(!Tt||!hn(e))return;const t="files"===ot?u?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===ot?"Shared with me":"My files";v(Tt.id,{entry:e,folderId:"files"===ot?m:null,location:n})},fn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?Ot(t.id):Tt?pn(t):(async t=>{if(c)return;if(a.open?.(t))return;const n=$e[ce(t.name)];n?await e({filePath:a.shortcutPath?.(t.id)??t.id,filename:t.name,kind:n,load:()=>a.read(t.id),onStaged:e=>Nt(e)}):zt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Tt)return t&&("folder"===t.kind||hn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const n=t&&"file"===t.kind&&a.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(ln);if(c)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Oe([...t?[{key:"open",label:n,icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */se(B,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(zt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */se(B,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Bt(t)}]:[],...r&&a.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */se(B,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>It(async()=>{for(const t of e)await a.copy(t.id);q.success(1===e.length?`Copied "${ue(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */se(B,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Ze(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */se(B,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Be(e)}]:[],...a.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */se(B,{name:"star",className:"h-4 w-4"}),onSelect:()=>Xt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */se(B,{name:"info",className:"h-4 w-4"}),onSelect:()=>{V(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},wn=(e,t)=>{const n=I.has(t.id)?an:[t];jt.open(e,n)&&!I.has(t.id)&&(V(/* @__PURE__ */new Set([t.id])),J.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=I.has(e.id)?an:[e];t.dataTransfer.setData(Le,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},bn=e=>"folder"===e.kind&&ln(e)&&a.move?{onDragOver:t=>{t.dataTransfer.types.includes(Le)&&(t.preventDefault(),t.stopPropagation(),He!==e.id&&Je(e.id))},onDragLeave:()=>{He===e.id&&Je(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(Le))return;t.preventDefault(),t.stopPropagation(),Je(null);const n=JSON.parse(t.dataTransfer.getData(Le)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(Ne)/* @__PURE__ */
36
36
  return ie("div",{className:"flex flex-col h-full bg-surface",children:[
37
- /* @__PURE__ */se(z,{title:`${r} - offline`}),
37
+ /* @__PURE__ */se(W,{title:`${r} - offline`}),
38
38
  /* @__PURE__ */se("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */ie("div",{className:"max-w-md",children:[
39
- /* @__PURE__ */se(B,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),R()?/* @__PURE__ */ie(le,{children:[
39
+ /* @__PURE__ */se(B,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),L()?/* @__PURE__ */ie(le,{children:[
40
40
  /* @__PURE__ */se("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
41
41
  /* @__PURE__ */se("p",{className:"text-sm text-ink-faint mb-3",children:"Check your connection and try again."})]}):/* @__PURE__ */ie(le,{children:[
42
42
  /* @__PURE__ */se("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
43
43
  /* @__PURE__ */ie("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
44
44
  /* @__PURE__ */se("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
45
- /* @__PURE__ */se(G,{variant:"primary",onClick:Ft,children:"Retry"})]})})]});const vn=ze&&ze.limit>0?Math.min(100,Math.round(ze.used/ze.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Jt?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>It(null)},...(Ut?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>It(e.id)}))],Cn="recent"===ot?"Recent":"starred"===ot?"Starred":"shared"===ot?"Shared with me":"search"===ot?`Results for “${nt}”`:"trash"===ot?"Trash":wt?wt.name:null,jn=Tt?`${r} - Choosing`:Cn?`${r} - ${"search"===ot?"Search":Cn}`:Ut&&null!==Ut.id?`${r} - ${Ut.name}`:r,Sn=e=>"flex w-full items-center gap-3 rounded-full px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-accent-tint font-medium text-accent-text":"text-ink hover:bg-row-hover"),Dn=Ie([{key:"folder",label:"New folder",icon:/* @__PURE__ */se(B,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await U({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?q.error("Folder names cannot contain slashes"):(await Ot(()=>n.createFolder(Yt,e),"Create folder failed"),"files"!==ot&&It(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */se(B,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */se(B,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>xt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?Pe.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=he["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */se(B,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Yt)).catch(e=>q.error(Ee(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */ie("div",{className:"flex h-full flex-col",children:[
46
- /* @__PURE__ */se("div",{className:"p-3 pb-2",children:/* @__PURE__ */se(H,{trigger:/* @__PURE__ */ie(le,{children:[
45
+ /* @__PURE__ */se(G,{variant:"primary",onClick:Ft,children:"Retry"})]})})]});const vn=We&&We.limit>0?Math.min(100,Math.round(We.used/We.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Ht?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>Ot(null)},...(Ut?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>Ot(e.id)}))],Cn="recent"===ot?"Recent":"starred"===ot?"Starred":"shared"===ot?"Shared with me":"search"===ot?`Results for “${nt}”`:"trash"===ot?"Trash":wt?wt.name:null,jn=Tt?`${r} - Choosing`:Cn?`${r} - ${"search"===ot?"Search":Cn}`:Ut&&null!==Ut.id?`${r} - ${Ut.name}`:r,Sn=e=>"flex w-full items-center gap-3 rounded-full px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-accent-tint font-medium text-accent-text":"text-ink hover:bg-row-hover"),Dn=Oe([{key:"folder",label:"New folder",icon:/* @__PURE__ */se(B,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await U({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?q.error("Folder names cannot contain slashes"):(await It(()=>a.createFolder(Jt,e),"Create folder failed"),"files"!==ot&&Ot(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */se(B,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...a.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */se(B,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>xt.current?.click()}]:[],{type:"divider",key:"d2"},...a.createOfficeFile?Pe.filter(e=>!a.officeKinds||a.officeKinds.includes(e.kind)).map(e=>{const t=he["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */se(B,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(a.createOfficeFile(e.kind,Jt)).catch(e=>q.error(Ee(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */ie("div",{className:"flex h-full flex-col",children:[
46
+ /* @__PURE__ */se("div",{className:"p-3 pb-2",children:/* @__PURE__ */se(Y,{trigger:/* @__PURE__ */ie(le,{children:[
47
47
  /* @__PURE__ */se(B,{name:"add",className:"h-5 w-5"}),
48
- /* @__PURE__ */se("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!Ht,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
48
+ /* @__PURE__ */se("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!Yt,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
49
49
  /* @__PURE__ */ie("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
50
- /* @__PURE__ */ie("button",{onClick:()=>It(null),className:Sn("files"===ot&&!Jt),children:[
51
- /* @__PURE__ */se(B,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!c&&/* @__PURE__ */ie("button",{onClick:()=>ft("recent"),className:Sn("recent"===ot),children:[
52
- /* @__PURE__ */se(B,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!c&&/* @__PURE__ */ie("button",{onClick:()=>ft("starred"),className:Sn("starred"===ot),children:[
53
- /* @__PURE__ */se(B,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),d&&/* @__PURE__ */ie("button",{onClick:()=>ft("shared"),className:Sn("shared"===ot||"files"===ot&&Jt),children:[
50
+ /* @__PURE__ */ie("button",{onClick:()=>Ot(null),className:Sn("files"===ot&&!Ht),children:[
51
+ /* @__PURE__ */se(B,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),a.recent&&!c&&/* @__PURE__ */ie("button",{onClick:()=>ft("recent"),className:Sn("recent"===ot),children:[
52
+ /* @__PURE__ */se(B,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),a.starred&&!c&&/* @__PURE__ */ie("button",{onClick:()=>ft("starred"),className:Sn("starred"===ot),children:[
53
+ /* @__PURE__ */se(B,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),d&&/* @__PURE__ */ie("button",{onClick:()=>ft("shared"),className:Sn("shared"===ot||"files"===ot&&Ht),children:[
54
54
  /* @__PURE__ */se(B,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!c&&/* @__PURE__ */ie("button",{onClick:()=>ft("trash"),className:Sn("trash"===ot),children:[
55
55
  /* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),kt&&kt.folders.length>0&&/* @__PURE__ */ie(le,{children:[
56
56
  /* @__PURE__ */se("div",{className:"px-3 pt-4 pb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),kt.folders.map(e=>/* @__PURE__ */ie("button",{onClick:()=>ft({desktopFolderId:e.id}),className:Sn(gt===e.id),children:[
57
- /* @__PURE__ */se(L,{className:"h-4 w-4 shrink-0 text-amber-500"}),
57
+ /* @__PURE__ */se(R,{className:"h-4 w-4 shrink-0 text-amber-500"}),
58
58
  /* @__PURE__ */se("span",{className:"truncate",children:e.name}),
59
- /* @__PURE__ */se(J,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),ze&&/* @__PURE__ */ie("div",{className:"px-5 py-3 shrink-0",title:`${o(ze.used)} of ${o(ze.limit)} used`,children:[
59
+ /* @__PURE__ */se(H,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),We&&/* @__PURE__ */ie("div",{className:"px-5 py-3 shrink-0",title:`${o(We.used)} of ${o(We.limit)} used`,children:[
60
60
  /* @__PURE__ */se("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */se("div",{className:`h-full ${xn} transition-all`,style:{width:`${vn}%`}})}),
61
- /* @__PURE__ */ie("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[o(ze.used)," of ",o(ze.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */ie("span",{className:"inline-flex items-center gap-1",children:[e,
62
- /* @__PURE__ */se(B,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),$n=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),Pn=De(ot)||"files"===ot,Rn=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>we.compare(e.name,t.name))}(en),Ln=Pn&&en.length>0?/* @__PURE__ */ie("div",{className:"flex items-center gap-2 shrink-0",children:[
63
- /* @__PURE__ */se(H,{trigger:Mn(rt.type?me[rt.type]:"Type",!!rt.type),"aria-label":"Type",triggerClassName:$n(!!rt.type),items:[...be.map(e=>({type:"radio",key:e,label:me[e],checked:rt.type===e,onSelect:()=>it(t=>({...t,type:t.type===e?null:e}))})),...rt.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,type:null}))}]:[]]}),d&&/* @__PURE__ */se(H,{trigger:Mn(rt.person?"me"===rt.person?"Owned by me":Rn.find(e=>e.id===rt.person)?.name??"People":"People",!!rt.person),"aria-label":"People",triggerClassName:$n(!!rt.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===rt.person,onSelect:()=>it(e=>({...e,person:"me"===e.person?null:"me"}))},...Rn.map(e=>({type:"radio",key:e.id,label:e.name,checked:rt.person===e.id,onSelect:()=>it(t=>({...t,person:t.person===e.id?null:e.id}))})),...rt.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,person:null}))}]:[]]}),
64
- /* @__PURE__ */se(H,{trigger:Mn(rt.modified?ve[rt.modified]:"Modified",!!rt.modified),"aria-label":"Modified",triggerClassName:$n(!!rt.modified),items:[...Object.keys(ve).map(e=>({type:"radio",key:e,label:ve[e],checked:rt.modified===e,onSelect:()=>it(t=>({...t,modified:t.modified===e?null:e}))})),...rt.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,modified:null}))}]:[]]})]}):null,An=Pn&&an.length>0&&!Tt?/* @__PURE__ */ie("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
61
+ /* @__PURE__ */ie("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[o(We.used)," of ",o(We.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */ie("span",{className:"inline-flex items-center gap-1",children:[e,
62
+ /* @__PURE__ */se(B,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),$n=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),Pn=De(ot)||"files"===ot,Ln=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>we.compare(e.name,t.name))}(en),Rn=Pn&&en.length>0?/* @__PURE__ */ie("div",{className:"flex items-center gap-2 shrink-0",children:[
63
+ /* @__PURE__ */se(Y,{trigger:Mn(rt.type?me[rt.type]:"Type",!!rt.type),"aria-label":"Type",triggerClassName:$n(!!rt.type),items:[...be.map(e=>({type:"radio",key:e,label:me[e],checked:rt.type===e,onSelect:()=>it(t=>({...t,type:t.type===e?null:e}))})),...rt.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,type:null}))}]:[]]}),d&&/* @__PURE__ */se(Y,{trigger:Mn(rt.person?"me"===rt.person?"Owned by me":Ln.find(e=>e.id===rt.person)?.name??"People":"People",!!rt.person),"aria-label":"People",triggerClassName:$n(!!rt.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===rt.person,onSelect:()=>it(e=>({...e,person:"me"===e.person?null:"me"}))},...Ln.map(e=>({type:"radio",key:e.id,label:e.name,checked:rt.person===e.id,onSelect:()=>it(t=>({...t,person:t.person===e.id?null:e.id}))})),...rt.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,person:null}))}]:[]]}),
64
+ /* @__PURE__ */se(Y,{trigger:Mn(rt.modified?ve[rt.modified]:"Modified",!!rt.modified),"aria-label":"Modified",triggerClassName:$n(!!rt.modified),items:[...Object.keys(ve).map(e=>({type:"radio",key:e,label:ve[e],checked:rt.modified===e,onSelect:()=>it(t=>({...t,modified:t.modified===e?null:e}))})),...rt.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,modified:null}))}]:[]]})]}):null,An=Pn&&an.length>0&&!Tt?/* @__PURE__ */ie("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
65
65
  /* @__PURE__ */se(Z,{"aria-label":"Clear selection",size:"sm",onClick:mn,children:/* @__PURE__ */se(B,{name:"close",className:"h-4 w-4"})}),
66
- /* @__PURE__ */ie("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[an.length," selected"]}),rn&&on(rn)&&/* @__PURE__ */se(Z,{"aria-label":"Share",size:"sm",onClick:()=>Ze(rn),children:/* @__PURE__ */se(B,{name:"add-person",className:"h-4 w-4"})}),!c&&an.every(e=>"file"===e.kind)&&/* @__PURE__ */se(Z,{"aria-label":"Download",size:"sm",onClick:()=>an.forEach(Kt),children:/* @__PURE__ */se(B,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */se(Z,{"aria-label":"Move",size:"sm",onClick:()=>Be(an),children:/* @__PURE__ */se(B,{name:"forward",className:"h-4 w-4"})}),!c&&an.every(ln)&&/* @__PURE__ */se(Z,{"aria-label":"Move to trash",size:"sm",onClick:()=>Qt(an),children:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"})}),
67
- /* @__PURE__ */se(H,{trigger:/* @__PURE__ */se(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(an)})]}):null,Fn=/* @__PURE__ */se("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:An??/* @__PURE__ */ie(le,{children:[
68
- /* @__PURE__ */ie("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===ot?/* @__PURE__ */se("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */se(a,{items:Nn,maxItems:5})}):"trash"===ot?/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof ot?/* @__PURE__ */ie(le,{children:[
69
- /* @__PURE__ */se(L,{className:"h-4 w-4 text-amber-500 shrink-0"}),
66
+ /* @__PURE__ */ie("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[an.length," selected"]}),rn&&on(rn)&&/* @__PURE__ */se(Z,{"aria-label":"Share",size:"sm",onClick:()=>Ze(rn),children:/* @__PURE__ */se(B,{name:"add-person",className:"h-4 w-4"})}),!c&&an.every(e=>"file"===e.kind)&&/* @__PURE__ */se(Z,{"aria-label":"Download",size:"sm",onClick:()=>an.forEach(zt),children:/* @__PURE__ */se(B,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */se(Z,{"aria-label":"Move",size:"sm",onClick:()=>Be(an),children:/* @__PURE__ */se(B,{name:"forward",className:"h-4 w-4"})}),!c&&an.every(ln)&&/* @__PURE__ */se(Z,{"aria-label":"Move to trash",size:"sm",onClick:()=>Qt(an),children:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"})}),
67
+ /* @__PURE__ */se(Y,{trigger:/* @__PURE__ */se(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(an)})]}):null,Fn=/* @__PURE__ */se("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:An??/* @__PURE__ */ie(le,{children:[
68
+ /* @__PURE__ */ie("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===ot?/* @__PURE__ */se("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */se(n,{items:Nn,maxItems:5})}):"trash"===ot?/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof ot?/* @__PURE__ */ie(le,{children:[
69
+ /* @__PURE__ */se(R,{className:"h-4 w-4 text-amber-500 shrink-0"}),
70
70
  /* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong truncate",children:wt?.name??"Desktop folder"}),
71
- /* @__PURE__ */se("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong truncate",children:Cn}),"files"===ot&&Jt&&!P(Vt)&&/* @__PURE__ */ie("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-2xs text-ink-faint whitespace-nowrap",children:[
72
- /* @__PURE__ */se(B,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Jt&&Ut?.owner&&/* @__PURE__ */ie("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Ut.owner.name]})]}),Ln,"trash"===ot&&/* @__PURE__ */se(G,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await K({title:"Empty trash",message:`${ht.length} item${1===ht.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&Ot(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),En=(e,t)=>Tt?null:/* @__PURE__ */ie("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[on(e)&&/* @__PURE__ */se(Z,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Ze(e)},children:/* @__PURE__ */se(B,{name:"add-person",className:"h-4 w-4"})}),!c&&"file"===e.kind&&/* @__PURE__ */se(Z,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Kt(e)},children:/* @__PURE__ */se(B,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!c&&/* @__PURE__ */se(Z,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Xt([e],!e.starred)},children:/* @__PURE__ */se(B,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
- /* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(H,{trigger:/* @__PURE__ */se(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(O.has(e.id)&&an.length>1?an:[e])})})]}),In=e=>/* @__PURE__ */ie("span",{className:"flex items-center gap-3 min-w-0",children:[
74
- /* @__PURE__ */se(Oe,{entry:e}),
75
- /* @__PURE__ */se("span",{className:"truncate",title:e.name,children:ue(e)}),!!e.shareCount&&/* @__PURE__ */se("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */se(B,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */se("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */se(B,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),On=(e,t,n)=>{const a=st.key===e;/* @__PURE__ */
76
- return se("th",{className:`${X} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===st.dir?"ascending":"descending":void 0,children:/* @__PURE__ */ie("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>lt(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===st.dir?/* @__PURE__ */se(B,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */se(B,{name:"arrow-down",className:"h-3 w-3"}))]})})},Wn="recent"===ot?"Files you and your colleagues change show here.":"starred"===ot?"Star the files and folders you want to find quickly.":"shared"===ot?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===ot?`Nothing matches “${nt}”.`:null,zn=0===tn.length?oe?/* @__PURE__ */se(Q,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:en.length>0?"Nothing matches these filters.":Wn??/* @__PURE__ */ie(le,{children:["This folder is empty.",Zt&&/* @__PURE__ */ie(le,{children:[" Drop files here or choose ",
71
+ /* @__PURE__ */se("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong truncate",children:Cn}),"files"===ot&&Ht&&!P(Vt)&&/* @__PURE__ */ie("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-2xs text-ink-faint whitespace-nowrap",children:[
72
+ /* @__PURE__ */se(B,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Ht&&Ut?.owner&&/* @__PURE__ */ie("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Ut.owner.name]})]}),Rn,"trash"===ot&&/* @__PURE__ */se(G,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await z({title:"Empty trash",message:`${ht.length} item${1===ht.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&It(()=>a.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),En=(e,t)=>Tt?null:/* @__PURE__ */ie("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[on(e)&&/* @__PURE__ */se(Z,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Ze(e)},children:/* @__PURE__ */se(B,{name:"add-person",className:"h-4 w-4"})}),!c&&"file"===e.kind&&/* @__PURE__ */se(Z,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),zt(e)},children:/* @__PURE__ */se(B,{name:"download",className:"h-4 w-4"})}),a.setStarred&&!c&&/* @__PURE__ */se(Z,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Xt([e],!e.starred)},children:/* @__PURE__ */se(B,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
+ /* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(Y,{trigger:/* @__PURE__ */se(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(I.has(e.id)&&an.length>1?an:[e])})})]}),On=e=>/* @__PURE__ */ie("span",{className:"flex items-center gap-3 min-w-0",children:[
74
+ /* @__PURE__ */se(Ie,{entry:e}),
75
+ /* @__PURE__ */se("span",{className:"truncate",title:e.name,children:ue(e)}),!!e.shareCount&&/* @__PURE__ */se("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */se(B,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */se("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */se(B,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),In=(e,t,n)=>{const a=st.key===e;/* @__PURE__ */
76
+ return se("th",{className:`${X} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===st.dir?"ascending":"descending":void 0,children:/* @__PURE__ */ie("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>lt(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===st.dir?/* @__PURE__ */se(B,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */se(B,{name:"arrow-down",className:"h-3 w-3"}))]})})},Kn="recent"===ot?"Files you and your colleagues change show here.":"starred"===ot?"Star the files and folders you want to find quickly.":"shared"===ot?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===ot?`Nothing matches “${nt}”.`:null,Wn=0===tn.length?oe?/* @__PURE__ */se(Q,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:en.length>0?"Nothing matches these filters.":Kn??/* @__PURE__ */ie(le,{children:["This folder is empty.",Zt&&/* @__PURE__ */ie(le,{children:[" Drop files here or choose ",
77
77
  /* @__PURE__ */se("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Qe?/* @__PURE__ */se("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=tn.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */ie("section",{className:"mb-4",children:[
78
78
  /* @__PURE__ */se("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
79
- /* @__PURE__ */se("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=O.has(t.id);/* @__PURE__ */
80
- return ie("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":ue(t),onClick:e=>dn(t.id,e),onDoubleClick:()=>kn(t),onContextMenu:e=>wn(e,t),...yn(t),...bn(t),className:"group rounded-xl border cursor-default select-none outline-none focus-visible:ring-2 focus-visible:ring-accent-border "+(a||Je===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
79
+ /* @__PURE__ */se("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const n=I.has(t.id);/* @__PURE__ */
80
+ return ie("div",{role:"button",tabIndex:0,"aria-pressed":n,"aria-label":ue(t),onClick:e=>dn(t.id,e),onDoubleClick:()=>kn(t),onContextMenu:e=>wn(e,t),...yn(t),...bn(t),className:"group rounded-xl border cursor-default select-none outline-none focus-visible:ring-2 focus-visible:ring-accent-border "+(n||He===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
81
81
  /* @__PURE__ */ie("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
82
- /* @__PURE__ */se(Oe,{entry:t,className:"h-4 w-4"}),
82
+ /* @__PURE__ */se(Ie,{entry:t,className:"h-4 w-4"}),
83
83
  /* @__PURE__ */se("span",{className:"flex-1 truncate text-sm",title:t.name,children:ue(t)}),
84
- /* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(H,{trigger:/* @__PURE__ */se(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&an.length>1?an:[t])})})]}),"file"===e&&/* @__PURE__ */ie(le,{children:[
85
- /* @__PURE__ */se("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */se(We,{entry:t,read:c?void 0:n.read})}),
84
+ /* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(Y,{trigger:/* @__PURE__ */se(B,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(n&&an.length>1?an:[t])})})]}),"file"===e&&/* @__PURE__ */ie(le,{children:[
85
+ /* @__PURE__ */se("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */se(Ke,{entry:t,read:c?void 0:a.read})}),
86
86
  /* @__PURE__ */ie("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ge(t)?"You":ge(t)," · ",fe(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
87
- /* @__PURE__ */se("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ie("tr",{children:[On("name","Name","text-left"),d&&On("owner","Owner","text-left w-32"),On("modified","Modified","text-left w-28"),On("size","Size","text-right w-20"),
87
+ /* @__PURE__ */se("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ie("tr",{children:[In("name","Name","text-left"),d&&In("owner","Owner","text-left w-32"),In("modified","Modified","text-left w-28"),In("size","Size","text-right w-20"),
88
88
  /* @__PURE__ */se("th",{className:`${X} w-32`,children:/* @__PURE__ */se("span",{className:"sr-only",children:"Actions"})})]})}),
89
- /* @__PURE__ */se("tbody",{children:tn.map(e=>{const t=O.has(e.id);/* @__PURE__ */
90
- return ie("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),onContextMenu:t=>wn(t,e),...yn(e),...bn(e),className:`group cursor-default select-none border-b border-line-subtle ${un(e)} ${t||Je===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
91
- /* @__PURE__ */se("td",{className:"px-3 h-11",children:In(e)}),d&&/* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint truncate",children:ge(e)}),
89
+ /* @__PURE__ */se("tbody",{children:tn.map(e=>{const t=I.has(e.id);/* @__PURE__ */
90
+ return ie("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),onContextMenu:t=>wn(t,e),...yn(e),...bn(e),className:`group cursor-default select-none border-b border-line-subtle ${un(e)} ${t||He===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
91
+ /* @__PURE__ */se("td",{className:"px-3 h-11",children:On(e)}),d&&/* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint truncate",children:ge(e)}),
92
92
  /* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:ke(e.modifiedAt),children:fe(e.modifiedAt)}),
93
93
  /* @__PURE__ */se("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint whitespace-nowrap",children:Tt&&"file"===e.kind&&!hn(e)&&Tt.request.otherLabel?Tt.request.otherLabel:pe(e)}),
94
- /* @__PURE__ */se("td",{className:"px-2 h-11",children:En(e,t)})]},e.id)})})]}),Kn=oe&&0===ht.length?/* @__PURE__ */se(Q,{size:"sm",padding:"p-6",label:"Loading"}):0===ht.length?/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
94
+ /* @__PURE__ */se("td",{className:"px-2 h-11",children:En(e,t)})]},e.id)})})]}),zn=oe&&0===ht.length?/* @__PURE__ */se(Q,{size:"sm",padding:"p-6",label:"Loading"}):0===ht.length?/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
95
95
  /* @__PURE__ */se("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ie("tr",{children:[
96
96
  /* @__PURE__ */se("th",{className:`${X} text-left font-medium px-3 h-9`,children:"Name"}),
97
97
  /* @__PURE__ */se("th",{className:`${X} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
@@ -100,14 +100,14 @@ return ie("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),
100
100
  /* @__PURE__ */se("th",{className:`${X} w-28`,children:/* @__PURE__ */se("span",{className:"sr-only",children:"Actions"})})]})}),
101
101
  /* @__PURE__ */se("tbody",{children:ht.map(e=>/* @__PURE__ */ie("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
102
102
  /* @__PURE__ */se("td",{className:"px-3 h-11",children:/* @__PURE__ */ie("span",{className:"flex items-center gap-3 min-w-0",children:[
103
- /* @__PURE__ */se(Oe,{entry:e}),
103
+ /* @__PURE__ */se(Ie,{entry:e}),
104
104
  /* @__PURE__ */se("span",{className:"truncate",title:e.name,children:e.name})]})}),
105
105
  /* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint text-xs truncate",title:e.originalPath,children:e.originalPath||"—"}),
106
106
  /* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:e.deletedAt?ke(e.deletedAt):void 0,children:e.deletedAt?fe(e.deletedAt):"—"}),
107
107
  /* @__PURE__ */se("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":o(e.size)}),
108
108
  /* @__PURE__ */se("td",{className:"px-2 h-11",children:/* @__PURE__ */ie("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
109
- /* @__PURE__ */se(Z,{"aria-label":"Restore",size:"sm",onClick:()=>Wt(e),children:/* @__PURE__ */se(B,{name:"revert",className:"h-4 w-4"})}),
110
- /* @__PURE__ */se(Z,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>zt(e),children:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),Un=0===yt.length?/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
109
+ /* @__PURE__ */se(Z,{"aria-label":"Restore",size:"sm",onClick:()=>Kt(e),children:/* @__PURE__ */se(B,{name:"revert",className:"h-4 w-4"})}),
110
+ /* @__PURE__ */se(Z,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>Wt(e),children:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),Un=0===yt.length?/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
111
111
  /* @__PURE__ */se("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ie("tr",{children:[
112
112
  /* @__PURE__ */se("th",{className:`${X} text-left font-medium px-3 h-9`,children:"Name"}),
113
113
  /* @__PURE__ */se("th",{className:`${X} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
@@ -122,7 +122,7 @@ return ie("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),
122
122
  /* @__PURE__ */se(Z,{"aria-label":"Move to desktop",size:"sm",onClick:()=>kt?.moveToDesktop([e]),children:/* @__PURE__ */se(B,{name:"desktop",className:"h-4 w-4"})}),
123
123
  /* @__PURE__ */se(Z,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>kt?.removeShortcuts([e]),children:/* @__PURE__ */se(B,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
124
124
  return ie("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Zt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),bt.current++,Ue||Ve(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{bt.current>0&&bt.current--,0===bt.current&&Ve(!1)},onDrop:e=>{e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),_t(),Zt&&e.dataTransfer.files?.length&&Gt(e.dataTransfer.files))},children:[
125
- /* @__PURE__ */se(z,{title:jn}),
125
+ /* @__PURE__ */se(W,{title:jn}),
126
126
  /* @__PURE__ */se(N,{app:"files"}),
127
127
  /* @__PURE__ */se("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Gt(e.target.files),vt.current&&(vt.current.value="")}}),
128
128
  /* @__PURE__ */se("input",{ref:e=>{xt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Gt(e.target.files,{withFolders:!0}),xt.current&&(xt.current.value="")}}),
@@ -138,4 +138,4 @@ return ie("div",{className:"relative flex flex-col h-full bg-surface",onDragEnte
138
138
  /* @__PURE__ */se(Z,{"aria-label":"List view","aria-pressed":"list"===Qe,onClick:()=>pt("list"),children:/* @__PURE__ */se(B,{name:"list",className:"h-4 w-4"})}),
139
139
  /* @__PURE__ */se(Z,{"aria-label":"Grid view","aria-pressed":"grid"===Qe,onClick:()=>pt("grid"),children:/* @__PURE__ */se(B,{name:"grid",className:"h-4 w-4"})})]}),
140
140
  /* @__PURE__ */se(Z,{"aria-label":"Details","aria-pressed":qe,onClick:()=>_e(e=>!e),children:/* @__PURE__ */se(B,{name:"info",className:"h-4 w-4"})})]}),Fn,
141
- /* @__PURE__ */se("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&fn&&(e.preventDefault(),pn(fn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Qt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),V(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Un:"trash"===ot?Kn:zn})]}),qe&&Pn&&/* @__PURE__ */se(Se,{store:n,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */se(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */se(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */se(B,{name:"revert",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)}]}),Dt.state&&/* @__PURE__ */se(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */se(B,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>kt?.moveToDesktop([Dt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */se(B,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),d&&/* @__PURE__ */se(Ce,{store:n,entry:He,onClose:()=>Ze(null),onChanged:Ft}),n.move&&/* @__PURE__ */se(je,{store:n,items:Ge,from:"files"===ot?m:void 0,onClose:()=>Be(null),onMove:e=>Ge&&qt(Ge,e)}),Ue&&/* @__PURE__ */se("div",{className:"absolute inset-0 bg-accent-tint border-4 border-dashed border-accent-border pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */se("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{ze as default,Fe as quotaExceededMessage};
141
+ /* @__PURE__ */se("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&fn&&(e.preventDefault(),pn(fn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Qt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),V(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Un:"trash"===ot?zn:Wn})]}),qe&&Pn&&/* @__PURE__ */se(Se,{store:a,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */se(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */se(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */se(B,{name:"revert",className:"h-4 w-4"}),onSelect:()=>Kt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */se(B,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)}]}),Dt.state&&/* @__PURE__ */se(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */se(B,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */se(B,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>kt?.moveToDesktop([Dt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */se(B,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),d&&/* @__PURE__ */se(Ce,{store:a,entry:Ye,onClose:()=>Ze(null),onChanged:Ft}),a.move&&/* @__PURE__ */se(je,{store:a,items:Ge,from:"files"===ot?m:void 0,onClose:()=>Be(null),onMove:e=>Ge&&qt(Ge,e)}),Ue&&/* @__PURE__ */se("div",{className:"absolute inset-0 bg-accent-tint border-4 border-dashed border-accent-border pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */se("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{We as default,Fe as quotaExceededMessage};
@@ -1,8 +1,8 @@
1
- import{getNumberingConfigs as e}from"./chunk-OZNCUWYB.js";import{SidebarLayout as t}from"./chunk-FUUUPTVN.js";import"./chunk-QWK6DRSN.js";import"./chunk-WNHDYTTI.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-OQAGCYR7.js";import{useWindowManager as o,client_default as i}from"./chunk-XRWUNOI3.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-IN36HWJK.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as s}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as l}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as k,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 y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=y[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},[v]);const w=j.notepad_notes||[],[_,C]=d(null),[D,W]=d(""),[P,R]=d(""),[S,U]=d("yellow"),[H,O]=d(!1),[Z,I]=d(!1),J=a(null),X=a();p(()=>{if(!_&&w.length>0){const e=w[0];C(e.id),W(e.title),R(e.content),U(e.color)}},[w.length]);const K=m(e=>{N({notepad_notes:e})},[N]),F=m(()=>{if(!_||!H)return;const e=w.map(e=>e.id===_?{...e,title:D,content:P,color:S,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);K(e),O(!1)},[_,H,D,P,S,w,K]);p(()=>{if(H)return X.current&&clearTimeout(X.current),X.current=setTimeout(F,800),()=>{X.current&&clearTimeout(X.current)}},[H,F]),p(()=>()=>{H&&F()},[]);const Q=e=>{H&&F(),C(e.id),W(e.title),R(e.content),U(e.color),O(!1),I(!1)},V=e=>{const t=P.slice(0,e),r=P.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=P.slice(e+r[0].length);R(t+n+o),O(!0)},$=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):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},Y="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.)",A=/* @__PURE__ */h(k,{children:[
2
- /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{H&&F();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];K(t),C(e.id),W(""),R(""),U("yellow"),O(!1),I(!0),setTimeout(()=>J.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
1
+ import{getNumberingConfigs as e}from"./chunk-XZKVGJIB.js";import{SidebarLayout as t}from"./chunk-FUUUPTVN.js";import"./chunk-QWK6DRSN.js";import"./chunk-WNHDYTTI.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-EA423N2F.js";import{useWindowManager as o,client_default as i}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-6FOLK4HD.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as s}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import{toast_default as l}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as k,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 y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=y[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},[v]);const w=j.notepad_notes||[],[_,D]=d(null),[C,P]=d(""),[S,U]=d(""),[W,Z]=d("yellow"),[H,R]=d(!1),[K,X]=d(!1),G=a(null),J=a();p(()=>{if(!_&&w.length>0){const e=w[0];D(e.id),P(e.title),U(e.content),Z(e.color)}},[w.length]);const F=m(e=>{N({notepad_notes:e})},[N]),I=m(()=>{if(!_||!H)return;const e=w.map(e=>e.id===_?{...e,title:C,content:S,color:W,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);F(e),R(!1)},[_,H,C,S,W,w,F]);p(()=>{if(H)return J.current&&clearTimeout(J.current),J.current=setTimeout(I,800),()=>{J.current&&clearTimeout(J.current)}},[H,I]),p(()=>()=>{H&&I()},[]);const O=e=>{H&&I(),D(e.id),P(e.title),U(e.content),Z(e.color),R(!1),X(!1)},V=e=>{const t=S.slice(0,e),r=S.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=S.slice(e+r[0].length);U(t+n+o),R(!0)},A=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):l.error(`${n} not found`)}catch{l.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.)",$=/* @__PURE__ */h(k,{children:[
2
+ /* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{H&&I();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];F(t),D(e.id),P(""),U(""),Z("yellow"),R(!1),X(!0),setTimeout(()=>G.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
3
  /* @__PURE__ */g(s,{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:()=>Q(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
5
+ return h("button",{onClick:()=>O(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
6
  /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */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"})]}),
@@ -10,15 +10,15 @@ return h("button",{onClick:()=>Q(e),className:"w-full text-left px-3 py-3 border
10
10
  /* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children: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:A,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:$,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:D,onChange:e=>{W(e.target.value),O(!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:()=>{U(e.key),O(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${S===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.filter(t=>t.id!==e);if(K(t),_===e){const e=t[0];e?Q(e):(C(null),W(""),R(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),Z?/* @__PURE__ */g("textarea",{ref:J,value:P,onChange:e=>{R(e.target.value),O(!0)},onBlur:()=>{I(!1),H&&F()},placeholder:Y,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:()=>{I(!0),setTimeout(()=>J.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:P?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(T.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>$(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */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(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */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__ */
18
- return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(P):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:Y})}),
15
+ /* @__PURE__ */g("input",{value:C,onChange:e=>{P(e.target.value),R(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{Z(e.key),R(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${W===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */g("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(F(t),_===e){const e=t[0];e?O(e):(D(null),P(""),U(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),K?/* @__PURE__ */g("textarea",{ref:G,value:S,onChange:e=>{U(e.target.value),R(!0)},onBlur:()=>{X(!1),H&&I()},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:()=>{X(!0),setTimeout(()=>G.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:S?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(T.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>A(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */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(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */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__ */
18
+ return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(S):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:B})}),
19
19
  /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
20
  /* @__PURE__ */g("span",{children:"[] checkbox"}),
21
21
  /* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
22
- /* @__PURE__ */g("span",{className:"ml-auto",children:Z?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
22
+ /* @__PURE__ */g("span",{className:"ml-auto",children:K?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
23
  /* @__PURE__ */g(s,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
24
24
  /* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};