efficient-shell 7.27.0 → 7.29.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.
- package/dist/{Browser-OL5LGTQ2.js → Browser-5DWPCWSB.js} +14 -14
- package/dist/Calculator-756J7AGT.js +29 -0
- package/dist/ConfirmDialog-GY3PLMAD.js +1 -0
- package/dist/CurrencyConverter-TVIYMDYE.js +21 -0
- package/dist/{Documents-MCMYMQQL.js → Documents-ZHENRDK2.js} +26 -26
- package/dist/Files-YKUTWABM.js +87 -0
- package/dist/Notepad-7MXZE6S4.js +25 -0
- package/dist/PdfViewer-T6SP6R6J.js +1 -0
- package/dist/{PomodoroTimer-BMBZ2TTC.js → PomodoroTimer-IUPEDDQV.js} +20 -20
- package/dist/{Preview-2BYPAVX5.js → Preview-6XGCKFXK.js} +20 -20
- package/dist/Sidebar-P3WJQSY5.js +44 -0
- package/dist/Spreadsheet-POFCH3DZ.js +37 -0
- package/dist/{Stock-4LFU53UL.js → Stock-MKUCNEAH.js} +3 -3
- package/dist/{Weather-BIOZMSPH.js → Weather-6Q7DSJR4.js} +18 -18
- package/dist/{WorldClock-BO6TIFOK.js → WorldClock-LTJJP4SS.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-OICSZKUO.js → chunk-2ECESCBH.js} +1 -1
- package/dist/chunk-2PNYIWIN.js +1 -0
- package/dist/{chunk-F2GDJO2Y.js → chunk-4EMCPU7W.js} +16 -16
- package/dist/{chunk-LG3UEPOI.js → chunk-BDXFODVC.js} +4 -4
- package/dist/chunk-BTLM7W6P.js +1 -0
- package/dist/{chunk-YJZ4VVDT.js → chunk-C4QIJNW3.js} +11 -11
- package/dist/{chunk-6RFXIPCN.js → chunk-DFCTQOIL.js} +1 -1
- package/dist/{chunk-GXHXNI55.js → chunk-DFEO2CGF.js} +1 -1
- package/dist/chunk-EFYGUYEZ.js +27 -0
- package/dist/{chunk-RMXUKHVK.js → chunk-GPHWFPXA.js} +1 -1
- package/dist/{chunk-DY43MKMT.js → chunk-H3ODY2XB.js} +1 -1
- package/dist/{chunk-H3U47ZEL.js → chunk-IIIUHK3J.js} +11 -11
- package/dist/{chunk-C2PGWIIO.js → chunk-JIHKEOLY.js} +1 -1
- package/dist/chunk-LKFJPLTO.js +1035 -0
- package/dist/{chunk-2I3Z4UFG.js → chunk-LU7X6LLY.js} +25 -25
- package/dist/{chunk-6JVUT3D4.js → chunk-OD3MT6SF.js} +2 -2
- package/dist/{chunk-6AXCLPSI.js → chunk-RAFTWZF5.js} +1 -1
- package/dist/chunk-REZ2UWJT.js +108 -0
- package/dist/{chunk-RVPQRXC4.js → chunk-RYBDLJJV.js} +1 -1
- package/dist/{chunk-ZXHA3XDM.js → chunk-T3UAIICC.js} +1 -1
- package/dist/chunk-V5MNUKAJ.js +1 -0
- package/dist/chunk-WOZ36LPR.js +9 -0
- package/dist/{chunk-Y6UXNQ42.js → chunk-X6ALQ2S6.js} +3 -3
- package/dist/chunk-XZXMVACA.js +5 -0
- package/dist/chunk-YO4FRA7Y.js +10 -0
- package/dist/{chunk-MEIVZG77.js → chunk-Z756FAL6.js} +9 -9
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-cfVn8e67.d.ts → index-CLkh3Bps.d.ts} +42 -2
- package/dist/index.d.ts +13 -13
- package/dist/index.js +678 -661
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +2 -2
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-DkffgGGm.d.ts → strings-DzmlWMRe.d.ts} +19 -0
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-HARXMYLM.js +0 -29
- package/dist/ConfirmDialog-VL3YU35U.js +0 -1
- package/dist/CurrencyConverter-KQ5UR4AU.js +0 -21
- package/dist/Files-CCP2UU4G.js +0 -87
- package/dist/Notepad-BAIEYDR6.js +0 -25
- package/dist/PdfViewer-4KFBJ4ZV.js +0 -1
- package/dist/Sidebar-GO32NHGH.js +0 -44
- package/dist/Spreadsheet-SQVOSXTU.js +0 -37
- package/dist/chunk-42B7TUEB.js +0 -1
- package/dist/chunk-CV3XVHWR.js +0 -108
- package/dist/chunk-DBWGMZCY.js +0 -1
- package/dist/chunk-MDM7YLWP.js +0 -1
- package/dist/chunk-QD22TNW3.js +0 -27
- package/dist/chunk-QKNGN4H4.js +0 -10
- package/dist/chunk-SZTKBF3D.js +0 -13
- package/dist/chunk-VROJD5KW.js +0 -1035
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-RMXUKHVK.js";import{useWidgetSettings as n}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{Icon as r}from"./chunk-B427NVDP.js";import{useState as l,useRef as c,useCallback as i,useEffect as a}from"react";import{jsxs as o,Fragment as s,jsx as u}from"react/jsx-runtime";var d="calc_appearance";function h(){const[h,m]=l("0"),[k,b]=l(null),[p,g]=l(null),[N,y]=l(!1),[x,f]=l(""),[v,C]=l([]),[$,j]=l(!1),[w,E]=l(()=>e(d)),[S,D]=l(!1),[T,W]=l(w),B=c(null);n(i(()=>{W({...w}),D(!0)},[w]));const F=i(e=>{f(""),m(t=>N||"0"===t?(y(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),K=i(()=>{m("0"),b(null),g(null),y(!1)},[]),M=i((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}},[]),G=i(e=>{const t=parseFloat(h);if(null!==k&&p&&!N){const e=M(k,t,p);m(String(e)),b(e),C(n=>[`${k} ${p} ${t} = ${e}`,...n].slice(0,20))}else b(t);g(e),y(!0)},[h,k,p,N,M]),V=i(()=>{if(null===k||!p)return;const e=parseFloat(h),t=M(k,e,p),n=`${k} ${p} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),f(n),m(String(t)),b(null),g(null),y(!0)},[h,k,p,M]),X=i(()=>{m(e=>String(parseFloat(e)/100))},[]),A=i(()=>{m(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);a(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?F(e.key):"."===e.key?F("."):"+"===e.key?G("+"):"-"===e.key?G("-"):"*"===e.key?G("×"):"/"===e.key?(e.preventDefault(),G("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&B.current?.contains(e.target)&&e.preventDefault(),V()):"Escape"===e.key?K():"Backspace"===e.key?m(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&X())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F,G,V,K,X]);const H="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",O=`${H} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,R=`${H} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,L=`${H} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,Q=`${H} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
-
return o(s,{children:[
|
|
3
|
-
/* @__PURE__ */o("div",{ref:B,className:"flex flex-col h-full",style:{opacity:w.activeOpacity/100,backdropFilter:w.activeBlur>0?`blur(${w.activeBlur}px)`:void 0},children:[
|
|
4
|
-
/* @__PURE__ */o("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__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:v.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(x||p&&null!==k)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:x||`${k} ${p} ${N?"":h}`}),
|
|
6
|
-
/* @__PURE__ */o("div",{className:"flex items-center gap-2",children:[
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(h),j(!0),setTimeout(()=>j(!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__ */u(r,$?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
-
/* @__PURE__ */u("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)})(h)})]})]}),
|
|
9
|
-
/* @__PURE__ */o("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
-
/* @__PURE__ */u("button",{onClick:K,className:L,children:"AC"}),
|
|
11
|
-
/* @__PURE__ */u("button",{onClick:A,className:L,children:"+/−"}),
|
|
12
|
-
/* @__PURE__ */u("button",{onClick:X,className:L,children:"%"}),
|
|
13
|
-
/* @__PURE__ */u("button",{onClick:()=>G("÷"),className:`${R} ${"÷"===p?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
-
/* @__PURE__ */u("button",{onClick:()=>F("7"),className:O,children:"7"}),
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:()=>F("8"),className:O,children:"8"}),
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>F("9"),className:O,children:"9"}),
|
|
17
|
-
/* @__PURE__ */u("button",{onClick:()=>G("×"),className:`${R} ${"×"===p?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
-
/* @__PURE__ */u("button",{onClick:()=>F("4"),className:O,children:"4"}),
|
|
19
|
-
/* @__PURE__ */u("button",{onClick:()=>F("5"),className:O,children:"5"}),
|
|
20
|
-
/* @__PURE__ */u("button",{onClick:()=>F("6"),className:O,children:"6"}),
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>G("-"),className:`${R} ${"-"===p?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:()=>F("1"),className:O,children:"1"}),
|
|
23
|
-
/* @__PURE__ */u("button",{onClick:()=>F("2"),className:O,children:"2"}),
|
|
24
|
-
/* @__PURE__ */u("button",{onClick:()=>F("3"),className:O,children:"3"}),
|
|
25
|
-
/* @__PURE__ */u("button",{onClick:()=>G("+"),className:`${R} ${"+"===p?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
-
/* @__PURE__ */u("button",{onClick:()=>F("0"),className:`${O} col-span-2`,children:"0"}),
|
|
27
|
-
/* @__PURE__ */u("button",{onClick:()=>F("."),className:O,children:"."}),
|
|
28
|
-
/* @__PURE__ */u("button",{onClick:V,className:Q,children:"="})]})]}),
|
|
29
|
-
/* @__PURE__ */u(t,{open:S,onClose:()=>D(!1),title:"Calculator Settings",appearance:T,onAppearanceChange:W,onSave:()=>{E(T),localStorage.setItem(d,JSON.stringify(T)),D(!1)}})]})}export{h as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-F2GDJO2Y.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-FIEA5CGB.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-RMXUKHVK.js";import{useWidgetSettings as r}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import{LoadingSpinner as n}from"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";import{useState as a,useCallback as s,useEffect as o}from"react";import{jsxs as c,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",d="currency_appearance",h="currency_rates_cache";function g(e){try{const t=JSON.parse(localStorage.getItem(h)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function f(e,t){try{const r=JSON.parse(localStorage.getItem(h)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(h,JSON.stringify(r))}catch{}}function N(){try{const e=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return u}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function x(){const[u,h]=a(N),[x,b]=a(()=>e(d)),[S,D]=a({}),[k,v]=a(!1),[j,C]=a(!1),[B,U]=a([]),[J,K]=a(x),[R,G]=a("USD"),[H,O]=a("CNY");r(s(()=>{U([...u]),K({...x}),C(!0)},[u,x])),o(()=>{const e=[...new Set(u.map(([e])=>e))];let t=!0;return async function(){v(!0);const r={};for(const t of e){const e=g(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,f(t,n.rates))}catch{}}t&&(D(r),v(!1))}(),()=>{t=!1}},[u]);/* @__PURE__ */
|
|
2
|
-
return c(i,{children:[
|
|
3
|
-
/* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${x.activeOpacity/100})`,backdropFilter:x.activeBlur>0?`blur(${x.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[k&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([e,t],r)=>{const n=S[e]?.[t];/* @__PURE__ */
|
|
4
|
-
return c("button",{onClick:()=>{const e=u.map((e,t)=>t===r?[e[1],e[0]]:e);h(e),localStorage.setItem(p,JSON.stringify(e))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
5
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
6
|
-
/* @__PURE__ */l("span",{className:"text-base",children:y[e]||""}),
|
|
7
|
-
/* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:e}),
|
|
8
|
-
/* @__PURE__ */l("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
|
|
9
|
-
/* @__PURE__ */l("span",{className:"text-base",children:y[t]||""}),
|
|
10
|
-
/* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
|
|
11
|
-
/* @__PURE__ */l("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
|
|
12
|
-
/* @__PURE__ */l(t,{open:j,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:K,onSave:()=>{if(0===B.length)return;const e=B.slice(0,4);h(e),b(J),localStorage.setItem(p,JSON.stringify(e)),localStorage.setItem(d,JSON.stringify(J)),C(!1)},children:/* @__PURE__ */c("div",{children:[
|
|
13
|
-
/* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",B.length,"/",4,")"]})]}),
|
|
15
|
-
/* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:B.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
|
-
/* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
|
|
17
|
-
/* @__PURE__ */l("button",{onClick:()=>U(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),B.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
-
/* @__PURE__ */l("select",{value:R,onChange:e=>G(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
|
|
19
|
-
/* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */l("select",{value:H,onChange:e=>O(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
|
|
21
|
-
/* @__PURE__ */l("button",{onClick:()=>{R!==H&&B.length<4&&U(e=>[...e,[R,H]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{x as default};
|
package/dist/Files-CCP2UU4G.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-6AXCLPSI.js";import{Breadcrumbs as t}from"./chunk-ZXHA3XDM.js";import{SidebarLayout as a}from"./chunk-LG3UEPOI.js";import{TH_ONE_LINE as r}from"./chunk-RVPQRXC4.js";import{getFilesDemoTree as n}from"./chunk-MZHH3MC7.js";import{AboutApp as s}from"./chunk-Y6UXNQ42.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as l,FILES_SHOW_TRASH_EVENT as o,FILES_OPEN_DESKTOP_FOLDER_EVENT as d,subscribeDesktopFolders as c,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-Y6UUDJNU.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import{toast_default as g}from"./chunk-42B7TUEB.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import{LoadingSpinner as y}from"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import{confirm as b,prompt as k}from"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-MDM7YLWP.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{formatBytes as N}from"./chunk-W32SKK3D.js";import{Icon as w}from"./chunk-B427NVDP.js";import{useState as v,useEffect as $,useSyncExternalStore as j,useRef as C,useCallback as D}from"react";import{jsxs as L,jsx as E,Fragment as T}from"react/jsx-runtime";var R="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",S={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 M(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function P(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 W(){const W=R.replace(/\/$/,""),F=null!==n(),[U,I]=v("/"),[O,A]=v([]),[V,B]=v([]),[H,K]=v(null),[z,X]=v(!0),[G,Q]=v(!1),[_,J]=v(null),[Y,Z]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});$(()=>{l()},[]);const[te,ae]=v([]);$(()=>{const e=()=>{l(),ee("trash")},t=e=>{l();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(o,e),window.addEventListener(d,t),()=>{window.removeEventListener(o,e),window.removeEventListener(d,t)}},[]);const re=j(c,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?re?.folders.find(e=>e.id===ne)??null:null,ie=ne&&re?.itemsByFolder[ne]||[];$(()=>{ne&&re&&!re.folders.some(e=>e.id===ne)&&ee("files")},[ne,re]);const le=C(0),oe=C(null),{openPage:de,openEntity:ce}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>de(e)}):"page"===t.entityType?de(t.entityId):ce(t.entityType,t.entityId,null,t.label)},he=D((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=D(async()=>{try{const e=await he(`${W}/api/quota`);if(e.ok){const t=await e.json();J({used:t.used,limit:t.limit})}}catch{}},[he,W]),ue=D(async e=>{if(K(null),F){const t=function(e){const t=n();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 A(t),I(e),Q(!1),X(!1),void("/"===e&&B(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}X(!0);try{const t=await he(`${W}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void g.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];A(r),I(a.path||e),Q(!1),"/"===(a.path||e)&&B(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Q(!0)}finally{X(!1)}pe()},[he,W,pe,F]),fe=D(async()=>{if(F)return ae([]),void X(!1);X(!0),K(null);try{const e=await he(`${W}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void g.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ae(t.entries||[]),Q(!1)}catch{Q(!0)}finally{X(!1)}pe()},[he,W,pe,F]);$(()=>{"files"===q?ue(U):"trash"===q&&fe()},[U,q]);const xe=async e=>{const t=M(U,e.name);try{const a=await he(`${W}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void g.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){g.error(e?.message||"Download failed")}},ge=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await he(`${W}/api/upload?path=${encodeURIComponent(U)}`,{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));g.error(`Quota exceeded — ${N(a)} free, ${e.name} is ${N(t.attempted||e.size)}`)}else g.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){g.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(U)},ye=()=>{le.current=0,Z(!1)};if($(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),G)/* @__PURE__ */
|
|
2
|
-
return L("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
|
-
/* @__PURE__ */E(x,{title:"Files - offline"}),
|
|
4
|
-
/* @__PURE__ */E("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */L("div",{className:"max-w-md",children:[
|
|
5
|
-
/* @__PURE__ */E(w,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
|
|
6
|
-
/* @__PURE__ */E("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
|
|
7
|
-
/* @__PURE__ */L("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
|
-
/* @__PURE__ */E("span",{className:"font-mono",children:W}),". Make sure the server is running — see ",
|
|
9
|
-
/* @__PURE__ */E("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
-
/* @__PURE__ */E("button",{onClick:()=>ue(U),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===U?[]:U.split("/").filter(Boolean),ke=_&&_.limit>0?Math.min(100,Math.round(_.used/_.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>I("/")},...be.map((e,t)=>({label:e,onClick:()=>I("/"+be.slice(0,t+1).join("/"))}))],ve=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),$e=e=>/* @__PURE__ */E("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__ */E("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),je=/* @__PURE__ */L("nav",{className:"p-2",children:[
|
|
11
|
-
/* @__PURE__ */E("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
|
|
12
|
-
/* @__PURE__ */L("button",{onClick:()=>{ee("files"),I("/")},className:ve("files"===q&&"/"===U),children:[$e("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"]}),V.map(e=>/* @__PURE__ */L("button",{onClick:()=>{ee("files"),I("/"+e)},className:ve("files"===q&&U==="/"+e),children:[$e("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__ */E("span",{className:"truncate",children:e})]},e)),!F&&/* @__PURE__ */L("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[$e("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"]}),re&&re.folders.length>0&&/* @__PURE__ */L(T,{children:[
|
|
14
|
-
/* @__PURE__ */E("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),re.folders.map(e=>/* @__PURE__ */L("button",{onClick:()=>ee({desktopFolderId:e.id}),className:ve(ne===e.id),children:[
|
|
15
|
-
/* @__PURE__ */E(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
16
|
-
/* @__PURE__ */E("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */E("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
|
|
17
|
-
return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{F||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),le.current++,Y||Z(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{le.current>0&&le.current--,0===le.current&&Z(!1)},onDrop:e=>{e.preventDefault(),ye(),F||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
|
|
18
|
-
/* @__PURE__ */E(x,{title:se?`Files - ${se.name}`:"Files"+("/"===U?"":" - "+U)}),
|
|
19
|
-
/* @__PURE__ */E(s,{app:"files"}),
|
|
20
|
-
/* @__PURE__ */E("input",{ref:oe,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ge(e.target.files),oe.current&&(oe.current.value="")}}),
|
|
21
|
-
/* @__PURE__ */E("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */E(a,{sidebar:je,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */L("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
22
|
-
/* @__PURE__ */L("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */L(T,"files"===q?{children:[
|
|
23
|
-
/* @__PURE__ */E("button",{onClick:()=>I(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(U)),disabled:"/"===U,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */E(w,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
24
|
-
/* @__PURE__ */E("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */E(t,{items:we,maxItems:5})}),
|
|
25
|
-
/* @__PURE__ */E("button",{onClick:()=>ue(U),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */E(w,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!F&&/* @__PURE__ */L(T,{children:[
|
|
26
|
-
/* @__PURE__ */L("button",{onClick:()=>ee("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
|
|
27
|
-
/* @__PURE__ */E(w,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
|
|
28
|
-
/* @__PURE__ */L("button",{onClick:async()=>{const e=await k({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void g.error("Folder names cannot contain slashes");const t=M(U,e),a=await he(`${W}/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 g.error(e.error||`Create folder failed (${a.status})`)}ue(U)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
29
|
-
/* @__PURE__ */E(w,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
|
|
30
|
-
/* @__PURE__ */L("button",{onClick:()=>oe.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__ */E(w,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===q?{children:[
|
|
32
|
-
/* @__PURE__ */E("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */E(w,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
33
|
-
/* @__PURE__ */E("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
|
|
34
|
-
/* @__PURE__ */E("button",{onClick:fe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */E(w,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
|
|
35
|
-
/* @__PURE__ */E("button",{onClick:async()=>{if(0===te.length)return;if(!await b({title:"Empty trash",message:`${te.length} item${1===te.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await he(`${W}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void g.error(t.error||`Empty trash failed (${e.status})`)}fe()},disabled:0===te.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
|
|
36
|
-
/* @__PURE__ */E("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */E(w,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
37
|
-
/* @__PURE__ */E(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
38
|
-
/* @__PURE__ */E("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
|
|
39
|
-
/* @__PURE__ */E("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),_&&/* @__PURE__ */L(T,{children:[
|
|
40
|
-
/* @__PURE__ */E("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */L("div",{className:"flex items-center gap-2",title:`${N(_.used)} of ${N(_.limit)} used`,children:[
|
|
42
|
-
/* @__PURE__ */E("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */E("div",{className:`h-full ${Ne} transition-all`,style:{width:`${ke}%`}})}),
|
|
43
|
-
/* @__PURE__ */L("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[N(_.used)," / ",N(_.limit)]})]})]})]}),
|
|
44
|
-
/* @__PURE__ */E("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ie.length?/* @__PURE__ */E("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__ */L("table",{className:"w-full text-sm",children:[
|
|
45
|
-
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */L("tr",{children:[
|
|
46
|
-
/* @__PURE__ */E("th",{className:`${r} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
47
|
-
/* @__PURE__ */E("th",{className:`${r} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
|
|
48
|
-
/* @__PURE__ */E("th",{className:`${r} w-56`})]})}),
|
|
49
|
-
/* @__PURE__ */E("tbody",{children:ie.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
50
|
-
return L("tr",{onClick:()=>K(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(H===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
51
|
-
/* @__PURE__ */L("td",{className:"px-3 h-8 flex items-center gap-2",children:[
|
|
52
|
-
/* @__PURE__ */E(p,{item:e}),
|
|
53
|
-
/* @__PURE__ */E("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
54
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-xs text-gray-500",children:u(e)}),
|
|
55
|
-
/* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
56
|
-
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),me(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
|
|
57
|
-
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Move to desktop"}),
|
|
58
|
-
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?z&&0===te.length?/* @__PURE__ */E(y,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
|
|
59
|
-
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */L("tr",{children:[
|
|
60
|
-
/* @__PURE__ */E("th",{className:`${r} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
61
|
-
/* @__PURE__ */E("th",{className:`${r} text-left font-medium px-3 h-8`,children:"Original location"}),
|
|
62
|
-
/* @__PURE__ */E("th",{className:`${r} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
63
|
-
/* @__PURE__ */E("th",{className:`${r} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
|
|
64
|
-
/* @__PURE__ */E("th",{className:`${r} w-44`})]})}),
|
|
65
|
-
/* @__PURE__ */E("tbody",{children:te.map(e=>/* @__PURE__ */L("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
|
|
66
|
-
/* @__PURE__ */L("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */E(w,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */E(w,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
67
|
-
/* @__PURE__ */E("span",{className:"truncate",title:e.name,children:e.name})]}),
|
|
68
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
|
|
69
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:N(e.size)}),
|
|
70
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?P(e.deletedAt):"—"}),
|
|
71
|
-
/* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
72
|
-
/* @__PURE__ */E("button",{onClick:()=>(async e=>{const t=await he(`${W}/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 g.error(e.error||`Restore failed (${t.status})`)}g.success(`Restored "${e.name}"`),fe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
|
|
73
|
-
/* @__PURE__ */E("button",{onClick:()=>(async e=>{if(!await b({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await he(`${W}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void g.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):z&&0===O.length?/* @__PURE__ */E(y,{size:"sm",padding:"p-6",label:"Loading"}):0===O.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!F&&/* @__PURE__ */L(T,{children:[" Drop files here or click ",
|
|
74
|
-
/* @__PURE__ */E("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
|
|
75
|
-
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */L("tr",{children:[
|
|
76
|
-
/* @__PURE__ */E("th",{className:`${r} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
77
|
-
/* @__PURE__ */E("th",{className:`${r} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
78
|
-
/* @__PURE__ */E("th",{className:`${r} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
|
|
79
|
-
/* @__PURE__ */E("th",{className:`${r} w-32`})]})}),
|
|
80
|
-
/* @__PURE__ */E("tbody",{children:O.map(t=>/* @__PURE__ */L("tr",{onClick:()=>K(t.name),onDoubleClick:()=>{"folder"===t.kind?I(M(U,t.name)):(async t=>{if(F)return;const a=M(U,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=S[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>de(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(H===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
81
|
-
/* @__PURE__ */L("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */E(w,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */E(w,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
82
|
-
/* @__PURE__ */E("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
83
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":N(t.size)}),
|
|
84
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:P(t.modifiedAt)}),
|
|
85
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!F&&/* @__PURE__ */L(T,{children:["file"===t.kind&&/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),xe(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
|
|
86
|
-
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await k({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void g.error("Names cannot contain slashes");const a=M(U,e.name),r=M(U,t),n=await he(`${W}/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 g.error(e.error||`Rename failed (${n.status})`)}ue(U)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
|
|
87
|
-
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await b({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=M(U,e.name),a=await he(`${W}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void g.error(e.error||`Delete failed (${a.status})`)}ue(U)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),Y&&/* @__PURE__ */E("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__ */E("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{W as default};
|
package/dist/Notepad-BAIEYDR6.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-C2PGWIIO.js";import{SidebarLayout as t}from"./chunk-LG3UEPOI.js";import{AboutApp as r}from"./chunk-Y6UXNQ42.js";import{useWindowManager as n,client_default as o}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import{toast_default as i}from"./chunk-42B7TUEB.js";import{useShellPrefs as s}from"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-MDM7YLWP.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{timeAgo as a}from"./chunk-W32SKK3D.js";import{Icon as c}from"./chunk-B427NVDP.js";import{useRef as l,useEffect as d,useState as p,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var b={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},f=/\[([ xX]?)\]/g;function k(){const{openEntity:k}=n(),{prefs:v,save:N}=s(),{data:w}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),_=l({});d(()=>{if(!w)return;const e={};for(const t of w){const r=b[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}_.current=e},[w]);const j=v.notepad_notes||[],[T,C]=p(null),[$,W]=p(""),[S,D]=p(""),[X,O]=p("yellow"),[K,I]=p(!1),[B,G]=p(!1),M=l(null),P=l(),U=j.find(e=>e.id===T);d(()=>{if(!T&&j.length>0){const e=j[0];C(e.id),W(e.title),D(e.content),O(e.color)}},[j.length]);const E=m(e=>{N({notepad_notes:e})},[N]),V=m(()=>{if(!T||!K)return;const e=j.map(e=>e.id===T?{...e,title:$,content:S,color:X,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);E(e),I(!1)},[T,K,$,S,X,j,E]);d(()=>{if(K)return P.current&&clearTimeout(P.current),P.current=setTimeout(V,800),()=>{P.current&&clearTimeout(P.current)}},[K,V]),d(()=>()=>{K&&V()},[]);const q=e=>{K&&V(),C(e.id),W(e.title),D(e.content),O(e.color),I(!1),G(!1)},F=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);D(t+n+o),I(!0)},Q=async(e,t)=>{const r=_.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?k(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},R="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",Y=/* @__PURE__ */h(y,{children:[
|
|
2
|
-
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{K&&V();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...j];E(t),C(e.id),W(""),D(""),O("yellow"),I(!1),G(!0),setTimeout(()=>M.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
|
|
3
|
-
/* @__PURE__ */g(c,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
4
|
-
/* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===j.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."}):j.map(e=>{const t=(r=e.color,x.find(e=>e.key===r)||x[0]);var r;/* @__PURE__ */
|
|
5
|
-
return h("button",{onClick:()=>q(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(T===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
6
|
-
/* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
|
|
7
|
-
/* @__PURE__ */g("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
|
|
8
|
-
/* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g(c,{name:"bookmark",look:"solid",className:"h-3 w-3 text-amber-500 shrink-0"})]}),
|
|
9
|
-
/* @__PURE__ */g("p",{className:"text-xs text-gray-400 mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
|
|
10
|
-
/* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:a(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
|
-
return h("div",{className:"h-full",children:[
|
|
12
|
-
/* @__PURE__ */g(r,{app:"notepad"}),
|
|
13
|
-
/* @__PURE__ */g(t,{sidebar:Y,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:T?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
14
|
-
/* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
|
|
15
|
-
/* @__PURE__ */g("input",{value:$,onChange:e=>{W(e.target.value),I(!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:()=>{O(e.key),I(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${X===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=j.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);E(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(T),title:U?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(U?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(c,{name:"bookmark",className:"h-4 w-4",fill:U?.sticky?"currentColor":"none",strokeWidth:1.5})}),
|
|
18
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(E(t),T===e){const e=t[0];e?q(e):(C(null),W(""),D(""))}})(T),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(c,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),B?/* @__PURE__ */g("textarea",{ref:M,value:S,onChange:e=>{D(e.target.value),I(!0)},onBlur:()=>{G(!1),K&&V()},placeholder:R,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:()=>{G(!0),setTimeout(()=>M.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:S?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=s.exec(e));){const e=a[1],t=a[2];if(_.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>Q(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}f.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(a=f.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=l+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>F(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(c,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:""},`empty-${r}`));const d=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
19
|
-
return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(S):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:R})}),
|
|
20
|
-
/* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
|
|
21
|
-
/* @__PURE__ */g("span",{children:"[] checkbox"}),
|
|
22
|
-
/* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
|
|
23
|
-
/* @__PURE__ */g("span",{className:"ml-auto",children:B?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
|
|
24
|
-
/* @__PURE__ */g(c,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
|
|
25
|
-
/* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-YJZ4VVDT.js";import"./chunk-42B7TUEB.js";import"./chunk-NVFKXL52.js";import"./chunk-K7PQXJO7.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";
|
package/dist/Sidebar-GO32NHGH.js
DELETED
|
@@ -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 i}from"./chunk-S2PS4IOT.js";import{partitionNav as l,BrandMark as s,openGlobalSearch as o,visibleNavChildren as c,visibleSectionItems as d,rowsContainRoute as m}from"./chunk-QD22TNW3.js";import{navSections as h,startMenuCategories as u,TAB_STRIP_H as p,navIcons as b,sectionIcons as g}from"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import{PopupMenu as f,PopupMenuItem as y,PopupMenuDivider as x}from"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import{useShellStrings as N}from"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{Icon as v}from"./chunk-B427NVDP.js";import{useMemo as k,useState as w,useRef as C,useEffect as j,isValidElement as S,cloneElement as z}from"react";import{jsx as L,jsxs as A}from"react/jsx-runtime";var W="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform),$=(e,t)=>["flex h-(--row-height-menu) w-full items-center gap-3 rounded-md px-3 text-left text-sm 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(" "),I="flex size-[18px] shrink-0 items-center justify-center [&>svg]:size-[18px]";function B({open:e}){/* @__PURE__ */
|
|
2
|
-
return L(v,{name:"chevron-down",className:"size-4 shrink-0 transition-transform "+(e?"rotate-180":""),strokeWidth:2,"aria-hidden":"true"})}function M({dir:e}){/* @__PURE__ */
|
|
3
|
-
return L(v,"left"===e?{name:"chevron-double-left",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"}:{name:"chevron-double-right",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"})}function T({className:e}){/* @__PURE__ */
|
|
4
|
-
return L(v,{name:"search",className:e,strokeWidth:2,"aria-hidden":"true"})}function D({width:D,collapsed:K,onToggleCollapsed:R,onOpen:H,activeRoute:O,profile:_,user:P,onLogout:G,onSwitchToDesktop:Q,onReportBug:V,navSections:X=h,navIcons:F=b,sectionIcons:J=g,categories:U=u,productName:Y,productIcon:E,tagline:Z,adaptiveLogo:q=!1,logoHasAlpha:ee=null,logoIsLight:te=null}){const ae=N().layout,{hasAnyPerm:re}=e(),ne=k(()=>l(X,U,re),[X,U,re]),[ie,le]=w(()=>t(a(r))),se=e=>le(t=>{const a=n(t,e);return i(r,JSON.stringify([...a])),a}),[oe,ce]=w(null),[de,me]=w(!1),he=C(null);j(()=>{K||ce(null)},[K]);const ue=(e,t)=>{ce(null),e.onSelect?e.onSelect():H(e.to,!!t&&(e=>e.metaKey||e.ctrlKey||1===e.button)(t))},pe=(e,t)=>{const a=t[e];/* @__PURE__ */
|
|
5
|
-
return L("span",{className:I,"aria-hidden":"true",children:a&&S(a)?z(a,{className:"size-[18px]"}):a})},be=(e,t)=>{const a=c(e,re),r=e.menuLabel??e.label;if(a.length>0){const n=`child:${e.to}`,i=ie.has(n),l=!i&&m(a,O,re);/* @__PURE__ */
|
|
6
|
-
return A("div",{children:[
|
|
7
|
-
/* @__PURE__ */A("button",{type:"button",onClick:()=>se(n),"aria-expanded":i,className:$(l,!1),style:t>0?{paddingLeft:.75+1.75*t+"rem"}:void 0,children:[0===t&&pe(e.to,F),
|
|
8
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate",children:r}),
|
|
9
|
-
/* @__PURE__ */L(B,{open:i})]}),i&&/* @__PURE__ */L("div",{className:"space-y-0.5 pt-0.5",children:a.map(e=>be(e,t+1))}),e.dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)}const n=e.to===O;/* @__PURE__ */
|
|
10
|
-
return A("div",{children:[
|
|
11
|
-
/* @__PURE__ */A("button",{type:"button",onClick:t=>ue(e,t),onAuxClick:t=>{1===t.button&&ue(e,t)},"aria-current":n?"page":void 0,className:$(n,!1),style:t>0?{paddingLeft:.75+1.75*t+"rem"}:void 0,children:[0===t&&pe(e.to,F),
|
|
12
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate",children:r})]}),e.dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)},ge=(e,t)=>{const a=t?e.items:d(e,re);if(0===a.length)return null;const r="icon"in e&&e.icon?/* @__PURE__ */L("span",{className:I,"aria-hidden":"true",children:e.icon}):pe(e.label,J),n=e.menuLabel??e.label,i=m(a,O,re),l="dividerAfter"in e&&e.dividerAfter;if(K)/* @__PURE__ */
|
|
13
|
-
return A("div",{children:[
|
|
14
|
-
/* @__PURE__ */L("button",{type:"button",title:n,"aria-label":n,"aria-haspopup":"menu","aria-expanded":oe?.label===e.label,onClick:t=>{const r=t.currentTarget.getBoundingClientRect();ce(t=>t?.label===e.label?null:{label:e.label,items:a,top:r.top})},className:$(i||oe?.label===e.label,!0),children:r}),l&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.label);const s=ie.has(e.label),o=`rosh-rail-${e.label.replace(/[^a-z0-9]+/gi,"-").toLowerCase()}`;/* @__PURE__ */
|
|
15
|
-
return A("div",{children:[
|
|
16
|
-
/* @__PURE__ */A("button",{type:"button",onClick:()=>se(e.label),"aria-expanded":s,"aria-controls":o,className:$(!s&&i,!1),children:[r,
|
|
17
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate",children:n}),
|
|
18
|
-
/* @__PURE__ */L(B,{open:s})]}),
|
|
19
|
-
/* @__PURE__ */L("div",{id:o,role:"group","aria-label":n,hidden:!s,className:"space-y-0.5 pt-0.5",children:s&&a.map(e=>be(e,1))}),l&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.label)},fe=_?.first_name?`${_.first_name} ${_.last_name||""}`.trim():P?.email||"",ye=(_?.first_name?.charAt(0)||P?.email?.charAt(0)||"?").toUpperCase(),xe=_?.avatar_url?/* @__PURE__ */L("img",{src:_.avatar_url,alt:"",className:"size-8 shrink-0 rounded-full object-cover"}):/* @__PURE__ */L("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-blue-600 text-xs font-semibold text-white",children:ye}),Ne=de?he.current?.getBoundingClientRect():void 0,ve="px-3",ke=ne.erpSections.length>0||ne.systemSections.length>0||ne.virtualSections.length>0;/* @__PURE__ */
|
|
20
|
-
return A("aside",{"aria-label":ae.navLabel,className:"fixed left-0 top-0 z-(--z-sidebar) flex h-dvh flex-col border-r border-gray-200 bg-white text-gray-800",style:{width:D},children:[
|
|
21
|
-
/* @__PURE__ */A("div",{className:"flex shrink-0 items-center border-b border-gray-200 "+(K?"justify-center":"justify-between gap-2 pl-4 pr-2"),style:{height:p},children:[
|
|
22
|
-
/* @__PURE__ */A("span",{className:"flex min-w-0 items-center gap-2",children:[E&&/* @__PURE__ */L(s,{src:E,alt:"",slot:"compact",surface:"light",adaptive:q,hasAlpha:ee,isLight:te,size:28,decorative:!0}),!K&&/* @__PURE__ */A("span",{className:"min-w-0 leading-tight",children:[
|
|
23
|
-
/* @__PURE__ */L("span",{className:"block truncate text-base font-bold tracking-wide text-gray-900",children:Y??"Apps"}),Z&&/* @__PURE__ */L("span",{className:"block truncate text-2xs font-medium text-gray-500",children:Z})]})]}),!K&&/* @__PURE__ */L("button",{type:"button",onClick:R,"aria-label":ae.collapseSidebar,title:`${ae.collapseSidebar} (${W?"⌘":"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__ */L(M,{dir:"left"})})]}),
|
|
24
|
-
/* @__PURE__ */L("div",{className:`shrink-0 pt-3 ${ve}`,children:K?/* @__PURE__ */L("button",{type:"button",onClick:o,"aria-label":ae.search,title:`${ae.search} (${W?"⌘K":"Ctrl K"})`,className:$(!1,!0),children:/* @__PURE__ */L(T,{className:"size-[18px]"})}):/* @__PURE__ */A("button",{type:"button",onClick:o,className:"flex h-(--row-height-menu) w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-3 text-left transition-colors hover:bg-gray-100",children:[
|
|
25
|
-
/* @__PURE__ */L(T,{className:"size-3.5 text-gray-500"}),
|
|
26
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate text-sm text-gray-500",children:ae.search}),
|
|
27
|
-
/* @__PURE__ */L("kbd",{className:"rounded border border-gray-200 bg-gray-100 px-2 py-0.5 font-mono text-2xs font-semibold text-gray-500",children:W?"⌘K":"Ctrl K"})]})}),
|
|
28
|
-
/* @__PURE__ */A("nav",{"aria-label":ae.navLabel,className:`min-h-0 flex-1 overflow-y-auto pb-4 pt-3 ${ve} ${K?"space-y-1":"space-y-0.5"}`,children:[K&&/* @__PURE__ */L("button",{type:"button",onClick:R,"aria-label":ae.expandSidebar,title:`${ae.expandSidebar} (${W?"⌘":"Ctrl"} .)`,className:`${$(!1,!0)} mb-3`,children:/* @__PURE__ */L(M,{dir:"right"})}),ne.topItems.map(e=>{if(!K)return be(e,0);const t=c(e,re),a=e.to===O||m(t,O,re),r=e.menuLabel??e.label;/* @__PURE__ */
|
|
29
|
-
return A("div",{children:[
|
|
30
|
-
/* @__PURE__ */L("button",{type:"button",title:r,"aria-label":r,onClick:a=>{if(0===t.length)return void ue(e,a);const r=a.currentTarget.getBoundingClientRect();ce(a=>a?.label===e.to?null:{label:e.to,items:t,top:r.top})},className:$(a,!0),children:pe(e.to,F)}),e.dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)}),ne.topItems.length>0&&ke&&!ne.topItems[ne.topItems.length-1].dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"}),ne.erpSections.map(e=>ge(e,!1)),ne.systemSections.map(e=>ge(e,!1)),ne.virtualSections.map(e=>ge(e,!0)),ne.footerSections.length>0&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"}),ne.footerSections.map(e=>ge(e,!1))]}),
|
|
31
|
-
/* @__PURE__ */L("div",{className:`shrink-0 border-t border-gray-200 py-2 ${ve}`,children:/* @__PURE__ */A("button",{ref:he,type:"button",onClick:()=>me(e=>!e),"aria-haspopup":"menu","aria-expanded":de,"aria-label":K?ae.accountMenu(fe):void 0,className:"flex w-full items-center gap-3 rounded-md hover:bg-gray-100 "+(K?"justify-center py-2":"px-2 py-2"),children:[xe,!K&&/* @__PURE__ */A("span",{className:"min-w-0 flex-1 text-left",children:[
|
|
32
|
-
/* @__PURE__ */L("span",{className:"block truncate text-sm font-semibold text-gray-800",children:fe}),P?.email&&fe!==P.email&&/* @__PURE__ */L("span",{className:"block truncate text-2xs text-gray-500",children:P.email})]})]})}),de&&Ne&&/* @__PURE__ */A(f,{portal:!0,minWidth:224,onClose:()=>me(!1),style:{left:Ne.left,bottom:window.innerHeight-Ne.top+8},children:[K&&/* @__PURE__ */A("div",{className:"border-b border-gray-200 px-3 py-3",children:[
|
|
33
|
-
/* @__PURE__ */L("p",{className:"truncate text-sm font-semibold text-gray-800",children:fe}),P?.email&&/* @__PURE__ */L("p",{className:"truncate text-xs text-gray-500",children:P.email})]}),
|
|
34
|
-
/* @__PURE__ */A(y,{onClick:()=>{me(!1),H("/profile",!1)},children:[
|
|
35
|
-
/* @__PURE__ */L(v,{name:"account",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.profile]}),ne.footerItems.map(e=>/* @__PURE__ */A(y,{onClick:()=>{me(!1),ue(e)},children:[
|
|
36
|
-
/* @__PURE__ */L("span",{className:"h-4 w-4 [&>svg]:size-4","aria-hidden":"true",children:F[e.to]}),e.menuLabel??e.label]},e.to)),V&&/* @__PURE__ */A(y,{onClick:()=>{me(!1),V()},children:[
|
|
37
|
-
/* @__PURE__ */L(v,{name:"error",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.reportIssue]}),
|
|
38
|
-
/* @__PURE__ */L(x,{}),
|
|
39
|
-
/* @__PURE__ */A(y,{onClick:()=>{me(!1),Q()},children:[
|
|
40
|
-
/* @__PURE__ */L(v,{name:"desktop",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.switchToDesktop]}),
|
|
41
|
-
/* @__PURE__ */L(x,{}),
|
|
42
|
-
/* @__PURE__ */A(y,{danger:!0,onClick:()=>{me(!1),G()},children:[
|
|
43
|
-
/* @__PURE__ */L(v,{name:"logout",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.signOut]})]}),oe&&K&&/* @__PURE__ */L(f,{portal:!0,minWidth:220,onClose:()=>ce(null),style:{left:D+6,top:Math.min(oe.top,window.innerHeight-48*Math.min(oe.items.length,10)-16)},children:oe.items.flatMap(e=>{const t=c(e,re);return(t.length>0?t:[e]).map(e=>/* @__PURE__ */A(y,{onClick:()=>ue(e),children:[pe(e.to,F),
|
|
44
|
-
/* @__PURE__ */L("span",{className:e.to===O?"font-semibold":"",children:e.menuLabel??e.label})]},e.to))})})]})}export{D as default};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import{EditableGrid as e}from"./chunk-MEIVZG77.js";import"./chunk-BR22X7E5.js";import"./chunk-RVPQRXC4.js";import{AboutApp as t}from"./chunk-Y6UXNQ42.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-MDM7YLWP.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";import{useRef as l,useState as s,useEffect as c,useCallback as i}from"react";import{jsxs as u,jsx as d,Fragment as h}from"react/jsx-runtime";var m="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p=10,x=30;function g(e){return e<26?m[e]:m[Math.floor(e/26)-1]+m[e%26]}function y(e){return Array.from({length:e},(e,t)=>({key:`col_${t}`,title:g(t),width:100}))}function b(e,t){return Array.from({length:e},()=>Array(t).fill(""))}function f(e){return{id:crypto.randomUUID(),name:e,columns:y(p),data:b(x,p),cellStyles:{}}}function v(e){return e.split("\n").map(e=>{if(e.includes("\t"))return e.split("\t").map(e=>e.trim());const t=[];let r="",n=!1;for(const o of e)'"'!==o?","!==o||n?r+=o:(t.push(r.trim()),r=""):n=!n;return t.push(r.trim()),t}).filter(e=>e.some(e=>e.trim()))}function k(e,t){const r=v(e);if(0===r.length)return null;const n=Math.max(p,r.reduce((e,t)=>Math.max(e,t.length),0)),o=r.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));return{id:crypto.randomUUID(),name:t,columns:y(n),data:o,cellStyles:{}}}function w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),N=(()=>{const e=g.current;if(!e)return null;const t=k(e.data.csv,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,j]=s(N?[N.sheet]:[f("Sheet 1")]),[S,M]=s(0),D=l([]),U=l(C),$=l(!1);c(()=>{$.current?$.current=!1:U.current!==C&&(D.current.push(U.current),D.current.length>50&&D.current.shift()),U.current=C},[C]);const E=i(()=>{const e=D.current.pop();e&&($.current=!0,j(e))},[]);c(()=>{const e=e=>{if(!m.current?.contains(document.activeElement)&&!m.current?.matches(":focus-within"))return;(e.ctrlKey||e.metaKey)&&!e.shiftKey&&("z"===e.key||"Z"===e.key)&&(e.preventDefault(),E())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E]);const[A,L]=s(N?.title??"Untitled"),[R,B]=s(()=>g.current?.data.onEmail),K=i(e=>{const t=k(e.csv,"Sheet 1");t&&(j([t]),M(0),L(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),B(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&K(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&K(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[F,V]=s(!1),[X,I]=s(null),[G,O]=s(""),Q=l(null),[H,W]=s("1"),[Y,P]=s("10"),T=C[S]||C[0],Z=T.data,z=T.columns,J=T.cellStyles??{},[_,q]=s(null),[ee,te]=s(null),re=i(()=>{if(ee){const e=Math.min(ee.anchor.row,ee.end.row),t=Math.max(ee.anchor.row,ee.end.row),r=Math.min(ee.anchor.col,ee.end.col),n=Math.max(ee.anchor.col,ee.end.col),o=[];for(let a=e;a<=t;a++)for(let e=r;e<=n;e++)o.push({row:a,col:e});return o}return _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&j(n=>n.map((n,o)=>{if(o!==S)return n;const a={...n.cellStyles??{}},l=`${r[0].row}:${r[0].col}`,s=void 0!==t?t:!(a[l]??{})[e];for(const{row:t,col:n}of r){const r=`${t}:${n}`;a[r]={...a[r]??{},[e]:s}}return{...n,cellStyles:a}}))},[re,S]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?J[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{j(t=>t.map((t,r)=>r===S?{...t,...e}:t))},[S]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==z.length?se({data:e,columns:y(t)}):se({data:e})},[se,z.length]),ie=(e,t)=>{j(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),I(null)},ue=()=>Z.filter(e=>e.some(e=>e.trim())).map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n"),de=[];Z.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=Z.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
|
|
2
|
-
return u("div",{ref:m,className:"flex flex-col h-full",children:[
|
|
3
|
-
/* @__PURE__ */d(a,{title:`${me=A||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
|
|
4
|
-
/* @__PURE__ */d(t,{app:"spreadsheet"}),
|
|
5
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[F?/* @__PURE__ */d("input",{type:"text",value:A,onChange:e=>L(e.target.value),onBlur:()=>V(!1),onKeyDown:e=>{"Enter"===e.key&&V(!1)},autoFocus:!0,className:"text-sm font-medium text-gray-900 border border-gray-300 rounded px-2 py-0.5 w-40 focus:border-blue-500 focus:ring-blue-500"}):/* @__PURE__ */d("button",{onClick:()=>V(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:A||"Untitled"}),
|
|
6
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
7
|
-
/* @__PURE__ */d("input",{ref:Q,type:"file",accept:".csv,.tsv,.txt,.xlsx,.xls,.ods",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");if(/\.(xlsx|xls|ods)$/i.test(t.name)){const e=new Uint8Array(await t.arrayBuffer()),n=await(import("xlsx")),o=n.read(e,{type:"array"}),a=o.SheetNames.map(e=>{const t=n.utils.sheet_to_json(o.Sheets[e],{header:1,defval:""}),r=Math.max(p,t.reduce((e,t)=>Math.max(e,t.length),0)),a=t.map(e=>{const t=e.map(e=>String(e??""));for(;t.length<r;)t.push("");return t});for(;a.length<x;)a.push(Array(r).fill(""));return{id:crypto.randomUUID(),name:e,columns:y(r),data:a}});j(a),M(0),L(r)}else{const e=v(await t.text());if(0===e.length)return;const n=Math.max(p,e.reduce((e,t)=>Math.max(e,t.length),0)),o=e.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));se({columns:y(n),data:o}),L(r)}Q.current&&(Q.current.value="")},className:"hidden"}),
|
|
8
|
-
/* @__PURE__ */d("button",{onClick:()=>Q.current?.click(),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Open"}),
|
|
9
|
-
/* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${A||"spreadsheet"}.csv`,r.click(),URL.revokeObjectURL(t)},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save CSV"}),R&&/* @__PURE__ */d("button",{onClick:()=>R(ue(),`${A||"spreadsheet"}.csv`),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Email"}),
|
|
10
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
11
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
12
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:H,onChange:e=>W(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
|
|
13
|
-
/* @__PURE__ */d("button",{onClick:()=>(e=>{const t=z.length+e;se({columns:y(t),data:Z.map(t=>[...t,...Array(e).fill("")])})})(parseInt(H)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
|
|
14
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
15
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:Y,onChange:e=>P(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
|
|
16
|
-
/* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(Y)||10,void se({data:[...Z,...Array.from({length:e},()=>Array(z.length).fill(""))]});var e},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Row"})]}),
|
|
17
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
18
|
-
/* @__PURE__ */d("button",{onClick:()=>{se({columns:y(p),data:b(x,p)})},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Clear"}),
|
|
19
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
20
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5",title:le?"":"Click a cell first",children:[
|
|
21
|
-
/* @__PURE__ */d("button",{onClick:()=>ne("bold"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors font-bold ${ae.bold?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"B"}),
|
|
22
|
-
/* @__PURE__ */d("button",{onClick:()=>ne("italic"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors italic ${ae.italic?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"I"}),
|
|
23
|
-
/* @__PURE__ */d("button",{onClick:()=>ne("underline"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors underline ${ae.underline?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"U"}),
|
|
24
|
-
/* @__PURE__ */u("select",{value:ae.fontSize??"base",onChange:e=>ne("fontSize",e.target.value),disabled:!le,className:"ml-1 text-xs border border-gray-300 rounded px-1 py-0.5 bg-white disabled:opacity-40 disabled:cursor-not-allowed",children:[
|
|
25
|
-
/* @__PURE__ */d("option",{value:"sm",children:"XS"}),
|
|
26
|
-
/* @__PURE__ */d("option",{value:"base",children:"S"}),
|
|
27
|
-
/* @__PURE__ */d("option",{value:"lg",children:"M"}),
|
|
28
|
-
/* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
|
|
29
|
-
/* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:z,data:Z,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:J,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
|
|
30
|
-
/* @__PURE__ */u("div",{className:"flex items-center border-t border-gray-200 bg-gray-50 shrink-0",children:[
|
|
31
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[C.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>M(t),onDoubleClick:()=>{I(t),O(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(j(t=>t.filter((t,r)=>r!==e)),S>=e&&S>0&&M(S-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===S?"bg-white text-blue-700 border border-t-0 border-gray-300 -mt-px relative z-10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:X===t?/* @__PURE__ */d("input",{type:"text",value:G,onChange:e=>O(e.target.value),onBlur:()=>ie(t,G||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,G||e.name),"Escape"===r.key&&I(null)},onClick:e=>e.stopPropagation(),autoFocus:!0,className:"w-20 text-xs border border-blue-400 rounded px-1 py-0 focus:ring-0 focus:outline-none"}):e.name},e.id)),
|
|
32
|
-
/* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;j(t=>[...t,f(e)]),M(C.length)},className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Add sheet",children:"+"})]}),
|
|
33
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-4 px-3 py-1 text-xs text-gray-500 shrink-0 border-l border-gray-200",children:[
|
|
34
|
-
/* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
|
|
35
|
-
/* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
|
|
36
|
-
/* @__PURE__ */u("span",{children:["Avg: ",(de.reduce((e,t)=>e+t,0)/de.length).toLocaleString(void 0,{maximumFractionDigits:2})]})]}),
|
|
37
|
-
/* @__PURE__ */u("span",{children:[Z.length," × ",z.length]})]})]})]});var me}export{w as default};
|
package/dist/chunk-42B7TUEB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{buttonClasses as t}from"./chunk-K7PQXJO7.js";import{currentShellStrings as e}from"./chunk-DBWGMZCY.js";var n="http://www.w3.org/2000/svg",o={},s=/* @__PURE__ */new Map;function r(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var i={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",loading:"M12 3a9 9 0 019 9",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function a(t,e){const o=document.createElementNS(n,"svg");o.setAttribute("class",e),o.setAttribute("fill","none"),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","2");const s=document.createElementNS(n,"path");return s.setAttribute("stroke-linecap","round"),"loading"!==t&&s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",i[t]),o.appendChild(s),o}function c(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function l(e,n,i){const l={...o,...i},d=l.placement??"top",u=l.sticky??!1,m=`${d}|${e}|${n}`;if(l.dedupe){const t=s.get(m);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==e&&!1!==l.sound&&import("./sounds-FO772MN2.js").then(t=>{"success"===e?t.playSuccess():"error"===e?t.playError():t.playNotification()}).catch(()=>{});const p="bottom"===d?r("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col-reverse gap-2 items-center pointer-events-none"):r("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col gap-2 items-center pointer-events-none"),f="bottom"===d?"translateY(10px)":"translateY(-10px)",h=c("pointer-events-auto cursor-pointer rosh-toast");h.style.opacity="0",h.style.transform=`${f} scale(0.95)`,h.setAttribute("role","error"===e?"alert":"status"),h.setAttribute("aria-atomic","true"),h.appendChild(a(e,`h-4 w-4 rosh-tone-${e}${"loading"===e?" animate-spin":""}`));const v=document.createElement("span");if(v.textContent=n,h.appendChild(v),l.action){const{label:e,onClick:n}=l.action,o=document.createElement("button");o.type="button",o.className=t({variant:"link",size:"sm"}),o.textContent=e,o.addEventListener("click",t=>{t.stopPropagation(),g||(n(),b("action"))}),h.appendChild(o)}let y;p.appendChild(h),requestAnimationFrame(()=>{h.style.opacity="1",h.style.transform="translateY(0) scale(1)"});let g=!1;const b=t=>{g||(g=!0,y&&clearTimeout(y),s.delete(m),h.style.opacity="0",h.style.transform=`${f} scale(0.95)`,setTimeout(()=>h.remove(),300),l.onClose?.(t))},x=()=>b("dismissed"),C=l.duration??("info"===e?4500:3e3),E=()=>{y&&clearTimeout(y),u||(y=setTimeout(()=>b("timeout"),C))};return E(),h.addEventListener("mouseenter",()=>{y&&clearTimeout(y)}),h.addEventListener("mouseleave",()=>{g||E()}),h.addEventListener("click",x),s.set(m,{el:h,restart:E,dismiss:x}),{dismiss:x}}var d={success:(t,e)=>l("success",t,e),error:(t,e)=>l("error",t,e),warning:(t,e)=>l("warning",t,e),info:(t,e)=>l("info",t,e),notify:(t,n)=>function(t,n){!1!==(n?.sound??o.sound)&&import("./sounds-FO772MN2.js").then(t=>t.playNotification()).catch(()=>{});const s=r("notif-container","fixed top-4 right-4 z-(--z-toast) flex flex-col gap-3 items-end pointer-events-none"),i=c("pointer-events-auto cursor-pointer rosh-notif");i.style.opacity="0",i.style.transform="translateX(30px) scale(0.95)";const l=c("rosh-notif-badge");l.appendChild(a("bell","h-5 w-5"));const d=c("rosh-notif-body");d.append(c("rosh-notif-title",e().toast.notification),c("notif-msg rosh-notif-msg",t));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",i.append(l,d,u);const m=()=>{i.style.opacity="0",i.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>i.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),i.addEventListener("click",m),s.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateX(0) scale(1)"}),setTimeout(m,n?.duration??1e4)}(t,n),promise:(t,e,n)=>{const o=l("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),l("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),l("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{o={...t}}};export{d as toast_default};
|