@f-office/docs-react 0.0.0-stage → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +168 -0
- package/NOTICE +31 -0
- package/README.md +92 -2
- package/dist/chrome.d.ts +46 -0
- package/dist/dialogs.d.ts +6 -0
- package/dist/docs-app.d.ts +8 -0
- package/dist/docs-canvas.d.ts +11 -0
- package/dist/docs-provider.d.ts +66 -0
- package/dist/f-office-docs.d.ts +46 -0
- package/dist/header.d.ts +35 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1477 -0
- package/dist/keep.d.ts +62 -0
- package/dist/menus.d.ts +7 -0
- package/dist/page-keys.d.ts +13 -0
- package/dist/page-menu.d.ts +8 -0
- package/dist/start.d.ts +2 -0
- package/dist/styles.css +2 -0
- package/dist/theme.d.ts +17 -0
- package/dist/ui/context-menu.d.ts +8 -0
- package/dist/ui/dialog.d.ts +7 -0
- package/dist/ui/menu-shortcut.d.ts +5 -0
- package/dist/ui/menubar.d.ts +16 -0
- package/dist/ui/portal-theme.d.ts +5 -0
- package/dist/ui/utils.d.ts +3 -0
- package/dist/url-file.d.ts +25 -0
- package/package.json +87 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1477 @@
|
|
|
1
|
+
import { COMMANDS as e, NARROW as t, TARGETS as n, ariaKeys as r, available as i, commandIsCmd as a, copiedAddress as o, docxFile as s, fixedValue as c, keyTexts as l, linkOfElement as u, noInstalledFonts as d, pageCommand as f, parseView as ee, printTarget as te, readZoom as ne, setUrlTarget as re, setUrlValue as ie, shortcutRows as p, urlTarget as ae } from "@f-office/docs/chrome";
|
|
2
|
+
import { createContext as m, use as h, useCallback as g, useEffect as _, useEffectEvent as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
3
|
+
import { DEFAULT_COMPATIFONT_CDN as oe, canReadInstalledFonts as se, compatifontCdnSource as ce, defineFOfficeDocsElement as le, fontFolder as ue, installedFonts as de, installedSource as fe, urlFontMode as pe } from "@f-office/docs";
|
|
4
|
+
import { clsx as me } from "clsx";
|
|
5
|
+
import { twMerge as S } from "tailwind-merge";
|
|
6
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
7
|
+
import { CheckIcon as E, ChevronRightIcon as he, CircleIcon as D, FileUpIcon as ge, ListIcon as O, MonitorIcon as k, MoonIcon as _e, SunIcon as ve, XIcon as A } from "lucide-react";
|
|
8
|
+
import { ContextMenu as j, Dialog as M, Menubar as N } from "radix-ui";
|
|
9
|
+
// src/assets/logo-mark-dark.svg
|
|
10
|
+
var ye = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%202346%20512'%20width='2346'%20height='512'%3e%3ctitle%3eF-Office%20logo%3c/title%3e%3cdefs%3e%3c!--%20One%20puzzle%20piece%20(the%20top-left%20one),%20origin%20at%20the%20puzzle%20center.%20The%20other%20three%20pieces%20are%20this%20outline%20rotated%20by%2090,%20180,%20270.%20--%3e%3cpath%20id='piece'%20d='M-134%20-256%20H-3%20A2.5%202.5%200%200%201%20-0.5%20-253.5%20V-185.97%20A17.5%2017.5%200%200%200%2022.45%20-169.34%20A43.5%2043.5%200%201%201%2022.45%20-86.66%20A17.5%2017.5%200%200%200%20-0.5%20-70.03%20V-0.5%20H-70.03%20A16.5%2016.5%200%200%201%20-85.71%20-22.14%20A44.5%2044.5%200%201%200%20-170.29%20-22.14%20A16.5%2016.5%200%200%201%20-185.97%20-0.5%20H-253.5%20A2.5%202.5%200%200%201%20-256%20-3%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20The%20whole%20puzzle%20square:%20drawn%20in%20the%20seam%20color%20under%20the%20pieces,%20and%20used%20to%20keep%20the%20edge%20shading%20inside%20the%20puzzle.%20--%3e%3cpath%20id='plate'%20d='M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3cclipPath%20id='plate-clip'%3e%3cuse%20xlink:href='%23plate'/%3e%3c/clipPath%3e%3cpath%20id='outside'%20fill-rule='evenodd'%20d='M-320%20-320%20H320%20V320%20H-320%20Z%20M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20Piece%20fills:%20light%20at%20the%20top%20left%20of%20every%20piece,%20so%20each%20gradient%20is%20turned%20back%20by%20the%20rotation%20of%20its%20piece.%20--%3e%3clinearGradient%20id='fill-purple'%20x1='-170.31'%20y1='-254.74'%20x2='-1.36'%20y2='5.42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23D697FF'/%3e%3cstop%20offset='0.5'%20stop-color='%237E5AF4'/%3e%3cstop%20offset='1'%20stop-color='%234137C8'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-pink'%20x1='40.82'%20y1='-222.24'%20x2='219.77'%20y2='53.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-90)'%3e%3cstop%20offset='0'%20stop-color='%23FFB0D8'/%3e%3cstop%20offset='0.5'%20stop-color='%23FB5D99'/%3e%3cstop%20offset='1'%20stop-color='%23C71878'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-cyan'%20x1='5.69'%20y1='1.26'%20x2='174.64'%20y2='261.42'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-180)'%3e%3cstop%20offset='0'%20stop-color='%238EF1FC'/%3e%3cstop%20offset='0.5'%20stop-color='%2300CEE7'/%3e%3cstop%20offset='1'%20stop-color='%23009DB7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-orange'%20x1='-215.18'%20y1='-46.24'%20x2='-36.23'%20y2='229.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-270)'%3e%3cstop%20offset='0'%20stop-color='%23FCDD64'/%3e%3cstop%20offset='0.5'%20stop-color='%23FF9525'/%3e%3cstop%20offset='1'%20stop-color='%23F57B20'/%3e%3c/linearGradient%3e%3c!--%20Edge%20shading%20of%20the%20pieces.%20'shade':%20a%20crisp%20dark%20rim%20inside%20the%20edges%20that%20face%20down%20and%20right,%20a%20soft%20band%20behind%20it,%20and%20a%20tight%20shadow%20cast%20onto%20the%20neighbors.%20'light':%20a%20crisp%20light%20rim%20inside%20the%20edges%20that%20face%20up%20and%20left,%20and%20a%20soft%20band%20behind%20it;%20the%20outside%20of%20the%20puzzle%20counts%20as%20filled%20there,%20so%20only%20the%20seams%20get%20it.%20--%3e%3cfilter%20id='shade'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='-1'%20dy='-1'%20result='up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='up'%20operator='out'%20result='dark-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='2'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='-5'%20dy='-5'%20result='soft-up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-up'%20operator='out'%20result='dark-band'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='0.7'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dx='0.8'%20dy='1.2'%20result='tight-off'/%3e%3cfeComposite%20in='tight-off'%20in2='SourceAlpha'%20operator='out'%20result='cast'/%3e%3cfeFlood%20flood-color='%23120C3A'%20flood-opacity='0.15'/%3e%3cfeComposite%20in2='cast'%20operator='in'%20result='cast-shadow'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.1'/%3e%3cfeComposite%20in2='dark-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.4'/%3e%3cfeComposite%20in2='dark-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='cast-shadow'/%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3cfilter%20id='light'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='1'%20dy='1'%20result='down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='down'%20operator='out'%20result='light-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='1.5'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='4'%20dy='4'%20result='soft-down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-down'%20operator='out'%20result='light-band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.38'/%3e%3cfeComposite%20in2='light-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.45'/%3e%3cfeComposite%20in2='light-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3c!--%20Colored%20glow%20and%20contact%20shadow%20under%20the%20pieces%20--%3e%3cfilter%20id='glow'%20x='-40%25'%20y='-40%25'%20width='180%25'%20height='180%25'%20color-interpolation-filters='sRGB'%3e%3cfeGaussianBlur%20in='SourceGraphic'%20stdDeviation='34'%20result='wide'/%3e%3cfeOffset%20in='wide'%20dy='16'%20result='wide-off'/%3e%3cfeComponentTransfer%20in='wide-off'%20result='color-glow'%3e%3cfeFuncA%20type='linear'%20slope='0.5'/%3e%3c/feComponentTransfer%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='9'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dy='10'%20result='tight-off'/%3e%3cfeFlood%20flood-color='%23202848'%20flood-opacity='0.07'/%3e%3cfeComposite%20in2='tight-off'%20operator='in'%20result='contact'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='color-glow'/%3e%3cfeMergeNode%20in='contact'/%3e%3c/feMerge%3e%3c/filter%3e%3c/defs%3e%3cg%20id='puzzle'%20transform='translate(256%20256)'%3e%3cg%20id='puzzle-glow'%20filter='url(%23glow)'%20clip-path='url(%23plate-clip)'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='pieces'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='edge-shade'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='edge-light'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cpath%20id='wordmark'%20fill='%23FFFFFF'%20transform='translate(662.00%20421)%20scale(0.46348)'%20d='M1241%20-729%20C1135%20-729%201050%20-693%20984%20-623%20C918%20-552%20886%20-463%20886%20-356%20C886%20-246%20918%20-156%20983%20-87%20C1047%20-17%201134%2017%201243%2017%20C1348%2017%201432%20-18%201495%20-88%20C1558%20-158%201590%20-247%201590%20-355%20C1590%20-469%201558%20-559%201495%20-627%20C1431%20-695%201347%20-729%201241%20-729Z%20M1896.7%20-713%20C1827.7%20-713%201777.7%20-700%201746.7%20-674%20C1714.7%20-648%201699.7%20-603%201699.7%20-539%20V-516%20H1617.7%20V-404%20H1699.7%20V0%20H1869.7%20V-404%20H1923.6%20H1969.7%20H2005.6%20V0%20H2175.6%20V-404%20H2275.6%20V-516%20H2173.6%20V-547%20C2173.6%20-565%202177.6%20-577%202185.6%20-583%20C2193.6%20-589%202210.6%20-592%202235.6%20-592%20C2251.6%20-592%202267.6%20-591%202281.6%20-590%20L2282.6%20-711%20C2246.6%20-712%202219.6%20-713%202202.6%20-713%20C2133.6%20-713%202083.6%20-700%202052.6%20-674%20C2020.6%20-648%202005.6%20-603%202005.6%20-539%20V-516%20H1969.7%20H1923.6%20H1867.7%20V-547%20C1867.7%20-565%201871.7%20-577%201879.7%20-583%20C1887.7%20-589%201904.7%20-592%201929.7%20-592%20C1945.7%20-592%201961.7%20-591%201975.7%20-590%20L1976.7%20-711%20C1940.7%20-712%201913.7%20-713%201896.7%20-713Z%20M0%20-712%20V0%20H187%20V-274%20H481%20V-420%20H187%20V-557%20H526%20V-712Z%20M2316.6%20-712%20V-584%20H2486.6%20V-712Z%20M1239%20-577%20C1289%20-577%201328%20-558%201357%20-519%20C1385%20-481%201400%20-428%201400%20-360%20C1400%20-289%201386%20-234%201358%20-195%20C1330%20-155%201290%20-136%201240%20-136%20C1188%20-136%201148%20-155%201119%20-195%20C1090%20-234%201076%20-288%201076%20-357%20C1076%20-425%201090%20-478%201120%20-518%20C1149%20-558%201189%20-577%201239%20-577Z%20M2795.6%20-530%20C2713.6%20-530%202647.6%20-504%202597.6%20-454%20C2547.6%20-403%202522.6%20-336%202522.6%20-253%20C2522.6%20-173%202547.6%20-109%202597.6%20-60%20C2647.6%20-11%202712.6%2014%202792.6%2014%20C2867.6%2014%202927.6%20-5%202972.6%20-42%20C3017.6%20-80%203044.6%20-133%203053.6%20-202%20L2891.6%20-203%20C2880.6%20-143%202849.6%20-113%202797.6%20-113%20C2763.6%20-113%202738.6%20-125%202720.6%20-150%20C2702.6%20-174%202693.6%20-209%202693.6%20-255%20C2693.6%20-303%202702.6%20-340%202720.6%20-367%20C2738.6%20-393%202764.6%20-407%202797.6%20-407%20C2821.6%20-407%202840.6%20-400%202856.6%20-386%20C2872.6%20-372%202881.6%20-353%202885.6%20-328%20H3049.6%20C3045.6%20-389%203019.6%20-438%202973.6%20-475%20C2927.6%20-511%202867.6%20-530%202795.6%20-530Z%20M3358.1%20-529%20C3276.1%20-529%203210.1%20-503%203159.1%20-451%20C3107.1%20-399%203082.1%20-333%203082.1%20-252%20C3082.1%20-170%203108.1%20-104%203161.1%20-56%20C3214.1%20-8%203282.1%2016%203364.1%2016%20C3429.1%2016%203484.1%201%203529.1%20-29%20C3574.1%20-59%203605.1%20-101%203622.1%20-157%20H3463.1%20C3441.1%20-117%203408.1%20-97%203366.1%20-97%20C3330.1%20-97%203301.1%20-107%203280.1%20-128%20C3259.1%20-149%203248.1%20-179%203248.1%20-217%20H3632.1%20V-232%20C3632.1%20-324%203607.1%20-396%203558.1%20-449%20C3509.1%20-502%203442.1%20-529%203358.1%20-529Z%20M2316.6%20-516%20V0%20H2486.6%20V-516Z%20M537%20-420%20V-274%20H848%20V-420Z%20M3359.1%20-415%20C3390.1%20-415%203415.1%20-405%203433.1%20-387%20C3451.1%20-369%203462.1%20-344%203465.1%20-314%20H3250.1%20C3260.1%20-381%203297.1%20-415%203359.1%20-415Z'/%3e%3c/svg%3e", be = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%202346%20512'%20width='2346'%20height='512'%3e%3ctitle%3eF-Office%20logo%3c/title%3e%3cdefs%3e%3c!--%20One%20puzzle%20piece%20(the%20top-left%20one),%20origin%20at%20the%20puzzle%20center.%20The%20other%20three%20pieces%20are%20this%20outline%20rotated%20by%2090,%20180,%20270.%20--%3e%3cpath%20id='piece'%20d='M-134%20-256%20H-3%20A2.5%202.5%200%200%201%20-0.5%20-253.5%20V-185.97%20A17.5%2017.5%200%200%200%2022.45%20-169.34%20A43.5%2043.5%200%201%201%2022.45%20-86.66%20A17.5%2017.5%200%200%200%20-0.5%20-70.03%20V-0.5%20H-70.03%20A16.5%2016.5%200%200%201%20-85.71%20-22.14%20A44.5%2044.5%200%201%200%20-170.29%20-22.14%20A16.5%2016.5%200%200%201%20-185.97%20-0.5%20H-253.5%20A2.5%202.5%200%200%201%20-256%20-3%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20The%20whole%20puzzle%20square:%20drawn%20in%20the%20seam%20color%20under%20the%20pieces,%20and%20used%20to%20keep%20the%20edge%20shading%20inside%20the%20puzzle.%20--%3e%3cpath%20id='plate'%20d='M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3cclipPath%20id='plate-clip'%3e%3cuse%20xlink:href='%23plate'/%3e%3c/clipPath%3e%3cpath%20id='outside'%20fill-rule='evenodd'%20d='M-320%20-320%20H320%20V320%20H-320%20Z%20M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20Piece%20fills:%20light%20at%20the%20top%20left%20of%20every%20piece,%20so%20each%20gradient%20is%20turned%20back%20by%20the%20rotation%20of%20its%20piece.%20--%3e%3clinearGradient%20id='fill-purple'%20x1='-170.31'%20y1='-254.74'%20x2='-1.36'%20y2='5.42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23D697FF'/%3e%3cstop%20offset='0.5'%20stop-color='%237E5AF4'/%3e%3cstop%20offset='1'%20stop-color='%234137C8'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-pink'%20x1='40.82'%20y1='-222.24'%20x2='219.77'%20y2='53.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-90)'%3e%3cstop%20offset='0'%20stop-color='%23FFB0D8'/%3e%3cstop%20offset='0.5'%20stop-color='%23FB5D99'/%3e%3cstop%20offset='1'%20stop-color='%23C71878'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-cyan'%20x1='5.69'%20y1='1.26'%20x2='174.64'%20y2='261.42'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-180)'%3e%3cstop%20offset='0'%20stop-color='%238EF1FC'/%3e%3cstop%20offset='0.5'%20stop-color='%2300CEE7'/%3e%3cstop%20offset='1'%20stop-color='%23009DB7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-orange'%20x1='-215.18'%20y1='-46.24'%20x2='-36.23'%20y2='229.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-270)'%3e%3cstop%20offset='0'%20stop-color='%23FCDD64'/%3e%3cstop%20offset='0.5'%20stop-color='%23FF9525'/%3e%3cstop%20offset='1'%20stop-color='%23F57B20'/%3e%3c/linearGradient%3e%3c!--%20Edge%20shading%20of%20the%20pieces.%20'shade':%20a%20crisp%20dark%20rim%20inside%20the%20edges%20that%20face%20down%20and%20right,%20a%20soft%20band%20behind%20it,%20and%20a%20tight%20shadow%20cast%20onto%20the%20neighbors.%20'light':%20a%20crisp%20light%20rim%20inside%20the%20edges%20that%20face%20up%20and%20left,%20and%20a%20soft%20band%20behind%20it;%20the%20outside%20of%20the%20puzzle%20counts%20as%20filled%20there,%20so%20only%20the%20seams%20get%20it.%20--%3e%3cfilter%20id='shade'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='-1'%20dy='-1'%20result='up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='up'%20operator='out'%20result='dark-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='2'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='-5'%20dy='-5'%20result='soft-up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-up'%20operator='out'%20result='dark-band'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='0.7'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dx='0.8'%20dy='1.2'%20result='tight-off'/%3e%3cfeComposite%20in='tight-off'%20in2='SourceAlpha'%20operator='out'%20result='cast'/%3e%3cfeFlood%20flood-color='%23120C3A'%20flood-opacity='0.15'/%3e%3cfeComposite%20in2='cast'%20operator='in'%20result='cast-shadow'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.1'/%3e%3cfeComposite%20in2='dark-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.4'/%3e%3cfeComposite%20in2='dark-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='cast-shadow'/%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3cfilter%20id='light'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='1'%20dy='1'%20result='down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='down'%20operator='out'%20result='light-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='1.5'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='4'%20dy='4'%20result='soft-down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-down'%20operator='out'%20result='light-band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.38'/%3e%3cfeComposite%20in2='light-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.45'/%3e%3cfeComposite%20in2='light-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3c!--%20Colored%20glow%20and%20contact%20shadow%20under%20the%20pieces%20--%3e%3cfilter%20id='glow'%20x='-40%25'%20y='-40%25'%20width='180%25'%20height='180%25'%20color-interpolation-filters='sRGB'%3e%3cfeGaussianBlur%20in='SourceGraphic'%20stdDeviation='34'%20result='wide'/%3e%3cfeOffset%20in='wide'%20dy='16'%20result='wide-off'/%3e%3cfeComponentTransfer%20in='wide-off'%20result='color-glow'%3e%3cfeFuncA%20type='linear'%20slope='0.5'/%3e%3c/feComponentTransfer%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='9'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dy='10'%20result='tight-off'/%3e%3cfeFlood%20flood-color='%23202848'%20flood-opacity='0.07'/%3e%3cfeComposite%20in2='tight-off'%20operator='in'%20result='contact'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='color-glow'/%3e%3cfeMergeNode%20in='contact'/%3e%3c/feMerge%3e%3c/filter%3e%3c/defs%3e%3cg%20id='puzzle'%20transform='translate(256%20256)'%3e%3cg%20id='puzzle-glow'%20filter='url(%23glow)'%20clip-path='url(%23plate-clip)'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='pieces'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='edge-shade'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='edge-light'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cpath%20id='wordmark'%20fill='%231D1D1F'%20transform='translate(662.00%20421)%20scale(0.46348)'%20d='M1241%20-729%20C1135%20-729%201050%20-693%20984%20-623%20C918%20-552%20886%20-463%20886%20-356%20C886%20-246%20918%20-156%20983%20-87%20C1047%20-17%201134%2017%201243%2017%20C1348%2017%201432%20-18%201495%20-88%20C1558%20-158%201590%20-247%201590%20-355%20C1590%20-469%201558%20-559%201495%20-627%20C1431%20-695%201347%20-729%201241%20-729Z%20M1896.7%20-713%20C1827.7%20-713%201777.7%20-700%201746.7%20-674%20C1714.7%20-648%201699.7%20-603%201699.7%20-539%20V-516%20H1617.7%20V-404%20H1699.7%20V0%20H1869.7%20V-404%20H1923.6%20H1969.7%20H2005.6%20V0%20H2175.6%20V-404%20H2275.6%20V-516%20H2173.6%20V-547%20C2173.6%20-565%202177.6%20-577%202185.6%20-583%20C2193.6%20-589%202210.6%20-592%202235.6%20-592%20C2251.6%20-592%202267.6%20-591%202281.6%20-590%20L2282.6%20-711%20C2246.6%20-712%202219.6%20-713%202202.6%20-713%20C2133.6%20-713%202083.6%20-700%202052.6%20-674%20C2020.6%20-648%202005.6%20-603%202005.6%20-539%20V-516%20H1969.7%20H1923.6%20H1867.7%20V-547%20C1867.7%20-565%201871.7%20-577%201879.7%20-583%20C1887.7%20-589%201904.7%20-592%201929.7%20-592%20C1945.7%20-592%201961.7%20-591%201975.7%20-590%20L1976.7%20-711%20C1940.7%20-712%201913.7%20-713%201896.7%20-713Z%20M0%20-712%20V0%20H187%20V-274%20H481%20V-420%20H187%20V-557%20H526%20V-712Z%20M2316.6%20-712%20V-584%20H2486.6%20V-712Z%20M1239%20-577%20C1289%20-577%201328%20-558%201357%20-519%20C1385%20-481%201400%20-428%201400%20-360%20C1400%20-289%201386%20-234%201358%20-195%20C1330%20-155%201290%20-136%201240%20-136%20C1188%20-136%201148%20-155%201119%20-195%20C1090%20-234%201076%20-288%201076%20-357%20C1076%20-425%201090%20-478%201120%20-518%20C1149%20-558%201189%20-577%201239%20-577Z%20M2795.6%20-530%20C2713.6%20-530%202647.6%20-504%202597.6%20-454%20C2547.6%20-403%202522.6%20-336%202522.6%20-253%20C2522.6%20-173%202547.6%20-109%202597.6%20-60%20C2647.6%20-11%202712.6%2014%202792.6%2014%20C2867.6%2014%202927.6%20-5%202972.6%20-42%20C3017.6%20-80%203044.6%20-133%203053.6%20-202%20L2891.6%20-203%20C2880.6%20-143%202849.6%20-113%202797.6%20-113%20C2763.6%20-113%202738.6%20-125%202720.6%20-150%20C2702.6%20-174%202693.6%20-209%202693.6%20-255%20C2693.6%20-303%202702.6%20-340%202720.6%20-367%20C2738.6%20-393%202764.6%20-407%202797.6%20-407%20C2821.6%20-407%202840.6%20-400%202856.6%20-386%20C2872.6%20-372%202881.6%20-353%202885.6%20-328%20H3049.6%20C3045.6%20-389%203019.6%20-438%202973.6%20-475%20C2927.6%20-511%202867.6%20-530%202795.6%20-530Z%20M3358.1%20-529%20C3276.1%20-529%203210.1%20-503%203159.1%20-451%20C3107.1%20-399%203082.1%20-333%203082.1%20-252%20C3082.1%20-170%203108.1%20-104%203161.1%20-56%20C3214.1%20-8%203282.1%2016%203364.1%2016%20C3429.1%2016%203484.1%201%203529.1%20-29%20C3574.1%20-59%203605.1%20-101%203622.1%20-157%20H3463.1%20C3441.1%20-117%203408.1%20-97%203366.1%20-97%20C3330.1%20-97%203301.1%20-107%203280.1%20-128%20C3259.1%20-149%203248.1%20-179%203248.1%20-217%20H3632.1%20V-232%20C3632.1%20-324%203607.1%20-396%203558.1%20-449%20C3509.1%20-502%203442.1%20-529%203358.1%20-529Z%20M2316.6%20-516%20V0%20H2486.6%20V-516Z%20M537%20-420%20V-274%20H848%20V-420Z%20M3359.1%20-415%20C3390.1%20-415%203415.1%20-405%203433.1%20-387%20C3451.1%20-369%203462.1%20-344%203465.1%20-314%20H3250.1%20C3260.1%20-381%203297.1%20-415%203359.1%20-415Z'/%3e%3c/svg%3e", P = 5e7, xe = 400, Se = {
|
|
11
|
+
kept: "Kept in this browser until you close it",
|
|
12
|
+
"too-large": `Not kept across a reload: larger than ${String(P / 1e6)} MB`,
|
|
13
|
+
failed: "Not kept across a reload: the browser's storage is blocked or full"
|
|
14
|
+
};
|
|
15
|
+
function Ce(e) {
|
|
16
|
+
return new TextEncoder().encode(JSON.stringify(e)).slice().buffer;
|
|
17
|
+
}
|
|
18
|
+
function F(e) {
|
|
19
|
+
return e === null ? null : JSON.parse(new TextDecoder().decode(e));
|
|
20
|
+
}
|
|
21
|
+
function we(e) {
|
|
22
|
+
let t = F(e);
|
|
23
|
+
return typeof t == "string" ? t : null;
|
|
24
|
+
}
|
|
25
|
+
function I(e) {
|
|
26
|
+
let t = F(e);
|
|
27
|
+
return t === null ? null : ee(t);
|
|
28
|
+
}
|
|
29
|
+
var L = class {
|
|
30
|
+
#e;
|
|
31
|
+
#t;
|
|
32
|
+
#n = Promise.resolve();
|
|
33
|
+
#r = !1;
|
|
34
|
+
#i = null;
|
|
35
|
+
#a = void 0;
|
|
36
|
+
constructor(e, t = 400) {
|
|
37
|
+
this.#e = e.catch(() => null), this.#t = t;
|
|
38
|
+
}
|
|
39
|
+
load() {
|
|
40
|
+
return this.#s(null, async (e) => {
|
|
41
|
+
let t = we(await e.read("name")), n = await e.read("bytes");
|
|
42
|
+
return t === null || n === null ? null : (this.#r = !0, {
|
|
43
|
+
name: t,
|
|
44
|
+
bytes: n,
|
|
45
|
+
view: I(await e.read("view"))
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
keep(e, t) {
|
|
50
|
+
return this.#o(), this.#r = !1, t.byteLength > 5e7 ? this.forget().then(() => "too-large") : this.#s("failed", async (n) => (await n.remove("name"), await n.remove("view"), await n.write("bytes", t.slice(0)), await n.write("name", Ce(e)), this.#r = !0, "kept"));
|
|
51
|
+
}
|
|
52
|
+
keepView(e) {
|
|
53
|
+
this.#o(), this.#i = e, this.#a = setTimeout(() => void this.flush(), this.#t);
|
|
54
|
+
}
|
|
55
|
+
flush() {
|
|
56
|
+
let e = this.#i;
|
|
57
|
+
return this.#o(), this.#s(void 0, async (t) => {
|
|
58
|
+
e && this.#r && await t.write("view", Ce(e));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
forget() {
|
|
62
|
+
return this.#o(), this.#r = !1, this.#s(void 0, async (e) => {
|
|
63
|
+
for (let t of [
|
|
64
|
+
"name",
|
|
65
|
+
"view",
|
|
66
|
+
"bytes"
|
|
67
|
+
]) await e.remove(t);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
#o() {
|
|
71
|
+
clearTimeout(this.#a), this.#a = void 0, this.#i = null;
|
|
72
|
+
}
|
|
73
|
+
#s(e, t) {
|
|
74
|
+
let n = this.#n.then(async () => {
|
|
75
|
+
let n = await this.#e;
|
|
76
|
+
return n ? await t(n) : e;
|
|
77
|
+
}).catch(() => e);
|
|
78
|
+
return this.#n = n, n;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
function R(e) {
|
|
82
|
+
return e instanceof DOMException && e.name === "NotFoundError";
|
|
83
|
+
}
|
|
84
|
+
function z(e) {
|
|
85
|
+
let t = (e) => `${e}.bin`;
|
|
86
|
+
return {
|
|
87
|
+
read: async (n) => {
|
|
88
|
+
try {
|
|
89
|
+
return await (await (await e.getFileHandle(t(n))).getFile()).arrayBuffer();
|
|
90
|
+
} catch (e) {
|
|
91
|
+
if (R(e)) return null;
|
|
92
|
+
throw e;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
write: async (n, r) => {
|
|
96
|
+
let i = await (await e.getFileHandle(t(n), { create: !0 })).createWritable();
|
|
97
|
+
await i.write(r), await i.close();
|
|
98
|
+
},
|
|
99
|
+
remove: async (n) => {
|
|
100
|
+
await e.removeEntry(t(n)).catch((e) => {
|
|
101
|
+
if (!R(e)) throw e;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
var B = "f-office-viewer", V = "kept";
|
|
107
|
+
function H(e) {
|
|
108
|
+
let t = (t, n) => new Promise((r, i) => {
|
|
109
|
+
let a = e.transaction(V, t), o = n(a.objectStore(V));
|
|
110
|
+
a.oncomplete = () => {
|
|
111
|
+
r(o.result);
|
|
112
|
+
}, a.onerror = a.onabort = () => {
|
|
113
|
+
i(a.error ?? /* @__PURE__ */ Error("the browser's storage refused"));
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
return {
|
|
117
|
+
read: async (e) => {
|
|
118
|
+
let n = await t("readonly", (t) => t.get(e));
|
|
119
|
+
return n instanceof ArrayBuffer ? n : null;
|
|
120
|
+
},
|
|
121
|
+
write: async (e, n) => {
|
|
122
|
+
await t("readwrite", (t) => t.put(n, e));
|
|
123
|
+
},
|
|
124
|
+
remove: async (e) => {
|
|
125
|
+
await t("readwrite", (t) => t.delete(e));
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function Te(e) {
|
|
130
|
+
return new Promise((t) => {
|
|
131
|
+
let n = e.open(B, 1);
|
|
132
|
+
n.onupgradeneeded = () => {
|
|
133
|
+
n.result.createObjectStore(V);
|
|
134
|
+
}, n.onsuccess = () => {
|
|
135
|
+
t(n.result);
|
|
136
|
+
}, n.onerror = () => {
|
|
137
|
+
t(null);
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async function Ee() {
|
|
142
|
+
try {
|
|
143
|
+
if (typeof FileSystemFileHandle < "u" && "createWritable" in FileSystemFileHandle.prototype) return z(await (await navigator.storage.getDirectory()).getDirectoryHandle(B, { create: !0 }));
|
|
144
|
+
} catch {}
|
|
145
|
+
try {
|
|
146
|
+
if (typeof indexedDB < "u") {
|
|
147
|
+
let e = await Te(indexedDB);
|
|
148
|
+
return e && H(e);
|
|
149
|
+
}
|
|
150
|
+
} catch {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
// src/page-keys.ts
|
|
156
|
+
function U(e, t) {
|
|
157
|
+
let n = e.composedPath(), r = n[0];
|
|
158
|
+
return {
|
|
159
|
+
inViewer: t !== null && n.includes(t),
|
|
160
|
+
inField: r instanceof HTMLInputElement || r instanceof HTMLSelectElement || r instanceof HTMLTextAreaElement,
|
|
161
|
+
inDialog: n.some((e) => e instanceof Element && e.getAttribute("role") === "dialog")
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function De(e, t) {
|
|
165
|
+
let n = e.target === document.body || e.target === document.documentElement, r = !(e.ctrlKey || e.metaKey || e.altKey);
|
|
166
|
+
return !t || !n || !r || !t.scrollByKey(e.key, e.shiftKey) ? !1 : (t.focus(), !0);
|
|
167
|
+
}
|
|
168
|
+
function Oe(e, t) {
|
|
169
|
+
let n = v((n) => {
|
|
170
|
+
if (n.defaultPrevented) return;
|
|
171
|
+
let r = t.current;
|
|
172
|
+
if (De(n, r)) {
|
|
173
|
+
n.preventDefault();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
let i = f(n, U(n, r));
|
|
177
|
+
i !== null && e.takes(i) && (n.preventDefault(), e.run(i));
|
|
178
|
+
});
|
|
179
|
+
_(() => (window.addEventListener("keydown", n), () => {
|
|
180
|
+
window.removeEventListener("keydown", n);
|
|
181
|
+
}), []);
|
|
182
|
+
}
|
|
183
|
+
// src/theme.ts
|
|
184
|
+
var W = [
|
|
185
|
+
"system",
|
|
186
|
+
"light",
|
|
187
|
+
"dark"
|
|
188
|
+
], G = {
|
|
189
|
+
system: "System",
|
|
190
|
+
light: "Light",
|
|
191
|
+
dark: "Dark"
|
|
192
|
+
}, ke = "f-office-viewer:theme", Ae = () => window.localStorage;
|
|
193
|
+
function je(e) {
|
|
194
|
+
return W.includes(e);
|
|
195
|
+
}
|
|
196
|
+
function Me(e = Ae, t = ke) {
|
|
197
|
+
try {
|
|
198
|
+
let n = e().getItem(t);
|
|
199
|
+
return je(n) ? n : "system";
|
|
200
|
+
} catch {
|
|
201
|
+
return "system";
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function Ne(e, t = Ae, n = ke) {
|
|
205
|
+
try {
|
|
206
|
+
t().setItem(n, e);
|
|
207
|
+
} catch {}
|
|
208
|
+
}
|
|
209
|
+
function Pe(e, t = document.documentElement) {
|
|
210
|
+
e === "system" ? delete t.dataset.theme : t.dataset.theme = e;
|
|
211
|
+
}
|
|
212
|
+
function Fe(e) {
|
|
213
|
+
return W[(W.indexOf(e) + 1) % W.length] ?? "system";
|
|
214
|
+
}
|
|
215
|
+
// src/ui/utils.ts
|
|
216
|
+
function K(...e) {
|
|
217
|
+
return S(me(e));
|
|
218
|
+
}
|
|
219
|
+
// src/ui/portal-theme.ts
|
|
220
|
+
var Ie = m(void 0);
|
|
221
|
+
function q() {
|
|
222
|
+
return h(Ie);
|
|
223
|
+
}
|
|
224
|
+
// src/url-file.ts
|
|
225
|
+
var Le = "file";
|
|
226
|
+
function Re(e, t) {
|
|
227
|
+
return `The address names a file on ${e.origin}. F-Office Docs opens files only from ${t.origin}, the site of this page.`;
|
|
228
|
+
}
|
|
229
|
+
function ze(e, t) {
|
|
230
|
+
let n = new URLSearchParams(e).get(Le);
|
|
231
|
+
if (n === null || n === "") return null;
|
|
232
|
+
let r = new URL(t), i;
|
|
233
|
+
try {
|
|
234
|
+
i = new URL(n, r);
|
|
235
|
+
} catch {
|
|
236
|
+
return {
|
|
237
|
+
kind: "refused",
|
|
238
|
+
why: `"${n}" is not an address.`
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return i.origin === r.origin ? {
|
|
242
|
+
kind: "address",
|
|
243
|
+
address: i
|
|
244
|
+
} : {
|
|
245
|
+
kind: "refused",
|
|
246
|
+
why: Re(i, r)
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function J(e) {
|
|
250
|
+
let t = e.pathname.split("/").pop() ?? "", n = t;
|
|
251
|
+
try {
|
|
252
|
+
n = decodeURIComponent(t);
|
|
253
|
+
} catch {}
|
|
254
|
+
return n || "document.docx";
|
|
255
|
+
}
|
|
256
|
+
async function Be(e, t, n = fetch) {
|
|
257
|
+
let r = await n(e.href, t ? { signal: t } : {}), i = r.url ? new URL(r.url) : e;
|
|
258
|
+
if (i.origin !== e.origin) throw Error(Re(i, e));
|
|
259
|
+
if (!r.ok) throw Error(`The file ${J(e)} cannot be read: the server answered HTTP ${String(r.status)}.`);
|
|
260
|
+
return {
|
|
261
|
+
name: J(e),
|
|
262
|
+
bytes: await r.arrayBuffer()
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function Ve() {
|
|
266
|
+
let e = new URLSearchParams(window.location.search);
|
|
267
|
+
if (!e.has("file")) return;
|
|
268
|
+
e.delete(Le);
|
|
269
|
+
let t = e.toString();
|
|
270
|
+
window.history.replaceState(null, "", t ? `?${t}` : window.location.pathname);
|
|
271
|
+
}
|
|
272
|
+
function He(e) {
|
|
273
|
+
return e instanceof Error ? e.message : String(e);
|
|
274
|
+
}
|
|
275
|
+
function Ue(e, t, n) {
|
|
276
|
+
let r = v(t), i = v(n);
|
|
277
|
+
_(() => {
|
|
278
|
+
if (e?.kind === "refused" && i(e.why), e?.kind !== "address") return;
|
|
279
|
+
let t = new AbortController();
|
|
280
|
+
return Be(e.address, t.signal).then((e) => {
|
|
281
|
+
r(e);
|
|
282
|
+
}, (e) => {
|
|
283
|
+
t.signal.aborted || i(He(e));
|
|
284
|
+
}), () => {
|
|
285
|
+
t.abort();
|
|
286
|
+
};
|
|
287
|
+
}, [e]);
|
|
288
|
+
}
|
|
289
|
+
// src/docs-provider.tsx
|
|
290
|
+
var We = null;
|
|
291
|
+
function Ge() {
|
|
292
|
+
return We ||= new L(Ee()), We;
|
|
293
|
+
}
|
|
294
|
+
var Ke = {
|
|
295
|
+
selected: !1,
|
|
296
|
+
outline: !1,
|
|
297
|
+
zoom: "fixed:1",
|
|
298
|
+
zoomSteps: [],
|
|
299
|
+
page: 0,
|
|
300
|
+
pageCount: 0,
|
|
301
|
+
layoutComplete: !0,
|
|
302
|
+
progress: null
|
|
303
|
+
};
|
|
304
|
+
function qe(e) {
|
|
305
|
+
return e.zoom === "fixed" ? c(e.factor) : e.zoom;
|
|
306
|
+
}
|
|
307
|
+
function Je(e) {
|
|
308
|
+
return `The installed fonts cannot be read (${e instanceof Error ? e.message : String(e)}), so the pages use the open fonts.`;
|
|
309
|
+
}
|
|
310
|
+
function Ye(e) {
|
|
311
|
+
let t = URL.createObjectURL(new Blob([e.bytes])), n = document.createElement("a");
|
|
312
|
+
n.href = t, n.download = e.name, n.click(), URL.revokeObjectURL(t);
|
|
313
|
+
}
|
|
314
|
+
var Xe = m(null);
|
|
315
|
+
function Y() {
|
|
316
|
+
let e = h(Xe);
|
|
317
|
+
if (!e) throw Error("useDocs must be used inside a <DocsProvider>");
|
|
318
|
+
return e;
|
|
319
|
+
}
|
|
320
|
+
function X() {
|
|
321
|
+
return Y().publicValue;
|
|
322
|
+
}
|
|
323
|
+
function Ze() {
|
|
324
|
+
return Y().internal;
|
|
325
|
+
}
|
|
326
|
+
function Qe({ children: e, keeper: n, fontCdnUrl: r = oe, fontFolderUrl: a, fontSource: o, moduleUrls: c, theme: l, onThemeChange: u, applyDocumentTheme: d = !0, themeStorageKey: f = ke, syncDocumentTitle: ee = !1, readUrlParams: p = !0, initialFile: m, initialUrl: h, className: me }) {
|
|
327
|
+
le();
|
|
328
|
+
let S = n === void 0 ? Ge() : n, C = b(null), E = b(null), he = b(0), [D, ge] = x(() => p ? ae(window.location.search) : "word-win"), [O] = x(() => h ? ze(`?${Le}=${encodeURIComponent(h)}`, window.location.href) : p ? ze(window.location.search, window.location.href) : null), [k, _e] = x(null), [ve, A] = x(null), [j, M] = x(0), [N, ye] = x(!1), [be, P] = x(null), [xe, Ce] = x(() => Me(void 0, f)), F = l ?? xe, we = g((e) => {
|
|
329
|
+
l === void 0 && (Ne(e, void 0, f), Ce(e)), u?.(e);
|
|
330
|
+
}, [
|
|
331
|
+
l,
|
|
332
|
+
u,
|
|
333
|
+
f
|
|
334
|
+
]);
|
|
335
|
+
_(() => {
|
|
336
|
+
d && Pe(F);
|
|
337
|
+
}, [F, d]);
|
|
338
|
+
let [I, L] = x(() => p ? pe(window.location.search) : "open"), [R, z] = x(null), [B, V] = x(Ke), [H, Te] = x(null), Ee = y(() => {
|
|
339
|
+
if (o) return o;
|
|
340
|
+
let e = a ? ue(typeof a == "string" ? new URL(a, document.baseURI) : a, I === "installed" ? "installed" : "open") : ce(r);
|
|
341
|
+
return I === "installed" && R ? fe(R, e) : e;
|
|
342
|
+
}, [
|
|
343
|
+
o,
|
|
344
|
+
a,
|
|
345
|
+
r,
|
|
346
|
+
I,
|
|
347
|
+
R
|
|
348
|
+
]), U = g(({ name: e, bytes: t }) => {
|
|
349
|
+
_e({
|
|
350
|
+
name: e,
|
|
351
|
+
bytes: t,
|
|
352
|
+
view: null
|
|
353
|
+
}), A(null), S && S.keep(e, t).then((e) => {
|
|
354
|
+
A(Se[e]);
|
|
355
|
+
});
|
|
356
|
+
}, [S]);
|
|
357
|
+
Ue(O, U, g((e) => {
|
|
358
|
+
P({ problem: e });
|
|
359
|
+
}, [])), _(() => {
|
|
360
|
+
if (!m) return;
|
|
361
|
+
let e = !0;
|
|
362
|
+
return m.arrayBuffer().then((t) => {
|
|
363
|
+
e && U({
|
|
364
|
+
name: m.name,
|
|
365
|
+
bytes: t
|
|
366
|
+
});
|
|
367
|
+
}), () => {
|
|
368
|
+
e = !1;
|
|
369
|
+
};
|
|
370
|
+
}, [m, U]), _(() => {
|
|
371
|
+
if (!S) return;
|
|
372
|
+
S.load().then((e) => {
|
|
373
|
+
e && O?.kind !== "address" && !m && (_e((t) => t ?? e), A((e) => e ?? Se.kept));
|
|
374
|
+
});
|
|
375
|
+
let e = () => void S.flush();
|
|
376
|
+
return window.addEventListener("pagehide", e), () => {
|
|
377
|
+
window.removeEventListener("pagehide", e);
|
|
378
|
+
};
|
|
379
|
+
}, [
|
|
380
|
+
S,
|
|
381
|
+
O,
|
|
382
|
+
m
|
|
383
|
+
]), _(() => {
|
|
384
|
+
I !== "installed" || R || de().then(z, (e) => {
|
|
385
|
+
L("open"), A(Je(e));
|
|
386
|
+
});
|
|
387
|
+
}, [I, R]);
|
|
388
|
+
let [De, W] = x(0), G = v((e) => {
|
|
389
|
+
let t = e.detail;
|
|
390
|
+
S?.keepView(t), V((e) => ({
|
|
391
|
+
...e,
|
|
392
|
+
zoom: qe(t)
|
|
393
|
+
}));
|
|
394
|
+
}), Ae = v((e) => {
|
|
395
|
+
let { pageCount: t, zoomSteps: n, complete: r } = e.detail, i = r ?? !0;
|
|
396
|
+
V((e) => ({
|
|
397
|
+
...e,
|
|
398
|
+
pageCount: t,
|
|
399
|
+
zoomSteps: n,
|
|
400
|
+
page: 0,
|
|
401
|
+
layoutComplete: i,
|
|
402
|
+
progress: i ? null : e.progress
|
|
403
|
+
}));
|
|
404
|
+
}), je = v((e) => {
|
|
405
|
+
let { pageCount: t, complete: n } = e.detail;
|
|
406
|
+
V((e) => ({
|
|
407
|
+
...e,
|
|
408
|
+
pageCount: t,
|
|
409
|
+
layoutComplete: n,
|
|
410
|
+
progress: n ? null : e.progress
|
|
411
|
+
}));
|
|
412
|
+
}), Fe = v((e) => {
|
|
413
|
+
let t = e.detail;
|
|
414
|
+
V((e) => ({
|
|
415
|
+
...e,
|
|
416
|
+
progress: t.complete ? null : t
|
|
417
|
+
}));
|
|
418
|
+
}), q = v(() => {
|
|
419
|
+
V((e) => e.progress === null ? e : {
|
|
420
|
+
...e,
|
|
421
|
+
progress: null
|
|
422
|
+
});
|
|
423
|
+
}), Re = v((e) => {
|
|
424
|
+
let { page: t } = e.detail;
|
|
425
|
+
V((e) => ({
|
|
426
|
+
...e,
|
|
427
|
+
page: t
|
|
428
|
+
}));
|
|
429
|
+
}), J = v((e) => {
|
|
430
|
+
let { open: t } = e.detail;
|
|
431
|
+
V((e) => ({
|
|
432
|
+
...e,
|
|
433
|
+
outline: t
|
|
434
|
+
}));
|
|
435
|
+
}), Be = v((e) => {
|
|
436
|
+
let { selected: t } = e.detail;
|
|
437
|
+
V((e) => ({
|
|
438
|
+
...e,
|
|
439
|
+
selected: t
|
|
440
|
+
}));
|
|
441
|
+
}), He = v((e) => {
|
|
442
|
+
e.preventDefault(), Te(e.detail);
|
|
443
|
+
}), We = g((e) => (E.current = e, W((e) => e + 1), () => {
|
|
444
|
+
E.current = null, V(Ke);
|
|
445
|
+
}), []);
|
|
446
|
+
_(() => {
|
|
447
|
+
let e = E.current;
|
|
448
|
+
if (e) return e.addEventListener("viewchange", G), e.addEventListener("open", Ae), e.addEventListener("pageschange", je), e.addEventListener("progress", Fe), e.addEventListener("error", q), e.addEventListener("pagechange", Re), e.addEventListener("outlinechange", J), e.addEventListener("selectionchange", Be), e.addEventListener("menu", He), () => {
|
|
449
|
+
e.removeEventListener("viewchange", G), e.removeEventListener("open", Ae), e.removeEventListener("pageschange", je), e.removeEventListener("progress", Fe), e.removeEventListener("error", q), e.removeEventListener("pagechange", Re), e.removeEventListener("outlinechange", J), e.removeEventListener("selectionchange", Be), e.removeEventListener("menu", He);
|
|
450
|
+
};
|
|
451
|
+
}, [De]), _(() => {
|
|
452
|
+
let e = E.current;
|
|
453
|
+
if (!e || I === "installed" && !R || (e.target = D, e.fontSource = Ee, !k)) return;
|
|
454
|
+
let n = !1, { view: r } = k;
|
|
455
|
+
return e.open(k.bytes, k.name).then(() => {
|
|
456
|
+
n || (r ? e.showView(r) : e.clientWidth < t && e.setZoom("fit-width"));
|
|
457
|
+
}, () => void 0), () => {
|
|
458
|
+
n = !0;
|
|
459
|
+
};
|
|
460
|
+
}, [
|
|
461
|
+
De,
|
|
462
|
+
D,
|
|
463
|
+
k,
|
|
464
|
+
j,
|
|
465
|
+
I,
|
|
466
|
+
R,
|
|
467
|
+
Ee
|
|
468
|
+
]), _(() => {
|
|
469
|
+
ee && (document.title = k ? `${k.name} — F-Office Docs` : "F-Office Docs");
|
|
470
|
+
}, [k, ee]);
|
|
471
|
+
let Y = g((e) => {
|
|
472
|
+
if (!e) return;
|
|
473
|
+
let t = ++he.current;
|
|
474
|
+
e.arrayBuffer().then((n) => {
|
|
475
|
+
t === he.current && (p && Ve(), U({
|
|
476
|
+
name: e.name,
|
|
477
|
+
bytes: n
|
|
478
|
+
}));
|
|
479
|
+
});
|
|
480
|
+
}, [p, U]), X = g((e) => {
|
|
481
|
+
let t = E.current;
|
|
482
|
+
switch (e) {
|
|
483
|
+
case "open":
|
|
484
|
+
C.current?.click();
|
|
485
|
+
return;
|
|
486
|
+
case "print":
|
|
487
|
+
if (t) {
|
|
488
|
+
let e = te();
|
|
489
|
+
t.pdf().then(e.print, e.cancel);
|
|
490
|
+
}
|
|
491
|
+
return;
|
|
492
|
+
case "download":
|
|
493
|
+
k && Ye(k);
|
|
494
|
+
return;
|
|
495
|
+
case "close":
|
|
496
|
+
p && Ve(), S?.forget(), _e(null), A(null), M((e) => e + 1);
|
|
497
|
+
return;
|
|
498
|
+
case "copy":
|
|
499
|
+
t?.copyText(null);
|
|
500
|
+
return;
|
|
501
|
+
case "select-all":
|
|
502
|
+
t?.selectAll();
|
|
503
|
+
return;
|
|
504
|
+
case "find":
|
|
505
|
+
t?.find();
|
|
506
|
+
return;
|
|
507
|
+
case "zoom-in":
|
|
508
|
+
t?.zoomStep(!0);
|
|
509
|
+
return;
|
|
510
|
+
case "zoom-out":
|
|
511
|
+
t?.zoomStep(!1);
|
|
512
|
+
return;
|
|
513
|
+
case "actual-size":
|
|
514
|
+
t?.setZoom("fixed", 1);
|
|
515
|
+
return;
|
|
516
|
+
case "advanced":
|
|
517
|
+
P("advanced");
|
|
518
|
+
return;
|
|
519
|
+
case "shortcuts":
|
|
520
|
+
P("shortcuts");
|
|
521
|
+
return;
|
|
522
|
+
case "about":
|
|
523
|
+
P("about");
|
|
524
|
+
return;
|
|
525
|
+
default: return;
|
|
526
|
+
}
|
|
527
|
+
}, [
|
|
528
|
+
k,
|
|
529
|
+
S,
|
|
530
|
+
p
|
|
531
|
+
]);
|
|
532
|
+
Oe({
|
|
533
|
+
takes: (e) => i(e, k !== null, B.selected),
|
|
534
|
+
run: X
|
|
535
|
+
}, E);
|
|
536
|
+
let Ze = g((e) => {
|
|
537
|
+
ge(e), p && re(e);
|
|
538
|
+
}, [p]), Qe = g(() => {
|
|
539
|
+
P(null);
|
|
540
|
+
}, []), $e = y(() => ({
|
|
541
|
+
run: X,
|
|
542
|
+
setOutline: (e) => {
|
|
543
|
+
E.current && (E.current.outlineOpen = e);
|
|
544
|
+
},
|
|
545
|
+
setZoom: (e) => {
|
|
546
|
+
let { zoom: t, factor: n } = ne(e);
|
|
547
|
+
E.current?.setZoom(t, n);
|
|
548
|
+
},
|
|
549
|
+
setTheme: we,
|
|
550
|
+
setFonts: (e) => {
|
|
551
|
+
e === "open" ? (p && ie("fonts", e), L(e)) : de().then((t) => {
|
|
552
|
+
p && ie("fonts", e), z(t), L(e);
|
|
553
|
+
}, (e) => {
|
|
554
|
+
A(Je(e));
|
|
555
|
+
});
|
|
556
|
+
},
|
|
557
|
+
focusPages: () => {
|
|
558
|
+
E.current?.focus();
|
|
559
|
+
}
|
|
560
|
+
}), [
|
|
561
|
+
X,
|
|
562
|
+
we,
|
|
563
|
+
p
|
|
564
|
+
]), et = y(() => ({
|
|
565
|
+
...B,
|
|
566
|
+
name: k?.name ?? null,
|
|
567
|
+
note: ve,
|
|
568
|
+
theme: F,
|
|
569
|
+
fonts: I,
|
|
570
|
+
installedFonts: se()
|
|
571
|
+
}), [
|
|
572
|
+
B,
|
|
573
|
+
k,
|
|
574
|
+
ve,
|
|
575
|
+
F,
|
|
576
|
+
I
|
|
577
|
+
]), Z = y(() => ({
|
|
578
|
+
publicValue: {
|
|
579
|
+
state: et,
|
|
580
|
+
calls: $e,
|
|
581
|
+
openFile: Y,
|
|
582
|
+
elementRef: E,
|
|
583
|
+
target: D,
|
|
584
|
+
setTarget: Ze,
|
|
585
|
+
dialog: be,
|
|
586
|
+
closeDialog: Qe
|
|
587
|
+
},
|
|
588
|
+
internal: {
|
|
589
|
+
file: k,
|
|
590
|
+
dragging: N,
|
|
591
|
+
generation: j,
|
|
592
|
+
menu: H,
|
|
593
|
+
moduleUrls: c,
|
|
594
|
+
attachElement: We
|
|
595
|
+
}
|
|
596
|
+
}), [
|
|
597
|
+
et,
|
|
598
|
+
$e,
|
|
599
|
+
Y,
|
|
600
|
+
D,
|
|
601
|
+
Ze,
|
|
602
|
+
be,
|
|
603
|
+
Qe,
|
|
604
|
+
k,
|
|
605
|
+
N,
|
|
606
|
+
j,
|
|
607
|
+
H,
|
|
608
|
+
c,
|
|
609
|
+
We
|
|
610
|
+
]);
|
|
611
|
+
return /* @__PURE__ */ w(Xe, {
|
|
612
|
+
value: Z,
|
|
613
|
+
children: /* @__PURE__ */ w(Ie, {
|
|
614
|
+
value: F,
|
|
615
|
+
children: /* @__PURE__ */ T("div", {
|
|
616
|
+
"data-f-office-theme": F,
|
|
617
|
+
className: K("f-office-docs-root flex h-full min-h-0 flex-col bg-background text-foreground", me),
|
|
618
|
+
onDragOver: (e) => {
|
|
619
|
+
e.preventDefault(), ye(!0);
|
|
620
|
+
},
|
|
621
|
+
onDragLeave: () => {
|
|
622
|
+
ye(!1);
|
|
623
|
+
},
|
|
624
|
+
onDrop: (e) => {
|
|
625
|
+
e.preventDefault(), ye(!1), Y(s(e.dataTransfer.files));
|
|
626
|
+
},
|
|
627
|
+
children: [e, /* @__PURE__ */ w("input", {
|
|
628
|
+
ref: C,
|
|
629
|
+
className: "hidden",
|
|
630
|
+
type: "file",
|
|
631
|
+
accept: ".docx",
|
|
632
|
+
"aria-label": "DOCX file",
|
|
633
|
+
onChange: (e) => {
|
|
634
|
+
Y(s(e.target.files)), e.target.value = "";
|
|
635
|
+
}
|
|
636
|
+
})]
|
|
637
|
+
})
|
|
638
|
+
})
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
// src/ui/dialog.tsx
|
|
642
|
+
var $e = M.Root;
|
|
643
|
+
function et({ className: e, children: t, ...n }) {
|
|
644
|
+
let r = q();
|
|
645
|
+
return /* @__PURE__ */ T(M.Portal, { children: [/* @__PURE__ */ w(M.Overlay, { className: "fixed inset-0 z-50 bg-black/40" }), /* @__PURE__ */ T(M.Content, {
|
|
646
|
+
"data-slot": "dialog-content",
|
|
647
|
+
"data-f-office-theme": r,
|
|
648
|
+
className: K("f-office-docs-portal fixed top-1/2 left-1/2 z-50 grid w-[min(28rem,calc(100%-2rem))] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover p-6 text-popover-foreground shadow-xl", e),
|
|
649
|
+
...n,
|
|
650
|
+
children: [t, /* @__PURE__ */ w(M.Close, {
|
|
651
|
+
className: "absolute top-4 right-4 rounded-full p-1 text-muted-foreground hover:bg-accent",
|
|
652
|
+
"aria-label": "Close",
|
|
653
|
+
children: /* @__PURE__ */ w(A, { className: "size-4" })
|
|
654
|
+
})]
|
|
655
|
+
})] });
|
|
656
|
+
}
|
|
657
|
+
function Z({ className: e, ...t }) {
|
|
658
|
+
return /* @__PURE__ */ w(M.Title, {
|
|
659
|
+
"data-slot": "dialog-title",
|
|
660
|
+
className: K("text-lg font-medium", e),
|
|
661
|
+
...t
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
function tt({ className: e, ...t }) {
|
|
665
|
+
return /* @__PURE__ */ w(M.Description, {
|
|
666
|
+
"data-slot": "dialog-description",
|
|
667
|
+
className: K("text-sm text-muted-foreground", e),
|
|
668
|
+
...t
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
// src/dialogs.tsx
|
|
672
|
+
function nt({ className: e }) {
|
|
673
|
+
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("img", {
|
|
674
|
+
src: be,
|
|
675
|
+
alt: "F-Office",
|
|
676
|
+
className: `f-office-logo-light ${e}`
|
|
677
|
+
}), /* @__PURE__ */ w("img", {
|
|
678
|
+
src: ye,
|
|
679
|
+
alt: "F-Office",
|
|
680
|
+
className: `f-office-logo-dark ${e}`
|
|
681
|
+
})] });
|
|
682
|
+
}
|
|
683
|
+
function rt() {
|
|
684
|
+
let e = a(navigator.userAgent);
|
|
685
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
686
|
+
/* @__PURE__ */ w(Z, { children: "Keyboard shortcuts" }),
|
|
687
|
+
/* @__PURE__ */ w(tt, { children: "Click the pages first, so that the keys of the text reach the document." }),
|
|
688
|
+
/* @__PURE__ */ w("table", {
|
|
689
|
+
className: "text-sm",
|
|
690
|
+
children: /* @__PURE__ */ w("tbody", { children: p(e).map(([e, t]) => /* @__PURE__ */ T("tr", {
|
|
691
|
+
className: "border-t border-border",
|
|
692
|
+
children: [/* @__PURE__ */ w("td", {
|
|
693
|
+
className: "py-1.5 pr-4 font-mono text-xs",
|
|
694
|
+
children: e
|
|
695
|
+
}), /* @__PURE__ */ w("td", {
|
|
696
|
+
className: "py-1.5",
|
|
697
|
+
children: t
|
|
698
|
+
})]
|
|
699
|
+
}, e)) })
|
|
700
|
+
})
|
|
701
|
+
] });
|
|
702
|
+
}
|
|
703
|
+
function it() {
|
|
704
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
705
|
+
/* @__PURE__ */ w(Z, {
|
|
706
|
+
className: "sr-only",
|
|
707
|
+
children: "About F-Office"
|
|
708
|
+
}),
|
|
709
|
+
/* @__PURE__ */ w(nt, { className: "h-8 w-auto self-start" }),
|
|
710
|
+
/* @__PURE__ */ w(tt, { children: "F-Office draws the pages of DOCX files as Word lays them out, in your browser. The file that you open stays in this browser." })
|
|
711
|
+
] });
|
|
712
|
+
}
|
|
713
|
+
function at({ why: e }) {
|
|
714
|
+
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Z, { children: "The file cannot be opened" }), /* @__PURE__ */ w(tt, { children: e })] });
|
|
715
|
+
}
|
|
716
|
+
function ot({ target: e, setTarget: t }) {
|
|
717
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
718
|
+
/* @__PURE__ */ w(Z, { children: "Advanced settings" }),
|
|
719
|
+
/* @__PURE__ */ w(tt, { children: "Target: which Word the layout copies. Not ready yet: this setting exists only for testing." }),
|
|
720
|
+
/* @__PURE__ */ T("label", {
|
|
721
|
+
className: "flex items-center gap-3 text-sm",
|
|
722
|
+
children: ["Target", /* @__PURE__ */ w("select", {
|
|
723
|
+
className: "h-9 rounded-md border border-border bg-transparent px-2",
|
|
724
|
+
value: e,
|
|
725
|
+
onChange: (e) => {
|
|
726
|
+
t(e.target.value);
|
|
727
|
+
},
|
|
728
|
+
children: n.map((e) => /* @__PURE__ */ w("option", {
|
|
729
|
+
value: e.id,
|
|
730
|
+
children: e.label
|
|
731
|
+
}, e.id))
|
|
732
|
+
})]
|
|
733
|
+
})
|
|
734
|
+
] });
|
|
735
|
+
}
|
|
736
|
+
function st() {
|
|
737
|
+
let { dialog: e, closeDialog: t, calls: n, target: r, setTarget: i } = X();
|
|
738
|
+
return /* @__PURE__ */ w($e, {
|
|
739
|
+
open: e !== null,
|
|
740
|
+
onOpenChange: (e) => {
|
|
741
|
+
e || t();
|
|
742
|
+
},
|
|
743
|
+
children: /* @__PURE__ */ T(et, {
|
|
744
|
+
onCloseAutoFocus: (e) => {
|
|
745
|
+
e.preventDefault(), n.focusPages();
|
|
746
|
+
},
|
|
747
|
+
children: [
|
|
748
|
+
e === "shortcuts" && /* @__PURE__ */ w(rt, {}),
|
|
749
|
+
e === "about" && /* @__PURE__ */ w(it, {}),
|
|
750
|
+
e === "advanced" && /* @__PURE__ */ w(ot, {
|
|
751
|
+
target: r,
|
|
752
|
+
setTarget: i
|
|
753
|
+
}),
|
|
754
|
+
typeof e == "object" && !!e && /* @__PURE__ */ w(at, { why: e.problem })
|
|
755
|
+
]
|
|
756
|
+
})
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
// src/ui/context-menu.tsx
|
|
760
|
+
var ct = "relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", lt = "f-office-docs-portal z-50 min-w-48 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg", ut = j.Root, dt = j.Trigger;
|
|
761
|
+
function ft({ className: e, ...t }) {
|
|
762
|
+
let n = q();
|
|
763
|
+
return /* @__PURE__ */ w(j.Portal, { children: /* @__PURE__ */ w(j.Content, {
|
|
764
|
+
"data-slot": "context-menu-content",
|
|
765
|
+
"data-f-office-theme": n,
|
|
766
|
+
className: K(lt, e),
|
|
767
|
+
...t
|
|
768
|
+
}) });
|
|
769
|
+
}
|
|
770
|
+
function pt({ className: e, ...t }) {
|
|
771
|
+
return /* @__PURE__ */ w(j.Item, {
|
|
772
|
+
"data-slot": "context-menu-item",
|
|
773
|
+
className: K(ct, e),
|
|
774
|
+
...t
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
function mt({ className: e, ...t }) {
|
|
778
|
+
return /* @__PURE__ */ w(j.Separator, {
|
|
779
|
+
"data-slot": "context-menu-separator",
|
|
780
|
+
className: K("-mx-1 my-1 h-px bg-border", e),
|
|
781
|
+
...t
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
// src/ui/menu-shortcut.tsx
|
|
785
|
+
function ht({ className: e, ...t }) {
|
|
786
|
+
return /* @__PURE__ */ w("span", {
|
|
787
|
+
"data-slot": "menu-shortcut",
|
|
788
|
+
"aria-hidden": "true",
|
|
789
|
+
className: K("ml-auto pl-6 text-xs tracking-widest text-muted-foreground", e),
|
|
790
|
+
...t
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
// src/page-menu.tsx
|
|
794
|
+
function gt(t, n, i) {
|
|
795
|
+
let o = a(navigator.userAgent), s = l(t, o)[0];
|
|
796
|
+
return {
|
|
797
|
+
name: e[t].name,
|
|
798
|
+
key: s,
|
|
799
|
+
aria: r(t, o),
|
|
800
|
+
disabled: n,
|
|
801
|
+
run: i
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function _t(e) {
|
|
805
|
+
let t = e?.link ?? null, n = t && o(t), r = [];
|
|
806
|
+
return t && r.push({
|
|
807
|
+
name: "Open link",
|
|
808
|
+
key: void 0,
|
|
809
|
+
aria: void 0,
|
|
810
|
+
disabled: !1,
|
|
811
|
+
run: (e) => {
|
|
812
|
+
e.followLink(t);
|
|
813
|
+
}
|
|
814
|
+
}), n !== null && r.push({
|
|
815
|
+
name: "Copy link",
|
|
816
|
+
key: void 0,
|
|
817
|
+
aria: void 0,
|
|
818
|
+
disabled: !1,
|
|
819
|
+
run: (e) => {
|
|
820
|
+
e.copyText(n);
|
|
821
|
+
}
|
|
822
|
+
}), [
|
|
823
|
+
...r,
|
|
824
|
+
...t ? [null] : [],
|
|
825
|
+
gt("copy", !e?.selected, (e) => {
|
|
826
|
+
e.copyText(null);
|
|
827
|
+
}),
|
|
828
|
+
gt("select-all", !1, (e) => {
|
|
829
|
+
e.selectAll();
|
|
830
|
+
})
|
|
831
|
+
];
|
|
832
|
+
}
|
|
833
|
+
function vt({ request: e, elementRef: t }) {
|
|
834
|
+
let n = b(null), r = b(null), i = b(null);
|
|
835
|
+
return _(() => {
|
|
836
|
+
if (e) {
|
|
837
|
+
let r = t.current?.shadowRoot?.activeElement ?? null;
|
|
838
|
+
i.current = r instanceof HTMLElement && u(r) ? r : null, n.current?.dispatchEvent(new MouseEvent("contextmenu", {
|
|
839
|
+
bubbles: !0,
|
|
840
|
+
cancelable: !0,
|
|
841
|
+
clientX: e.x,
|
|
842
|
+
clientY: e.y
|
|
843
|
+
}));
|
|
844
|
+
}
|
|
845
|
+
}, [e, t]), /* @__PURE__ */ T(ut, { children: [/* @__PURE__ */ w(dt, {
|
|
846
|
+
ref: n,
|
|
847
|
+
className: "hidden"
|
|
848
|
+
}), /* @__PURE__ */ w(ft, {
|
|
849
|
+
"aria-label": "Page",
|
|
850
|
+
onContextMenu: (e) => {
|
|
851
|
+
e.preventDefault();
|
|
852
|
+
},
|
|
853
|
+
onCloseAutoFocus: (e) => {
|
|
854
|
+
e.preventDefault();
|
|
855
|
+
let n = t.current, a = r.current;
|
|
856
|
+
r.current = null;
|
|
857
|
+
let o = i.current;
|
|
858
|
+
i.current = null, o?.isConnected ? o.focus() : n?.focus(), n && a?.(n);
|
|
859
|
+
},
|
|
860
|
+
children: _t(e).map((e) => e === null ? /* @__PURE__ */ w(mt, {}, "separator") : /* @__PURE__ */ T(pt, {
|
|
861
|
+
disabled: e.disabled,
|
|
862
|
+
"aria-keyshortcuts": e.aria,
|
|
863
|
+
onSelect: () => {
|
|
864
|
+
r.current = e.run;
|
|
865
|
+
},
|
|
866
|
+
children: [e.name, e.key !== void 0 && /* @__PURE__ */ w(ht, { children: e.key })]
|
|
867
|
+
}, e.name))
|
|
868
|
+
})] });
|
|
869
|
+
}
|
|
870
|
+
// src/start.tsx
|
|
871
|
+
function yt() {
|
|
872
|
+
let { calls: e } = X();
|
|
873
|
+
return /* @__PURE__ */ T("div", {
|
|
874
|
+
className: "flex h-full flex-col items-center justify-center gap-10 overflow-auto p-6",
|
|
875
|
+
children: [/* @__PURE__ */ w(nt, { className: "h-10 w-auto sm:h-14" }), /* @__PURE__ */ T("button", {
|
|
876
|
+
type: "button",
|
|
877
|
+
className: "flex w-full max-w-xl flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-border bg-[var(--f-office-drop)] px-6 py-14 text-center hover:border-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
878
|
+
onClick: () => {
|
|
879
|
+
e.run("open");
|
|
880
|
+
},
|
|
881
|
+
children: [
|
|
882
|
+
/* @__PURE__ */ w(ge, {
|
|
883
|
+
className: "size-10 text-primary",
|
|
884
|
+
"aria-hidden": "true"
|
|
885
|
+
}),
|
|
886
|
+
/* @__PURE__ */ w("span", {
|
|
887
|
+
className: "text-lg font-medium",
|
|
888
|
+
children: "Open a DOCX file or drop it here"
|
|
889
|
+
}),
|
|
890
|
+
/* @__PURE__ */ w("span", {
|
|
891
|
+
className: "text-sm text-muted-foreground",
|
|
892
|
+
children: "The file stays in this browser."
|
|
893
|
+
})
|
|
894
|
+
]
|
|
895
|
+
})]
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
// src/docs-canvas.tsx
|
|
899
|
+
function bt({ emptyState: e, className: t }) {
|
|
900
|
+
let { state: n, elementRef: r } = X(), { file: i, dragging: a, generation: o, menu: s, moduleUrls: c, attachElement: l } = Ze(), u = n.progress, d = u?.fraction !== null && u?.fraction !== void 0 ? Math.max(4, Math.min(100, Math.round(u.fraction * 100))) : null;
|
|
901
|
+
return /* @__PURE__ */ T("main", {
|
|
902
|
+
className: K("relative min-h-0 flex-1", t),
|
|
903
|
+
children: [
|
|
904
|
+
i !== null && u !== null && !u.complete && /* @__PURE__ */ w("div", {
|
|
905
|
+
role: "progressbar",
|
|
906
|
+
"aria-label": "Document loading progress",
|
|
907
|
+
"aria-valuemin": 0,
|
|
908
|
+
"aria-valuemax": 100,
|
|
909
|
+
"aria-valuenow": d ?? void 0,
|
|
910
|
+
className: "pointer-events-none absolute inset-x-0 top-0 z-10 h-0.5 overflow-hidden bg-border",
|
|
911
|
+
children: /* @__PURE__ */ w("div", {
|
|
912
|
+
className: K("h-full bg-primary transition-[width] duration-150 ease-out", d === null && "w-1/3 animate-pulse"),
|
|
913
|
+
style: d === null ? void 0 : { width: `${String(d)}%` }
|
|
914
|
+
})
|
|
915
|
+
}),
|
|
916
|
+
/* @__PURE__ */ w("div", {
|
|
917
|
+
className: i === null ? "hidden" : "f-office-docs-holder h-full",
|
|
918
|
+
children: /* @__PURE__ */ w("f-office-docs", {
|
|
919
|
+
ref: l,
|
|
920
|
+
chrome: "none",
|
|
921
|
+
"outline-button": "true",
|
|
922
|
+
className: "h-full",
|
|
923
|
+
...c?.module ? { module: c.module } : {},
|
|
924
|
+
...c?.wasm ? { wasm: c.wasm } : {},
|
|
925
|
+
...c?.dictionaries ? { dictionaries: c.dictionaries } : {}
|
|
926
|
+
}, o)
|
|
927
|
+
}),
|
|
928
|
+
/* @__PURE__ */ w(vt, {
|
|
929
|
+
request: s,
|
|
930
|
+
elementRef: r
|
|
931
|
+
}),
|
|
932
|
+
i === null && (e ?? /* @__PURE__ */ w(yt, {})),
|
|
933
|
+
a && /* @__PURE__ */ w("div", {
|
|
934
|
+
className: "pointer-events-none absolute inset-0 grid place-items-center bg-background/85 text-lg font-medium",
|
|
935
|
+
children: "Drop the file to open it"
|
|
936
|
+
})
|
|
937
|
+
]
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
// src/assets/mark.svg
|
|
941
|
+
var xt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='-256%20-256%20512%20512'%20width='512'%20height='512'%3e%3ctitle%3eF-Office%20mark%3c/title%3e%3cdefs%3e%3c!--%20One%20puzzle%20piece%20(the%20top-left%20one),%20origin%20at%20the%20puzzle%20center.%20The%20other%20three%20pieces%20are%20this%20outline%20rotated%20by%2090,%20180,%20270.%20--%3e%3cpath%20id='piece'%20d='M-134%20-256%20H-3%20A2.5%202.5%200%200%201%20-0.5%20-253.5%20V-185.97%20A17.5%2017.5%200%200%200%2022.45%20-169.34%20A43.5%2043.5%200%201%201%2022.45%20-86.66%20A17.5%2017.5%200%200%200%20-0.5%20-70.03%20V-0.5%20H-70.03%20A16.5%2016.5%200%200%201%20-85.71%20-22.14%20A44.5%2044.5%200%201%200%20-170.29%20-22.14%20A16.5%2016.5%200%200%201%20-185.97%20-0.5%20H-253.5%20A2.5%202.5%200%200%201%20-256%20-3%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20The%20whole%20puzzle%20square:%20drawn%20in%20the%20seam%20color%20under%20the%20pieces,%20and%20used%20to%20keep%20the%20edge%20shading%20inside%20the%20puzzle.%20--%3e%3cpath%20id='plate'%20d='M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3cclipPath%20id='plate-clip'%3e%3cuse%20xlink:href='%23plate'/%3e%3c/clipPath%3e%3cpath%20id='outside'%20fill-rule='evenodd'%20d='M-320%20-320%20H320%20V320%20H-320%20Z%20M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20Piece%20fills:%20light%20at%20the%20top%20left%20of%20every%20piece,%20so%20each%20gradient%20is%20turned%20back%20by%20the%20rotation%20of%20its%20piece.%20--%3e%3clinearGradient%20id='fill-purple'%20x1='-170.31'%20y1='-254.74'%20x2='-1.36'%20y2='5.42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23D697FF'/%3e%3cstop%20offset='0.5'%20stop-color='%237E5AF4'/%3e%3cstop%20offset='1'%20stop-color='%234137C8'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-pink'%20x1='40.82'%20y1='-222.24'%20x2='219.77'%20y2='53.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-90)'%3e%3cstop%20offset='0'%20stop-color='%23FFB0D8'/%3e%3cstop%20offset='0.5'%20stop-color='%23FB5D99'/%3e%3cstop%20offset='1'%20stop-color='%23C71878'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-cyan'%20x1='5.69'%20y1='1.26'%20x2='174.64'%20y2='261.42'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-180)'%3e%3cstop%20offset='0'%20stop-color='%238EF1FC'/%3e%3cstop%20offset='0.5'%20stop-color='%2300CEE7'/%3e%3cstop%20offset='1'%20stop-color='%23009DB7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-orange'%20x1='-215.18'%20y1='-46.24'%20x2='-36.23'%20y2='229.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-270)'%3e%3cstop%20offset='0'%20stop-color='%23FCDD64'/%3e%3cstop%20offset='0.5'%20stop-color='%23FF9525'/%3e%3cstop%20offset='1'%20stop-color='%23F57B20'/%3e%3c/linearGradient%3e%3c!--%20Edge%20shading%20of%20the%20pieces.%20'shade':%20a%20crisp%20dark%20rim%20inside%20the%20edges%20that%20face%20down%20and%20right,%20a%20soft%20band%20behind%20it,%20and%20a%20tight%20shadow%20cast%20onto%20the%20neighbors.%20'light':%20a%20crisp%20light%20rim%20inside%20the%20edges%20that%20face%20up%20and%20left,%20and%20a%20soft%20band%20behind%20it;%20the%20outside%20of%20the%20puzzle%20counts%20as%20filled%20there,%20so%20only%20the%20seams%20get%20it.%20--%3e%3cfilter%20id='shade'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='-1'%20dy='-1'%20result='up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='up'%20operator='out'%20result='dark-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='2'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='-5'%20dy='-5'%20result='soft-up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-up'%20operator='out'%20result='dark-band'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='0.7'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dx='0.8'%20dy='1.2'%20result='tight-off'/%3e%3cfeComposite%20in='tight-off'%20in2='SourceAlpha'%20operator='out'%20result='cast'/%3e%3cfeFlood%20flood-color='%23120C3A'%20flood-opacity='0.15'/%3e%3cfeComposite%20in2='cast'%20operator='in'%20result='cast-shadow'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.1'/%3e%3cfeComposite%20in2='dark-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.4'/%3e%3cfeComposite%20in2='dark-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='cast-shadow'/%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3cfilter%20id='light'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='1'%20dy='1'%20result='down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='down'%20operator='out'%20result='light-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='1.5'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='4'%20dy='4'%20result='soft-down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-down'%20operator='out'%20result='light-band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.38'/%3e%3cfeComposite%20in2='light-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.45'/%3e%3cfeComposite%20in2='light-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3c!--%20Colored%20glow%20and%20contact%20shadow%20under%20the%20pieces%20--%3e%3cfilter%20id='glow'%20x='-40%25'%20y='-40%25'%20width='180%25'%20height='180%25'%20color-interpolation-filters='sRGB'%3e%3cfeGaussianBlur%20in='SourceGraphic'%20stdDeviation='34'%20result='wide'/%3e%3cfeOffset%20in='wide'%20dy='16'%20result='wide-off'/%3e%3cfeComponentTransfer%20in='wide-off'%20result='color-glow'%3e%3cfeFuncA%20type='linear'%20slope='0.5'/%3e%3c/feComponentTransfer%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='9'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dy='10'%20result='tight-off'/%3e%3cfeFlood%20flood-color='%23202848'%20flood-opacity='0.07'/%3e%3cfeComposite%20in2='tight-off'%20operator='in'%20result='contact'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='color-glow'/%3e%3cfeMergeNode%20in='contact'/%3e%3c/feMerge%3e%3c/filter%3e%3c/defs%3e%3cg%20id='puzzle'%3e%3cg%20id='puzzle-glow'%20filter='url(%23glow)'%20clip-path='url(%23plate-clip)'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='pieces'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='edge-shade'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='edge-light'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
|
|
942
|
+
// src/chrome.ts
|
|
943
|
+
function St(e) {
|
|
944
|
+
return `${String(Math.round(e * 100))}%`;
|
|
945
|
+
}
|
|
946
|
+
function Ct(e, t) {
|
|
947
|
+
let n = [
|
|
948
|
+
{
|
|
949
|
+
value: "fit-width",
|
|
950
|
+
label: "Fit width"
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
value: "fit-page",
|
|
954
|
+
label: "Fit page"
|
|
955
|
+
},
|
|
956
|
+
...e.map((e) => ({
|
|
957
|
+
value: c(e),
|
|
958
|
+
label: St(e)
|
|
959
|
+
}))
|
|
960
|
+
];
|
|
961
|
+
return t.startsWith("fixed:") && !n.some((e) => e.value === t) && n.push({
|
|
962
|
+
value: t,
|
|
963
|
+
label: St(Number(t.slice(6)))
|
|
964
|
+
}), n;
|
|
965
|
+
}
|
|
966
|
+
// src/ui/menubar.tsx
|
|
967
|
+
var wt = "relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", Tt = "f-office-docs-portal z-50 min-w-48 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg";
|
|
968
|
+
function Et(e) {
|
|
969
|
+
return /* @__PURE__ */ w(N.Menu, { ...e });
|
|
970
|
+
}
|
|
971
|
+
function Dt(e) {
|
|
972
|
+
return /* @__PURE__ */ w(N.Sub, { ...e });
|
|
973
|
+
}
|
|
974
|
+
function Ot(e) {
|
|
975
|
+
return /* @__PURE__ */ w(N.RadioGroup, { ...e });
|
|
976
|
+
}
|
|
977
|
+
function kt({ className: e, ...t }) {
|
|
978
|
+
return /* @__PURE__ */ w(N.Root, {
|
|
979
|
+
"data-slot": "menubar",
|
|
980
|
+
className: K("flex items-center gap-0.5", e),
|
|
981
|
+
...t
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
function At({ className: e, ...t }) {
|
|
985
|
+
return /* @__PURE__ */ w(N.Trigger, {
|
|
986
|
+
"data-slot": "menubar-trigger",
|
|
987
|
+
className: K("rounded px-1.5 py-0.5 text-sm outline-none hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-[highlighted]:bg-accent data-[state=open]:bg-accent", e),
|
|
988
|
+
...t
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
function jt({ className: e, align: t = "start", sideOffset: n = 4, ...r }) {
|
|
992
|
+
let i = q();
|
|
993
|
+
return /* @__PURE__ */ w(N.Portal, { children: /* @__PURE__ */ w(N.Content, {
|
|
994
|
+
"data-slot": "menubar-content",
|
|
995
|
+
"data-f-office-theme": i,
|
|
996
|
+
align: t,
|
|
997
|
+
sideOffset: n,
|
|
998
|
+
className: K(Tt, e),
|
|
999
|
+
...r
|
|
1000
|
+
}) });
|
|
1001
|
+
}
|
|
1002
|
+
function Mt({ className: e, ...t }) {
|
|
1003
|
+
return /* @__PURE__ */ w(N.Item, {
|
|
1004
|
+
"data-slot": "menubar-item",
|
|
1005
|
+
className: K(wt, e),
|
|
1006
|
+
...t
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
function Nt({ className: e, children: t, ...n }) {
|
|
1010
|
+
return /* @__PURE__ */ T(N.CheckboxItem, {
|
|
1011
|
+
"data-slot": "menubar-checkbox-item",
|
|
1012
|
+
className: K(wt, "pl-8", e),
|
|
1013
|
+
...n,
|
|
1014
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1015
|
+
className: "absolute left-2 flex size-4 items-center justify-center",
|
|
1016
|
+
children: /* @__PURE__ */ w(N.ItemIndicator, { children: /* @__PURE__ */ w(E, { className: "size-4" }) })
|
|
1017
|
+
}), t]
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
function Pt({ className: e, children: t, ...n }) {
|
|
1021
|
+
return /* @__PURE__ */ T(N.RadioItem, {
|
|
1022
|
+
"data-slot": "menubar-radio-item",
|
|
1023
|
+
className: K(wt, "pl-8", e),
|
|
1024
|
+
...n,
|
|
1025
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1026
|
+
className: "absolute left-2 flex size-4 items-center justify-center",
|
|
1027
|
+
children: /* @__PURE__ */ w(N.ItemIndicator, { children: /* @__PURE__ */ w(D, { className: "size-2 fill-current" }) })
|
|
1028
|
+
}), t]
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
function Ft({ className: e, children: t, ...n }) {
|
|
1032
|
+
return /* @__PURE__ */ T(N.SubTrigger, {
|
|
1033
|
+
"data-slot": "menubar-sub-trigger",
|
|
1034
|
+
className: K(wt, "data-[state=open]:bg-accent", e),
|
|
1035
|
+
...n,
|
|
1036
|
+
children: [t, /* @__PURE__ */ w(he, { className: "ml-auto size-4" })]
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
function It({ className: e, ...t }) {
|
|
1040
|
+
let n = q();
|
|
1041
|
+
return /* @__PURE__ */ w(N.Portal, { children: /* @__PURE__ */ w(N.SubContent, {
|
|
1042
|
+
"data-slot": "menubar-sub-content",
|
|
1043
|
+
"data-f-office-theme": n,
|
|
1044
|
+
className: K(Tt, "min-w-36", e),
|
|
1045
|
+
...t
|
|
1046
|
+
}) });
|
|
1047
|
+
}
|
|
1048
|
+
function Lt({ className: e, ...t }) {
|
|
1049
|
+
return /* @__PURE__ */ w(N.Separator, {
|
|
1050
|
+
"data-slot": "menubar-separator",
|
|
1051
|
+
className: K("-mx-1 my-1 h-px bg-border", e),
|
|
1052
|
+
...t
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
function Rt({ className: e, ...t }) {
|
|
1056
|
+
return /* @__PURE__ */ w(N.Label, {
|
|
1057
|
+
"data-slot": "menubar-label",
|
|
1058
|
+
className: K("px-2 py-1.5 text-xs text-muted-foreground", e),
|
|
1059
|
+
...t
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
// src/menus.tsx
|
|
1063
|
+
function Q({ id: t, state: n, calls: o, choice: s }) {
|
|
1064
|
+
let c = a(navigator.userAgent), u = l(t, c)[0], d = !i(t, n.name !== null, n.selected);
|
|
1065
|
+
return /* @__PURE__ */ T(Mt, {
|
|
1066
|
+
disabled: d,
|
|
1067
|
+
"aria-keyshortcuts": r(t, c),
|
|
1068
|
+
onSelect: () => {
|
|
1069
|
+
s.choose(() => {
|
|
1070
|
+
o.run(t);
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
children: [e[t].name, u !== void 0 && /* @__PURE__ */ w(ht, { children: u })]
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
function $({ title: e, calls: t, choice: n, children: r }) {
|
|
1077
|
+
return /* @__PURE__ */ T(Et, { children: [/* @__PURE__ */ w(At, { children: e }), /* @__PURE__ */ w(jt, {
|
|
1078
|
+
onCloseAutoFocus: (e) => {
|
|
1079
|
+
let r = n.take();
|
|
1080
|
+
r && (e.preventDefault(), t.focusPages(), r());
|
|
1081
|
+
},
|
|
1082
|
+
children: r
|
|
1083
|
+
})] });
|
|
1084
|
+
}
|
|
1085
|
+
function zt(e) {
|
|
1086
|
+
let { state: t } = e;
|
|
1087
|
+
return /* @__PURE__ */ T($, {
|
|
1088
|
+
title: "File",
|
|
1089
|
+
calls: e.calls,
|
|
1090
|
+
choice: e.choice,
|
|
1091
|
+
children: [
|
|
1092
|
+
/* @__PURE__ */ w(Q, {
|
|
1093
|
+
id: "open",
|
|
1094
|
+
...e
|
|
1095
|
+
}),
|
|
1096
|
+
/* @__PURE__ */ w(Q, {
|
|
1097
|
+
id: "download",
|
|
1098
|
+
...e
|
|
1099
|
+
}),
|
|
1100
|
+
/* @__PURE__ */ w(Q, {
|
|
1101
|
+
id: "print",
|
|
1102
|
+
...e
|
|
1103
|
+
}),
|
|
1104
|
+
/* @__PURE__ */ w(Q, {
|
|
1105
|
+
id: "close",
|
|
1106
|
+
...e
|
|
1107
|
+
}),
|
|
1108
|
+
t.note && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Lt, {}), /* @__PURE__ */ w(Rt, {
|
|
1109
|
+
className: "max-w-64",
|
|
1110
|
+
children: t.note
|
|
1111
|
+
})] })
|
|
1112
|
+
]
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
function Bt(e) {
|
|
1116
|
+
return /* @__PURE__ */ T($, {
|
|
1117
|
+
title: "Edit",
|
|
1118
|
+
calls: e.calls,
|
|
1119
|
+
choice: e.choice,
|
|
1120
|
+
children: [
|
|
1121
|
+
/* @__PURE__ */ w(Q, {
|
|
1122
|
+
id: "copy",
|
|
1123
|
+
...e
|
|
1124
|
+
}),
|
|
1125
|
+
/* @__PURE__ */ w(Q, {
|
|
1126
|
+
id: "select-all",
|
|
1127
|
+
...e
|
|
1128
|
+
}),
|
|
1129
|
+
/* @__PURE__ */ w(Lt, {}),
|
|
1130
|
+
/* @__PURE__ */ w(Q, {
|
|
1131
|
+
id: "find",
|
|
1132
|
+
...e
|
|
1133
|
+
})
|
|
1134
|
+
]
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
function Vt(e) {
|
|
1138
|
+
let { state: t, calls: n } = e;
|
|
1139
|
+
return /* @__PURE__ */ T(Dt, { children: [/* @__PURE__ */ w(Ft, {
|
|
1140
|
+
disabled: t.name === null,
|
|
1141
|
+
children: "Zoom"
|
|
1142
|
+
}), /* @__PURE__ */ T(It, { children: [
|
|
1143
|
+
/* @__PURE__ */ w(Q, {
|
|
1144
|
+
id: "zoom-in",
|
|
1145
|
+
...e
|
|
1146
|
+
}),
|
|
1147
|
+
/* @__PURE__ */ w(Q, {
|
|
1148
|
+
id: "zoom-out",
|
|
1149
|
+
...e
|
|
1150
|
+
}),
|
|
1151
|
+
/* @__PURE__ */ w(Q, {
|
|
1152
|
+
id: "actual-size",
|
|
1153
|
+
...e
|
|
1154
|
+
}),
|
|
1155
|
+
/* @__PURE__ */ w(Lt, {}),
|
|
1156
|
+
/* @__PURE__ */ w(Ot, {
|
|
1157
|
+
value: t.zoom,
|
|
1158
|
+
onValueChange: (t) => {
|
|
1159
|
+
e.choice.choose(() => {
|
|
1160
|
+
n.setZoom(t);
|
|
1161
|
+
});
|
|
1162
|
+
},
|
|
1163
|
+
children: Ct(t.zoomSteps, t.zoom).map((e) => /* @__PURE__ */ w(Pt, {
|
|
1164
|
+
value: e.value,
|
|
1165
|
+
children: e.label
|
|
1166
|
+
}, e.value))
|
|
1167
|
+
})
|
|
1168
|
+
] })] });
|
|
1169
|
+
}
|
|
1170
|
+
var Ht = {
|
|
1171
|
+
open: "Open fonts",
|
|
1172
|
+
installed: "Installed fonts"
|
|
1173
|
+
};
|
|
1174
|
+
function Ut({ state: e, calls: t, choice: n }) {
|
|
1175
|
+
return /* @__PURE__ */ T(Dt, { children: [/* @__PURE__ */ w(Ft, { children: "Fonts" }), /* @__PURE__ */ T(It, { children: [/* @__PURE__ */ T(Ot, {
|
|
1176
|
+
value: e.fonts,
|
|
1177
|
+
onValueChange: (e) => {
|
|
1178
|
+
n.choose(() => {
|
|
1179
|
+
t.setFonts(e);
|
|
1180
|
+
});
|
|
1181
|
+
},
|
|
1182
|
+
children: [/* @__PURE__ */ w(Pt, {
|
|
1183
|
+
value: "open",
|
|
1184
|
+
children: Ht.open
|
|
1185
|
+
}), /* @__PURE__ */ w(Pt, {
|
|
1186
|
+
value: "installed",
|
|
1187
|
+
disabled: !e.installedFonts,
|
|
1188
|
+
children: Ht.installed
|
|
1189
|
+
})]
|
|
1190
|
+
}), !e.installedFonts && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Lt, {}), /* @__PURE__ */ w(Rt, {
|
|
1191
|
+
className: "max-w-64 font-normal text-muted-foreground",
|
|
1192
|
+
children: d()
|
|
1193
|
+
})] })] })] });
|
|
1194
|
+
}
|
|
1195
|
+
function Wt(e) {
|
|
1196
|
+
let { state: t, calls: n } = e;
|
|
1197
|
+
return /* @__PURE__ */ T($, {
|
|
1198
|
+
title: "View",
|
|
1199
|
+
calls: n,
|
|
1200
|
+
choice: e.choice,
|
|
1201
|
+
children: [
|
|
1202
|
+
/* @__PURE__ */ w(Nt, {
|
|
1203
|
+
disabled: t.name === null,
|
|
1204
|
+
checked: t.outline,
|
|
1205
|
+
onCheckedChange: (t) => {
|
|
1206
|
+
e.choice.choose(() => {
|
|
1207
|
+
n.setOutline(t);
|
|
1208
|
+
});
|
|
1209
|
+
},
|
|
1210
|
+
children: "Outline"
|
|
1211
|
+
}),
|
|
1212
|
+
/* @__PURE__ */ w(Vt, { ...e }),
|
|
1213
|
+
/* @__PURE__ */ w(Ut, { ...e }),
|
|
1214
|
+
/* @__PURE__ */ T(Dt, { children: [/* @__PURE__ */ w(Ft, { children: "Theme" }), /* @__PURE__ */ w(It, { children: /* @__PURE__ */ w(Ot, {
|
|
1215
|
+
value: t.theme,
|
|
1216
|
+
onValueChange: (t) => {
|
|
1217
|
+
e.choice.choose(() => {
|
|
1218
|
+
n.setTheme(t);
|
|
1219
|
+
});
|
|
1220
|
+
},
|
|
1221
|
+
children: W.map((e) => /* @__PURE__ */ w(Pt, {
|
|
1222
|
+
value: e,
|
|
1223
|
+
children: G[e]
|
|
1224
|
+
}, e))
|
|
1225
|
+
}) })] })
|
|
1226
|
+
]
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
function Gt({ className: e }) {
|
|
1230
|
+
let { state: t, calls: n } = X(), r = b(null), i = {
|
|
1231
|
+
choose: (e) => {
|
|
1232
|
+
r.current = e;
|
|
1233
|
+
},
|
|
1234
|
+
take: () => {
|
|
1235
|
+
let e = r.current;
|
|
1236
|
+
return r.current = null, e;
|
|
1237
|
+
}
|
|
1238
|
+
}, a = {
|
|
1239
|
+
state: t,
|
|
1240
|
+
calls: n,
|
|
1241
|
+
choice: i
|
|
1242
|
+
};
|
|
1243
|
+
return /* @__PURE__ */ T(kt, {
|
|
1244
|
+
"aria-label": "Menus",
|
|
1245
|
+
className: e ?? "-ml-1.5",
|
|
1246
|
+
children: [
|
|
1247
|
+
/* @__PURE__ */ w(zt, { ...a }),
|
|
1248
|
+
/* @__PURE__ */ w(Bt, { ...a }),
|
|
1249
|
+
/* @__PURE__ */ w(Wt, { ...a }),
|
|
1250
|
+
/* @__PURE__ */ w($, {
|
|
1251
|
+
title: "Tools",
|
|
1252
|
+
calls: n,
|
|
1253
|
+
choice: i,
|
|
1254
|
+
children: /* @__PURE__ */ w(Q, {
|
|
1255
|
+
id: "advanced",
|
|
1256
|
+
...a
|
|
1257
|
+
})
|
|
1258
|
+
}),
|
|
1259
|
+
/* @__PURE__ */ T($, {
|
|
1260
|
+
title: "Help",
|
|
1261
|
+
calls: n,
|
|
1262
|
+
choice: i,
|
|
1263
|
+
children: [/* @__PURE__ */ w(Q, {
|
|
1264
|
+
id: "shortcuts",
|
|
1265
|
+
...a
|
|
1266
|
+
}), /* @__PURE__ */ w(Q, {
|
|
1267
|
+
id: "about",
|
|
1268
|
+
...a
|
|
1269
|
+
})]
|
|
1270
|
+
})
|
|
1271
|
+
]
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
// src/header.tsx
|
|
1275
|
+
var Kt = {
|
|
1276
|
+
system: k,
|
|
1277
|
+
light: ve,
|
|
1278
|
+
dark: _e
|
|
1279
|
+
};
|
|
1280
|
+
function qt({ className: e, alt: t = "" }) {
|
|
1281
|
+
return /* @__PURE__ */ w("img", {
|
|
1282
|
+
src: xt,
|
|
1283
|
+
alt: t,
|
|
1284
|
+
className: K("size-10 p-1", e)
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
function Jt({ className: e }) {
|
|
1288
|
+
let { state: t, calls: n } = X();
|
|
1289
|
+
return t.name === null || t.outline ? null : /* @__PURE__ */ w("button", {
|
|
1290
|
+
type: "button",
|
|
1291
|
+
className: K("grid size-10 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring sm:hidden", e),
|
|
1292
|
+
"aria-label": "Show outline",
|
|
1293
|
+
title: "Show outline",
|
|
1294
|
+
onClick: () => {
|
|
1295
|
+
n.setOutline(!0);
|
|
1296
|
+
},
|
|
1297
|
+
children: /* @__PURE__ */ w(O, { className: "size-5" })
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
function Yt({ fallback: e = "F-Office Docs", className: t }) {
|
|
1301
|
+
let { state: n } = X();
|
|
1302
|
+
return /* @__PURE__ */ T("div", {
|
|
1303
|
+
className: K("min-w-0 flex-1", t),
|
|
1304
|
+
children: [/* @__PURE__ */ w("h1", {
|
|
1305
|
+
className: "truncate text-lg leading-6",
|
|
1306
|
+
children: n.name ?? e
|
|
1307
|
+
}), /* @__PURE__ */ w(Gt, {})]
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
function Xt({ className: e }) {
|
|
1311
|
+
let { state: t, calls: n } = X();
|
|
1312
|
+
return t.name === null ? null : /* @__PURE__ */ T("div", {
|
|
1313
|
+
className: K("hidden shrink-0 items-center gap-3 text-sm text-muted-foreground md:flex", e),
|
|
1314
|
+
children: [/* @__PURE__ */ T("span", { children: [
|
|
1315
|
+
"Page ",
|
|
1316
|
+
t.page + 1,
|
|
1317
|
+
" of ",
|
|
1318
|
+
t.pageCount,
|
|
1319
|
+
t.layoutComplete ? "" : "…"
|
|
1320
|
+
] }), /* @__PURE__ */ w("select", {
|
|
1321
|
+
"aria-label": "Zoom",
|
|
1322
|
+
className: "h-8 rounded-md border border-border bg-transparent px-2 text-foreground",
|
|
1323
|
+
value: t.zoom,
|
|
1324
|
+
onChange: (e) => {
|
|
1325
|
+
n.setZoom(e.target.value);
|
|
1326
|
+
},
|
|
1327
|
+
children: Ct(t.zoomSteps, t.zoom).map((e) => /* @__PURE__ */ w("option", {
|
|
1328
|
+
value: e.value,
|
|
1329
|
+
children: e.label
|
|
1330
|
+
}, e.value))
|
|
1331
|
+
})]
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
function Zt({ className: e }) {
|
|
1335
|
+
let { state: t, calls: n } = X(), r = Kt[t.theme], i = `Theme: ${G[t.theme]}`;
|
|
1336
|
+
return /* @__PURE__ */ w("button", {
|
|
1337
|
+
type: "button",
|
|
1338
|
+
className: K("grid size-10 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring", e),
|
|
1339
|
+
"aria-label": i,
|
|
1340
|
+
title: i,
|
|
1341
|
+
onClick: () => {
|
|
1342
|
+
n.setTheme(Fe(t.theme));
|
|
1343
|
+
},
|
|
1344
|
+
children: /* @__PURE__ */ w(r, { className: "size-5" })
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
function Qt({ className: e }) {
|
|
1348
|
+
let { calls: t } = X();
|
|
1349
|
+
return /* @__PURE__ */ T("button", {
|
|
1350
|
+
type: "button",
|
|
1351
|
+
className: K("h-10 shrink-0 rounded-full bg-primary px-4 text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring sm:px-5", e),
|
|
1352
|
+
"aria-label": "Open a DOCX file",
|
|
1353
|
+
onClick: () => {
|
|
1354
|
+
t.run("open");
|
|
1355
|
+
},
|
|
1356
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1357
|
+
className: "hidden sm:inline",
|
|
1358
|
+
children: "Open a DOCX file"
|
|
1359
|
+
}), /* @__PURE__ */ w("span", {
|
|
1360
|
+
className: "sm:hidden",
|
|
1361
|
+
children: "Open"
|
|
1362
|
+
})]
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
function $t({ className: e }) {
|
|
1366
|
+
return /* @__PURE__ */ T("header", {
|
|
1367
|
+
className: K("flex h-16 shrink-0 items-center gap-2 px-3 sm:gap-3 sm:px-4", e),
|
|
1368
|
+
children: [
|
|
1369
|
+
/* @__PURE__ */ w(qt, { className: "shrink-0" }),
|
|
1370
|
+
/* @__PURE__ */ w(Jt, {}),
|
|
1371
|
+
/* @__PURE__ */ w(Yt, {}),
|
|
1372
|
+
/* @__PURE__ */ w(Xt, {}),
|
|
1373
|
+
/* @__PURE__ */ w(Zt, {}),
|
|
1374
|
+
/* @__PURE__ */ w(Qt, {})
|
|
1375
|
+
]
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
// src/docs-app.tsx
|
|
1379
|
+
function en(e) {
|
|
1380
|
+
return /* @__PURE__ */ T(Qe, {
|
|
1381
|
+
...e,
|
|
1382
|
+
children: [
|
|
1383
|
+
/* @__PURE__ */ w($t, {}),
|
|
1384
|
+
/* @__PURE__ */ w(bt, {}),
|
|
1385
|
+
/* @__PURE__ */ w(st, {})
|
|
1386
|
+
]
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
// src/f-office-docs.tsx
|
|
1390
|
+
function tn(e, t) {
|
|
1391
|
+
if (e) {
|
|
1392
|
+
if (typeof e == "function") return e(t) ?? void 0;
|
|
1393
|
+
e.current = t;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
function nn({ ref: e, source: t, name: n, zoom: r, target: i, chrome: a = "none", outlineButton: o, readOnly: s = !0, outlineOpen: c, fontSource: l, highlights: u, moduleUrls: d, className: f, style: ee, onOpen: te, onPagesChange: ne, onProgress: re, onViewChange: ie, onPageChange: p, onOutlineChange: ae, onSelectionChange: m, onMenu: h, onError: y }) {
|
|
1397
|
+
le();
|
|
1398
|
+
let x = b(null), oe = v((e) => {
|
|
1399
|
+
te?.(e.detail);
|
|
1400
|
+
}), se = v((e) => {
|
|
1401
|
+
ne?.(e.detail);
|
|
1402
|
+
}), ce = v((e) => {
|
|
1403
|
+
re?.(e.detail);
|
|
1404
|
+
}), ue = v((e) => {
|
|
1405
|
+
ie?.(e.detail);
|
|
1406
|
+
}), de = v((e) => {
|
|
1407
|
+
p?.(e.detail);
|
|
1408
|
+
}), fe = v((e) => {
|
|
1409
|
+
ae?.(e.detail);
|
|
1410
|
+
}), pe = v((e) => {
|
|
1411
|
+
m?.(e.detail);
|
|
1412
|
+
}), me = v((e) => {
|
|
1413
|
+
h && (e.preventDefault(), h(e.detail));
|
|
1414
|
+
}), S = v((e) => {
|
|
1415
|
+
y?.(e.detail);
|
|
1416
|
+
}), C = v((e) => {
|
|
1417
|
+
c !== void 0 && (e.outlineOpen = c), u !== void 0 && e.setDocsHighlights(u);
|
|
1418
|
+
}), T = g((t) => {
|
|
1419
|
+
x.current = t;
|
|
1420
|
+
let n = tn(e, t);
|
|
1421
|
+
return () => {
|
|
1422
|
+
x.current = null, typeof n == "function" ? n() : tn(e, null);
|
|
1423
|
+
};
|
|
1424
|
+
}, [e]);
|
|
1425
|
+
return _(() => {
|
|
1426
|
+
let e = x.current;
|
|
1427
|
+
if (e) return e.addEventListener("open", oe), e.addEventListener("pageschange", se), e.addEventListener("progress", ce), e.addEventListener("viewchange", ue), e.addEventListener("pagechange", de), e.addEventListener("outlinechange", fe), e.addEventListener("selectionchange", pe), e.addEventListener("menu", me), e.addEventListener("error", S), () => {
|
|
1428
|
+
e.removeEventListener("open", oe), e.removeEventListener("pageschange", se), e.removeEventListener("progress", ce), e.removeEventListener("viewchange", ue), e.removeEventListener("pagechange", de), e.removeEventListener("outlinechange", fe), e.removeEventListener("selectionchange", pe), e.removeEventListener("menu", me), e.removeEventListener("error", S);
|
|
1429
|
+
};
|
|
1430
|
+
}, []), _(() => {
|
|
1431
|
+
let e = x.current;
|
|
1432
|
+
e && (e.readOnly = s);
|
|
1433
|
+
}, [s]), _(() => {
|
|
1434
|
+
let e = x.current;
|
|
1435
|
+
e && l !== void 0 && (e.fontSource = l);
|
|
1436
|
+
}, [l]), _(() => {
|
|
1437
|
+
let e = x.current;
|
|
1438
|
+
e && c !== void 0 && (e.outlineOpen = c);
|
|
1439
|
+
}, [c]), _(() => {
|
|
1440
|
+
let e = x.current;
|
|
1441
|
+
e && i !== void 0 && (e.target = i);
|
|
1442
|
+
}, [i]), _(() => {
|
|
1443
|
+
let e = x.current;
|
|
1444
|
+
e && u !== void 0 && e.setDocsHighlights(u);
|
|
1445
|
+
}, [u]), _(() => {
|
|
1446
|
+
let e = x.current;
|
|
1447
|
+
if (!e) return;
|
|
1448
|
+
if (!t) {
|
|
1449
|
+
e.close().catch(() => void 0);
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
let r = !1;
|
|
1453
|
+
return e.openSource(t, n).then(() => {
|
|
1454
|
+
r || C(e);
|
|
1455
|
+
}).catch(() => void 0), () => {
|
|
1456
|
+
r = !0;
|
|
1457
|
+
};
|
|
1458
|
+
}, [t, n]), /* @__PURE__ */ w("f-office-docs", {
|
|
1459
|
+
ref: T,
|
|
1460
|
+
chrome: a,
|
|
1461
|
+
"read-only": s ? "true" : "false",
|
|
1462
|
+
...r === void 0 ? {} : { zoom: String(r) },
|
|
1463
|
+
...o === void 0 ? {} : { "outline-button": o ? "true" : "false" },
|
|
1464
|
+
...i ? { target: i } : {},
|
|
1465
|
+
...d?.module ? { module: d.module } : {},
|
|
1466
|
+
...d?.wasm ? { wasm: d.wasm } : {},
|
|
1467
|
+
...d?.dictionaries ? { dictionaries: d.dictionaries } : {},
|
|
1468
|
+
className: f,
|
|
1469
|
+
style: {
|
|
1470
|
+
display: "block",
|
|
1471
|
+
width: "100%",
|
|
1472
|
+
height: "100%",
|
|
1473
|
+
...ee
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
export { ke as DEFAULT_THEME_STORAGE_KEY, en as DocsApp, bt as DocsCanvas, st as DocsDialogs, $t as DocsHeader, qt as DocsMark, Gt as DocsMenuBar, Qt as DocsOpenButton, Jt as DocsOutlineButton, Xt as DocsPageControls, Qe as DocsProvider, yt as DocsStart, Zt as DocsThemeButton, Yt as DocsTitle, nt as DocsWordmark, Le as FILE_PARAMETER, nn as FOfficeDocs, P as KEEP_LIMIT, Se as KEEP_NOTES, L as Keeper, W as THEMES, G as THEME_NAMES, xe as VIEW_DELAY, Pe as applyTheme, ze as askedFile, Ee as browserSlots, H as databaseSlots, Ve as dropFileParameter, Be as fetchAskedFile, J as fileName, z as folderSlots, Me as loadTheme, Fe as nextTheme, Te as openDatabase, Ne as saveTheme, X as useDocs, Ct as zoomOptions };
|