efficient-shell 13.24.0 → 13.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +14 -3
  2. package/dist/Browser-W2WVSAEN.js +44 -0
  3. package/dist/Calculator-PKAM5ERT.js +29 -0
  4. package/dist/CurrencyConverter-VH4UVYLO.js +21 -0
  5. package/dist/Files-6QZFFGSH.js +141 -0
  6. package/dist/Notepad-YU4HIJD2.js +24 -0
  7. package/dist/PomodoroTimer-PBSAKRX5.js +91 -0
  8. package/dist/{Preview-FXOWT52M.js → Preview-H7N2MMAI.js} +39 -39
  9. package/dist/{Sidebar-MY66ILZY.js → Sidebar-HAIHWIJD.js} +22 -22
  10. package/dist/{Stock-SHKXRWJQ.js → Stock-YL732PKW.js} +5 -5
  11. package/dist/{Weather-WMKWOPBU.js → Weather-3CBRXNNM.js} +18 -18
  12. package/dist/{WorldClock-GZYOF4B2.js → WorldClock-LONNWCRG.js} +6 -6
  13. package/dist/ai/index.js +117 -117
  14. package/dist/apps/index.js +1 -1
  15. package/dist/bin/browser-check.js +1 -1
  16. package/dist/bin/media-host-check.js +1 -1
  17. package/dist/bin/ui-check.js +1 -1
  18. package/dist/{chunk-GAEQYCLS.js → chunk-26KHYLJN.js} +1 -1
  19. package/dist/{chunk-SAHRIE35.js → chunk-2Y4AH7NC.js} +1 -1
  20. package/dist/{chunk-7G5HKAGV.js → chunk-3WUVYXCF.js} +5 -5
  21. package/dist/chunk-44ERJYNW.js +6 -0
  22. package/dist/{chunk-XYQFTFI7.js → chunk-4VFEPP2W.js} +9 -9
  23. package/dist/{chunk-TSCJG6UM.js → chunk-527WMFTR.js} +1 -1
  24. package/dist/{chunk-VLIXI42G.js → chunk-77N3REYY.js} +2 -2
  25. package/dist/chunk-AAFPAQXH.js +13 -0
  26. package/dist/{chunk-ZL654Y6H.js → chunk-AAJSE5HA.js} +1 -1
  27. package/dist/{chunk-J5OAQAAD.js → chunk-B5KX7PDG.js} +4 -4
  28. package/dist/{chunk-UJY5RUZ5.js → chunk-BQQEQCSK.js} +1 -1
  29. package/dist/{chunk-JJYTN72U.js → chunk-CCZHSISF.js} +3 -3
  30. package/dist/{chunk-WNX6EVJ4.js → chunk-EXDSYFHB.js} +1 -1
  31. package/dist/chunk-FLQXMCB3.js +8 -0
  32. package/dist/{chunk-GPU7LLTJ.js → chunk-HPKQYUQT.js} +1 -1
  33. package/dist/{chunk-LRMDLZMM.js → chunk-JVENCUUG.js} +4 -4
  34. package/dist/{chunk-23YQNCZ4.js → chunk-K4KUGKWP.js} +16 -16
  35. package/dist/chunk-LG6NDTHZ.js +2 -0
  36. package/dist/{chunk-ZBGPAUOH.js → chunk-N4LMFGRI.js} +5 -5
  37. package/dist/chunk-O5ZBRG2G.js +1 -0
  38. package/dist/{chunk-7N6CVTWO.js → chunk-P6H2B635.js} +1 -1
  39. package/dist/{chunk-Z6J4KXY3.js → chunk-PWOVSR7N.js} +6 -6
  40. package/dist/chunk-PWX64YBI.js +28 -0
  41. package/dist/{chunk-F3EBYHIE.js → chunk-S5MTTJ3F.js} +10 -10
  42. package/dist/{chunk-ONWFKCMB.js → chunk-SRI2D23Y.js} +8 -8
  43. package/dist/{chunk-LUARJHUK.js → chunk-TJG76Y7I.js} +8 -8
  44. package/dist/{chunk-TT7KXS2Q.js → chunk-UQV4TSWB.js} +1 -1
  45. package/dist/{chunk-AFYLMXOJ.js → chunk-UU42O5ON.js} +5 -5
  46. package/dist/{chunk-H2Q7G5D6.js → chunk-VGUB7LPF.js} +28 -28
  47. package/dist/{chunk-QPVYBN4J.js → chunk-VLBLDSA6.js} +1 -1
  48. package/dist/{chunk-L744YF4X.js → chunk-VMAIZU5S.js} +1 -1
  49. package/dist/{chunk-6CFI4YGI.js → chunk-VP2IQJUD.js} +4 -4
  50. package/dist/chunk-VY6OQRZA.js +1 -0
  51. package/dist/{chunk-FMBUR4EU.js → chunk-XC2GUCTG.js} +1 -1
  52. package/dist/data/EntityList.js +1 -1
  53. package/dist/data/ResizableTable.js +1 -1
  54. package/dist/format/index.js +1 -1
  55. package/dist/forms/BorderInput.js +1 -1
  56. package/dist/forms/ColorPicker.js +1 -1
  57. package/dist/forms/ComposerAttachments.js +1 -1
  58. package/dist/forms/CornersInput.js +1 -1
  59. package/dist/forms/DateRangePicker.js +1 -1
  60. package/dist/forms/IconPicker.js +1 -1
  61. package/dist/forms/Input.js +1 -1
  62. package/dist/forms/InputNumber.js +1 -1
  63. package/dist/forms/LinkPicker.js +1 -1
  64. package/dist/forms/MediaLibrary.js +1 -1
  65. package/dist/forms/PositionInput.js +1 -1
  66. package/dist/forms/RenameField.js +1 -1
  67. package/dist/forms/SidesInput.js +1 -1
  68. package/dist/forms/Slider.js +1 -1
  69. package/dist/forms/WidthsBar.js +1 -1
  70. package/dist/icons/index.js +1 -1
  71. package/dist/index.js +516 -516
  72. package/dist/page-tabs/index.js +5 -5
  73. package/dist/shell/ConfirmDialog.js +1 -1
  74. package/dist/shell/Dialog.js +1 -1
  75. package/dist/shell/Drawer.js +1 -1
  76. package/dist/shell/LanguageSelect.js +1 -1
  77. package/dist/shell/SearchableSelect.js +1 -1
  78. package/dist/shell/SettingRow.js +1 -1
  79. package/dist/shell/discardGuard.js +1 -1
  80. package/dist/telemetry/index.js +1 -1
  81. package/dist/templates/AuthScreen.js +1 -1
  82. package/dist/templates/ChatTemplate.js +1 -1
  83. package/dist/templates/CheckoutTemplate.js +1 -1
  84. package/dist/templates/DataTablePage.js +1 -1
  85. package/dist/templates/FormLayoutPage.js +1 -1
  86. package/dist/ui/index.js +1 -1
  87. package/dist/version.js +1 -1
  88. package/package.json +1 -1
  89. package/dist/Browser-NZ32TN3O.js +0 -44
  90. package/dist/Calculator-PHIOJNTS.js +0 -29
  91. package/dist/CurrencyConverter-WZXN6WTD.js +0 -21
  92. package/dist/Files-BKNIV43J.js +0 -141
  93. package/dist/Notepad-XJTIS3J5.js +0 -24
  94. package/dist/PomodoroTimer-WVIAWG5E.js +0 -91
  95. package/dist/chunk-3ZX5DC2S.js +0 -1
  96. package/dist/chunk-CJQPC2P3.js +0 -2
  97. package/dist/chunk-M36B3M2H.js +0 -8
  98. package/dist/chunk-MRZLFZNJ.js +0 -6
  99. package/dist/chunk-OFMZ6JM6.js +0 -13
  100. package/dist/chunk-QKVPKLDN.js +0 -28
  101. /package/dist/{chunk-UAXL44HH.js → chunk-4BYJABCX.js} +0 -0
package/README.md CHANGED
@@ -5407,9 +5407,13 @@ itself where the kit has an answer:
5407
5407
  | `chart` | an import of a second chart library: `recharts`, `chart.js`, `react-chartjs-2`, `d3` and every `d3-*` module (one imported only for its maths too), `@nivo/*`, `victory` and `victory-*`, `echarts`, `echarts-for-react`, `apexcharts`, `react-apexcharts`, `@visx/*`, `highcharts`, `highcharts-react-official`, `plotly.js`, `plotly.js-dist`, `react-plotly.js`, `lightweight-charts`, `@antv/g2`, `@antv/g2plot`, `chartist`, `billboard.js`, `c3`, `uplot`. A name counts with its subpaths (`chart.js/auto`); a name that only contains one (`react-d3-tree`) does not. Read after `kit` and `icon`, so `@mui/x-charts` stays a `kit` | a chart from `efficient-shell/ui`: `ChartFrame`, `TimeSeriesChart`, `ColumnChart`, `RankedBars`, `PieChart`, `FunnelChart`, `ScatterChart`, …; the one chart system (harness FT-3) |
5408
5408
  | `chart-dep` | one of those chart libraries declared in `package.json`, whether or not anything imports it (not `devDependencies`) | remove it |
