@sheetxl/studio-mui 0.8.0-beta.10 → 0.8.0-beta.12

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 (150) hide show
  1. package/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → 0IBZhOJaVmzJxuTv.mjs} +1 -1
  2. package/browser/esm/2nRxqrNYbmEn8fS8.mjs +386 -0
  3. package/browser/esm/{fb126BNj3F8URR19.mjs → 7fVZXXuonYb6Z7FU.mjs} +3 -3
  4. package/browser/esm/BAzhmMX4Fk_qnUTp.mjs +414 -0
  5. package/browser/esm/BGL3x0W74D7qZXlf.mjs +318 -0
  6. package/browser/esm/BHGr2gsFofTdAFxq.mjs +515 -0
  7. package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BKhcJI-G15D3kGap.mjs} +4 -4
  8. package/browser/esm/BNbub9weuqm3mcoF.mjs +335 -0
  9. package/browser/esm/BSv9MVJaz1DVEffm.mjs +975 -0
  10. package/browser/esm/BWfLpYmd3cSgJ0C6.mjs +141 -0
  11. package/browser/esm/BZqwbIE8qzjSOYcJ.mjs +582 -0
  12. package/browser/esm/BZy9xUrYpAtnKeji.mjs +1288 -0
  13. package/browser/esm/{CIu1bjPJe_x31Oww.mjs → BnkwC5rsg9LZyhoP.mjs} +3 -3
  14. package/browser/esm/BpJsBv413cNQpyg0.mjs +319 -0
  15. package/browser/esm/BpVrgbVISiTDyFR3.mjs +197 -0
  16. package/browser/esm/BsngRDhvVYGVBJeK.mjs +1546 -0
  17. package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → C29TKq47CbXs652l.mjs} +2 -2
  18. package/browser/esm/{CEvZe2cZK-voZTif.mjs → C8p2iMad_NNCwGI_.mjs} +5 -5
  19. package/browser/esm/CBzXksWnb-1gGEWZ.mjs +212 -0
  20. package/browser/esm/{IQLeaAbtGTipUsOD.mjs → CFIAWgpU3UyepLBn.mjs} +25 -24
  21. package/browser/esm/CJD4jF4m9cBGHzr_.mjs +31 -0
  22. package/browser/esm/{CjznclrKqJRi7u9O.mjs → CMc7G7cevxzPGxr9.mjs} +2 -2
  23. package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → CYtULLhY9M2m3DeH.mjs} +1 -1
  24. package/browser/esm/CeF35ZeFP28Do5Zx.mjs +1379 -0
  25. package/browser/esm/{xKiLJKiLxto8SayF.mjs → CjYKDxU4EP2Kf_vo.mjs} +2 -2
  26. package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → Cq82lvdjyBvlJ8xJ.mjs} +19 -17
  27. package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → CuRxFAO42JkQvMEx.mjs} +1 -1
  28. package/browser/esm/Cvk2yY90hpgXWMAt.mjs +103 -0
  29. package/browser/esm/D0slJycx3nq53qmf.mjs +14 -0
  30. package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → D2jzliMwAo2ENpfi.mjs} +1 -1
  31. package/browser/esm/D5Fn0Hqllwv5HY6i.mjs +7581 -0
  32. package/browser/esm/D5N4nGaZsXtrHAOh.mjs +831 -0
  33. package/browser/esm/D7AqPfyhMiuda5l5.mjs +412 -0
  34. package/browser/esm/DHZA48ZMCETvHmeP.mjs +161 -0
  35. package/browser/esm/DX2_vf7WX6uRLaOZ.mjs +94 -0
  36. package/browser/esm/DaxpbAF1ShkT7hNU.mjs +490 -0
  37. package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → Db3oHfXiRtcH015t.mjs} +162 -156
  38. package/browser/esm/Dt47Huh1l3C4_5_w.mjs +87 -0
  39. package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → DtPt0phL7m56YfHZ.mjs} +1 -1
  40. package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → DtTDaXmnWUoG4VBO.mjs} +2 -2
  41. package/browser/esm/{DHY19rkSiiRZxShC.mjs → DuuyN4-7K6_io2Py.mjs} +3 -3
  42. package/browser/esm/{yZxC4qUENOlMhVUH.mjs → NeGeLF3gbGMZyV6E.mjs} +1 -1
  43. package/browser/esm/PY3Br5Bo_TxcCnCU.mjs +252 -0
  44. package/browser/esm/WIhvQtBkGiw-oFUs.mjs +2566 -0
  45. package/browser/esm/WgIvwAENeO8LANax.mjs +437 -0
  46. package/browser/esm/{DBtc4lku0uHVcqWn.mjs → Yjq3p_7eVGFw2Jod.mjs} +3 -3
  47. package/browser/esm/index.mjs +1053 -192
  48. package/browser/esm/jFRFCWlkD7Dsrhkh.mjs +236 -0
  49. package/browser/esm/lKXEDVt2ow1NlWJj.mjs +392 -0
  50. package/browser/esm/{Blaj2R5hYxtLAW__.mjs → oC0OwOddhOD0OoCJ.mjs} +6 -6
  51. package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → tIKqpsA0vNXH9EgU.mjs} +1 -1
  52. package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → u84rSnESjxqB6gay.mjs} +1 -1
  53. package/licenses/dependencies.txt +94 -94
  54. package/node/esm/{BcwMb6CyVfvEwbHn.mjs → B8Ls4Eh1k8-Yiry_.mjs} +1 -1
  55. package/node/esm/{CKu1AtRgyltyEdEN.mjs → B9X3n8MglL4OitAV.mjs} +1 -1
  56. package/node/esm/{ETK6T6G0SIcFXDe5.mjs → BBGoyqs2L_ccSH1e.mjs} +40 -40
  57. package/node/esm/BLv99aovW4R3C5PE.mjs +515 -0
  58. package/node/esm/BUGU_5lUtnCRlp3n.mjs +519 -0
  59. package/node/esm/BalROFG_oa9PFs9Q.mjs +141 -0
  60. package/node/esm/{ah3CUg4-VmNstGk_.mjs → BqVxnA1mo52ubjdf.mjs} +2 -2
  61. package/node/esm/C3FCh9xju2SccUIE.mjs +1283 -0
  62. package/node/esm/{Bb1sLMqXWKjdve23.mjs → C4F6WY8M4nkLyxdb.mjs} +2 -2
  63. package/node/esm/CKWeipCqqpLnLE5e.mjs +391 -0
  64. package/node/esm/CTnVNfz4eqFnM92M.mjs +212 -0
  65. package/node/esm/Cfi_ly8fBDZZdiZT.mjs +72 -0
  66. package/node/esm/CgKa6JuyJ1tTodev.mjs +1703 -0
  67. package/node/esm/{cqzp431iNSLWictb.mjs → Cq53M7bAUSXMNq1f.mjs} +22 -22
  68. package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → Cr8AYWUoU-XVt0hu.mjs} +1 -1
  69. package/node/esm/CyuOE595I2e-U4cG.mjs +236 -0
  70. package/node/esm/D72CupF9mfy2D1Xa.mjs +94 -0
  71. package/node/esm/{DNSjK5DAH3M14Qbc.mjs → DGDHFK8okuVbRCe5.mjs} +1 -1
  72. package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DJFkALt4XrwkMbnU.mjs} +163 -157
  73. package/node/esm/DJpwI8PlKBI2rk0r.mjs +319 -0
  74. package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DQaGPUYbgL4Y5YZW.mjs} +32 -30
  75. package/node/esm/{D9rzScOA9pEYFrtz.mjs → DsNYnq4NtYBxPmeA.mjs} +20 -20
  76. package/node/esm/DygDgOpa9sJ6YFVS.mjs +385 -0
  77. package/node/esm/Dz0Hg87UcJ-awwiI.mjs +489 -0
  78. package/node/esm/M7YxvRPGCuxuk9aK.mjs +142 -0
  79. package/node/esm/QNjtpX8rIpqGGLEJ.mjs +1379 -0
  80. package/node/esm/{B_jRGdwGFkudwmL-.mjs → ZzvsynJTCSuChYS-.mjs} +1 -1
  81. package/node/esm/{ci8d-mF1H9wnYzix.mjs → di_8-pXh90j4BO4j.mjs} +1 -1
  82. package/node/esm/dm8dmEaTIqfmgyeL.mjs +412 -0
  83. package/node/esm/{D6oQL8knsPpgdXuk.mjs → fmya3XQnTGyQisvT.mjs} +2 -2
  84. package/node/esm/gPYAb_A0T5ZwcQ1E.mjs +318 -0
  85. package/node/esm/index.mjs +8915 -13417
  86. package/node/esm/wB8xMpyJ_NvE16yG.mjs +975 -0
  87. package/node/esm/zGAcd4Jr7wkvXDBS.mjs +197 -0
  88. package/package.json +9 -9
  89. package/resources/locales/de/groups.cmd.json +4 -0
  90. package/resources/locales/de/ui.msg.json +100 -1
  91. package/resources/locales/en/groups.cmd.json +4 -0
  92. package/resources/locales/en/ui.msg.json +100 -1
  93. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
  94. package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
  95. package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
  96. package/types/src/anomalies/index.d.ts +3 -0
  97. package/types/src/border/BorderPopupButton.d.ts +1 -1
  98. package/types/src/border/BorderTemplateIcon.d.ts +6 -1
  99. package/types/src/chart/ChartFormatPanel.d.ts +20 -0
  100. package/types/src/chart/ChartPlugin.d.ts +6 -0
  101. package/types/src/chart/index.d.ts +3 -0
  102. package/types/src/color/ColorPopupButton.d.ts +1 -1
  103. package/types/src/command/AccountingStyleCommandButton.d.ts +1 -1
  104. package/types/src/command/DocThemeCommandButton.d.ts +1 -1
  105. package/types/src/command/FontFamilyCommandButton.d.ts +1 -1
  106. package/types/src/command/FontSizeCommandButton.d.ts +1 -1
  107. package/types/src/command/InsertCellControlCommandButton.d.ts +17 -0
  108. package/types/src/command/LanguageCommandButton.d.ts +1 -1
  109. package/types/src/command/LocaleCommandButton.d.ts +1 -1
  110. package/types/src/command/index.d.ts +1 -0
  111. package/types/src/comments/CommentCard.d.ts +2 -2
  112. package/types/src/conditionalFormat/IconPickerPopupButton.d.ts +1 -1
  113. package/types/src/conditions/ConditionEditor.d.ts +1 -1
  114. package/types/src/conditions/OperatorAndParamEditor.d.ts +1 -1
  115. package/types/src/conditions/OperatorSelectPopupButton.d.ts +1 -1
  116. package/types/src/conditions/useFormulaOption.d.ts +2 -2
  117. package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
  118. package/types/src/fill/PatternPopupButton.d.ts +1 -1
  119. package/types/src/format/BorderPreview.d.ts +11 -4
  120. package/types/src/format/useFormatSelection.d.ts +4 -4
  121. package/types/src/formulaBar/IFormulaBar.d.ts +4 -2
  122. package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
  123. package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
  124. package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
  125. package/types/src/index.d.ts +15 -6
  126. package/types/src/itemsPanel/ItemsPanel.d.ts +5 -0
  127. package/types/src/named/NamedDetailsPanel.d.ts +2 -2
  128. package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
  129. package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
  130. package/types/src/protection/index.d.ts +1 -1
  131. package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
  132. package/types/src/statusBar/PendingStatus.d.ts +19 -0
  133. package/types/src/statusBar/index.d.ts +1 -0
  134. package/types/src/studio/StudioProps.d.ts +10 -10
  135. package/types/src/template/TemplatePanel.d.ts +5 -1
  136. package/types/src/theme/ThemeSelectPopupButton.d.ts +1 -1
  137. package/types/src/toolbar/WorkbookToolbars.d.ts +1 -1
  138. package/types/src/workbook/DefaultRenderers.d.ts +31 -19
  139. package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
  140. package/types/src/workbook/WorkbookElement.d.ts +5 -4
  141. package/types/src/workbook/WorkbookStrip.d.ts +8 -7
  142. package/types/src/workbook/index.d.ts +1 -1
  143. package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
  144. package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
  145. package/browser/esm/CtEFHbzYNvYjDYvi.mjs +0 -236
  146. package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
  147. package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
  148. package/node/esm/BYVLi0md4AYuDsB_.mjs +0 -236
  149. package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
  150. package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
