efficient-shell 7.36.0 → 7.40.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 (79) hide show
  1. package/README.md +60 -2
  2. package/dist/{Browser-GL5LSI47.js → Browser-WFF3V5XN.js} +14 -14
  3. package/dist/Calculator-L6726KWL.js +29 -0
  4. package/dist/ConfirmDialog-V7JRHNK7.js +1 -0
  5. package/dist/{CurrencyConverter-HOHIYM4N.js → CurrencyConverter-5LXIRNZG.js} +12 -12
  6. package/dist/{Documents-U6ZBCYXP.js → Documents-73VBBEBF.js} +24 -24
  7. package/dist/{Files-YSWLVOAC.js → Files-FFNF3QZ7.js} +40 -40
  8. package/dist/{Notepad-5CO7KAHW.js → Notepad-XIG4KJA5.js} +10 -10
  9. package/dist/PdfViewer-BS5UDROT.js +1 -0
  10. package/dist/{PomodoroTimer-JQNFGA3S.js → PomodoroTimer-LHHDM6ML.js} +40 -40
  11. package/dist/{Preview-WUJSCN5P.js → Preview-C2ZC2SM3.js} +32 -32
  12. package/dist/{Sidebar-ON4DBXVI.js → Sidebar-XMH2FKCU.js} +27 -27
  13. package/dist/{Spreadsheet-32KRT3LH.js → Spreadsheet-FZV4FL6H.js} +10 -10
  14. package/dist/{Stock-EUD5OG3O.js → Stock-PWDOGWFR.js} +7 -7
  15. package/dist/{Weather-GA2K5LGB.js → Weather-WRNKDPM2.js} +16 -16
  16. package/dist/{WorldClock-THKDQYUL.js → WorldClock-L43LQEXI.js} +6 -6
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/{chunk-6IMYNQCU.js → chunk-3K5JZXDC.js} +14 -14
  21. package/dist/{chunk-6OXNDFJE.js → chunk-4755JEGD.js} +1 -1
  22. package/dist/{chunk-JLAK6FVZ.js → chunk-4TOFAEAW.js} +28 -28
  23. package/dist/{chunk-I2BPCXPL.js → chunk-7D6TZW44.js} +6 -6
  24. package/dist/{chunk-P6WZ24CB.js → chunk-CXF2BVXH.js} +1 -1
  25. package/dist/{chunk-2CTK44IB.js → chunk-E3JFDVQ5.js} +8 -8
  26. package/dist/{chunk-LF7FHR6U.js → chunk-E4FJNJ2I.js} +101 -101
  27. package/dist/chunk-ENMILDMH.js +1 -0
  28. package/dist/{chunk-K6VLDHTD.js → chunk-F5BQTXGY.js} +1 -1
  29. package/dist/{chunk-YXNO6PLF.js → chunk-F7OP5E6L.js} +1 -1
  30. package/dist/{chunk-YIEGC2CL.js → chunk-FBXOKW33.js} +2 -2
  31. package/dist/{chunk-YVECLMNT.js → chunk-FY3H52BM.js} +1 -1
  32. package/dist/chunk-IL4TXZ2Z.js +1041 -0
  33. package/dist/chunk-IZWMK4LP.js +1 -0
  34. package/dist/{chunk-MWAPICLX.js → chunk-KEZYLOFK.js} +1 -1
  35. package/dist/{chunk-PMUU2VHD.js → chunk-KNGFJOQD.js} +1 -1
  36. package/dist/chunk-LVCRH3K6.js +1 -0
  37. package/dist/{chunk-WCGEABUZ.js → chunk-OTFHGJSO.js} +6 -6
  38. package/dist/{chunk-XUHJRDNO.js → chunk-PBZ2VHS3.js} +1 -1
  39. package/dist/{chunk-K3LAW5NH.js → chunk-TRNQNGYE.js} +18 -18
  40. package/dist/{chunk-GKI4SVYL.js → chunk-UAG5IEAY.js} +1 -1
  41. package/dist/{chunk-OKHHHI4N.js → chunk-UONWRDS7.js} +1 -1
  42. package/dist/{chunk-XEHXBWEP.js → chunk-UQVSH226.js} +1 -1
  43. package/dist/{chunk-UBRW43AM.js → chunk-VHHZHNJC.js} +8 -8
  44. package/dist/{chunk-PYNMOS2E.js → chunk-WSRZRWN7.js} +1 -1
  45. package/dist/{chunk-I5JYRYAY.js → chunk-XKANXONN.js} +2 -2
  46. package/dist/{chunk-B527AYLS.js → chunk-Y6V2JPN3.js} +1 -1
  47. package/dist/{chunk-CMUDEROF.js → chunk-ZELMENOO.js} +8 -8
  48. package/dist/file-intake/index.js +1 -1
  49. package/dist/i18n/index.d.ts +1 -1
  50. package/dist/icons/efficient-looks.js +38 -14
  51. package/dist/icons/efficient.d.ts +28 -4
  52. package/dist/icons/efficient.js +333 -311
  53. package/dist/icons/iconoir.js +7 -1
  54. package/dist/icons/index.d.ts +1 -1
  55. package/dist/icons/index.js +1 -1
  56. package/dist/icons/lucide.js +24 -9
  57. package/dist/icons/phosphor.js +14 -10
  58. package/dist/icons/tabler.js +54 -19
  59. package/dist/{index-9qfNoZ-O.d.ts → index-CFyMUpku.d.ts} +236 -128
  60. package/dist/index.d.ts +3 -3
  61. package/dist/index.js +194 -194
  62. package/dist/locales/zh-Hans.d.ts +1 -1
  63. package/dist/locales/zh-Hans.js +1 -1
  64. package/dist/map/index.js +2 -2
  65. package/dist/markdown/index.js +1 -1
  66. package/dist/page-tabs/index.js +5 -5
  67. package/dist/pdf/index.js +1 -1
  68. package/dist/{strings-Cn5SsfWm.d.ts → strings-BOGLdj8k.d.ts} +4 -0
  69. package/dist/telemetry/index.js +1 -1
  70. package/dist/ui/index.d.ts +2 -2
  71. package/dist/ui/index.js +1 -1
  72. package/package.json +1 -1
  73. package/dist/Calculator-HQNPFH7T.js +0 -29
  74. package/dist/ConfirmDialog-DHHLXNMV.js +0 -1
  75. package/dist/PdfViewer-KA4YIRIO.js +0 -1
  76. package/dist/chunk-7ZKLBRHL.js +0 -1
  77. package/dist/chunk-DJ3Z66LK.js +0 -1
  78. package/dist/chunk-KLGZ3O7B.js +0 -1035
  79. package/dist/chunk-PUCDNUFR.js +0 -1
