efficient-shell 5.0.0 → 5.1.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 (63) hide show
  1. package/README.md +29 -2
  2. package/dist/{Browser-5F5LWXYQ.js → Browser-WUVL7ZSM.js} +18 -18
  3. package/dist/Calculator-E2CBADVF.js +29 -0
  4. package/dist/ConfirmDialog-ZM364NPI.js +1 -0
  5. package/dist/{CurrencyConverter-QEG6RFAS.js → CurrencyConverter-LF2WHJW4.js} +7 -7
  6. package/dist/{Documents-6DEUZVVA.js → Documents-MB4TJGNY.js} +26 -26
  7. package/dist/Files-JQYIBZEP.js +87 -0
  8. package/dist/{Notepad-KNJRTYXR.js → Notepad-UQSG5BE3.js} +11 -11
  9. package/dist/PdfViewer-4VGNBBED.js +1 -0
  10. package/dist/{PomodoroTimer-T6YAQFIE.js → PomodoroTimer-XARF7DO3.js} +50 -50
  11. package/dist/{Preview-KEIDYSHF.js → Preview-LETK6AJS.js} +126 -126
  12. package/dist/Sidebar-VR4QYFQU.js +44 -0
  13. package/dist/{Spreadsheet-HKXSYD5B.js → Spreadsheet-RCHOM2RE.js} +13 -13
  14. package/dist/{Stock-BZFC2ROU.js → Stock-25FQMI2G.js} +3 -3
  15. package/dist/{Weather-S3N5OWYF.js → Weather-KLQ55R64.js} +17 -17
  16. package/dist/{WorldClock-ACC3S6OA.js → WorldClock-RMPU7D2M.js} +6 -6
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/{chunk-2DX65GOO.js → chunk-2KTBZE5F.js} +1 -1
  21. package/dist/{chunk-PQLVWCUI.js → chunk-2TP4GK53.js} +5 -5
  22. package/dist/chunk-3JK2LSFU.js +1 -0
  23. package/dist/{chunk-R7EBJKN2.js → chunk-4KLBITSY.js} +28 -28
  24. package/dist/{chunk-5IWSOLLY.js → chunk-5LCZFVE4.js} +2 -2
  25. package/dist/{chunk-GMMTTWHB.js → chunk-6TCHOT4R.js} +1 -1
  26. package/dist/{chunk-3DGTIWZP.js → chunk-DBB4DB7J.js} +1 -1
  27. package/dist/{chunk-KDRAU4XQ.js → chunk-DXNCJBGY.js} +7 -7
  28. package/dist/{chunk-WNEO7TSP.js → chunk-FA6E75W5.js} +1 -1
  29. package/dist/{chunk-TKUNR5KP.js → chunk-GPNNQIRY.js} +2 -2
  30. package/dist/{chunk-LK7V32MR.js → chunk-H5NEXQTX.js} +1 -1
  31. package/dist/{chunk-T4CFSGSL.js → chunk-HKLW5KTW.js} +6 -6
  32. package/dist/{chunk-NHIGOEZF.js → chunk-JK2KQ4PF.js} +1 -1
  33. package/dist/chunk-LOXV3J6X.js +1005 -0
  34. package/dist/{chunk-QRV7RNQX.js → chunk-LTGIQ7HO.js} +14 -14
  35. package/dist/{chunk-MIAJQGWE.js → chunk-LY2G6LHW.js} +1 -1
  36. package/dist/{chunk-PE4F4MJE.js → chunk-MDI265RK.js} +4 -4
  37. package/dist/{chunk-FOEVG7RT.js → chunk-N3W6PH55.js} +11 -11
  38. package/dist/chunk-OBMR6BEP.js +1 -0
  39. package/dist/{chunk-SBDIHKLU.js → chunk-TMZVVRTA.js} +20 -20
  40. package/dist/{chunk-ZZKIKW62.js → chunk-VOY6TCS2.js} +19 -19
  41. package/dist/{chunk-VJP3R52B.js → chunk-XNHYCOPO.js} +1 -1
  42. package/dist/file-intake/index.js +1 -1
  43. package/dist/i18n/index.d.ts +1 -1
  44. package/dist/{index-HMDUOPnX.d.ts → index-CzMz_Y9A.d.ts} +139 -3
  45. package/dist/index.d.ts +3 -3
  46. package/dist/index.js +479 -479
  47. package/dist/locales/zh-Hans.d.ts +1 -1
  48. package/dist/locales/zh-Hans.js +1 -1
  49. package/dist/map/index.js +5 -5
  50. package/dist/page-tabs/index.js +5 -5
  51. package/dist/pdf/index.js +1 -1
  52. package/dist/{strings-ZbotP_I6.d.ts → strings-BEuOOURI.d.ts} +21 -0
  53. package/dist/ui/index.d.ts +2 -2
  54. package/dist/ui/index.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/Calculator-4K53PFBL.js +0 -29
  57. package/dist/ConfirmDialog-X2DPOYWO.js +0 -1
  58. package/dist/Files-2VSFXA45.js +0 -87
  59. package/dist/PdfViewer-UZGDE4HD.js +0 -1
  60. package/dist/Sidebar-3NZRIL7F.js +0 -44
  61. package/dist/chunk-67PNFBCW.js +0 -993
  62. package/dist/chunk-J3LIIIHJ.js +0 -1
  63. package/dist/chunk-YKHMAGEM.js +0 -1