@@ -0,0 +1,1703 @@
1
+ /**
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.12
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { AnomaliesPlugin as e, CommentsPlugin as t, DocumentTitle as o, ExternalLinksPlugin as r, FormatPlugin as n, NamedPlugin as a, ProtectionPlugin as i, SlicerPlugin as s, TablePlugin as l, WorkbookElement as c, createStudioThemeCSS as d, defaultRenderFormulaBar as p, defaultRenderStatusBar as u, defaultRenderToolbar as m, defaultRenderWorkbookError as g, defaultRenderWorkbookLoading as h, l as f, registerStudioCommandCatalogs as k, registerStudioCommandGroups as b, t as y, tokensToMuiOptions as w } from "./index.mjs";
8
+ import { CommandRootProvider as x, DefaultTaskPaneRegistry as v, LogoNoPaddingIcon as C, SHAPE_ICON_PACK as D, TaskPaneArea as S, TaskPaneProvider as W, ThemeStateDefaults as E, ThemeStateKey as T, WorkbookIO as F, WorkbookProvider as I, buildOOXMLThemeCSS as P, createEditable as R, createSystemColorVars as A, registerMovablePane as j, registerMovableToolbarEntry as N, useDocThemes as M, useModelSync as L, useReferenceModeStore as O, useResolvedWorkbook as $, useTaskPaneArea as B, useWorkbookEncrypted as _, useWorkbookName as K, useWorkbookSaveState as V } from "@sheetxl/react";
9
+ import { Command as z, DefaultIconService as H, DynamicIcon as U, LanguageStateKey as G, NotifierType as q, ReactErrorBoundary as X, ReactNotifierProvider as Y, ReactUtils as Z, RenderSlot as J, ScrollUtils as Q, SplitPane as ee, UncaughtErrorBoundary as te, createBusyHandle as oe, useCallbackRef as re, useFullscreen as ne, useImperativeElement as ae, useLanguage as ie, useMeasure as se, useNotifier as le, usePersistentState as ce, useResolvedThemeMode as de, useTokenThemeContext as pe, useTranslator as ue, useVisualViewportRect as me } from "@sheetxl/utils-react";
10
+ import ge, { forwardRef as he, isValidElement as fe, memo as ke, useCallback as be, useEffect as ye, useMemo as we, useRef as xe, useState as ve } from "react";
11
+ import { AnimatedLoadingPanel as Ce, AnimatedTraversingEllipsisIcon as De, CommandGroup as Se, ExhibitFloatProvider as We, ExhibitTooltip as Ee, ModalProvider as Te, SimpleTooltip as Fe, StackTrace as Ie, createExhibitTheme as Pe, hideLoadingPanel as Re, lazyModal as Ae, lazyPanel as je, showLoadingPanel as Ne, useInputDialog as Me, useLazyWindow as Le, useModal as Oe, useOptionsDialog as $e } from "@sheetxl/utils-mui";
12
+ import { Fragment as Be, jsx as _e, jsxs as Ke } from "react/jsx-runtime";
13
+ import { Box as Ve, Card as ze, CardActions as He, Collapse as Ue, CssBaseline as Ge, DialogTitle as qe, IconButton as Xe, Paper as Ye, SvgIcon as Ze, Tab as Je, Tabs as Qe, ThemeProvider as et, Typography as tt, alpha as ot, useMediaQuery as rt, useTheme as nt } from "@mui/material";
14
+ import { CommonUtils as at, DOMUtils as it, DefaultLanguagePackService as st, ErrorUtils as lt, ExpectedError as ct, PartialError as dt, defineLazyModule as pt, formatMessage as ut, messageKey as mt, t as gt } from "@sheetxl/utils";
15
+ import ht from "clsx";
16
+ import { mergeRefs as ft, useMergeRefs as kt } from "react-merge-refs";
17
+ import { SnackbarContent as bt, SnackbarProvider as yt, useSnackbar as wt } from "notistack";
18
+ var xt = je(pt("studio:conditionalFormatDetailsTaskPane", () => import("./C3FCh9xju2SccUIE.mjs"), { select: (e) => ({ default: e.ConditionalFormatDetailsTaskPane }) }).load), vt = ["lines"], Ct = {
19
+ card: "_card_h0jnt_7",
20
+ actionRoot: "_actionRoot_h0jnt_11",
21
+ icons: "_icons_h0jnt_16",
22
+ expand: "_expand_h0jnt_22",
23
+ expandOpen: "_expandOpen_h0jnt_29",
24
+ stackTraceContainer: "_stackTraceContainer_h0jnt_33",
25
+ paper: "_paper_h0jnt_37",
26
+ checkIcon: "_checkIcon_h0jnt_42",
27
+ button: "_button_h0jnt_47"
28
+ }, Dt = ke(he((e, t) => {
29
+ const { id: o, message: r, iconVariant: n, error: a, hideIconVariant: i, ...s } = e, l = ue(), { closeSnackbar: c } = wt(), [d, p] = ve(!1), u = a ? lt.collectErrorChain(a, !0)?.[0]?.error : void 0, m = u && !(u instanceof ct), g = be(() => {
30
+ p((e) => !e);
31
+ }, []), h = be(() => {
32
+ c(o);
33
+ }, [o, c]);
34
+ let f = u?.message;
35
+ return !f && fe(r) && (f = r), f || "string" != typeof r || (f = r), f || (f = `Unknown Error: ${r}`), _e(bt, {
36
+ ref: t,
37
+ className: ht(Ct.root, "error-snackbar"),
38
+ children: Ke(ze, {
39
+ className: Ct.card,
40
+ style: {
41
+ backgroundColor: "var(--sxl-color-error)",
42
+ color: "var(--sxl-color-error-content)",
43
+ border: "1px solid var(--sxl-color-error)"
44
+ },
45
+ children: [Ke(He, {
46
+ className: Ct.actionRoot,
47
+ children: [
48
+ i ? null : n?.error,
49
+ _e(tt, {
50
+ variant: "body2",
51
+ component: "div",
52
+ className: Ct.typography,
53
+ children: f
54
+ }),
55
+ _e("div", { style: { flex: "1 1 auto" } }),
56
+ Ke("div", {
57
+ className: Ct.icons,
58
+ children: [m ? _e(Xe, {
59
+ "aria-label": l("toast.showMore"),
60
+ size: "small",
61
+ className: ht(Ct.expand, { [Ct.expandOpen]: d }),
62
+ onClick: g,
63
+ children: _e(U, { iconKey: "ExpandMore" })
64
+ }) : null, _e(Xe, {
65
+ size: "small",
66
+ className: Ct.expand,
67
+ onClick: h,
68
+ children: _e(U, {
69
+ iconKey: "Close",
70
+ style: { transform: "scale(0.8)" }
71
+ })
72
+ })]
73
+ })
74
+ ]
75
+ }), m ? _e(Ue, {
76
+ in: d,
77
+ timeout: "auto",
78
+ children: _e("div", {
79
+ className: Ct.stackTraceContainer,
80
+ style: {
81
+ backgroundColor: "color-mix(in srgb, var(--sxl-color-error) 90%, var(--sxl-color-base-100))",
82
+ borderTop: "1px solid var(--sxl-color-error)"
83
+ },
84
+ children: _e(Ie, {
85
+ error: a,
86
+ hideLineNumbers: !0
87
+ })
88
+ })
89
+ }) : null]
90
+ })
91
+ });
92
+ }));
93
+ Dt.displayName = "ToastError";
94
+ var St = () => {
95
+ const e = ue();
96
+ return _e(Ee, {
97
+ label: "SheetXL",
98
+ description: e("logo.description"),
99
+ children: _e(Ve, {
100
+ component: "a",
101
+ href: "https://www.sheetxl.com",
102
+ target: "_blank",
103
+ rel: "noopener noreferrer",
104
+ sx: {
105
+ display: "inline-flex",
106
+ width: "24px",
107
+ height: "24px",
108
+ marginBottom: "4px",
109
+ marginLeft: "6px",
110
+ cursor: "pointer"
111
+ },
112
+ children: _e(C, { style: {
113
+ width: "24px",
114
+ height: "24px"
115
+ } })
116
+ })
117
+ });
118
+ }, Wt = _e(St, {}), Et = ke(he((e, t) => {
119
+ const { workbook: o, className: r, logo: n = Wt, mainElement: a, startElement: i, endElement: s, ...l } = e, [c, { width: d }] = se(), p = d < 530, u = xe(null), g = kt([
120
+ u,
121
+ c,
122
+ t
123
+ ]);
124
+ return _e(Ve, {
125
+ ...l,
126
+ ref: g,
127
+ className: r,
128
+ children: m({
129
+ isCompact: p,
130
+ wrapperSelect: (e) => Ke(Ve, {
131
+ sx: {
132
+ display: "grid",
133
+ gridTemplateColumns: "1fr auto 1fr",
134
+ flex: "1",
135
+ alignItems: "stretch",
136
+ gap: (e) => e.spacing(1),
137
+ paddingLeft: (e) => e.spacing(1),
138
+ paddingRight: (e) => e.spacing(1)
139
+ },
140
+ children: [
141
+ Ke(Ve, {
142
+ sx: {
143
+ display: "flex",
144
+ flexDirection: "row",
145
+ alignItems: "center",
146
+ justifyContent: "start",
147
+ gap: (e) => e.spacing(.5)
148
+ },
149
+ children: [n, Ke(Ve, {
150
+ sx: {
151
+ display: "flex",
152
+ flexDirection: "row",
153
+ alignItems: "center",
154
+ gap: (e) => e.spacing(.25)
155
+ },
156
+ children: [i, e]
157
+ })]
158
+ }),
159
+ _e(Ve, {
160
+ sx: {
161
+ display: "flex",
162
+ flexDirection: "row",
163
+ minWidth: 0,
164
+ overflow: "hidden",
165
+ alignItems: "center",
166
+ justifyContent: "center"
167
+ },
168
+ children: a
169
+ }),
170
+ _e(Ve, {
171
+ sx: {
172
+ display: "flex",
173
+ alignItems: "center",
174
+ justifyContent: "end"
175
+ },
176
+ children: s
177
+ })
178
+ ]
179
+ })
180
+ })
181
+ });
182
+ }));
183
+ Et.displayName = "StudioToolbar";
184
+ var Tt = (e, t) => {
185
+ const o = new URL(window.location.pathname, window.location.origin);
186
+ e && o.searchParams.set("source", e), e && t && o.searchParams.set("title", t), window.open(o.toString(), "sheetxl-" + at.uuidV4(), "popup=true");
187
+ };
188
+ function Ft(e, t) {
189
+ const { workbook: o, setWorkbook: r, workbookTitle: n = "export", isDirty: a, notifier: i, refSave: s } = t;
190
+ let l = !1;
191
+ const c = async (e = null, t = null, o = null) => {
192
+ const r = [], n = {
193
+ source: e && "string" != typeof e ? e : null,
194
+ typedCreateWorkbookOptions: t ?? void 0,
195
+ onPassword: async ({ origin: e, validate: t }) => {
196
+ const o = await i.showInput({
197
+ title: gt("dialog.password.title"),
198
+ description: gt("dialog.password.open.description", { name: e.getName() ?? "" }),
199
+ inputType: "password",
200
+ options: [{
201
+ id: "Open",
202
+ label: () => gt("dialog.open")
203
+ }, "Cancel"],
204
+ defaultOption: "Open",
205
+ onValidateInput: async (e, o) => void 0 === o ? { valid: !0 } : e ? await t(e) ? { valid: !0 } : {
206
+ valid: !1,
207
+ message: gt("dialog.password.open.retry")
208
+ } : {
209
+ valid: !1,
210
+ message: gt("dialog.password.open.required")
211
+ }
212
+ });
213
+ return "Open" === o?.option ? o.input ?? null : null;
214
+ },
215
+ progress: { onWarning: (e) => {
216
+ r.push(e);
217
+ } }
218
+ };
219
+ let a;
220
+ o && (n.progress.onStart = o);
221
+ let s = -5;
222
+ return F.read({
223
+ ...n,
224
+ progress: {
225
+ async onStart(e, t) {
226
+ await n?.progress?.onStart?.(e, t), a = await i?.showBusy?.(gt("workbook.opening", { name: e?.getName() ?? "" })), t && a?.setProgress?.(0, t);
227
+ },
228
+ onProgress(e, t) {
229
+ if (!t) return;
230
+ const o = Math.min(100, Math.round(e / t * 100));
231
+ if (o >= 100) {
232
+ if (100 === s) return;
233
+ s = 100, a?.setProgress?.(e, t);
234
+ return;
235
+ }
236
+ o - s < 5 || (s = o, a?.setProgress?.(e, t));
237
+ },
238
+ onComplete() {
239
+ a?.(), r.length > 0 && (i.showMessage(gt("workbook.importWarnings")), console.warn("Import warnings:\n" + r.join("\n")));
240
+ },
241
+ onWarning(e, t) {
242
+ n?.progress?.onWarning?.(e, t);
243
+ }
244
+ }
245
+ });
246
+ }, d = async (e, t, o = !1, r) => {
247
+ let a;
248
+ const s = {
249
+ format: t?.key,
250
+ progress: {
251
+ async onStart(e) {
252
+ a = await i?.showBusy?.(gt("workbook.saving", { name: e?.getName() ?? "" }));
253
+ },
254
+ onComplete() {
255
+ a?.();
256
+ }
257
+ },
258
+ onWarnings: r ?? (async ({ warnings: e, origin: t, canCancel: o }) => {
259
+ a?.(), console.warn(`Not written to '${t.getName()}':\n${e.map((e) => ` ${e.message}`).join("\n")}`);
260
+ const r = gt("dialog.writeWarnings.title"), n = t.getFormat(), s = (n ? (await F.getWriteFormats({ search: n }))[0] : void 0)?.description ?? n ?? "", l = gt("dialog.writeWarnings.keep");
261
+ return o ? "Save" === await i.showOptions({
262
+ title: r,
263
+ type: q.Warning,
264
+ description: `${gt("dialog.writeWarnings.confirm", { format: s })}\n\n${l}`,
265
+ options: [{
266
+ id: "Save",
267
+ label: () => gt("dialog.save")
268
+ }, "Cancel"],
269
+ defaultOption: "Cancel"
270
+ }) && (a = await i?.showBusy?.(gt("workbook.saving", { name: t?.getName() ?? "" })), !0) : (i.showOptions({
271
+ title: r,
272
+ type: q.Warning,
273
+ description: `${gt("dialog.writeWarnings.saved", { format: s })}\n\n${l}`,
274
+ options: ["Ok"]
275
+ }), !0);
276
+ })
277
+ };
278
+ let l;
279
+ if (o) {
280
+ const o = e.getOrigin(), r = t?.exts?.[0] ?? (o.getExtension() || "sxl"), a = `${n || o.getName() || gt("workbook.defaultName")}.${r}`;
281
+ l = await F.writeAs(e, a, {
282
+ ...s,
283
+ prompt: !0
284
+ });
285
+ } else l = await F.write(e, void 0, s);
286
+ return l;
287
+ };
288
+ let p = null;
289
+ return e.updateCommand("newWorkbook", { callback: async (e) => {
290
+ const t = F.canRead() && !a();
291
+ e?.source ? t && p ? await p({
292
+ url: e.source,
293
+ title: e.title
294
+ }) : Tt(e.source, e.title) : t ? r({}) : Tt();
295
+ } }), e.updateCommand("closeWorkbook", { callback: async () => {
296
+ a() && "Close" !== await i.showOptions({
297
+ title: gt("dialog.confirm.title"),
298
+ description: gt("dialog.unsavedChanges"),
299
+ options: [{
300
+ id: "Close",
301
+ label: () => gt("dialog.close")
302
+ }, "Cancel"],
303
+ defaultOption: "Cancel"
304
+ }) || window.close();
305
+ } }), (async () => {
306
+ const t = await F.getWriteFormats();
307
+ if (l) return;
308
+ const n = F.canWrite(), u = F.canRead();
309
+ if (n) {
310
+ const r = (e) => {
311
+ const r = e ? t.find((t) => t.key === e) : void 0;
312
+ d(o, r, !0).catch((e) => i.showError(e));
313
+ };
314
+ e.updateCommand("saveWorkbook", { callback: () => {
315
+ d(o, void 0, !1).catch((e) => i.showError(e));
316
+ } }), s && (s.current = (e) => d(o, void 0, !1, e?.onWarnings)), e.updateCommand("saveWorkbookAs", { callback: (e) => {
317
+ r(e);
318
+ } });
319
+ for (const o of t) {
320
+ const t = o.key;
321
+ e.updateCommand(`saveWorkbookAs${t}`, {
322
+ label: () => gt("command.saveAsFormat.label", { format: o.description }),
323
+ groupLabels: {
324
+ workbook: () => gt("command.saveAsFormat.workbook", { format: o.description }),
325
+ saveWorkbookOptions: () => gt("command.saveAsFormat.compact", { format: o.description })
326
+ },
327
+ tags: o.tags,
328
+ description: () => gt("command.saveAsFormat", { format: o.description }),
329
+ icon: "CSV" === t ? "FileDownloadAsCSV" : "Excel" === t ? "FileDownloadAsExcel" : "FileDownloadAsSheet",
330
+ callback: () => {
331
+ r(t);
332
+ }
333
+ });
334
+ }
335
+ }
336
+ const m = async (e = null) => {
337
+ const t = { csv: {
338
+ date1904: o.getRuntime().isDate1904(),
339
+ ...o.options
340
+ } };
341
+ try {
342
+ let r = "";
343
+ const n = async (e) => {
344
+ r = e?.getName() ?? "";
345
+ }, a = await c(e, t, n);
346
+ if (!a) return;
347
+ const i = a.getWorksheets().getItems();
348
+ await o.doBatch(async () => {
349
+ for (let e = 0; e < i.length; e++) {
350
+ const t = i[e], n = 1 === i.length ? r : t.getName(), a = o.findValidSheetName(n);
351
+ await o.getWorksheets().add({
352
+ name: a,
353
+ autoSelect: e === i.length - 1
354
+ }).getEntireRange().copyFrom(t.getEntireRange());
355
+ }
356
+ }, mt("op.importData")), a.close();
357
+ } catch (e) {
358
+ i.showError(e);
359
+ }
360
+ };
361
+ if (e.updateCommand("insertDataFromFile", {
362
+ tags: ["noTransaction", "noRepeat"],
363
+ callback: async (e = null) => {
364
+ let t = e;
365
+ if (t || F.canRead() || (t = await (async () => {
366
+ const e = await F.getReadFormats(), t = [...new Set(e.flatMap((e) => e.exts))].map((e) => `.${e}`);
367
+ return it.openFileDialog(t.length ? t.join(",") : "*.*");
368
+ })(), t)) return m(t);
369
+ }
370
+ }), e.updateCommand("insertDataFromURL", {
371
+ tags: ["noTransaction", "noRepeat"],
372
+ callback: async (e) => {
373
+ if (!e) {
374
+ const t = await i.showInput({
375
+ title: gt("dialog.importFromWeb.title"),
376
+ description: gt("dialog.importFromWeb.description"),
377
+ inputLabel: gt("dialog.webAddress.inputLabel"),
378
+ initialValue: "https://www.sheetxl.com/docs/examples/loan-calculator.xlsx",
379
+ propsInput: { style: { minWidth: "440px" } },
380
+ options: [{
381
+ id: "Import",
382
+ label: () => gt("dialog.import")
383
+ }]
384
+ });
385
+ if ("Import" !== t.option) return;
386
+ e = t.input;
387
+ }
388
+ if (e) try {
389
+ const t = await fetch(e);
390
+ if (!t.ok) throw new Error(`Could not fetch '${e}' (${t.status} ${t.statusText}).`);
391
+ const o = await t.blob(), r = decodeURIComponent(e.split("/").pop()?.split("?")[0] || "") || "import.xlsx";
392
+ await m(new File([o], r, { type: o.type }));
393
+ } catch (e) {
394
+ i.showError(e);
395
+ }
396
+ }
397
+ }), u) {
398
+ const t = async () => !a() || "Open" === await i.showOptions({
399
+ title: gt("dialog.confirm.title"),
400
+ description: gt("dialog.unsavedChanges"),
401
+ options: [{
402
+ id: "Open",
403
+ label: () => gt("dialog.open")
404
+ }, "Cancel"],
405
+ defaultOption: "Cancel"
406
+ }), n = async (e = null) => {
407
+ const t = { csv: {
408
+ date1904: o.getRuntime().isDate1904(),
409
+ ...o.options
410
+ } };
411
+ try {
412
+ const o = await c(e, t);
413
+ if (!o) return;
414
+ r(o);
415
+ } catch (e) {
416
+ i.showError(e);
417
+ }
418
+ };
419
+ e.updateCommand("openWorkbook", { callback: async (e = null) => {
420
+ await t() && await n(e);
421
+ } }), p = async (e) => {
422
+ let o = "string" == typeof e ? e : e?.url;
423
+ const r = "string" == typeof e ? void 0 : e?.title;
424
+ if (!o) {
425
+ const e = await i.showInput({
426
+ title: gt("dialog.openFromWeb.title"),
427
+ description: gt("dialog.openFromWeb.description"),
428
+ inputLabel: gt("dialog.webAddress.inputLabel"),
429
+ initialValue: "https://www.sheetxl.com/docs/examples/loan-calculator.xlsx",
430
+ propsInput: { style: { minWidth: "440px" } },
431
+ options: [{
432
+ id: "Open",
433
+ label: () => gt("dialog.open")
434
+ }]
435
+ });
436
+ if ("Open" !== e.option) return;
437
+ o = e.input;
438
+ }
439
+ if (o && await t()) try {
440
+ const e = await fetch(o);
441
+ if (!e.ok) throw new Error(`Could not fetch '${o}' (${e.status} ${e.statusText}).`);
442
+ const t = await e.blob(), a = decodeURIComponent(o.split("/").pop()?.split("?")[0] || "") || "workbook.xlsx", i = a.match(/\.[^/.]+$/)?.[0] ?? "", s = r ? `${r}${i}` : a;
443
+ await n(new File([t], s, { type: t.type }));
444
+ } catch (e) {
445
+ i.showError(e);
446
+ }
447
+ }, e.updateCommand("openWorkbookFromUrl", { callback: p });
448
+ }
449
+ })(), () => {
450
+ l = !0, s && (s.current = null);
451
+ };
452
+ }
453
+ var It = Ae(pt("studio:shortcutKeysDialog", () => import("./DGDHFK8okuVbRCe5.mjs")).load);
454
+ k(), y();
455
+ var Pt = /* @__PURE__ */ new Set(["ui"]), Rt = (e) => {
456
+ const t = (e) => {
457
+ if ("function" != typeof e) return e;
458
+ try {
459
+ return e();
460
+ } catch {
461
+ return;
462
+ }
463
+ }, o = (e, o) => {
464
+ const r = t(e);
465
+ return "string" == typeof r ? ut(r, o, st.getActive()) : void 0;
466
+ }, r = [];
467
+ for (const n of e.names()) if (!Pt.has(n)) for (const a of e.keys(n)) {
468
+ const i = e.resolveDefinition(n, a);
469
+ r.push({
470
+ groupKey: n,
471
+ command: {
472
+ getLabel: () => o(i?.label, i?.params) ?? a,
473
+ getIcon: () => t(i?.icon),
474
+ getDescription: () => o(i?.description, i?.params) ?? "",
475
+ getShortcut: () => t(i?.shortcut) ?? null,
476
+ getScope: () => n,
477
+ getScopeLabel: () => z.DefaultCommandCatalogService.getScopeLabel(n)
478
+ }
479
+ });
480
+ }
481
+ return { getAllCommands: () => r };
482
+ }, At = (e) => {
483
+ const { children: t, workbook: o, setWorkbook: r, workbookTitle: n, isDirty: a, refSave: i, fullscreenTarget: s } = e, l = z.useCommandScope(), c = le(), { showModal: d } = Oe(), p = ue(), u = xe(a);
484
+ u.current = a;
485
+ const m = re(() => {
486
+ const e = l?.getRoot().getRegistry();
487
+ if (!e) return;
488
+ const t = d(It, {
489
+ title: p("dialog.shortcutKeys.title"),
490
+ commands: Rt(e),
491
+ onDone: () => t.hide(),
492
+ onLoadError: (e) => {
493
+ t.destroy(), c.showError(e);
494
+ }
495
+ });
496
+ }, [l, d]);
497
+ ye(() => {
498
+ if (!l) return;
499
+ const e = l.getRoot().contribution();
500
+ return function(e, t) {
501
+ const o = () => t.showShortcuts();
502
+ e.updateCommand("showKeyboardShortcuts", { callback: o }), e.updateCommand("help", { callback: o });
503
+ for (const [t, o] of Object.entries({
504
+ gotoUrlGithub: "https://github.com/sheetxl/sheetxl",
505
+ gotoUrlDiscord: "https://discord.gg/NTKdwUgK9p",
506
+ gotoUrlDocumentation: "https://www.sheetxl.com/docs",
507
+ gotoUrlIssue: "https://github.com/sheetxl/sheetxl/issues"
508
+ })) e.updateCommand(t, { callback: () => {
509
+ window?.open(o);
510
+ } });
511
+ }(e, { showShortcuts: m }), () => e.remove();
512
+ }, [l, m]);
513
+ const g = rt("(prefers-color-scheme: dark)"), { themeMode: h } = de(), [f, k] = ce(T.Mode, E[T.Mode]), [b, y] = ce(T.DarkGrid, E[T.DarkGrid]), [w, x] = ce(T.DarkImages, E[T.DarkImages]);
514
+ ye(() => {
515
+ if (!l) return;
516
+ const e = l.getRoot().contribution();
517
+ return function(e, t) {
518
+ e.updateCommand("themeMode", {
519
+ state: t.mode ?? null,
520
+ params: { dark: t.isDark },
521
+ icon: t.isDark ? "DarkMode" : "LightMode",
522
+ callback: () => t.setMode(t.isDark ? "light" : "dark")
523
+ }), e.updateCommand("defaultThemeMode", {
524
+ state: !t.mode,
525
+ icon: t.systemDefaultDark ? "SystemDefaultDarkMode" : "SystemDefaultLightMode",
526
+ callback: () => t.setMode(null)
527
+ }), e.updateCommand("enableDarkGrid", {
528
+ state: t.enableDarkGrid,
529
+ callback: () => t.setEnableDarkGrid((e) => !e)
530
+ }), e.updateCommand("enableDarkImages", {
531
+ state: t.enableDarkImages,
532
+ callback: () => t.setEnableDarkImages((e) => !e)
533
+ });
534
+ }(e, {
535
+ mode: f,
536
+ setMode: k,
537
+ isDark: "dark" === f || !f && "dark" === h,
538
+ systemDefaultDark: g,
539
+ enableDarkGrid: b,
540
+ setEnableDarkGrid: y,
541
+ enableDarkImages: w,
542
+ setEnableDarkImages: x
543
+ }), () => e.remove();
544
+ }, [
545
+ l,
546
+ f,
547
+ h,
548
+ g,
549
+ b,
550
+ w,
551
+ k,
552
+ y,
553
+ x
554
+ ]);
555
+ const [v, C] = ce(G.Active, null), [D, S] = ve(() => st.getActive());
556
+ ye(() => st.addChangeListener(S), []), ye(() => {
557
+ v && v !== st.getActive() && st.setActive(v);
558
+ }, [v]), ye(() => {
559
+ if (!l) return;
560
+ const e = l.getRoot().contribution();
561
+ return function(e, t) {
562
+ e.updateCommand("language", {
563
+ state: t.active,
564
+ callback: (e) => {
565
+ e && t.setActive(e);
566
+ }
567
+ });
568
+ }(e, {
569
+ active: D,
570
+ setActive: (e) => {
571
+ C(e);
572
+ }
573
+ }), () => e.remove();
574
+ }, [
575
+ l,
576
+ D,
577
+ C
578
+ ]);
579
+ const W = we(() => ({ current: s ?? null }), [s]), { isFullscreenAvailable: F, isFullscreenEnabled: I, toggleFullscreen: P } = ne({ target: W });
580
+ ye(() => {
581
+ if (!l) return;
582
+ const e = l.getRoot().contribution();
583
+ return function(e, t) {
584
+ e.updateCommand("fullScreenToggle", {
585
+ state: t.isFullscreenEnabled,
586
+ disabledReasons: t.isFullscreenAvailable ? [] : [mt("reason.fullscreenUnavailable")],
587
+ icon: t.isFullscreenEnabled ? "FullScreenOff" : "FullScreen",
588
+ callback: () => {
589
+ t.toggleFullscreen();
590
+ }
591
+ });
592
+ }(e, {
593
+ isFullscreenAvailable: F,
594
+ isFullscreenEnabled: I,
595
+ toggleFullscreen: P
596
+ }), () => e.remove();
597
+ }, [
598
+ l,
599
+ F,
600
+ I,
601
+ P
602
+ ]);
603
+ const R = B(!0);
604
+ return ye(() => {
605
+ if (!l) return;
606
+ const e = l.getRoot().contribution();
607
+ return function(e, t) {
608
+ e.updateCommand("protectWorkbook", {
609
+ tags: ["noTransaction", "noRepeat"],
610
+ callback: () => {
611
+ t("manageProtection", { args: { tab: "workbook" } });
612
+ }
613
+ });
614
+ }(e, (e, t) => R.activate(e, t)), () => e.remove();
615
+ }, [l, R]), ye(() => {
616
+ if (!l || !o) return;
617
+ const e = l.getRoot().contribution(), t = Ft(e, {
618
+ workbook: o,
619
+ setWorkbook: r,
620
+ workbookTitle: n ?? void 0,
621
+ isDirty: () => u.current?.() ?? !1,
622
+ notifier: c,
623
+ refSave: i
624
+ });
625
+ return () => {
626
+ t(), e.remove();
627
+ };
628
+ }, [
629
+ l,
630
+ o,
631
+ r,
632
+ n,
633
+ c,
634
+ i
635
+ ]), t;
636
+ };
637
+ At.displayName = "StudioCommandProvider";
638
+ var jt = ({ renderWorkbook: e }) => {
639
+ const t = z.useCommandResolver(), o = xe(null), r = ue(), [n, a] = ve(null), i = be((e) => {
640
+ const o = e.dataTransfer;
641
+ if (t && o) {
642
+ if ("dragenter" === e.type || "dragover" === e.type) {
643
+ const e = o.types, t = o.items;
644
+ let r = !1;
645
+ for (let e = 0; e < t.length; e++) if (t[e].type.startsWith("image/")) {
646
+ r = !0;
647
+ break;
648
+ }
649
+ r ? a("insertImage") : e.includes("Files") && t.length > 0 ? a("open") : (o.effectAllowed = "none", o.dropEffect = "none");
650
+ } else if ("dragleave" === e.type) {
651
+ const t = e.relatedTarget;
652
+ t && e.currentTarget.contains(t) || a(null);
653
+ }
654
+ e.preventDefault();
655
+ }
656
+ }, [t]), s = re((e) => {
657
+ e.preventDefault();
658
+ const r = n;
659
+ if (a(null), r && t && (e.stopPropagation(), e.dataTransfer.files && e.dataTransfer.files.length > 0)) {
660
+ const r = e.dataTransfer.files[0];
661
+ if (!r) return;
662
+ if (r?.type?.startsWith("image/")) {
663
+ const n = o.current?.getSheetElement()?.getGridSurface().getPaneFromClient(e.clientX, e.clientY);
664
+ if (!n) return;
665
+ const a = n.getPanePointFromPointer(e.clientX, e.clientY);
666
+ if (!a) return;
667
+ const i = n.toAbsoluteBounds({
668
+ x: a.x ?? 0,
669
+ y: a.y ?? 0,
670
+ width: 0,
671
+ height: 0
672
+ });
673
+ t.execute("insertImageFromFile", {
674
+ file: r,
675
+ options: { bounds: {
676
+ x: i.x,
677
+ y: i.y
678
+ } }
679
+ });
680
+ } else {
681
+ if (!F.canRead()) return;
682
+ const o = e.dataTransfer.items?.[0], n = "undefined" != typeof window && window.isSecureContext ? o?.getAsFileSystemHandle?.() : void 0;
683
+ n ? n.then((e) => t.execute("openWorkbook", "file" === e?.kind ? e : r)).catch(() => t.execute("openWorkbook", r)) : t.execute("openWorkbook", r);
684
+ }
685
+ }
686
+ }, [t, n]), l = we(() => {
687
+ if (!n) return null;
688
+ const e = "insertImage" === n;
689
+ return _e(Ve, {
690
+ className: "drop-overlay",
691
+ sx: {
692
+ position: "absolute",
693
+ inset: 0,
694
+ zIndex: 1,
695
+ boxSizing: "border-box",
696
+ pointerEvents: "none",
697
+ display: "flex",
698
+ justifyContent: "center",
699
+ alignItems: "center",
700
+ backgroundColor: (e) => ot(e.palette.primary.main, .46),
701
+ outline: (e) => `2px dashed ${e.palette.primary.main}`,
702
+ outlineOffset: "-6px",
703
+ borderRadius: 2
704
+ },
705
+ children: Ke(Ye, {
706
+ elevation: 6,
707
+ sx: {
708
+ display: "flex",
709
+ alignItems: "center",
710
+ gap: 1.5,
711
+ px: 3,
712
+ py: 2,
713
+ borderRadius: 2,
714
+ color: "text.primary",
715
+ "& .drop-overlay-icon": { color: "primary.main" }
716
+ },
717
+ children: [_e(U, {
718
+ iconKey: e ? "InsertImage" : "FileOpen",
719
+ className: "drop-overlay-icon",
720
+ size: 32
721
+ }), _e(tt, {
722
+ variant: "h6",
723
+ component: "span",
724
+ children: r(e ? "drop.insertImage" : "drop.open")
725
+ })]
726
+ })
727
+ });
728
+ }, [n, r]);
729
+ return Ke(Be, { children: [e({
730
+ ref: o,
731
+ onDragStart: (e) => {
732
+ if (e.target.src) {
733
+ const t = new Image();
734
+ t.src = e.target.src, e.dataTransfer.setDragImage(t, 1, 1);
735
+ }
736
+ },
737
+ onDragEnter: i,
738
+ onDragLeave: i,
739
+ onDragOver: i,
740
+ onDrop: s
741
+ }), l] });
742
+ }, Nt = ke((e) => {
743
+ const { workbook: t, setWorkbook: o, refDocumentTitle: r, titleWorkbook: n, setWorkbookTitle: a, isDirty: i, initialCommandAnchor: s, renderWorkbook: l, refSave: c, host: d } = e;
744
+ return _e(x, {
745
+ initialAnchor: s,
746
+ children: _e(At, {
747
+ workbook: t,
748
+ setWorkbook: o,
749
+ workbookTitle: n,
750
+ isDirty: i,
751
+ refSave: c,
752
+ fullscreenTarget: d,
753
+ children: _e(jt, { renderWorkbook: l })
754
+ })
755
+ });
756
+ });
757
+ Nt.displayName = "CommandsWrapper";
758
+ var Mt = {
759
+ sort: pt("studio:sortDialog", () => import("./BBGoyqs2L_ccSH1e.mjs")).load,
760
+ hyperlink: pt("studio:hyperlinkDialog", () => import("./CyuOE595I2e-U4cG.mjs")).load,
761
+ find: pt("studio:findReplaceWindow", () => import("./B8Ls4Eh1k8-Yiry_.mjs")).load,
762
+ tableNew: pt("studio:tableNewDialog", () => import("./Cq53M7bAUSXMNq1f.mjs")).load,
763
+ namedDetails: pt("studio:namedReferenceDialog", () => import("./B9X3n8MglL4OitAV.mjs")).load,
764
+ insertFunction: pt("studio:insertFunctionDialog", () => import("./DsNYnq4NtYBxPmeA.mjs")).load,
765
+ resizeHeader: pt("studio:resizeHeaderDialog", () => import("./di_8-pXh90j4BO4j.mjs")).load,
766
+ outlineSettings: pt("studio:outlineSettingsDialog", () => import("./ZzvsynJTCSuChYS-.mjs")).load,
767
+ fillSeries: pt("studio:fillSeriesDialog", () => import("./Cr8AYWUoU-XVt0hu.mjs")).load,
768
+ workbookStatistics: pt("studio:workbookStatisticsDialog", () => import("./DQaGPUYbgL4Y5YZW.mjs")).load,
769
+ password: pt("studio:passwordDialog", () => import("./D72CupF9mfy2D1Xa.mjs")).load
770
+ }, Lt = ["find"], Ot = ke((e) => {
771
+ const { children: t } = e, o = wt(), r = o ? o.enqueueSnackbar : () => {}, n = o ? o.closeSnackbar : () => {}, a = xe(/* @__PURE__ */ new Set()), i = xe(null), s = xe(null), [l, c] = ve({
772
+ label: null,
773
+ progress: null
774
+ }), d = ue(), p = at.EmptyObject, u = Le(p), m = $e(p), g = Me(p), h = xe(!1);
775
+ ye(() => {
776
+ if (h.current) return;
777
+ h.current = !0;
778
+ const e = window, t = e.requestIdleCallback ?? ((e) => setTimeout(e, 500)), o = e.cancelIdleCallback ?? clearTimeout, r = t(() => {
779
+ for (const e of Lt) u(e, Mt[e], { prewarm: !0 }).catch(() => {});
780
+ });
781
+ return () => o(r);
782
+ }, []);
783
+ const f = xe(/* @__PURE__ */ new Set()), k = we(() => {
784
+ const e = (e, t) => {
785
+ if (t?.onceKey) {
786
+ if (f.current.has(t.onceKey)) return;
787
+ const e = new Set(f.current);
788
+ e.add(t.onceKey), f.current = e;
789
+ }
790
+ const o = {
791
+ variant: t?.type ?? q.Info,
792
+ anchorOrigin: {
793
+ vertical: "top",
794
+ horizontal: "center"
795
+ },
796
+ preventDuplicate: t?.preventDuplicate,
797
+ persist: t?.persist ?? t?.type === q.Error,
798
+ action: (e) => _e(Xe, {
799
+ onClick: () => n(e),
800
+ children: _e(U, { iconKey: "Cancel" })
801
+ })
802
+ };
803
+ t?.enqueueProps && Object.assign(o, t.enqueueProps), e || console.log("message is 'null'", t), r(e ?? "Alert", o);
804
+ };
805
+ return {
806
+ showMessage: e,
807
+ showBusy: (e, t) => {
808
+ const o = Symbol("busy");
809
+ a.current.add(o), s.current = e, null != e && "string" != typeof e && c((t) => t.label === e ? t : {
810
+ ...t,
811
+ label: e
812
+ });
813
+ const r = oe(() => {
814
+ a.current.delete(o) && (a.current.size > 0 || (Re(i.current), s.current = null, c((e) => null === e.label && null === e.progress ? e : {
815
+ label: null,
816
+ progress: null
817
+ })));
818
+ }, (e, t) => {
819
+ const o = t && t > 0 && null != e ? Math.max(0, Math.min(1, e / t)) : null;
820
+ c((e) => e.progress === o ? e : {
821
+ ...e,
822
+ progress: o
823
+ });
824
+ }, (e) => {
825
+ s.current = e, "string" == typeof e ? Ne(i.current, e) : c((t) => ({
826
+ ...t,
827
+ label: e
828
+ }));
829
+ }), n = Ne(i.current, "string" == typeof e ? e : void 0);
830
+ return n ? n.then(() => r) : r;
831
+ },
832
+ showWindow: (e, t) => {
833
+ const o = t;
834
+ return t = {
835
+ ...t,
836
+ onKeyDown: (e) => {
837
+ e.isDefaultPrevented() || e.isPropagationStopped() || o?.onKeyDown?.(e);
838
+ }
839
+ }, u(e, Mt[e], t);
840
+ },
841
+ showOptions: m,
842
+ showInput: g,
843
+ showError: (t) => {
844
+ let o, r = q.Error, n = d("error.unknown");
845
+ "string" == typeof t ? n = t : t instanceof Error && (o = t, t.message && (n = d(t.message))), t instanceof dt && (r = q.Info), e(n, {
846
+ type: r,
847
+ enqueueProps: { error: o }
848
+ });
849
+ }
850
+ };
851
+ }, [d]), b = we(() => _e(Ce, {
852
+ ref: i,
853
+ autoStart: !1,
854
+ icon: _e(De, { sx: {
855
+ transform: "scale(0.7)",
856
+ marginLeft: "-6px"
857
+ } }),
858
+ panel: !0,
859
+ label: l.label ?? ("string" == typeof s.current ? s.current : void 0),
860
+ progress: l.progress,
861
+ sx: {
862
+ position: "absolute",
863
+ left: "0",
864
+ top: "0",
865
+ width: "100%",
866
+ height: "100%",
867
+ zIndex: "9999",
868
+ pointerEvents: "none"
869
+ }
870
+ }), [l.label, l.progress]);
871
+ return Ke(Y, {
872
+ notifier: k,
873
+ children: [b, t]
874
+ });
875
+ });
876
+ Ot.displayName = "StudioNotifierProvider";
877
+ var $t = "var(--sxl-color-input-border, light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2)))", Bt = ke(he((e, t) => {
878
+ const { children: o, title: r, taskPanes: n, onSelect: a, selected: i, registry: s = v, style: l, iconsOnly: c, side: d = "right", className: p, ...u } = e, m = "right" !== d, g = ie(), h = we(() => n.map((t) => {
879
+ const o = s.getRegisteredTaskPane(t);
880
+ if (!o) return null;
881
+ let r = o.getIcon?.();
882
+ "string" == typeof r && (r = _e(U, { iconKey: r }));
883
+ const n = t === i, a = r ? _e(Ve, {
884
+ sx: {
885
+ display: "inline-block",
886
+ transform: m ? "rotate(-90deg)" : "rotate(90deg)",
887
+ transformOrigin: "center",
888
+ color: (e) => e.palette.text.secondary
889
+ },
890
+ children: r
891
+ }) : null, l = !r || !c && n, d = _e(Ve, {
892
+ sx: {
893
+ display: "grid",
894
+ gridTemplateColumns: l ? "1fr" : "0fr",
895
+ opacity: l ? 1 : 0,
896
+ transition: (e) => e.transitions.create(["grid-template-columns", "opacity"], { duration: e.transitions.duration.short })
897
+ },
898
+ children: _e(Ve, {
899
+ sx: {
900
+ overflow: "hidden",
901
+ minWidth: 0,
902
+ minHeight: 0
903
+ },
904
+ children: _e(tt, {
905
+ component: "div",
906
+ sx: {
907
+ textTransform: "none",
908
+ whiteSpace: "nowrap",
909
+ transform: m ? "rotate(180deg)" : void 0,
910
+ padding: "4px 0px",
911
+ color: (e) => n ? e.palette.primary.main : e.palette.text.secondary
912
+ },
913
+ children: o.getTitle()
914
+ })
915
+ })
916
+ });
917
+ return _e(Je, {
918
+ value: t,
919
+ label: _e(Fe, {
920
+ disableInteractive: !0,
921
+ title: o.getTitle() ?? "",
922
+ placement: "left-start",
923
+ children: Ke(Ve, {
924
+ sx: {
925
+ padding: "0px 0px",
926
+ writingMode: m ? "vertical-lr" : "vertical-rl",
927
+ textOrientation: "mixed",
928
+ display: "flex",
929
+ alignItems: "center",
930
+ justifyContent: "space-between",
931
+ minWidth: "0px",
932
+ color: (e) => e.palette.text.secondary
933
+ },
934
+ children: [m ? d : a, m ? a : d]
935
+ })
936
+ }),
937
+ sx: {
938
+ padding: "4px 4px",
939
+ minWidth: "0px",
940
+ minHeight: "0px",
941
+ borderRadius: "4px"
942
+ },
943
+ className: ht("taskpane-strip-item", { "Mui-selected": n }),
944
+ onClick: () => e.onSelect(t)
945
+ }, t);
946
+ }), [
947
+ n,
948
+ i,
949
+ a,
950
+ s,
951
+ m,
952
+ c,
953
+ g
954
+ ]), f = ae(t, () => ({ isTaskPaneStrip: () => !0 }), []), k = we(() => ht("taskpane-strip", p), [p]);
955
+ return _e(Ve, {
956
+ ref: f,
957
+ className: k,
958
+ sx: {
959
+ paddingLeft: m ? void 0 : "2px",
960
+ paddingRight: m ? "2px" : void 0,
961
+ paddingTop: "4px",
962
+ ...l
963
+ },
964
+ ...u,
965
+ children: _e(Qe, {
966
+ orientation: "vertical",
967
+ variant: "scrollable",
968
+ value: i,
969
+ onChange: (e, t) => {
970
+ a(t);
971
+ },
972
+ slotProps: {
973
+ list: { sx: { gap: "2px" } },
974
+ indicator: { sx: {
975
+ left: m ? void 0 : "0px",
976
+ right: m ? void 0 : "unset",
977
+ bottom: m ? "0px" : void 0
978
+ } }
979
+ },
980
+ children: h
981
+ })
982
+ });
983
+ })), _t = (e) => {
984
+ const { title: t, icon: o, onClose: r, readOnly: n, focused: a, ...i } = e, s = xe(null), l = ue();
985
+ return _e(qe, {
986
+ className: ht({ "Mui-selected": a }),
987
+ sx: {
988
+ display: "flex",
989
+ flex: "1 1 %0",
990
+ color: (e) => e.palette.text.secondary,
991
+ boxSizing: "border-box",
992
+ padding: "0 0",
993
+ transitionProperty: "opacity",
994
+ transitionDuration: (e) => `${e.transitions.duration.shortest}ms`,
995
+ opacity: .7,
996
+ "&.Mui-selected": {
997
+ opacity: 1,
998
+ transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
999
+ },
1000
+ backgroundColor: (e) => ot(e.palette.action.hover, .03),
1001
+ borderBottom: `solid ${$t} 1px`
1002
+ },
1003
+ ...i,
1004
+ children: Ke(Ve, {
1005
+ sx: {
1006
+ display: "flex",
1007
+ flex: "1 1 10%",
1008
+ flexDirection: "row",
1009
+ alignItems: "center",
1010
+ marginTop: (e) => e.spacing(.25),
1011
+ marginBottom: (e) => e.spacing(.25),
1012
+ marginLeft: (e) => e.spacing(1),
1013
+ marginRight: (e) => e.spacing(1)
1014
+ },
1015
+ children: [_e(Ve, {
1016
+ sx: {
1017
+ flex: "1 1 100%",
1018
+ paddingLeft: (e) => e.spacing(1)
1019
+ },
1020
+ children: t
1021
+ }), _e(Ee, {
1022
+ label: l("taskPane.close"),
1023
+ children: _e(Xe, {
1024
+ "aria-label": "close",
1025
+ sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
1026
+ touchRippleRef: s,
1027
+ onPointerDown: (e) => {
1028
+ s.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
1029
+ },
1030
+ onPointerUp: () => {
1031
+ r();
1032
+ },
1033
+ children: _e(U, { iconKey: "Close" })
1034
+ })
1035
+ })]
1036
+ })
1037
+ });
1038
+ }, Kt = he((e, t) => {
1039
+ const { model: o, side: r, ...n } = e, a = nt(), i = `solid ${$t} 1px`, s = `${a.shape.borderRadius ?? 4}px`, l = `${a.spacing?.(.5) ?? 4}px`;
1040
+ return _e(S, {
1041
+ model: o,
1042
+ ref: t,
1043
+ propsFrame: { style: {
1044
+ border: i,
1045
+ borderRadius: s,
1046
+ marginBottom: l
1047
+ } },
1048
+ alwaysShowStrip: !0,
1049
+ componentTitle: _t,
1050
+ componentStrip: Bt,
1051
+ side: r,
1052
+ ...e,
1053
+ onOpen: () => {
1054
+ e?.onOpen?.();
1055
+ },
1056
+ onClose: () => {
1057
+ e?.onClose?.();
1058
+ },
1059
+ ...n
1060
+ });
1061
+ }), Vt = "_styled-resizer_fdl5y_3", zt = {}, Ht = {
1062
+ flex: "1 1 100%",
1063
+ display: "flex",
1064
+ boxSizing: "border-box"
1065
+ }, Ut = ke(he((e, t) => {
1066
+ const { mainElement: o, sidebarElement: r, position: n, persistKey: a, onPositionChange: i, className: s, style: l, taskSide: c = "right", ...d } = e, [p, u] = ce(a ?? null, zt), m = nt(), [g, { width: h }] = se(), f = h > 530 || 0 === h, k = xe(null);
1067
+ let b, y, w = null, x = 4, v = 13;
1068
+ f ? w = "m 3.6261898,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.8836498,0 -1.60004965,-0.71626 -1.60004965,-1.59991 0,-0.88365 0.71639985,-1.6000508 1.60004965,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.8836498,0 -1.60004965,-0.7164 -1.60004965,-1.60004 0,-0.88365 0.71639985,-1.60005 1.60004965,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 1.14263,3.19996 0.42623015,2.48356 0.42623015,1.59991 0.42623015,0.71626 1.14263,0 2.0262798,0 c 0.88364,0 1.59991,0.71626 1.59991,1.59991" : (w = "M 1.59991,3.62619 C 0.71626,3.62619 0,2.90992 0,2.02628 0,1.1426301 0.71626,0.42623015 1.59991,0.42623015 c 0.88365,0 1.6000508,0.71639995 1.6000508,1.60004985 0,0.88364 -0.7164008,1.59991 -1.6000508,1.59991 m 4.881294,0 c -0.88364,0 -1.60004,-0.71627 -1.60004,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60004,-1.60004985 0.88365,0 1.60005,0.71639995 1.60005,1.60004985 0,0.88364 -0.7164,1.59991 -1.60005,1.59991 m 4.881226,0 c -0.88365,0 -1.60005,-0.71627 -1.60005,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60005,-1.60004985 0.88365,0 1.59991,0.71639995 1.59991,1.60004985 0,0.88364 -0.71626,1.59991 -1.59991,1.59991", x = 13, v = 4);
1069
+ let C, D = o, S = r;
1070
+ const W = "right" !== c, E = f ? "row" : "column", T = W && S ? "before" : "after", F = `${E}:${T}`, I = a ? p[F] : void 0, P = null != I ? `${I}%` : ((e, t) => {
1071
+ if (null == e) return "40%";
1072
+ if ("number" == typeof e || "string" == typeof e) return e;
1073
+ const o = e[t];
1074
+ return null != o ? `${o}%` : "40%";
1075
+ })(n, F), R = a || i ? (e) => {
1076
+ a && u((t) => ({
1077
+ ...t,
1078
+ [F]: e.percent
1079
+ })), i?.(e, {
1080
+ orientation: E,
1081
+ side: T,
1082
+ key: F
1083
+ });
1084
+ } : void 0;
1085
+ W && S ? (D = r, S = o, y = { style: {
1086
+ flexDirection: "column",
1087
+ boxSizing: "border-box",
1088
+ paddingRight: "2px"
1089
+ } }, b = {}, C = {
1090
+ fixedPane: "before",
1091
+ position: P,
1092
+ minBefore: f ? "280px" : "120px",
1093
+ splitDirection: f ? "row" : "column"
1094
+ }) : (b = { style: {
1095
+ flexDirection: "column",
1096
+ marginRight: r ? void 0 : "6px"
1097
+ } }, y = { style: {
1098
+ marginLeft: f ? "0px" : "4px",
1099
+ marginRight: f ? "8px" : "4px"
1100
+ } }, C = {
1101
+ fixedPane: "after",
1102
+ position: P,
1103
+ minAfter: f ? "280px" : "120px",
1104
+ splitDirection: f ? "row" : "column"
1105
+ });
1106
+ const A = kt([
1107
+ k,
1108
+ g,
1109
+ t
1110
+ ]);
1111
+ return _e(ee, {
1112
+ ref: A,
1113
+ className: s,
1114
+ style: l ? {
1115
+ ...Ht,
1116
+ ...l
1117
+ } : Ht,
1118
+ ...d,
1119
+ ...C,
1120
+ onPositionChange: R,
1121
+ propsResizer: {
1122
+ className: ht("styled-resizer", Vt),
1123
+ style: {
1124
+ minWidth: f ? "7px" : void 0,
1125
+ minHeight: f ? void 0 : "6px",
1126
+ maskImage: `url("data:image/svg+xml,%3Csvg width='${x}' height='${v}' viewBox='0 0 ${x} ${v}' version='1.1' fill='${m.palette.text.icon ?? m.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${w}' /%3E%3C/svg%3E%0A")`,
1127
+ maskRepeat: "no-repeat",
1128
+ maskPosition: W ? f ? "center center" : "bottom center" : f ? "left center" : "top center"
1129
+ }
1130
+ },
1131
+ elementBefore: D,
1132
+ propsPaneBefore: b,
1133
+ elementAfter: S,
1134
+ propsPaneAfter: y
1135
+ });
1136
+ }));
1137
+ Ut.displayName = "StudioSplitPane";
1138
+ var Gt = () => _e("div", { style: {
1139
+ flex: "none",
1140
+ height: 0,
1141
+ borderTop: "solid var(--sxl-color-base-border, light-dark(rgba(0, 0, 0, 0.26), rgba(255, 255, 255, 0.3))) 1px"
1142
+ } }), qt = (e, t) => {
1143
+ const o = (e) => _e(ge.Fragment, { children: t[e] }, e);
1144
+ if ("bottom" === e) {
1145
+ const e = t.statusBar && t.formulaBar ? _e(Gt, {}, "divider") : null;
1146
+ return [
1147
+ o("toolbar"),
1148
+ o("main"),
1149
+ o("statusBar"),
1150
+ e,
1151
+ o("formulaBar")
1152
+ ];
1153
+ }
1154
+ return [
1155
+ o("toolbar"),
1156
+ o("formulaBar"),
1157
+ o("main"),
1158
+ o("statusBar")
1159
+ ];
1160
+ }, Xt = je(pt("studio:dataValidationDetailsTaskPane", () => import("./dm8dmEaTIqfmgyeL.mjs"), { select: (e) => ({ default: e.DataValidationDetailsTaskPane }) }).load);
1161
+ l(), N("shape", {
1162
+ key: "changeShapeGallery",
1163
+ render: (e) => _e(f, {
1164
+ ...e,
1165
+ commandKey: "changeShape",
1166
+ excludeCategories: vt
1167
+ })
1168
+ }, {
1169
+ order: -1,
1170
+ divider: "after"
1171
+ }), j("shape", () => import("./Cfi_ly8fBDZZdiZT.mjs").then((e) => e.ShapeFormatPanel)), j("chart", () => import("./BLv99aovW4R3C5PE.mjs").then((e) => e.ChartFormatPanel)), N("picture", {
1172
+ key: "changePictureOptions",
1173
+ defaultKey: "changePictureFromFile",
1174
+ members: ["changePictureFromFile", "changePictureFromURL"]
1175
+ }, {
1176
+ order: -1,
1177
+ divider: "after"
1178
+ }), s(), H.register("plugin-table", { icons: {} }), v.registerTaskPane({
1179
+ key: "dataValidationDetails",
1180
+ getTitle: () => "Data Validation",
1181
+ getIcon: () => "DataValidation",
1182
+ component: Xt
1183
+ }, !0), v.registerTaskPane({
1184
+ key: "conditionalFormatDetails",
1185
+ getTitle: () => "Conditional Formatting",
1186
+ getIcon: () => "FormatPaint",
1187
+ component: xt
1188
+ }, !0), i(), a(), r(), t(), e(), n(), b();
1189
+ var Yt = () => {
1190
+ let e, t;
1191
+ const o = new Promise((o, r) => {
1192
+ e = o, t = r;
1193
+ }), r = {
1194
+ promise: o,
1195
+ settled: !1,
1196
+ resolve: (t) => {
1197
+ r.settled = !0, e(t);
1198
+ },
1199
+ reject: (e) => {
1200
+ r.settled = !0, t(e);
1201
+ }
1202
+ };
1203
+ return o.catch(() => {}), r;
1204
+ }, Zt = (e, t) => {
1205
+ if (!e) return {};
1206
+ const { colorSchemes: o, ...r } = e, n = o?.[t ? "dark" : "light"];
1207
+ return n && "object" == typeof n ? at.deepMerge(r, n) : r;
1208
+ }, Jt = "taskPanePosition", Qt = ke(he((e, t) => {
1209
+ const { host: r, scopeClass: n, square: a, elevation: i, variant: s, onWorkbookLoad: l, prefetch: m, onDocumentError: f, renderDocumentError: k = g, propsDocumentError: b, propsTaskPaneArea: y, renderTaskPaneArea: x = eo, taskPaneSide: v = "right", onKeyDown: C, workbook: S, onWorkbookChange: j, logo: N, topLeft: B, topRight: q, muiTheme: Y, tokens: ee, cssBaseline: oe, autoFocus: ne = !1, title: ie, onDirtyChange: se, propsDocumentTitle: le, renderDocumentLoading: ue = h, propsDocumentLoading: ge, propsWorkbook: he, showFormulaBar: fe, propsFormulaBar: ke, renderFormulaBar: Ce, formulaBarPlacement: De, manageVisualViewport: Ee = !0, editable: Fe, showStatusBar: Ie, propsStatusBar: Re, renderStatusBar: Ae, propsToolbar: je, renderToolbar: Ne } = e, Me = xe(null), Le = xe(null), Oe = xe(null), $e = re(() => {
1210
+ Oe.current?.getNamedCollectionEditorElement?.()?.focus?.();
1211
+ }, []), Be = ((e, t = "undefined" == typeof window ? "mouse" : Z.detectIt().primaryInput) => "top" === e || "bottom" === e ? e : "touch" === t ? "bottom" : "top")(De), ze = "bottom" === Be && Ee, He = me(ze), Ue = He ? Math.max(0, Math.round(window.innerHeight - He.height)) : 0, qe = He ? Math.round(He.offsetTop) : 0, Xe = He?.height;
1212
+ ye(() => {
1213
+ ze && void 0 !== Xe && (0 === window.scrollX && 0 === window.scrollY || window.scrollTo(0, 0));
1214
+ }, [ze, Xe]);
1215
+ const Je = re(f ?? (() => {}), [f]), Qe = re(se ?? (() => {}), [se]), tt = le?.placeHolder, [ot] = ce(T.Mode, E[T.Mode]), { themeMode: rt } = de({ mode: ot ?? void 0 }), [nt] = ce(G.Active, null), it = xe(nt);
1216
+ it.current = nt;
1217
+ const lt = pe(), ct = we(() => ({
1218
+ light: Pe(!1, at.deepMerge(Zt(Y, !1), w(lt?.light))),
1219
+ dark: Pe(!0, at.deepMerge(Zt(Y, !0), w(lt?.dark)))
1220
+ }), [
1221
+ Y,
1222
+ lt?.light,
1223
+ lt?.dark
1224
+ ]), dt = "dark" === rt, pt = we(() => d(ct.light, ct.dark, `.${n}`, ee), [
1225
+ ct,
1226
+ n,
1227
+ ee
1228
+ ]), ut = we(() => P("sxl-defaults", `.${n}`), [n]), mt = M(), [gt, ht] = ve(() => S ?? null);
1229
+ ye(() => {
1230
+ ht(S ?? null);
1231
+ }, [S]);
1232
+ const [kt, bt] = ve(0), wt = xe(null);
1233
+ wt.current || (wt.current = Yt());
1234
+ const xt = $(gt, {
1235
+ io: F,
1236
+ defaultTheme: mt.getDefaultTheme(),
1237
+ reloadKey: kt
1238
+ }), vt = "loaded" === xt.status ? xt.workbook : null, Ct = we(() => "error" === xt.status ? {
1239
+ status: "error",
1240
+ error: xt.error
1241
+ } : "loaded" === xt.status ? {
1242
+ status: "loaded",
1243
+ workbook: xt.workbook
1244
+ } : { status: "loading" }, [xt]);
1245
+ ye(() => {
1246
+ wt.current.settled && (wt.current = Yt());
1247
+ }, [gt, kt]), ye(() => {
1248
+ if ("loaded" === Ct.status) {
1249
+ const e = wt.current, t = Ct.workbook;
1250
+ t.whenFontsReady().then(() => e.resolve(t), () => e.resolve(t));
1251
+ } else "error" === Ct.status && (Je?.(Ct.error), wt.current.reject(Ct.error));
1252
+ }, [Ct]);
1253
+ const [St, Wt] = ve(null);
1254
+ vt && !St && Wt(vt);
1255
+ const Tt = vt && St && vt !== St ? vt : null, Ft = xe(Tt);
1256
+ Ft.current = Tt;
1257
+ const It = xe(St);
1258
+ It.current = St;
1259
+ const Pt = xe([]), Rt = be((e) => {
1260
+ const t = It.current;
1261
+ t && Pt.current.push(t), ht(e);
1262
+ }, []);
1263
+ ye(() => {
1264
+ const e = Pt.current;
1265
+ if (0 !== e.length) {
1266
+ Pt.current = e.filter((e) => e === St);
1267
+ for (let t = 0; t < e.length; t++) {
1268
+ const o = e[t];
1269
+ if (o !== St) try {
1270
+ o.close();
1271
+ } catch (e) {
1272
+ console.warn("Unable to close the replaced workbook", e);
1273
+ }
1274
+ }
1275
+ }
1276
+ }, [St]);
1277
+ const At = Fe ? null : St, jt = O(), Mt = we(() => {
1278
+ const e = At?.getSelectedWorksheet() ?? At?.getWorksheets().getItems({ visibility: "veryHidden" })[0];
1279
+ return e ? R(e, { referenceMode: jt }) : null;
1280
+ }, [At, jt]), Lt = Fe ?? Mt, $t = xe(Lt);
1281
+ $t.current = Lt, ye(() => {
1282
+ if (!Lt) return;
1283
+ let e = Lt.getSession();
1284
+ return Lt.subscribe(() => {
1285
+ const t = e;
1286
+ e = Lt.getSession(), t && !e && "formula-bar" === t.getActiveEditorId() && Oe.current?.contains?.(document.activeElement) && Me.current?.focus();
1287
+ });
1288
+ }, [Lt]);
1289
+ const Bt = K(St), { isDirty: _t, saveState: Kt } = V(St, F), Vt = _(St), zt = xe(Kt), Ht = xe(null);
1290
+ zt.current = Kt;
1291
+ const Gt = be(() => zt.current?.isDirty() ?? !1, []), Xt = xe(Ct);
1292
+ Xt.current = Ct;
1293
+ const [Qt, to] = ve(null), oo = ie ?? le?.title, [ro, no] = ve(null);
1294
+ ye(() => {
1295
+ no(null);
1296
+ }, [St]);
1297
+ const ao = oo ?? ro ?? Bt ?? "";
1298
+ ye(() => {
1299
+ Qe?.(_t);
1300
+ }, [_t]);
1301
+ const io = re(j ?? (() => {}), [j]);
1302
+ ye(() => {
1303
+ io?.(vt);
1304
+ }, [vt]);
1305
+ const so = xe(vt);
1306
+ so.current = vt, L(St, "onViewChange");
1307
+ const lo = we(() => _e(Se, {
1308
+ groupKey: "helpOptions",
1309
+ disableHover: !0,
1310
+ sx: { padding: "0" },
1311
+ propsButton: { sx: { maxHeight: "22px" } }
1312
+ }), []), [co, po] = ve(null), uo = be((e) => {
1313
+ po(e);
1314
+ }, []);
1315
+ ye(() => {
1316
+ H.prefetch([H.getActive(), D]).catch((e) => {
1317
+ console.warn("Icons could not be loaded:", e);
1318
+ });
1319
+ }, []);
1320
+ const mo = xe(null);
1321
+ mo.current || (mo.current = Yt());
1322
+ const go = xe(null), ho = be(() => go.current?.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? mo.current.promise, []), fo = re(async (e) => {
1323
+ const t = it.current;
1324
+ t && t !== st.getActive() && await st.setActive(t), await z.DefaultCommandCatalogService.prefetch(t ?? void 0), to(e), go.current = e.source, mo.current.settled || mo.current.resolve(e.source.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? null), l?.(e);
1325
+ }, []), ko = xe(null), bo = be((e) => {
1326
+ let t = null, r = {
1327
+ readOnly: !0,
1328
+ ...le
1329
+ };
1330
+ return le?.hidden || (t = _e(o, {
1331
+ ...r,
1332
+ style: {
1333
+ maxWidth: "100%",
1334
+ ...le?.style
1335
+ },
1336
+ workbook: e.workbook ?? Me.current,
1337
+ ref: ko,
1338
+ title: ao,
1339
+ modified: _t,
1340
+ encrypted: Vt,
1341
+ placeHolder: tt,
1342
+ onTitleChange: (e) => {
1343
+ no(e), le?.onTitleChange?.(e);
1344
+ }
1345
+ })), _e(Et, {
1346
+ ...e,
1347
+ logo: N,
1348
+ mainElement: t,
1349
+ startElement: B,
1350
+ endElement: q
1351
+ });
1352
+ }, [
1353
+ N,
1354
+ ao,
1355
+ _t,
1356
+ Vt,
1357
+ le,
1358
+ B,
1359
+ q
1360
+ ]);
1361
+ ye(() => {
1362
+ const e = Me.current;
1363
+ if (!e) return;
1364
+ const t = (t) => {
1365
+ (t.ctrlKey || t.metaKey || "native" !== Q.getWheelOwner(t, e)) && t.preventDefault();
1366
+ };
1367
+ return e.addEventListener("wheel", t, { passive: !1 }), () => {
1368
+ e.removeEventListener("wheel", t);
1369
+ };
1370
+ }, [Qt]);
1371
+ const [yo, wo] = ve(null);
1372
+ ye(() => {
1373
+ wo(Qt?.source?.getCommandScope?.() ?? null);
1374
+ }, [Qt]);
1375
+ const xo = we(() => ({
1376
+ "& .SnackbarContainer-root": { position: "absolute !important" },
1377
+ "& .notistack-SnackbarContainer > div": { maxWidth: "min(100%, 720px)" },
1378
+ "& .notistack-Snackbar": { minWidth: "unset" },
1379
+ "& .notistack-Snackbar > .error-snackbar .MuiTypography-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
1380
+ "& .notistack-Snackbar > .error-snackbar .MuiCardActions-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
1381
+ "& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
1382
+ "& .notistack-MuiContent *": { fontFamily: (e) => e.typography.fontFamily },
1383
+ "& #notistack-snackbar": {
1384
+ maxWidth: "560px",
1385
+ whiteSpace: "pre-wrap"
1386
+ },
1387
+ "*": { userSelect: "none" }
1388
+ }), []), [vo, Co] = ve(null), [, Do] = ce(null, !1);
1389
+ ye(() => {
1390
+ Do(null != vo);
1391
+ }, [vo, Do]);
1392
+ const So = be((e) => x({
1393
+ model: St,
1394
+ side: v,
1395
+ ...e,
1396
+ ...y
1397
+ }), [
1398
+ St,
1399
+ v,
1400
+ y
1401
+ ]), Wo = xe(r);
1402
+ Wo.current = r, ae(t, () => ({
1403
+ isStudioElement: () => !0,
1404
+ save: (e) => {
1405
+ const t = Ht.current;
1406
+ return t ? t(e) : Promise.reject(/* @__PURE__ */ new Error("The studio cannot save: no workbook, or the backing store cannot write."));
1407
+ },
1408
+ getWorkbookElement: () => Me.current,
1409
+ getWorkbook: () => so.current ?? null,
1410
+ isDirty: () => zt.current?.isDirty() ?? !1,
1411
+ getEditable: () => $t.current,
1412
+ getFormulaBarElement: () => Oe.current ?? null,
1413
+ focus: () => Me.current?.focus(),
1414
+ whenReady: () => (wt.current || (wt.current = Yt()), wt.current.promise),
1415
+ getWorkbookState: () => Xt.current,
1416
+ retry: () => bt((e) => e + 1)
1417
+ }), [], r);
1418
+ const Eo = xe(!1), To = re((e, t) => {
1419
+ t === Ft.current && requestAnimationFrame(() => requestAnimationFrame(() => {
1420
+ t === Ft.current && (Eo.current = Wo.current?.contains(document.activeElement) ?? !0, Wt(t), fo(e));
1421
+ }));
1422
+ }, []);
1423
+ ye(() => {
1424
+ Eo.current && (Eo.current = !1, Me.current?.focus());
1425
+ }, [St]);
1426
+ const Fo = be((e) => {
1427
+ const { ref: t, ...o } = e, r = dt ? ct.dark : ct.light, n = "error" === Ct.status && k ? _e(J, {
1428
+ render: k,
1429
+ props: {
1430
+ ...b,
1431
+ style: {
1432
+ width: "100%",
1433
+ height: "100%",
1434
+ ...b?.style
1435
+ },
1436
+ error: Ct.error
1437
+ }
1438
+ }) : null;
1439
+ if (n && !St) return _e(Ye, {
1440
+ style: {
1441
+ width: "100%",
1442
+ height: "100%",
1443
+ position: "absolute",
1444
+ display: "flex",
1445
+ alignItems: "stretch",
1446
+ justifyContent: "stretch"
1447
+ },
1448
+ children: n
1449
+ });
1450
+ let l = null;
1451
+ if (St) {
1452
+ const e = St, n = e.getView(), a = fe ?? n?.isShowFormulaBar(), i = Ie ?? n?.isShowStatusBar(), s = Qt?.source ?? Me.current, d = _e(J, {
1453
+ render: void 0 === Ne ? bo : Ne,
1454
+ props: {
1455
+ workbook: s,
1456
+ ...je
1457
+ }
1458
+ }), g = "bottom" === Be, h = a ? _e(J, {
1459
+ render: void 0 === Ce ? p : Ce,
1460
+ props: {
1461
+ ref: Oe,
1462
+ style: {
1463
+ marginTop: r.spacing(g ? .5 : .25),
1464
+ marginLeft: r.spacing(1),
1465
+ marginRight: r.spacing(1),
1466
+ marginBottom: r.spacing(g ? .5 : .75)
1467
+ },
1468
+ workbook: e,
1469
+ editable: Lt ?? void 0,
1470
+ placement: Be,
1471
+ ...ke,
1472
+ propsNamedCollectionEditor: {
1473
+ restoreFocus: (e) => s?.focus(e),
1474
+ ...ke?.propsNamedCollectionEditor
1475
+ }
1476
+ }
1477
+ }) : null, f = i ? _e(J, {
1478
+ render: void 0 === Ae ? u : Ae,
1479
+ props: {
1480
+ childrenEnd: lo,
1481
+ ...Re
1482
+ }
1483
+ }) : null, k = (e, r) => _e(c, {
1484
+ ...he,
1485
+ tabIndex: 0,
1486
+ autoFocus: !r && ne,
1487
+ workbook: e,
1488
+ editable: r ? void 0 : Lt ?? void 0,
1489
+ focusNameBox: r ? void 0 : $e,
1490
+ prefetch: !r && m,
1491
+ ref: r ? Le : ft([t, Me]),
1492
+ onWorkbookLoad: r ? (t) => To(t, e) : fo,
1493
+ onKeyDown: (e) => {
1494
+ C?.(e);
1495
+ },
1496
+ propsWorkbookLoading: ge,
1497
+ renderWorkbookLoading: null,
1498
+ style: r ? {
1499
+ ...he?.style,
1500
+ position: "absolute",
1501
+ inset: 0,
1502
+ visibility: "hidden"
1503
+ } : {
1504
+ flex: "1 1 100%",
1505
+ minHeight: 0,
1506
+ ...he?.style
1507
+ },
1508
+ onContextMenu: (e) => e.preventDefault(),
1509
+ ...r ? null : o
1510
+ }, e.getId());
1511
+ l = _e("div", {
1512
+ style: {
1513
+ display: "flex",
1514
+ flexDirection: "column",
1515
+ flex: "1 1 100%",
1516
+ minWidth: 0,
1517
+ minHeight: 0,
1518
+ ...A({
1519
+ window: r.palette.background.default,
1520
+ windowText: r.palette.text.primary
1521
+ })
1522
+ },
1523
+ children: qt(Be, {
1524
+ toolbar: d,
1525
+ formulaBar: h,
1526
+ statusBar: f,
1527
+ main: _e(Ut, {
1528
+ taskSide: v,
1529
+ persistKey: Jt,
1530
+ sidebarElement: vo ? _e(z.CommandScopeProvider, {
1531
+ scope: yo,
1532
+ children: vo
1533
+ }) : void 0,
1534
+ mainElement: Ke("div", {
1535
+ style: {
1536
+ position: "relative",
1537
+ display: "flex",
1538
+ flexDirection: "column",
1539
+ flex: "1 1 100%",
1540
+ minWidth: 0,
1541
+ minHeight: 0
1542
+ },
1543
+ children: [[k(St, !1), Tt ? k(Tt, !0) : null], _e(Ve, {
1544
+ ref: uo,
1545
+ sx: {
1546
+ position: "absolute",
1547
+ top: "10%",
1548
+ left: 0,
1549
+ right: 0,
1550
+ bottom: 0,
1551
+ pointerEvents: "none",
1552
+ "& > :first-of-type": { position: "relative" }
1553
+ }
1554
+ })]
1555
+ })
1556
+ })
1557
+ })
1558
+ });
1559
+ }
1560
+ const d = !Qt && ue ? _e(J, {
1561
+ render: ue,
1562
+ props: { ...ge }
1563
+ }) : null;
1564
+ return Ke(Ye, {
1565
+ sx: xo,
1566
+ style: {
1567
+ width: "100%",
1568
+ height: Ue ? `calc(100% - ${Ue}px)` : "100%",
1569
+ transform: qe ? `translateY(${qe}px)` : void 0,
1570
+ overscrollBehavior: ze ? "none" : void 0,
1571
+ position: "absolute",
1572
+ display: "flex",
1573
+ alignItems: "stretch",
1574
+ justifyContent: "stretch",
1575
+ backgroundColor: "var(--sxl-color-base-200)"
1576
+ },
1577
+ className: "eager-studio",
1578
+ square: a,
1579
+ elevation: i,
1580
+ variant: s,
1581
+ children: [
1582
+ l,
1583
+ n ? _e(Ye, {
1584
+ style: {
1585
+ position: "absolute",
1586
+ inset: 0,
1587
+ display: "flex",
1588
+ alignItems: "stretch",
1589
+ justifyContent: "stretch"
1590
+ },
1591
+ children: n
1592
+ }) : null,
1593
+ d ? _e("div", {
1594
+ style: {
1595
+ position: "absolute",
1596
+ inset: 0,
1597
+ display: "flex",
1598
+ alignItems: "center",
1599
+ justifyContent: "center",
1600
+ background: `var(--sxl-color-base-100, ${dt ? "#121212" : "#fff"})`
1601
+ },
1602
+ children: d
1603
+ }) : null
1604
+ ]
1605
+ });
1606
+ }, [
1607
+ Ct,
1608
+ St,
1609
+ Tt,
1610
+ Qt,
1611
+ ao,
1612
+ ue,
1613
+ ge,
1614
+ he,
1615
+ a,
1616
+ i,
1617
+ s,
1618
+ lo,
1619
+ k,
1620
+ b,
1621
+ bo,
1622
+ xo,
1623
+ vo,
1624
+ v,
1625
+ yo,
1626
+ fe,
1627
+ ke,
1628
+ Ce,
1629
+ Be,
1630
+ Lt,
1631
+ Ie,
1632
+ Re,
1633
+ Ae,
1634
+ je,
1635
+ Ne,
1636
+ ze,
1637
+ Ue,
1638
+ qe,
1639
+ ct,
1640
+ dt
1641
+ ]);
1642
+ let Io = _e(yt, {
1643
+ maxSnack: 3,
1644
+ domRoot: co ?? void 0,
1645
+ anchorOrigin: {
1646
+ vertical: "bottom",
1647
+ horizontal: "right"
1648
+ },
1649
+ autoHideDuration: 3500,
1650
+ onClose: (e, t, o) => {
1651
+ Me.current?.focus();
1652
+ },
1653
+ Components: { error: Dt },
1654
+ iconVariant: {
1655
+ success: _e(Ze, {
1656
+ style: { marginRight: "8px" },
1657
+ children: _e("path", { d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" })
1658
+ }),
1659
+ error: _e(U, {
1660
+ iconKey: "ErrorAlert",
1661
+ style: { marginRight: "8px" }
1662
+ })
1663
+ },
1664
+ children: _e(I, {
1665
+ workbook: St,
1666
+ children: _e(W, {
1667
+ renderArea: So,
1668
+ onUpdateArea: (e) => {
1669
+ Co(e);
1670
+ },
1671
+ children: _e(Te, { children: _e(Ot, { children: _e(te, { children: _e(X, { children: _e(Nt, {
1672
+ workbook: St,
1673
+ initialCommandAnchor: ho,
1674
+ renderWorkbook: Fo,
1675
+ setWorkbook: Rt,
1676
+ titleWorkbook: ao,
1677
+ setWorkbookTitle: no,
1678
+ refDocumentTitle: ko,
1679
+ isDirty: Gt,
1680
+ refSave: Ht,
1681
+ host: r
1682
+ }) }) }) }) })
1683
+ })
1684
+ })
1685
+ });
1686
+ return Io = Ke(et, {
1687
+ theme: dt ? ct.dark : ct.light,
1688
+ children: [
1689
+ oe ? _e(Ge, {}) : null,
1690
+ _e("style", { children: pt }),
1691
+ _e("style", { children: ut }),
1692
+ _e(We, {
1693
+ themeScopeClass: n,
1694
+ themeSurface: "app",
1695
+ themeMode: rt,
1696
+ children: Io
1697
+ })
1698
+ ]
1699
+ }), Io;
1700
+ }));
1701
+ Qt.displayName = "EagerStudio";
1702
+ var eo = (e) => _e(Kt, { ...e });
1703
+ export { Qt as EagerStudio, Qt as default };