package/README.md CHANGED
@@ -423,6 +423,7 @@ is dragged. The side it ended up on is on the surface as `data-side`.
423
423
  | Radio | `{ key, type: 'radio', label, checked, onSelect, icon?, disabled? }` | `<button role="menuitemradio" aria-checked>`, with a check on the checked one. Consecutive radios form one `role="group"`, named by a label directly above them. |
424
424
  | Check box | `{ key, type: 'checkbox', label, checked, onSelect, icon?, disabled? }` | `<button role="menuitemcheckbox" aria-checked>`, a box ticked when on. Choosing it calls `onSelect` (the toggle — you flip `checked`) and the menu STAYS OPEN, focus where it was, so several are ticked in one visit; Escape, Tab or a click elsewhere puts it away. Consecutive check boxes form one `role="group"`, named by a label directly above them. Disable the rest when a limit is reached ("up to eight"). |
425
425
  | Label | `{ key, type: 'label', label }` | A heading (`PopupMenuLabel`). Not focusable. |
426
+ | Status | `{ key, type: 'status', label }` | A sentence about the state of things, such as "Saved 2 seconds ago · Changes not live yet" at the top of a save menu. Drawn as written (not in capitals, unlike a label), small and in the label's muted ink, and it wraps. Not focusable. The menu's `aria-describedby` names every status row, so a screen reader reads them when the menu opens. |
426
427
  | Divider | `{ key, type: 'divider' }` | `role="separator"` (`PopupMenuDivider`). |
427
428
 
428
429
  **Props beyond `trigger`, `items`, `align` and `side`.** `linkAs` draws each
@@ -440,13 +441,57 @@ it), and its hint or error describes it.
440
441
  **Keyboard** (the WAI-ARIA menu button). Enter, Space or ArrowDown on the
441
442
  trigger opens the menu on its first entry, and ArrowUp opens it on its last.
442
443
  Inside the menu, the arrows move between the entries that can be chosen,
443
- skipping labels, dividers and disabled entries, and wrap at the ends. Home and
444
+ skipping labels, status rows, dividers and disabled entries, and wrap at the ends. Home and
444
445
  End jump to the first and the last. A letter moves to the next entry starting
445
446
  with it, and letters typed together search for the whole run. Enter or Space
446
447
  chooses; on a link Enter follows it, and so does Space. Escape closes the menu
447
448
  and gives focus back to the trigger, and so does Tab. A click elsewhere closes
448
449
  it and leaves focus where you clicked.
449
450
 