5409
5409
  | `ellipsis-label` | a button, link or menu label that ends in `…` or `...`: the text of `button`, `a`, `option`, `Button`, `IconButton`, `SplitButton`, `Link`, `NavLink`, `PopupMenuItem`, `PopupMenuLabel`, `DropdownMenuItem`, `MenuItem`, `ContextMenuItem` (through any spans inside), a `label` or `aria-label`, and a `label:` in an object. Each branch of a `?:` is read, and so is the English phrase handed to `say()` or `t()` (a key such as `team:menu.remove` has no dots of its own); no other call's result is. A `…` with no word of its own in the same string is a truncation's and is not counted. Not counted yet, by name in `ELLIPSIS_EXEMPT` until the sweep that clears each: `busy` (a listed first word such as Saving, Loading, and the Chinese busy forms), `placeholder` (`placeholder`, `searchPlaceholder`, `emptyOptionLabel`, `blankLabel`) and `prompt` (an `<option value="">` or `{ value: '', label }`) | the label without the dots, saying what it does ("Extend trial"). `…` means only "the words are cut" (owner ruling 2026-10-14) |
5410
- | `colour` | a literal colour, in a script string (`.ts` and `.tsx`) or a stylesheet declaration (`.css`, `.scss`, which this kind alone reads): a hex; an `rgb()` / `rgba()` / `hsl()` / `hsla()` / `hwb()` / `oklch()` / `oklab()` / `lab()` / `lch()` with a number in it; a Tailwind palette class (a colour utility with a hue and a step, or `white` / `black`, under any variant and alpha); a `--color-<hue>-<step>` variable; a named colour as the value of a colour property; and a palette class in `@apply`. A `var()` fallback counts (a fallback is a second palette). Not counted: a role or token, `transparent`, `currentColor`, `url(#…)`, a `#` in a link or id, a comment, a `mask` declaration (its black is alpha) | a colour role: its utility (`text-ink`, `bg-surface`, `border-line`, `bg-accent-fill` …) or `var(--role)`; `COLOUR_ROLES` lists them. A merchant site reads the site theme. A colour a frame needs because the shell's stylesheet cannot reach it is an `allow` entry with its reason (owner ruling 2026-10-23) |
5410
+ | `colour` | a literal colour, in a script string (`.ts` and `.tsx`) or a stylesheet declaration (`.css`, `.scss`, read for this kind, `own-text` and `hand-motion`): a hex; an `rgb()` / `rgba()` / `hsl()` / `hsla()` / `hwb()` / `oklch()` / `oklab()` / `lab()` / `lch()` with a number in it; a Tailwind palette class (a colour utility with a hue and a step, or `white` / `black`, under any variant and alpha); a `--color-<hue>-<step>` variable; a named colour as the value of a colour property; and a palette class in `@apply`. A `var()` fallback counts (a fallback is a second palette). Not counted: a role or token, `transparent`, `currentColor`, `url(#…)`, a `#` in a link or id, a comment, a `mask` declaration (its black is alpha) | a colour role: its utility (`text-ink`, `bg-surface`, `border-line`, `bg-accent-fill` …) or `var(--role)`; `COLOUR_ROLES` lists them. A merchant site reads the site theme. A colour a frame needs because the shell's stylesheet cannot reach it is an `allow` entry with its reason (owner ruling 2026-10-23) |
5411
5411
  | `dialog-frame` | a `className` on a shell `Dialog`, `PopupForm` or `ConfirmDialog` (bare or namespaced) that redraws its frame (a string or a template literal): a zero padding on any side, named or `[0]` / `[0px]`; a width or height cap taken off or set (`none`, `screen`, `full`, any arbitrary value); a height of `full`, `screen` or a viewport unit (`dvh`, `svh` …); an arbitrary width or height in viewport units, a percentage or a `calc()`; a minimum height of the screen. Not counted: a class held in a variable (`className={cls}`), and a `style` prop | a `Dialog` size: `size="full"` for a chooser laid out like a window, with `headerActions` beside the cross |
5412
5412
  | `scaled-frame` | a drawing scaled from the top left by hand: a top-left transform origin (`top left`, `left top`, `0 0`, `0% 0%`, `0px 0px`) as a style key or a DOM write, in CSS text inside a string, or as the Tailwind origin class for the top left (named or an arbitrary zero). Not counted: an origin held in a variable, a stylesheet file, and a scale from the centre moved back with a translate | `FitFrame` (a preview drawn at a logical size), or `fitScale` / `fitBoxScale` / `fitFrameStyle`, from `efficient-shell/ui` |
5413
+ | `own-text` | text drawn with its own type: a raw `<h1>`…`<h6>`; a raw `<p>` or `<span>` with a type class (a size step `text-xs` … or an arbitrary size, a weight `font-medium` … or `font-[600]`, also through `clsx()`) or an inline `fontSize` / `fontWeight`; in a stylesheet, a rule that sets its own `font-size` or `font` (not a reset to `inherit`), once per rule, on its selector line. A pill's type is the pill's (`own-badge`) | `Title` (with `as=` for the heading level), `Paragraph`, `Text` |
5414
+ | `own-badge` | a pill drawn by hand: a raw `span`, `div`, `small`, `strong`, `b`, `em`, `i`, `p`, `mark`, `label` or `li` whose classes (a string, a template, the strings of a ternary or a `clsx()`) give it a round corner, a background colour, a text colour, side padding and a pill's height (a vertical padding of 0 to 3px, or a full round with small type and no vertical padding). Not counted: a box with a box's padding, a `<button>` (the `button` kind) | `ColoredBadge` (a tone), `StatusBadge` |
5415
+ | `shell-part-copy` | a component defined under the name of a shell part: a function with a body, a class, or a `const` set to an arrow, a function, or `forwardRef` / `memo` of one, named like a PascalCase value the shell exports (`Title`, `Card`, `ColoredBadge` …). The names are read when the check runs, from the installed shell's own `dist/index.js` and `dist/ui/index.js` (through `export *`), never from a hand list: a part a release adds is covered by that release. A run that cannot read them fails | import the part from `efficient-shell` (`efficient-shell/ui`) |
5416
+ | `hand-motion` | a typed time, weight or length where the shell has a token: a time in a `transition` / `animation`, a `duration-150` / `delay-[40ms]` class, a numeric or bold `font-weight` / `fontWeight` / `font-[600]`, a literal border width (`border-[1px]`, `borderWidth: 1`, `border: 1px solid …`); in a stylesheet also a literal `padding`, `margin` or `gap`, and a custom property set to one literal length or time (an own token: `--rail-w: 44px`). Not counted: a token, a zero, `none` | `--motion-fast` / `--motion-base`, `--weight-*`, `--border-hairline` / `-strong` / `-accent`, `--space-*`, `--row-height-*`, `--control-height-*` |
5413
5417
 
5414
5418
  Known gaps: `rgb()` / `hsl()` colours, colours in `.ts` maps, and
5415
5419
  `createElement('button')` are not counted.
@@ -5450,10 +5454,17 @@ and reviewed:
5450
5454
  again in the same change: take them out of `kinds` and run `--update` (it
5451
5455
  drops their lines), put them back with the key, and run
5452
5456
  `--init --kind <kind>` for each.
5457
+ - `includeValues` (globs) does the same for the design-value kinds
5458
+ (`VALUE_KINDS`: `hex`, `colour`, `radius`, `spacing`, `font-size`, `shadow`,
5459
+ `hand-motion`): they also read every file these globs match, `output`
5460
+ included (render code, shopper pages), and stylesheets when `colour` or
5461
+ `hand-motion` is checked. A typed colour or size is wrong on a shopper's page
5462
+ too. Every other kind keeps the scope above; without the key nothing changes.
5463
+ The config fails when the key is set and `kinds` names no design-value kind.
5453
5464
  - No scope shrinks on a pull request. Dropping an `include`, `includeImporting`
5454
- (glob and module) or `includeCopies` line, or adding an `exclude` line or an
5465
+ (glob and module), `includeCopies` or `includeValues` line, or adding an `exclude` line or an
5455
5466
  `output` region, fails while that line matches a file the check can read (a
5456
- script, or a stylesheet when `colour` is checked, that the base branch does
5467
+ script, or a stylesheet when `colour`, `own-text` or `hand-motion` is checked, that the base branch does
5457
5468
  not exclude). A line whose files are gone may go. Lines are compared as text,
5458
5469
  so a glob written another way counts as dropped. A file that imported a module
5459
5470
  of an `includeImporting` region on the base branch fails when it is still here