@@ -1,29 +0,0 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-MIAJQGWE.js";import{useWidgetSettings as n}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CheckFallbackB as l,CopyFallbackB as r}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as c}from"./chunk-YKZHOXI4.js";import{useState as a,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as u,Fragment as d,jsx as h}from"react/jsx-runtime";var m="calc_appearance";function b(){const[b,k]=a("0"),[p,g]=a(null),[f,y]=a(null),[x,N]=a(!1),[v,C]=a(""),[$,j]=a([]),[w,W]=a(!1),[E,S]=a(()=>e(m)),[T,F]=a(!1),[I,H]=a(E),A=i(null);n(o(()=>{H({...E}),F(!0)},[E]));const D=o(e=>{C(""),k(t=>x||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[x]),J=o(()=>{k("0"),g(null),y(null),N(!1)},[]),L=o((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),O=o(e=>{const t=parseFloat(b);if(null!==p&&f&&!x){const e=L(p,t,f);k(String(e)),g(e),j(n=>[`${p} ${f} ${t} = ${e}`,...n].slice(0,20))}else g(t);y(e),N(!0)},[b,p,f,x,L]),X=o(()=>{if(null===p||!f)return;const e=parseFloat(b),t=L(p,e,f),n=`${p} ${f} ${e} =`;j(e=>[`${n} ${t}`,...e].slice(0,20)),C(n),k(String(t)),g(null),y(null),N(!0)},[b,p,f,L]),Z=o(()=>{k(e=>String(parseFloat(e)/100))},[]),M=o(()=>{k(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);s(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?D(e.key):"."===e.key?D("."):"+"===e.key?O("+"):"-"===e.key?O("-"):"*"===e.key?O("×"):"/"===e.key?(e.preventDefault(),O("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&A.current?.contains(e.target)&&e.preventDefault(),X()):"Escape"===e.key?J():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&Z())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D,O,X,J,Z]);const Q="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",U=`${Q} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,B=`${Q} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,K=`${Q} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,P=`${Q} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
- return u(d,{children:[
3
- /* @__PURE__ */u("div",{ref:A,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
4
- /* @__PURE__ */u("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
- /* @__PURE__ */h("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:$.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */h("div",{className:"text-[11px] text-slate-400 text-right font-mono truncate",children:e},t))}),(v||f&&null!==p)&&/* @__PURE__ */h("div",{className:"text-base text-slate-600 text-right font-mono",children:v||`${p} ${f} ${x?"":b}`}),
6
- /* @__PURE__ */u("div",{className:"flex items-center gap-2",children:[
7
- /* @__PURE__ */h("button",{onClick:()=>{navigator.clipboard.writeText(b),W(!0),setTimeout(()=>W(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */h(c,w?{name:"check",fallback:l,className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",fallback:r,className:"h-5 w-5",strokeWidth:2})}),
8
- /* @__PURE__ */h("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(b)})]})]}),
9
- /* @__PURE__ */u("div",{className:"grid grid-cols-4 grid-rows-5 gap-1.5 flex-1 min-h-0 p-2",children:[
10
- /* @__PURE__ */h("button",{onClick:J,className:K,children:"AC"}),
11
- /* @__PURE__ */h("button",{onClick:M,className:K,children:"+/−"}),
12
- /* @__PURE__ */h("button",{onClick:Z,className:K,children:"%"}),
13
- /* @__PURE__ */h("button",{onClick:()=>O("÷"),className:`${B} ${"÷"===f?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
- /* @__PURE__ */h("button",{onClick:()=>D("7"),className:U,children:"7"}),
15
- /* @__PURE__ */h("button",{onClick:()=>D("8"),className:U,children:"8"}),
16
- /* @__PURE__ */h("button",{onClick:()=>D("9"),className:U,children:"9"}),
17
- /* @__PURE__ */h("button",{onClick:()=>O("×"),className:`${B} ${"×"===f?"ring-2 ring-blue-400":""}`,children:"×"}),
18
- /* @__PURE__ */h("button",{onClick:()=>D("4"),className:U,children:"4"}),
19
- /* @__PURE__ */h("button",{onClick:()=>D("5"),className:U,children:"5"}),
20
- /* @__PURE__ */h("button",{onClick:()=>D("6"),className:U,children:"6"}),
21
- /* @__PURE__ */h("button",{onClick:()=>O("-"),className:`${B} ${"-"===f?"ring-2 ring-blue-400":""}`,children:"−"}),
22
- /* @__PURE__ */h("button",{onClick:()=>D("1"),className:U,children:"1"}),
23
- /* @__PURE__ */h("button",{onClick:()=>D("2"),className:U,children:"2"}),
24
- /* @__PURE__ */h("button",{onClick:()=>D("3"),className:U,children:"3"}),
25
- /* @__PURE__ */h("button",{onClick:()=>O("+"),className:`${B} ${"+"===f?"ring-2 ring-blue-400":""}`,children:"+"}),
26
- /* @__PURE__ */h("button",{onClick:()=>D("0"),className:`${U} col-span-2`,children:"0"}),
27
- /* @__PURE__ */h("button",{onClick:()=>D("."),className:U,children:"."}),
28
- /* @__PURE__ */h("button",{onClick:X,className:P,children:"="})]})]}),
29
- /* @__PURE__ */h(t,{open:T,onClose:()=>F(!1),title:"Calculator Settings",appearance:I,onAppearanceChange:H,onSave:()=>{S(I),localStorage.setItem(m,JSON.stringify(I)),F(!1)}})]})}export{b as default};
@@ -1 +0,0 @@
1
- export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-ZZKIKW62.js";import"./chunk-AFYQTVZO.js";import"./chunk-X4FJ54PP.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";
@@ -1,87 +0,0 @@
1
- import{openPreviewFile as e}from"./chunk-NHIGOEZF.js";import{Breadcrumbs as t}from"./chunk-VJP3R52B.js";import{SidebarLayout as a}from"./chunk-PE4F4MJE.js";import{getFilesDemoTree as r}from"./chunk-P4SGJTK3.js";import{AboutApp as n}from"./chunk-TKUNR5KP.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as s,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as c,getDesktopFoldersSnapshot as d,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-LMIQV3NB.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as u}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import"./chunk-YKHMAGEM.js";import{toast_default as x}from"./chunk-3DGTIWZP.js";import"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as g,prompt as y}from"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CloseCircleFallback as b,ArrowLeftFallback as k,RefreshFallback as N,TrashFallback as w,FolderPlusFallback as v,UploadFallbackB as j,FolderFallback as $,PageFallback as C}from"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{formatBytes as D}from"./chunk-W32SKK3D.js";import{Icon as L}from"./chunk-YKZHOXI4.js";import{useState as T,useEffect as E,useSyncExternalStore as R,useRef as I,useCallback as P}from"react";import{jsxs as W,jsx as F,Fragment as S}from"react/jsx-runtime";var M="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",O={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function U(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function A(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function H(){const H=M.replace(/\/$/,""),K=null!==r(),[V,J]=T("/"),[B,z]=T([]),[Z,_]=T([]),[Q,X]=T(null),[G,Y]=T(!0),[q,ee]=T(!1),[te,ae]=T(null),[re,ne]=T(!1),[ie,se]=T(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});E(()=>{s()},[]);const[le,oe]=T([]);E(()=>{const e=()=>{s(),se("trash")},t=e=>{s();const t=e.detail?.folderId;t&&se({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const ce=R(c,d,d),de="object"==typeof ie?ie.desktopFolderId:null,me=de?ce?.folders.find(e=>e.id===de)??null:null,he=de&&ce?.itemsByFolder[de]||[];E(()=>{de&&ce&&!ce.folders.some(e=>e.id===de)&&se("files")},[de,ce]);const pe=I(0),fe=I(null),{openPage:ue,openEntity:xe}=f(),ge=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ue(e)}):"page"===t.entityType?ue(t.entityId):xe(t.entityType,t.entityId,null,t.label)},ye=P((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),be=P(async()=>{try{const e=await ye(`${H}/api/quota`);if(e.ok){const t=await e.json();ae({used:t.used,limit:t.limit})}}catch{}},[ye,H]),ke=P(async e=>{if(X(null),K){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return z(t),J(e),ee(!1),Y(!1),void("/"===e&&_(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Y(!0);try{const t=await ye(`${H}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];z(r),J(a.path||e),ee(!1),"/"===(a.path||e)&&_(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){ee(!0)}finally{Y(!1)}be()},[ye,H,be,K]),Ne=P(async()=>{if(K)return oe([]),void Y(!1);Y(!0),X(null);try{const e=await ye(`${H}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();oe(t.entries||[]),ee(!1)}catch{ee(!0)}finally{Y(!1)}be()},[ye,H,be,K]);E(()=>{"files"===ie?ke(V):"trash"===ie&&Ne()},[V,ie]);const we=async e=>{const t=U(V,e.name);try{const a=await ye(`${H}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void x.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},ve=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ye(`${H}/api/upload?path=${encodeURIComponent(V)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${D(a)} free, ${e.name} is ${D(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ke(V)},je=()=>{pe.current=0,ne(!1)};if(E(()=>{const e=()=>je();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),q)/* @__PURE__ */
2
- return W("div",{className:"flex flex-col h-full bg-white",children:[
3
- /* @__PURE__ */F(u,{title:"Files - offline"}),
4
- /* @__PURE__ */F("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */W("div",{className:"max-w-md",children:[
5
- /* @__PURE__ */F(L,{name:"close-circle",fallback:b,className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
6
- /* @__PURE__ */F("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
7
- /* @__PURE__ */W("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
8
- /* @__PURE__ */F("span",{className:"font-mono",children:H}),". Make sure the server is running — see ",
9
- /* @__PURE__ */F("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
10
- /* @__PURE__ */F("button",{onClick:()=>ke(V),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const $e="/"===V?[]:V.split("/").filter(Boolean),Ce=te&&te.limit>0?Math.min(100,Math.round(te.used/te.limit*100)):0,De=Ce>90?"bg-red-500":Ce>75?"bg-amber-500":"bg-blue-500",Le=[{label:"My files",onClick:()=>J("/")},...$e.map((e,t)=>({label:e,onClick:()=>J("/"+$e.slice(0,t+1).join("/"))}))],Te=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),Ee=e=>/* @__PURE__ */F("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */F("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),Re=/* @__PURE__ */W("nav",{className:"p-2",children:[
11
- /* @__PURE__ */F("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
12
- /* @__PURE__ */W("button",{onClick:()=>{se("files"),J("/")},className:Te("files"===ie&&"/"===V),children:[Ee("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),Z.map(e=>/* @__PURE__ */W("button",{onClick:()=>{se("files"),J("/"+e)},className:Te("files"===ie&&V==="/"+e),children:[Ee("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
13
- /* @__PURE__ */F("span",{className:"truncate",children:e})]},e)),!K&&/* @__PURE__ */W("button",{onClick:()=>se("trash"),className:Te("trash"===ie),children:[Ee("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),ce&&ce.folders.length>0&&/* @__PURE__ */W(S,{children:[
14
- /* @__PURE__ */F("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ce.folders.map(e=>/* @__PURE__ */W("button",{onClick:()=>se({desktopFolderId:e.id}),className:Te(de===e.id),children:[
15
- /* @__PURE__ */F(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
16
- /* @__PURE__ */F("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */F("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
17
- return W("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{K||"object"==typeof ie||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),pe.current++,re||ne(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{pe.current>0&&pe.current--,0===pe.current&&ne(!1)},onDrop:e=>{e.preventDefault(),je(),K||"object"==typeof ie||e.dataTransfer.files?.length&&ve(e.dataTransfer.files)},children:[
18
- /* @__PURE__ */F(u,{title:me?`Files - ${me.name}`:"Files"+("/"===V?"":" - "+V)}),
19
- /* @__PURE__ */F(n,{app:"files"}),
20
- /* @__PURE__ */F("input",{ref:fe,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ve(e.target.files),fe.current&&(fe.current.value="")}}),
21
- /* @__PURE__ */F("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */F(a,{sidebar:Re,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */W("div",{className:"flex h-full min-w-0 flex-col",children:[
22
- /* @__PURE__ */W("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */W(S,"files"===ie?{children:[
23
- /* @__PURE__ */F("button",{onClick:()=>J(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(V)),disabled:"/"===V,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */F(L,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
24
- /* @__PURE__ */F("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */F(t,{items:Le,maxItems:5})}),
25
- /* @__PURE__ */F("button",{onClick:()=>ke(V),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */F(L,{name:"refresh",fallback:N,className:"h-3.5 w-3.5",strokeWidth:1.8})}),!K&&/* @__PURE__ */W(S,{children:[
26
- /* @__PURE__ */W("button",{onClick:()=>se("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
27
- /* @__PURE__ */F(L,{name:"trash",fallback:w,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
28
- /* @__PURE__ */W("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void x.error("Folder names cannot contain slashes");const t=U(V,e),a=await ye(`${H}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Create folder failed (${a.status})`)}ke(V)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
29
- /* @__PURE__ */F(L,{name:"folder-plus",fallback:v,className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
30
- /* @__PURE__ */W("button",{onClick:()=>fe.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
31
- /* @__PURE__ */F(L,{name:"upload",fallback:j,className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ie?{children:[
32
- /* @__PURE__ */F("button",{onClick:()=>se("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */F(L,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
33
- /* @__PURE__ */F("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
34
- /* @__PURE__ */F("button",{onClick:Ne,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */F(L,{name:"refresh",fallback:N,className:"h-3.5 w-3.5",strokeWidth:1.8})}),
35
- /* @__PURE__ */F("button",{onClick:async()=>{if(0===le.length)return;if(!await g({title:"Empty trash",message:`${le.length} item${1===le.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await ye(`${H}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Empty trash failed (${e.status})`)}Ne()},disabled:0===le.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
36
- /* @__PURE__ */F("button",{onClick:()=>se("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */F(L,{name:"arrow-left",fallback:k,className:"h-3.5 w-3.5",strokeWidth:2})}),
37
- /* @__PURE__ */F(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
38
- /* @__PURE__ */F("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:me?.name??"Desktop folder"}),
39
- /* @__PURE__ */F("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),te&&/* @__PURE__ */W(S,{children:[
40
- /* @__PURE__ */F("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */W("div",{className:"flex items-center gap-1.5",title:`${D(te.used)} of ${D(te.limit)} used`,children:[
42
- /* @__PURE__ */F("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */F("div",{className:`h-full ${De} transition-all`,style:{width:`${Ce}%`}})}),
43
- /* @__PURE__ */W("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[D(te.used)," / ",D(te.limit)]})]})]})]}),
44
- /* @__PURE__ */F("div",{className:"flex-1 overflow-auto",children:"object"==typeof ie?0===he.length?/* @__PURE__ */F("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */W("table",{className:"w-full text-sm",children:[
45
- /* @__PURE__ */F("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */W("tr",{children:[
46
- /* @__PURE__ */F("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
47
- /* @__PURE__ */F("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
48
- /* @__PURE__ */F("th",{className:"w-56"})]})}),
49
- /* @__PURE__ */F("tbody",{children:he.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
50
- return W("tr",{onClick:()=>X(t),onDoubleClick:()=>ge(e),className:"cursor-default border-b border-gray-100 "+(Q===t?"bg-blue-50":"hover:bg-gray-50"),children:[
51
- /* @__PURE__ */W("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
52
- /* @__PURE__ */F(h,{item:e}),
53
- /* @__PURE__ */F("span",{className:"truncate",title:e.label,children:e.label})]}),
54
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-xs text-gray-500",children:p(e)}),
55
- /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
56
- /* @__PURE__ */F("button",{onClick:t=>{t.stopPropagation(),ge(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
57
- /* @__PURE__ */F("button",{onClick:t=>{t.stopPropagation(),ce?.moveToDesktop([e])},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Move to desktop"}),
58
- /* @__PURE__ */F("button",{onClick:t=>{t.stopPropagation(),ce?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===ie?G&&0===le.length?/* @__PURE__ */F("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===le.length?/* @__PURE__ */F("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */W("table",{className:"w-full text-sm",children:[
59
- /* @__PURE__ */F("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */W("tr",{children:[
60
- /* @__PURE__ */F("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
61
- /* @__PURE__ */F("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
62
- /* @__PURE__ */F("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
63
- /* @__PURE__ */F("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Deleted"}),
64
- /* @__PURE__ */F("th",{className:"w-44"})]})}),
65
- /* @__PURE__ */F("tbody",{children:le.map(e=>/* @__PURE__ */W("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
66
- /* @__PURE__ */W("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */F(L,{name:"folder",fallback:$,className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */F(L,{name:"page",fallback:C,className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
67
- /* @__PURE__ */F("span",{className:"truncate",title:e.name,children:e.name})]}),
68
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
69
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:D(e.size)}),
70
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?A(e.deletedAt):"—"}),
71
- /* @__PURE__ */W("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
72
- /* @__PURE__ */F("button",{onClick:()=>(async e=>{const t=await ye(`${H}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Restore failed (${t.status})`)}x.success(`Restored "${e.name}"`),Ne()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
73
- /* @__PURE__ */F("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await ye(`${H}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}Ne()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):G&&0===B.length?/* @__PURE__ */F("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===B.length?/* @__PURE__ */W("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!K&&/* @__PURE__ */W(S,{children:[" Drop files here or click ",
74
- /* @__PURE__ */F("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */W("table",{className:"w-full text-sm",children:[
75
- /* @__PURE__ */F("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */W("tr",{children:[
76
- /* @__PURE__ */F("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
77
- /* @__PURE__ */F("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
78
- /* @__PURE__ */F("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
79
- /* @__PURE__ */F("th",{className:"w-32"})]})}),
80
- /* @__PURE__ */F("tbody",{children:B.map(t=>/* @__PURE__ */W("tr",{onClick:()=>X(t.name),onDoubleClick:()=>{"folder"===t.kind?J(U(V,t.name)):(async t=>{if(K)return;const a=U(V,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=O[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>ue(e)}):we(t)})(t)},className:"cursor-default border-b border-gray-100 "+(Q===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
81
- /* @__PURE__ */W("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */F(L,{name:"folder",fallback:$,className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */F(L,{name:"page",fallback:C,className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
82
- /* @__PURE__ */F("span",{className:"truncate",title:t.name,children:t.name})]}),
83
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":D(t.size)}),
84
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:A(t.modifiedAt)}),
85
- /* @__PURE__ */F("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!K&&/* @__PURE__ */W(S,{children:["file"===t.kind&&/* @__PURE__ */F("button",{onClick:e=>{e.stopPropagation(),we(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
86
- /* @__PURE__ */F("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void x.error("Names cannot contain slashes");const a=U(V,e.name),r=U(V,t),n=await ye(`${H}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:r})});if(!n.ok){const e=await n.json().catch(()=>({}));return void x.error(e.error||`Rename failed (${n.status})`)}ke(V)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
87
- /* @__PURE__ */F("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=U(V,e.name),a=await ye(`${H}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${a.status})`)}ke(V)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),re&&/* @__PURE__ */F("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */F("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{H as default};
@@ -1 +0,0 @@
1
- export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-QRV7RNQX.js";import"./chunk-3DGTIWZP.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";
@@ -1,44 +0,0 @@
1
- import{useAuth as e,parseOpenSections as t,readStored as a,RAIL_OPEN_SECTIONS_KEY as r,toggleOpenSection as n,writeStored as l}from"./chunk-S2PS4IOT.js";import{partitionNav as i,BrandMark as o,openGlobalSearch as s,visibleNavChildren as c,visibleSectionItems as d,rowsContainRoute as m}from"./chunk-KDRAU4XQ.js";import{navSections as h,startMenuCategories as p,TAB_STRIP_H as u,navIcons as b,sectionIcons as g}from"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import{PopupMenu as f,PopupMenuItem as x,PopupMenuDivider as y}from"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{AccountFallback as k,ErrorFallback as N,DesktopFallback as v,LogoutFallback as w,ChevronDoubleLeftFallback as C,ChevronDoubleRightFallback as j,SearchFallback as S,ChevronDownFallback as A}from"./chunk-XUF7VW4U.js";import{useShellStrings as L}from"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{Icon as z}from"./chunk-YKZHOXI4.js";import{useMemo as $,useState as W,useRef as I,useEffect as H,isValidElement as R,cloneElement as T}from"react";import{jsx as K,jsxs as O}from"react/jsx-runtime";var D="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform),M=(e,t)=>["flex h-9 w-full items-center gap-2.5 rounded-md px-3 text-left text-[13.5px] font-medium transition-colors",t?"justify-center px-0":"",e?"bg-gray-100 text-gray-900":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"].join(" "),J="flex size-[18px] shrink-0 items-center justify-center [&>svg]:size-[18px]";function P({open:e}){/* @__PURE__ */
2
- return K(z,{name:"chevron-down",fallback:A,className:"size-4 shrink-0 text-gray-400 transition-transform "+(e?"rotate-180":""),strokeWidth:2,"aria-hidden":"true"})}function X({dir:e}){/* @__PURE__ */
3
- return K(z,"left"===e?{name:"chevron-double-left",fallback:C,className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"}:{name:"chevron-double-right",fallback:j,className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"})}function _({className:e}){/* @__PURE__ */
4
- return K(z,{name:"search",fallback:S,className:e,strokeWidth:2,"aria-hidden":"true"})}function Z({width:C,collapsed:j,onToggleCollapsed:S,onOpen:A,activeRoute:Z,profile:B,user:F,onLogout:Q,onSwitchToDesktop:U,onReportBug:V,navSections:Y=h,navIcons:q=b,sectionIcons:E=g,categories:G=p,productName:ee,productIcon:te,tagline:ae,adaptiveLogo:re=!1,logoHasAlpha:ne=null,logoIsLight:le=null}){const ie=L().layout,{hasAnyPerm:oe}=e(),se=$(()=>i(Y,G,oe),[Y,G,oe]),[ce,de]=W(()=>t(a(r))),me=e=>de(t=>{const a=n(t,e);return l(r,JSON.stringify([...a])),a}),[he,pe]=W(null),[ue,be]=W(!1),ge=I(null);H(()=>{j||pe(null)},[j]);const fe=(e,t)=>{pe(null),e.onSelect?e.onSelect():A(e.to,!!t&&(e=>e.metaKey||e.ctrlKey||1===e.button)(t))},xe=(e,t)=>{const a=t[e];/* @__PURE__ */
5
- return K("span",{className:J,"aria-hidden":"true",children:a&&R(a)?T(a,{className:"size-[18px]"}):a})},ye=(e,t)=>{const a=c(e,oe),r=e.menuLabel??e.label;if(a.length>0){const n=`child:${e.to}`,l=ce.has(n),i=!l&&m(a,Z,oe);/* @__PURE__ */
6
- return O("div",{children:[
7
- /* @__PURE__ */O("button",{type:"button",onClick:()=>me(n),"aria-expanded":l,className:M(i,!1),style:t>0?{paddingLeft:.75+1.75*t+"rem"}:void 0,children:[0===t&&xe(e.to,q),
8
- /* @__PURE__ */K("span",{className:"min-w-0 flex-1 truncate",children:r}),
9
- /* @__PURE__ */K(P,{open:l})]}),l&&/* @__PURE__ */K("div",{className:"space-y-0.5 pt-0.5",children:a.map(e=>ye(e,t+1))}),e.dividerAfter&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"})]},e.to)}const n=e.to===Z;/* @__PURE__ */
10
- return O("div",{children:[
11
- /* @__PURE__ */O("button",{type:"button",onClick:t=>fe(e,t),onAuxClick:t=>{1===t.button&&fe(e,t)},"aria-current":n?"page":void 0,className:M(n,!1),style:t>0?{paddingLeft:.75+1.75*t+"rem"}:void 0,children:[0===t&&xe(e.to,q),
12
- /* @__PURE__ */K("span",{className:"min-w-0 flex-1 truncate",children:r})]}),e.dividerAfter&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"})]},e.to)},ke=(e,t)=>{const a=t?e.items:d(e,oe);if(0===a.length)return null;const r="icon"in e&&e.icon?/* @__PURE__ */K("span",{className:J,"aria-hidden":"true",children:e.icon}):xe(e.label,E),n=e.menuLabel??e.label,l=m(a,Z,oe),i="dividerAfter"in e&&e.dividerAfter;if(j)/* @__PURE__ */
13
- return O("div",{children:[
14
- /* @__PURE__ */K("button",{type:"button",title:n,"aria-label":n,"aria-haspopup":"menu","aria-expanded":he?.label===e.label,onClick:t=>{const r=t.currentTarget.getBoundingClientRect();pe(t=>t?.label===e.label?null:{label:e.label,items:a,top:r.top})},className:M(l||he?.label===e.label,!0),children:r}),i&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"})]},e.label);const o=ce.has(e.label),s=`rosh-rail-${e.label.replace(/[^a-z0-9]+/gi,"-").toLowerCase()}`;/* @__PURE__ */
15
- return O("div",{children:[
16
- /* @__PURE__ */O("button",{type:"button",onClick:()=>me(e.label),"aria-expanded":o,"aria-controls":s,className:M(!o&&l,!1),children:[r,
17
- /* @__PURE__ */K("span",{className:"min-w-0 flex-1 truncate",children:n}),
18
- /* @__PURE__ */K(P,{open:o})]}),
19
- /* @__PURE__ */K("div",{id:s,role:"group","aria-label":n,hidden:!o,className:"space-y-0.5 pt-0.5",children:o&&a.map(e=>ye(e,1))}),i&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"})]},e.label)},Ne=B?.first_name?`${B.first_name} ${B.last_name||""}`.trim():F?.email||"",ve=(B?.first_name?.charAt(0)||F?.email?.charAt(0)||"?").toUpperCase(),we=B?.avatar_url?/* @__PURE__ */K("img",{src:B.avatar_url,alt:"",className:"size-8 shrink-0 rounded-full object-cover"}):/* @__PURE__ */K("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-blue-600 text-xs font-semibold text-white",children:ve}),Ce=ue?ge.current?.getBoundingClientRect():void 0,je=j?"px-2.5":"px-3",Se=se.erpSections.length>0||se.systemSections.length>0||se.virtualSections.length>0;/* @__PURE__ */
20
- return O("aside",{"aria-label":ie.navLabel,className:"fixed left-0 top-0 z-[260] flex h-dvh flex-col border-r border-gray-200 bg-white text-gray-800",style:{width:C},children:[
21
- /* @__PURE__ */O("div",{className:"flex shrink-0 items-center border-b border-gray-200 "+(j?"justify-center":"justify-between gap-2 pl-4 pr-2"),style:{height:u},children:[
22
- /* @__PURE__ */O("span",{className:"flex min-w-0 items-center gap-2",children:[te&&/* @__PURE__ */K(o,{src:te,alt:"",slot:"compact",surface:"light",adaptive:re,hasAlpha:ne,isLight:le,size:28,decorative:!0}),!j&&/* @__PURE__ */O("span",{className:"min-w-0 leading-tight",children:[
23
- /* @__PURE__ */K("span",{className:"block truncate text-[15px] font-bold tracking-wide text-gray-900",children:ee??"Apps"}),ae&&/* @__PURE__ */K("span",{className:"block truncate text-[11px] font-medium text-gray-500",children:ae})]})]}),!j&&/* @__PURE__ */K("button",{type:"button",onClick:S,"aria-label":ie.collapseSidebar,title:`${ie.collapseSidebar} (${D?"⌘":"Ctrl"} .)`,className:"flex size-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900",children:/* @__PURE__ */K(X,{dir:"left"})})]}),
24
- /* @__PURE__ */K("div",{className:`shrink-0 pt-3 ${je}`,children:j?/* @__PURE__ */K("button",{type:"button",onClick:s,"aria-label":ie.search,title:`${ie.search} (${D?"⌘K":"Ctrl K"})`,className:M(!1,!0),children:/* @__PURE__ */K(_,{className:"size-[18px]"})}):/* @__PURE__ */O("button",{type:"button",onClick:s,className:"flex h-[34px] w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-2.5 text-left transition-colors hover:bg-gray-100",children:[
25
- /* @__PURE__ */K(_,{className:"size-3.5 text-gray-500"}),
26
- /* @__PURE__ */K("span",{className:"min-w-0 flex-1 truncate text-[13px] text-gray-500",children:ie.search}),
27
- /* @__PURE__ */K("kbd",{className:"rounded border border-gray-200 bg-gray-100 px-1.5 py-0.5 font-mono text-[11px] font-semibold text-gray-500",children:D?"⌘K":"Ctrl K"})]})}),
28
- /* @__PURE__ */O("nav",{"aria-label":ie.navLabel,className:`min-h-0 flex-1 overflow-y-auto pb-4 pt-3 ${je} ${j?"space-y-1":"space-y-0.5"}`,children:[j&&/* @__PURE__ */K("button",{type:"button",onClick:S,"aria-label":ie.expandSidebar,title:`${ie.expandSidebar} (${D?"⌘":"Ctrl"} .)`,className:`${M(!1,!0)} mb-3`,children:/* @__PURE__ */K(X,{dir:"right"})}),se.topItems.map(e=>{if(!j)return ye(e,0);const t=c(e,oe),a=e.to===Z||m(t,Z,oe),r=e.menuLabel??e.label;/* @__PURE__ */
29
- return O("div",{children:[
30
- /* @__PURE__ */K("button",{type:"button",title:r,"aria-label":r,onClick:a=>{if(0===t.length)return void fe(e,a);const r=a.currentTarget.getBoundingClientRect();pe(a=>a?.label===e.to?null:{label:e.to,items:t,top:r.top})},className:M(a,!0),children:xe(e.to,q)}),e.dividerAfter&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"})]},e.to)}),se.topItems.length>0&&Se&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"}),se.erpSections.map(e=>ke(e,!1)),se.systemSections.map(e=>ke(e,!1)),se.virtualSections.map(e=>ke(e,!0)),se.footerSections.length>0&&/* @__PURE__ */K("div",{className:"mx-2 my-1.5 border-t border-gray-200","aria-hidden":"true"}),se.footerSections.map(e=>ke(e,!1))]}),
31
- /* @__PURE__ */K("div",{className:`shrink-0 border-t border-gray-200 py-2 ${je}`,children:/* @__PURE__ */O("button",{ref:ge,type:"button",onClick:()=>be(e=>!e),"aria-haspopup":"menu","aria-expanded":ue,"aria-label":j?ie.accountMenu(Ne):void 0,className:"flex w-full items-center gap-2.5 rounded-md hover:bg-gray-100 "+(j?"justify-center py-2":"px-2 py-2"),children:[we,!j&&/* @__PURE__ */O("span",{className:"min-w-0 flex-1 text-left",children:[
32
- /* @__PURE__ */K("span",{className:"block truncate text-[13px] font-semibold text-gray-800",children:Ne}),F?.email&&Ne!==F.email&&/* @__PURE__ */K("span",{className:"block truncate text-[11px] text-gray-500",children:F.email})]})]})}),ue&&Ce&&/* @__PURE__ */O(f,{portal:!0,minWidth:224,onClose:()=>be(!1),style:{left:Ce.left,bottom:window.innerHeight-Ce.top+8},children:[j&&/* @__PURE__ */O("div",{className:"border-b border-gray-200 px-3 py-2.5",children:[
33
- /* @__PURE__ */K("p",{className:"truncate text-sm font-semibold text-gray-800",children:Ne}),F?.email&&/* @__PURE__ */K("p",{className:"truncate text-xs text-gray-500",children:F.email})]}),
34
- /* @__PURE__ */O(x,{onClick:()=>{be(!1),A("/profile",!1)},children:[
35
- /* @__PURE__ */K(z,{name:"account",fallback:k,className:"h-4 w-4 text-gray-400",strokeWidth:1.5,"aria-hidden":"true"}),ie.profile]}),se.footerItems.map(e=>/* @__PURE__ */O(x,{onClick:()=>{be(!1),fe(e)},children:[
36
- /* @__PURE__ */K("span",{className:"h-4 w-4 text-gray-400 [&>svg]:size-4","aria-hidden":"true",children:q[e.to]}),e.menuLabel??e.label]},e.to)),V&&/* @__PURE__ */O(x,{onClick:()=>{be(!1),V()},children:[
37
- /* @__PURE__ */K(z,{name:"error",fallback:N,className:"h-4 w-4 text-gray-400",strokeWidth:1.5,"aria-hidden":"true"}),ie.reportIssue]}),
38
- /* @__PURE__ */K(y,{}),
39
- /* @__PURE__ */O(x,{onClick:()=>{be(!1),U()},children:[
40
- /* @__PURE__ */K(z,{name:"desktop",fallback:v,className:"h-4 w-4 text-gray-400",strokeWidth:1.5,"aria-hidden":"true"}),ie.switchToDesktop]}),
41
- /* @__PURE__ */K(y,{}),
42
- /* @__PURE__ */O(x,{danger:!0,onClick:()=>{be(!1),Q()},children:[
43
- /* @__PURE__ */K(z,{name:"logout",fallback:w,className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ie.signOut]})]}),he&&j&&/* @__PURE__ */K(f,{portal:!0,minWidth:220,onClose:()=>pe(null),style:{left:C+6,top:Math.min(he.top,window.innerHeight-48*Math.min(he.items.length,10)-16)},children:he.items.flatMap(e=>{const t=c(e,oe);return(t.length>0?t:[e]).map(e=>/* @__PURE__ */O(x,{onClick:()=>fe(e),children:[xe(e.to,q),
44
- /* @__PURE__ */K("span",{className:e.to===Z?"font-semibold":"",children:e.menuLabel??e.label})]},e.to))})})]})}export{Z as default};