451
+ ### Split buttons
452
+
453
+ `SplitButton` is a main action and its own menu, drawn as one control: the
454
+ website editor's **Publish ▾**, the email designer's **Save and close ▾**.
455
+
456
+ ```tsx
457
+ import { SplitButton } from 'efficient-shell/ui';
458
+
459
+ <SplitButton
460
+ onClick={publish}
461
+ menuLabel="Save options"
462
+ disabled={!hasChanges}
463
+ disabledReason="Everything is live"
464
+ items={[
465
+ { key: 'auto', type: 'checkbox', label: 'Auto-save', checked: autosave, onSelect: toggleAutosave },
466
+ { key: 'now', label: 'Save now', onSelect: saveNow },
467
+ ]}
468
+ >
469
+ Publish
470
+ </SplitButton>
471
+ ```
472
+
473
+ - **Two buttons, one shape.** The main half is a `Button`; the chevron half is
474
+ the square `IconButton` of the same size and opens a `DropdownMenu` of
475
+ `items`. Each half has its own tab stop and focus ring. Together they have
476
+ one height, one outer border, square inner corners and a 1px seam. This is
477
+ the exception harness UI-23 allows ("a control that is one control"), so use
478
+ it instead of two buttons with no gap between them.
479
+ - **Looks:** `variant` is `primary` (the default) or `secondary`; `size` takes
480
+ `Button`'s sizes. The look is `Button`'s own, so it follows the accent, dark
481
+ mode and the theme's corners.
482
+ - **The chevron's name is required** (`menuLabel`). It is the chevron's
483
+ `aria-label` and shows in the shell `Tooltip` on hover and on keyboard focus,
484
+ never as a `title`.
485
+ - **The main half can be off on its own.** `disabled` with a `disabledReason`
486
+ uses `Button`'s compact form: `aria-disabled`, still focusable, its press does
487
+ nothing, and the reason is its description and its Tooltip. The chevron stays
488
+ usable. `menuDisabled` turns off the chevron alone. `loading` shows the
489
+ spinner on the main half; the menu still opens.
490
+ - `tooltip` gives the main half a Tooltip while it is on. `align`, `side`,
491
+ `menuMinWidth` and `linkAs` are passed to the `DropdownMenu`; a footer bar
492
+ wants `side="top"`. `block` stretches the control: the main half grows and
493
+ the chevron keeps its square.
494
+
450
495
  ### The text toolbar
451
496
 
452
497
  `TextToolbar` is the one text toolbar of every rich text box: over a text box
@@ -1150,6 +1195,18 @@ equal strings and the equal panel figures.
1150
1195
  each face in itself. The `label` still names, filters and fills the field.
1151
1196
  `Select` takes the same, and `renderValue(chosen)` draws its closed field.
1152
1197
 
1198
+ **Actions under a list, and a changed mark.** `Select`'s `footer` takes action
1199
+ rows, each `{ label, icon?, onSelect, disabled? }`, drawn under the options in
1200
+ the open list: a text style field ending in "Clear changes", "Edit styles" and
1201
+ "Update style". They are buttons below the listbox, not options in it. With
1202
+ the list open, Tab goes from the field to the first action, the arrow keys
1203
+ walk them, Shift+Tab or ArrowUp from the first goes back to the field, and
1204
+ Escape or Tab past the last closes the list. Pressing one closes the list,
1205
+ puts focus back on the field, then calls `onSelect`. `changed` draws a "*"
1206
+ after the closed field's value and describes the field as "Changed" to a
1207
+ screen reader (`strings.select.changed`). Either one keeps the listbox on
1208
+ touch, at the `touchSize` rung, because a native picker cannot draw them.
1209
+
1153
1210
  **A server search that is running, or has failed.** A `SearchableSelect` fed
1154
1211
  by `onSearchChange` can say both. `loading` puts "Searching..." on a line
1155
1212
  above the options, in place of "No matches". `error` puts the caller's words
@@ -1312,6 +1369,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
1312
1369
  | `PopupMenu`, `PopupMenuItem`, `PopupMenuDivider`, `PopupMenuLabel`, `PopupSubmenu` | Right-click / context-menu primitive; `PopupSubmenu` is a row that opens a nested menu. |