@@ -0,0 +1,44 @@
1
+ import{InputEndActionButton as e}from"./chunk-B5KX7PDG.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-77N3REYY.js";import{WindowTitle as n}from"./chunk-VGUB7LPF.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as s}from"./chunk-4VFEPP2W.js";import"./chunk-44ERJYNW.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-VY6OQRZA.js";import"./chunk-LG6NDTHZ.js";import"./chunk-4BYJABCX.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-O5ZBRG2G.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-NWS5G7FE.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as a}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as i,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",p="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(d);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(p)||k}function v(){const h=i(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,v]=l(k||b),[C,R]=l(w),[W,D]=l([w]),[U,E]=l(0),[S,z]=l(0),[T,Y]=l(x),[A,B]=l(!1),[F,G]=l(null),P=i(null),L=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(T))}catch{}},[T]);const Z=e=>{const t=f(e);t&&(v(t),R(t),D(e=>{const o=e.slice(0,U+1);return o.push(t),o}),E(e=>e+1),B(!1))},H=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},V=()=>{const e=F?.trim();e?(Y(t=>[...t,{label:e,url:w}]),G(null)):G(null)};c(()=>{if(null===F)return;P.current?.focus(),P.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||G(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==F]);const J=e=>{Y(t=>t.filter((t,o)=>o!==e))},I=U>0,O=U<W.length-1,Q=T.some(e=>e.url===w),X="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
+ return m("div",{className:"relative flex flex-col h-full bg-white",children:[
3
+ /* @__PURE__ */u(n,{title:`Browser - ${j(w)}`}),
4
+ /* @__PURE__ */u(r,{app:"browser"}),
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(U>0){const e=U-1;E(e),v(W[e]),R(W[e]),B(!1)}},disabled:!I,className:X,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */u("button",{onClick:()=>{if(U<W.length-1){const e=U+1;E(e),v(W[e]),R(W[e]),B(!1)}},disabled:!O,className:X,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */u("button",{onClick:()=>z(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */u("button",{onClick:()=>Z(b),className:X,title:"Home",children:/* @__PURE__ */u(a,{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
+ /* @__PURE__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
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
+ /* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>R(w)}})})]})}),
14
+ /* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>Q?J(T.findIndex(e=>e.url===w)):void G(j(w)),className:X+" "+(Q?"text-yellow-500":""),title:Q?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:Q?"currentColor":"none",strokeWidth:1.5})}),
15
+ /* @__PURE__ */u("button",{onClick:H,className:X,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
16
+ /* @__PURE__ */u("button",{onClick:()=>B(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==F&&/* @__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
+ /* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
18
+ /* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
19
+ /* @__PURE__ */u("input",{ref:P,type:"text",value:F,onChange:e=>G(e.target.value),onKeyDown:e=>{"Enter"===e.key?V():"Escape"===e.key&&G(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
+ /* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
21
+ /* @__PURE__ */u("button",{onClick:()=>G(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
22
+ /* @__PURE__ */u("button",{onClick:V,disabled:!F.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===T.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),T.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"})&&J(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
+ /* @__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
+ /* @__PURE__ */u("div",{className:"flex-1"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(p,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(N,{url:w,iframeKey:S,iframeRef:L,openExternal:H,showHelp:A,dismissHelp:()=>B(!1)})})]})}function j(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[i,d]=l(!1);c(()=>{d(!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)&&!i?/* @__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
+ /* @__PURE__ */u(a,{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:[j(e)," can't be embedded"]}),
30
+ /* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
31
+ /* @__PURE__ */u("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
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."]}),
33
+ /* @__PURE__ */m("div",{className:"flex flex-col items-center gap-2",children:[
34
+ /* @__PURE__ */m("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 inline-flex items-center gap-2",children:[
35
+ /* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5}),"Open in a new tab"]}),
36
+ /* @__PURE__ */u("button",{onClick:()=>d(!0),className:"text-xs text-gray-500 hover:text-gray-800 underline",children:"Try loading it here anyway"})]})]})}):/* @__PURE__ */m(h,{children:[
37
+ /* @__PURE__ */u("iframe",{ref:o,src:e,className:"absolute inset-0 w-full h-full bg-white",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals",referrerPolicy:"no-referrer-when-downgrade"},t+e),n&&/* @__PURE__ */m("div",{className:"absolute top-2 right-2 max-w-sm bg-white border border-gray-200 rounded-md shadow-lg p-3 text-xs text-gray-700 z-10",children:[
38
+ /* @__PURE__ */u("div",{className:"font-medium text-gray-900 mb-1",children:"Why is this page blank?"}),
39
+ /* @__PURE__ */m("p",{className:"mb-2",children:["Most major sites (Google, GitHub, banks, news) refuse to be embedded in an iframe via ",
40
+ /* @__PURE__ */u("span",{className:"font-mono",children:"X-Frame-Options"})," or Content Security Policy. There's no workaround — the browser blocks the load before our app can do anything."]}),
41
+ /* @__PURE__ */m("p",{children:["Hit the ",
42
+ /* @__PURE__ */u("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
43
+ /* @__PURE__ */u("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
44
+ /* @__PURE__ */u("button",{onClick:s,className:"mt-2 text-2xs text-blue-600 hover:underline",children:"Got it"})]})]})}export{v as default};
@@ -0,0 +1,29 @@
1
+ import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-26KHYLJN.js";import{useWidgetSettings as n}from"./chunk-VGUB7LPF.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-4VFEPP2W.js";import"./chunk-44ERJYNW.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-VY6OQRZA.js";import"./chunk-LG6NDTHZ.js";import"./chunk-4BYJABCX.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-NWS5G7FE.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as r}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as 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),[E,T]=c(()=>t(h)),[F,U]=c(!1),[A,D]=c(E),R=i(null);n(o(()=>{D({...E}),U(!0)},[E]));const S=o(t=>{C(""),k(e=>g||"0"===e?(N(!1),"."===t?"0.":t):"."===t&&e.includes(".")?e:e+t)},[g]),W=o(()=>{k("0"),d(null),b(null),N(!1)},[]),B=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}},[]),V=o(t=>{const e=parseFloat(m);if(null!==p&&j&&!g){const t=B(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,B]),J=o(()=>{if(null===p||!j)return;const t=parseFloat(m),e=B(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,B]),Z=o(()=>{k(t=>String(parseFloat(t)/100))},[]),Y=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"?S(t.key):"."===t.key?S("."):"+"===t.key?V("+"):"-"===t.key?V("-"):"*"===t.key?V("×"):"/"===t.key?(t.preventDefault(),V("÷")):"Enter"===t.key||"="===t.key?("Enter"===t.key&&t.target instanceof Node&&R.current?.contains(t.target)&&t.preventDefault(),J()):"Escape"===t.key?W():"Backspace"===t.key?k(t=>t.length>1?t.slice(0,-1):"0"):"%"===t.key&&Z())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[S,V,J,W,Z]);const P="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",G=`${P} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,Q=`${P} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,w=`${P} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,H=`${P} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
+ return l(a,{children:[
3
+ /* @__PURE__ */l("div",{ref:R,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
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))}),(y||j&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${j} ${g?"":m}`}),
6
+ /* @__PURE__ */l("div",{className:"flex items-center gap-2",children:[
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
+ /* @__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
+ /* @__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:W,className:w,children:"AC"}),
11
+ /* @__PURE__ */u("button",{onClick:Y,className:w,children:"+/−"}),
12
+ /* @__PURE__ */u("button",{onClick:Z,className:w,children:"%"}),
13
+ /* @__PURE__ */u("button",{onClick:()=>V("÷"),className:`${Q} ${"÷"===j?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */u("button",{onClick:()=>S("7"),className:G,children:"7"}),
15
+ /* @__PURE__ */u("button",{onClick:()=>S("8"),className:G,children:"8"}),
16
+ /* @__PURE__ */u("button",{onClick:()=>S("9"),className:G,children:"9"}),
17
+ /* @__PURE__ */u("button",{onClick:()=>V("×"),className:`${Q} ${"×"===j?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */u("button",{onClick:()=>S("4"),className:G,children:"4"}),
19
+ /* @__PURE__ */u("button",{onClick:()=>S("5"),className:G,children:"5"}),
20
+ /* @__PURE__ */u("button",{onClick:()=>S("6"),className:G,children:"6"}),
21
+ /* @__PURE__ */u("button",{onClick:()=>V("-"),className:`${Q} ${"-"===j?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */u("button",{onClick:()=>S("1"),className:G,children:"1"}),
23
+ /* @__PURE__ */u("button",{onClick:()=>S("2"),className:G,children:"2"}),
24
+ /* @__PURE__ */u("button",{onClick:()=>S("3"),className:G,children:"3"}),
25
+ /* @__PURE__ */u("button",{onClick:()=>V("+"),className:`${Q} ${"+"===j?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>S("0"),className:`${G} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */u("button",{onClick:()=>S("."),className:G,children:"."}),
28
+ /* @__PURE__ */u("button",{onClick:J,className:H,children:"="})]})]}),
29
+ /* @__PURE__ */u(e,{open:F,onClose:()=>U(!1),title:"Calculator Settings",appearance:A,onAppearanceChange:D,onSave:()=>{T(A),localStorage.setItem(h,JSON.stringify(A)),U(!1)}})]})}export{m as default};
@@ -0,0 +1,21 @@
1
+ import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-26KHYLJN.js";import{useWidgetSettings as r}from"./chunk-VGUB7LPF.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-4VFEPP2W.js";import"./chunk-44ERJYNW.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-VY6OQRZA.js";import"./chunk-LG6NDTHZ.js";import"./chunk-4BYJABCX.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-NWS5G7FE.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as 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",d="currency_rates_cache";function k(t){try{const e=JSON.parse(localStorage.getItem(d)||"{}")[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(d)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(d,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,d]=s(g),[f,x]=s(()=>t(h)),[D,y]=s({}),[b,S]=s(!1),[U,C]=s(!1),[v,R]=s([]),[J,A]=s(f),[B,Y]=s("USD"),[F,P]=s("CNY");r(o(()=>{R([...u]),A({...f}),C(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){S(!0);const r={};for(const e of t){const t=k(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&&(y(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
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:[b&&/* @__PURE__ */m(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=D[t]?.[e];/* @__PURE__ */
4
+ return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(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
+ /* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
6
+ /* @__PURE__ */m("span",{className:"text-base",children:N[t]||""}),
7
+ /* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:t}),
8
+ /* @__PURE__ */m("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */m("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
9
+ /* @__PURE__ */m("span",{className:"text-base",children:N[e]||""}),
10
+ /* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
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:U,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:A,onSave:()=>{if(0===v.length)return;const t=v.slice(0,4);d(t),x(J),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(J)),C(!1)},children:/* @__PURE__ */i("div",{children:[
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:["(",v.length,"/",4,")"]})]}),
15
+ /* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:v.map(([t,e],r)=>/* @__PURE__ */i("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
+ /* @__PURE__ */i("span",{className:"text-sm",children:[N[t]||""," ",t," → ",N[e]||""," ",e]}),
17
+ /* @__PURE__ */m("button",{onClick:()=>R(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),v.length<4?/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
18
+ /* @__PURE__ */m("select",{value:B,onChange:t=>Y(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
+ /* @__PURE__ */m("span",{className:"text-gray-400",children:"→"}),
20
+ /* @__PURE__ */m("select",{value:F,onChange:t=>P(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:()=>{B!==F&&v.length<4&&R(t=>[...t,[B,F]])},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};
@@ -0,0 +1,141 @@
1
+ import{openPreviewFile as e}from"./chunk-UMIRPFQJ.js";import{SidebarLayout as t}from"./chunk-MCLVTQSF.js";import"./chunk-QWK6DRSN.js";import"./chunk-JLSXDYS4.js";import{SearchableSelect as n}from"./chunk-AAFPAQXH.js";import{Breadcrumbs as a}from"./chunk-WREUA43Q.js";import{Select_default as r}from"./chunk-D5PXRJHA.js";import"./chunk-EO5RLFRX.js";import"./chunk-K5YT5PMJ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-VKZC3NPM.js";import{Input_default as l}from"./chunk-B5KX7PDG.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 f}from"./chunk-36BRD5J3.js";import{fromDateKey as p,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-77N3REYY.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 $,getDesktopFoldersSnapshot as M,filesRoleWrites as R,hasHostFilesStore as A,FolderGlyph as L,DesktopItemMiniIcon as P,desktopItemTypeLabel as F,FilesQuotaError as E,FILES_OFFICE_EXTENSIONS as I,FILES_ROLE_LABELS as W}from"./chunk-KGRJSTPM.js";import"./chunk-I4RJAMLJ.js";import{useWindowManager as z,WindowTitle as O}from"./chunk-VGUB7LPF.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as U,prompt as K}from"./chunk-4VFEPP2W.js";import{Dialog as Y}from"./chunk-44ERJYNW.js";import"./chunk-EIFNESXS.js";import{ItemCount as V}from"./chunk-LC2UF3AA.js";import"./chunk-VY6OQRZA.js";import"./chunk-LG6NDTHZ.js";import"./chunk-4BYJABCX.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-O5ZBRG2G.js";import{DropdownMenu as J}from"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import{IconButton_default as B}from"./chunk-NWS5G7FE.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.js";import{Button_default as G}from"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as Q}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as Z}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import{TH_ONE_LINE as H}from"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as X}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as q,useRef as _,useEffect as ee,useCallback as te,useSyncExternalStore as ne,useMemo as ae}from"react";import{jsxs as re,jsx as ie,Fragment as se}from"react/jsx-runtime";var le={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 oe(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function ce(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":le[oe(e.name)]??"other"}var de={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},me={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 he(e){const t=e.officeKind?I[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function ue(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"}}):f}function pe(e){return d(e,{clock:{dateStyle:"short",timeStyle:"short"}})}function ke(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var ge=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function we(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 ge.compare(ke(e),ke(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return ge.compare(he(e),he(n))}})(e,a)||ge.compare(e.name,a.name))}var ye=["folder","document","spreadsheet","slides","pdf","image","video"],be={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function ve(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=h(t),a=p(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&&ce(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 xe=[{value:"viewer",label:"Viewer"},{value:"commenter",label:"Commenter"},{value:"editor",label:"Editor"}];function Ne({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=q(null),[o,c]=q(""),[d,m]=q([]),[h,u]=q(!1),[f,p]=q(""),[k,g]=q("viewer"),[w,y]=q(!1),b=_(/* @__PURE__ */new Map),v=t?.id??null;if(ee(()=>{if(l(null),p(""),c(""),!v||!e.shares)return;let t=!0;return e.shares(v).then(e=>{t&&l(e)}).catch(e=>{t&&(X.error(e.message),l([]))}),()=>{t=!1}},[v,e]),ee(()=>{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){X.error(e.message)}finally{y(!1)}};/* @__PURE__ */
2
+ return re(Y,{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__ */ie(G,{variant:"secondary",onClick:a,children:"Done"}),children:[
3
+ /* @__PURE__ */re("div",{className:"flex items-center gap-2",children:[
4
+ /* @__PURE__ */ie("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */ie(n,{value:f,onChange:p,onSearchChange:c,loading:h&&0===d.length,options:N,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
5
+ /* @__PURE__ */ie("div",{className:"w-28 shrink-0",children:/* @__PURE__ */ie(r,{value:k,onChange:e=>g(e),options:xe,"aria-label":"Access"})}),
6
+ /* @__PURE__ */ie(G,{variant:"primary",onClick:()=>{if(!f||!e.share)return;const n=b.current.get(f);C(async()=>{await e.share(t.id,f,k),p(""),c(""),n&&X.success(`Shared with ${n.name}`)})},disabled:!f||w,children:"Add"})]}),
7
+ /* @__PURE__ */ie("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */ie(Z,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */re("ul",{className:"divide-y divide-line-subtle text-sm",children:[
8
+ /* @__PURE__ */re("li",{className:"flex items-center gap-2 h-10",children:[
9
+ /* @__PURE__ */ie("span",{className:"flex-1 truncate",children:"You"}),
10
+ /* @__PURE__ */ie("span",{className:"text-xs text-ink-faint",children:"Owner"})]}),s.map(n=>/* @__PURE__ */re("li",{className:"flex items-center gap-2 h-10",children:[
11
+ /* @__PURE__ */ie("span",{className:"flex-1 truncate",title:n.person.name,children:n.person.name}),
12
+ /* @__PURE__ */ie("div",{className:"w-28 shrink-0",children:/* @__PURE__ */ie(r,{value:n.role,onChange:a=>C(()=>e.share(t.id,n.person.id,a)),options:xe,"aria-label":`Access for ${n.person.name}`,disabled:w})}),
13
+ /* @__PURE__ */ie(B,{"aria-label":`Remove ${n.person.name}`,variant:"ghost",size:"sm",disabled:w,onClick:()=>C(()=>e.unshare(t.id,n.person.id)),children:/* @__PURE__ */ie(Q,{name:"close",className:"h-4 w-4",strokeWidth:1.8})})]},n.person.id))]})]})}function Ce({store:e,items:t,from:n,onClose:a,onMove:r}){const[i,s]=q(n??null),[l,o]=q(null),[c,d]=q(!1);ee(()=>{t&&s(n??null)},[t,n]),ee(()=>{if(!t)return;let n=!0;return d(!0),e.list(i).then(e=>{n&&o(e)}).catch(()=>{n&&o(null)}).finally(()=>{n&&d(!1)}),()=>{n=!1}},[e,i,t]);const m=new Set((t??[]).map(e=>e.id)),h=(l?.entries??[]).filter(e=>"folder"===e.kind&&!m.has(e.id)),u=(l?.folder.path??[]).filter(e=>null!==e.id),f=u.length>1?u[u.length-2].id:null,p=l?.folder,k=R(p?.role??"owner"),g=void 0!==n&&i===n,w=t?.length??0,y=1===w?`"${t[0].name}"`:`${w} items`;/* @__PURE__ */
14
+ return re(Y,{open:!!t,onClose:a,title:`Move ${y}`,size:"sm",footer:/* @__PURE__ */re(se,{children:[
15
+ /* @__PURE__ */ie(G,{variant:"secondary",onClick:a,children:"Cancel"}),
16
+ /* @__PURE__ */ie(G,{variant:"primary",onClick:()=>r(i),disabled:c||!k||g,children:"Move here"})]}),children:[
17
+ /* @__PURE__ */re("div",{className:"flex items-center gap-1 mb-2 min-h-8",children:[null!==i&&/* @__PURE__ */ie(B,{"aria-label":"Back",size:"sm",onClick:()=>s(f),children:/* @__PURE__ */ie(Q,{name:"arrow-left",className:"h-4 w-4"})}),
18
+ /* @__PURE__ */ie("span",{className:"text-sm font-medium text-ink-strong truncate",children:null===i?"My files":p?.name??""})]}),
19
+ /* @__PURE__ */ie("div",{className:"border border-line rounded-(--radius-control) h-64 overflow-auto",children:c?/* @__PURE__ */ie(Z,{size:"sm",padding:"p-6",label:"Loading"}):0===h.length?/* @__PURE__ */ie("div",{className:"p-6 text-center text-sm text-ink-faintest",children:"No folders here."}):/* @__PURE__ */ie("ul",{children:h.map(e=>/* @__PURE__ */ie("li",{children:/* @__PURE__ */re("button",{type:"button",onClick:()=>s(e.id),className:"flex w-full items-center gap-2 px-3 h-9 text-left text-sm hover:bg-row-hover",children:[
20
+ /* @__PURE__ */ie(Q,{name:"folder",look:"solid",tone:"muted",className:"h-4 w-4 shrink-0"}),
21
+ /* @__PURE__ */ie("span",{className:"truncate flex-1",children:e.name}),
22
+ /* @__PURE__ */ie(Q,{name:"chevron-right",tone:"muted",className:"h-4 w-4 shrink-0"})]})},e.id))})}),!k&&/* @__PURE__ */ie("p",{className:"mt-2 text-xs text-ink-faint",children:"You can view this folder but not move things into it."})]})}function je({store:e,entry:t,selectedCount:n,onClose:a}){const[r,i]=q(null),[s,l]=q(null);ee(()=>{if(i(null),l(null),!t)return;let n=!0;return e.info?.(t.id).then(e=>{n&&i(e)}).catch(()=>{}),e.shares?.(t.id).then(e=>{n&&l(e)}).catch(()=>{}),()=>{n=!1}},[e,t]);const o=t?ce(t):null,c=o?me[o]:null,d=r?.path.slice(0,-1).map(e=>e.name||"My files").join(" / "),m=(e,t)=>t?/* @__PURE__ */re("div",{className:"py-2",children:[
23
+ /* @__PURE__ */ie("dt",{className:"text-2xs text-ink-faint",children:e}),
24
+ /* @__PURE__ */ie("dd",{className:"text-sm text-ink break-words",children:t})]}):null;/* @__PURE__ */
25
+ return re("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col min-h-0 bg-surface","aria-label":"Details",children:[
26
+ /* @__PURE__ */re("div",{className:"flex items-center gap-2 px-3 h-12 shrink-0",children:[c&&/* @__PURE__ */ie(Q,{name:c.name,tone:c.tone,className:"h-5 w-5 shrink-0"}),
27
+ /* @__PURE__ */ie("span",{className:"flex-1 truncate text-sm font-medium text-ink-strong",children:t?he(t):n>1?`${n} items selected`:"Details"}),
28
+ /* @__PURE__ */ie(B,{"aria-label":"Close details",size:"sm",onClick:a,children:/* @__PURE__ */ie(Q,{name:"close",className:"h-4 w-4"})})]}),
29
+ /* @__PURE__ */ie("div",{className:"flex-1 overflow-auto px-4 pb-4",children:t?/* @__PURE__ */re(se,{children:[
30
+ /* @__PURE__ */ie("div",{className:"h-32 rounded-(--radius-control) bg-surface-sunken flex items-center justify-center mb-3",children:c&&/* @__PURE__ */ie(Q,{name:c.name,tone:c.tone,className:"h-12 w-12"})}),s&&/* @__PURE__ */re("div",{className:"mb-3",children:[
31
+ /* @__PURE__ */ie("div",{className:"text-xs font-medium text-ink-strong mb-1",children:"Who has access"}),0===s.length?/* @__PURE__ */re("p",{className:"text-sm text-ink-faint",children:["Only ","owner"!==t.role&&t.role?t.owner?.name??"its owner":"you"]}):/* @__PURE__ */ie("ul",{className:"text-sm text-ink",children:s.map(e=>/* @__PURE__ */re("li",{className:"flex justify-between py-0.5",children:[
32
+ /* @__PURE__ */ie("span",{className:"truncate",children:e.person.name}),
33
+ /* @__PURE__ */ie("span",{className:"text-ink-faint text-xs",children:W[e.role]})]},e.person.id))})]}),
34
+ /* @__PURE__ */re("dl",{className:"border-t border-line pt-2",children:[m("Type",o?de[o]:null),"file"===t.kind&&m("Size",ue(t)),m("Location",d),m("Owner","me"===ke(t)?"me":ke(t)),m("Modified",t.modifiedAt?`${fe(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),m("Created",r?.createdAt?fe(r.createdAt):null)]})]}):/* @__PURE__ */ie("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 Se=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,De="files.layout",Te={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"},$e=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],Me="application/x-efficient-files";function Re(){try{return"grid"===localStorage.getItem(De)?"grid":"list"}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 Le(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 Pe=(e,t)=>e instanceof Error&&e.message||t;function Fe(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 Ee({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=me[ce(e)];/* @__PURE__ */
35
+ return ie(Q,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function Ie({entry:e,read:t}){const[n,a]=q(null),r="image"===ce(e)&&e.size<=5242880;return ee(()=>{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__ */ie("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */ie(Ee,{entry:e,className:"h-10 w-10"})}function We(){const n=C(),r=n.title??"Files",c=null!==g(),d=!c&&!!n.shares&&!!n.sharedWithMe,[m,h]=q(null),[u,f]=q(null),[p,k]=q([]),[W,Y]=q(()=>/* @__PURE__ */new Set),le=_(null),[ce,xe]=q(!0),[We,ze]=q(!1),[Oe,Ue]=q(null),[Ke,Ye]=q(!1),[Ve,Je]=q(null),[Be,Ge]=q(null),[Qe,Ze]=q(null),[He,Xe]=q(Re),[qe,_e]=q(!1),[et,tt]=q(""),[nt,at]=q(""),[rt,it]=q({}),[st,lt]=q({key:"name",dir:"asc"}),[ot,ct]=q(()=>{const e=j();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),dt=_("files"),mt=_(ot);mt.current=ot,ee(()=>{S()},[]);const[ht,ut]=q([]),ft=e=>{Xe(e);try{localStorage.setItem(De,e)}catch{}},pt=te(e=>{ct(e),it({}),lt("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(tt(""),at(""))},[]);ee(()=>{const e=()=>{S(),pt("trash")},t=e=>{S();const t=e.detail?.folderId;t&&pt({desktopFolderId:t})};return window.addEventListener(D,e),window.addEventListener(T,t),()=>{window.removeEventListener(D,e),window.removeEventListener(T,t)}},[pt]);const kt=ne($,M,M),gt="object"==typeof ot?ot.desktopFolderId:null,wt=gt?kt?.folders.find(e=>e.id===gt)??null:null,yt=gt&&kt?.itemsByFolder[gt]||[];ee(()=>{gt&&kt&&!kt.folders.some(e=>e.id===gt)&&pt("files")},[gt,kt,pt]);const bt=_(0),vt=_(null),xt=_(null),{openPage:Nt,openEntity:Ct}=z(),jt=i(),St=i(),Dt=i(),Tt=ne(w,y,y);ee(()=>b(),[]),ee(()=>{!Tt||"trash"!==ot&&"object"!=typeof ot||pt("files")},[Tt,ot,pt]);const $t=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)},Mt=te(async()=>{if(!c)try{Ue(await n.quota())}catch{}},[n,c]),Rt=te(async(e,t)=>{xe(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):X.error(Pe(e,t))}finally{xe(!1)}},[]),At=te(async e=>{if(c)return f(Ae(e)),ze(!1),void xe(!1);await Rt(async()=>{f(await n.list(e))},"Failed to list"),Mt()},[n,Mt,c,Rt]),Lt=te(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 xe(!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 Rt(async()=>{k(await a())},"Failed to list files")},[n,c,m,Rt]),Pt=te(async()=>{if(c)return ut([]),void xe(!1);await Rt(async()=>{ut(await n.trash())},"Failed to list trash"),Mt()},[n,Mt,c,Rt]),Ft=()=>{"files"===ot?At(m):Se(ot)?Lt(ot,nt):"trash"===ot&&Pt()};ee(()=>{Y(/* @__PURE__ */new Set),le.current=null,Ft()},[m,ot,nt]),ee(()=>{const e=et.trim();if(!e)return;const t=setTimeout(()=>{e===nt&&"search"===mt.current||("search"!==mt.current&&(dt.current=mt.current),ct("search"),it({}),at(e))},300);return()=>clearTimeout(t)},[et]);const Et=()=>{tt(""),"search"===mt.current&&pt(dt.current)},It=e=>{pt("files"),h(e)},Wt=async(e,t)=>{try{await e()}catch(e){X.error(Pe(e,t))}Ft()},zt=e=>Wt(async()=>{await n.restore(e.id),X.success(`Restored "${e.name}"`)},"Restore failed"),Ot=async e=>{await U({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Wt(()=>n.purge(e.id),"Delete failed")},Ut=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){X.error(Pe(e,"Download failed"))}},Kt="files"===ot?u?.folder??null:null,Yt=Kt?.role??"owner",Vt="owner"!==Yt,Jt="files"===ot?m:null,Bt=!c&&("files"!==ot||R(Yt)),Gt=!c&&"files"===ot&&R(Yt),Qt=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 E?X.error(Le(r.name,e)):X.error(`Upload ${r.name}: ${Pe(e,"failed")}`)}}a>1&&X.success(`Uploaded ${a} files`),"files"===ot?At(m):It(null)},Zt=async e=>{const t=he(e),a=await K({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?X.error("Names cannot contain slashes"):Wt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?I[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Ht=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 U({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${he(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 Wt(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),X.success(t?`"${he(t)}" moved to trash`:`${e.length} items moved to trash`))},Xt=(e,t)=>Wt(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 Wt(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),X.success(1===a.length?`Moved "${he(a[0])}"`:`Moved ${a.length} items`))},_t=()=>{bt.current=0,Ye(!1),Je(null)};ee(()=>{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??[]:Se(ot)?p:[],tn=ae(()=>we(ve(en,rt),st),[en,rt,st]),nn=ae(()=>new Map(tn.map(e=>[e.id,e])),[tn]),an=[...W].map(e=>nn.get(e)).filter(e=>!!e),rn=1===an.length?an[0]:null,sn=e=>e.role??("files"===ot?Yt:"owner"),ln=e=>!c&&R(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 Y(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&le.current){const t=tn.map(e=>e.id),n=t.indexOf(le.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Y(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}le.current=e,t.metaKey||t.ctrlKey?Y(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Y(/* @__PURE__ */new Set([e]))},mn=()=>{Y(/* @__PURE__ */new Set),le.current=null},hn=e=>!!Tt&&"file"===e.kind&&x(Tt.request,e.name),un=e=>Tt&&"file"===e.kind&&!hn(e)?"text-ink-faintest":"",fn=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})},pn=Tt&&rn&&hn(rn)?rn:null,kn=t=>{"folder"===t.kind?It(t.id):Tt?fn(t):(async t=>{if(c)return;if(n.open?.(t))return;const a=Te[oe(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)}):Ut(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__ */ie(Q,{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__ */ie(Q,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[];const s=e.some(e=>!e.starred);return Fe([...t?[{key:"open",label:a,icon:/* @__PURE__ */ie(Q,{name:"external",className:"h-4 w-4"}),onSelect:()=>kn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */ie(Q,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Ut)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */ie(Q,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Zt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */ie(Q,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Wt(async()=>{for(const t of e)await n.copy(t.id);X.success(1===e.length?`Copied "${he(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&on(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */ie(Q,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Ge(t)}]:[],...e.every(cn)?[{key:"move",label:"Move",icon:/* @__PURE__ */ie(Q,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Ze(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */ie(Q,{name:"star",className:"h-4 w-4"}),onSelect:()=>Xt(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */ie(Q,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Y(/* @__PURE__ */new Set([t.id])),_e(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */ie(Q,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Ht(e)}]:[]])},wn=(e,t)=>{const n=W.has(t.id)?an:[t];jt.open(e,n)&&!W.has(t.id)&&(Y(/* @__PURE__ */new Set([t.id])),le.current=t.id)},yn=e=>cn(e)?{draggable:!0,onDragStart:t=>{const n=W.has(e.id)?an:[e];t.dataTransfer.setData(Me,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(Me)&&(t.preventDefault(),t.stopPropagation(),Ve!==e.id&&Je(e.id))},onDragLeave:()=>{Ve===e.id&&Je(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(Me))return;t.preventDefault(),t.stopPropagation(),Je(null);const n=JSON.parse(t.dataTransfer.getData(Me)||"[]").map(e=>nn.get(e)).filter(t=>!!t&&t.id!==e.id);qt(n,e.id)}}:{};if(We)/* @__PURE__ */
36
+ return re("div",{className:"flex flex-col h-full bg-surface",children:[
37
+ /* @__PURE__ */ie(O,{title:`${r} - offline`}),
38
+ /* @__PURE__ */ie("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */re("div",{className:"max-w-md",children:[
39
+ /* @__PURE__ */ie(Q,{name:"close-circle",tone:"muted",className:"h-12 w-12 mx-auto mb-3",strokeWidth:1.4}),A()?/* @__PURE__ */re(se,{children:[
40
+ /* @__PURE__ */ie("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach your files"}),
41
+ /* @__PURE__ */ie("p",{className:"text-sm text-ink-faint mb-3",children:"Check your connection and try again."})]}):/* @__PURE__ */re(se,{children:[
42
+ /* @__PURE__ */ie("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
43
+ /* @__PURE__ */re("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
44
+ /* @__PURE__ */ie("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
45
+ /* @__PURE__ */ie(G,{variant:"primary",onClick:Ft,children:"Retry"})]})})]});const vn=Oe&&Oe.limit>0?Math.min(100,Math.round(Oe.used/Oe.limit*100)):0,xn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",Nn=[Vt?{label:"Shared with me",onClick:()=>pt("shared")}:{label:"My files",onClick:()=>It(null)},...(Kt?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>It(e.id)}))],Cn="recent"===ot?"Recent":"starred"===ot?"Starred":"shared"===ot?"Shared with me":"search"===ot?`Results for “${nt}”`:"trash"===ot?"Trash":wt?wt.name:null,jn=Tt?`${r} - Choosing`:Cn?`${r} - ${"search"===ot?"Search":Cn}`:Kt&&null!==Kt.id?`${r} - ${Kt.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=Fe([{key:"folder",label:"New folder",icon:/* @__PURE__ */ie(Q,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await K({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?X.error("Folder names cannot contain slashes"):(await Wt(()=>n.createFolder(Jt,e),"Create folder failed"),"files"!==ot&&It(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */ie(Q,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */ie(Q,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>xt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?$e.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=me["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */ie(Q,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Jt)).catch(e=>X.error(Pe(e,"Could not create it")))}}}):[]]),Tn=/* @__PURE__ */re("div",{className:"flex h-full flex-col",children:[
46
+ /* @__PURE__ */ie("div",{className:"p-3 pb-2",children:/* @__PURE__ */ie(J,{trigger:/* @__PURE__ */re(se,{children:[
47
+ /* @__PURE__ */ie(Q,{name:"add",className:"h-5 w-5"}),
48
+ /* @__PURE__ */ie("span",{children:"New"})]}),items:Dn,align:"start","aria-label":"New",disabled:!Bt,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
+ /* @__PURE__ */re("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
50
+ /* @__PURE__ */re("button",{onClick:()=>It(null),className:Sn("files"===ot&&!Vt),children:[
51
+ /* @__PURE__ */ie(Q,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!c&&/* @__PURE__ */re("button",{onClick:()=>pt("recent"),className:Sn("recent"===ot),children:[
52
+ /* @__PURE__ */ie(Q,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!c&&/* @__PURE__ */re("button",{onClick:()=>pt("starred"),className:Sn("starred"===ot),children:[
53
+ /* @__PURE__ */ie(Q,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),d&&/* @__PURE__ */re("button",{onClick:()=>pt("shared"),className:Sn("shared"===ot||"files"===ot&&Vt),children:[
54
+ /* @__PURE__ */ie(Q,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!c&&/* @__PURE__ */re("button",{onClick:()=>pt("trash"),className:Sn("trash"===ot),children:[
55
+ /* @__PURE__ */ie(Q,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),kt&&kt.folders.length>0&&/* @__PURE__ */re(se,{children:[
56
+ /* @__PURE__ */ie("div",{className:"px-3 pt-4 pb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),kt.folders.map(e=>/* @__PURE__ */re("button",{onClick:()=>pt({desktopFolderId:e.id}),className:Sn(gt===e.id),children:[
57
+ /* @__PURE__ */ie(L,{className:"h-4 w-4 shrink-0 text-amber-500"}),
58
+ /* @__PURE__ */ie("span",{className:"truncate",children:e.name}),
59
+ /* @__PURE__ */ie(V,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),Oe&&/* @__PURE__ */re("div",{className:"px-5 py-3 shrink-0",title:`${o(Oe.used)} of ${o(Oe.limit)} used`,children:[
60
+ /* @__PURE__ */ie("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */ie("div",{className:`h-full ${xn} transition-all`,style:{width:`${vn}%`}})}),
61
+ /* @__PURE__ */re("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[o(Oe.used)," of ",o(Oe.limit)," used"]})]})]}),$n=(e,t)=>/* @__PURE__ */re("span",{className:"inline-flex items-center gap-1",children:[e,
62
+ /* @__PURE__ */ie(Q,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),Mn=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"),Rn=Se(ot)||"files"===ot,An=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)=>ge.compare(e.name,t.name))}(en),Ln=Rn&&en.length>0?/* @__PURE__ */re("div",{className:"flex items-center gap-2 shrink-0",children:[
63
+ /* @__PURE__ */ie(J,{trigger:$n(rt.type?de[rt.type]:"Type",!!rt.type),"aria-label":"Type",triggerClassName:Mn(!!rt.type),items:[...ye.map(e=>({type:"radio",key:e,label:de[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__ */ie(J,{trigger:$n(rt.person?"me"===rt.person?"Owned by me":An.find(e=>e.id===rt.person)?.name??"People":"People",!!rt.person),"aria-label":"People",triggerClassName:Mn(!!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"}))},...An.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__ */ie(J,{trigger:$n(rt.modified?be[rt.modified]:"Modified",!!rt.modified),"aria-label":"Modified",triggerClassName:Mn(!!rt.modified),items:[...Object.keys(be).map(e=>({type:"radio",key:e,label:be[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,Pn=Rn&&an.length>0&&!Tt?/* @__PURE__ */re("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
65
+ /* @__PURE__ */ie(B,{"aria-label":"Clear selection",size:"sm",onClick:mn,children:/* @__PURE__ */ie(Q,{name:"close",className:"h-4 w-4"})}),
66
+ /* @__PURE__ */re("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[an.length," selected"]}),rn&&on(rn)&&/* @__PURE__ */ie(B,{"aria-label":"Share",size:"sm",onClick:()=>Ge(rn),children:/* @__PURE__ */ie(Q,{name:"add-person",className:"h-4 w-4"})}),!c&&an.every(e=>"file"===e.kind)&&/* @__PURE__ */ie(B,{"aria-label":"Download",size:"sm",onClick:()=>an.forEach(Ut),children:/* @__PURE__ */ie(Q,{name:"download",className:"h-4 w-4"})}),an.every(cn)&&/* @__PURE__ */ie(B,{"aria-label":"Move",size:"sm",onClick:()=>Ze(an),children:/* @__PURE__ */ie(Q,{name:"forward",className:"h-4 w-4"})}),!c&&an.every(ln)&&/* @__PURE__ */ie(B,{"aria-label":"Move to trash",size:"sm",onClick:()=>Ht(an),children:/* @__PURE__ */ie(Q,{name:"trash",className:"h-4 w-4"})}),
67
+ /* @__PURE__ */ie(J,{trigger:/* @__PURE__ */ie(Q,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(an)})]}):null,Fn=/* @__PURE__ */ie("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:Pn??/* @__PURE__ */re(se,{children:[
68
+ /* @__PURE__ */re("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===ot?/* @__PURE__ */ie("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */ie(a,{items:Nn,maxItems:5})}):"trash"===ot?/* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof ot?/* @__PURE__ */re(se,{children:[
69
+ /* @__PURE__ */ie(L,{className:"h-4 w-4 text-amber-500 shrink-0"}),
70
+ /* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong truncate",children:wt?.name??"Desktop folder"}),
71
+ /* @__PURE__ */ie("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */ie("span",{className:"text-base font-medium text-ink-strong truncate",children:Cn}),"files"===ot&&Vt&&!R(Yt)&&/* @__PURE__ */re("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__ */ie(Q,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===ot&&Vt&&Kt?.owner&&/* @__PURE__ */re("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",Kt.owner.name]})]}),Ln,"trash"===ot&&/* @__PURE__ */ie(G,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===ht.length)return;await U({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"})&&Wt(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===ht.length,children:"Empty trash"})]})}),En=(e,t)=>Tt?null:/* @__PURE__ */re("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[on(e)&&/* @__PURE__ */ie(B,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Ge(e)},children:/* @__PURE__ */ie(Q,{name:"add-person",className:"h-4 w-4"})}),!c&&"file"===e.kind&&/* @__PURE__ */ie(B,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Ut(e)},children:/* @__PURE__ */ie(Q,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!c&&/* @__PURE__ */ie(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__ */ie(Q,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
73
+ /* @__PURE__ */ie("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ie(J,{trigger:/* @__PURE__ */ie(Q,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(W.has(e.id)&&an.length>1?an:[e])})})]}),In=e=>/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
74
+ /* @__PURE__ */ie(Ee,{entry:e}),
75
+ /* @__PURE__ */ie("span",{className:"truncate",title:e.name,children:he(e)}),!!e.shareCount&&/* @__PURE__ */ie("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__ */ie(Q,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */ie("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */ie(Q,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),Wn=(e,t,n)=>{const a=st.key===e;/* @__PURE__ */
76
+ return ie("th",{className:`${H} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===st.dir?"ascending":"descending":void 0,children:/* @__PURE__ */re("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__ */ie(Q,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */ie(Q,{name:"arrow-down",className:"h-3 w-3"}))]})})},zn="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,On=0===tn.length?ce?/* @__PURE__ */ie(Z,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:en.length>0?"Nothing matches these filters.":zn??/* @__PURE__ */re(se,{children:["This folder is empty.",Gt&&/* @__PURE__ */re(se,{children:[" Drop files here or choose ",
77
+ /* @__PURE__ */ie("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===He?/* @__PURE__ */ie("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=tn.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */re("section",{className:"mb-4",children:[
78
+ /* @__PURE__ */ie("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
79
+ /* @__PURE__ */ie("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=W.has(t.id);/* @__PURE__ */
80
+ return re("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":he(t),onClick:e=>dn(t.id,e),onDoubleClick:()=>kn(t),onContextMenu:e=>wn(e,t),...yn(t),...bn(t),className:"group rounded-xl border cursor-default select-none outline-none focus-visible:ring-2 focus-visible:ring-accent-border "+(a||Ve===t.id?"border-accent-border bg-accent-tint":"border-line bg-surface-sunken hover:bg-row-hover"),children:[
81
+ /* @__PURE__ */re("div",{className:"flex items-center gap-2 pl-3 pr-1 h-11",children:[
82
+ /* @__PURE__ */ie(Ee,{entry:t,className:"h-4 w-4"}),
83
+ /* @__PURE__ */ie("span",{className:"flex-1 truncate text-sm",title:t.name,children:he(t)}),
84
+ /* @__PURE__ */ie("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */ie(J,{trigger:/* @__PURE__ */ie(Q,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&an.length>1?an:[t])})})]}),"file"===e&&/* @__PURE__ */re(se,{children:[
85
+ /* @__PURE__ */ie("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */ie(Ie,{entry:t,read:c?void 0:n.read})}),
86
+ /* @__PURE__ */re("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ke(t)?"You":ke(t)," · ",fe(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */re("table",{className:"w-full text-sm table-fixed",children:[
87
+ /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[Wn("name","Name","text-left"),d&&Wn("owner","Owner","text-left w-32"),Wn("modified","Modified","text-left w-28"),Wn("size","Size","text-right w-20"),
88
+ /* @__PURE__ */ie("th",{className:`${H} w-32`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
89
+ /* @__PURE__ */ie("tbody",{children:tn.map(e=>{const t=W.has(e.id);/* @__PURE__ */
90
+ return re("tr",{"aria-selected":t,onClick:t=>dn(e.id,t),onDoubleClick:()=>kn(e),onContextMenu:t=>wn(t,e),...yn(e),...bn(e),className:`group cursor-default select-none border-b border-line-subtle ${un(e)} ${t||Ve===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
91
+ /* @__PURE__ */ie("td",{className:"px-3 h-11",children:In(e)}),d&&/* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint truncate",children:ke(e)}),
92
+ /* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:pe(e.modifiedAt),children:fe(e.modifiedAt)}),
93
+ /* @__PURE__ */ie("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:ue(e)}),
94
+ /* @__PURE__ */ie("td",{className:"px-2 h-11",children:En(e,t)})]},e.id)})})]}),Un=ce&&0===ht.length?/* @__PURE__ */ie(Z,{size:"sm",padding:"p-6",label:"Loading"}):0===ht.length?/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */re("table",{className:"w-full text-sm table-fixed",children:[
95
+ /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[
96
+ /* @__PURE__ */ie("th",{className:`${H} text-left font-medium px-3 h-9`,children:"Name"}),
97
+ /* @__PURE__ */ie("th",{className:`${H} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
98
+ /* @__PURE__ */ie("th",{className:`${H} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
99
+ /* @__PURE__ */ie("th",{className:`${H} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
100
+ /* @__PURE__ */ie("th",{className:`${H} w-28`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
101
+ /* @__PURE__ */ie("tbody",{children:ht.map(e=>/* @__PURE__ */re("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
102
+ /* @__PURE__ */ie("td",{className:"px-3 h-11",children:/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
103
+ /* @__PURE__ */ie(Ee,{entry:e}),
104
+ /* @__PURE__ */ie("span",{className:"truncate",title:e.name,children:e.name})]})}),
105
+ /* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint text-xs truncate",title:e.originalPath,children:e.originalPath||"—"}),
106
+ /* @__PURE__ */ie("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:e.deletedAt?pe(e.deletedAt):void 0,children:e.deletedAt?fe(e.deletedAt):"—"}),
107
+ /* @__PURE__ */ie("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":o(e.size)}),
108
+ /* @__PURE__ */ie("td",{className:"px-2 h-11",children:/* @__PURE__ */re("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
109
+ /* @__PURE__ */ie(B,{"aria-label":"Restore",size:"sm",onClick:()=>zt(e),children:/* @__PURE__ */ie(Q,{name:"revert",className:"h-4 w-4"})}),
110
+ /* @__PURE__ */ie(B,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>Ot(e),children:/* @__PURE__ */ie(Q,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),Kn=0===yt.length?/* @__PURE__ */ie("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */re("table",{className:"w-full text-sm table-fixed",children:[
111
+ /* @__PURE__ */ie("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */re("tr",{children:[
112
+ /* @__PURE__ */ie("th",{className:`${H} text-left font-medium px-3 h-9`,children:"Name"}),
113
+ /* @__PURE__ */ie("th",{className:`${H} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
114
+ /* @__PURE__ */ie("th",{className:`${H} w-32`,children:/* @__PURE__ */ie("span",{className:"sr-only",children:"Actions"})})]})}),
115
+ /* @__PURE__ */ie("tbody",{children:yt.map(e=>/* @__PURE__ */re("tr",{onDoubleClick:()=>$t(e),onContextMenu:t=>Dt.open(t,e),className:"group cursor-default border-b border-line-subtle hover:bg-row-hover",children:[
116
+ /* @__PURE__ */ie("td",{className:"px-3 h-11",children:/* @__PURE__ */re("span",{className:"flex items-center gap-3 min-w-0",children:[
117
+ /* @__PURE__ */ie(P,{item:e}),
118
+ /* @__PURE__ */ie("span",{className:"truncate",title:e.label,children:e.label})]})}),
119
+ /* @__PURE__ */ie("td",{className:"px-3 h-11 text-xs text-ink-faint",children:F(e)}),
120
+ /* @__PURE__ */ie("td",{className:"px-2 h-11",children:/* @__PURE__ */re("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
121
+ /* @__PURE__ */ie(B,{"aria-label":"Open",size:"sm",onClick:()=>$t(e),children:/* @__PURE__ */ie(Q,{name:"external",className:"h-4 w-4"})}),
122
+ /* @__PURE__ */ie(B,{"aria-label":"Move to desktop",size:"sm",onClick:()=>kt?.moveToDesktop([e]),children:/* @__PURE__ */ie(Q,{name:"desktop",className:"h-4 w-4"})}),
123
+ /* @__PURE__ */ie(B,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>kt?.removeShortcuts([e]),children:/* @__PURE__ */ie(Q,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
124
+ return re("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Gt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),bt.current++,Ke||Ye(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{bt.current>0&&bt.current--,0===bt.current&&Ye(!1)},onDrop:e=>{e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),_t(),Gt&&e.dataTransfer.files?.length&&Qt(e.dataTransfer.files))},children:[
125
+ /* @__PURE__ */ie(O,{title:jn}),
126
+ /* @__PURE__ */ie(N,{app:"files"}),
127
+ /* @__PURE__ */ie("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Qt(e.target.files),vt.current&&(vt.current.value="")}}),
128
+ /* @__PURE__ */ie("input",{ref:e=>{xt.current=e,e?.setAttribute("webkitdirectory","")},type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Qt(e.target.files,{withFolders:!0}),xt.current&&(xt.current.value="")}}),
129
+ /* @__PURE__ */ie("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */ie(t,{sidebar:Tn,storageKey:"files.sidebarWidth",defaultWidth:220,minWidth:170,maxWidth:320,children:/* @__PURE__ */re("div",{className:"flex h-full min-w-0",children:[
130
+ /* @__PURE__ */re("div",{className:"flex flex-1 min-w-0 flex-col",children:[Tt&&/* @__PURE__ */re("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-line bg-accent-tint text-accent-text text-sm shrink-0",role:"status",children:[
131
+ /* @__PURE__ */ie(Q,{name:"cursor",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),
132
+ /* @__PURE__ */ie("span",{className:"flex-1 min-w-0 truncate",children:Tt.request.title}),
133
+ /* @__PURE__ */ie(G,{variant:"secondary",size:"sm",onClick:()=>v(Tt.id,null),children:"Cancel"}),
134
+ /* @__PURE__ */ie(G,{variant:"primary",size:"sm",disabled:!pn,onClick:()=>{pn&&fn(pn)},children:"Open"})]}),
135
+ /* @__PURE__ */re("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
136
+ /* @__PURE__ */ie("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */ie(l,{type:"text",enterKeyHint:"search",value:et,onChange:e=>{tt(e.target.value),e.target.value.trim()||Et()},onKeyDown:e=>{"Escape"===e.key&&et&&(e.stopPropagation(),Et())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */ie(Q,{name:"search",className:"h-4 w-4"}),endAction:et?{label:"Clear search",icon:/* @__PURE__ */ie(Q,{name:"close",className:"h-4 w-4"}),onClick:Et}:void 0})}),
137
+ /* @__PURE__ */ie("div",{className:"flex-1"}),"object"!=typeof ot&&"trash"!==ot&&/* @__PURE__ */re(se,{children:[
138
+ /* @__PURE__ */ie(B,{"aria-label":"List view","aria-pressed":"list"===He,onClick:()=>ft("list"),children:/* @__PURE__ */ie(Q,{name:"list",className:"h-4 w-4"})}),
139
+ /* @__PURE__ */ie(B,{"aria-label":"Grid view","aria-pressed":"grid"===He,onClick:()=>ft("grid"),children:/* @__PURE__ */ie(Q,{name:"grid",className:"h-4 w-4"})})]}),
140
+ /* @__PURE__ */ie(B,{"aria-label":"Details","aria-pressed":qe,onClick:()=>_e(e=>!e),children:/* @__PURE__ */ie(Q,{name:"info",className:"h-4 w-4"})})]}),Fn,
141
+ /* @__PURE__ */ie("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Tt?"Enter"===e.key&&pn&&(e.preventDefault(),fn(pn)):("Delete"===e.key||"Backspace"===e.key)&&an.length&&an.every(ln)?(e.preventDefault(),Ht(an)):"Enter"===e.key&&rn?(e.preventDefault(),kn(rn)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&tn.length&&(e.preventDefault(),Y(new Set(tn.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&mn()},children:"object"==typeof ot?Kn:"trash"===ot?Un:On})]}),qe&&Rn&&/* @__PURE__ */ie(je,{store:n,entry:rn,selectedCount:an.length,onClose:()=>_e(!1)})]})})}),jt.state&&/* @__PURE__ */ie(s,{...jt.props,items:gn(jt.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */ie(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */ie(Q,{name:"revert",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */ie(Q,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Ot(St.state.data)}]}),Dt.state&&/* @__PURE__ */ie(s,{...Dt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */ie(Q,{name:"external",className:"h-4 w-4"}),onSelect:()=>$t(Dt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */ie(Q,{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__ */ie(Q,{name:"close",className:"h-4 w-4"}),onSelect:()=>kt?.removeShortcuts([Dt.state.data])}]}),d&&/* @__PURE__ */ie(Ne,{store:n,entry:Be,onClose:()=>Ge(null),onChanged:Ft}),n.move&&/* @__PURE__ */ie(Ce,{store:n,items:Qe,from:"files"===ot?m:void 0,onClose:()=>Ze(null),onMove:e=>Qe&&qt(Qe,e)}),Ke&&/* @__PURE__ */ie("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__ */ie("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{We as default,Le as quotaExceededMessage};
@@ -0,0 +1,24 @@
1
+ import{getNumberingConfigs as e}from"./chunk-UQV4TSWB.js";import{SidebarLayout as t}from"./chunk-MCLVTQSF.js";import"./chunk-QWK6DRSN.js";import"./chunk-JLSXDYS4.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-77N3REYY.js";import{useWindowManager as o,client_default as i}from"./chunk-VGUB7LPF.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-FBZUEZK7.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-4VFEPP2W.js";import"./chunk-44ERJYNW.js";import"./chunk-EIFNESXS.js";import"./chunk-LC2UF3AA.js";import"./chunk-VY6OQRZA.js";import"./chunk-LG6NDTHZ.js";import"./chunk-4BYJABCX.js";import"./chunk-VWGWZY7A.js";import"./chunk-UVHXVSB2.js";import"./chunk-UVPDEGIA.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-DPFEQQQU.js";import"./chunk-AW7TOB6N.js";import"./chunk-O5ZBRG2G.js";import"./chunk-EX3DARI3.js";import"./chunk-VQBKRBBR.js";import"./chunk-DWGYC7OD.js";import"./chunk-NWS5G7FE.js";import"./chunk-THAPVKEJ.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-YDJ5IZOU.js";import"./chunk-UTISUEO4.js";import"./chunk-BUFAJJDZ.js";import{Icon as s}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-TD3ZQD5R.js";import"./chunk-F2RAIGCG.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-VY3UA6AR.js";import"./chunk-WCCS4VFE.js";import"./chunk-ZDXRSY2Y.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import{toast_default as l}from"./chunk-I2NVBDKH.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as k}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=y[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[v]);const w=j.notepad_notes||[],[_,S]=d(null),[D,C]=d(""),[R,W]=d(""),[U,V]=d("yellow"),[B,F]=d(!1),[X,J]=d(!1),Z=a(null),E=a();p(()=>{if(!_&&w.length>0){const e=w[0];S(e.id),C(e.title),W(e.content),V(e.color)}},[w.length]);const I=m(e=>{N({notepad_notes:e})},[N]),Q=m(()=>{if(!_||!B)return;const e=w.map(e=>e.id===_?{...e,title:D,content:R,color:U,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);I(e),F(!1)},[_,B,D,R,U,w,I]);p(()=>{if(B)return E.current&&clearTimeout(E.current),E.current=setTimeout(Q,800),()=>{E.current&&clearTimeout(E.current)}},[B,Q]),p(()=>()=>{B&&Q()},[]);const Y=e=>{B&&Q(),S(e.id),C(e.title),W(e.content),V(e.color),F(!1),J(!1)},$=e=>{const t=R.slice(0,e),r=R.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=R.slice(e+r[0].length);W(t+n+o),F(!0)},A=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},O="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.)",P=/* @__PURE__ */h(g,{children:[
2
+ /* @__PURE__ */k("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{B&&Q();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];I(t),S(e.id),C(""),W(""),V("yellow"),F(!1),J(!0),setTimeout(()=>Z.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
+ /* @__PURE__ */k(s,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
+ /* @__PURE__ */k("div",{className:"flex-1 overflow-y-auto",children:0===w.length?/* @__PURE__ */k("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):w.map(e=>{const t=(n=e.color,x.find(e=>e.key===n)||x[0]);var n;/* @__PURE__ */
5
+ return h("button",{onClick:()=>Y(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
+ /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */k("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
+ /* @__PURE__ */k("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
9
+ /* @__PURE__ */k("p",{className:"text-xs text-ink-faintest mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
+ /* @__PURE__ */k("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
+ return h("div",{className:"h-full",children:[
12
+ /* @__PURE__ */k(n,{app:"notepad"}),
13
+ /* @__PURE__ */k(t,{sidebar:P,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__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__ */k("input",{value:D,onChange:e=>{C(e.target.value),F(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
+ /* @__PURE__ */k("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */k("button",{onClick:()=>{V(e.key),F(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${U===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
+ /* @__PURE__ */k("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(I(t),_===e){const e=t[0];e?Y(e):(S(null),C(""),W(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */k(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),X?/* @__PURE__ */k("textarea",{ref:Z,value:R,onChange:e=>{W(e.target.value),F(!0)},onBlur:()=>{J(!1),B&&Q()},placeholder:O,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__ */k("div",{onClick:()=>{J(!0),setTimeout(()=>Z.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:R?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(T.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */k("button",{onClick:()=>A(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */k("button",{onClick:()=>$(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__ */k(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */k("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__ */k("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */k("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
+ return k("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(R):/* @__PURE__ */k("p",{className:"text-gray-300 whitespace-pre-line",children:O})}),
19
+ /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
+ /* @__PURE__ */k("span",{children:"[] checkbox"}),
21
+ /* @__PURE__ */k("span",{children:"SO#35001 entity link"}),
22
+ /* @__PURE__ */k("span",{className:"ml-auto",children:X?"Editing":"Click to edit"})]})]}):/* @__PURE__ */k("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
+ /* @__PURE__ */k(s,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
24
+ /* @__PURE__ */k("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};