efficient-shell 16.3.0 → 16.4.1
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-FO7ICGJP.js → Browser-LCX3F2VY.js} +16 -16
- package/dist/{Calculator-MBHZSFJ6.js → Calculator-ZCDSQCRN.js} +23 -23
- package/dist/{CurrencyConverter-7FPB7WJE.js → CurrencyConverter-ZLHZOLYE.js} +9 -9
- package/dist/{Files-XUGJSFME.js → Files-TMEV736Q.js} +18 -18
- package/dist/{Notepad-Q3YNHSWM.js → Notepad-EWLJWILB.js} +8 -8
- package/dist/{PomodoroTimer-TYSJOYDJ.js → PomodoroTimer-DIIU6KRF.js} +65 -65
- package/dist/{Preview-56C2XB7V.js → Preview-CG2KGNSM.js} +14 -14
- package/dist/{Stock-Y74YC25V.js → Stock-VW2AUUD6.js} +3 -3
- package/dist/{Weather-EO4LYAPA.js → Weather-ZGQHMHNW.js} +18 -18
- package/dist/{WorldClock-3E3KLHSD.js → WorldClock-GYRJWYQM.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/attributes-CseTvqC-.d.ts +49 -0
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-EF75NNOR.js → chunk-3UCJ6SGP.js} +1 -1
- package/dist/chunk-4MYFHXU7.js +1 -0
- package/dist/chunk-4N24K3UX.js +1 -0
- package/dist/{chunk-5L7II37P.js → chunk-5MJO7RMB.js} +3 -3
- package/dist/chunk-74SCWPQF.js +1 -0
- package/dist/{chunk-V77UETV3.js → chunk-HHGSWUGI.js} +1 -1
- package/dist/{chunk-HOSLX3ST.js → chunk-IXGJTYOG.js} +3 -3
- package/dist/chunk-KT57MRN4.js +1 -0
- package/dist/chunk-OMOAD5LL.js +1 -0
- package/dist/{chunk-XNPCOWOO.js → chunk-S5JX4IAP.js} +1 -1
- package/dist/{chunk-ZV2ZAHZV.js → chunk-UJ5772FB.js} +1 -1
- package/dist/chunk-WS4C6Z22.js +1 -0
- package/dist/engine-T4D3AZOO.js +1 -0
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/icons/brands.node.js +1 -1
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.js +38 -38
- package/dist/model-stage/index.d.ts +154 -0
- package/dist/model-stage/index.js +4 -0
- package/dist/model-viewer/index.d.ts +3 -49
- package/dist/model-viewer/index.js +6 -6
- package/dist/routine-index.json +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/value-index.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +13 -3
- package/dist/chunk-CLFXMTD2.js +0 -1
- package/dist/chunk-EV5BEEVO.js +0 -1
- package/dist/chunk-FHNQC2MA.js +0 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import{InputEndActionButton as e}from"./chunk-BYTQRQ5P.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-
|
|
1
|
+
import{InputEndActionButton as e}from"./chunk-BYTQRQ5P.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-IXGJTYOG.js";import{WindowTitle as n}from"./chunk-S5JX4IAP.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as s}from"./chunk-OLXUMB2V.js";import"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-4MYFHXU7.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import{Icon as i}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var p="react-os-shell:browser-bookmarks",d="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(p);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(d)||k}function j(){const h=a(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,j]=l(k||b),[C,R]=l(w),[W,L]=l([w]),[P,H]=l(0),[S,T]=l(0),[U,z]=l(x),[G,Y]=l(!1),[D,J]=l(null),M=a(null),O=a(null);c(()=>{try{localStorage.setItem(p,JSON.stringify(U))}catch{}},[U]);const Z=e=>{const t=f(e);t&&(j(t),R(t),L(e=>{const o=e.slice(0,P+1);return o.push(t),o}),H(e=>e+1),Y(!1))},B=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},E=()=>{const e=D?.trim();e?(z(t=>[...t,{label:e,url:w}]),J(null)):J(null)};c(()=>{if(null===D)return;M.current?.focus(),M.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||J(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==D]);const A=e=>{z(t=>t.filter((t,o)=>o!==e))},I=P>0,Q=P<W.length-1,V=U.some(e=>e.url===w),X="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
|
-
/* @__PURE__ */u(n,{title:`Browser - ${
|
|
3
|
+
/* @__PURE__ */u(n,{title:`Browser - ${v(w)}`}),
|
|
4
4
|
/* @__PURE__ */u(r,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(P>0){const e=P-1;
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(P<W.length-1){const e=P+1;
|
|
8
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(P>0){const e=P-1;H(e),j(W[e]),R(W[e]),Y(!1)}},disabled:!I,className:X,title:"Back",children:/* @__PURE__ */u(i,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(P<W.length-1){const e=P+1;H(e),j(W[e]),R(W[e]),Y(!1)}},disabled:!Q,className:X,title:"Forward",children:/* @__PURE__ */u(i,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("button",{onClick:()=>T(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */u(i,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */u("button",{onClick:()=>Z(b),className:X,title:"Home",children:/* @__PURE__ */u(i,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),Z(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>R(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),w!==C&&
|
|
13
13
|
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(i,{name:"close"}),onClick:()=>R(w)}})})]})}),
|
|
14
|
-
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
14
|
+
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>V?A(U.findIndex(e=>e.url===w)):void J(v(w)),className:X+" "+(V?"text-yellow-500":""),title:V?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(i,{name:"star",className:"h-4 w-4",fill:V?"currentColor":"none",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:B,className:X,title:"Open in new tab",children:/* @__PURE__ */u(i,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>Y(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */u(i,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==D&&/* @__PURE__ */m("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
17
17
|
/* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
18
18
|
/* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
|
|
19
|
-
/* @__PURE__ */u("input",{ref:
|
|
19
|
+
/* @__PURE__ */u("input",{ref:M,type:"text",value:D,onChange:e=>J(e.target.value),onKeyDown:e=>{"Enter"===e.key?E():"Escape"===e.key&&J(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:
|
|
23
|
-
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>J(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:E,disabled:!D.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
23
|
+
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===U.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),U.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>Z(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&A(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
24
24
|
/* @__PURE__ */u("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
25
25
|
/* @__PURE__ */u("div",{className:"flex-1"}),
|
|
26
26
|
/* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(d,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
27
|
-
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(
|
|
27
|
+
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(N,{url:w,iframeKey:S,iframeRef:O,openExternal:B,showHelp:G,dismissHelp:()=>Y(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[a,p]=l(!1);c(()=>{p(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!a?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
|
|
28
28
|
/* @__PURE__ */u(i,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
29
|
-
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[
|
|
29
|
+
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
30
30
|
/* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
31
31
|
/* @__PURE__ */u("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
|
|
32
32
|
/* @__PURE__ */u("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-
|
|
1
|
+
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-UJ5772FB.js";import{useWidgetSettings as n}from"./chunk-S5JX4IAP.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-OLXUMB2V.js";import"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import{Icon as r}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as l,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[j,b]=c(null),[g,N]=c(!1),[y,C]=c(""),[x,f]=c([]),[v,$]=c(!1),[T,B]=c(()=>t(h)),[J,P]=c(!1),[Z,E]=c(T),U=i(null);n(o(()=>{E({...T}),P(!0)},[T]));const W=o(t=>{C(""),k(e=>g||"0"===e?(N(!1),"."===t?"0.":t):"."===t&&e.includes(".")?e:e+t)},[g]),A=o(()=>{k("0"),d(null),b(null),N(!1)},[]),R=o((t,e,n)=>{switch(n){case"+":return t+e;case"-":return t-e;case"×":return t*e;case"÷":return 0===e?0:t/e;default:return e}},[]),S=o(t=>{const e=parseFloat(m);if(null!==p&&j&&!g){const t=R(p,e,j);k(String(t)),d(t),f(n=>[`${p} ${j} ${e} = ${t}`,...n].slice(0,20))}else d(e);b(t),N(!0)},[m,p,j,g,R]),F=o(()=>{if(null===p||!j)return;const t=parseFloat(m),e=R(p,t,j),n=`${p} ${j} ${t} =`;f(t=>[`${n} ${e}`,...t].slice(0,20)),C(n),k(String(e)),d(null),b(null),N(!0)},[m,p,j,R]),G=o(()=>{k(t=>String(parseFloat(t)/100))},[]),M=o(()=>{k(t=>t.startsWith("-")?t.slice(1):"0"===t?t:"-"+t)},[]);s(()=>{const t=t=>{const e=t.target.tagName;"INPUT"!==e&&"TEXTAREA"!==e&&"SELECT"!==e&&(t.key>="0"&&t.key<="9"?W(t.key):"."===t.key?W("."):"+"===t.key?S("+"):"-"===t.key?S("-"):"*"===t.key?S("×"):"/"===t.key?(t.preventDefault(),S("÷")):"Enter"===t.key||"="===t.key?("Enter"===t.key&&t.target instanceof Node&&U.current?.contains(t.target)&&t.preventDefault(),F()):"Escape"===t.key?A():"Backspace"===t.key?k(t=>t.length>1?t.slice(0,-1):"0"):"%"===t.key&&G())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[W,S,F,A,G]);const V="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",D=`${V} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,H=`${V} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,L=`${V} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,O=`${V} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
2
|
return l(a,{children:[
|
|
3
|
-
/* @__PURE__ */l("div",{ref:
|
|
3
|
+
/* @__PURE__ */l("div",{ref:U,className:"flex flex-col h-full",style:{opacity:T.activeOpacity/100,backdropFilter:T.activeBlur>0?`blur(${T.activeBlur}px)`:void 0},children:[
|
|
4
4
|
/* @__PURE__ */l("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:x.slice(0,3).reverse().map((t,e)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:t},e))}),(
|
|
5
|
+
/* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:x.slice(0,3).reverse().map((t,e)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:t},e))}),(y||j&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${j} ${g?"":m}`}),
|
|
6
6
|
/* @__PURE__ */l("div",{className:"flex items-center gap-2",children:[
|
|
7
7
|
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!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,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
|
|
8
8
|
/* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(t=>{const e=parseFloat(t);return isNaN(e)||t.endsWith(".")||t.endsWith(".0")||Math.abs(e)<1e15&&t.length<16?t:e.toExponential(6)})(m)})]})]}),
|
|
9
9
|
/* @__PURE__ */l("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
-
/* @__PURE__ */u("button",{onClick:A,className:
|
|
11
|
-
/* @__PURE__ */u("button",{onClick:
|
|
12
|
-
/* @__PURE__ */u("button",{onClick:G,className:
|
|
13
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
14
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
17
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
19
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
20
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
23
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
24
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
25
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
26
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
27
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
28
|
-
/* @__PURE__ */u("button",{onClick:
|
|
29
|
-
/* @__PURE__ */u(e,{open:
|
|
10
|
+
/* @__PURE__ */u("button",{onClick:A,className:L,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:M,className:L,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */u("button",{onClick:G,className:L,children:"%"}),
|
|
13
|
+
/* @__PURE__ */u("button",{onClick:()=>S("÷"),className:`${H} ${"÷"===j?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */u("button",{onClick:()=>W("7"),className:D,children:"7"}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:()=>W("8"),className:D,children:"8"}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>W("9"),className:D,children:"9"}),
|
|
17
|
+
/* @__PURE__ */u("button",{onClick:()=>S("×"),className:`${H} ${"×"===j?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onClick:()=>W("4"),className:D,children:"4"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onClick:()=>W("5"),className:D,children:"5"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onClick:()=>W("6"),className:D,children:"6"}),
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>S("-"),className:`${H} ${"-"===j?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:()=>W("1"),className:D,children:"1"}),
|
|
23
|
+
/* @__PURE__ */u("button",{onClick:()=>W("2"),className:D,children:"2"}),
|
|
24
|
+
/* @__PURE__ */u("button",{onClick:()=>W("3"),className:D,children:"3"}),
|
|
25
|
+
/* @__PURE__ */u("button",{onClick:()=>S("+"),className:`${H} ${"+"===j?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */u("button",{onClick:()=>W("0"),className:`${D} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */u("button",{onClick:()=>W("."),className:D,children:"."}),
|
|
28
|
+
/* @__PURE__ */u("button",{onClick:F,className:O,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */u(e,{open:J,onClose:()=>P(!1),title:"Calculator Settings",appearance:Z,onAppearanceChange:E,onSave:()=>{B(Z),localStorage.setItem(h,JSON.stringify(Z)),P(!1)}})]})}export{m as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-
|
|
1
|
+
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-UJ5772FB.js";import{useWidgetSettings as r}from"./chunk-S5JX4IAP.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-OLXUMB2V.js";import"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as c}from"react";import{jsxs as i,Fragment as a,jsx as m}from"react/jsx-runtime";var l=["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",h="currency_appearance",k="currency_rates_cache";function d(t){try{const e=JSON.parse(localStorage.getItem(k)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function j(t,e){try{const r=JSON.parse(localStorage.getItem(k)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(k,JSON.stringify(r))}catch{}}function g(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var N={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[u,k]=s(g),[f,x]=s(()=>t(h)),[y,b]=s({}),[S,D]=s(!1),[C,U]=s(!1),[J,v]=s([]),[B,P]=s(f),[R,A]=s("USD"),[G,H]=s("CNY");r(o(()=>{v([...u]),P({...f}),U(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){D(!0);const r={};for(const e of t){const t=d(e);if(t)r[e]=t;else try{const t=await fetch(`https://open.er-api.com/v6/latest/${e}`),n=await t.json();n.rates&&(r[e]=n.rates,j(e,n.rates))}catch{}}e&&(b(r),D(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
|
|
2
2
|
return i(a,{children:[
|
|
3
|
-
/* @__PURE__ */m("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3 space-y-1",children:[
|
|
3
|
+
/* @__PURE__ */m("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3 space-y-1",children:[S&&/* @__PURE__ */m(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=y[t]?.[e];/* @__PURE__ */
|
|
4
4
|
return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);k(t),localStorage.setItem(p,JSON.stringify(t))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
5
5
|
/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
|
|
6
6
|
/* @__PURE__ */m("span",{className:"text-base",children:N[t]||""}),
|
|
@@ -9,13 +9,13 @@ return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);k(t),l
|
|
|
9
9
|
/* @__PURE__ */m("span",{className:"text-base",children:N[e]||""}),
|
|
10
10
|
/* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
|
|
11
11
|
/* @__PURE__ */m("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${t}-${e}-${r}`)})]})}),
|
|
12
|
-
/* @__PURE__ */m(e,{open:C,onClose:()=>U(!1),title:"Currency Settings",appearance:B,onAppearanceChange:P,onSave:()=>{if(0===
|
|
12
|
+
/* @__PURE__ */m(e,{open:C,onClose:()=>U(!1),title:"Currency Settings",appearance:B,onAppearanceChange:P,onSave:()=>{if(0===J.length)return;const t=J.slice(0,4);k(t),x(B),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(B)),U(!1)},children:/* @__PURE__ */i("div",{children:[
|
|
13
13
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */i("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",
|
|
15
|
-
/* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:
|
|
14
|
+
/* @__PURE__ */i("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",J.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:J.map(([t,e],r)=>/* @__PURE__ */i("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
16
|
/* @__PURE__ */i("span",{className:"text-sm",children:[N[t]||""," ",t," → ",N[e]||""," ",e]}),
|
|
17
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */m("select",{value:
|
|
17
|
+
/* @__PURE__ */m("button",{onClick:()=>v(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),J.length<4?/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */m("select",{value:R,onChange:t=>A(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
|
|
19
19
|
/* @__PURE__ */m("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */m("select",{value:
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:()=>{
|
|
20
|
+
/* @__PURE__ */m("select",{value:G,onChange:t=>H(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:()=>{R!==G&&J.length<4&&v(t=>[...t,[R,G]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */i("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-QD7IODP2.js";import{SidebarLayout as t}from"./chunk-XN72RFDV.js";import"./chunk-QWK6DRSN.js";import{SearchableSelect as n}from"./chunk-DFI5EHSV.js";import"./chunk-2KD6R2XF.js";import{Breadcrumbs as a}from"./chunk-WREUA43Q.js";import{Select_default as r}from"./chunk-W7HTHKN2.js";import"./chunk-EO5RLFRX.js";import"./chunk-GML6FVPA.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-MF7OELXP.js";import{Input_default as l}from"./chunk-BYTQRQ5P.js";import"./chunk-AYZY3YNC.js";import{formatBytes as o}from"./chunk-OJI4ROSD.js";import{dayKeyInZone as c,formatTime as d,formatDateTime as m,userToday as h,instantOnDayKey as u}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as p}from"./chunk-36BRD5J3.js";import{fromDateKey as f,toDateKey as k}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as g,subscribeFilesChoice as w,getFilesChoice as y,holdFilesChoice as b,answerFilesChoice as v,choiceTakes as x}from"./chunk-CUNYWXUT.js";import{AboutApp as N}from"./chunk-
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-QD7IODP2.js";import{SidebarLayout as t}from"./chunk-XN72RFDV.js";import"./chunk-QWK6DRSN.js";import{SearchableSelect as n}from"./chunk-DFI5EHSV.js";import"./chunk-2KD6R2XF.js";import{Breadcrumbs as a}from"./chunk-WREUA43Q.js";import{Select_default as r}from"./chunk-W7HTHKN2.js";import"./chunk-EO5RLFRX.js";import"./chunk-GML6FVPA.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-MF7OELXP.js";import{Input_default as l}from"./chunk-BYTQRQ5P.js";import"./chunk-AYZY3YNC.js";import{formatBytes as o}from"./chunk-OJI4ROSD.js";import{dayKeyInZone as c,formatTime as d,formatDateTime as m,userToday as h,instantOnDayKey as u}from"./chunk-NHKT5IH6.js";import{EMPTY_VALUE as p}from"./chunk-36BRD5J3.js";import{fromDateKey as f,toDateKey as k}from"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as g,subscribeFilesChoice as w,getFilesChoice as y,holdFilesChoice as b,answerFilesChoice as v,choiceTakes as x}from"./chunk-CUNYWXUT.js";import{AboutApp as N}from"./chunk-IXGJTYOG.js";import{getFilesStore as C,peekFilesViewRequest as j,consumeFilesViewRequest as S,FILES_SHOW_TRASH_EVENT as D,FILES_OPEN_DESKTOP_FOLDER_EVENT as T,subscribeDesktopFolders as M,getDesktopFoldersSnapshot as $,filesRoleWrites as L,hasHostFilesStore as P,FolderGlyph as R,DesktopItemMiniIcon as A,desktopItemTypeLabel as F,FilesQuotaError as O,FILES_OFFICE_EXTENSIONS as E,FILES_ROLE_LABELS as I}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as W,WindowTitle as z}from"./chunk-S5JX4IAP.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as K,prompt as U}from"./chunk-OLXUMB2V.js";import{Dialog as V}from"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import{ItemCount as Y}from"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import{parseOption as J}from"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-4MYFHXU7.js";import{DropdownMenu as H}from"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import{IconButton_default as B}from"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as G}from"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import{Icon as Z}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as Q}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import{TH_ONE_LINE as X}from"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import{toast_default as q}from"./chunk-VLT4ZEHT.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as _,useRef as ee,useEffect as te,useCallback as ne,useSyncExternalStore as ae,useMemo as re}from"react";import{jsxs as ie,jsx as se,Fragment as le}from"react/jsx-runtime";var oe={doc:"document",docx:"document",odt:"document",rtf:"document",txt:"document",md:"document",xls:"spreadsheet",xlsx:"spreadsheet",ods:"spreadsheet",csv:"spreadsheet",sheet:"spreadsheet",ppt:"slides",pptx:"slides",odp:"slides",key:"slides",slides:"slides",pdf:"pdf",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",heic:"image",tif:"image",tiff:"image",mp4:"video",mov:"video",webm:"video",avi:"video",mkv:"video",mp3:"audio",wav:"audio",m4a:"audio",ogg:"audio",flac:"audio",zip:"archive",rar:"archive","7z":"archive",gz:"archive",tar:"archive",dxf:"drawing",dwg:"drawing",stp:"drawing",step:"drawing",stl:"drawing",obj:"drawing",iges:"drawing",igs:"drawing","3mf":"drawing",glb:"drawing",gltf:"drawing"};function ce(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function de(e){if("folder"===e.kind)return"folder";if("document"===e.officeKind)return"document";if("spreadsheet"===e.officeKind)return"spreadsheet";if("deck"===e.officeKind)return"slides";const t=e.contentType??"";return"application/pdf"===t?"pdf":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":oe[ce(e.name)]??"other"}var me={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},he={folder:{name:"folder",tone:"muted"},document:{name:"document",tone:"accent"},spreadsheet:{name:"table",tone:"success"},slides:{name:"presentation-chart-bar",tone:"warning"},pdf:{name:"document",tone:"danger"},image:{name:"image",tone:"muted"},video:{name:"play",tone:"muted"},audio:{name:"speaker-wave",tone:"muted"},archive:{name:"archive-box",tone:"muted"},drawing:{name:"cube-transparent",tone:"muted"},other:{name:"page",tone:"muted"}};function ue(e){const t=e.officeKind?E[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function pe(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":o(e.size)}function fe(e,t=/* @__PURE__ */new Date){const n=c(e),a=c(t.toISOString());return n&&a?n===a?d(e,{clock:{hour:"numeric",minute:"2-digit"}}):n.slice(0,4)===a.slice(0,4)?m(e,{clock:{day:"numeric",month:"short"}}):m(e,{clock:{day:"numeric",month:"short",year:"numeric"}}):p}function ke(e){return d(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function ge(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var we=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function ye(e,t){const n="asc"===t.dir?1:-1;return[...e].sort((e,a)=>e.kind!==a.kind?"folder"===e.kind?-1:1:n*((e,n)=>{switch(t.key){case"owner":return we.compare(ge(e),ge(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return we.compare(ue(e),ue(n))}})(e,a)||we.compare(e.name,a.name))}var be=["folder","document","spreadsheet","slides","pdf","image","video"],ve={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function xe(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=h(t),a=f(n);if(!n||!a)return Number.NEGATIVE_INFINITY;"week"===e&&a.setDate(a.getDate()-6),"month"===e&&a.setDate(a.getDate()-29),"year"===e&&a.setMonth(0,1);const r=u(k(a),{hour:0,minute:0});return r?Date.parse(r):Number.NEGATIVE_INFINITY}(t.modified,n):null;return e.filter(e=>{if(t.type&&de(e)!==t.type)return!1;if(t.person){const n="owner"===(e.role??"owner");if("me"===t.person?!n:n||e.owner?.id!==t.person)return!1}return null===a||(Date.parse(e.modifiedAt)||0)>=a})}var Ne=[{value:"viewer",label:"Viewer"},{value:"commenter",label:"Commenter"},{value:"editor",label:"Editor"}];function Ce({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=_(null),[o,c]=_(""),[d,m]=_([]),[h,u]=_(!1),[p,f]=_(""),[k,g]=_("viewer"),[w,y]=_(!1),b=ee(/* @__PURE__ */new Map),v=t?.id??null;if(te(()=>{if(l(null),f(""),c(""),!v||!e.shares)return;let t=!0;return e.shares(v).then(e=>{t&&l(e)}).catch(e=>{t&&(q.error(e.message),l([]))}),()=>{t=!1}},[v,e]),te(()=>{if(!e.searchPeople||!v)return;let t=!0;u(!0);const n=setTimeout(()=>{e.searchPeople(o).then(e=>{if(t){for(const t of e)b.current.set(t.id,t);m(e)}}).catch(()=>{t&&m([])}).finally(()=>{t&&u(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[o,v,e]),!t)return null;const x=new Set((s??[]).map(e=>e.person.id)),N=d.filter(e=>!x.has(e.id)).map(e=>({value:e.id,label:e.name})),C=async n=>{y(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){q.error(e.message)}finally{y(!1)}};/* @__PURE__ */
|
|
2
2
|
return ie(V,{open:!0,onClose:a,size:"md",title:`Share “${t.name}”`,description:"folder"===t.kind?"Everything inside this folder is shared too. Editors’ uploads count toward your quota.":"Viewers can open and download it. Editors can also replace, rename and delete it.",footer:/* @__PURE__ */se(G,{variant:"secondary",onClick:a,children:"Done"}),children:[
|
|
3
3
|
/* @__PURE__ */ie("div",{className:"flex items-center gap-2",children:[
|
|
4
4
|
/* @__PURE__ */se("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */se(n,{value:p,onChange:f,onSearchChange:c,loading:h&&0===d.length,options:N,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
|
|
@@ -31,8 +31,8 @@ return ie("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col m
|
|
|
31
31
|
/* @__PURE__ */se("div",{className:"text-xs font-medium text-ink-strong mb-1",children:"Who has access"}),0===s.length?/* @__PURE__ */ie("p",{className:"text-sm text-ink-faint",children:["Only ","owner"!==t.role&&t.role?t.owner?.name??"its owner":"you"]}):/* @__PURE__ */se("ul",{className:"text-sm text-ink",children:s.map(e=>/* @__PURE__ */ie("li",{className:"flex justify-between py-0.5",children:[
|
|
32
32
|
/* @__PURE__ */se("span",{className:"truncate",children:e.person.name}),
|
|
33
33
|
/* @__PURE__ */se("span",{className:"text-ink-faint text-xs",children:I[e.role]})]},e.person.id))})]}),
|
|
34
|
-
/* @__PURE__ */ie("dl",{className:"border-t border-line pt-2",children:[m("Type",o?me[o]:null),"file"===t.kind&&m("Size",pe(t)),m("Location",d),m("Owner","me"===ge(t)?"me":ge(t)),m("Modified",t.modifiedAt?`${fe(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),m("Created",r?.createdAt?fe(r.createdAt):null)]})]}):/* @__PURE__ */se("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var De=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,Te=["list","grid"],Me="files.layout",$e={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"},Le=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],Pe="application/x-efficient-files";function Re(){try{return
|
|
35
|
-
return se(Z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function We({entry:e,read:t}){const[n,a]=_(null),r="image"===de(e)&&e.size<=5242880;return te(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */se("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */se(Ie,{entry:e,className:"h-10 w-10"})}function ze(){const n=C(),r=n.title??"Files",c=null!==g(),d=!c&&!!n.shares&&!!n.sharedWithMe,[m,h]=_(null),[u,p]=_(null),[f,k]=_([]),[I,V]=_(()=>/* @__PURE__ */new Set),H=ee(null),[oe,de]=_(!0),[Ne,Te]=_(!1),[ze,Ke]=_(null),[Ue,Ve]=_(!1),[Ye,He]=_(null),[Je,Be]=_(null),[Ge,Ze]=_(null),[Qe,Xe]=_(Re),[qe,_e]=_(!1),[et,tt]=_(""),[nt,at]=_(""),[rt,it]=_({}),[st,lt]=_({key:"name",dir:"asc"}),[ot,ct]=_(()=>{const e=j();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=ee("files"),mt=ee(ot);mt.current=ot,te(()=>{S()},[]);const[ht,ut]=_([]),pt=e=>{Xe(e);try{localStorage.setItem(Me,e)}catch{}},ft=ne(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);te(()=>{const e=()=>{S(),ft("trash")},t=e=>{S();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(D,e),window.addEventListener(T,t),()=>{window.removeEventListener(D,e),window.removeEventListener(T,t)}},[ft]);const kt=ae(M,$,$),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];te(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&ft("files")},[gt,kt,ft]);const bt=ee(0),vt=ee(null),xt=ee(null),{openPage:Nt,openEntity:Ct}=W(),jt=i(),St=i(),Dt=i(),Tt=ae(w,y,y);te(()=>b(),[]),te(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||ft("files")},[Tt,ot,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>Nt(e)}):"page"===t.entityType?Nt(t.entityId):Ct(t.entityType,t.entityId,null,t.label)},$t=ne(async()=>{if(!c)try{Ke(await n.quota())}catch{}},[n,c]),Lt=ne(async(e,t)=>{de(!0);try{await e(),Te(!1)}catch(e){e instanceof TypeError?Te(!0):q.error(Fe(e,t))}finally{de(!1)}},[]),Pt=ne(async e=>{if(c)return p(Oe(e)),Te(!1),void de(!1);await Lt(async()=>{p(await n.list(e))},"Failed to list"),$t()},[n,$t,c,Lt]),Rt=ne(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=c?Oe(m):await n.list(m).catch(()=>null);return k((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void de(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await Lt(async()=>{k(await a())},"Failed to list files")},[n,c,m,Lt]),Ot=ne(async()=>{if(c)return ut([]),void de(!1);await Lt(async()=>{ut(await n.trash())},"Failed to list trash"),$t()},[n,$t,c,Lt]),At=()=>{"files"===ot?Pt(m):De(ot)?Rt(ot,nt):"trash"===ot&&Ot()};te(()=>{V(/* @__PURE__ */new Set),H.current=null,At()},[m,ot,nt]),te(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Ft=()=>{tt(""),"search"===mt.current&&ft(dt.current)},Et=e=>{ft("files"),h(e)},It=async(e,t)=>{try{await e()}catch(e){q.error(Fe(e,t))}At()},Wt=e=>It(async()=>{await n.restore(e.id),q.success(`Restored "${e.name}"`)},"Restore failed"),zt=async e=>{await K({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&It(()=>n.purge(e.id),"Delete failed")},Kt=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){q.error(Fe(e,"Download failed"))}},Ut="files"===ot?u?.folder??null:null,Vt=Ut?.role??"owner",Yt="owner"!==Vt,Ht="files"===ot?m:null,Jt=!c&&("files"!==ot||L(Vt)),Bt=!c&&"files"===ot&&L(Vt),Gt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Ht,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof F?q.error(Ae(r.name,e)):q.error(`Upload ${r.name}: ${Fe(e,"failed")}`)}}a>1&&q.success(`Uploaded ${a} files`),"files"===ot?Pt(m):Et(null)},Zt=async e=>{const t=ue(e),a=await U({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?q.error("Names cannot contain slashes"):It(()=>n.rename(e.id,function(e,t){const n=e.officeKind?E[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??u?.folder.owner)?.name??"its owner":"their owners";await K({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ue(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await It(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),q.success(t?`"${ue(t)}" moved to trash`:`${e.length} items moved to trash`))},Xt=(e,t)=>It(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),qt=async(e,t)=>{Ze(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await It(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),q.success(1===a.length?`Moved "${ue(a[0])}"`:`Moved ${a.length} items`))},_t=()=>{bt.current=0,Ve(!1),He(null)};te(()=>{const e=()=>_t();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const en="files"===ot?u?.entries??[]:De(ot)?f:[],tn=re(()=>ye(xe(en,rt),st),[en,rt,st]),nn=re(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...I].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Vt:"owner"),ln=e=>!c&&L(sn(e)),on=e=>d&&"owner"===sn(e),cn=e=>!!n.move&&ln(e),dn=(e,t)=>{if(Tt){const t=nn.get(e);if(t&&"file"===t.kind&&!hn(t))return;return void V(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&H.current){const t=tn.map(e=>e.id),n=t.indexOf(H.current),a=t.indexOf(e);if(n>=0&&a>=0)return void V(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}H.current=e,t.metaKey||t.ctrlKey?V(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):V(/* @__PURE__ */new Set([e]))},mn=()=>{V(/* @__PURE__ */new Set),H.current=null},hn=e=>!!Tt&&"file"===e.kind&&x(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",pn=e=>{if(!Tt||!hn(e))return;const t="files"===ot?u?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===ot?"Shared with me":"My files";v(Tt.id,{entry:e,folderId:"files"===ot?m:null,location:n})},fn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?Et(t.id):Tt?pn(t):(async t=>{if(c)return;if(n.open?.(t))return;const a=$e[ce(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>Nt(e)}):Kt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Tt)return t&&("folder"===t.kind||hn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(ln);if(c)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Ee([...t?[{key:"open",label:a,icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */se(Z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */se(Z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Zt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */se(Z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>It(async()=>{for(const t of e)await n.copy(t.id);q.success(1===e.length?`Copied "${ue(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */se(Z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Be(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */se(Z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Ze(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */se(Z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Xt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */se(Z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{V(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */se(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},wn=(e,t)=>{const n=I.has(t.id)?an:[t];jt.open(e,n)&&!I.has(t.id)&&(V(/* @__PURE__ */new Set([t.id])),H.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=I.has(e.id)?an:[e];t.dataTransfer.setData(Pe,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},bn=e=>"folder"===e.kind&&ln(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(Pe)&&(t.preventDefault(),t.stopPropagation(),Ye!==e.id&&He(e.id))},onDragLeave:()=>{Ye===e.id&&He(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(Pe))return;t.preventDefault(),t.stopPropagation(),He(null);const n=JSON.parse(t.dataTransfer.getData(Pe)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(Ne)/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ie("dl",{className:"border-t border-line pt-2",children:[m("Type",o?me[o]:null),"file"===t.kind&&m("Size",pe(t)),m("Location",d),m("Owner","me"===ge(t)?"me":ge(t)),m("Modified",t.modifiedAt?`${fe(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),m("Created",r?.createdAt?fe(r.createdAt):null)]})]}):/* @__PURE__ */se("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var De=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,Te=["list","grid"],Me="files.layout",$e={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"},Le=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],Pe="application/x-efficient-files";function Re(){try{return J(Te,"list",localStorage.getItem(Me))}catch{return"list"}}function Ae(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=g()??[];for(const e of n){const t=a.find(t=>"folder"===t.kind&&t.name===e);a=t?.children??[]}return{folder:{id:e,name:n[n.length-1]??"",role:"owner",path:[{id:null,name:""},...n.map((e,t)=>({id:"/"+n.slice(0,t+1).join("/"),name:e}))]},entries:a.map(e=>({id:("/"===t?"":t)+"/"+e.name,name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}}function Fe(e,t){return`Not enough space for “${e}” (${o(t.attempted)}). You've used ${o(t.used)} of ${o(t.limit)}. Empty Trash or ask an administrator for more space.`}var Oe=(e,t)=>e instanceof Error&&e.message||t;function Ee(e){const t=[];for(const n of e)("divider"!==n.type||0!==t.length&&"divider"!==t[t.length-1].type)&&t.push(n);for(;t.length&&"divider"===t[t.length-1].type;)t.pop();return t}function Ie({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=he[de(e)];/* @__PURE__ */
|
|
35
|
+
return se(Z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function We({entry:e,read:t}){const[n,a]=_(null),r="image"===de(e)&&e.size<=5242880;return te(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */se("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */se(Ie,{entry:e,className:"h-10 w-10"})}function ze(){const n=C(),r=n.title??"Files",c=null!==g(),d=!c&&!!n.shares&&!!n.sharedWithMe,[m,h]=_(null),[u,p]=_(null),[f,k]=_([]),[I,V]=_(()=>/* @__PURE__ */new Set),J=ee(null),[oe,de]=_(!0),[Ne,Te]=_(!1),[ze,Ke]=_(null),[Ue,Ve]=_(!1),[Ye,Je]=_(null),[He,Be]=_(null),[Ge,Ze]=_(null),[Qe,Xe]=_(Re),[qe,_e]=_(!1),[et,tt]=_(""),[nt,at]=_(""),[rt,it]=_({}),[st,lt]=_({key:"name",dir:"asc"}),[ot,ct]=_(()=>{const e=j();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=ee("files"),mt=ee(ot);mt.current=ot,te(()=>{S()},[]);const[ht,ut]=_([]),pt=e=>{Xe(e);try{localStorage.setItem(Me,e)}catch{}},ft=ne(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);te(()=>{const e=()=>{S(),ft("trash")},t=e=>{S();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(D,e),window.addEventListener(T,t),()=>{window.removeEventListener(D,e),window.removeEventListener(T,t)}},[ft]);const kt=ae(M,$,$),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];te(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&ft("files")},[gt,kt,ft]);const bt=ee(0),vt=ee(null),xt=ee(null),{openPage:Nt,openEntity:Ct}=W(),jt=i(),St=i(),Dt=i(),Tt=ae(w,y,y);te(()=>b(),[]),te(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||ft("files")},[Tt,ot,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>Nt(e)}):"page"===t.entityType?Nt(t.entityId):Ct(t.entityType,t.entityId,null,t.label)},$t=ne(async()=>{if(!c)try{Ke(await n.quota())}catch{}},[n,c]),Lt=ne(async(e,t)=>{de(!0);try{await e(),Te(!1)}catch(e){e instanceof TypeError?Te(!0):q.error(Oe(e,t))}finally{de(!1)}},[]),Pt=ne(async e=>{if(c)return p(Ae(e)),Te(!1),void de(!1);await Lt(async()=>{p(await n.list(e))},"Failed to list"),$t()},[n,$t,c,Lt]),Rt=ne(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=c?Ae(m):await n.list(m).catch(()=>null);return k((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void de(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await Lt(async()=>{k(await a())},"Failed to list files")},[n,c,m,Lt]),At=ne(async()=>{if(c)return ut([]),void de(!1);await Lt(async()=>{ut(await n.trash())},"Failed to list trash"),$t()},[n,$t,c,Lt]),Ft=()=>{"files"===ot?Pt(m):De(ot)?Rt(ot,nt):"trash"===ot&&At()};te(()=>{V(/* @__PURE__ */new Set),J.current=null,Ft()},[m,ot,nt]),te(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Ot=()=>{tt(""),"search"===mt.current&&ft(dt.current)},Et=e=>{ft("files"),h(e)},It=async(e,t)=>{try{await e()}catch(e){q.error(Oe(e,t))}Ft()},Wt=e=>It(async()=>{await n.restore(e.id),q.success(`Restored "${e.name}"`)},"Restore failed"),zt=async e=>{await K({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&It(()=>n.purge(e.id),"Delete failed")},Kt=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){q.error(Oe(e,"Download failed"))}},Ut="files"===ot?u?.folder??null:null,Vt=Ut?.role??"owner",Yt="owner"!==Vt,Jt="files"===ot?m:null,Ht=!c&&("files"!==ot||L(Vt)),Bt=!c&&"files"===ot&&L(Vt),Gt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Jt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof O?q.error(Fe(r.name,e)):q.error(`Upload ${r.name}: ${Oe(e,"failed")}`)}}a>1&&q.success(`Uploaded ${a} files`),"files"===ot?Pt(m):Et(null)},Zt=async e=>{const t=ue(e),a=await U({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?q.error("Names cannot contain slashes"):It(()=>n.rename(e.id,function(e,t){const n=e.officeKind?E[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Qt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??u?.folder.owner)?.name??"its owner":"their owners";await K({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ue(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await It(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),q.success(t?`"${ue(t)}" moved to trash`:`${e.length} items moved to trash`))},Xt=(e,t)=>It(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),qt=async(e,t)=>{Ze(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await It(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),q.success(1===a.length?`Moved "${ue(a[0])}"`:`Moved ${a.length} items`))},_t=()=>{bt.current=0,Ve(!1),Je(null)};te(()=>{const e=()=>_t();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const en="files"===ot?u?.entries??[]:De(ot)?f:[],tn=re(()=>ye(xe(en,rt),st),[en,rt,st]),nn=re(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...I].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Vt:"owner"),ln=e=>!c&&L(sn(e)),on=e=>d&&"owner"===sn(e),cn=e=>!!n.move&&ln(e),dn=(e,t)=>{if(Tt){const t=nn.get(e);if(t&&"file"===t.kind&&!hn(t))return;return void V(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&J.current){const t=tn.map(e=>e.id),n=t.indexOf(J.current),a=t.indexOf(e);if(n>=0&&a>=0)return void V(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}J.current=e,t.metaKey||t.ctrlKey?V(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):V(/* @__PURE__ */new Set([e]))},mn=()=>{V(/* @__PURE__ */new Set),J.current=null},hn=e=>!!Tt&&"file"===e.kind&&x(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",pn=e=>{if(!Tt||!hn(e))return;const t="files"===ot?u?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===ot?"Shared with me":"My files";v(Tt.id,{entry:e,folderId:"files"===ot?m:null,location:n})},fn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?Et(t.id):Tt?pn(t):(async t=>{if(c)return;if(n.open?.(t))return;const a=$e[ce(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>Nt(e)}):Kt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Tt)return t&&("folder"===t.kind||hn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(ln);if(c)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Ee([...t?[{key:"open",label:a,icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */se(Z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */se(Z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Zt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */se(Z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>It(async()=>{for(const t of e)await n.copy(t.id);q.success(1===e.length?`Copied "${ue(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */se(Z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Be(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */se(Z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Ze(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */se(Z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Xt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */se(Z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{V(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */se(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Qt(e)}]:[]])},wn=(e,t)=>{const n=I.has(t.id)?an:[t];jt.open(e,n)&&!I.has(t.id)&&(V(/* @__PURE__ */new Set([t.id])),J.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=I.has(e.id)?an:[e];t.dataTransfer.setData(Pe,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},bn=e=>"folder"===e.kind&&ln(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(Pe)&&(t.preventDefault(),t.stopPropagation(),Ye!==e.id&&Je(e.id))},onDragLeave:()=>{Ye===e.id&&Je(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(Pe))return;t.preventDefault(),t.stopPropagation(),Je(null);const n=JSON.parse(t.dataTransfer.getData(Pe)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(Ne)/* @__PURE__ */
|
|
36
36
|
return ie("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
37
37
|
/* @__PURE__ */se(z,{title:`${r} - offline`}),
|
|
38
38
|
/* @__PURE__ */se("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */ie("div",{className:"max-w-md",children:[
|
|
@@ -42,10 +42,10 @@ return ie("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
|
42
42
|
/* @__PURE__ */se("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
|
|
43
43
|
/* @__PURE__ */ie("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
|
|
44
44
|
/* @__PURE__ */se("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
|
|
45
|
-
/* @__PURE__ */se(G,{variant:"primary",onClick:
|
|
46
|
-
/* @__PURE__ */se("div",{className:"p-3 pb-2",children:/* @__PURE__ */se(
|
|
45
|
+
/* @__PURE__ */se(G,{variant:"primary",onClick:Ft,children:"Retry"})]})})]});const vn=ze&&ze.limit>0?Math.min(100,Math.round(ze.used/ze.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Yt?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>Et(null)},...(Ut?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>Et(e.id)}))],Cn="recent"===ot?"Recent":"starred"===ot?"Starred":"shared"===ot?"Shared with me":"search"===ot?`Results for “${nt}”`:"trash"===ot?"Trash":wt?wt.name:null,jn=Tt?`${r} - Choosing`:Cn?`${r} - ${"search"===ot?"Search":Cn}`:Ut&&null!==Ut.id?`${r} - ${Ut.name}`:r,Sn=e=>"flex w-full items-center gap-3 rounded-full px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-accent-tint font-medium text-accent-text":"text-ink hover:bg-row-hover"),Dn=Ee([{key:"folder",label:"New folder",icon:/* @__PURE__ */se(Z,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await U({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?q.error("Folder names cannot contain slashes"):(await It(()=>n.createFolder(Jt,e),"Create folder failed"),"files"!==ot&&Et(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */se(Z,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */se(Z,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>xt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?Le.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=he["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */se(Z,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Jt)).catch(e=>q.error(Oe(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */ie("div",{className:"flex h-full flex-col",children:[
|
|
46
|
+
/* @__PURE__ */se("div",{className:"p-3 pb-2",children:/* @__PURE__ */se(H,{trigger:/* @__PURE__ */ie(le,{children:[
|
|
47
47
|
/* @__PURE__ */se(Z,{name:"add",className:"h-5 w-5"}),
|
|
48
|
-
/* @__PURE__ */se("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!
|
|
48
|
+
/* @__PURE__ */se("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!Ht,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
|
|
49
49
|
/* @__PURE__ */ie("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
|
|
50
50
|
/* @__PURE__ */ie("button",{onClick:()=>Et(null),className:Sn("files"===ot&&!Yt),children:[
|
|
51
51
|
/* @__PURE__ */se(Z,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!c&&/* @__PURE__ */ie("button",{onClick:()=>ft("recent"),className:Sn("recent"===ot),children:[
|
|
@@ -60,17 +60,17 @@ return ie("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
|
60
60
|
/* @__PURE__ */se("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */se("div",{className:`h-full ${xn} transition-all`,style:{width:`${vn}%`}})}),
|
|
61
61
|
/* @__PURE__ */ie("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[o(ze.used)," of ",o(ze.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */ie("span",{className:"inline-flex items-center gap-1",children:[e,
|
|
62
62
|
/* @__PURE__ */se(Z,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),$n=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),Ln=De(ot)||"files"===ot,Pn=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>we.compare(e.name,t.name))}(en),Rn=Ln&&en.length>0?/* @__PURE__ */ie("div",{className:"flex items-center gap-2 shrink-0",children:[
|
|
63
|
-
/* @__PURE__ */se(
|
|
64
|
-
/* @__PURE__ */se(
|
|
63
|
+
/* @__PURE__ */se(H,{trigger:Mn(rt.type?me[rt.type]:"Type",!!rt.type),"aria-label":"Type",triggerClassName:$n(!!rt.type),items:[...be.map(e=>({type:"radio",key:e,label:me[e],checked:rt.type===e,onSelect:()=>it(t=>({...t,type:t.type===e?null:e}))})),...rt.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,type:null}))}]:[]]}),d&&/* @__PURE__ */se(H,{trigger:Mn(rt.person?"me"===rt.person?"Owned by me":Pn.find(e=>e.id===rt.person)?.name??"People":"People",!!rt.person),"aria-label":"People",triggerClassName:$n(!!rt.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===rt.person,onSelect:()=>it(e=>({...e,person:"me"===e.person?null:"me"}))},...Pn.map(e=>({type:"radio",key:e.id,label:e.name,checked:rt.person===e.id,onSelect:()=>it(t=>({...t,person:t.person===e.id?null:e.id}))})),...rt.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,person:null}))}]:[]]}),
|
|
64
|
+
/* @__PURE__ */se(H,{trigger:Mn(rt.modified?ve[rt.modified]:"Modified",!!rt.modified),"aria-label":"Modified",triggerClassName:$n(!!rt.modified),items:[...Object.keys(ve).map(e=>({type:"radio",key:e,label:ve[e],checked:rt.modified===e,onSelect:()=>it(t=>({...t,modified:t.modified===e?null:e}))})),...rt.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>it(e=>({...e,modified:null}))}]:[]]})]}):null,An=Ln&&an.length>0&&!Tt?/* @__PURE__ */ie("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
|
|
65
65
|
/* @__PURE__ */se(B,{"aria-label":"Clear selection",size:"sm",onClick:mn,children:/* @__PURE__ */se(Z,{name:"close",className:"h-4 w-4"})}),
|
|
66
66
|
/* @__PURE__ */ie("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[an.length," selected"]}),rn&&on(rn)&&/* @__PURE__ */se(B,{"aria-label":"Share",size:"sm",onClick:()=>Be(rn),children:/* @__PURE__ */se(Z,{name:"add-person",className:"h-4 w-4"})}),!c&&an.every(e=>"file"===e.kind)&&/* @__PURE__ */se(B,{"aria-label":"Download",size:"sm",onClick:()=>an.forEach(Kt),children:/* @__PURE__ */se(Z,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */se(B,{"aria-label":"Move",size:"sm",onClick:()=>Ze(an),children:/* @__PURE__ */se(Z,{name:"forward",className:"h-4 w-4"})}),!c&&an.every(ln)&&/* @__PURE__ */se(B,{"aria-label":"Move to trash",size:"sm",onClick:()=>Qt(an),children:/* @__PURE__ */se(Z,{name:"trash",className:"h-4 w-4"})}),
|
|
67
|
-
/* @__PURE__ */se(
|
|
67
|
+
/* @__PURE__ */se(H,{trigger:/* @__PURE__ */se(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(an)})]}):null,Fn=/* @__PURE__ */se("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:An??/* @__PURE__ */ie(le,{children:[
|
|
68
68
|
/* @__PURE__ */ie("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===ot?/* @__PURE__ */se("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */se(a,{items:Nn,maxItems:5})}):"trash"===ot?/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof ot?/* @__PURE__ */ie(le,{children:[
|
|
69
69
|
/* @__PURE__ */se(R,{className:"h-4 w-4 text-amber-500 shrink-0"}),
|
|
70
70
|
/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong truncate",children:wt?.name??"Desktop folder"}),
|
|
71
71
|
/* @__PURE__ */se("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */se("span",{className:"text-base font-medium text-ink-strong truncate",children:Cn}),"files"===ot&&Yt&&!L(Vt)&&/* @__PURE__ */ie("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-2xs text-ink-faint whitespace-nowrap",children:[
|
|
72
|
-
/* @__PURE__ */se(Z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Yt&&Ut?.owner&&/* @__PURE__ */ie("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Ut.owner.name]})]}),Rn,"trash"===ot&&/* @__PURE__ */se(G,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await K({title:"Empty trash",message:`${ht.length} item${1===ht.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&It(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),
|
|
73
|
-
/* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(
|
|
72
|
+
/* @__PURE__ */se(Z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Yt&&Ut?.owner&&/* @__PURE__ */ie("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Ut.owner.name]})]}),Rn,"trash"===ot&&/* @__PURE__ */se(G,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await K({title:"Empty trash",message:`${ht.length} item${1===ht.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&It(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),On=(e,t)=>Tt?null:/* @__PURE__ */ie("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[on(e)&&/* @__PURE__ */se(B,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Be(e)},children:/* @__PURE__ */se(Z,{name:"add-person",className:"h-4 w-4"})}),!c&&"file"===e.kind&&/* @__PURE__ */se(B,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Kt(e)},children:/* @__PURE__ */se(Z,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!c&&/* @__PURE__ */se(B,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Xt([e],!e.starred)},children:/* @__PURE__ */se(Z,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
|
|
73
|
+
/* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(H,{trigger:/* @__PURE__ */se(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(I.has(e.id)&&an.length>1?an:[e])})})]}),En=e=>/* @__PURE__ */ie("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
74
74
|
/* @__PURE__ */se(Ie,{entry:e}),
|
|
75
75
|
/* @__PURE__ */se("span",{className:"truncate",title:e.name,children:ue(e)}),!!e.shareCount&&/* @__PURE__ */se("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */se(Z,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */se("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */se(Z,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),In=(e,t,n)=>{const a=st.key===e;/* @__PURE__ */
|
|
76
76
|
return se("th",{className:`${X} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===st.dir?"ascending":"descending":void 0,children:/* @__PURE__ */ie("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>lt(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===st.dir?/* @__PURE__ */se(Z,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */se(Z,{name:"arrow-down",className:"h-3 w-3"}))]})})},Wn="recent"===ot?"Files you and your colleagues change show here.":"starred"===ot?"Star the files and folders you want to find quickly.":"shared"===ot?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===ot?`Nothing matches “${nt}”.`:null,zn=0===tn.length?oe?/* @__PURE__ */se(Q,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:en.length>0?"Nothing matches these filters.":Wn??/* @__PURE__ */ie(le,{children:["This folder is empty.",Bt&&/* @__PURE__ */ie(le,{children:[" Drop files here or choose ",
|
|
@@ -81,7 +81,7 @@ return ie("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":ue(t),on
|
|
|
81
81
|
/* @__PURE__ */ie("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
|
|
82
82
|
/* @__PURE__ */se(Ie,{entry:t,className:"h-4 w-4"}),
|
|
83
83
|
/* @__PURE__ */se("span",{className:"flex-1 truncate text-sm",title:t.name,children:ue(t)}),
|
|
84
|
-
/* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(
|
|
84
|
+
/* @__PURE__ */se("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */se(H,{trigger:/* @__PURE__ */se(Z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&an.length>1?an:[t])})})]}),"file"===e&&/* @__PURE__ */ie(le,{children:[
|
|
85
85
|
/* @__PURE__ */se("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */se(We,{entry:t,read:c?void 0:n.read})}),
|
|
86
86
|
/* @__PURE__ */ie("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ge(t)?"You":ge(t)," · ",fe(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
|
|
87
87
|
/* @__PURE__ */se("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ie("tr",{children:[In("name","Name","text-left"),d&&In("owner","Owner","text-left w-32"),In("modified","Modified","text-left w-28"),In("size","Size","text-right w-20"),
|
|
@@ -91,7 +91,7 @@ return ie("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),
|
|
|
91
91
|
/* @__PURE__ */se("td",{className:"px-3 h-11",children:En(e)}),d&&/* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint truncate",children:ge(e)}),
|
|
92
92
|
/* @__PURE__ */se("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:ke(e.modifiedAt),children:fe(e.modifiedAt)}),
|
|
93
93
|
/* @__PURE__ */se("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint whitespace-nowrap",children:Tt&&"file"===e.kind&&!hn(e)&&Tt.request.otherLabel?Tt.request.otherLabel:pe(e)}),
|
|
94
|
-
/* @__PURE__ */se("td",{className:"px-2 h-11",children:
|
|
94
|
+
/* @__PURE__ */se("td",{className:"px-2 h-11",children:On(e,t)})]},e.id)})})]}),Kn=oe&&0===ht.length?/* @__PURE__ */se(Q,{size:"sm",padding:"p-6",label:"Loading"}):0===ht.length?/* @__PURE__ */se("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */ie("table",{className:"w-full text-sm table-fixed",children:[
|
|
95
95
|
/* @__PURE__ */se("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */ie("tr",{children:[
|
|
96
96
|
/* @__PURE__ */se("th",{className:`${X} text-left font-medium px-3 h-9`,children:"Name"}),
|
|
97
97
|
/* @__PURE__ */se("th",{className:`${X} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
|
|
@@ -114,9 +114,9 @@ return ie("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),
|
|
|
114
114
|
/* @__PURE__ */se("th",{className:`${X} w-32`,children:/* @__PURE__ */se("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
115
115
|
/* @__PURE__ */se("tbody",{children:yt.map(e=>/* @__PURE__ */ie("tr",{onDoubleClick:()=>Mt(e),onContextMenu:t=>Dt.open(t,e),className:"group cursor-default border-b border-line-subtle hover:bg-row-hover",children:[
|
|
116
116
|
/* @__PURE__ */se("td",{className:"px-3 h-11",children:/* @__PURE__ */ie("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
117
|
-
/* @__PURE__ */se(
|
|
117
|
+
/* @__PURE__ */se(A,{item:e}),
|
|
118
118
|
/* @__PURE__ */se("span",{className:"truncate",title:e.label,children:e.label})]})}),
|
|
119
|
-
/* @__PURE__ */se("td",{className:"px-3 h-11 text-xs text-ink-faint",children:
|
|
119
|
+
/* @__PURE__ */se("td",{className:"px-3 h-11 text-xs text-ink-faint",children:F(e)}),
|
|
120
120
|
/* @__PURE__ */se("td",{className:"px-2 h-11",children:/* @__PURE__ */ie("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
|
|
121
121
|
/* @__PURE__ */se(B,{"aria-label":"Open",size:"sm",onClick:()=>Mt(e),children:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"})}),
|
|
122
122
|
/* @__PURE__ */se(B,{"aria-label":"Move to desktop",size:"sm",onClick:()=>kt?.moveToDesktop([e]),children:/* @__PURE__ */se(Z,{name:"desktop",className:"h-4 w-4"})}),
|
|
@@ -133,9 +133,9 @@ return ie("div",{className:"relative flex flex-col h-full bg-surface",onDragEnte
|
|
|
133
133
|
/* @__PURE__ */se(G,{variant:"secondary",size:"sm",onClick:()=>v(Tt.id,null),children:"Cancel"}),
|
|
134
134
|
/* @__PURE__ */se(G,{variant:"primary",size:"sm",disabled:!fn,onClick:()=>{fn&&pn(fn)},children:"Open"})]}),
|
|
135
135
|
/* @__PURE__ */ie("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
|
|
136
|
-
/* @__PURE__ */se("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */se(l,{type:"text",enterKeyHint:"search",value:et,onChange:e=>{tt(e.target.value),e.target.value.trim()||
|
|
136
|
+
/* @__PURE__ */se("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */se(l,{type:"text",enterKeyHint:"search",value:et,onChange:e=>{tt(e.target.value),e.target.value.trim()||Ot()},onKeyDown:e=>{"Escape"===e.key&&et&&(e.stopPropagation(),Ot())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */se(Z,{name:"search",className:"h-4 w-4"}),endAction:et?{label:"Clear search",icon:/* @__PURE__ */se(Z,{name:"close",className:"h-4 w-4"}),onClick:Ot}:void 0})}),
|
|
137
137
|
/* @__PURE__ */se("div",{className:"flex-1"}),"object"!=typeof ot&&"trash"!==ot&&/* @__PURE__ */ie(le,{children:[
|
|
138
138
|
/* @__PURE__ */se(B,{"aria-label":"List view","aria-pressed":"list"===Qe,onClick:()=>pt("list"),children:/* @__PURE__ */se(Z,{name:"list",className:"h-4 w-4"})}),
|
|
139
139
|
/* @__PURE__ */se(B,{"aria-label":"Grid view","aria-pressed":"grid"===Qe,onClick:()=>pt("grid"),children:/* @__PURE__ */se(Z,{name:"grid",className:"h-4 w-4"})})]}),
|
|
140
|
-
/* @__PURE__ */se(B,{"aria-label":"Details","aria-pressed":qe,onClick:()=>_e(e=>!e),children:/* @__PURE__ */se(Z,{name:"info",className:"h-4 w-4"})})]}),
|
|
141
|
-
/* @__PURE__ */se("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&fn&&(e.preventDefault(),pn(fn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Qt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),V(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Un:"trash"===ot?Kn:zn})]}),qe&&Ln&&/* @__PURE__ */se(Se,{store:n,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */se(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */se(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */se(Z,{name:"revert",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */se(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)}]}),Dt.state&&/* @__PURE__ */se(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */se(Z,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>kt?.moveToDesktop([Dt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */se(Z,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),d&&/* @__PURE__ */se(Ce,{store:n,entry:
|
|
140
|
+
/* @__PURE__ */se(B,{"aria-label":"Details","aria-pressed":qe,onClick:()=>_e(e=>!e),children:/* @__PURE__ */se(Z,{name:"info",className:"h-4 w-4"})})]}),Fn,
|
|
141
|
+
/* @__PURE__ */se("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&fn&&(e.preventDefault(),pn(fn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Qt(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),V(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Un:"trash"===ot?Kn:zn})]}),qe&&Ln&&/* @__PURE__ */se(Se,{store:n,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */se(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */se(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */se(Z,{name:"revert",className:"h-4 w-4"}),onSelect:()=>Wt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */se(Z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)}]}),Dt.state&&/* @__PURE__ */se(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */se(Z,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */se(Z,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>kt?.moveToDesktop([Dt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */se(Z,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),d&&/* @__PURE__ */se(Ce,{store:n,entry:He,onClose:()=>Be(null),onChanged:Ft}),n.move&&/* @__PURE__ */se(je,{store:n,items:Ge,from:"files"===ot?m:void 0,onClose:()=>Ze(null),onMove:e=>Ge&&qt(Ge,e)}),Ue&&/* @__PURE__ */se("div",{className:"absolute inset-0 bg-accent-tint border-4 border-dashed border-accent-border pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */se("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{ze as default,Fe as quotaExceededMessage};
|