1313
1370
  | `ShellContextMenu` | The shell-wide right-click menu, already mounted by `Layout` (`<Layout contextMenu={false}>` turns it off). Mount it yourself only on a screen rendered outside the layout. See [Right-click menu](#right-click-menu). |
1314
1371
  | `DropdownMenu` | A button and the menu it opens, right under it: actions, links (`href`, drawn by `linkAs`), radios, labels and dividers, with shared dismissal and the menu-button keyboard. `align` lines it up with the trigger's left or right edge; `side="top"` suits a trigger in a bottom action bar. See [Dropdown menus](#dropdown-menus). |
1372
+ | `SplitButton` | A main action and its own menu as one control ("Publish ▾"): a `Button` half and a chevron half that opens a `DropdownMenu` of `items`. Two tab stops, one shape. The chevron's name `menuLabel` is required and shows in a `Tooltip`. The main half can be off with a `disabledReason` while the chevron still opens the menu. See [Split buttons](#split-buttons). |
1315
1373
  | `Popover` | A button and the panel it opens, right under it, placed by `DropdownMenu`'s rule (left edges together, or right with `align="end"`, flipping and shifting to stay on screen and in its window, never wider than a phone allows): a non-modal `role="dialog"` named by `title` or `aria-label`, for check boxes, a date, a short form. A kit popup opened inside it (a `DatePicker`'s calendar, a `Select`'s list) does not close it. Focus moves in as it opens; Tab reads it as if it sat right after its trigger; Escape closes it and gives focus back. See [Popovers](#popovers). |
1316
1374
  | `Dialog`, `Drawer` | A modal sheet that is not a shell window — centred (`Dialog`) or pinned to an edge (`Drawer`, `side` right / left / bottom) — for a till, a routed page or a form: trapped focus, a locked page, Escape and a backdrop click to close (`blocking` turns both off), a close cross when there is no `footer`. A `Dialog` is never taller than the screen less its gutter: a longer form — on a phone, most of them — scrolls inside the panel, footer included, and a footer wider than the panel wraps. `title` names it; `description` is a line under the title that DESCRIBES it to a screen reader — without one the body does, which suits a confirm whose body is the question and not a form, whose every label would be read out. `role="alertdialog"` (Dialog) for a confirmation that interrupts. A heading or note that lives in the body — a form that loads the record its heading names — names and describes it through `aria-labelledby` / `aria-describedby`. Two open at once — the second inside the first, or beside it on `<body>` where a host portals its dialogs — each hold focus, and only the one in front moves Tab (`useFocusTrap` keeps a stack). |
1317
1375
  | `ConfirmProvider`, `confirm` | Imperative `confirm({ title, body })` returning a Promise<boolean>. |
@@ -4082,7 +4140,7 @@ itself where the kit has an answer:
4082
4140
  | `kit-dep` | one of those packages declared in `package.json` (not `devDependencies`, and not one the shell needs from an entry the repository imports: `@headlessui/react` and `@heroicons/react` for the root entry, an icon set's own package) | remove it |
4083
4141
  | `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) |
4084
4142
  | `chart-dep` | one of those chart libraries declared in `package.json`, whether or not anything imports it (not `devDependencies`) | remove it |
4085
- | `ellipsis-label` | a button, link or menu label that ends in `…` or `...`: the text of `button`, `a`, `option`, `Button`, `IconButton`, `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) |
4143
+ | `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) |
4086
4144
 
4087
4145
  Known gaps: `rgb()` / `hsl()` colours, colours in `.ts` maps, and
4088
4146
  `createElement('button')` are not counted.
@@ -1,29 +1,29 @@
1
- import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-OKHHHI4N.js";import"./chunk-PUCDNUFR.js";import{WindowTitle as r}from"./chunk-LF7FHR6U.js";import"./chunk-WCGEABUZ.js";import"./chunk-KNUR2UEG.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-K6VLDHTD.js";import{confirm as a}from"./chunk-K3LAW5NH.js";import"./chunk-UBRW43AM.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import{Icon as n}from"./chunk-6OXNDFJE.js";import"./chunk-DJ3Z66LK.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=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&&b.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["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 g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[j,C]=i(k),[z,R]=i([k]),[W,E]=i(0),[H,L]=i(0),[S,D]=i(x),[U,O]=i(!1),[F,K]=i(null),I=s(null),T=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(S))}catch{}},[S]);const A=e=>{const t=f(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,W+1);return o.push(t),o}),E(e=>e+1),O(!1))},B=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},G=()=>{const e=F?.trim();e?(D(t=>[...t,{label:e,url:k}]),K(null)):K(null)};l(()=>{if(null===F)return;I.current?.focus(),I.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||K(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==F]);const M=e=>{D(t=>t.filter((t,o)=>o!==e))},J=W>0,P=W<z.length-1,q=S.some(e=>e.url===k),X="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
1
+ import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-UONWRDS7.js";import"./chunk-IZWMK4LP.js";import{WindowTitle as r}from"./chunk-E4FJNJ2I.js";import"./chunk-F5BQTXGY.js";import"./chunk-OTFHGJSO.js";import"./chunk-KNUR2UEG.js";import{confirm as a}from"./chunk-TRNQNGYE.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-VHHZHNJC.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import{Icon as n}from"./chunk-4755JEGD.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=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&&b.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["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 g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[j,C]=i(k),[z,R]=i([k]),[E,S]=i(0),[W,H]=i(0),[L,D]=i(x),[O,G]=i(!1),[T,I]=i(null),J=s(null),U=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(L))}catch{}},[L]);const F=e=>{const t=f(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,E+1);return o.push(t),o}),S(e=>e+1),G(!1))},K=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},M=()=>{const e=T?.trim();e?(D(t=>[...t,{label:e,url:k}]),I(null)):I(null)};l(()=>{if(null===T)return;J.current?.focus(),J.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||I(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==T]);const B=e=>{D(t=>t.filter((t,o)=>o!==e))},P=E>0,Q=E<z.length-1,q=L.some(e=>e.url===k),X="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
2
  return c("div",{className:"relative flex flex-col h-full bg-white",children:[
3
3
  /* @__PURE__ */m(r,{title:`Browser - ${v(k)}`}),
4
4
  /* @__PURE__ */m(o,{app:"browser"}),
5
5
  /* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
6
- /* @__PURE__ */m("button",{onClick:()=>{if(W>0){const e=W-1;E(e),y(z[e]),C(z[e]),O(!1)}},disabled:!J,className:X,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
- /* @__PURE__ */m("button",{onClick:()=>{if(W<z.length-1){const e=W+1;E(e),y(z[e]),C(z[e]),O(!1)}},disabled:!P,className:X,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
- /* @__PURE__ */m("button",{onClick:()=>L(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
- /* @__PURE__ */m("button",{onClick:()=>A(g),className:X,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
- /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),A(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("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:[
6
+ /* @__PURE__ */m("button",{onClick:()=>{if(E>0){const e=E-1;S(e),y(z[e]),C(z[e]),G(!1)}},disabled:!P,className:X,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */m("button",{onClick:()=>{if(E<z.length-1){const e=E+1;S(e),y(z[e]),C(z[e]),G(!1)}},disabled:!Q,className:X,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */m("button",{onClick:()=>H(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */m("button",{onClick:()=>F(g),className:X,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
+ /* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),F(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
11
11
  /* @__PURE__ */m("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
12
12
  /* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(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…"}),k!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(k),className:"px-2 text-2xs text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
13
- /* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>q?M(S.findIndex(e=>e.url===k)):void K(v(k)),className:X+" "+(q?"text-yellow-500":""),title:q?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:q?"currentColor":"none",strokeWidth:1.5})}),
14
- /* @__PURE__ */m("button",{onClick:B,className:X,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
- /* @__PURE__ */m("button",{onClick:()=>O(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==F&&/* @__PURE__ */c("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:[
13
+ /* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>q?B(L.findIndex(e=>e.url===k)):void I(v(k)),className:X+" "+(q?"text-yellow-500":""),title:q?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:q?"currentColor":"none",strokeWidth:1.5})}),
14
+ /* @__PURE__ */m("button",{onClick:K,className:X,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
15
+ /* @__PURE__ */m("button",{onClick:()=>G(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==T&&/* @__PURE__ */c("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:[
16
16
  /* @__PURE__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
17
17
  /* @__PURE__ */m("div",{className:"text-2xs text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
18
- /* @__PURE__ */m("input",{ref:I,type:"text",value:F,onChange:e=>K(e.target.value),onKeyDown:e=>{"Enter"===e.key?G():"Escape"===e.key&&K(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
18
+ /* @__PURE__ */m("input",{ref:J,type:"text",value:T,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key?M():"Escape"===e.key&&I(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
19
  /* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
20
- /* @__PURE__ */m("button",{onClick:()=>K(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
- /* @__PURE__ */m("button",{onClick:G,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"})]})]}),
22
- /* @__PURE__ */c("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===S.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),S.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>A(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&M(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
20
+ /* @__PURE__ */m("button",{onClick:()=>I(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
21
+ /* @__PURE__ */m("button",{onClick:M,disabled:!T.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
22
+ /* @__PURE__ */c("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===L.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),L.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>F(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&B(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
23
23
  /* @__PURE__ */m("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)),
24
24
  /* @__PURE__ */m("div",{className:"flex-1"}),
25
25
  /* @__PURE__ */m("button",{onClick:()=>{b(k);try{localStorage.setItem(h,k)}catch{}},className:"px-2 py-0.5 text-2xs text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
26
- /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:H,iframeRef:T,openExternal:B,showHelp:U,dismissHelp:()=>O(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
26
+ /* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:W,iframeRef:U,openExternal:K,showHelp:O,dismissHelp:()=>G(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
27
27
  /* @__PURE__ */m(n,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
28
28
  /* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
29
29
  /* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
@@ -0,0 +1,29 @@
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-UQVSH226.js";import{useWidgetSettings as n}from"./chunk-E4FJNJ2I.js";import"./chunk-F5BQTXGY.js";import"./chunk-OTFHGJSO.js";import"./chunk-KNUR2UEG.js";import"./chunk-TRNQNGYE.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-VHHZHNJC.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import{Icon as r}from"./chunk-4755JEGD.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useState as l,useRef as c,useCallback as i,useEffect as a}from"react";import{jsxs as o,Fragment as s,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function d(){const[d,m]=l("0"),[k,b]=l(null),[p,g]=l(null),[N,y]=l(!1),[x,f]=l(""),[v,C]=l([]),[$,j]=l(!1),[E,w]=l(()=>e(h)),[S,T]=l(!1),[F,H]=l(E),J=c(null);n(i(()=>{H({...E}),T(!0)},[E]));const G=i(e=>{f(""),m(t=>N||"0"===t?(y(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),B=i(()=>{m("0"),b(null),g(null),y(!1)},[]),O=i((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),Q=i(e=>{const t=parseFloat(d);if(null!==k&&p&&!N){const e=O(k,t,p);m(String(e)),b(e),C(n=>[`${k} ${p} ${t} = ${e}`,...n].slice(0,20))}else b(t);g(e),y(!0)},[d,k,p,N,O]),R=i(()=>{if(null===k||!p)return;const e=parseFloat(d),t=O(k,e,p),n=`${k} ${p} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),f(n),m(String(t)),b(null),g(null),y(!0)},[d,k,p,O]),W=i(()=>{m(e=>String(parseFloat(e)/100))},[]),A=i(()=>{m(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);a(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?G(e.key):"."===e.key?G("."):"+"===e.key?Q("+"):"-"===e.key?Q("-"):"*"===e.key?Q("×"):"/"===e.key?(e.preventDefault(),Q("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&J.current?.contains(e.target)&&e.preventDefault(),R()):"Escape"===e.key?B():"Backspace"===e.key?m(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&W())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[G,Q,R,B,W]);const D="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",I=`${D} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,L=`${D} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,U=`${D} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,V=`${D} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
+ return o(s,{children:[
3
+ /* @__PURE__ */o("div",{ref:J,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
4
+ /* @__PURE__ */o("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
+ /* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:v.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(x||p&&null!==k)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:x||`${k} ${p} ${N?"":d}`}),
6
+ /* @__PURE__ */o("div",{className:"flex items-center gap-2",children:[
7
+ /* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(d),j(!0),setTimeout(()=>j(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,$?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
8
+ /* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(d)})]})]}),
9
+ /* @__PURE__ */o("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
10
+ /* @__PURE__ */u("button",{onClick:B,className:U,children:"AC"}),
11
+ /* @__PURE__ */u("button",{onClick:A,className:U,children:"+/−"}),
12
+ /* @__PURE__ */u("button",{onClick:W,className:U,children:"%"}),
13
+ /* @__PURE__ */u("button",{onClick:()=>Q("÷"),className:`${L} ${"÷"===p?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */u("button",{onClick:()=>G("7"),className:I,children:"7"}),
15
+ /* @__PURE__ */u("button",{onClick:()=>G("8"),className:I,children:"8"}),
16
+ /* @__PURE__ */u("button",{onClick:()=>G("9"),className:I,children:"9"}),
17
+ /* @__PURE__ */u("button",{onClick:()=>Q("×"),className:`${L} ${"×"===p?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */u("button",{onClick:()=>G("4"),className:I,children:"4"}),
19
+ /* @__PURE__ */u("button",{onClick:()=>G("5"),className:I,children:"5"}),
20
+ /* @__PURE__ */u("button",{onClick:()=>G("6"),className:I,children:"6"}),
21
+ /* @__PURE__ */u("button",{onClick:()=>Q("-"),className:`${L} ${"-"===p?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */u("button",{onClick:()=>G("1"),className:I,children:"1"}),
23
+ /* @__PURE__ */u("button",{onClick:()=>G("2"),className:I,children:"2"}),
24
+ /* @__PURE__ */u("button",{onClick:()=>G("3"),className:I,children:"3"}),
25
+ /* @__PURE__ */u("button",{onClick:()=>Q("+"),className:`${L} ${"+"===p?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>G("0"),className:`${I} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */u("button",{onClick:()=>G("."),className:I,children:"."}),
28
+ /* @__PURE__ */u("button",{onClick:R,className:V,children:"="})]})]}),
29
+ /* @__PURE__ */u(t,{open:S,onClose:()=>T(!1),title:"Calculator Settings",appearance:F,onAppearanceChange:H,onSave:()=>{w(F),localStorage.setItem(h,JSON.stringify(F)),T(!1)}})]})}export{d as default};
@@ -0,0 +1 @@
1
+ export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-TRNQNGYE.js";import"./chunk-UVBK6YSR.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-4755JEGD.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";
@@ -1,21 +1,21 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-XEHXBWEP.js";import{useWidgetSettings as r}from"./chunk-LF7FHR6U.js";import"./chunk-WCGEABUZ.js";import"./chunk-KNUR2UEG.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-K6VLDHTD.js";import"./chunk-K3LAW5NH.js";import"./chunk-UBRW43AM.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-6OXNDFJE.js";import"./chunk-DJ3Z66LK.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as n}from"./chunk-2J6F4EE7.js";import{useState as a,useCallback as s,useEffect as o}from"react";import{jsxs as c,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",d="currency_appearance",h="currency_rates_cache";function g(e){try{const t=JSON.parse(localStorage.getItem(h)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function f(e,t){try{const r=JSON.parse(localStorage.getItem(h)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(h,JSON.stringify(r))}catch{}}function y(){try{const e=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return u}var x={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function N(){const[u,h]=a(y),[N,b]=a(()=>e(d)),[k,S]=a({}),[v,D]=a(!1),[j,C]=a(!1),[U,B]=a([]),[J,A]=a(N),[H,R]=a("USD"),[E,L]=a("CNY");r(s(()=>{B([...u]),A({...N}),C(!0)},[u,N])),o(()=>{const e=[...new Set(u.map(([e])=>e))];let t=!0;return async function(){D(!0);const r={};for(const t of e){const e=g(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,f(t,n.rates))}catch{}}t&&(S(r),D(!1))}(),()=>{t=!1}},[u]);/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-UQVSH226.js";import{useWidgetSettings as r}from"./chunk-E4FJNJ2I.js";import"./chunk-F5BQTXGY.js";import"./chunk-OTFHGJSO.js";import"./chunk-KNUR2UEG.js";import"./chunk-TRNQNGYE.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-VHHZHNJC.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-4755JEGD.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as n}from"./chunk-2J6F4EE7.js";import{useState as a,useCallback as s,useEffect as o}from"react";import{jsxs as c,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",d="currency_appearance",h="currency_rates_cache";function g(e){try{const t=JSON.parse(localStorage.getItem(h)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function f(e,t){try{const r=JSON.parse(localStorage.getItem(h)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(h,JSON.stringify(r))}catch{}}function y(){try{const e=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(e)&&e.length)return e.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 x(){const[u,h]=a(y),[x,b]=a(()=>e(d)),[S,k]=a({}),[v,D]=a(!1),[j,C]=a(!1),[J,H]=a([]),[U,B]=a(x),[R,G]=a("USD"),[O,I]=a("CNY");r(s(()=>{H([...u]),B({...x}),C(!0)},[u,x])),o(()=>{const e=[...new Set(u.map(([e])=>e))];let t=!0;return async function(){D(!0);const r={};for(const t of e){const e=g(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,f(t,n.rates))}catch{}}t&&(k(r),D(!1))}(),()=>{t=!1}},[u]);/* @__PURE__ */
2
2
  return c(i,{children:[
3
- /* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${N.activeOpacity/100})`,backdropFilter:N.activeBlur>0?`blur(${N.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[v&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([e,t],r)=>{const n=k[e]?.[t];/* @__PURE__ */
3
+ /* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${x.activeOpacity/100})`,backdropFilter:x.activeBlur>0?`blur(${x.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[v&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([e,t],r)=>{const n=S[e]?.[t];/* @__PURE__ */
4
4
  return c("button",{onClick:()=>{const e=u.map((e,t)=>t===r?[e[1],e[0]]:e);h(e),localStorage.setItem(p,JSON.stringify(e))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
5
5
  /* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
6
- /* @__PURE__ */l("span",{className:"text-base",children:x[e]||""}),
6
+ /* @__PURE__ */l("span",{className:"text-base",children:N[e]||""}),
7
7
  /* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:e}),
8
8
  /* @__PURE__ */l("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
9
- /* @__PURE__ */l("span",{className:"text-base",children:x[t]||""}),
9
+ /* @__PURE__ */l("span",{className:"text-base",children:N[t]||""}),
10
10
  /* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
11
11
  /* @__PURE__ */l("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
12
- /* @__PURE__ */l(t,{open:j,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:A,onSave:()=>{if(0===U.length)return;const e=U.slice(0,4);h(e),b(J),localStorage.setItem(p,JSON.stringify(e)),localStorage.setItem(d,JSON.stringify(J)),C(!1)},children:/* @__PURE__ */c("div",{children:[
12
+ /* @__PURE__ */l(t,{open:j,onClose:()=>C(!1),title:"Currency Settings",appearance:U,onAppearanceChange:B,onSave:()=>{if(0===J.length)return;const e=J.slice(0,4);h(e),b(U),localStorage.setItem(p,JSON.stringify(e)),localStorage.setItem(d,JSON.stringify(U)),C(!1)},children:/* @__PURE__ */c("div",{children:[
13
13
  /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
14
- /* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",U.length,"/",4,")"]})]}),
15
- /* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:U.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
- /* @__PURE__ */c("span",{className:"text-sm",children:[x[e]||""," ",e," → ",x[t]||""," ",t]}),
17
- /* @__PURE__ */l("button",{onClick:()=>B(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),U.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
18
- /* @__PURE__ */l("select",{value:H,onChange:e=>R(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
14
+ /* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",J.length,"/",4,")"]})]}),
15
+ /* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:J.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
+ /* @__PURE__ */c("span",{className:"text-sm",children:[N[e]||""," ",e," → ",N[t]||""," ",t]}),
17
+ /* @__PURE__ */l("button",{onClick:()=>H(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),J.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
18
+ /* @__PURE__ */l("select",{value:R,onChange:e=>G(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
19
19
  /* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
20
- /* @__PURE__ */l("select",{value:E,onChange:e=>L(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
21
- /* @__PURE__ */l("button",{onClick:()=>{H!==E&&U.length<4&&B(e=>[...e,[H,E]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{N as default};
20
+ /* @__PURE__ */l("select",{value:O,onChange:e=>I(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
21
+ /* @__PURE__ */l("button",{onClick:()=>{R!==O&&J.length<4&&H(e=>[...e,[R,O]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{x as default};
@@ -1,25 +1,25 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-OKHHHI4N.js";import{toast_default as n}from"./chunk-PYNMOS2E.js";import"./chunk-PUCDNUFR.js";import{WindowTitle as r}from"./chunk-LF7FHR6U.js";import"./chunk-WCGEABUZ.js";import"./chunk-KNUR2UEG.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-K6VLDHTD.js";import"./chunk-K3LAW5NH.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-UBRW43AM.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import{Icon as s}from"./chunk-6OXNDFJE.js";import"./chunk-DJ3Z66LK.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as c}from"./chunk-2J6F4EE7.js";import{useState as d,useRef as m}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";var p=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),g=/* @__PURE__ */new Set(["docx"]),x={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function f(){const[f,y]=d(x),[v,b]=d(!1),[k,w]=d(!1),[N,j]=d(!1),[C,D]=d(null),L=m(null),M=m(null),U=m(null),R=(e,t)=>{U.current?.focus(),document.execCommand(e,!1,t),j(!0)},B=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{U.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),j(!0)},e.readAsDataURL(t)}},W=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",j(!0),D(null))},O=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();b(!0);try{if(p.has(r)||!g.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");y({filename:t.name,kind:"text",content:o,ext:r}),j(!1)}else if(g.has(r))try{const e=await(import(
1
+ import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-UONWRDS7.js";import{toast_default as n}from"./chunk-WSRZRWN7.js";import"./chunk-IZWMK4LP.js";import{WindowTitle as r}from"./chunk-E4FJNJ2I.js";import"./chunk-F5BQTXGY.js";import"./chunk-OTFHGJSO.js";import"./chunk-KNUR2UEG.js";import"./chunk-TRNQNGYE.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-VHHZHNJC.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import{Icon as s}from"./chunk-4755JEGD.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as c}from"./chunk-2J6F4EE7.js";import{useState as d,useRef as m}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";var p=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),g=/* @__PURE__ */new Set(["docx"]),x={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function f(){const[f,y]=d(x),[v,b]=d(!1),[k,w]=d(!1),[N,j]=d(!1),[C,D]=d(null),L=m(null),M=m(null),R=m(null),U=(e,t)=>{R.current?.focus(),document.execCommand(e,!1,t),j(!0)},W=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{R.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),j(!0)},e.readAsDataURL(t)}},B=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",j(!0),D(null))},O=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();b(!0);try{if(p.has(r)||!g.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");y({filename:t.name,kind:"text",content:o,ext:r}),j(!1)}else if(g.has(r))try{const e=await(import(
2
2
  /* @vite-ignore */
3
- "mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),j(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{b(!1)}},A=f?.filename?(E=f.filename).length>24?`${E.slice(0,23)}…`:E:"Untitled";var E;/* @__PURE__ */
4
- return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),k||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?B(t):O(t[0]))},children:[
5
- /* @__PURE__ */u(r,{title:`${A}${N?" •":""} - Documents`}),
3
+ "mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),j(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{b(!1)}},S=f?.filename?(T=f.filename).length>24?`${T.slice(0,23)}…`:T:"Untitled";var T;/* @__PURE__ */
4
+ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),k||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?W(t):O(t[0]))},children:[
5
+ /* @__PURE__ */u(r,{title:`${S}${N?" •":""} - Documents`}),
6
6
  /* @__PURE__ */u(t,{app:"documents"}),
7
7
  /* @__PURE__ */h("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
8
8
  /* @__PURE__ */u("input",{ref:L,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&O(t),L.current&&(L.current.value="")},className:"hidden"}),
9
9
  /* @__PURE__ */h("button",{onClick:()=>L.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
10
10
  /* @__PURE__ */u(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
11
- /* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=U.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=U.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
11
+ /* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=R.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=R.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
12
12
  /* @__PURE__ */u("span",{className:"text-2xs text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
13
13
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
14
14
  /* @__PURE__ */h("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:f.filename,children:[f.filename,N?" •":""]}),
15
15
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
16
16
  /* @__PURE__ */h("div",{className:"flex items-center gap-0.5",children:[
17
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
18
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
19
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
20
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
17
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
18
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
19
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
20
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
21
21
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
22
- /* @__PURE__ */h("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
22
+ /* @__PURE__ */h("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{U("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
23
23
  /* @__PURE__ */u("option",{value:"",disabled:!0,children:"Size"}),
24
24
  /* @__PURE__ */u("option",{value:"1",children:"XS"}),
25
25
  /* @__PURE__ */u("option",{value:"2",children:"S"}),
@@ -27,26 +27,26 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
27
27
  /* @__PURE__ */u("option",{value:"4",children:"L"}),
28
28
  /* @__PURE__ */u("option",{value:"5",children:"XL"}),
29
29
  /* @__PURE__ */u("option",{value:"6",children:"2XL"})]}),
30
- /* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
30
+ /* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>U("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
31
31
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
32
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
33
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
32
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
33
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
34
34
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
35
35
  /* @__PURE__ */h("div",{className:"flex items-center gap-0.5",children:[
36
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
37
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
38
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
- /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
36
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
37
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
38
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
39
+ /* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
40
40
  /* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
41
- /* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&B(Array.from(e.target.files)),M.current&&(M.current.value="")}}),
41
+ /* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&W(Array.from(e.target.files)),M.current&&(M.current.value="")}}),
42
42
  /* @__PURE__ */h("button",{onClick:()=>M.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
43
43
  /* @__PURE__ */u(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
44
- /* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:v?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:U,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>j(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),B(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),D({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-sm leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-sm leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),k&&/* @__PURE__ */u("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */u("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),C&&/* @__PURE__ */h(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
44
+ /* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:v?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:R,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>j(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),W(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),D({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-sm leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-sm leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),k&&/* @__PURE__ */u("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */u("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),C&&/* @__PURE__ */h(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
45
45
  /* @__PURE__ */u(l,{children:"Image width"}),
46
- /* @__PURE__ */u(a,{onClick:()=>W("25%"),children:"25%"}),
47
- /* @__PURE__ */u(a,{onClick:()=>W("50%"),children:"50%"}),
48
- /* @__PURE__ */u(a,{onClick:()=>W("75%"),children:"75%"}),
49
- /* @__PURE__ */u(a,{onClick:()=>W("100%"),children:"100%"}),
50
- /* @__PURE__ */u(a,{onClick:()=>W(null),children:"Original size"}),
46
+ /* @__PURE__ */u(a,{onClick:()=>B("25%"),children:"25%"}),
47
+ /* @__PURE__ */u(a,{onClick:()=>B("50%"),children:"50%"}),
48
+ /* @__PURE__ */u(a,{onClick:()=>B("75%"),children:"75%"}),
49
+ /* @__PURE__ */u(a,{onClick:()=>B("100%"),children:"100%"}),
50
+ /* @__PURE__ */u(a,{onClick:()=>B(null),children:"Original size"}),
51
51
  /* @__PURE__ */u(i,{}),
52
52
  /* @__PURE__ */u(a,{danger:!0,onClick:()=>{C?.el.remove(),j(!0),D(null)},children:"Remove image"})]})]})}export{f as default};