@sheetxl/studio-mui 0.7.19 → 0.7.20
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/browser/cjs/9A8PR69vLQMV7BcN.cjs +20 -0
- package/browser/cjs/{DdfZbPGZ8PPPUM_a.cjs → BQNV7GVR6JkMal0s.cjs} +1 -1
- package/browser/cjs/{CRfQidmKBQ4Osnbw.cjs → BU-c6ouMN5P9GFpC.cjs} +1 -1
- package/browser/cjs/{CnqcFtkhyr8c_vIx.cjs → CPXMzOdl6xxPLfPn.cjs} +6 -6
- package/browser/cjs/{Bewd3fxKZsnU-nNE.cjs → C_j6lCasu1t14O9Y.cjs} +1 -1
- package/browser/cjs/{DQDHzkk3uE69oOf1.cjs → CtrHMVYocAsdsdWM.cjs} +2 -2
- package/browser/cjs/{BGM5Egsh-nk8JoMR.cjs → DG1AUTzpqtpS_jVC.cjs} +1 -1
- package/browser/cjs/{O0u5_8LdiNZxf7nW.cjs → Dc9yE1yxW-8SY3Hv.cjs} +1 -1
- package/browser/cjs/{bHc9WXWuOLgCy20D.cjs → Dj9IHyA7WeKPeOcw.cjs} +1 -1
- package/browser/cjs/{DeVzYeQ2NQw772Pw.cjs → DncFK07jNQbBqKkM.cjs} +3 -3
- package/browser/cjs/{CDa5R5H06f0QGbLy.cjs → DoSWqHU9pvfHVYlj.cjs} +2 -2
- package/browser/cjs/{DLI8Ew9QZfYFQggZ.cjs → hW1tQx38Ra1unYqS.cjs} +2 -2
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{B_99zP5rSV8EjlLY.mjs → BCJfGxexFSseQSX1.mjs} +1 -1
- package/browser/esm/{CW4BTiGS1PKWCRBT.mjs → BG8BFBORDGBJ3nhX.mjs} +2 -2
- package/browser/esm/{Epfu4gRj2jHk_aDB.mjs → BW4phvITufQ_VYkF.mjs} +524 -525
- package/browser/esm/{C4TtshZ7KhuiUGbn.mjs → BZ9mDgpYGUEkfYek.mjs} +3 -3
- package/browser/esm/{DDfXhHCLfmybPYNh.mjs → CCw88yjz7gsAET8V.mjs} +2 -2
- package/browser/esm/{CxSd30g44XJ8mnmj.mjs → CzI2pgZrodF1v9Qy.mjs} +2 -2
- package/browser/esm/{BdkP5a6d0ML7Y0b2.mjs → CzbyIwG_G4o6kvXx.mjs} +1 -1
- package/browser/esm/{Cmnwt2GoquorcXj3.mjs → DnnkEOAQ3T-BZ8YN.mjs} +1 -1
- package/browser/esm/DuBLWU88ClLWzYcS.mjs +4510 -0
- package/browser/esm/{DUKRC4tS-eJTCx_v.mjs → MNeM7EdplvhB32i_.mjs} +1 -1
- package/browser/esm/{jCtxuLpDj7wzHB8p.mjs → R5qqTNvjnM3WxJs7.mjs} +1 -1
- package/browser/esm/index.mjs +18 -19
- package/browser/esm/{CQRjYFZa4QbRTGg_.mjs → tHtBuu4Jh64s0gfO.mjs} +1 -1
- package/licenses/dependencies.txt +139 -139
- package/node/esm/{eZ7cx2YnaEfXyfU8.mjs → BCop3xTgurk_pOXZ.mjs} +1 -1
- package/node/esm/{BEnfb2SK8bA4gTFW.mjs → BFHAvoo6cadd7zYQ.mjs} +1 -1
- package/node/esm/{DNlKlusE8DeOTRuC.mjs → BScUpdKO-b4Gr5Xm.mjs} +1 -1
- package/node/esm/{BZDELNZUW344wqXt.mjs → BcKSdSKQD8WAIJsN.mjs} +1 -1
- package/node/esm/{CkTwDMf16gYei7o2.mjs → BrOlE1aJNCNuEX5e.mjs} +2 -3
- package/node/esm/{Id0KR5kK1ADVhWhD.mjs → Cy29Wsw-LIboDmIX.mjs} +1 -1
- package/node/esm/{DiTrdBQV2uxN3GKM.mjs → DxLeMhSCAbLseA57.mjs} +1 -1
- package/node/esm/{D3_AGbvzQKHFYZxn.mjs → DzH9wpTF59hEQ5jd.mjs} +1 -1
- package/node/esm/{B8fe0e-2ZKPkjmUL.mjs → QXAsw9Yj3OjQnfqS.mjs} +1 -1
- package/node/esm/index.mjs +1025 -1028
- package/node/esm/{BNP3QSlZuis44plx.mjs → xfteOmuy00dffn5q.mjs} +1 -1
- package/package.json +8 -8
- package/types/index.d.ts +87 -108
- package/browser/cjs/BZwSUqHASXkJlWax.cjs +0 -20
- package/browser/esm/D0Qe0M3MAH6Ya8_q.mjs +0 -4513
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";var Tl=Object.create;var En=Object.defineProperty;var Bl=Object.getOwnPropertyDescriptor;var Rl=Object.getOwnPropertyNames;var Pl=Object.getPrototypeOf,Ml=Object.prototype.hasOwnProperty;var Dl=(a,l,o,t)=>{if(l&&typeof l=="object"||typeof l=="function")for(let r of Rl(l))!Ml.call(a,r)&&r!==o&&En(a,r,{get:()=>l[r],enumerable:!(t=Bl(l,r))||t.enumerable});return a};var Fl=(a,l,o)=>(o=a!=null?Tl(Pl(a)):{},Dl(l||!a||!a.__esModule?En(o,"default",{value:a,enumerable:!0}):o,a));/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.20
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/const L=require("@sheetxl/sdk"),ne=require("@sheetxl/react"),e=require("react/jsx-runtime"),n=require("react"),T=require("@mui/material"),y=require("@sheetxl/utils-mui"),G=require("@mui/material/styles"),k=require("@sheetxl/utils-react"),et=require("react-dom"),Pe=require("@mui/system"),ve=require("@sheetxl/utils"),st=require("@sheetxl/io");function Ca(a){var l,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a)){var r=a.length;for(l=0;l<r;l++)a[l]&&(o=Ca(a[l]))&&(t&&(t+=" "),t+=o)}else for(o in a)a[o]&&(t&&(t+=" "),t+=o);return t}function de(){for(var a,l,o=0,t="",r=arguments.length;o<r;o++)(a=arguments[o])&&(l=Ca(a))&&(t&&(t+=" "),t+=l);return t}const Sa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...h}=a,i=k.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),u=n.useMemo(()=>{for(let p=0;p<i.length;p++)if(i[p]?.state())return i[p];return i[0]},[i]),g=n.useMemo(()=>{if(!t)return null;const p={...t};return delete p.beforeExecute,p},[t]),b=n.useCallback((p,d)=>{const m={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},S=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignLeftToggle")}),e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignCenterToggle")}),e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignRightToggle")}),e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignJustifyToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignFillToggle")}),e.jsx(y.CommandButton,{...m,command:d.getCommand("formatAlignDistributedHorizontalToggle")})]}),C=e.jsxs(T.Box,{sx:{className:de("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:x=>x.stopPropagation(),children:[e.jsx(y.CommandButton,{command:d.getCommand("formatIndentDecrease"),commandHook:g,scope:r,disabled:s}),e.jsx(y.CommandButton,{command:d.getCommand("formatIndentIncrease"),commandHook:g,scope:r,disabled:s})]}),f=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...h,children:[C,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:S})]});return y.defaultCreatePopupPanel({...p,children:f})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:l,parentFloat:c,commands:o,commandHook:t,scope:r,createPopupPanel:b,label:"Horizontal Alignment",tooltip:"Configure how text is placed in the horizontal direction of the cell.",quickCommand:u?.key(),icon:u?.icon()??"FormatAlignLeft",...h})})),wa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),{activeCommand:i,allDisabled:u}=n.useMemo(()=>{const b=h.length;let p,d=0;for(let m=0;m<b;m++){const S=h[m];S&&!S.disabled()&&(!p&&S?.state()&&(p=S),d++)}return p=p??h[0],{activeCommand:p,allDisabled:d===0}},[h]),g=n.useCallback((b,p)=>{const d={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...d,command:p.getCommand("formatAlignTopToggle")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatAlignMiddleToggle")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatAlignBottomToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatAlignDistributedVerticalToggle")})]});return y.defaultCreatePopupPanel({...b,children:m})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,createPopupPanel:g,disabled:s||u,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:i?.icon()??"TextVerticalBottom",...c})})),ka=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),{activeCommand:i,allDisabled:u}=n.useMemo(()=>{const b=h.length;let p,d=0;for(let m=0;m<b;m++){const S=h[m];S&&!S.disabled()&&(!p&&S?.state()&&(p=S),d++)}return p=p??h[0],{activeCommand:p,allDisabled:d===0}},[h]),g=k.useCallbackRef((b,p)=>{const d={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextOverflowWrapToggle")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextOverflowClipToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextOverflowShrinkToggle")})]});return y.defaultCreatePopupPanel({...b,children:m})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,disabled:s||u,scope:r,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:g,icon:i?.icon()??"TextHorizontalOverflow",...c})})),va=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),i=n.useMemo(()=>{const b=h.length;for(let p=0;p<b;p++){const d=h[p];if(d?.state())return d}return h[1]},[h]),u=n.useCallback((b,p)=>{const d={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextRotate0")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextRotate315")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextRotate45")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextRotate90")}),e.jsx(y.CommandButton,{...d,command:p.getCommand("formatTextRotate270")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.InputCommandButton,{...d,command:p.getCommand("formatTextRotateCustom"),label:"Custom"})]});return y.defaultCreatePopupPanel({...b,children:m})},[s,t,r,o]),g=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.state()??0)!==0,[h]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,scope:r,selected:g,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:u,quickCommand:g?"formatTextRotate0":"formatTextRotate315",icon:i?.icon()??"TextRotation315",...c})})),ja={Preset:"preset",Custom:"custom"},ut={Start:"start",End:"end"},fo={},Il=(a,l,o,t)=>{const r=a+"-"+l+"-"+o+(t?"-server":"");if(fo[r])return fo[r];const s=((c,h,i,u)=>{if(typeof document>"u"&&!u)return null;const g=u?new u:document.createElement("canvas");g.width=2*i,g.height=2*i;const b=g.getContext("2d");return b?(b.fillStyle=c,b.fillRect(0,0,g.width,g.height),b.fillStyle=h,b.fillRect(0,0,i,i),b.translate(i,i),b.fillRect(0,0,i,i),g.toDataURL()):null})(a,l,o,t);return fo[r]=s,s},Nl={},Ea=n.memo(a=>{const{className:l,style:o=k.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:c,boxShadow:h,renderers:i=Nl,children:u,...g}=a,b=u,p=n.useMemo(()=>Object.assign({borderRadius:c,boxShadow:h,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Il(t,r,s,i?.canvas)}) center left`},o),[t,r,s,i]);return n.isValidElement(u)?n.cloneElement(u,{...b.props}):e.jsx("div",{style:p,...g})}),Ol=n.memo(a=>{const{selectedColor:l,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:c,onMouseLeave:h,onFocus:i,style:u=k.ReactUtils.EmptyCssProperties,children:g,alphaWhite:b,alphaGrey:p,darkMode:d,alphaCheckSize:m=7,...S}=a;if(!l)throw new Error("a selectedColor is required");const C=n.useCallback(E=>{r?.(E),E.isDefaultPrevented()||(E.ctrlKey?t?.(l.toRGBA()):o?.(l.toRGBA()))},[o,t,r,l]),f=n.useCallback(E=>{c?.(E),E.isDefaultPrevented()||t?.(l.toRGBA())},[t,c,l]),x=n.useCallback(E=>{h?.(E),E.isDefaultPrevented()},[t,h]),w=n.useCallback(E=>{i?.(E),E.isDefaultPrevented()||t?.(l.toRGBA())},[t,i,l]),j=n.useCallback(E=>{s?.(E),E.isDefaultPrevented()||E.keyCode===k.KeyCodes.Enter&&o?.(l.toRGBA())},[o,s,l]),v=n.useMemo(()=>l.toRGBA().alpha===1?null:e.jsx(Ea,{size:m,white:b,grey:p,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[b,p,l]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...u},tabIndex:0,...S,onClick:C,onKeyDown:j,onMouseOver:f,onMouseLeave:x,onFocus:w,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:l.toCSS(d)},children:g})]})}),no=n.memo(a=>{const{schemeColorLookup:l,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:c,swatchProps:h,defaultButtonSize:i=24,isLarge:u=!1,compareRGB:g=!1,darkMode:b=!1,...p}=a,d=new L.Color({val:r.definition.val,adjs:r.definition.adjs},v=>l(v)),m=g?d.toRGBA().toString():d.toString(),S=o&&(g?o.toRGBA().toString():o.toString())===m,C=t&&(g?t.toRGBA().toString():t.toString())===m,f=[];f.push({[L.IColor.AdjustmentType.Inv]:!0}),f.push({[L.IColor.AdjustmentType.Alpha]:100});const x=d.adjust(f),w=n.useCallback(()=>{s?.(r)},[s,r]),j=n.useCallback(v=>{c?.(v?r:null)},[c,r]);return e.jsx(y.SimpleTooltip,{disableInteractive:!0,PopperProps:{style:{pointerEvents:"none"},disablePortal:!0,popperOptions:{strategy:"fixed",modifiers:[{name:"preventOverflow",enabled:!0,options:{boundariesElement:"viewport"}}]}},title:r.description,placement:"bottom-start",children:e.jsx("div",{style:{width:i*(u?1.2:1)+"px",height:i*(u?1.2:1)+"px",position:"relative",boxSizing:"border-box",cursor:"pointer",outline:"none"},...p,children:e.jsxs(Ol,{selectedColor:d,title:null,onSelectColor:w,onPreviewColor:j,alphaCheckSize:u?9:void 0,darkMode:b,...h,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:x.toRGBA(b).toString(),borderWidth:"2px",borderStyle:"solid",boxSizing:"border-box",opacity:S?"1":"0"}}),e.jsx("div",{style:{position:"absolute",width:.33*i*(u?1.2:1)+"px",height:.33*i*(u?1.2:1)+"px",left:"calc(50% - 0.5px)",top:"calc(50% - 0.5px)",transform:"translate(-50%,-50%)",pointerEvents:"none",background:x.toRGBA(b).toString(),borderRadius:"50%",opacity:C?"1":"0"}})]})})})}),Rt=n.memo(a=>{const{title:l,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:c,onPreviewColorDef:h,style:i=k.ReactUtils.EmptyCssProperties,compareRGB:u=!1,darkMode:g,swatchProps:b,...p}=a;let d;if(Array.isArray(t[0]))d=t;else{d=[];for(let x=0;x<t.length;x++)d.push([t[x]])}const m=n.useCallback(x=>{c?.(x)},[c]),S=n.useCallback(x=>{h?.(x)},[h]),C=n.useMemo(()=>{let x=[];for(let w=0;w<d.length;w++){let j=[],v=d[w];for(let P=0;P<v.length;P++){let B=v[P];j.push(e.jsx(no,{schemeColorLookup:o,colorDef:B,selectedColor:r,previewColor:s,onSelectColorDef:m,onPreviewColorDef:S,swatchProps:b,compareRGB:u,darkMode:g},w+" "+P))}let E=e.jsx(T.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:P=>P.shadows[2],borderRadius:"2px",overflow:"hidden"},children:j},""+w);x.push(E)}return x},[d,r,s,m,S]),f=n.useMemo(()=>l?e.jsx(T.Typography,{noWrap:!0,component:"div",sx:{display:"flex",flexShrink:"0",paddingLeft:"6px",paddingBottom:"4px",paddingTop:"0px",userSelect:"none",color:x=>x.palette.text.secondary},children:l}):null,[l]);return e.jsxs(T.Box,{style:{...i},children:[f,e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...p,children:C})]})}),De=(a,l)=>({description:a,definition:{val:l,adjs:[]}}),ge=(a,l,o,t,r,s)=>{const c=De(a,l);t?.push(c);const h=new L.Color({val:c.definition.val,adjs:c.definition.adjs},o),i=h.toString();r?.set(i,h);const u=h.toRGBA().toString();s?.set(u,h)},Al=n.lazy(()=>Promise.resolve().then(()=>require("./CPXMzOdl6xxPLfPn.cjs"))),Ta=n.memo(n.forwardRef((a,l)=>{const{selectedColor:o=null,previewColor:t=a.selectedColor??null,recentColors:r,schemeLookup:s,disableAlpha:c=!1,previewDebounceTime:h=100,initialPanelType:i,defaultButtonSize:u=24,width:g,onElementLoad:b,onDone:p,onEyeDropStart:d,onEyeDropStop:m,onPreviewColor:S,onPreviewColorImmediate:C,onSelectColor:f,autoColor:x,autoColorLabel:w="Automatic",autoColorPosition:j=ut.Start,compareRGB:v=!1,darkMode:E=!1,...P}=a,B=t||o,R=k.useCallbackRef(S,[S]),D=k.useCallbackRef(C,[C]),F=k.useCallbackRef(f,[f]),M=k.useCallbackRef(d,[d]),N=k.useCallbackRef(m,[m]),[z,I]=n.useState(!1),A=G.useTheme(),O=n.useMemo(()=>s||L.Color.getDefaultSchemeLookup(),[s]),W=n.useMemo(()=>{const _=new Map,ee=new Map,me=[];ge("Primary Background","bg1",O,me,_,ee),ge("Primary Text","tx1",O,me,_,ee),ge("Secondary Background","bg2",O,me,_,ee),ge("Secondary Text","tx2",O,me,_,ee),ge("Accent 1","accent1",O,me,_,ee),ge("Accent 2","accent2",O,me,_,ee),ge("Accent 3","accent3",O,me,_,ee),ge("Accent 4","accent4",O,me,_,ee),ge("Accent 5","accent5",O,me,_,ee),ge("Accent 6","accent6",O,me,_,ee);const je=L.ITheme.buildPalette(me,O,_,ee),se=[];if(ge("Dark Red","C00000",O,se,_,ee),ge("Red","FF0000",O,se,_,ee),ge("Orange","FFC000",O,se,_,ee),ge("Yellow","FFFF00",O,se,_,ee),ge("Light Green","92D050",O,se,_,ee),ge("Green","00B050",O,se,_,ee),ge("Light Blue","00B0F0",O,se,_,ee),ge("Blue","0070C0",O,se,_,ee),ge("Dark Blue","002060",O,se,_,ee),c?ge("Purple Is A Fruit","7030A0",O,se,_,ee):ge("Transparent","00000000",O,se,_,ee),x){const ce=x.toString();_.set(ce,x)}const Oe=new Map,Te=typeof r=="function"?r():r,Q=[];for(let ce=0;Te&&ce<Te.length;ce++){const Ee=Te[ce].toString();Oe.set(Ee,Te[ce]),Q.push({description:"Recent "+(ce+1),definition:{val:Te[ce].toString()}})}return{primaryColors:me,modifiedPresets:je,standardColors:se,recentColorsLimited:Q,mapAllPresets:_,mapAllPresetsRGB:ee,mapRecent:Oe}},[O,r,c,x]);n.useEffect(()=>{b?.()},[]);const[Z,J]=n.useState(!1),te=n.useCallback(()=>{J(_=>!_)},[]);n.useEffect(()=>{if(i)J(i===ja.Custom);else if(o){let _=o.toString(),ee=W.mapAllPresets.get(_);ee||(_=o.toRGBA().toString(),ee=W.mapAllPresetsRGB.get(_));const me=W.mapRecent.get(_);J(!ee&&!me)}},[o,i]);const U=n.useCallback(L.CommonUtils.debounce(_=>{R?.(_)},h),[R,h]),[H,X]=n.useState();n.useEffect(()=>{X(t||o)},[t,o]);const q=k.useCallbackRef(_=>{D&&(D(_),U(_))},[D]),K=k.useCallbackRef(_=>{q(_?new L.Color({val:_.definition.val,adjs:_.definition.adjs},O):null)},[O]),V=n.useCallback(_=>{_.ctrlKey&&J(!0)},[]),oe=k.useCallbackRef(_=>{let ee=!1;if(_){const me=_.toString();ee=!W.mapAllPresets.has(me)}F?.(_,ee)},[F,W]),le=k.useCallbackRef(_=>{const ee=_?new L.Color({val:_.definition.val,adjs:_.definition.adjs},O):null;Promise.resolve(p?.()).then(()=>{oe(ee)})},[O,p]),ie=k.useCallbackRef(_=>{q(_?new L.Color(_,O):null)},[O]),ae=n.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(T.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:_=>_.palette.text.icon??_.palette.action.active},onClick:async()=>{I(!0),M?.(),await new EyeDropper().open().then(_=>{I(!1),N?.();let ee=new L.Color(_.sRGBHex),me=ee.toString(),je=W.mapAllPresets.get(me);if(je||(me=ee.toRGBA().toString(),je=W.mapAllPresetsRGB.get(me)),!je){const se=ee.toRGBA(),Oe=3;let Te=255;W.mapAllPresetsRGB.forEach((Q,ce)=>{const Ee=Q.toRGBA(),Fe=Math.abs(Ee.red-se.red)+Math.abs(Ee.blue-se.blue)+Math.abs(Ee.green-se.green);Fe<Oe&&Fe<Te&&(je=Q)})}J(!je),q(je||ee)}).catch(_=>{I(!1),_?.name!=="AbortError"&&console.error(_)})},children:e.jsx(k.DynamicIcon,{iconKey:"Colorize"})}),[W,E]),Ce=n.useMemo(()=>{if(!Z)return;const _={opacity:Z?1:"0",position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box"};return e.jsx(n.Suspense,{fallback:e.jsx("div",{style:_,children:e.jsx(y.AnimatedLoadingPanel,{})}),children:e.jsx(Al,{style:_,selectedColor:B?B.toRGBA().toString():"transparent",onColorChange:ie,disableAlpha:c})})},[Z,B]),he=n.useMemo(()=>({onClick:V,alphaGrey:A.palette.text.icon??A.palette.action.active}),[V,A]),Y=n.useMemo(()=>{if(!x)return null;const _={description:w,definition:{val:x.getVal(),adjs:x.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(T.MenuItem,{sx:{display:"flex",color:ee=>ee.palette.text.secondary},onMouseOver:()=>{K(null)},onClick:()=>{le(null)},children:[e.jsx(T.Box,{sx:{flex:"none",boxShadow:ee=>ee.shadows[2],borderRadius:ee=>ee.spacing(.5),overflow:"hidden"},children:e.jsx(no,{schemeColorLookup:O,colorDef:_,selectedColor:o===null?x:o,previewColor:t===null?x:t,defaultButtonSize:u,isLarge:!0,darkMode:E,compareRGB:v,swatchProps:he})}),e.jsx(T.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:w})]})})},[x,w,O,o,t]);return e.jsxs(T.Box,{ref:l,sx:{width:g,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...P,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:Z?"0":1},children:[Y&&j===ut.Start?e.jsxs(e.Fragment,{children:[Y,e.jsx(T.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(Rt,{title:"Theme Colors",schemeColorLookup:O,colorDefs:W.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:he,onPreviewColorDef:K,onSelectColorDef:le,compareRGB:v,darkMode:E}),e.jsx(Rt,{schemeColorLookup:O,colorDefs:W.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:he,onPreviewColorDef:K,onSelectColorDef:le,compareRGB:v,darkMode:E}),e.jsx(T.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Rt,{title:"Standard Colors",schemeColorLookup:O,colorDefs:W.standardColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:he,onPreviewColorDef:K,onSelectColorDef:le,compareRGB:v,darkMode:E}),e.jsxs("div",{style:{opacity:W.recentColorsLimited.length===0?"0":void 0,display:W.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(T.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Rt,{title:"Recent Colors",schemeColorLookup:O,colorDefs:W.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:he,onPreviewColorDef:K,onSelectColorDef:le,compareRGB:v,darkMode:E})]}),Y&&j===ut.End?e.jsxs(e.Fragment,{children:[e.jsx(T.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),Y,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),Ce]}),e.jsx(T.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-around",gap:"8px",paddingLeft:"2px",paddingRight:"2px"},children:[ae,e.jsx("div",{style:{flex:"1 1 100%",background:"pink"}}),e.jsx(T.Button,{style:{minWidth:"75px",maxWidth:"75px"},value:"check",variant:"outlined",size:"small",onClick:()=>{te()},children:Z?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(T.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(p?.()).then(()=>{oe(H)})},children:"Done"})]})]})})),Ll=e.jsx(k.DynamicIcon,{iconKey:"circle.colored"}),Io=n.memo(n.forwardRef((a,l)=>{const{selectedColor:o,quickColor:t,icon:r=Ll,tooltip:s,label:c,onPreviewColor:h,onPreviewColorImmediate:i,onSelectColor:u,variant:g=y.PopupButtonType.Toolbar,panelProps:b,shouldCloseFloatAll:p=!0,compareRGB:d=!1,darkMode:m=!1,...S}=a,C=k.useCallbackRef(h,[h]),f=k.useCallbackRef(i,[i]),x=k.useCallbackRef(u,[u]),[w,j]=n.useState(()=>{}),v=t||w||o||b?.autoColor,E=n.useRef(!1),P=n.useCallback(()=>{},[]),B=k.useCallbackRef(()=>{j(o)},[o]),R=k.useCallbackRef(W=>{E.current||(j(W),C?.(W))},[C]),D=k.useCallbackRef(W=>{E.current||(j(W),f?.(W))},[f]),F=k.useCallbackRef((W,Z)=>{E.current||(j(void 0),x?.(W,Z))},[x]),M=n.useMemo(()=>e.jsx(T.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(m)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(m)??"transparent"}`},"& .style_grey":{fill:W=>W.palette.text.icon??W.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,m]),N=k.useCallbackRef(W=>{x?.(t,!1)},[x,t]),[z,I]=n.useState(!1),A=n.useCallback(W=>{const{closeFloat:Z,closeFloatAll:J}=W;return e.jsx(Ta,{...b,selectedColor:o,previewColor:w,onDone:p?J:Z,onKeyDown:te=>{te.which===k.KeyCodes.Enter&&(p?J():Z())},onPreviewColorImmediate:D,onPreviewColor:R,onSelectColor:F,onEyeDropStart:()=>I(!0),onEyeDropStop:()=>I(!1),compareRGB:d,darkMode:m})},[o,w,p,v,b?.autoColor,m]),O={onQuickClick:t?N:void 0,createPopupPanel:A,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:B,onPopupClose:P,tooltip:s||c||"Color",label:c,icon:M,...S};return g===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:l,...O}):e.jsx(y.ExhibitPopupMenuItem,{ref:l,...O})})),Zt=82,Bo=a=>{const{styleColor:l,length:o=Zt,width:t=1,dashArray:r=null,sx:s,isDouble:c=!1,isAngled:h=!1,darkMode:i=!1,...u}=a;return e.jsx(T.SvgIcon,{sx:{width:`${o}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:g=>`${l?l.toRGBA(i).toString():g.palette.text.icon??g.palette.action.active}`},"& .style_grey":{stroke:g=>g.palette.text.icon??g.palette.action.active},...s},height:t,width:o,viewBox:`0 0 ${o} ${t}`,...u,children:e.jsx(ne.StyledStrokePath,{length:o,width:t,dashArray:r,isDouble:c,isAngled:h,className:"activeColor"})})},Ba=n.memo(n.forwardRef((a,l)=>{const{variant:o,showLabels:t=!1,disabled:r=!1,createPopupPanel:s,styleColor:c,selectedStyle:h,onSelectStyle:i,showNone:u=!0,darkMode:g,sx:b,...p}=a,d=k.useCallbackRef(i,[]),m=n.useCallback(x=>{const{popupContainer:w,floatReference:j,closeFloat:v,...E}=x,P=[],B=L.IBorder.BuiltInDefinitionsArray;for(let R=0;R<B.length;R++){const D=B[R];if(D.description==="None"&&!u)continue;const F=e.jsx(Bo,{styleColor:c,length:Zt,width:D.width,darkMode:g,dashArray:D.pattern,isDouble:D.description.toLowerCase().includes("double"),isAngled:D.description.toLowerCase().includes("slant")});let M=null;M=t?e.jsxs(e.Fragment,{children:[e.jsx(T.Box,{sx:{marginRight:"6px"},children:D.description}),e.jsxs(T.Box,{sx:{marginLeft:"6px",marginRight:"6px",display:"flex",alignItems:"center",flex:"1 1 100%"},children:[e.jsx("div",{style:{flex:"1 1 100%"}}),F]})]}):D.description==="None"?"None":F,P.push(e.jsx(y.ExhibitMenuItem,{className:"border-stroke",tabIndex:0,sx:{height:"28px","& svg path.activeColor":{filter:y.createStrokeShadowFilter(4)},paddingLeft:"16px",background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},tooltipProps:{description:t?"":D.description},icon:null,disabled:r,onMouseDown:N=>N.preventDefault(),onMouseUp:()=>{v(),d(D.style)},onKeyDown:N=>{N.which===k.KeyCodes.Enter&&v()},selected:D.style===h,parentFloat:j,children:M},R))}return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:P})},[r,u,c,h,g]),S=n.useMemo(()=>{const x=L.IBorder.BuiltInDefinitions.get(h);let w;return w=x.description==="None"?e.jsx(T.Box,{sx:{minWidth:`${Zt}px`},children:"None"}):e.jsx(Bo,{styleColor:c,length:Zt,width:x.width,dashArray:x.pattern,darkMode:g,isDouble:x.description.toLowerCase().includes("double"),isAngled:x.description.toLowerCase().includes("slant")}),e.jsx(T.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:y.createStrokeShadowFilter()}},children:w})},[h,c]),C=n.useMemo(()=>L.IBorder.BuiltInDefinitions.get(h),[h]),f={disabled:r,icon:S,tooltip:"Border Style: "+C.description,sx:{background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...b},createPopupPanel:m,...p};return o===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{...f}):e.jsx(y.ExhibitPopupMenuItem,{...f})})),Ra=n.memo(n.forwardRef((a,l)=>{const{autoColor:o=null,schemeLookup:t,autoStrokeStyle:r=L.IBorder.StrokeStyle.Thin,disabled:s=!1,darkMode:c=!1,showStylingBefore:h=!0,onSelectBorder:i,onPreviewBorder:u,selectedBorder:g,createTemporaryBorder:b,...p}=a,d=k.useCallbackRef(i,[i]),m=k.useCallbackRef(u,[u]),[S,C]=n.useState(),[f,x]=n.useState(),w=S??r,j=f??o,v=g||{bottom:{style:r,color:o?.toString()}},E=k.useCallbackRef(M=>{const N={},z=M?Object.keys(M):[];let I=!1;const A=z.length;for(let X=0;X<A;X++){const q=z[X];M[q]?.style&&(N[q]={style:M[q].style,color:M[q].color},I||N[q].style===L.IBorder.StrokeStyle.None||(I=!0))}z.length<6&&(I=!0);const O=I?N.left:null,W=I?N.top:null,Z=I?N.right:null,J=I?N.bottom:null,te=I?N.vertical:null,U=I?N.horizontal:null;let H="";return W||O||(H+="M 3,5 H 5 V 3 H 3 "),W||(H+="M 7,5 H 9 V 3 H 7 "),W||te||(H+="M 11,5 h 2 V 3 h -2 "),W||(H+="M 15,5 h 2 V 3 h -2 "),W||Z||(H+="M 19,5 h 2 V 3 h -2 "),O||(H+="M 3,9 H 5 V 7 H 3 "),te||(H+="M 11,9 h 2 V 7 h -2 "),Z||(H+="M 19,9 h 2 V 7 h -2 "),U||O||(H+="M 3,13 H 5 V 11 H 3 "),U||(H+="M 7,13 H 9 V 11 H 7 "),U||te||(H+="M 11,13 h 2 v -2 h -2 "),U||Z||(H+="M 19,13 h 2 v -2 h -2 "),U||(H+="M 15,13 h 2 v -2 h -2 "),O||(H+="M 3,17 H 5 V 15 H 3 "),te||(H+="M 11,17 h 2 v -2 h -2 "),Z||(H+="M 19,17 h 2 v -2 h -2 "),J||O||(H+="M 3,21 H 5 V 19 H 3 "),J||(H+="M 7,21 H 9 V 19 H 7 "),J||te||(H+="M 11,21 h 2 v -2 h -2 "),J||(H+="M 15,21 h 2 v -2 h -2 "),J||Z||(H+="M 19,21 h 2 v -2 h -2 "),e.jsxs(k.DynamicIcon,{children:[" ",e.jsxs(T.Box,{className:"border-icon",sx:{width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",position:"relative","& .grid > path":{opacity:"0.8"}},children:[e.jsx("svg",{viewBox:"0 0 24 24",className:"grid",style:{top:"0px",left:"0px",width:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",height:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",position:"absolute"},children:e.jsx("path",{className:"fill",d:H})}),e.jsx(T.Box,{className:"border-container",sx:{position:"absolute",display:"flex",justifyContent:"stretch",alignItems:"stretch",top:"0px",left:"0px",width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",padding:"1px 1px","& svg path":{filter:y.strokeShadowFilter}},children:e.jsx(ne.StaticBorderRenderer,{getBorderAt:(X,q)=>{if(!b||z.length===0)return null;const K=X.rowIndex,V=X.colIndex,oe={};return K===0?(oe.top=N.top,oe.bottom=N.horizontal):(oe.top=N.horizontal,oe.bottom=N.bottom),V===0?(oe.left=N.left,oe.right=N.vertical):(oe.left=N.vertical,oe.right=N.right),b?.(oe)},darkMode:c,style:{top:"2px",left:"2px",width:"calc(100% - 5px)",height:"calc(100% - 5px)",position:"absolute"}})})]})]})},[j,w,c]),P=n.useCallback((M,N,z)=>{let I=null;if(M&&M.length>0){let A=null;(N||z)&&(A={style:z,color:N?.toString()??null}),I={};const O=M.length;for(let W=0;W<O;W++)I[M[W]]=A}return I},[]),B=n.useCallback(M=>{d?.(M)},[]),R=n.useCallback(M=>{m?.(M)},[]),D=n.useCallback(M=>{const{closeFloatAll:N,floatReference:z}=M,I=(W,Z,J="bottom",te=!1)=>{const U=P(W,j??null,te?L.IBorder.StrokeStyle.None:w??null),H=te?P([],j??null,w??null):U;return e.jsx(y.ExhibitIconButton,{icon:E(H),sx:{background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},tooltipProps:{label:Z,simple:!0,placement:J},onClick:()=>{N(),R(U),B(U)}})},A=e.jsxs(e.Fragment,{children:[e.jsxs(T.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[I([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom,L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical],"All Borders","top"),I([L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical],"Inner Borders","top"),I([L.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),I([L.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),I([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(T.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[I([L.IBorder.Edge.Left],"Left Borders"),I([L.IBorder.Edge.Top],"Top Borders"),I([L.IBorder.Edge.Right],"Right Borders"),I([L.IBorder.Edge.Bottom],"Bottom Borders"),I([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom,L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical,L.IBorder.Edge.DiagonalUp,L.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),O=e.jsx(e.Fragment,{children:e.jsxs(T.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Io,{variant:y.PopupButtonType.Toolbar,icon:e.jsx(k.DynamicIcon,{iconKey:"stroke.colored"}),selectedColor:w===L.IBorder.StrokeStyle.None?new L.Color("transparent"):j,onPreviewColor:W=>{x(W)},onSelectColor:(W,Z)=>{x(W)},darkMode:c,tooltip:"Border Color",panelProps:{disableAlpha:!0,autoColor:o,schemeLookup:t},disabled:s||w===L.IBorder.StrokeStyle.None,parentFloat:z,shouldCloseFloatAll:!1}),e.jsx(Ba,{selectedStyle:w,onSelectStyle:C,styleColor:j,darkMode:c,variant:y.PopupButtonType.Toolbar,parentFloat:z})]})});return e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:W=>W.stopPropagation(),children:[h?O:A,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),h?A:O]})},[w,j,o,t,c]),F=n.useMemo(()=>E(v),[v,c]);return e.jsx(y.ExhibitPopupIconButton,{ref:l,createPopupPanel:D,popupProps:{popperProps:{resizeOnOverflow:!1}},createTooltip:({children:M},N)=>e.jsx(y.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:N,children:M}),onQuickClick:()=>{d?.(v)},quickButtonProps:{sx:{}},disabled:s,icon:F,...p})})),Pa=n.memo(n.forwardRef((a,l)=>{const{commands:o,command:t,commandHook:r,variant:s=k.CommandButtonType.Toolbar,disabled:c=!1,autoColor:h,autoStrokeStyle:i,schemeLookup:u,createTemporaryBorder:g,selectedBorder:b,onSelectBorder:p,darkMode:d,icon:m,label:S,...C}=a,f=k.useCommands(o,["formatBorder"]),x=t??f[0],w=x?.context()??null,j=w?.autoColor??h,v=w?.autoStyle??i,E=b??w?.quickBorder,P=d??w?.darkMode,B=g??w?.createTemporaryBorder,R=u??w?.schemeLookup,D=k.useCallbackRef(M=>{w?.onBorderSelect&&w.onBorderSelect(M),p?.(M),x?.execute(M,r)},[x,p,r]),F=n.useCallback((M,N)=>{const{children:z,title:I,...A}=M;let O=M.children;return(x?.disabled()||c)&&(O=e.jsx("div",{children:O})),e.jsx(y.CommandTooltip,{command:x,placement:s===k.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:N,...A,children:O})},[x,c]);return e.jsx(Ra,{ref:l,autoColor:j,darkMode:P,autoStrokeStyle:v,createTemporaryBorder:B,schemeLookup:R,selectedBorder:E,onSelectBorder:D,createTooltip:F,disabled:c||!x||x.disabled(),...C})})),Ma=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=n.useCallback((i,u)=>{const g={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:u.getCommand("mergeToggle")}),e.jsx(y.CommandButton,{...g,command:u.getCommand("mergeHorizontal")}),e.jsx(y.CommandButton,{...g,command:u.getCommand("mergeVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:u.getCommand("unmerge")})]});return y.defaultCreatePopupPanel({...i,children:b})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,quickCommand:"mergeToggle",commandHook:t,scope:r,tooltip:"Combine or split cells.",createPopupPanel:h,icon:"MergeAll",...c})})),Da=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=n.useCallback((i,u)=>{const g={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:u.getCommand("freezeToggle")}),e.jsx(y.CommandButton,{...g,command:u.getCommand("freezeToggleHorizontal")}),e.jsx(y.CommandButton,{...g,command:u.getCommand("freezeToggleVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:u.getCommand("unfreeze")})]});return y.defaultCreatePopupPanel({...i,children:b})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,createPopupPanel:h,quickCommand:"freezeToggle",label:"Freeze Panes",tooltip:"Freeze a portion of the sheet to keep it visible while you scroll through the rest of the sheet.\\n\\nUseful for viewing data in other parts of your worksheet without losing your headers or labels.",icon:"Freeze",...c})})),Fa=n.memo(n.forwardRef((a,l)=>e.jsx(y.SimpleCommandPopupButton,{ref:l,...a,popupCommandKeys:["find","findReplace","goto"],scope:"find",label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:"Find"}))),Ia=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:c=L.FontUtils.DefaultFontSizes,disabled:h=!1,parentFloat:i,icon:u,label:g,sx:b,...p}=a;k.useCommand(o);const d=()=>o?.state()?.toString()||"11",[m,S]=n.useState(d),C=k.useCallbackRef(()=>{const B=parseFloat(m);isNaN(B)?S(d()):parseFloat(d())!==B&&o.execute(B,t)},[d,o,m,t]);n.useEffect(()=>{S(d())},[o?.state()]);const f=n.useMemo(()=>{if(!t)return null;const B={...t};return delete B.beforeExecute,B},[t]),x=k.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),w=n.useMemo(()=>x?e.jsxs(T.Box,{className:de("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:B=>B.stopPropagation(),children:[e.jsx(y.CommandButton,{command:x[0],commandHook:f}),e.jsx(y.CommandButton,{command:x[1],commandHook:f})]}):null,[x]),j=G.useTheme(),v=n.useMemo(()=>`${L.IFont.getSharedMeasurer()("12.3",Math.round(j.typography.fontSize),j.typography.fontFamily).width}px`,[j]),E=n.useCallback(B=>{const{onMouseDown:R,onMouseUp:D,...F}=B;return e.jsx(T.IconButton,{component:"div",...F,disableRipple:!0,children:e.jsx(T.Input,{inputMode:"numeric",disabled:h||!o||o.disabled(),inputProps:{name:"font-input",autoComplete:"off",tabIndex:0,type:"number",maxLength:4,max:409,min:2},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:M=>`1px solid ${M.palette.text.icon??M.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:M=>`1px solid ${M.palette.error.main}`},"::after":{borderBottom:M=>`1px solid ${M.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:M=>`${Math.round(M.typography.fontSize)}px`,width:v,color:M=>M.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:M=>M.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:M=>M.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:m,onFocus:M=>{M.target?.select()},onKeyDown:M=>{if(M.which===k.KeyCodes.Enter)d()!==m&&(M.stopPropagation(),M.preventDefault(),C());else if(M.which===k.KeyCodes.Escape)d()!==m&&(S(d()),setTimeout(()=>{M.target?.select()},0),M.stopPropagation(),M.preventDefault());else{if(M.key.match("[-]")||M.key.match("[0-9.]")&&(m+M.key).length>4)return M.stopPropagation(),void M.preventDefault();if(M.which===k.KeyCodes.Space)return void M.preventDefault()}},onBlur:()=>{C()},onChange:M=>{if(M.target.value.length>4)return M.stopPropagation(),void M.preventDefault();S(M.target.value)}})})},[m,h,o]),P=n.useCallback(B=>{const R=N=>{o?.execute(N,t)},D=o?.state(),F=[];for(let N=0;N<c.length;N++){const z=c[N]===D;F.push(e.jsx(y.ExhibitMenuItem,{selected:z,icon:z?e.jsx(y.SelectedIcon,{}):void 0,disabled:h||!o||o.disabled(),onMouseDown:I=>{I.button===0&&I.preventDefault()},onMouseUp:I=>{I.button===0&&R(c[N])},onKeyDown:I=>{I.keyCode!==k.KeyCodes.Enter&&I.keyCode!==k.KeyCodes.Space||R(c[N])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:c[N]})},"fontSize-"+N))}const M=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...p,children:[w,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:F})]});return y.defaultCreatePopupPanel({...B,children:M})},[h,o?.state(),t]);return e.jsx(y.ExhibitPopupIconButton,{ref:l,sx:{...b},tabIndex:-1,outlined:!0,disabled:h,parentFloat:i,createPopupPanel:P,createTooltip:({children:B},R)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:R||o?.disabled(),children:B}),createQuickButton:E,...p})})),Tn=n.memo(a=>{const{selected:l,disabled:o,formattedValue:t,handleSetFormat:r,format:s,sx:c,...h}=a;return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:o,selected:l,icon:l?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:i=>{i.button===0&&i.preventDefault()},onMouseUp:i=>{i.button===0&&r(s.numberFormat)},onKeyDown:i=>{i.keyCode!==k.KeyCodes.Enter&&i.keyCode!==k.KeyCodes.Space||r(s.numberFormat)},...h,children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(T.Typography,{component:"div",children:[s.formatType,s.formatType===L.NumberFormat.Type.Custom?"…":""]}),e.jsx(T.Typography,{variant:"caption",component:"div",sx:{color:i=>Pe.alpha(i.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),Na=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:c=!1,parentFloat:h,...i}=a,u=k.useCommands(o,["formatNumberFormat"])[0],g=u?.state()?L.NumberFormat.Styles.lookupStyle(u?.state()).formatType:L.NumberFormat.Type.General,b=n.useMemo(()=>{if(!t)return null;const S={...t};return delete S.beforeExecute,S},[t]),p=n.useCallback((S,C)=>{const f=D=>{t?.beforeExecute?.(u,u?.state()),u.execute(D,t),t?.onExecute?.(u,u?.state())},x=u?.context()(),w=L.NumberFormat.Styles.lookupPrimary(),j=[];for(let D=0;D<w.length;D++){let F="";if(x&&!x.isEmpty())try{F=x.getNumberFormat(w[D].numberFormat).displayText}catch(N){console.warn(N)}F===""&&w[D].formatType===L.NumberFormat.Type.General&&(F="No specific format");const M=w[D].formatType===g;j.push(e.jsx(Tn,{selected:M,disabled:c||!u||u.disabled(),formattedValue:F,handleSetFormat:f,format:w[D]},w[D].formatType))}const v={numberFormat:"",formatType:L.NumberFormat.Type.Custom},E=g===L.NumberFormat.Type.Custom,P=e.jsx(Tn,{selected:E,disabled:c||!u||u.disabled(),formattedValue:E?x.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(u,u?.state()),C.getCommand("formatNumberDialog")?.execute(u?.state()),t?.onExecute?.(u,u?.state())},format:v,sx:{flex:"0",width:"100%"}},L.NumberFormat.Type.Custom),B=e.jsxs(T.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:D=>D.stopPropagation(),children:[e.jsx(y.CommandButton,{command:C.getCommand("formatNumberFormatAccountingStyle"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:C.getCommand("formatNumberFormatPercentStyle"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:C.getCommand("formatNumberFormatCommaStyle"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:C.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:C.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:b,scope:r})]}),R=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...i,children:[B,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:j}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),P]});return y.defaultCreatePopupPanel({...S,children:R})},[u?.context(),u?.state(),t,r]),d=G.useTheme(),m=n.useMemo(()=>{const S=L.NumberFormat.Type.MediumTime;return`${L.IFont.getSharedMeasurer()(S,Math.round(d.typography.fontSize),d.typography.fontFamily).width}px`},[d]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,sx:s,outlined:!0,disabled:c,parentFloat:h,createPopupPanel:p,createTooltip:({children:S},C)=>e.jsx(y.ExhibitTooltip,{label:u?.label(),description:u?.description(),disabled:C,children:S}),icon:e.jsx(T.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:S=>`${Math.round(S.typography.fontSize)}px`,color:S=>S.palette.text.secondary,fontFamily:S=>S.typography.fontFamily,width:m},children:e.jsx(T.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...i})})),No=n.memo(n.forwardRef((a,l)=>e.jsx(y.SimpleCommandPopupButton,{ref:l,...a,popupCommandKeys:["clearAll","clearFormats","clearContents","clearComments","clearHyperlinks"],scope:"clear",label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",icon:"ClearAll"}))),Oa=n.memo(n.forwardRef((a,l)=>e.jsx(y.SimpleCommandPopupButton,{ref:l,...a,popupCommandKeys:["fillDown","fillRight","fillUp","fillLeft"],scope:"fill",label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",icon:"FillDown"}))),Oo=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:c=!1,preferSingleMenu:h=!0,showQuickButton:i=!0,variant:u=k.CommandButtonType.Toolbar,...g}=a,b=["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns","addSheet"];c||b.push("addSheet");const p=k.useCommands(o,b),{singleCommand:d,allDisabled:m}=n.useMemo(()=>{let C=null,f=0;const x=p.length;for(let w=0;w<x;w++){const j=p[w];j&&!j.disabled()&&(h&&u===k.CommandButtonType.Menuitem&&(C=f===0?j:null),f++)}return{singleCommand:C,allDisabled:f===0}},[p]),S=n.useCallback((C,f)=>{let x=null;const w={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"insertCells",disabled:s};c||(x=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...w,command:f.getCommand("addSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...w,command:p[0]}),e.jsx(y.CommandButton,{...w,command:p[1]}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...w,command:p[2]}),e.jsx(y.CommandButton,{...w,command:p[3]}),x]});return y.defaultCreatePopupPanel({...C,children:j})},[s,p,t,r]);return d?e.jsx(y.CommandButton,{ref:l,variant:u,commandHook:t,disabled:s,command:d,...g}):e.jsx(y.CommandPopupButton,{ref:l,variant:u,quickCommand:"insertCells",commands:o,commandHook:t,scope:r,disabled:s||m,tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Insert new cells, rows or columns to your workbook."}),e.jsx("br",{}),e.jsx("span",{children:"To insert multiple rows or columns at a time, select multiple rows or columns in the sheet and click Insert."})]}),createPopupPanel:S,...g})})),Ao=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:c=!1,preferSingleMenu:h=!0,showQuickButton:i=!0,variant:u=k.CommandButtonType.Toolbar,...g}=a,b=["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"];c||b.push("deleteSheet");const p=k.useCommands(o,b),{singleCommand:d,allDisabled:m}=n.useMemo(()=>{let C=null,f=0;const x=p.length;for(let w=0;w<x;w++){const j=p[w];j&&!j.disabled()&&(h&&u===k.CommandButtonType.Menuitem&&(C=f===0?j:null),f++)}return{singleCommand:C,allDisabled:f===0}},[p]),S=n.useCallback((C,f)=>{const x={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let w=null;c||(w=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:f.getCommand("deleteSheet")})]}));const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:f.getCommand("deleteCellsShiftUp")}),e.jsx(y.CommandButton,{...x,command:f.getCommand("deleteCellsShiftLeft")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:f.getCommand("deleteRows")}),e.jsx(y.CommandButton,{...x,command:f.getCommand("deleteColumns")}),w]});return y.defaultCreatePopupPanel({...C,children:j})},[s,t,r]);return d?e.jsx(y.CommandButton,{ref:l,variant:u,commandHook:t,disabled:s,command:d,...g}):e.jsx(y.CommandPopupButton,{ref:l,variant:u,quickCommand:"deleteCells",commands:o,commandHook:t,scope:r,disabled:s||m,tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Delete cells, rows, columns or sheets from your workbook."}),e.jsx("br",{}),e.jsx("span",{children:"To delete multiple rows or columns at a time, select multiple rows or columns in the sheet and click Delete."})]}),createPopupPanel:S,...g})})),Lo=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["resizeRows","autoFitRows","resizeColumns","autoFitColumns","hideColumns","hideRows","unhideColumns","unhideRows"]),{allDisabled:i}=n.useMemo(()=>{let g=0;const b=h.length;for(let p=0;p<b;p++){const d=h[p];d&&!d.disabled()&&g++}return{allDisabled:g===0}},[h]),u=n.useCallback((g,b)=>{const p={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"formatCells"},d={commands:b,parentFloat:g.floatReference,...p},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:b.getCommand("resizeRows")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("autoFitRows")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:b.getCommand("resizeColumns")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("autoFitColumns")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{ref:l,...d,popupCommandKeys:["hideColumns","hideRows",null,"unhideColumns","unhideRows"],popupScope:"hideUnhide",label:"Hide & Unhide"})]});return y.defaultCreatePopupPanel({...g,children:m})},[t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,scope:r,createPopupPanel:u,disabled:s||i,icon:"CellsFormat",label:"Format Cells",tooltip:"Change row and column sizes or visibility.",...c})}));Lo.displayName="CellsFormatCommandButton";const pt=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:c=k.CommandButtonType.Toolbar,quickColor:h,panelProps:i,isSplit:u=!1,darkMode:g,icon:b,...p}=a,{autoColor:d,schemeLookup:m,recentColors:S,...C}=i;if(p.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");k.useCommand(o);const f=o?.context();let x=h??f?.quickColor;u&&!x&&(x=new L.Color("transparent"));const w=d??f?.autoColor,j=m??f?.schemeLookup,v=S??f?.recentColors,E=g??f?.darkMode,P=n.useMemo(()=>({autoColor:w,schemeLookup:j,recentColors:v,darkMode:E,...C}),[w,j,v,E]),B=k.useCallbackRef((D,F)=>{D&&F&&f?.addRecentColor&&f.addRecentColor(D),f?.onColorSelect&&f.onColorSelect(D),r?.(D,F),o?.execute(D,t)},[o,r,t,f]),R=n.useCallback((D,F)=>{const{children:M,title:N,...z}=D;let I=D.children;return(o?.disabled()||s)&&(I=e.jsx("div",{children:I})),e.jsx(y.CommandTooltip,{command:o,placement:c===k.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:F,...z,children:I})},[o,s]);return e.jsx(Io,{ref:l,panelProps:P,icon:b??o?.icon(f),quickColor:x,selectedColor:o?.state(),onSelectColor:B,variant:c===k.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:R,label:o?.label(),disabled:s||!o||o.disabled(),compareRGB:!0,darkMode:E,...p})}));pt.displayName="ColorCommandButton";const Aa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...h}=a,i=k.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),u=n.useCallback((g,b)=>{const p={variant:k.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:b.getCommand("gridlinesToggle")}),e.jsx(pt,{...p,command:b.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(k.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:b.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("sheetViewToggleGridlinesRows")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:l,parentFloat:c,quickCommand:i[0]?.key(),commands:o,commandHook:t,createPopupPanel:u,label:"Gridlines",tooltip:"Configure how the lines between rows and columns in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:i[0],scope:"view"}),...h})})),zo=n.memo(n.forwardRef((a,l)=>e.jsx(y.SimpleCommandPopupButton,{ref:l,...a,popupCommandKeys:["sortAscending","sortDescending","sortCustom",null,"autoFilterToggle","autoFilterClear","autoFilterReapply"],scope:"sortFilter",label:"Sort & Filter",tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Organize your data so it's easier to analyze."}),e.jsx("br",{}),e.jsx("span",{children:"You can sort the selected data from smallest to largest or largest to smallest."})]}),icon:"SortFilter"}))),zl=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=n.useCallback((i,u)=>{const g={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,scope:"filter",command:u.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:u.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...g,scope:"filter",command:u.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...i,children:b})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,scope:r,disabled:s,label:"Filter",tooltip:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Organize your data so it's easier to analyze."}),e.jsx("br",{}),e.jsx("span",{children:"You can sort the selected data from smallest to largest or largest to smallest."})]}),createPopupPanel:h,icon:"FilterToggle",...c})})),Ho=n.memo(n.forwardRef((a,l)=>{const{quickCommand:o,icon:t,isRedo:r=!1,nestRedo:s=!0,undoManager:c,scope:h,sx:i,disabled:u,commands:g,...b}=a,p=[o];!r&&s&&p.push("redo");const d=k.useCommands(g,p),m=d[0],S=d[1],C=c??m?.context?.()?.undoManager;let f=u;u||(f=!m||m.disabled(),S&&!S.disabled()&&(f=!1));const[x,w]=n.useState(0),j=n.useCallback((v,E)=>{let P=x===0?"Cancel":`${m.label()} ${x} Action${x===1?"":"s"}`,B=!1;C||(B=!0),B||(B=s?!C.hasRedo()&&!C.hasUndo():!C.hasRedo());const R=I=>{m.execute(I)},D=e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:B?void 0:"0 0",minWidth:"180px"},icon:e.jsx(k.DynamicIcon,{}),onMouseEnter:()=>{w(0)},onMouseDown:I=>{I.button===0&&I.preventDefault()},onMouseUp:I=>{I.button===0&&R(x)},onKeyDown:I=>{I.isDefaultPrevented()||I.keyCode!==k.KeyCodes.Enter&&I.keyCode!==k.KeyCodes.Space||R(x)},children:e.jsx(T.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:P})});if(B)return D;const F=r?C?.getRedoDescriptions():C?.getUndoDescriptions(),M=[];for(let I=0;I<F.length;I++){const A=F[I];M.push(e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:f,selected:I<x,icon:e.jsx(k.DynamicIcon,{}),onMouseEnter:()=>{w(I+1)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&R(I+1)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==k.KeyCodes.Enter&&O.keyCode!==k.KeyCodes.Space||R(I+1)},children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(T.Typography,{component:"div",children:A}),e.jsx(k.DynamicIcon,{})]})},`action:${I}`))}let N=null;if(!r&&s){const I={scope:"undo",commands:E,variant:k.CommandButtonType.Menuitem,parentFloat:v.floatReference};N=[],N.push(e.jsx(Ho,{...I,quickCommand:"redo",isRedo:!0},"nested:redo")),C.hasRedo()&&C.hasUndo()&&N.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const z=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{v.closeFloatAll()},onMouseLeave:()=>{w(0)},children:[N,e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:M}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),D]});return y.defaultCreatePopupPanel({...v,children:z})},[m?.context(),m?.state(),h,C,x,f]);return e.jsx(y.CommandPopupButton,{ref:l,commands:g,quickCommand:o,scope:h,disabled:f,label:m?.label()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${m?.label()??"No"} last actions.`})}),createPopupPanel:j,icon:t??(r?"Redo":"Undo"),selected:!1,...b})})),mt=L.IFontCollection.getFontList(),La=new Map;for(let a=0;a<mt.length;a++)La.set(mt[a].fontRef.getFamily(),mt[a]);const za=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:c,icon:h,label:i,...u}=a;k.useCommand(o);const g=o?.state(),b=G.useTheme(),p=n.useMemo(()=>`${L.IFont.getSharedMeasurer()("Times New Roman",Math.round(b.typography.fontSize),b.typography.fontFamily).width}px`,[b]),d=n.useCallback(m=>{const S=w=>{o?.execute(w,t)},C=[];for(let w=0;w<mt.length;w++)C.push({key:mt[w].fontRef.getFamily(),description:mt[w].fontRef.getFamily()});La.get(g)||C.unshift({key:g,description:g});const f=[];for(let w=0;w<C.length;w++){const j=C[w].key===g;f.push(e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",paddingTop:"4px",paddingBottom:"4px"},selected:j,disabled:s||!o||o.disabled(),icon:j?e.jsx(y.SelectedIcon,{}):void 0,onMouseUp:v=>{v.button===0&&S(C[w].key)},onMouseDown:v=>{v.button===0&&v.preventDefault()},onKeyDown:v=>{v.keyCode!==k.KeyCodes.Enter&&v.keyCode!==k.KeyCodes.Space||S(C[w].key)},children:e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(T.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>C[w]?.key},children:C[w].description})})},w+""+C[w].key))}const x=e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...u,children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:f})});return y.defaultCreatePopupPanel({...m,children:x})},[s,o?.state()]);return e.jsx(y.ExhibitPopupIconButton,{ref:l,sx:{...r},outlined:!0,disabled:s,parentFloat:c,createPopupPanel:d,createTooltip:({children:m},S)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:S,children:m}),icon:e.jsx(T.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:m=>`${Math.round(m.typography.fontSize)}px`,fontFamily:m=>m.typography.fontFamily,color:m=>m.palette.text.secondary,width:p},children:e.jsx(T.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...u})})),Ha=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),i=n.useMemo(()=>{const g=h.length;for(let b=0;b<g;b++){const p=h[b];if(p?.state())return p}return h[0]},[h]),u=n.useCallback((g,b)=>{const p={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:b.getCommand("formatStrikeThroughToggle")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("formatSuperscriptToggle")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("formatSubscriptToggle")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:i?.key(),commands:o,commandHook:t,createPopupPanel:u,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:i?.icon()??"TextStrike",...c})})),Wa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),i=n.useMemo(()=>{const g=h.length;for(let b=0;b<g;b++)if(h[b]?.state())return h[b];return h[0]},[h]),u=n.useCallback((g,b)=>{const p={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:b.getCommand("formatUnderlinedToggle")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(y.CommandButton,{...p,command:b.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:i?.key(),commands:o,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:u,icon:i?.icon()??"TextUnderline",...c})})),Wo=n.memo(n.forwardRef((a,l)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:c=!0,disabled:h=!1,...i}=a,u=k.useCallbackRef((g,b)=>{const p={variant:k.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:h},d=[];return c&&(d.push(n.createElement(y.CommandButton,{...p,command:b.getCommand("paste"),key:"paste"})),d.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),d.push(n.createElement(y.CommandButton,{...p,command:b.getCommand("pasteValues"),key:"pasteValues"})),d.push(n.createElement(y.CommandButton,{...p,command:b.getCommand("pasteFormats"),key:"pasteFormats"})),d.push(n.createElement(y.CommandButton,{...p,command:b.getCommand("pasteFormulas"),key:"pasteFormulas"})),d.push(n.createElement(y.CommandButton,{...p,command:b.getCommand("pasteTranspose"),key:"pasteTranspose"})),d.push(n.createElement(y.CommandButton,{...p,command:b.getCommand("pasteLinks"),key:"pasteLinks"})),y.defaultCreatePopupPanel({...g,children:d})},[h,r,s,c]);return e.jsx(y.CommandPopupButton,{ref:l,commands:t,commandHook:r,scope:s,createPopupPanel:u,label:"Paste",tooltip:"Add content to the clipboard to your document.",quickCommand:"paste",...i})})),$a=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...h}=a,i=k.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),u=n.useCallback((g,b)=>{const p={variant:k.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:b.getCommand("sheetViewToggleShowHeadings")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:b.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(y.CommandButton,{...p,command:b.getCommand("sheetViewToggleShowHeadingRows")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,parentFloat:c,quickCommand:i[0]?.key(),commands:o,commandHook:t,createPopupPanel:u,label:"Headings",tooltip:"Configure how the column and rows headings in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:i[0],scope:"view"}),...h})})),Va=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r="view",disabled:s=!1,...c}=a,h=n.useCallback(i=>{const u={variant:k.CommandButtonType.Menuitem,parentFloat:i.floatReference,commandHook:t,scope:r,disabled:s},g=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...u,command:o.getCommand("workbookViewToggleShowFormulaBar")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("workbookViewToggleShowTabs")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("workbookViewToggleShowStatusBar")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...u,command:o.getCommand("workbookViewToggleShowHorizontalScrollBar")}),e.jsx(y.CommandButton,{...u,command:o.getCommand("workbookViewToggleShowVerticalScrollBar")})]});return y.defaultCreatePopupPanel({...i,children:g})},[s,o,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,disabled:s,commandHook:t,scope:r,label:"Workbook View",tooltip:"Options to configure how the workbook is displayed.",createPopupPanel:h,icon:e.jsx(y.LabelIcon,{icon:null,label:"Workbook View"}),...c})})),_a=n.memo(n.forwardRef((a,l)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:c,sx:h,borderProps:i,disabled:u,...g}=a,b=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),p=n.useMemo(()=>b.getStyle(),[b,c]),d=n.useMemo(()=>p.getFill().toCSS(c?.darkMode??!1),[p]),m=p.getInsets(),S=p.getFont(),C=n.useCallback(()=>p.getBorder(),[p]);return e.jsx(T.Box,{ref:l,sx:{width:"100px",height:"100%",textOverflow:"ellipsis",display:"flex",alignItems:"stretch",background:c?.fill,filter:u?"grayscale(0.4) opacity(0.8);":"none","& .fill":{flex:"1 1 100%",overflow:"hidden",...d},"& .text":{flex:"1 1 100%",...S.toCSS(c?.darkMode??!1,1),boxSizing:"border-box",padding:`${m.top}px ${m.right}px ${m.bottom}px ${m.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:S.toCSS().textDecoration,textAlign:L.ITextFrame.toCSSHorizontalTextAlign(b.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...h},...g,children:e.jsx(ne.StaticBorderRenderer,{getBorderAt:C,darkMode:c?.darkMode??!1,rowCount:1,columnCount:1,style:{height:"100%",width:"100%",...i?.style},...i,children:e.jsx(T.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-2px",marginBottom:"-2px",display:"flex",alignItems:"center"},children:e.jsx(T.Box,{className:"text",children:o})})})})})),Hl=n.memo(a=>{const{styles:l,namedStyle:o,selectedNamed:t,hasContextMenu:r=!0,bodyStyle:s,onSelectNamed:c,createTemporaryCell:h,parentFloat:i,commands:u,disabled:g,commandHook:b,...p}=a,d=n.useCallback(C=>{const f={variant:k.CommandButtonType.Menuitem,commandHook:b,context:"cellStyle"},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,style:{fontWeight:550},command:u.getCommand("formatCellStyle"),commandState:o,disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:u.getCommand("modifyCellStyle"),commandState:{named:o}}),e.jsx(y.CommandButton,{...f,command:u.getCommand("deleteCellStyle"),commandState:o,disabled:g||o?.getName()===L.IStyle.BuiltInName.Normal})]}),w=e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x})});return y.defaultCreatePopupPanel({...C,children:w})},[]),m=o?.getName()===t?.getName();let S=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:C=>`solid ${m?C.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName(),placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{c?.(o)},...p,children:e.jsx(_a,{value:o.getName(),cellStyle:{named:o.getName()},styles:l,createTemporaryCell:h,bodyStyle:s})},o.getName());return r&&(S=e.jsx(y.ContextMenu,{label:o.getName(),parentFloat:i,createPopupPanel:d,children:S})),S}),Ka=n.memo(n.forwardRef((a,l)=>{const{commands:o,command:t,commandHook:r,selectedNamed:s,onSelectNamed:c,disabled:h=!1,bodyStyle:i,usePreviewIcon:u=!0,...g}=a;k.useCommand(t);const b=t?.context(),p=b?.styles,d=s??b?.named(),m=i??b?.bodyStyle(),S=k.useCallbackRef(j=>{c?.(j),t?.execute(j,r)},[t,c,r]),C=n.useCallback((j,v)=>{const E={onSelectNamed:S,styles:p(),parentFloat:j.floatReference},P=p().getCustomNamed(),B=new Map,R=[];for(let O=0;O<P.length;O++)B.set(P[O].getName(),P[O]),p().getNamed(P[O].getName()).getBuiltInID()===null&&R.push(P[O].getName());const D=O=>{let W=B.get(O);return W||(W=p().getNamed(O)),!W||W.isHidden()?null:e.jsx(Hl,{namedStyle:W,selectedNamed:d,bodyStyle:b.bodyStyle(),createTemporaryCell:b.createTemporaryCell,commands:o,commandHook:r,...E},O)},F=(O,W,Z=!0)=>{const J=[];for(let te=0;te<W.length;te++){const U=D(W[te]);U&&J.push(U)}return J.length===0?null:e.jsxs(T.Box,{children:[Z?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:O},O+"-header"),e.jsx(T.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:J},O+"-presets")]},O)},M=(O,W)=>{const Z=[];for(let J=0;J<W.length;J++){const te=D(W[J]);te&&Z.push(te)}return Z.length===0?null:e.jsx(T.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:Z},O+"-presets")},N=[];N.push(F("Custom",R,!1)),N.push(F("Good, Bad and Neutral",[L.IStyle.BuiltInName.Normal,L.IStyle.BuiltInName.Bad,L.IStyle.BuiltInName.Good,L.IStyle.BuiltInName.Neutral],R.length>0)),N.push(F("Data and Model",[L.IStyle.BuiltInName.Calculation,L.IStyle.BuiltInName.CheckCell,L.IStyle.BuiltInName.ExplanatoryText,L.IStyle.BuiltInName.FollowedHyperlink,L.IStyle.BuiltInName.Hyperlink,L.IStyle.BuiltInName.Input,L.IStyle.BuiltInName.LinkedCell,L.IStyle.BuiltInName.Note,L.IStyle.BuiltInName.Output,L.IStyle.BuiltInName.WarningText])),N.push(F("Titles and Headings",[L.IStyle.BuiltInName.Heading1,L.IStyle.BuiltInName.Heading2,L.IStyle.BuiltInName.Heading3,L.IStyle.BuiltInName.Heading4,L.IStyle.BuiltInName.Title,L.IStyle.BuiltInName.Total]));let z=[];var I,A;return z.push(M("Accent 1",[L.IStyle.BuiltInName.Accent1_20,L.IStyle.BuiltInName.Accent1_40,L.IStyle.BuiltInName.Accent1_60,L.IStyle.BuiltInName.Accent1])),z.push(M("Accent 2",[L.IStyle.BuiltInName.Accent2_20,L.IStyle.BuiltInName.Accent2_40,L.IStyle.BuiltInName.Accent2_60,L.IStyle.BuiltInName.Accent2])),z.push(M("Accent 3",[L.IStyle.BuiltInName.Accent3_20,L.IStyle.BuiltInName.Accent3_40,L.IStyle.BuiltInName.Accent3_60,L.IStyle.BuiltInName.Accent3])),z.push(M("Accent 4",[L.IStyle.BuiltInName.Accent4_20,L.IStyle.BuiltInName.Accent4_40,L.IStyle.BuiltInName.Accent4_60,L.IStyle.BuiltInName.Accent4])),z.push(M("Accent 5",[L.IStyle.BuiltInName.Accent5_20,L.IStyle.BuiltInName.Accent5_40,L.IStyle.BuiltInName.Accent5_60,L.IStyle.BuiltInName.Accent5])),z.push(M("Accent 6",[L.IStyle.BuiltInName.Accent6_20,L.IStyle.BuiltInName.Accent6_40,L.IStyle.BuiltInName.Accent6_60,L.IStyle.BuiltInName.Accent6])),N.push((I="Themed Cell Styles",A=z,e.jsxs(T.Box,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.ExhibitMenuHeader,{children:I},I+"-header"),e.jsx(T.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:A},I+"-presets")]},I))),N.push(F("Number Format",[L.IStyle.BuiltInName.Comma,L.IStyle.BuiltInName.Comma0,L.IStyle.BuiltInName.Currency,L.IStyle.BuiltInName.Currency0,L.IStyle.BuiltInName.Percent])),e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:O=>`${O.shape.borderRadius}px`,paddingBottom:O=>`${O.shape.borderRadius}px`},children:[e.jsx(T.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:N}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:k.CommandButtonType.Menuitem,commandState:d,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:h})]})},[d,p?.().getTheme(),m]),f=k.useCallbackRef(j=>{const v=18/L.IFont.getDeviceScale(),E=b?.createTemporaryCell(j);return E.getStyle().getFont().getSize()<=v?E:E.createTemporaryCell({style:{font:{size:v}}})},[b?.createTemporaryCell]),x=h||!t||t.disabled(),w=n.useMemo(()=>b&&u?e.jsx(_a,{value:d?.getName()??"Custom",cellStyle:d?{named:d.getName()}:void 0,styles:b.styles(),createTemporaryCell:f,bodyStyle:b.bodyStyle(),className:"outline-hover",disabled:x,sx:{marginRight:"4px",borderRadius:"2px",minHeight:"calc(100% - 2px)",overflow:"hidden",outline:j=>`1px solid ${j.palette.action.hover}`},borderProps:{style:{height:"calc(100% - 2px)",width:"calc(100% - 1px)"}}}):t?.icon(),[d,m,x,t]);return e.jsx(y.CommandPopupButton,{ref:l,createPopupPanel:C,outlined:u,commands:o,createTooltip:({children:j},v)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:v,children:j}),selected:!1,disabled:x,label:t?.label(),icon:w,...g})})),Ua="_sheetxl-reset_11z3j_1",Wl=10,$o=n.memo(n.forwardRef((a,l)=>{const{styles:o,table:t,tableStyle:r=t?.getStyle()??o.getDefaultTableStyle(),bodyStyle:s,sx:c,disabled:h,className:i,forceThinBorder:u,cellHeight:g=Wl,isLive:b=!1,...p}=a,d=Math.ceil(1.3*g),[m,S]=n.useReducer(j=>j+1,0);n.useEffect(()=>{if(b&&t)return t.addListeners({onAnyChange:()=>{S()}})},[t,b]);const C=n.useMemo(()=>{let j=t?.toJSON()??{};const v={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return j&&(j.styleOptions={...j.styleOptions,name:r.getName()}),j.ref=v,new L.Table({initialAnchor:v,json:j,styles:o})},[m,t,r,o]),f=n.useMemo(()=>{const j=[];for(let v=0;v<5;v++)for(let E=0;E<5;E++){const P=C.getStyleAt({colIndex:E,rowIndex:v});j.push(P)}return j},[C]),x=n.useMemo(()=>{const j=(E,P,B)=>{let R=B.getFill().toCSS(s?.darkMode??!1);const D=d-(P<4?1:0),F=g-(E<4?1:0),M=B.getFont().getFill().toCSS(s?.darkMode??!1);return R={...R,position:"absolute",boxSizing:"border-box",left:P*(d-1),top:E*(g-1),width:D,height:F},e.jsx("td",{className:`table-style-fill ${E}-${P}`,style:R,children:e.jsx("div",{className:`table-style-text ${E}-${P}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(D-6)/2,top:(F-1)/2,borderTop:`1px solid ${M}`}})},`${E}-${P}`)},v=[];for(let E=0;E<5;E++){const P=[];for(let B=0;B<5;B++){const R=f[5*E+B];P.push(j(E,B,R))}v.push(e.jsx("tr",{children:P},E))}return v},[C,r,s]),w=n.useCallback((j,v)=>f[v].getBorder()??null,[f]);return e.jsx(T.Box,{ref:l,className:"table-format-preview",sx:{background:s?.fill,filter:h?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...c},...p,children:e.jsx(ne.StaticBorderRenderer,{getBorderAt:w,rowCount:5,columnCount:5,forceThinBorder:u,width:5*(d-1)+1,height:5*(g-1)+1,darkMode:s?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:de(i,"sheetxl-table-preview",Ua),style:{borderCollapse:"collapse",width:5*(d-1)+1,height:5*(g-1)+1},children:e.jsx("tbody",{children:x})})})})})),bt=(a,l,o,t,r)=>{a.beginPath(),a.moveTo(l+.5,o+.5),a.lineTo(t+.5,r+.5),a.stroke()},qa=n.memo(n.forwardRef((a,l)=>{const{table:o,tableStyle:t,styles:r,bodyStyle:s,disabled:c,style:h,className:i,canvas:u,...g}=a,b=n.useMemo(()=>{const m=o.toJSON(),S={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return m.styleOptions={...m.styleOptions,name:t.getName()},m.ref=S,new L.Table({initialAnchor:S,json:m,styles:r})},[o,t,r]),p=n.useMemo(()=>{const m=[];for(let S=0;S<5;S++)for(let C=0;C<5;C++){const f=b.getStyleAt({colIndex:C,rowIndex:S});m.push(f)}return m},[b]),d=n.useMemo(()=>{let m=u;if(u||(m=document.createElement("canvas")),!m)return null;m.width!==61&&(m.width=61),m.height!==46&&(m.height=46);const S=m.getContext("2d",{alpha:!1});if(!S)return null;const C=12,f=s?.darkMode??!1;for(let x=0;x<5;x++)for(let w=0;w<5;w++){const j=p[5*x+w].getFill();let v=s?.fill;j.getType()===L.IFill.Type.Solid?v=j.getColor().toCSS(f,!1):j.getType()===L.IFill.Type.Gradient?v=j.getStops[0]?.color.toCSS(f,!1):j.getType()===L.IFill.Type.Pattern&&(v=j.getForeground().toCSS(f,!1)),S.fillStyle=v;const E=w*C,P=9*x;S.fillRect(E,P,13,10)}S.lineWidth=1;for(let x=0;x<5;x++)for(let w=0;w<5;w++){const j=p[5*x+w],v=w*C,E=9*x,P=j.getBorder();if(!P.isEmpty()){const D=P.getLeft();D.isNone()||(S.strokeStyle=D.getColor().toCSS(f,!1),bt(S,v,E,v,E+9));const F=P.getTop();F.isNone()||(S.strokeStyle=F.getColor().toCSS(f,!1),bt(S,v,E,v+C,9*x));const M=P.getRight();M.isNone()||(S.strokeStyle=M.getColor().toCSS(f,!1),bt(S,v+C,E,v+C,E+9));const N=P.getBottom();N.isNone()||(S.strokeStyle=N.getColor().toCSS(f,!1),bt(S,v,E+9,v+C,E+9))}S.strokeStyle=j.getFont().getFill().toCSS(f,!1);const B=4,R=2.5;bt(S,w*C+R,9*x+B,w*C+R+7,9*x+B)}return`url(${m.toDataURL()})`},[u,b,t,s]);return e.jsx("div",{ref:l,className:de("table-style-preview",i),style:{backgroundImage:d,width:61,height:46,...h},...g})})),$l="_table-style-options-container_1kfn2_1",Vl="_table-style-options_1kfn2_1",Ga=n.memo(n.forwardRef((a,l)=>{const{styleOptions:o,onStyleOptionsChange:t,showHeaderRow:r,onShowHeaderRowChange:s,showTotalRow:c,onShowTotalRowChange:h,showFilterButton:i,onShowFilterButtonChange:u,sx:g,className:b,disabled:p,...d}=a;return e.jsx("div",{className:$l,children:e.jsxs(T.Box,{sx:{pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:m=>`${m.spacing(2)}`,marginRight:m=>`${m.spacing(2)}`},"& .MuiCheckbox-root":{padding:m=>`${m.spacing(.5)}`},...g},...d,ref:l,className:de(b,Vl),children:[s&&e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:p||r==null}),label:"Header Row",labelPlacement:"end"}),h&&e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:c??!1,indeterminate:c==null,onChange:()=>h(!c),disabled:p||c==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:p||!o,onChange:()=>{t?.({...o,showRowStripes:!o?.showRowStripes})}}),label:"Banded Rows",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showFirstColumn??!1,indeterminate:!o,disabled:p||!o,onChange:()=>{t?.({...o,showFirstColumn:!o?.showFirstColumn})}}),label:"First Column",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showLastColumn??!1,indeterminate:!o,disabled:p||!o,onChange:()=>{t?.({...o,showLastColumn:!o?.showLastColumn})}}),label:"Last Column",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showColumnStripes??!1,indeterminate:!o,disabled:p||!o,onChange:()=>{t?.({...o,showColumnStripes:!o?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),u&&e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:i??!1,indeterminate:i==null,disabled:p||!o||i==null,onChange:()=>u(!i)}),label:"Filter Button",labelPlacement:"end"})]})})}));function ho(a,l){if(typeof a=="function")return a(l);a&&(a.current=l)}var Ke=parseInt(n.version.split(".")[0],10)>=19?function(a){return l=>{const o=[];for(const t of a){const r=ho(t,l),s=typeof r=="function";o.push(s?r:()=>ho(t,null))}return()=>{for(const t of o)t()}}}:function(a){return l=>{for(const o of a)ho(o,l)}},_l=function(){},Xa=typeof window<"u",ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Kl=Xa?n.useLayoutEffect:n.useEffect,Bn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const _e=Xa&&window.ResizeObserver!==void 0?function(){var a=n.useState(null),l=a[0],o=a[1],t=n.useState(Bn),r=t[0],s=t[1],c=n.useMemo(function(){return new window.ResizeObserver(function(h){if(h[0]){var i=h[0].contentRect,u=i.x,g=i.y,b=i.width,p=i.height,d=i.top,m=i.left,S=i.bottom,C=i.right;s({x:u,y:g,width:b,height:p,top:d,left:m,bottom:S,right:C})}})},[]);return Kl(function(){if(l)return c.observe(l),function(){c.disconnect()}},[l]),[o,r]}:function(){return[_l,Bn]},Ul="_range-row_akhf4_1",ql="_action-row_akhf4_15",Ya=n.createContext(null);Ya.displayName="HookFormContext";const Za=()=>n.useContext(Ya);typeof window<"u"?n.useLayoutEffect:n.useEffect;const Vo=n.memo(n.forwardRef((a,l)=>{const{disabled:o,style:t,className:r,sx:s,defaultInput:c,value:h,formName:i,formOptions:u,onChangeInput:g,onValidate:b,onKeyDown:p,...d}=a,m=Za(),S=i&&m?m.register(i,u):null,[C,f]=n.useState(""),[x,w]=n.useState(""),[j,v]=n.useState(h);n.useEffect(()=>{v(h),w("")},[h]);const E=k.useCallbackRef(F=>{let M="";try{v(F),b?.(F),g?.(F)}catch(N){M=N.message??"Invalid Name"}i&&m&&(M?m.setError(i,{message:M}):m.clearErrors(i)),w(M)},[h,b,g]),P=k.useCallbackRef(async F=>{F.keyCode===k.KeyCodes.Escape&&C!==h&&(E(C),m?.setValue(i,C),m?.clearErrors(i),F.stopPropagation()),p?.(F)},[p,C,h,m]),B=k.useCallbackRef(F=>{f(F.target.value??"")},[]),R=k.useCallbackRef(F=>{f(""),S?.onBlur(F)},[]),D=n.useCallback(F=>{E(F.target.value),S?.onChange(F)},[S]);return e.jsx(T.FormControl,{sx:{paddingTop:F=>F.spacing(1.5),minWidth:135,width:"100%",...s},size:"small",ref:l,className:de("named-input",r),...d,children:e.jsx(T.TextField,{label:"Name",placeholder:c,onFocus:B,onBlur:R,inputRef:S?.ref,disabled:o,error:!!x,helperText:x||" ",sx:{"& .MuiFormHelperText-root":{marginTop:F=>F.spacing(.5)}},slotProps:{inputLabel:{shrink:!0},htmlInput:{className:"autoFocus",name:i,spellCheck:!1,autoComplete:"off",readOnly:o,sx:{paddingTop:F=>F.spacing(1.25),paddingBottom:F=>F.spacing(.75),backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`}}},value:j??"",onChange:D,onKeyDownCapture:P,onContextMenu:F=>{F.stopPropagation()}})})}));Vo.displayName="NamedInput";const Lt=a=>a===null?"":a.toString(),_o=n.memo(n.forwardRef((a,l)=>{const{formName:o,formOptions:t,disabled:r,style:s,className:c,sx:h,onKeyDown:i,value:u,onChangeInput:g,resolvedAddress:b,...p}=a,d=Za(),m=o&&d?d.register(o,t):null,[S,C]=n.useState(""),[f,x]=n.useState(!1),[w,j]=n.useState(()=>Lt(u));n.useEffect(()=>{j(Lt(u)),C(""),o&&d&&d.clearErrors(o),x(!1)},[u]);const v=k.useCallbackRef(M=>{let N="";try{j(M);const z=Lt(u),I=b(M);I.toString()!==z&&g?.(I)}catch{N="Invalid Range"}o&&d&&(N?d.setError(o,{message:N}):d.clearErrors(o)),C(N),x(!0)},[w,g,o,d]),E=k.useCallbackRef(async M=>{if(f&&M.keyCode===k.KeyCodes.Escape){const N=Lt(u);j(N),C(""),x(!1),M.stopPropagation()}i?.(M)},[u,g,i,f]),P=k.useCallbackRef(M=>{m?.onBlur(M)},[m]),B=n.useCallback(M=>{v(M.target.value),m?.onChange(M)},[m]),[R,D]=n.useState(!1),F=n.useMemo(()=>e.jsx(T.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(y.ExhibitOptionButton,{disabled:!0,selected:R,onSelectToggle:M=>{D(M)},label:"Select Range",icon:e.jsx(k.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[R]);return e.jsx(T.FormControl,{sx:{paddingTop:M=>M.spacing(1.5),minWidth:135,width:"100%",...h},size:"small",ref:l,className:de("range-input",c),...p,children:e.jsx(T.TextField,{label:"Range",placeholder:"Enter Range",onBlur:P,disabled:r,error:!!S,inputRef:m?.ref,helperText:S||" ",sx:{"& .MuiFormHelperText-root":{marginTop:M=>M.spacing(.5)}},slotProps:{input:{endAdornment:F},inputLabel:{shrink:!0},htmlInput:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:M=>M.spacing(1.25),paddingBottom:M=>M.spacing(.75)}}},value:w??"",onChange:B,onKeyDownCapture:E,onContextMenu:M=>{M.stopPropagation()}})})}));_o.displayName="RangeInput";const Re=[];Re.push(De("Primary Background","bg1")),Re.push(De("Primary Text","tx1")),Re.push(De("Secondary Background","bg2")),Re.push(De("Secondary Text","tx2")),Re.push(De("Accent 1","accent1")),Re.push(De("Accent 2","accent2")),Re.push(De("Accent 3","accent3")),Re.push(De("Accent 4","accent4")),Re.push(De("Accent 5","accent5")),Re.push(De("Accent 6","accent6"));const Qa=a=>{const{docTheme:l,onSelectTheme:o,darkMode:t,isSelected:r,outlined:s,sx:c,...h}=a,i=G.useTheme(),u=n.useMemo(()=>{let g=[];for(let b=0;b<Re.length;b++){const p=Re[b];g.push(e.jsx(no,{schemeColorLookup:l.schemeLookup(),colorDef:p,darkMode:t,selectedColor:null},b+"-colorDef"))}return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(T.Box,{sx:{display:"flex",boxShadow:b=>b.shadows[2]},children:g})})},[l,i]);return e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:g=>`solid ${r?g.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:g=>`solid ${g.palette.text.primary} 1px !important`}},icon:null,...h,children:e.jsxs(T.Box,{sx:{border:g=>`solid ${g.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:g=>r?g.palette.text.primary:void 0,"&:hover:not([disabled])":{color:g=>g.palette.text.primary}},children:[e.jsx(T.Box,{sx:{},children:l.getName()}),e.jsxs(T.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[u,e.jsx(T.Box,{sx:{flex:"1 1 100%",textOverflow:"ellipsis",overflow:"hidden",marginTop:"2px",whiteSpace:"pre",fontFamily:()=>l.getFontScheme().getMajorFont()},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,slotProps:{popper:{style:{pointerEvents:"none"},disablePortal:!0,popperOptions:{strategy:"fixed",modifiers:[{name:"preventOverflow",enabled:!0,options:{boundariesElement:"viewport"}}]}}},title:e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"pre"},children:`The font used for the body.
|
|
7
|
+
The heading font is '${l.getFontScheme().getMajorFont()}'.`}),placement:"bottom-start",children:e.jsx("div",{children:l.getFontScheme().getMinorFont()})})})]})]})})},Ja=n.memo(n.forwardRef((a,l)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,sx:s,disabled:c=!1,darkMode:h,...i}=a,u=n.useMemo(()=>{const g=o?.getItems({selected:t})??[],b=[];if(g.length===0)return e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const p=g.length;for(let d=0;d<p;d++){const m=g[d],S=t&&m?.getName()===t.getName(),C=g[d+1];C&&C.isCustom()!==m.isCustom()&&b.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${d}`)),b.push(e.jsx(Qa,{docTheme:m,onSelectTheme:()=>r(m),isSelected:S,disabled:c,darkMode:h,onMouseDown:f=>{f.button===0&&f.preventDefault()},onMouseUp:f=>{f.button===0&&r(m)},onKeyDown:f=>{f.keyCode!==k.KeyCodes.Enter&&f.keyCode!==k.KeyCodes.Space||r(m)}},m.getName()))}return b},[t,r,h]);return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},ref:l,...i,children:e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"2px"},children:"Themes"}),e.jsx(y.ExhibitDivider,{}),e.jsx(T.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:u})]})})})),er=n.memo(n.forwardRef((a,l)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,icon:s,tooltip:c,label:h,variant:i=y.PopupButtonType.Toolbar,darkMode:u,panelProps:g,...b}=a,p=s||e.jsx(k.DynamicIcon,{iconKey:"Theme2"}),d=n.useCallback(S=>{const{closeFloatAll:C}=S;return e.jsx(Ja,{...g,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:u,onKeyDown:f=>{f.which===k.KeyCodes.Enter&&C()}})},[o,t,r,g,u]),m={createPopupPanel:d,tooltip:c||h||"Theme",label:h,icon:p,...b};return i===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:l,...m}):e.jsx(y.ExhibitPopupMenuItem,{ref:l,...m})})),Ko=n.memo(n.forwardRef((a,l)=>{const{sheet:o,className:t,debounceDelay:r=220,sx:s,...c}=a,[h,i]=n.useState(()=>o.getView().getZoomScale()),[u,g]=n.useState(null),b=n.useRef(0);ne.useModelListener(o,{onViewChange:()=>{g(!0),b.current===0&&i(o.getView().getZoomScale())}}),n.useEffect(()=>{b.current=0,g(!1),i(o.getView().getZoomScale())},[o]),n.useEffect(()=>{b.current!==0&&L.CommonUtils.debounce(()=>{h===b.current&&(b.current=0,o.getView().update({zoomScale:h}))},r)()},[h,r]);const p=k.useCallbackRef(P=>{let B=P;P<100?B=Math.round(P/(10/9)+10):P>100&&(B=Math.round(3*P-200)),b.current=B,g(!0),i(B)},[o]),d=P=>{let B=P;return P<100?B=10/9*(P-10):P>100&&(B=(P+200)/3),B},m=d(h),[S,C]=n.useState(null),f=n.useRef(null),x=n.useCallback(()=>{const P=S;P&&requestAnimationFrame(()=>{f.current?.contains(document.activeElement)&&P.focus()})},[]),w=k.useMouseDownAndHoldListener(()=>{p(d(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),j=k.useMouseDownAndHoldListener(()=>p(d(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10)))),v=G.useTheme(),E=n.useMemo(()=>`${L.IFont.getSharedMeasurer()("100%",Math.round(v.typography.fontSize),v.typography.fontFamily).width}px`,[v]);return e.jsxs(T.Box,{ref:l,className:de(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:P=>P.palette.text.secondary,...s},onFocus:P=>{P.relatedTarget&&!S&&C(P.relatedTarget)},onBlur:P=>{S&&!f?.current?.contains(P.relatedTarget)&&C(null)},onMouseDown:P=>{P.button===0&&P.preventDefault()},onMouseUp:P=>{P.button===0&&x()},...c,children:[e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(T.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:P=>P.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:P=>{P.button!==0?P.preventDefault():w(P)},children:e.jsx(k.DynamicIcon,{iconKey:"Remove"})})}),e.jsx(T.Slider,{ref:f,sx:{flex:"1 1 100%",padding:"6px 0px !important",marginRight:"2px",marginLeft:"2px","& .MuiSlider-thumb":{height:14,width:6,borderRadius:.75,"&.Mui-focusVisible":{boxShadow:P=>`0px 0px 0px 3px ${y.hexToRGB(P.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:P=>`0px 0px 0px 2px ${y.hexToRGB(P.palette.primary.main,.16)}`}},"& .MuiSlider-mark":{width:"1px",height:"8px"},"& .MuiSlider-markActive":{backgroundColor:"currentColor"},"& .MuiSlider-thumb:not(.MuiSlider-active)":{transition:u?"left 260ms ease-in":"none"}},valueLabelDisplay:"auto",size:"small",track:!1,min:0,step:1,value:m,max:200,marks:[{value:100}],onAnimationEnd:()=>g(!1),onWheel:P=>{p(d(L.CommonUtils.findNextStep(o.getView().getZoomScale(),P.deltaY<0,10)))},onKeyDown:P=>{P.which===k.KeyCodes.Down||P.which===k.KeyCodes.Right?(p(d(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),P.preventDefault()):P.which===k.KeyCodes.Up||P.which===k.KeyCodes.Left?(p(d(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),P.preventDefault()):P.which!==k.KeyCodes.Enter&&P.which!==k.KeyCodes.Escape||x()},onChange:(P,B)=>{Math.abs(B-100)<3?p(100):p(B)},valueLabelFormat:(P,B)=>`Zoom: ${Math.round(h)}%`}),e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom In",children:e.jsx(T.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:P=>P.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:P=>{P.button!==0?P.preventDefault():j(P)},children:e.jsx(k.DynamicIcon,{iconKey:"Add"})})}),e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(T.Box,{sx:{minWidth:"8px"}}),e.jsx(T.Typography,{noWrap:!0,component:"div",onClick:()=>{p(100)},sx:{cursor:"pointer",display:"flex",flex:"1 1 100%",fontSize:"0.70rem",marginLeft:"2px",marginRight:"2px",userSelect:"none",justifyContent:"center",width:E},children:e.jsx("div",{children:Math.round(h)+"%"})})]})]})}));Ko.displayName="SheetZoomScale";const Uo=n.memo(n.forwardRef((a,l)=>{const{sx:o,sheet:t,gridStyle:r,children:s,childrenEnd:c,...h}=a,i=n.useRef(null);n.useEffect(()=>{const d=m=>m.preventDefault();return i.current?.addEventListener("wheel",d,{passive:!1}),()=>{i.current?.removeEventListener("wheel",d)}},[]);const u=k.useEditMode(),g=n.useMemo(()=>{const d=u.getMode();return d?.description?d.description:"Ready"},[u]),[b,p]=n.useState(!1);return e.jsxs(T.Box,{className:"statusBar",ref:Ke([i,l]),sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",overflow:b?"visible":"hidden",boxShadow:`0px -1px 0px ${r.header.edgeStrokeFill}`,zIndex:1e3,...o},onMouseOver:()=>p(!0),onMouseLeave:()=>p(!1),...h,children:[s,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",color:d=>d.palette.text.secondary},variant:"caption",children:g})}),c?e.jsx(T.Box,{sx:{display:"flex",alignItems:"center"},children:c}):null,e.jsx(y.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(Ko,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Uo.displayName="StatusBar";var Rn,Pn,go,Mn,Dn,zt={exports:{}},yt={},Ct={exports:{}},Fn={},In={exports:{}};function Gl(){return Pn?Rn:(Pn=1,Rn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Xl(){if(Mn)return go;Mn=1;var a=Gl();function l(){}function o(){}return o.resetWarningCache=l,go=function(){function t(c,h,i,u,g,b){if(b!==a){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}function r(){return t}t.isRequired=t;var s={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:r,element:t,elementType:t,instanceOf:r,node:t,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:o,resetWarningCache:l};return s.PropTypes=s,s},go}function Ft(){return Dn||(Dn=1,In.exports=Xl()()),In.exports}var Nn,Ht={exports:{}},On,xe={},He={};function ao(){return On||(On=1,Object.defineProperty(He,"__esModule",{value:!0}),He.dontSetMe=function(a,l,o){if(a[l])return new Error(`Invalid prop ${l} passed to ${o} - do not set this, set it on the child.`)},He.findInArray=function(a,l){for(let o=0,t=a.length;o<t;o++)if(l.apply(l,[a[o],o,a]))return a[o]},He.int=function(a){return parseInt(a,10)},He.isFunction=function(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Function]"},He.isNum=function(a){return typeof a=="number"&&!isNaN(a)}),He}var An,Ln,We={};function qo(){if(Ln)return xe;Ln=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.addClassName=c,xe.addEvent=function(i,u,g,b){if(!i)return;const p={capture:!0,...b};i.addEventListener?i.addEventListener(u,g,p):i.attachEvent?i.attachEvent("on"+u,g):i["on"+u]=g},xe.addUserSelectStyles=function(i){if(!i)return;let u=i.getElementById("react-draggable-style-el");u||(u=i.createElement("style"),u.type="text/css",u.id="react-draggable-style-el",u.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
8
|
+
`,u.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
9
|
+
`,i.getElementsByTagName("head")[0].appendChild(u)),i.body&&c(i.body,"react-draggable-transparent-selection")},xe.createCSSTransform=function(i,u){const g=r(i,u,"px");return{[(0,l.browserPrefixToKey)("transform",l.default)]:g}},xe.createSVGTransform=function(i,u){return r(i,u,"")},xe.getTouch=function(i,u){return i.targetTouches&&(0,a.findInArray)(i.targetTouches,g=>u===g.identifier)||i.changedTouches&&(0,a.findInArray)(i.changedTouches,g=>u===g.identifier)},xe.getTouchIdentifier=function(i){if(i.targetTouches&&i.targetTouches[0])return i.targetTouches[0].identifier;if(i.changedTouches&&i.changedTouches[0])return i.changedTouches[0].identifier},xe.getTranslation=r,xe.innerHeight=function(i){let u=i.clientHeight;const g=i.ownerDocument.defaultView.getComputedStyle(i);return u-=(0,a.int)(g.paddingTop),u-=(0,a.int)(g.paddingBottom),u},xe.innerWidth=function(i){let u=i.clientWidth;const g=i.ownerDocument.defaultView.getComputedStyle(i);return u-=(0,a.int)(g.paddingLeft),u-=(0,a.int)(g.paddingRight),u},xe.matchesSelector=t,xe.matchesSelectorAndParentsTo=function(i,u,g){let b=i;do{if(t(b,u))return!0;if(b===g)return!1;b=b.parentNode}while(b);return!1},xe.offsetXYFromParent=function(i,u,g){const b=u===u.ownerDocument.body?{left:0,top:0}:u.getBoundingClientRect(),p=(i.clientX+u.scrollLeft-b.left)/g,d=(i.clientY+u.scrollTop-b.top)/g;return{x:p,y:d}},xe.outerHeight=function(i){let u=i.clientHeight;const g=i.ownerDocument.defaultView.getComputedStyle(i);return u+=(0,a.int)(g.borderTopWidth),u+=(0,a.int)(g.borderBottomWidth),u},xe.outerWidth=function(i){let u=i.clientWidth;const g=i.ownerDocument.defaultView.getComputedStyle(i);return u+=(0,a.int)(g.borderLeftWidth),u+=(0,a.int)(g.borderRightWidth),u},xe.removeClassName=h,xe.removeEvent=function(i,u,g,b){if(!i)return;const p={capture:!0,...b};i.removeEventListener?i.removeEventListener(u,g,p):i.detachEvent?i.detachEvent("on"+u,g):i["on"+u]=null},xe.scheduleRemoveUserSelectStyles=function(i){window.requestAnimationFrame?window.requestAnimationFrame(()=>{s(i)}):s(i)};var a=ao(),l=(function(i,u){if(typeof WeakMap=="function")var g=new WeakMap,b=new WeakMap;return(function(p,d){if(!d&&p&&p.__esModule)return p;var m,S,C={__proto__:null,default:p};if(p===null||typeof p!="object"&&typeof p!="function")return C;if(m=d?b:g){if(m.has(p))return m.get(p);m.set(p,C)}for(const f in p)f!=="default"&&{}.hasOwnProperty.call(p,f)&&((S=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(p,f))&&(S.get||S.set)?m(C,f,S):C[f]=p[f]);return C})(i,u)})((function(){if(An)return We;An=1,Object.defineProperty(We,"__esModule",{value:!0}),We.browserPrefixToKey=g,We.browserPrefixToStyle=function(b,p){return p?`-${p.toLowerCase()}-${b}`:b},We.default=void 0,We.getPrefix=u;const i=["Moz","Webkit","O","ms"];function u(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const p=window.document?.documentElement?.style;if(!p||b in p)return"";for(let d=0;d<i.length;d++)if(g(b,i[d])in p)return i[d];return""}function g(b,p){return p?`${p}${(function(d){let m="",S=!0;for(let C=0;C<d.length;C++)S?(m+=d[C].toUpperCase(),S=!1):d[C]==="-"?S=!0:m+=d[C];return m})(b)}`:b}return We.default=u(),We})());let o="";function t(i,u){return o||(o=(0,a.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(g){return(0,a.isFunction)(i[g])})),!!(0,a.isFunction)(i[o])&&i[o](u)}function r(i,u,g){let{x:b,y:p}=i,d=`translate(${b}${g},${p}${g})`;return u&&(d=`translate(${`${typeof u.x=="string"?u.x:u.x+g}`}, ${`${typeof u.y=="string"?u.y:u.y+g}`})`+d),d}function s(i){if(i)try{if(i.body&&h(i.body,"react-draggable-transparent-selection"),i.selection)i.selection.empty();else{const u=(i.defaultView||window).getSelection();u&&u.type!=="Caret"&&u.removeAllRanges()}}catch{}}function c(i,u){i.classList?i.classList.add(u):i.className.match(new RegExp(`(?:^|\\s)${u}(?!\\S)`))||(i.className+=` ${u}`)}function h(i,u){i.classList?i.classList.remove(u):i.className=i.className.replace(new RegExp(`(?:^|\\s)${u}(?!\\S)`,"g"),"")}return xe}var zn,Ie={};function tr(){if(zn)return Ie;zn=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Ie.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Ie.createCoreData=function(t,r,s){const c=!(0,a.isNum)(t.lastX),h=o(t);return c?{node:h,deltaX:0,deltaY:0,lastX:r,lastY:s,x:r,y:s}:{node:h,deltaX:r-t.lastX,deltaY:s-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:s}},Ie.createDraggableData=function(t,r){const s=t.props.scale;return{node:r.node,x:t.state.x+r.deltaX/s,y:t.state.y+r.deltaY/s,deltaX:r.deltaX/s,deltaY:r.deltaY/s,lastX:t.state.x,lastY:t.state.y}},Ie.getBoundPosition=function(t,r,s){if(!t.props.bounds)return[r,s];let{bounds:c}=t.props;c=typeof c=="string"?c:(function(i){return{left:i.left,top:i.top,right:i.right,bottom:i.bottom}})(c);const h=o(t);if(typeof c=="string"){const{ownerDocument:i}=h,u=i.defaultView;let g;if(c==="parent"?g=h.parentNode:g=h.getRootNode().querySelector(c),!(g instanceof u.HTMLElement))throw new Error('Bounds selector "'+c+'" could not find an element.');const b=g,p=u.getComputedStyle(h),d=u.getComputedStyle(b);c={left:-h.offsetLeft+(0,a.int)(d.paddingLeft)+(0,a.int)(p.marginLeft),top:-h.offsetTop+(0,a.int)(d.paddingTop)+(0,a.int)(p.marginTop),right:(0,l.innerWidth)(b)-(0,l.outerWidth)(h)-h.offsetLeft+(0,a.int)(d.paddingRight)-(0,a.int)(p.marginRight),bottom:(0,l.innerHeight)(b)-(0,l.outerHeight)(h)-h.offsetTop+(0,a.int)(d.paddingBottom)-(0,a.int)(p.marginBottom)}}return(0,a.isNum)(c.right)&&(r=Math.min(r,c.right)),(0,a.isNum)(c.bottom)&&(s=Math.min(s,c.bottom)),(0,a.isNum)(c.left)&&(r=Math.max(r,c.left)),(0,a.isNum)(c.top)&&(s=Math.max(s,c.top)),[r,s]},Ie.getControlPosition=function(t,r,s){const c=typeof r=="number"?(0,l.getTouch)(t,r):null;if(typeof r=="number"&&!c)return null;const h=o(s),i=s.props.offsetParent||h.offsetParent||h.ownerDocument.body;return(0,l.offsetXYFromParent)(c||t,i,s.props.scale)},Ie.snapToGrid=function(t,r,s){const c=Math.round(r/t[0])*t[0],h=Math.round(s/t[1])*t[1];return[c,h]};var a=ao(),l=qo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return Ie}var Hn,Wn,$n,Vn,St={},Wt={};function or(){return Hn||(Hn=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.default=function(){}),Wt}function Yl(){if(Wn)return St;Wn=1,Object.defineProperty(St,"__esModule",{value:!0}),St.default=void 0;var a=(function(d,m){if(typeof WeakMap=="function")var S=new WeakMap,C=new WeakMap;return(function(f,x){if(!x&&f&&f.__esModule)return f;var w,j,v={__proto__:null,default:f};if(f===null||typeof f!="object"&&typeof f!="function")return v;if(w=x?C:S){if(w.has(f))return w.get(f);w.set(f,v)}for(const E in f)E!=="default"&&{}.hasOwnProperty.call(f,E)&&((j=(w=Object.defineProperty)&&Object.getOwnPropertyDescriptor(f,E))&&(j.get||j.set)?w(v,E,j):v[E]=f[E]);return v})(d,m)})(n),l=h(Ft()),o=h(et),t=qo(),r=tr(),s=ao(),c=h(or());function h(d){return d&&d.__esModule?d:{default:d}}function i(d,m,S){return(m=(function(C){var f=(function(x,w){if(typeof x!="object"||!x)return x;var j=x[Symbol.toPrimitive];if(j!==void 0){var v=j.call(x,w);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(x)})(C,"string");return typeof f=="symbol"?f:f+""})(m))in d?Object.defineProperty(d,m,{value:S,enumerable:!0,configurable:!0,writable:!0}):d[m]=S,d}const u={start:"touchstart",move:"touchmove",stop:"touchend"},g={start:"mousedown",move:"mousemove",stop:"mouseup"};let b=g,p=class extends a.Component{constructor(){super(...arguments),i(this,"dragging",!1),i(this,"lastX",NaN),i(this,"lastY",NaN),i(this,"touchIdentifier",null),i(this,"mounted",!1),i(this,"handleDragStart",d=>{if(this.props.onMouseDown(d),!this.props.allowAnyClick&&typeof d.button=="number"&&d.button!==0)return!1;const m=this.findDOMNode();if(!m||!m.ownerDocument||!m.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:S}=m;if(this.props.disabled||!(d.target instanceof S.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(d.target,this.props.handle,m)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(d.target,this.props.cancel,m))return;d.type!=="touchstart"||this.props.allowMobileScroll||d.preventDefault();const C=(0,t.getTouchIdentifier)(d);this.touchIdentifier=C;const f=(0,r.getControlPosition)(d,C,this);if(f==null)return;const{x,y:w}=f,j=(0,r.createCoreData)(this,x,w);(0,c.default)("DraggableCore: handleDragStart: %j",j),(0,c.default)("calling",this.props.onStart),this.props.onStart(d,j)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(S),this.dragging=!0,this.lastX=x,this.lastY=w,(0,t.addEvent)(S,b.move,this.handleDrag),(0,t.addEvent)(S,b.stop,this.handleDragStop))}),i(this,"handleDrag",d=>{const m=(0,r.getControlPosition)(d,this.touchIdentifier,this);if(m==null)return;let{x:S,y:C}=m;if(Array.isArray(this.props.grid)){let x=S-this.lastX,w=C-this.lastY;if([x,w]=(0,r.snapToGrid)(this.props.grid,x,w),!x&&!w)return;S=this.lastX+x,C=this.lastY+w}const f=(0,r.createCoreData)(this,S,C);if((0,c.default)("DraggableCore: handleDrag: %j",f),this.props.onDrag(d,f)!==!1&&this.mounted!==!1)this.lastX=S,this.lastY=C;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const w=document.createEvent("MouseEvents");w.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(w)}}),i(this,"handleDragStop",d=>{if(!this.dragging)return;const m=(0,r.getControlPosition)(d,this.touchIdentifier,this);if(m==null)return;let{x:S,y:C}=m;if(Array.isArray(this.props.grid)){let w=S-this.lastX||0,j=C-this.lastY||0;[w,j]=(0,r.snapToGrid)(this.props.grid,w,j),S=this.lastX+w,C=this.lastY+j}const f=(0,r.createCoreData)(this,S,C);if(this.props.onStop(d,f)===!1||this.mounted===!1)return!1;const x=this.findDOMNode();x&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(x.ownerDocument),(0,c.default)("DraggableCore: handleDragStop: %j",f),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,x&&((0,c.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(x.ownerDocument,b.move,this.handleDrag),(0,t.removeEvent)(x.ownerDocument,b.stop,this.handleDragStop))}),i(this,"onMouseDown",d=>(b=g,this.handleDragStart(d))),i(this,"onMouseUp",d=>(b=g,this.handleDragStop(d))),i(this,"onTouchStart",d=>(b=u,this.handleDragStart(d))),i(this,"onTouchEnd",d=>(b=u,this.handleDragStop(d)))}componentDidMount(){this.mounted=!0;const d=this.findDOMNode();d&&(0,t.addEvent)(d,u.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const d=this.findDOMNode();if(d){const{ownerDocument:m}=d;(0,t.removeEvent)(m,g.move,this.handleDrag),(0,t.removeEvent)(m,u.move,this.handleDrag),(0,t.removeEvent)(m,g.stop,this.handleDragStop),(0,t.removeEvent)(m,u.stop,this.handleDragStop),(0,t.removeEvent)(d,u.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(m)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:o.default.findDOMNode(this)}render(){return a.cloneElement(a.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return St.default=p,i(p,"displayName","DraggableCore"),i(p,"propTypes",{allowAnyClick:l.default.bool,allowMobileScroll:l.default.bool,children:l.default.node.isRequired,disabled:l.default.bool,enableUserSelectHack:l.default.bool,offsetParent:function(d,m){if(d[m]&&d[m].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:l.default.arrayOf(l.default.number),handle:l.default.string,cancel:l.default.string,nodeRef:l.default.object,onStart:l.default.func,onDrag:l.default.func,onStop:l.default.func,onMouseDown:l.default.func,scale:l.default.number,className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),i(p,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),St}function Zl(){return $n||($n=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"DraggableCore",{enumerable:!0,get:function(){return i.default}}),a.default=void 0;var l=(function(m,S){if(typeof WeakMap=="function")var C=new WeakMap,f=new WeakMap;return(function(x,w){if(!w&&x&&x.__esModule)return x;var j,v,E={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return E;if(j=w?f:C){if(j.has(x))return j.get(x);j.set(x,E)}for(const P in x)P!=="default"&&{}.hasOwnProperty.call(x,P)&&((v=(j=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,P))&&(v.get||v.set)?j(E,P,v):E[P]=x[P]);return E})(m,S)})(n),o=g(Ft()),t=g(et),r=(function(){if(Nn)return Ht.exports;function m(C){var f,x,w="";if(typeof C=="string"||typeof C=="number")w+=C;else if(typeof C=="object")if(Array.isArray(C)){var j=C.length;for(f=0;f<j;f++)C[f]&&(x=m(C[f]))&&(w&&(w+=" "),w+=x)}else for(x in C)C[x]&&(w&&(w+=" "),w+=x);return w}function S(){for(var C,f,x=0,w="",j=arguments.length;x<j;x++)(C=arguments[x])&&(f=m(C))&&(w&&(w+=" "),w+=f);return w}return Nn=1,Ht.exports=S,Ht.exports.clsx=S,Ht.exports})(),s=qo(),c=tr(),h=ao(),i=g(Yl()),u=g(or());function g(m){return m&&m.__esModule?m:{default:m}}function b(){return b=Object.assign?Object.assign.bind():function(m){for(var S=1;S<arguments.length;S++){var C=arguments[S];for(var f in C)({}).hasOwnProperty.call(C,f)&&(m[f]=C[f])}return m},b.apply(null,arguments)}function p(m,S,C){return(S=(function(f){var x=(function(w,j){if(typeof w!="object"||!w)return w;var v=w[Symbol.toPrimitive];if(v!==void 0){var E=v.call(w,j);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(w)})(f,"string");return typeof x=="symbol"?x:x+""})(S))in m?Object.defineProperty(m,S,{value:C,enumerable:!0,configurable:!0,writable:!0}):m[S]=C,m}class d extends l.Component{static getDerivedStateFromProps(S,C){let{position:f}=S,{prevPropsPosition:x}=C;return!f||x&&f.x===x.x&&f.y===x.y?null:((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:f,prevPropsPosition:x}),{x:f.x,y:f.y,prevPropsPosition:{...f}})}constructor(S){super(S),p(this,"onDragStart",(C,f)=>{if((0,u.default)("Draggable: onDragStart: %j",f),this.props.onStart(C,(0,c.createDraggableData)(this,f))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(C,f)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",f);const x=(0,c.createDraggableData)(this,f),w={x:x.x,y:x.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:v}=w;w.x+=this.state.slackX,w.y+=this.state.slackY;const[E,P]=(0,c.getBoundPosition)(this,w.x,w.y);w.x=E,w.y=P,w.slackX=this.state.slackX+(j-w.x),w.slackY=this.state.slackY+(v-w.y),x.x=w.x,x.y=w.y,x.deltaX=w.x-this.state.x,x.deltaY=w.y-this.state.y}if(this.props.onDrag(C,x)===!1)return!1;this.setState(w)}),p(this,"onDragStop",(C,f)=>{if(!this.state.dragging||this.props.onStop(C,(0,c.createDraggableData)(this,f))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",f);const x={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:w,y:j}=this.props.position;x.x=w,x.y=j}this.setState(x)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},!S.position||S.onDrag||S.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??t.default.findDOMNode(this)}render(){const{axis:S,bounds:C,children:f,defaultPosition:x,defaultClassName:w,defaultClassNameDragging:j,defaultClassNameDragged:v,position:E,positionOffset:P,scale:B,...R}=this.props;let D={},F=null;const M=!E||this.state.dragging,N=E||x,z={x:(0,c.canDragX)(this)&&M?this.state.x:N.x,y:(0,c.canDragY)(this)&&M?this.state.y:N.y};this.state.isElementSVG?F=(0,s.createSVGTransform)(z,P):D=(0,s.createCSSTransform)(z,P);const I=(0,r.clsx)(f.props.className||"",w,{[j]:this.state.dragging,[v]:this.state.dragged});return l.createElement(i.default,b({},R,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),l.cloneElement(l.Children.only(f),{className:I,style:{...f.props.style,...D},transform:F}))}}a.default=d,p(d,"displayName","Draggable"),p(d,"propTypes",{...i.default.propTypes,axis:o.default.oneOf(["both","x","y","none"]),bounds:o.default.oneOfType([o.default.shape({left:o.default.number,right:o.default.number,top:o.default.number,bottom:o.default.number}),o.default.string,o.default.oneOf([!1])]),defaultClassName:o.default.string,defaultClassNameDragging:o.default.string,defaultClassNameDragged:o.default.string,defaultPosition:o.default.shape({x:o.default.number,y:o.default.number}),positionOffset:o.default.shape({x:o.default.oneOfType([o.default.number,o.default.string]),y:o.default.oneOfType([o.default.number,o.default.string])}),position:o.default.shape({x:o.default.number,y:o.default.number}),className:h.dontSetMe,style:h.dontSetMe,transform:h.dontSetMe}),p(d,"defaultProps",{...i.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Fn)),Fn}function nr(){if(Vn)return Ct.exports;Vn=1;const{default:a,DraggableCore:l}=Zl();return Ct.exports=a,Ct.exports.default=a,Ct.exports.DraggableCore=l,Ct.exports}var _n,$t={};function Ql(){if(_n)return $t;_n=1,$t.__esModule=!0,$t.cloneElement=function(s,c){return c.style&&s.props.style&&(c.style=t(t({},s.props.style),c.style)),c.className&&s.props.className&&(c.className=s.props.className+" "+c.className),l.default.cloneElement(s,c)};var a,l=(a=n)&&a.__esModule?a:{default:a};function o(s,c){var h=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);c&&(i=i.filter(function(u){return Object.getOwnPropertyDescriptor(s,u).enumerable})),h.push.apply(h,i)}return h}function t(s){for(var c=1;c<arguments.length;c++){var h=arguments[c]!=null?arguments[c]:{};c%2?o(Object(h),!0).forEach(function(i){r(s,i,h[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(h)):o(Object(h)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(h,i))})}return s}function r(s,c,h){return(c=(function(i){var u=(function(g,b){if(typeof g!="object"||g===null)return g;var p=g[Symbol.toPrimitive];if(p!==void 0){var d=p.call(g,b);if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(g)})(i,"string");return typeof u=="symbol"?u:String(u)})(c))in s?Object.defineProperty(s,c,{value:h,enumerable:!0,configurable:!0,writable:!0}):s[c]=h,s}return $t}var Kn,Un,wt={};function ar(){if(Kn)return wt;Kn=1,wt.__esModule=!0,wt.resizableProps=void 0;var a,l=(a=Ft())&&a.__esModule?a:{default:a};nr();var o={axis:l.default.oneOf(["both","x","y","none"]),className:l.default.string,children:l.default.element.isRequired,draggableOpts:l.default.shape({allowAnyClick:l.default.bool,cancel:l.default.string,children:l.default.node,disabled:l.default.bool,enableUserSelectHack:l.default.bool,offsetParent:l.default.node,grid:l.default.arrayOf(l.default.number),handle:l.default.string,nodeRef:l.default.object,onStart:l.default.func,onDrag:l.default.func,onStop:l.default.func,onMouseDown:l.default.func,scale:l.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var c,h=r[0];return h.axis==="both"||h.axis==="y"?(c=l.default.number).isRequired.apply(c,r):l.default.number.apply(l.default,r)},handle:l.default.oneOfType([l.default.node,l.default.func]),handleSize:l.default.arrayOf(l.default.number),lockAspectRatio:l.default.bool,maxConstraints:l.default.arrayOf(l.default.number),minConstraints:l.default.arrayOf(l.default.number),onResizeStop:l.default.func,onResizeStart:l.default.func,onResize:l.default.func,resizeHandles:l.default.arrayOf(l.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:l.default.number,width:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var c,h=r[0];return h.axis==="both"||h.axis==="x"?(c=l.default.number).isRequired.apply(c,r):l.default.number.apply(l.default,r)}};return wt.resizableProps=o,wt}function rr(){if(Un)return yt;Un=1,yt.__esModule=!0,yt.default=void 0;var a=(function(p,d){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var m=s(d);if(m&&m.has(p))return m.get(p);var S={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in p)if(f!=="default"&&Object.prototype.hasOwnProperty.call(p,f)){var x=C?Object.getOwnPropertyDescriptor(p,f):null;x&&(x.get||x.set)?Object.defineProperty(S,f,x):S[f]=p[f]}return S.default=p,m&&m.set(p,S),S})(n),l=nr(),o=Ql(),t=ar(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(p){if(typeof WeakMap!="function")return null;var d=new WeakMap,m=new WeakMap;return(s=function(S){return S?m:d})(p)}function c(){return c=Object.assign?Object.assign.bind():function(p){for(var d=1;d<arguments.length;d++){var m=arguments[d];for(var S in m)Object.prototype.hasOwnProperty.call(m,S)&&(p[S]=m[S])}return p},c.apply(this,arguments)}function h(p,d){var m=Object.keys(p);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(p);d&&(S=S.filter(function(C){return Object.getOwnPropertyDescriptor(p,C).enumerable})),m.push.apply(m,S)}return m}function i(p){for(var d=1;d<arguments.length;d++){var m=arguments[d]!=null?arguments[d]:{};d%2?h(Object(m),!0).forEach(function(S){u(p,S,m[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(m)):h(Object(m)).forEach(function(S){Object.defineProperty(p,S,Object.getOwnPropertyDescriptor(m,S))})}return p}function u(p,d,m){return(d=(function(S){var C=(function(f,x){if(typeof f!="object"||f===null)return f;var w=f[Symbol.toPrimitive];if(w!==void 0){var j=w.call(f,x);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(f)})(S,"string");return typeof C=="symbol"?C:String(C)})(d))in p?Object.defineProperty(p,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):p[d]=m,p}function g(p,d){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,S){return m.__proto__=S,m},g(p,d)}var b=(function(p){var d,m;function S(){for(var f,x=arguments.length,w=new Array(x),j=0;j<x;j++)w[j]=arguments[j];return(f=p.call.apply(p,[this].concat(w))||this).handleRefs={},f.lastHandleRect=null,f.slack=null,f}m=p,(d=S).prototype=Object.create(m.prototype),d.prototype.constructor=d,g(d,m);var C=S.prototype;return C.componentWillUnmount=function(){this.resetData()},C.resetData=function(){this.lastHandleRect=this.slack=null},C.runConstraints=function(f,x){var w=this.props,j=w.minConstraints,v=w.maxConstraints,E=w.lockAspectRatio;if(!j&&!v&&!E)return[f,x];if(E){var P=this.props.width/this.props.height,B=f-this.props.width,R=x-this.props.height;Math.abs(B)>Math.abs(R*P)?x=f/P:f=x*P}var D=f,F=x,M=this.slack||[0,0],N=M[0],z=M[1];return f+=N,x+=z,j&&(f=Math.max(j[0],f),x=Math.max(j[1],x)),v&&(f=Math.min(v[0],f),x=Math.min(v[1],x)),this.slack=[N+(D-f),z+(F-x)],[f,x]},C.resizeHandler=function(f,x){var w=this;return function(j,v){var E=v.node,P=v.deltaX,B=v.deltaY;f==="onResizeStart"&&w.resetData();var R=(w.props.axis==="both"||w.props.axis==="x")&&x!=="n"&&x!=="s",D=(w.props.axis==="both"||w.props.axis==="y")&&x!=="e"&&x!=="w";if(R||D){var F=x[0],M=x[x.length-1],N=E.getBoundingClientRect();w.lastHandleRect!=null&&(M==="w"&&(P+=N.left-w.lastHandleRect.left),F==="n"&&(B+=N.top-w.lastHandleRect.top)),w.lastHandleRect=N,M==="w"&&(P=-P),F==="n"&&(B=-B);var z=w.props.width+(R?P/w.props.transformScale:0),I=w.props.height+(D?B/w.props.transformScale:0),A=w.runConstraints(z,I);z=A[0],I=A[1];var O=z!==w.props.width||I!==w.props.height,W=typeof w.props[f]=="function"?w.props[f]:null;W&&!(f==="onResize"&&!O)&&(j.persist==null||j.persist(),W(j,{node:E,size:{width:z,height:I},handle:x})),f==="onResizeStop"&&w.resetData()}}},C.renderResizeHandle=function(f,x){var w=this.props.handle;if(!w)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+f,ref:x});if(typeof w=="function")return w(f,x);var j=i({ref:x},typeof w.type=="string"?{}:{handleAxis:f});return a.cloneElement(w,j)},C.render=function(){var f=this,x=this.props,w=x.children,j=x.className,v=x.draggableOpts;x.width,x.height,x.handle,x.handleSize,x.lockAspectRatio,x.axis,x.minConstraints,x.maxConstraints,x.onResize,x.onResizeStop,x.onResizeStart;var E=x.resizeHandles;x.transformScale;var P=(function(B,R){if(B==null)return{};var D,F,M={},N=Object.keys(B);for(F=0;F<N.length;F++)D=N[F],R.indexOf(D)>=0||(M[D]=B[D]);return M})(x,r);return(0,o.cloneElement)(w,i(i({},P),{},{className:(j?j+" ":"")+"react-resizable",children:[].concat(w.props.children,E.map(function(B){var R,D=(R=f.handleRefs[B])!=null?R:f.handleRefs[B]=a.createRef();return a.createElement(l.DraggableCore,c({},v,{nodeRef:D,key:"resizableHandle-"+B,onStop:f.resizeHandler("onResizeStop",B),onStart:f.resizeHandler("onResizeStart",B),onDrag:f.resizeHandler("onResize",B)}),f.renderResizeHandle(B,D))}))}))},S})(a.Component);return yt.default=b,b.propTypes=t.resizableProps,b.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},yt}var qn,Gn,kt={};function Jl(){if(qn)return kt;qn=1,kt.__esModule=!0,kt.default=void 0;var a=(function(d,m){if(d&&d.__esModule)return d;if(d===null||typeof d!="object"&&typeof d!="function")return{default:d};var S=c(m);if(S&&S.has(d))return S.get(d);var C={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in d)if(x!=="default"&&Object.prototype.hasOwnProperty.call(d,x)){var w=f?Object.getOwnPropertyDescriptor(d,x):null;w&&(w.get||w.set)?Object.defineProperty(C,x,w):C[x]=d[x]}return C.default=d,S&&S.set(d,C),C})(n),l=s(Ft()),o=s(rr()),t=ar(),r=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(d){return d&&d.__esModule?d:{default:d}}function c(d){if(typeof WeakMap!="function")return null;var m=new WeakMap,S=new WeakMap;return(c=function(C){return C?S:m})(d)}function h(){return h=Object.assign?Object.assign.bind():function(d){for(var m=1;m<arguments.length;m++){var S=arguments[m];for(var C in S)Object.prototype.hasOwnProperty.call(S,C)&&(d[C]=S[C])}return d},h.apply(this,arguments)}function i(d,m){var S=Object.keys(d);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(d);m&&(C=C.filter(function(f){return Object.getOwnPropertyDescriptor(d,f).enumerable})),S.push.apply(S,C)}return S}function u(d){for(var m=1;m<arguments.length;m++){var S=arguments[m]!=null?arguments[m]:{};m%2?i(Object(S),!0).forEach(function(C){g(d,C,S[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(S)):i(Object(S)).forEach(function(C){Object.defineProperty(d,C,Object.getOwnPropertyDescriptor(S,C))})}return d}function g(d,m,S){return(m=(function(C){var f=(function(x,w){if(typeof x!="object"||x===null)return x;var j=x[Symbol.toPrimitive];if(j!==void 0){var v=j.call(x,w);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(x)})(C,"string");return typeof f=="symbol"?f:String(f)})(m))in d?Object.defineProperty(d,m,{value:S,enumerable:!0,configurable:!0,writable:!0}):d[m]=S,d}function b(d,m){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(S,C){return S.__proto__=C,S},b(d,m)}var p=(function(d){var m,S;function C(){for(var f,x=arguments.length,w=new Array(x),j=0;j<x;j++)w[j]=arguments[j];return(f=d.call.apply(d,[this].concat(w))||this).state={width:f.props.width,height:f.props.height,propsWidth:f.props.width,propsHeight:f.props.height},f.onResize=function(v,E){var P=E.size;f.props.onResize?(v.persist==null||v.persist(),f.setState(P,function(){return f.props.onResize&&f.props.onResize(v,E)})):f.setState(P)},f}return S=d,(m=C).prototype=Object.create(S.prototype),m.prototype.constructor=m,b(m,S),C.getDerivedStateFromProps=function(f,x){return x.propsWidth!==f.width||x.propsHeight!==f.height?{width:f.width,height:f.height,propsWidth:f.width,propsHeight:f.height}:null},C.prototype.render=function(){var f=this.props,x=f.handle,w=f.handleSize;f.onResize;var j=f.onResizeStart,v=f.onResizeStop,E=f.draggableOpts,P=f.minConstraints,B=f.maxConstraints,R=f.lockAspectRatio,D=f.axis;f.width,f.height;var F=f.resizeHandles,M=f.style,N=f.transformScale,z=(function(I,A){if(I==null)return{};var O,W,Z={},J=Object.keys(I);for(W=0;W<J.length;W++)O=J[W],A.indexOf(O)>=0||(Z[O]=I[O]);return Z})(f,r);return a.createElement(o.default,{axis:D,draggableOpts:E,handle:x,handleSize:w,height:this.state.height,lockAspectRatio:R,maxConstraints:B,minConstraints:P,onResizeStart:j,onResize:this.onResize,onResizeStop:v,resizeHandles:F,transformScale:N,width:this.state.width},a.createElement("div",h({},z,{style:u(u({},M),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},C})(a.Component);return kt.default=p,p.propTypes=u(u({},t.resizableProps),{},{children:l.default.element}),kt}var ei=(Gn||(Gn=1,zt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},zt.exports.Resizable=rr().default,zt.exports.ResizableBox=Jl().default),zt.exports);const Go=n.memo(n.forwardRef((a,l)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:c=!1,disabled:h=!1,commandPopupButtonProps:i,sx:u,...g}=a,b=k.useNotifier(),[p,d]=n.useState(null),[m,S]=n.useState(()=>r.getSelectedRanges().getCoords()),[C,f]=n.useState(!1),{reference:x}=y.useFloatStack({parentFloat:i?.parentFloat}),[w,j]=n.useState(()=>c||!r.getProtection().isStructureAllowed()),v=()=>p?.text??"",[E,P]=n.useState(v),B=k.useCallbackRef(()=>{if(x?.closeAll(),!E){const q=v();return P(v()),q}if(v()===E)return E;const U=E.trim().toLowerCase();if(U==="r"||U==="c")return E;try{const q=r.getRanges(E);if(q)return q.toString()}catch{}const H=t.getByName(E);if(H&&H.getRanges())return E;let X=null;try{const q=r.getRanges(E),K=q.getCoords().map(V=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...V}));X=r.getRanges(K)}catch{}if(!X){const q=r.getSelectedRanges().getCoords().map(K=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...K}));X=r.getRanges(q)}try{let q=t.getByName(E);w||q||(q=t.addReference(E,X)),q&&d({text:q.getName()})}catch(q){P(v()),b.showMessage?.(q.message,{type:k.NotifierType.Error})}return null},[E,t,x,w,b]),R=k.useCallbackRef(()=>{if(r.isClosed())return;const U=[];for(let q=0;q<m.length;q++){const K=m[q];U.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...K})}let H=null;try{H=t.lookupByRanges(U)}catch{}let X=null;X=H?.length>0?H[0].getName():r.getSelectedSheet().getSelectedRange().toString(),d({text:X})},[r,m]),[D,F]=n.useState(()=>t?.getItems()??null);ne.useModelListener(t,{onCollectionChange(U){F(t.getItems()),R()},onClose(U){F([])}}),n.useEffect(()=>{P(v())},[p,m]);const[M,N]=n.useState(r?.getSelectedSheet());ne.useModelListener(r,{onProtectionChange:U=>{j(c||!U.getProtection().isStructureAllowed())},onSheetsChange:U=>{N(U?.getSelectedSheet())},onViewChange(U){N(U?.getSelectedSheet())}});const[z,I]=n.useState(null),A=k.useCallbackRef(L.CommonUtils.debounce(R,z?320:0),[]);ne.useModelListener(M.getSelection(),{onChange:()=>{S(U=>{const H=r.getSelectedRanges().getCoords();return L.CoordUtils.isEqualRangesArrays(H,U)?U:H})},onAdjustingChange:U=>{I(U.getAdjusting())}}),n.useEffect(()=>{if(z){const U=r.getSelectedRange(),H=U.getRowCount(),X=U.getColumnCount();let q=`${H}R x ${X}C`;if(q.length>17&&(q=`${H}x${X}`),H>1||X>1)return void d({text:q,fontStyle:"italic",justifyContent:"center"})}d({text:r.getSelectedSheet().getSelectedRange().toString()}),A()},[m,r,z]);const O=n.useRef(null),W=n.useCallback(U=>{const{onMouseDown:H,onMouseUp:X,...q}=U;return e.jsx(T.IconButton,{...q,sx:{...q?.sx,display:"flex",flex:"1 1 100%"},disableRipple:!0,children:e.jsx(T.Input,{inputMode:"text",inputProps:{tabIndex:0,name:"input-named-range",maxLength:255,className:"input",autoFocus:!1,spellCheck:!1,autoComplete:"off",ref:O},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:K=>`1px solid ${K.palette.text.icon??K.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:K=>`1px solid ${K.palette.primary.main}`},"::after":{borderBottom:K=>`1px solid ${K.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",height:"1rem",fontSize:11*L.IFont.getDeviceScale(),fontStyle:p?.fontStyle,paddingLeft:K=>K.spacing(.75),paddingRight:K=>K.spacing(.75),boxShadow:"none",flex:"1",color:K=>K.palette.text.secondary,input:{padding:"0",height:"1rem",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:K=>K.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:K=>K.palette.text.primary}}},value:E,onFocus:K=>{K.target?.select()},onKeyDown:K=>{if(K.which===k.KeyCodes.Enter||K.which===k.KeyCodes.Tab){let V=E;v()!==E&&(K.stopPropagation(),K.preventDefault(),V=B()),V?Z(V):s?.()}else if(K.which===k.KeyCodes.Escape)v()!==E?(P(v()),setTimeout(()=>{K.target?.select()},0),K.stopPropagation(),K.preventDefault()):s?.();else if(K.which===k.KeyCodes.Space)return void K.stopPropagation()},onBlur:()=>{P(v())},onChange:K=>{P(K.target.value)}})})},[E,p]),Z=k.useCallbackRef(async U=>{try{x?.closeAll();const H=t.lookupByRanges(U)?.[0];H&&await H?.select(),await r.getRanges(U)?.select()}catch(H){b.showMessage?.(H.message,{type:k.NotifierType.Error})}},[t,b,r]),J=n.useCallback(U=>{setTimeout(()=>{f(!0)},0);const H={variant:k.CommandButtonType.Menuitem,parentFloat:U.floatReference,commandHook:{...i?.commandHook,beforeExecute:(ie,ae)=>(x?.closeAll(),i?.commandHook?.beforeExecute?.(ie,ae))},scope:i?.scope,commands:i?.commands};let X=t.getItems({scope:r?.getSelectedSheet().getName()});X=X.sort((ie,ae)=>ie.getType()===ae.getType()?ie.getName().localeCompare(ae.getName()):ie.getType()==="range"?-1:1);const q=w?null:["editNamedReference","deleteNamedReference"],K=w?null:["editTable",null,"convertTableToRange","deleteTable"],V=[],oe=X.length;for(let ie=0;ie<oe;ie++){const ae=X[ie],Ce=ae.getRanges();if(!Ce||ae.isHidden())continue;const he=ae.getType();he!==X[ie-1]?.getType()&&(ie>0&&V.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},`type-divider-${V.length}`)),V.push(e.jsx(y.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:ae.getType()==="reference"?"Ranges":"Tables"},`type-header-${V.length}`))),he==="reference"?V.push(n.createElement(y.SimpleCommandPopupButton,{...H,key:"named-"+V.length,popupCommandKeys:q,popupScope:"namedItem",scope:"namedItem",commandState:ae,commands:i?.commands,label:ae.getName(),quickCommand:"selectNamed",disabled:!ae.getRanges()||h,icon:"NamedRange"})):he==="table"&&V.push(n.createElement(y.SimpleCommandPopupButton,{...H,key:"namedItem-"+V.length,popupCommandKeys:K,popupScope:"namedItem",scope:"namedItem",commands:i?.commands,commandState:ae,label:ae.getName(),quickCommand:"selectNamed",disabled:!Ce||h,icon:"InsertTable"}))}const le=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...g,children:[w?null:e.jsx(y.CommandButton,{...H,scope:"namedItem",command:i?.commands.getCommand("addNamedReference")}),V&&V.length>0?e.jsxs(e.Fragment,{children:[w?null:e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:V})]}):null]});return y.defaultCreatePopupPanel({...U,children:le})},[r,D,t,p,w]),te=k.useImperativeElement(l,()=>({focus(U){O.current?.focus(U)}}),[]);return e.jsx(T.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...u},ref:Ke([te,l]),...g,children:e.jsx(y.ExhibitPopupIconButton,{className:"outer-button",sx:{display:"flex",flex:"1 1 100%","& .tooltip-wrapper":{display:"flex",flex:"1 1 100%",width:"100%"},...u},buttonProps:{sx:{backgroundColor:U=>U.palette.background.paper,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:U=>o?U.palette.action.disabled:G.alpha(U.palette.divider,.2)},parentFloat:x,createPopupPanel:J,onPopupOpen:()=>f(!0),onPopupClose:()=>f(!1),createTooltip:({children:U},H)=>e.jsx(y.ExhibitTooltip,{title:H||C?"":"Name Box",disabled:H,leaveDelay:0,sx:{opacity:H||C?0:1},children:U}),createQuickButton:W})})}));Go.displayName="NamedCollectionEditor";const ti=(a,l)=>e.jsx(Go,{ref:l,...a}),Xo=n.memo(n.forwardRef((a,l)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:c=!0,NamedCollectionEditorProps:h,renderNamedCollectionEditor:i=ti,disabled:u,commands:g,...b}=a,[p,d]=n.useState(t?.getSelectedSheet()),[m,S]=n.useState(p.getSelectedCell().getCoords()),[C,f]=n.useState(!1),x=u||C;ne.useModelListener(t,{onSheetsChange:V=>{const oe=V?.getSelectedSheet();S(oe.getSelectedCell().getCoords()),d(oe)},onViewChange(V){const oe=V?.getSelectedSheet();S(oe.getSelectedCell().getCoords()),d(oe)}});const w=n.useRef(null),j=n.useMemo(()=>({fontSize:11}),[]);ne.useModelListener(p.getSelection(),{onChange:()=>{const V=p.getSelectedCell();f(!V.isEditAllowed()),S(V.getCoords())}}),ne.useModelListener(p,{onProtectionChange(){f(!p.getSelectedCell().isEditAllowed())}});const v=w.current?.getLineHeight()??20,[E,P]=n.useState(v),[B,R]=n.useState(5),[D,F]=n.useState(1),M=k.useCallbackRef((V,{size:oe})=>{V.preventDefault(),V.stopPropagation();const le=Math.floor(oe.height/v);P(le*v+1),le>1&&R(le)},[v]),N=k.useCallbackRef((V,{size:oe})=>{const le=Math.floor(oe.height/v);F(le)},[v]),z=k.useEditMode(),I=z.getMode();let A=null;I?.key==="edit"&&(A=I.args?.stateAndCoords);const O=n.useMemo(()=>{let V=A?.editState;return V||(V=ne.createCellEditStateFromCell(()=>p.getRange(m).getCell())),e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(ne.SheetCellEditor,{ref:w,activeCoords:m,sheet:p,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:m})},defaultTextStyle:j,useRichStyling:!1,disabled:x,onChangeEdit:oe=>{if(oe.dirty!==void 0){const le={sheet:p,coords:m,editState:oe};z.setMode(ie=>({...ie,args:{...ie?.args,stateAndCoords:le}}))}},editState:V,commands:g,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:D})})},[p,A,m,D,r]),W=n.useRef(null),Z=n.useMemo(()=>c?i({names:t.getNames(),workbook:t,...h},W):null,[i,h,c,p,t,x]),J=n.useMemo(()=>e.jsxs(T.Paper,{elevation:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:0,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,border:V=>`solid ${x?V.palette.action.disabled:G.alpha(V.palette.divider,.2)} 1px`},children:[e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"warning","aria-label":"cancel-formula-edit",icon:e.jsx(k.DynamicIcon,{iconKey:"CloseError"}),tooltipProps:{label:"Cancel",simple:!0},disabled:x||A===null,onMouseDown:V=>{V.button===0&&V.preventDefault()},onClick:()=>{r.cancelEdit()}}),e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,color:"primary","aria-label":"commit-formula-edit",icon:e.jsx(k.DynamicIcon,{iconKey:"CheckSuccess"}),tooltipProps:{label:"Enter",simple:!0},disabled:x||A===null,onMouseDown:V=>{V.button===0&&V.preventDefault()},onClick:()=>{r.submitEdit()}}),e.jsx(y.ExhibitIconButton,{sx:{border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,disabled:!0,"aria-label":"commit-formula-function",icon:e.jsx(k.DynamicIcon,{iconKey:"Function",style:{transform:"scale(0.85)"}}),tooltipProps:{label:"Insert Function",simple:!0},onMouseDown:V=>{V.button===0&&V.preventDefault()}})]}),[x,A]),te=G.useTheme(),[U,H]=n.useState(!1),X=n.useMemo(()=>e.jsxs(T.Box,{className:"formula-bar",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:V=>V.spacing(.5),alignItems:"start"},children:[J,e.jsxs(T.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:V=>V.typography.fontFamily,fontSize:11*L.IFont.getDeviceScale(),alignItems:"stretch",paddingTop:"2px",paddingBottom:"2px",boxShadow:"none",borderRadius:V=>`${V.shape.borderRadius}px`,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,border:V=>`solid ${x?V.palette.action.disabled:G.alpha(V.palette.divider,.2)} 1px`,"& textarea":{color:V=>x?`${V.palette.text.disabled} !important`:V.palette.text.primary},"& .react-resizable-handle":{width:"100%",height:"8px",backgroundColor:"transparent",boxSizing:"content-box",zIndex:1e3},"& .react-resizable-handle-s":{position:"absolute",bottom:"-10px",cursor:"s-resize"}},onFocus:()=>H(!0),onBlur:()=>H(!1),onMouseDown:V=>{V.target?.classList.contains("react-resizable-handle")&&V.preventDefault()},children:[e.jsx(T.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignItems:"center",marginTop:"0px",paddingLeft:V=>V.spacing(1),paddingRight:V=>V.spacing(1)},children:e.jsx(ei.ResizableBox,{height:E,draggableOpts:{grid:[v,v]},minConstraints:[v,v],maxConstraints:[15*v,15*v],onResize:N,onResizeStop:M,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:O})}),e.jsx(y.ExhibitIconButton,{sx:{padding:"0px",margin:"0px 0px",border:"none !important","&.Mui-focusVisible":{border:"none"},"&:hover:not([disabled])":{border:"none"}},dense:!0,outlined:!1,"aria-label":"toggle-expand-formula-edit",icon:e.jsx(k.DynamicIcon,{iconKey:D>1?"ExpandLess":"ExpandMore"}),tooltipProps:{label:(D>1?"Collapse":"Expand")+" Formula Bar",simple:!0},onMouseDown:V=>{V.button===0&&V.preventDefault()},onClick:()=>{const V=D>1?1:B;P(V*v+1),F(V)}}),e.jsx(T.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:U?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:V=>V.palette.primary.main,borderRadius:V=>`${V.shape.borderRadius}px`}})]})]}),[J,O,U,D,v]),q=n.useMemo(()=>Z||X?!Z&&X?X:Z&&!X?Z:e.jsx(e.Fragment,{children:e.jsx(k.SplitPane,{fixedPane:"before",minBefore:"165px",minAfter:"200px",paneBeforeProps:{style:{alignItems:"flex-start"}},paneAfterProps:{style:{overflow:"visible"}},resizerProps:{style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='6' height='13' viewBox='0 0 6 13' version='1.1' fill='${te.palette.text.icon??te.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='m 4.5961932,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.88365,0 -1.60005,-0.71626 -1.60005,-1.59991 0,-0.88365 0.7164,-1.6000508 1.60005,-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.88365,0 -1.60005,-0.7164 -1.60005,-1.60004 0,-0.88365 0.7164,-1.60005 1.60005,-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 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60005 0,-0.88365 0.7164,-1.59991 1.60005,-1.59991 0.88364,0 1.59991,0.71626 1.59991,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center calc(((var(--icon-size, 24) - 13px + 5px) / 2))",minWidth:"18px",marginRight:"1px"}},elementBefore:Z,elementAfter:X})}):null,[Z,X]),K=k.useImperativeElement(l,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>W.current}),[]);return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",gap:V=>V.spacing(.5),...o},ref:K,...b,children:q})}));Xo.displayName="FormulaBar";const Yo=n.memo(n.forwardRef((a,l)=>{const{filter:o,commands:t,disabled:r,sx:s,floatReference:c,...h}=a,i=n.useMemo(()=>({}),[]),u=n.useMemo(()=>({commandHook:{beforeExecute:(p,d)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:c}),[r,c]),g=n.useMemo(()=>({...i,...u,variant:k.CommandButtonType.Menuitem}),[i,u]),b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:t.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...g,command:t.getCommand("sortDescending")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:t.getCommand("autoFilterClear")}),[]]});return e.jsx(T.Box,{ref:l,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...h,children:b})}));Yo.displayName="FilterColumnMenu";const lr=n.memo(n.forwardRef((a,l)=>{const{children:o,className:t,disabled:r,style:s,filter:c,...h}=a,i=k.useImperativeElement(l,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:i,className:de("filters",t),style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",...s},...h,children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",minHeight:"100px",minWidth:"220px",alignItems:"center",border:"grey solid 1px",padding:"4px 4px",overflow:"hidden",flexDirection:"column",justifyContent:"space-evenly",marginTop:"4px",marginBottom:"4px",marginLeft:"16px",marginRight:"16px"},children:[e.jsx("div",{children:c.getName()}),e.jsx("div",{children:"Filter Widget"})]})})}));lr.displayName="Filters";const Zo=n.memo(n.forwardRef((a,l)=>{const{children:o,sheet:t,style:r,className:s,value:c,index:h,editing:i,editable:u,disabled:g,selectedIndex:b,dragging:p,borderColor:d,borderWidth:m,activeColor:S,background:C="white",tabRadius:f=4,gridTheme:x,...w}=a,[j,v]=n.useState(()=>!!t&&t.getProtection().isLocked()),[E,P]=n.useState(()=>t?t.getTabColor():null);ne.useModelListener(t,{onProtectionChange:()=>{v(t.getProtection().isLocked())},onTabColorChange:()=>{P(t.getTabColor())},onStyleChange:()=>{P(t.getTabColor())}});const B=G.useTheme(),R=b===h;let D=null,F=null;if(E||p){let z=C;E?(F=E.toBlackOrWhite().toCSS(),z=E?.toCSS()):R||(z=B.palette.background.paper),D=e.jsx(T.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:R?"50%":"100%",borderRadius:"4px",border:I=>R?`${C} solid 1px`:`${I.palette.divider} solid 1px`,background:R&&E?`linear-gradient(0deg, ${z} 0%, transparent)`:z}})}let M=null;typeof d=="string"?M=d:d?.toCSS&&(M=d.toCSS());const N=R?e.jsx(T.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:z=>z.palette.primary.main}}):null;return e.jsx(G.ThemeProvider,{theme:R?x??B:B,children:e.jsx(T.Box,{ref:l,className:de(s),sx:{...r,display:"flex",flexDirection:"column",minHeight:"0px",fontWeight:R?"700":"400",fontSize:"0.85rem",letterSpacing:"0",lineHeight:"1",textTransform:"none",minWidth:"unset",cursor:p?"grabbing":void 0},...w,children:e.jsx(k.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:f,strokeColor:R?M:"transparent",children:e.jsx(T.Button,{sx:{textTransform:"none",borderRadius:"0px",minHeight:"0px",paddingLeft:"11px",paddingRight:"12px",paddingTop:"3px",flex:"1 1 100%",paddingBottom:"3px",fontWeight:R?"700":"400",fontSize:"0.85rem",letterSpacing:"0",transition:"none",cursor:p?"grabbing":void 0,color:R?"primary":F||"text.secondary",backgroundColor:R?C:"transparent","&:hover:not([disabled])":{backgroundColor:R?C:"transparent"},"& input":{color:z=>`${z.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:g,disableRipple:i,component:"div",children:e.jsxs(e.Fragment,{children:[D,e.jsxs(T.Box,{sx:{zIndex:"1",display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:"1px",lineHeight:"1",marginTop:R?void 0:"1px"},children:[o,N]}),j?e.jsx(k.DynamicIcon,{iconKey:"Lock",style:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(T.Box,{sx:{minHeight:"22px"}})]})]})},c+":"+h)})})})}));Zo.displayName="SheetTab";const Qo=n.memo(n.forwardRef((a,l)=>{const{workbook:o,index:t,commands:r,scope:s="sheet",disabled:c,floatReference:h,sx:i,className:u,tabStripRef:g,...b}=a,[p,d]=n.useState(o?.getProtection());ne.useModelListener(o,{onProtectionChange:x=>{d(x?.getProtection())}});const m=n.useMemo(()=>({}),[]),S=n.useMemo(()=>({commandHook:{beforeExecute:(x,w)=>h.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:c||t===void 0,parentFloat:h}),[c,h]),C=n.useMemo(()=>({...m,...S}),[m,S]),f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:r.getCommand("addSheet"),commandState:t,...C,variant:k.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r.getCommand("deleteSheet"),...C,variant:k.CommandButtonType.Menuitem}),e.jsxs(y.ExhibitMenuItem,{onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:()=>{Promise.resolve(h.closeAll()).then(()=>{g?.startEdit(t)})},disabled:c||!p.isStructureAllowed(),parentFloat:h,children:["Rename",s!=="sheet"?" Sheet":""]}),e.jsx(y.CommandButton,{command:r.getCommand("duplicateSheet"),...C,variant:k.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r?.getCommand("protectionSheetToggle"),...C,variant:k.CommandButtonType.Menuitem}),e.jsx(pt,{variant:k.CommandButtonType.Menuitem,command:r.getCommand("formatSheetTabColor"),icon:e.jsx(k.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:ut.End},parentFloat:h}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{command:r.getCommand("hideSheet"),...C,variant:k.CommandButtonType.Menuitem})]});return e.jsx(T.Box,{ref:l,className:de("menu",u),sx:{...i},...b,children:f})}));Qo.displayName="SheetTabMenu";const Jo=n.memo(n.forwardRef((a,l)=>{const{workbook:o,gridStyle:t,floatReference:r,closeFloatAll:s,className:c,...h}=a,[i,u]=n.useState(o?.getSheets().getItems()),[g,b]=n.useState(o?.getProtection());ne.useModelListener(o,{onSheetsChange:d=>{u(d.getSheets().getItems())},onProtectionChange:d=>{b(d?.getProtection())}});const p=n.useMemo(()=>{const d=[],m=o.getSheets().getItems({visibility:L.ISheet.Visibility.Hidden}),S=o.getSelectedSheet();for(let C=0;C<m.length;C++){const f=m[C],x=f.getVisibility();if(x===L.ISheet.Visibility.VeryHidden)continue;const w=S===f,j=f.getProtection().isLocked(),v=f.getTabColor(),E=t?.body.fill??"transparent";let P=null,B=null,R=E;v&&(R=v.toCSS(),w||(B=v.toBlackOrWhite().toCSS()),P=e.jsx(T.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:w?R:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(T.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:w||x===L.ISheet.Visibility.Hidden?"50%":"100%",border:F=>w?`${E} solid 1.5px`:`${F.palette.divider} solid 1px`,background:w&&v?`linear-gradient(0deg, ${R} 0%, ${E})`:R,borderRadius:"4px"}})}));let D=null;j&&(D=e.jsx(k.DynamicIcon,{iconKey:"Lock"})),x!==L.ISheet.Visibility.Visible&&(D=e.jsx(k.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:g.isStructureAllowed()?1:.7},color:"secondary"})),D&&(D=e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:D})),d.push(e.jsx(y.ExhibitMenuItem,{disabled:!g.isStructureAllowed()&&x===L.ISheet.Visibility.Hidden,sx:{color:F=>{let M=w?F.palette.primary.main:F.palette.text.secondary;return B&&(M=B),x===L.ISheet.Visibility.Hidden&&(M=Pe.alpha(M,F.palette.action.disabledOpacity)),M},borderLeft:F=>`${w?F.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",paddingTop:"4px",paddingBottom:"4px",fontWeight:w?"700":"400","&:hover":{fontWeight:"700"}},icon:w?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:F=>F.preventDefault(),onMouseUp:()=>{Promise.resolve(r.closeAll()).then(()=>{try{f.select()}catch(F){console.error(F)}})},children:e.jsxs(e.Fragment,{children:[P,e.jsxs(T.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(T.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[f.getName(),e.jsx(T.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:f.getName()})]}),D]})]})},""+C))}return d},[o,g,i,r,t]);return e.jsx(T.Box,{ref:l,className:de("menu",c),...h,children:p})}));Jo.displayName="SheetsAllMenu";let Vt=!1,ir=!1,$e=null;const Xn=async a=>{const l=await L.LicenseManager.getDetails();if(ir||l.isEval()){try{const o=top??window;o.SheetXL||(o.SheetXL=Object.freeze({getSelectedWorkbook:()=>$e?.getWorkbook(),getSelectedSheet:()=>$e?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>$e?.getWorkbook().getSelectedRange(),getSelectedRanges:()=>$e?.getWorkbook().getSelectedRanges(),getRange:t=>$e?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>$e,getLicenseManager:()=>L.LicenseManager,moreExamples:()=>{console.table({"SheetXL.getRange('Sheet1!e5:f6').setValues([[110, 220], [210, 220]])":{Summary:"Set an array of values."},"SheetXL.getRange('a1:e5').setValue(100)":{Summary:"Set a single repeating value to a range."},"SheetXL.getRange('Sheet1!e5:f6').getValues()":{Summary:"Get the values as a 2d array (see forEach)."},"SheetXL.getSelectedRange().setValue(new Date())":{Summary:"Set current date/time using Javascript Date."},"SheetXL.getSelectedRange().setValue('10/23/95')":{Summary:"Set current date/time using string."},"SheetXL.getSelectedSheet().getUsedRange().getValues()":{Summary:"Get all of the values in a sheet."},"SheetXL.getSelectedRange().getStyle().update({ fill: 'accent4' })":{Summary:"Set fill to theme color 4."},"SheetXL.getRange('E:L').getStyle().update({ fill: 'accent1 lumMod 90 lumOff 40' })":{Summary:"Set some columns to a modified theme color."},"SheetXL.getRange('e5:f10').getStyle().update({ style: { border: 'double blue' }})":{Summary:"Set border."},"SheetXL.getCell().getStyle().fill.toCSS()":{Summary:"Get the fill style as css for the selected cell."},"SheetXL.getRange('a1:a3').autoFill('a1:a7')":{Summary:"Autofill down."},"SheetXL.getRange('e7:i9').merge({ orientation: 'rows' })":{Summary:"Merge cells horizontally."},"SheetXL.getSelectedRange().sort({ ascending: false, hasHeader: false })":{Summary:"Sort selected cells ascending with a header."},"SheetXL.getSelectedRange().clear('all')":{Summary:"Clear the current range a different way."},"SheetXL.getSelectedSheet().getTables().add('b2:e9')":{Summary:"Create a 4x8 table at b2 for current sheet."},"SheetXL.getRange('a1:c3').copyFrom('e1:g3')":{Summary:"Copy cells."},"SheetXL.getRange('c:t').getColumnHeaders().setSize(30)":{Summary:"Set the size of columns to 30 pixels."},"SheetXL.getRange('2:3').delete()":{Summary:"Remove rows 2 and 3 and shift up."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg')":{Summary:"Add an image."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg', { bounds: { height: 100 } })":{Summary:"Add an image of height 100."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue(1.50).getStyle().update({ numberFormat: '0%' }).autoFit(); }, 'Enter 150%')":{Summary:"Set value to 100 and numberformat to 0% as a single."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue('Remind Me Later').getStyle().update({ namedStyle: 'Note'}).autoFit(); }, 'Set Reminder')":{Summary:"Set a value and style to Note style and autofit text."},"SheetXL.getSelectedWorkbook().getNames().addReference('Small_Range', 'A2:E5');":{Summary:"Add a named range."},"SheetXL.getSelectedWorkbook().getRange('a1:e5').addListener((e) => { console.log('got an update for:', e.getSource().toString()) })":{Summary:"Listen for updates at a range."}})}}))}catch(o){o instanceof DOMException||console.error(o),Vt=!0}if($e!==a&&($e=a,!Vt))try{Vt=!0,(top??window).SheetXL&&(await L.LicenseManager._validate(!0),L.LicenseManager.wasPrinted()&&(()=>{ve.CommonUtils.consoleWithNoSource(`%cTip: You can access the API directly in the console.
|
|
10
|
+
Try
|
|
11
|
+
%c>%c SheetXL.getRange('b2:c3').setValues([[42, 'Hello Word'], [new Date(), true]]) %c
|
|
12
|
+
>%c SheetXL.moreExamples()`,"color:#ffa726;","font-family:monospace;color:#1976d2;font-size:12px;","font-family:monospace;","font-family:monospace;color:#1976d2;font-size:12px;","font-family:monospace;"),Vt=!0;const o=document.getElementById("openEditorLink");o&&o.addEventListener("click",t=>{t.preventDefault(),console.log("openScriptEditor called from console")})})())}catch(o){o instanceof DOMException||console.error(o)}}};function Jt(){return Jt=Object.assign?Object.assign.bind():function(a){for(var l=1;l<arguments.length;l++){var o=arguments[l];for(var t in o)({}).hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},Jt.apply(null,arguments)}function en(a,l){if(a==null)return{};var o={};for(var t in a)if({}.hasOwnProperty.call(a,t)){if(l.indexOf(t)!==-1)continue;o[t]=a[t]}return o}function eo(a,l){return eo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,t){return o.__proto__=t,o},eo(a,l)}function sr(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,eo(a,l)}function Yn(a,l){return a.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const Zn=!1,cr=n.createContext(null);var dr=function(a){return a.scrollTop},Pt="unmounted",Ye="exited",Ze="entering",lt="entered",Ro="exiting",ze=(function(a){function l(t,r){var s;s=a.call(this,t,r)||this;var c,h=r&&!r.isMounting?t.enter:t.appear;return s.appearStatus=null,t.in?h?(c=Ye,s.appearStatus=Ze):c=lt:c=t.unmountOnExit||t.mountOnEnter?Pt:Ye,s.state={status:c},s.nextCallback=null,s}sr(l,a),l.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Pt?{status:Ye}:null};var o=l.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==Ze&&s!==lt&&(r=Ze):s!==Ze&&s!==lt||(r=Ro)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t,r,s,c=this.props.timeout;return t=r=s=c,c!=null&&typeof c!="number"&&(t=c.exit,r=c.enter,s=c.appear!==void 0?c.appear:r),{exit:t,enter:r,appear:s}},o.updateStatus=function(t,r){if(t===void 0&&(t=!1),r!==null)if(this.cancelNextCallback(),r===Ze){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:et.findDOMNode(this);s&&dr(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ye&&this.setState({status:Pt})},o.performEnter=function(t){var r=this,s=this.props.enter,c=this.context?this.context.isMounting:t,h=this.props.nodeRef?[c]:[et.findDOMNode(this),c],i=h[0],u=h[1],g=this.getTimeouts(),b=c?g.appear:g.enter;!t&&!s||Zn?this.safeSetState({status:lt},function(){r.props.onEntered(i)}):(this.props.onEnter(i,u),this.safeSetState({status:Ze},function(){r.props.onEntering(i,u),r.onTransitionEnd(b,function(){r.safeSetState({status:lt},function(){r.props.onEntered(i,u)})})}))},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts(),c=this.props.nodeRef?void 0:et.findDOMNode(this);r&&!Zn?(this.props.onExit(c),this.safeSetState({status:Ro},function(){t.props.onExiting(c),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:Ye},function(){t.props.onExited(c)})})})):this.safeSetState({status:Ye},function(){t.props.onExited(c)})},o.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(c){s&&(s=!1,r.nextCallback=null,t(c))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=this.props.nodeRef?this.props.nodeRef.current:et.findDOMNode(this),c=t==null&&!this.props.addEndListener;if(s&&!c){if(this.props.addEndListener){var h=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],i=h[0],u=h[1];this.props.addEndListener(i,u)}t!=null&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Pt)return null;var r=this.props,s=r.children;r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef;var c=en(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n.createElement(cr.Provider,{value:null},typeof s=="function"?s(t,c):n.cloneElement(n.Children.only(s),c))},l})(n.Component);function ot(){}ze.contextType=cr,ze.propTypes={},ze.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ot,onEntering:ot,onEntered:ot,onExit:ot,onExiting:ot,onExited:ot},ze.UNMOUNTED=Pt,ze.EXITED=Ye,ze.ENTERING=Ze,ze.ENTERED=lt,ze.EXITING=Ro;var xo=function(a,l){return a&&l&&l.split(" ").forEach(function(o){return r=o,void((t=a).classList?t.classList.remove(r):typeof t.className=="string"?t.className=Yn(t.className,r):t.setAttribute("class",Yn(t.className&&t.className.baseVal||"",r)));var t,r})},Po=(function(a){function l(){for(var t,r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];return(t=a.call.apply(a,[this].concat(s))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(h,i){var u=t.resolveArguments(h,i),g=u[0],b=u[1];t.removeClasses(g,"exit"),t.addClass(g,b?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(h,i)},t.onEntering=function(h,i){var u=t.resolveArguments(h,i),g=u[0],b=u[1]?"appear":"enter";t.addClass(g,b,"active"),t.props.onEntering&&t.props.onEntering(h,i)},t.onEntered=function(h,i){var u=t.resolveArguments(h,i),g=u[0],b=u[1]?"appear":"enter";t.removeClasses(g,b),t.addClass(g,b,"done"),t.props.onEntered&&t.props.onEntered(h,i)},t.onExit=function(h){var i=t.resolveArguments(h)[0];t.removeClasses(i,"appear"),t.removeClasses(i,"enter"),t.addClass(i,"exit","base"),t.props.onExit&&t.props.onExit(h)},t.onExiting=function(h){var i=t.resolveArguments(h)[0];t.addClass(i,"exit","active"),t.props.onExiting&&t.props.onExiting(h)},t.onExited=function(h){var i=t.resolveArguments(h)[0];t.removeClasses(i,"exit"),t.addClass(i,"exit","done"),t.props.onExited&&t.props.onExited(h)},t.resolveArguments=function(h,i){return t.props.nodeRef?[t.props.nodeRef.current,h]:[h,i]},t.getClassNames=function(h){var i=t.props.classNames,u=typeof i=="string",g=u?(u&&i?i+"-":"")+h:i[h];return{baseClassName:g,activeClassName:u?g+"-active":i[h+"Active"],doneClassName:u?g+"-done":i[h+"Done"]}},t}sr(l,a);var o=l.prototype;return o.addClass=function(t,r,s){var c=this.getClassNames(r)[s+"ClassName"],h=this.getClassNames("enter").doneClassName;r==="appear"&&s==="done"&&h&&(c+=" "+h),s==="active"&&t&&dr(t),c&&(this.appliedClasses[r][s]=c,(function(i,u){i&&u&&u.split(" ").forEach(function(g){return p=g,void((b=i).classList?b.classList.add(p):(function(d,m){return d.classList?!!m&&d.classList.contains(m):(" "+(d.className.baseVal||d.className)+" ").indexOf(" "+m+" ")!==-1})(b,p)||(typeof b.className=="string"?b.className=b.className+" "+p:b.setAttribute("class",(b.className&&b.className.baseVal||"")+" "+p)));var b,p})})(t,c))},o.removeClasses=function(t,r){var s=this.appliedClasses[r],c=s.base,h=s.active,i=s.done;this.appliedClasses[r]={},c&&xo(t,c),h&&xo(t,h),i&&xo(t,i)},o.render=function(){var t=this.props;t.classNames;var r=en(t,["classNames"]);return n.createElement(ze,Jt({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},l})(n.Component);Po.defaultProps={classNames:""},Po.propTypes={};const bo=.12,Mo=(a,l)=>{const o={},t=i=>{const u=i.palette?.background.default??"rgba(255,255,255,1)";return{text:{fontFamily:i.typography?.fontFamily??"Calibri",fontSize:i.typography?.fontSize??8.25,fontWeight:i.typography?.fontWeightRegular??"400",fill:i.palette.mode==="dark"?i.palette?.text?.secondary:i.palette?.text?.primary},fill:u,strokeFill:y.elevateColor(u,bo,i.palette?.mode),darkMode:i.palette.mode==="dark"}},r=t(l);o.body=t(a),o.header={...o.body,strokeFill:y.elevateColor(o.body.fill,bo,a.palette?.mode),fill:l&&a.palette.mode==="dark"&&l.palette.mode!==a.palette.mode?o.body.fill:y.elevateColor(o.body.fill,.055,a.palette?.mode),edgeStrokeFill:a.palette.mode==="dark"?o.body.strokeFill:y.elevateColor(o.body.fill,.328,a.palette?.mode)},o.headerHover=i=>({...o.header,strokeFill:y.elevateColor(i?.fill??o.body.fill,.22,a.palette?.mode),fill:y.elevateColor(i?.fill??o.header.fill,.065,a.palette?.mode),text:{...i?.text,fontWeight:a.typography?.fontWeightBold}});const s=y.elevateColor(a.palette.mode!=="dark"?a.palette.primary.light:a.palette.primary.main,.055,a.palette?.mode);o.headerSelect={...o.header,strokeFill:a.palette.primary.main,fill:Pe.alpha(s,.2),text:{...o.header.text,fill:a.palette.primary.main},dividerStrokeFill:Pe.alpha(s,.7)},o.headerSelectAll={...o.headerSelect,fill:Pe.alpha(s,.9),text:{...o.headerSelect.text,fill:a.palette.primary.contrastText},edgeStrokeFill:o.headerSelect.strokeFill},o.buttonSurface={...r,strokeFill:y.elevateColor(r.fill,bo,l.palette?.mode),fill:l&&l.palette.mode==="dark"&&l.palette.mode!==a.palette.mode?r.fill:y.elevateColor(r.fill,.055,l.palette?.mode),edgeStrokeFill:l.palette.mode==="dark"?r.strokeFill:y.elevateColor(r.fill,.328,l.palette?.mode)},o.headerSelection={fill:a.palette?.primary?.main?Pe.alpha(a.palette?.primary?.main,.1):void 0,strokeFill:a.palette?.primary?.main},o.headerSelectionInactive={...o.headerSelection,fill:a.palette?.divider?Pe.alpha(a.palette?.divider,.05):void 0,strokeFill:"transparent"};const c=l??a,h=c.palette.mode==="dark";return o.selection={fill:c.palette?.primary?.main?Pe.alpha(c.palette?.primary?.main,.1):void 0,strokeFill:c.palette?.primary?.main},o.selectionInactive={...o.selection,fill:c.palette?.divider?Pe.alpha(c.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Pe.alpha(c.palette.warning.light,.05),strokeFill:c.palette.warning.dark},l&&(o.body=t(l)),o.colorShadow=Pe.alpha(c.palette.action.active,.5),o.colorGrey=c.palette.action.active,o.filterDarkInvert=h?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},oi="_sheetxl-theme_4opcr_2",Dt=n.memo(n.forwardRef((a,l)=>{const{children:o,sx:t,parentFloat:r,...s}=a,c=k.useImperativeElement(l,()=>({}),[]),[h,i]=_e(),u=n.useRef(null),g=n.useRef(null),[b,p]=n.useReducer(v=>v+1,0),[d,m]=n.useState(null),[S,C]=n.useState(null),[f,x]=n.useState(null),{reference:w}=y.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{g.current={refs:[]};const v=[],E=n.Children.toArray(o);let P=0;E.forEach((B,R)=>{v.push(e.jsx(T.Box,{sx:{display:"flex"},ref:D=>{P++,P===E.length&&p();const F={current:null};F.current=D,g.current.refs[R]=F},children:B},R))}),m(v)},[o,i]),n.useLayoutEffect(()=>{if(!d)return;const v=g.current.refs,E=v?v.length:0;if(!c.current||E===0)return C(null),void x(null);const P=c.current?.getBoundingClientRect(),B=[],R=[];let D=0,F=!1;for(let N=0;!F&&N<E;N++){const z=v[N];if(!z)continue;if(!z.current){F=!0;continue}const I=z.current.getBoundingClientRect();D+=I?.width,D>P.width&&(F=!0)}if(!F)return C(null),void x([]);const M=u.current?.getBoundingClientRect();D=0;for(let N=0;N<E;N++){const z=v[N];let I=!1;if(z.current){const A=z.current.getBoundingClientRect();D+=A?.width,D<P.width-M.width&&(I=!0)}I?B.push(d[N]):R.push(d[N])}C(B.length>0?B:null),x(R.length>0?R:null)},[o,d,i,w,b]);const j=k.useCallbackRef(v=>{const E=[],P=f.length;for(let R=0;R<P;R++){const D=n.Children.toArray(f[R])[0];n.Children.toArray(D.props.children?.props?.children??D.props.children).forEach((F,M)=>{const N=F,z={...N.props,key:`overflow-${R}-${M}${N.key??""}`};z.parentFloat&&v&&(z.parentFloat=v.floatReference);const I=n.cloneElement(N,z);E.push(I)})}const B=e.jsx(T.Box,{className:"overflow-palette-popup-panel",sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:R=>R.spacing(.25),paddingTop:R=>R.spacing(.5),paddingBottom:R=>R.spacing(.5),paddingLeft:R=>R.spacing(1),paddingRight:R=>R.spacing(1),overflow:"hidden"},children:E});return y.defaultCreatePopupPanel({...v,children:B})},[f]);return e.jsxs(T.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:Ke([c,h,l]),...s,children:[e.jsx(T.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:S??d}),e.jsx(T.Box,{className:"overflow-palette-popup-button",sx:{display:f!==null&&f.length===0?"none":"flex",flex:"1 1 0"},children:e.jsx(y.ExhibitPopupIconButton,{createPopupPanel:j,ref:u,parentFloat:w,createTooltip:({children:v},E)=>e.jsx(y.ExhibitTooltip,{label:"More",description:"More toolbar options…",disabled:E,children:v}),icon:e.jsx(k.DynamicIcon,{iconKey:"MoreHorizontal"})})})]})})),ur="https://unpkg.com/@sheetxl/scripting-templates/dist",ni=a=>{if(a.metadata?.name)return a.metadata.name;let l=(a.path.split("/").pop()||"").replace(/\.[^/.]+$/,"");return a.metadata?.icon==="formula"?l.toUpperCase():(l=l.replace(/([a-z])([A-Z])/g,"$1 $2"),l.replace(/[-_]/g," ").trim().split(/\s+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "))},mr=async a=>{const l=st.IOUtils.relativePath(a,"./manifest.json"),o=await fetch(l);if(!o.ok)throw new ve.ChainedError(`Failed to retrieve directory at '${a}': ${o.statusText}`);const t=await o.text();if(t.trim().toLowerCase().startsWith("<!doctype html")||t.trim().toLowerCase().startsWith("<html"))throw new ve.ChainedError(`Failed to retrieve directory at '${a}'`);let r;try{r=JSON.parse(t)}catch(c){throw new Error(`Failed to parse directory: ${c.message}. Ensure the file is valid JSON.`)}const s=r.map(async c=>{try{const h=st.IOUtils.relativePath(a,c.path),i=await fetch(h);if(!i.ok)throw new Error(`Failed to fetch file at '${c.path}': ${i.statusText}`);const u=await i.text();let g=c.metadata;return g?.title||(g={title:ni(c),...g}),{path:c.path,content:u,metadata:g}}catch(h){console.error(h.message)}return null});return(await Promise.all(s)).filter(c=>c!==null)},yo={marginRight:"4px"},Co="1em",ai=n.memo(a=>{const{disabled:l,snippet:o,description:t,handleInsert:r,sx:s,...c}=a;let h;const i=o.metadata?.icon;return h=i==="formula"?e.jsx(k.DynamicIcon,{iconKey:"ScriptFormula",size:Co,style:yo}):i==="macro"?e.jsx(k.DynamicIcon,{iconKey:"ScriptMacro",size:Co,style:yo}):e.jsx(k.DynamicIcon,{iconKey:"ScriptAutoStart",size:Co,style:yo}),e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"460px",display:"flex","*":{lineHeight:"1.2"},...s},disabled:l,icon:h,onMouseDown:u=>{u.button===0&&u.preventDefault()},onMouseUp:u=>{u.button===0&&r(o)},onKeyDown:u=>{u.keyCode!==k.KeyCodes.Enter&&u.keyCode!==k.KeyCodes.Space||r(o)},...c,children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsx(T.Typography,{component:"div",children:o.metadata?.title??o.path}),e.jsx(T.Typography,{variant:"caption",component:"div",sx:{color:u=>Pe.alpha(u.palette.text.secondary??u.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),ri=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:c=ur,...h}=a,[i,u]=n.useState([]),[g,b]=n.useState(!0),p=k.useCommands(o,["executeSelectedScript"]),d=p[0]?.context?.();n.useEffect(()=>{(async()=>{try{const S=await mr(c);u(S)}catch{}finally{b(!1)}})()},[c]);const m=n.useCallback((S,C)=>{if(g)return e.jsx("div",{children:"Loading..."});const f={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},x=v=>{d.getEditor()?.insertSnippet(v.content),S.closeFloat()},w=[];for(let v=0;v<i.length;v++){const E=i[v];E&&w.push(e.jsx(ai,{handleInsert:x,snippet:E},E.path))}const j=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[w.length>0?e.jsxs(e.Fragment,{children:[e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:w}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...f,key:"help",command:o.getCommand("help")})]});return y.defaultCreatePopupPanel({...S,children:j})},[s,t,r,g,d]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,disabled:s,commandHook:t,scope:r,label:"Insert Script",tooltip:"Inserts a script from a set of templates.",createPopupPanel:m,icon:"ScriptInsert",...h})})),pr=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,c=k.useCallbackRef(h=>{const{commandButtonProps:i,commandPopupProps:u}=h;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(Dt,{parentFloat:t,style:{},children:e.jsx(y.CommandButton,{...i,command:o?.getCommand("saveScripts")})})}),e.jsx("div",{style:{flex:"1 1 100%"}}),e.jsx("div",{children:e.jsx(Dt,{parentFloat:t,style:{},children:e.jsx(ri,{...i,commands:o})})})]})})},[o]);return e.jsx(y.CommandToolbar,{ref:l,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:c,...s})}));pr.displayName="ScriptEditorToolbar";const fr=n.memo(n.forwardRef((a,l)=>{const{scriptPath:o=ur,onScriptSelect:t,sx:r=k.ReactUtils.EmptyCssProperties,className:s,buttonMinWidth:c=210,buttonMinHeight:h=80,gap:i=12,...u}=a,[g,b]=n.useState([]),[p,d]=n.useState(!0),[m,S]=n.useState(null);if(n.useEffect(()=>{(async()=>{const x=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{d(!0),S(null);const w=await mr(o);for(let j=0;j<w.length;j++){const v=w[j];v&&x.push(v)}}catch(w){S(w instanceof Error?w.message:"Failed to load scripts"),w instanceof ve.ChainedError||console.error("Error loading scripts:",w)}finally{b(x),d(!1)}})()},[o]),p)return e.jsx(T.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:de(s,"script-select"),sx:{background:x=>x.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...r},...u,children:e.jsx(T.CircularProgress,{})});let C=null;m&&(C=e.jsxs(T.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:de(s,"script-select","error-results"),sx:{background:x=>x.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:x=>x.spacing(1),border:x=>`1px solid ${x.palette.error.main}`,borderBottomLeftRadius:1,borderBottomRightRadius:1,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},...u,children:[e.jsx(T.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(T.Typography,{color:"error",component:"div",children:m})]}));const f=x=>{const w=x.metadata?.icon;return w==="macro"?e.jsx(k.DynamicIcon,{iconKey:"ScriptMacro",size:"1em"}):w==="formula"?e.jsx(k.DynamicIcon,{iconKey:"ScriptFormula",size:"1em"}):w==="autostart"?e.jsx(k.DynamicIcon,{iconKey:"ScriptAutoStart",size:"1em"}):null};return e.jsxs(T.Box,{ref:l,className:de(s,"script-select"),sx:{background:x=>x.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...r},...u,children:[e.jsxs(T.Box,{p:3,className:"script-select-content",sx:{overflow:"auto",flex:"1 1 auto"},children:[e.jsx(T.Typography,{variant:"h6",gutterBottom:!0,children:"Script Template"}),e.jsx(T.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Choose from a template to provide a starting point to automate tasks or create user defined functions."}),e.jsx(T.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Templates provide a foundation to customize and meet your specific needs."}),e.jsx(T.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${c}px, 1fr))`,gap:`${i}px`,padding:2,paddingLeft:"0px",paddingRight:"0px"},children:g.map((x,w)=>e.jsxs(T.Button,{variant:"outlined",sx:{minWidth:c,minHeight:h,display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",textAlign:"left",padding:2,textTransform:"none",overflow:"hidden",...w===0&&{borderStyle:"dashed",marginBottom:"8px"},...w===1&&{gridColumn:"1"}},onClick:()=>t?.(x),children:[e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(T.Typography,{variant:"subtitle2",component:"div",children:x.metadata?.title||x.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),f(x)]}),x.metadata?.summary&&e.jsx(T.Typography,{variant:"body2",component:"div",color:"text.secondary",sx:{overflow:"hidden",display:"flex",flexDirection:"column",textOverflow:"ellipsis",alignItems:"flex-start"},children:x.metadata.summary})]},`${x.path}-${w}`))})]}),C]})}));fr.displayName="TemplateSelectPanel";const hr=n.memo(n.forwardRef((a,l)=>{const{className:o,sx:t,editorProps:r,commands:s,readOnly:c=!1,frame:h,autoFocusSel:i,autoFocus:u=!0,scripts:g,...b}=a,p=G.useTheme(),[d,m]=n.useState(!1),S=n.useRef(!1),[C,f]=n.useState({message:"Loading",cursor:"",dirty:!1}),[x,w]=n.useState(null);n.useEffect(()=>{let A=!1;return w(null),(async function(){if(g&&(await g.start(),!A)){const O=g.getModules().getItems()[0]?.getSource();w({source:O||null})}})(),()=>{A=!0}},[g]);const j=n.useCallback(A=>{f(O=>({...O,...A}))},[]),v=n.useRef(null),[E,P]=n.useState(null),B=n.useRef(null),R=k.useCallbackRef(A=>{if(E)return E.focus(A),!0;if(i){const O=v.current?.querySelectorAll?.(i);if(O&&O.length>0)return O[0]?.focus?.(A),!0}return v.current?.focus?.(A),!1},[E,i,u]),D=n.useMemo(()=>e.jsx(y.AnimatedLoadingPanel,{transitionDelay:"160ms",style:{position:"absolute",width:"100%",height:"100%"},transparentBackground:!1}),[]),F=n.useMemo(()=>e.jsx(T.Paper,{elevation:1,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,marginLeft:A=>A.spacing(.5),marginRight:A=>A.spacing(.5),marginTop:A=>A.spacing(1),marginBottom:A=>A.spacing(1)},children:e.jsx(pr,{commands:s})}),[p,s]),M=n.useMemo(()=>e.jsx(T.Box,{className:de("script-status-panel","status-panel"),sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",margin:0,borderTop:`solid 1px ${p.palette.divider}`},children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"center",flexDirection:"row",justifyContent:"center"},children:[e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"1 1 100%",color:A=>A.palette.text.secondary},variant:"caption",children:C.message}),e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",color:A=>A.palette.text.secondary},variant:"caption",children:C.dirty?"Unsaved":""}),e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",marginLeft:"8px",minWidth:"90px",display:"flex",justifyContent:"end",color:A=>A.palette.text.secondary},variant:"caption",children:C.cursor})]})}),[C]),N=n.useMemo(()=>e.jsxs(T.Box,{className:de("script-editor-content"),sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"column",boxSizing:"border-box"},children:[F,e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"row",position:"relative",boxSizing:"border-box"},children:e.jsx(ne.ScriptEditor,{ref:v,loadingPanel:D,readOnly:c,frame:h,autoFocus:u,commands:s,onStatusChange:j,darkMode:p.palette.mode==="dark",...r})}),M]}),[p,s,F,M,d,D,c,r,u,i,h,j]),z=n.useMemo(()=>{let A;return x===null?null:(x.source===null&&(A=e.jsx(fr,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:O=>{v.current?.getEditor()?.insertSnippet(O.content),w({source:O.content??""})}})),e.jsx(T.Box,{tabIndex:0,className:de("script-workspace",o),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none"},onPointerDown:O=>{O.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(T.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[N,A]})}))},[F,N,o,x]),I=k.useImperativeElement(l,()=>({isScriptWorkspaceElement:()=>!0,focus:A=>{R(A)}}),[]);return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:I,...b,onFocus:A=>{m(!0),S.current=!0,I.current?.contains(A.target)&&A.target!==I.current&&P(A.target),A.relatedTarget&&!B.current&&(B.current=A.relatedTarget),b?.onFocus?.(A)},onBlur:A=>{I?.current?.contains(A.relatedTarget)||I?.current===A.relatedTarget||(B.current=null,S.current=!1,m(!1)),b?.onBlur?.(A)},children:z})}));hr.displayName="ScriptWorkspace";const li=(a,l)=>{const{model:o,commands:t,entryKey:r,frame:s,...c}=a;return e.jsx(hr,{ref:l,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...c})},gr=n.memo(n.forwardRef((a,l)=>{const{commands:o,...t}=a,r=k.useCommands(o,["executeScript","showScriptEditor"]),[s,c]=n.useState([]),[h,i]=n.useState(!1),u=r[0]?.context?.();n.useEffect(()=>{const m=u?.getScripts();m&&(async()=>{i(!0);const S=await m.searchFunctions({type:"macro"});c(S),i(!1)})()},[]);const g={variant:k.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},b=[],p=s.length;for(let m=0;m<p;m++){const S=s[m];b.push(e.jsx(y.CommandButton,{...g,command:o.getCommand("executeScript"),commandState:{declaration:S},tooltipProps:{description:`Execute ${S.getName()??"macro"}`},icon:e.jsx(k.DynamicIcon,{iconKey:"ScriptMacro"}),label:S.getName()??`Script '${S.getName()}'`},`macro-${S.getName()}-${m}`))}const d=e.jsxs(T.Box,{ref:l,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[b.length>0?e.jsxs(e.Fragment,{children:[e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...g,key:"show-editor",command:o.getCommand("showScriptEditor")})]});return y.defaultCreatePopupPanel({...t,children:d})}));gr.displayName="RunScriptPopupPanel";const xr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h="showScriptEditor",i=k.useCommands(o,["executeScript","showScriptEditor"])[0].context(),u=n.useCallback((g,b)=>{const p=e.jsx(gr,{...g,commands:b});return y.defaultCreatePopupPanel({...g,children:p})},[s,i,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,createPopupPanel:u,selected:o.getCommand(h).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:h,...c})})),ii=a=>e.jsx(y.CommandButton,{...a}),br=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,[c,h]=n.useState(!1),i=k.useCommands(o,["executeScript","showScriptEditor"]),u=i[0]?.context?.();n.useEffect(()=>{const p=u?.getScripts();if(!p)return;const d=i[1],m=async()=>{if(!d)return;let f=!1;if(!d.state()){const x=await p.searchFunctions({type:"macro"}),w=x?.length??0;for(let j=0;x&&!f&&j<w;j++)f=!0}h(f||!!d.state())};m();const S=d.addPropertyListener(()=>{m()}),C=p.addListeners({onChange:()=>{m()}});return()=>{C(),S()}},[u]);const g=ne.useTaskPaneArea(),b=n.useCallback(p=>{const{commandButtonProps:d,commandPopupProps:m}=p,S=ne.DefaultTaskPaneRegistry.findContributions("ribbon/home");let C;const f=S.length;if(f>0){C=[];for(let P=0;P<f;P++){const B=S[P],R=B.createCommand?.(g);if(!R)continue;const D={command:R,...m},F=(B.createCommandButton??ii)(D);C.push(F)}}const x=e.jsx(pt,{...m,command:o.getCommand("formatFontColor"),isSplit:!0,panelProps:{disableAlpha:!0}}),w=e.jsx(pt,{...m,command:o.getCommand("formatFillColor"),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:ut.End}}),j=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(Ho,{...m,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Fa,{...m})}):null;let E=null;return c&&(E=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{}),e.jsx(xr,{...m})]})),e.jsxs(Dt,{parentFloat:t,children:[j,null,j?e.jsx(y.ExhibitDivider,{}):null,e.jsx(Wo,{...m,command:o.getCommand("paste")}),e.jsx(y.CommandButton,{...d,command:o.getCommand("formatPainterToggle")}),e.jsx(ro,{...d,command:o.getCommand("copy")}),e.jsx(y.ExhibitDivider,{}),e.jsx(za,{...m,command:o.getCommand("formatFontFamily")}),e.jsx(Ia,{...m,command:o.getCommand("formatFontSize")}),e.jsx(y.CommandButton,{...d,command:o.getCommand("formatBoldToggle")}),e.jsx(y.CommandButton,{...d,command:o.getCommand("formatItalicToggle")}),e.jsx(Wa,{...m}),e.jsx(Ha,{...m}),e.jsx(Pa,{...m}),w,x,e.jsx(y.ExhibitDivider,{}),e.jsx(Sa,{...m}),e.jsx(wa,{...m}),e.jsx(va,{...m}),e.jsx(ka,{...m}),e.jsx(Ma,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(Na,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ka,{command:o.getCommand("formatCellStyle"),...m}),e.jsx(ln,{command:o.getCommand("formatTableStyle"),...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(Oo,{...m}),e.jsx(Ao,{...m}),e.jsx(Lo,{...m}),e.jsx(y.ExhibitDivider,{}),e.jsx(cn,{...m}),e.jsx(Oa,{...m}),e.jsx(No,{...m}),e.jsx(zo,{...m}),v,E,C]})},[o,i,c,g]);return e.jsx(y.CommandToolbar,{ref:l,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:b,...s})}));br.displayName="HomeToolbar";const yr=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,c=k.useCallbackRef(h=>{const{commandButtonProps:i,commandPopupProps:u}=h;return e.jsxs(Dt,{parentFloat:t,children:[e.jsx(y.CommandButton,{...i,command:o.getCommand("insertTable")}),e.jsx(sn,{...u}),null,e.jsx(y.CommandButton,{...i,command:o.getCommand("updateHyperlink")}),e.jsx(y.CommandButton,{...i,command:o.getCommand("updateComments")})]})},[o]);return e.jsx(y.CommandToolbar,{ref:l,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:c,...s})}));yr.displayName="InsertToolbar";const Cr=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,c=k.useCallbackRef(h=>{const{commandButtonProps:i,commandPopupProps:u}=h;return e.jsxs(Dt,{parentFloat:t,children:[e.jsx(Da,{...u}),e.jsx(y.CommandButton,{...i,command:o.getCommand("protectionSheetToggle")}),e.jsx(y.ExhibitDivider,{}),e.jsx(Aa,{...u}),e.jsx($a,{...u}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...i,command:o.getCommand("sheetViewToggleFormulaView"),scope:"view"}),e.jsx(y.CommandButton,{...i,command:o.getCommand("sheetViewToggleShowZeros"),scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(Va,{...u}),e.jsx(Br,{command:o.getCommand("selectTheme"),...u}),e.jsx(y.ExhibitDivider,{}),e.jsx(xr,{...u,scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...i,command:o.getCommand("fullScreenToggle"),scope:"view"})]})},[o]);return e.jsx(y.CommandToolbar,{ref:l,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:c,...s})}));Cr.displayName="ViewToolbar";const Sr=a=>e.jsx(wr,{...a}),si=n.memo(a=>{const{sx:l,...o}=a;return e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",position:"relative","&:hover:not([disabled]) .indicator":{borderBottom:t=>`${G.alpha(t.palette.primary.main,.35)} solid 2px`}},children:[e.jsx(T.Tab,{disableRipple:!0,onMouseDown:t=>{t.button===0&&t.preventDefault()},sx:{textTransform:"none",flex:"1 1 100%",fontWeight:t=>t.typography.fontWeightRegular,padding:"2px 6px",minHeight:"0px",minWidth:"0px",marginRight:t=>t.spacing(.5),"&.Mui-selected":{},"&.Mui-focusVisible":{},...l},...o}),e.jsx(T.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),ci=n.memo(a=>{const{toolbars:l,value:o,onToolbarChange:t,sx:r,...s}=a,c=n.useMemo(()=>{const h=[];for(let i=0;i<l.length;i++)h.push(e.jsx(si,{label:l[i].label},l[i].label));return h},[l]);return e.jsx(T.Tabs,{value:o,onChange:(h,i)=>{t?.(i)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:h=>h.spacing(1.5),paddingRight:h=>h.spacing(1.5),paddingTop:h=>h.spacing(0),paddingBottom:h=>h.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:h=>h.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...r},slotProps:{indicator:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})}},...s,children:c})}),di=n.memo(a=>{const{toolbars:l,value:o,onToolbarChange:t,selectProps:r,...s}=a,c=n.useCallback(i=>{t?.(i.target.value)},[t]),h=n.useMemo(()=>{const i=[];for(let u=0;u<l.length;u++){const g=l[u].label;i.push(e.jsx(T.MenuItem,{value:u,sx:{color:b=>{if(o===u)return b.palette.primary.main}},children:g},g))}return i},[l,o]);return e.jsx(T.FormControl,{sx:{minWidth:"125px",maxWidth:"125px","& .MuiInputBase-root":{paddingLeft:"0px",paddingRight:"0px"},"& .MuiSelect-select":{paddingTop:i=>i.spacing(.5),paddingBottom:i=>i.spacing(.5),paddingLeft:i=>i.spacing(2),color:i=>i.palette.primary.main},"& .MuiSelect-icon":{fill:i=>i.palette.text.icon??i.palette.action.active,"&:hover:not(.Mui-disabled)":{color:i=>i.palette.text.icon??i.palette.action.active}},...r},size:"small",children:e.jsx(T.Select,{value:o,onChange:c,variant:"outlined",sx:{backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},...s,children:h})})}),wr=n.memo(n.forwardRef((a,l)=>{const{commands:o,selectWrapper:t,selectProps:r={},renderCompact:s=!1,paletteWrapper:c,toolbarsProps:h,paletteProps:i={},workbook:u,sx:g,...b}=a,p=n.useMemo(()=>{const v=[],{ref:E,...P}=h?.Home||{};v.push({label:"Home",component:e.jsx(br,{commands:o,...P})});const{ref:B,...R}=h?.Insert||{};v.push({label:"Insert",component:e.jsx(yr,{commands:o,...R})});const{ref:D,...F}=h?.View||{};return v.push({label:"View",component:e.jsx(Cr,{commands:o,...F})}),v},[o,u]),d=n.useMemo(()=>{const v=[];for(let E=0;E<p.length;E++)v.push(n.cloneElement(p[E].component,{...p[E].component.props,key:p[E].key??p[E].label}));return v},[p]),[m,S]=n.useState(0),C=v=>{S(v)},f=n.useMemo(()=>s?e.jsx(di,{toolbars:p,value:m,onToolbarChange:C,sx:r}):e.jsx(ci,{toolbars:p,value:m,onToolbarChange:C,sx:r}),[p,m,r,s]),{sx:x,...w}=i,j=e.jsx(T.Paper,{elevation:2,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,borderRadius:"8px",backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,marginLeft:v=>v.spacing(1),marginRight:v=>v.spacing(1),marginTop:v=>v.spacing(.5),marginBottom:v=>v.spacing(.5),...x},...w,children:d[m]});return e.jsxs(T.Box,{ref:l,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:v=>v.spacing(.5),"*":{userSelect:"none"},...g},...b,children:[t?t(f):f,c?c(j):j]})}));var Qn,Jn;wr.displayName="WorkbookToolbars",(function(){if(Jn)return Qn;Jn=1;var a=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,t=/^0o[0-7]+$/i,r=parseInt,s=typeof ct=="object"&&ct&&ct.Object===Object&&ct,c=typeof self=="object"&&self&&self.Object===Object&&self,h=s||c||Function("return this")(),i=Object.prototype.toString,u=Math.max,g=Math.min,b=function(){return h.Date.now()};function p(m){var S=typeof m;return!!m&&(S=="object"||S=="function")}function d(m){if(typeof m=="number")return m;if((function(f){return typeof f=="symbol"||(function(x){return!!x&&typeof x=="object"})(f)&&i.call(f)=="[object Symbol]"})(m))return NaN;if(p(m)){var S=typeof m.valueOf=="function"?m.valueOf():m;m=p(S)?S+"":S}if(typeof m!="string")return m===0?m:+m;m=m.replace(a,"");var C=o.test(m);return C||t.test(m)?r(m.slice(2),C?2:8):l.test(m)?NaN:+m}Qn=function(m,S,C){var f,x,w,j,v,E,P=0,B=!1,R=!1,D=!0;if(typeof m!="function")throw new TypeError("Expected a function");function F(A){var O=f,W=x;return f=x=void 0,P=A,j=m.apply(W,O)}function M(A){var O=A-E;return E===void 0||O>=S||O<0||R&&A-P>=w}function N(){var A=b();if(M(A))return z(A);v=setTimeout(N,(function(O){var W=S-(O-E);return R?g(W,w-(O-P)):W})(A))}function z(A){return v=void 0,D&&f?F(A):(f=x=void 0,j)}function I(){var A=b(),O=M(A);if(f=arguments,x=this,E=A,O){if(v===void 0)return(function(W){return P=W,v=setTimeout(N,S),B?F(W):j})(E);if(R)return v=setTimeout(N,S),F(E)}return v===void 0&&(v=setTimeout(N,S)),j}return S=d(S)||0,p(C)&&(B=!!C.leading,w=(R="maxWait"in C)?u(d(C.maxWait)||0,S):w,D="trailing"in C?!!C.trailing:D),I.cancel=function(){v!==void 0&&clearTimeout(v),P=0,f=E=x=v=void 0},I.flush=function(){return v===void 0?j:z(b())},I}})();var ea,ta,oa={exports:{}},So={};ta||(ta=1,oa.exports=(function(){if(ea)return So;ea=1;var a=n,l=typeof Object.is=="function"?Object.is:function(i,u){return i===u&&(i!==0||1/i==1/u)||i!=i&&u!=u},o=a.useState,t=a.useEffect,r=a.useLayoutEffect,s=a.useDebugValue;function c(i){var u=i.getSnapshot;i=i.value;try{var g=u();return!l(i,g)}catch{return!0}}var h=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(i,u){return u()}:function(i,u){var g=u(),b=o({inst:{value:g,getSnapshot:u}}),p=b[0].inst,d=b[1];return r(function(){p.value=g,p.getSnapshot=u,c(p)&&d({inst:p})},[i,g,u]),t(function(){return c(p)&&d({inst:p}),i(function(){c(p)&&d({inst:p})})},[i]),s(g),g};return So.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:h,So})()),oa.exports;var na,aa,vt={exports:{}},it={exports:{}},ui=it.exports;(function(){if(aa)return vt.exports;aa=1;for(var a=(na||(na=1,function(){var b,p,d,m,S,C;typeof performance<"u"&&performance!==null&&performance.now?it.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(it.exports=function(){return(b()-S)/1e6},p=process.hrtime,m=(b=function(){var f;return 1e9*(f=p())[0]+f[1]})(),C=1e9*process.uptime(),S=m-C):Date.now?(it.exports=function(){return Date.now()-d},d=Date.now()):(it.exports=function(){return new Date().getTime()-d},d=new Date().getTime())}.call(ui)),it.exports),l=typeof window>"u"?ct:window,o=["moz","webkit"],t="AnimationFrame",r=l["request"+t],s=l["cancel"+t]||l["cancelRequest"+t],c=0;!r&&c<o.length;c++)r=l[o[c]+"Request"+t],s=l[o[c]+"Cancel"+t]||l[o[c]+"CancelRequest"+t];if(!r||!s){var h=0,i=0,u=[],g=1e3/60;r=function(b){if(u.length===0){var p=a(),d=Math.max(0,g-(p-h));h=d+p,setTimeout(function(){var m=u.slice(0);u.length=0;for(var S=0;S<m.length;S++)if(!m[S].cancelled)try{m[S].callback(h)}catch(C){setTimeout(function(){throw C},0)}},Math.round(d))}return u.push({handle:++i,callback:b,cancelled:!1}),i},s=function(b){for(var p=0;p<u.length;p++)u[p].handle===b&&(u[p].cancelled=!0)}}vt.exports=function(b){return r.call(l,b)},vt.exports.cancel=function(){s.apply(l,arguments)},vt.exports.polyfill=function(b){b||(b=l),b.requestAnimationFrame=r,b.cancelAnimationFrame=s},vt.exports})();var Ne={DOM_UNAVAILABLE_ERROR:"DOM is unavailable server-side. Please use this method client-side only.",FULLSCREEN_UNSUPPORTED_ERROR:"Your browser does not support Fullscreen API.",getEventsNames(){if(typeof document>"u")return null;const a=document;return"exitFullscreen"in a?["fullscreenchange","fullscreenerror"]:"webkitExitFullscreen"in a||"webkitCancelFullScreen"in a?["webkitfullscreenchange","webkitfullscreenerror"]:"mozCancelFullScreen"in a?["mozfullscreenchange","mozfullscreenerror"]:"msExitFullscreen"in a?["MSFullscreenChange","MSFullscreenError"]:null},getEventName(a){const l=this.getEventsNames();return l?a==="change"?l[0]:l[1]:null},get fullscreenEnabled(){if(typeof document>"u")return!1;const a=document;return a.fullscreenEnabled||a.webkitFullscreenEnabled||!!a.webkitCancelFullScreen||a.mozFullScreenEnabled||a.msFullscreenEnabled||!1},get fullscreenElement(){if(typeof document>"u")return null;const a=document;return a.fullscreenElement||a.webkitFullscreenElement||a.webkitCurrentFullScreenElement||a.mozFullScreenElement||a.msFullscreenElement||null},requestFullscreen(a,l){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const o=a??document.documentElement,t=o.requestFullscreen||o.webkitRequestFullscreen||o.webkitRequestFullScreen||o.mozRequestFullScreen||o.msRequestFullscreen;if(!t)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return t.call(o,l)},exitFullscreen(){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const a=document,l=a.exitFullscreen||a.webkitExitFullscreen||a.webkitCancelFullScreen||a.mozCancelFullScreen||a.msExitFullscreen;if(!l)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return l.call(a)},on(a,l){const o=this.getEventName(a);o&&document.addEventListener(o,l)},off(a,l){const o=this.getEventName(a);o&&document.removeEventListener(o,l)}};const kr=a=>{const{workbook:l,workbookElement:o,target:t,commands:r,darkMode:s}=a,c=k.useNotifier(),[h,i]=n.useState(l?.getSelectedSheet()),[u,g]=n.useState(l?.getSheets().getItems()),b=ne.useTaskPaneArea(),p=n.useMemo(()=>[new k.SimpleCommand("activateTask",t,{label:"Activate Task",description:"Activate Task Pane.",shortcut:{key:"F6"}}),new k.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.Command("newCellStyle",t,{label:"New Cell Style…",scopedLabels:{cellStyle:"New Cell Style"},description:"Create a new named style can can be quickly used later.",icon:"NewPresetStyles"}),new k.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new k.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new k.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",icon:"Find",shortcut:[{key:"F",modifiers:[k.KeyModifiers.Ctrl]},{key:"F5",modifiers:[k.KeyModifiers.Shift]}]}),new k.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",icon:"FindReplace",shortcut:[{key:"H",modifiers:[k.KeyModifiers.Ctrl]},{key:"H",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Alt]}]}),new k.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",icon:"GoTo",shortcut:[{key:"G",modifiers:[k.KeyModifiers.Ctrl]}]}),new k.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new k.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new k.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new k.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new k.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new k.Command("hideSheet",t,{label:"Hide Sheet",scopedLabels:{sheet:"Hide"},description:"Hide the sheet from appearing in the tabs. This keeps the data but de-clutters the tabs.",icon:"VisibilityOff"}),new k.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new k.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[k.KeyModifiers.Shift]},{key:"F1",modifiers:[k.KeyModifiers.Alt,k.KeyModifiers.Shift]}]}),new k.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new k.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[k.KeyModifiers.Ctrl]}]}),new k.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[k.KeyModifiers.Ctrl]}]}),new k.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}]}),new k.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}]}),new k.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new k.Command("selectNamed",t,{label:R=>R?.getName()??"Select Named Item",scopedLabels:{namedItem:R=>R?.getName()??"Select"},description:"Select the item."}),new k.Command("addNamedReference",t,{label:"Define Named Reference",scopedLabels:{namedItem:"Define Name…"},description:"Add a new named reference. Names can be used as a substitute for cell references.",icon:"InsertNamedRange"}),new k.Command("editNamedReference",t,{label:"Edit Named Reference…",scopedLabels:{namedItem:"Edit…"},description:"Add a new named reference. Names can be used as a substitute for cell references.",icon:"NamedRangeEdit"}),new k.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference.",icon:"DeleteNamedRange"}),new k.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[k.KeyModifiers.Alt]}}),new k.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Shift]}}),new k.SimpleCommand("activeNameManager",t,{label:"Activate Name Manager",description:`Create, edit, delete, and find all the names used in the workbook.
|
|
13
|
+
|
|
14
|
+
Names can be used as a substitute for cell references.`,shortcut:{key:"F3",modifiers:[k.KeyModifiers.Ctrl]}}),new k.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"},icon:"FullScreen"}),new k.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",icon:"ScriptRun",shortcut:[{key:"F11",modifiers:[k.KeyModifiers.Alt]}]}),new k.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new k.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new k.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts.",icon:"ScriptSave"}),new k.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[k.KeyModifiers.Ctrl]}}),new k.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new k.Command("calculateAll",t,{label:"Calculate Now",description:"Recalculate all formulas.",icon:"Calculate",shortcut:{key:"F9"}})],[]),d=n.useMemo(()=>{let R=null;return R=r?r.createChildGroup(t,"workbook",!1):new k.CommandGroup(t,"workbook"),R.addCommands(p,!0),R},[r,p]),m=k.useEditMode(),S=n.useRef(null),C=k.useCallbackRef(()=>{let R,D=null;const F=d.getCommand("executeScript");if(F.update({disabled:!1,context:{getScripts:()=>l.getScripts()}}),!F)return;const M=d.getCommand("showScriptEditor");M.updateCallback(function(I=!0){D?D.close():b.activateTaskPane("scriptEditor",{})});const N=d.getCommand("executeSelectedScript");if(!N)return;const z={saveSource:async I=>{let A=null,O=null;const W=l.getScripts();try{I&&(O=await c.showBusy("Saving Scripts..."),A=await W.createModule({source:I})),W.addModule("scripts",A,{replace:!0}),O?.()}catch(Z){O?.(),console.warn("Unable to compile",Z),c.showError(Z)}return A},addContainerListener:I=>(f.current=I,()=>{f.current=null}),setSelectedFunction:I=>{R=I??S.current??null,Promise.resolve(R).then(A=>{N.update({disabled:A===null})})},quickInsertFunction:I=>{const A=`=${I.toUpperCase()}(`,O={text:A+")",editMode:!0,initialSelection:{start:A.length,end:A.length+0}};m.setMode(W=>W?.key==="edit"?{...W,args:{...W.args}}:{key:"edit",args:{stateAndCoords:null,start:O}})},getSelectedFunction:()=>R,setEditor:I=>{D=I??null,M.update({state:D!==null})},getEditor:()=>D,getRanges:I=>{try{return l.getRanges(I)}catch{}return null},getScripts:()=>l.getScripts()};N.update({context:z})},[d,l,o,c]),f=n.useRef(null);ne.useModelListener(l,{onBeforeSave:async()=>{await f.current?.onBeforeSave()},onProtectionChange:()=>{f.current?.onReadonlyChange()},onLoad:()=>{(async()=>(await l.getCalculation().start(),l.getScripts().start(),f.current?.onScriptChange()))()}}),ne.useModelListener(l,{onSheetsChange:R=>{g(R.getSheets().getItems())},onViewChange(R){i(R?.getSelectedSheet())},onProtectionChange:R=>{const D={disabled:!R.getProtection().isStructureAllowed()};d.getCommand("hideSheet").update(D),d.getCommand("deleteSheet").update(D),d.getCommand("addSheet").update(D),d.getCommand("duplicateSheet").update(D),d.getCommand("selectTheme").update(D),d.getCommand("addNamedReference").update(D),d.getCommand("editNamedReference").update(D),d.getCommand("deleteNamedReference").update(D)},onScriptsChange:R=>{C()}});const{isFullscreenAvailable:x,isFullscreenEnabled:w,toggleFullscreen:j}=(function(R={}){const{target:D,onChange:F,onError:M,requestFullScreenOptions:N}=R,[z,I]=n.useState(!1),[A,O]=n.useState(null),[W,Z]=n.useState(!1),J=n.useCallback(()=>Ne.requestFullscreen(D?.current||null,N),[D,N]),te=n.useCallback(()=>Ne.exitFullscreen(),[]),U=n.useCallback(()=>Ne.fullscreenElement?te():J(),[J,te]),H=n.useCallback(q=>{const K=Ne.fullscreenElement;O(K),Z(!!K),F?.(q)},[F]),X=n.useCallback(q=>{const K=Ne.fullscreenElement;O(K),Z(!!K),M?.(q)},[M]);return n.useEffect(()=>{I(Ne.fullscreenEnabled)},[]),n.useEffect(()=>(Ne.on("change",H),Ne.on("error",X),()=>{Ne.off("change",H),Ne.off("error",X)}),[H,X]),{isFullscreenAvailable:z,fullscreenElement:A,isFullscreenEnabled:W,enableFullscreen:J,disableFullscreen:te,toggleFullscreen:U}})({target:{current:o??document.body}}),v=ne.useDocThemes();n.useEffect(()=>{d.getCommand("selectTheme").update({state:()=>l.getTheme(),context:()=>({theme:l.getTheme(),themes:v,darkMode:s})})},[l?.getTheme(),s]);const E=k.useCallbackRef(async function(R,D){let F=null;const M=l.getScripts();if(R?.declaration||R?.functionName){const N=R.declaration?R.declaration.getName():R.functionName;(await M.searchFunctions({name:N})).length>0&&(F=N)}if(F)try{await M.executeMacro(F),S.current=Promise.resolve({source:null,name:F})}catch(N){return void c.showError(N)}},[l,c]);n.useEffect(()=>{d.getCommand("newCellStyle").updateCallback(R=>{c.showInput({initialValue:(()=>{let D=0;for(;;){D++;const F=`Style ${D}`;try{return l.getStyles().validateStyleName(F,!0),F}catch{}}})(),title:d.getCommand("newCellStyle")?.label("cellStyle"),description:"Enter a name for the new cell style.",inputLabel:"Style Name",inputProps:{style:{minWidth:"300px"}},options:["Ok","Cancel"],defaultOption:"Ok",onValidateInput:async(D,F)=>{let M=null;try{l.getStyles().validateStyleName(D,!1)}catch(I){M=I.message}let N=l.getStyles().getNamed(D),z=M;return!z&&N&&(z=`Update style '${N.getName()}'.`),{valid:M===null,message:z}}}).then(({input:D,option:F})=>{const M=l.getSelectedSheet().getSelectedRange();if(F!=="Ok")return;const N=l.getStyles().setNamed({name:D,style:M.getCell().getStyle()});M.getStyle().update({named:N.getName()})})}),d.getCommand("deleteCellStyle").updateCallback(R=>{R.delete()}),d.getCommand("modifyCellStyle").updateCallback(({named:R})=>{const D=l.getSelectedSheet().getSelectedRange();l.getStyles().setNamed({name:R.getName(),style:D.getCell().getStyle()})}),d.getCommand("hideSheet").updateCallback(R=>{l.getSheetAt(R).setVisibility(L.ISheet.Visibility.Hidden)}),d.getCommand("deleteSheet").updateCallback(async R=>{l.getSheetAt(R??l.getSelectedSheetIndex())?.delete()}),d.getCommand("addSheet").updateCallback(R=>{l.getSheets().add({index:R,autoSelect:!0})}),d.getCommand("duplicateSheet").updateCallback(async R=>{(await l.getSheetAt(R??l.getSelectedSheetIndex())?.duplicate())?.select()}),d.getCommand("nextSheet").updateCallback(R=>{l.getNextSheet(R??l.getSelectedSheetIndex()).select()}),d.getCommand("previousSheet").updateCallback(R=>{l.getPreviousSheet(R??l.getSelectedSheetIndex()).select()}),d.getCommand("selectNextSheet").updateCallback(R=>{l.getNextSheet(R??l.getSelectedSheetIndex()).select()}),d.getCommand("selectPreviousSheet").updateCallback(R=>{l.getPreviousSheet(R??l.getSelectedSheetIndex()).select()}),d.getCommand("selectTheme").updateCallback(R=>{l.setTheme(R)}),d.getCommand("calculateAll").updateCallback(()=>{l.getSelectedSheet().getEntireRange().calculate(!0)}),d.getCommand("executeScript").updateCallback(E),d.getCommand("executeSelectedScript").updateCallback(E)},[l,c]);const P=k.useCallbackRef(async R=>{let D=0,F=null,M="Find & Replace";R?.replace&&!R?.replaceOptions?.maxCount&&(M="Replace All");const N=await c.showBusy(M);try{const z=R?.scope??"sheet";let I=null;const A=l.getSelectedSheet(),O={from:A.getSelectedCell(),...R.findOptions};if(I=z==="sheet"?l.getSelectedSheet().find(O):l.find(O),R.replace){const W=l.replace(I,R.replaceText,R.replaceOptions);D=W.count,R.replaceOptions.maxCount&&(F=W.last)}else{let W=I.next();W.done||(D++,F=W.value)}F?.select({autoFocus:!1}),N?.(),!R.replaceOptions.maxCount&&D>1&&c.showMessage(`We replaced ${D} cells.`)}catch(z){N?.(),c.showError(z)}return D},[l,o]),B=k.useCallbackRef(R=>{const D={selection:()=>{const M=l.getSelectedRanges(),N=M.getCount(),z=new Array(N);for(let I=0;I<N;I++){const A=M.at(I).getFixed(!0).getCoords();z[I]=A}return l.getRanges(z)},getNames:()=>l.getNames()},F={initialValue:R,context:()=>D,onInput:async M=>{try{await M.select()}catch(N){c.showMessage(N.message,{type:k.NotifierType.Error})}}};return c.showWindow("namedDetails",F)},[c,l,o]);return n.useEffect(()=>{const R=(D=!1)=>{const F={initialValue:{findOptions:{text:l.getSelectedCell().toTextUnformatted(!0)},replace:D},context:()=>P,onKeyDown:M=>{d.findCommandByEvent(M)!==d.getCommand("find")&&d.findCommandByEvent(M)!==d.getCommand("findReplace")||M.preventDefault()},autoFocus:!0,disableAutoDestroy:!0};c.showWindow("find",F)};d.getCommand("find")?.update({disabled:!c.showWindow}).updateCallback(()=>{R()}),d.getCommand("findReplace")?.update({disabled:!c.showWindow}).updateCallback(()=>{R(!0)}),d.getCommand("activateTask")?.update({disabled:!c}).updateCallback(()=>{const D={onInput:async F=>{try{b.activateTaskPane(F)}catch(M){c.showError(M.message)}},title:d.getCommand("activateTask")?.label(),inputLabel:"Task Name",options:["Activate"]};c.showInput(D)}),d.getCommand("goto")?.update({disabled:!c}).updateCallback(()=>{const D={onInput:async F=>{try{await l.getRanges(F).select()}catch(M){c.showMessage(M.message,{type:k.NotifierType.Error})}},title:d.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};c.showInput(D)}),d.getCommand("selectNamed")?.update({disabled:!c}).updateCallback(async D=>{if(D)try{await D.select()}catch(F){c.showError(F)}}),d.getCommand("addNamedReference")?.updateCallback(async function(D){B(null)}),d.getCommand("editNamedReference")?.updateCallback(async function(D){B(D)}),d.getCommand("deleteNamedReference")?.updateCallback(async function(D){D?.delete?.()}),d.getCommand("activeNameBox")?.updateCallback(async function(){o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[o,l,c]),ne.useModelListener(l?.getView(),{onViewChange:R=>{d.getCommand("workbookViewToggleShowFormulaBar").update({state:R.isShowFormulaBar()}).updateCallback(()=>{R.setShowFormulaBar(!R.isShowFormulaBar())}),d.getCommand("workbookViewToggleShowTabs").update({state:R.isShowTabs()}).updateCallback(()=>{R.setShowTabs(!R.isShowTabs())}),d.getCommand("workbookViewToggleShowStatusBar").update({state:R.isShowStatusBar()}).updateCallback(()=>{R.setShowStatusBar(!R.isShowStatusBar())}),d.getCommand("workbookViewToggleShowHorizontalScrollBar").update({state:R.isShowHorizontalScrollbar()}).updateCallback(()=>{R.setShowHorizontalScrollbar(!R.isShowHorizontalScrollbar())}),d.getCommand("workbookViewToggleShowVerticalScrollBar").update({state:R.isShowVerticalScrollbar()}).updateCallback(()=>{R.setShowVerticalScrollbar(!R.isShowVerticalScrollbar())})}}),n.useEffect(()=>{d.getCommand("fullScreenToggle").update({state:w,disabled:!x,icon:w?"FullScreenOff":"FullScreen"}).updateCallback(()=>{j()})},[w,x]),n.useEffect(()=>{const R=l.getProtection().isStructureAllowed();d.getCommand("hideSheet").update({disabled:u.length<=1||!R}),d.getCommand("deleteSheet").update({disabled:u.length<=1||!R})},[u,h]),d},mi="_sheetxl-workbook_g5t6x_5",ro=n.memo(n.forwardRef((a,l)=>{const{command:o,...t}=a,r=k.useEditMode(),[s,c]=n.useState(!1),[h,i]=n.useState("info");return n.useEffect(()=>{const u=r.getMode();c(u?.key==="copy"||u?.key==="cut"),i(u?.key==="cut"?"warn":"accent")},[r]),e.jsx(y.CommandButton,{ref:l,command:o,icon:e.jsx(k.DynamicIcon,{iconKey:"copy.walking",sourceProps:{isWalking:s,themedType:h}}),...t})})),vr=n.memo(n.forwardRef((a,l)=>{const{movable:o,commands:t,disabled:r,sx:s,floatReference:c,...h}=a;ne.useModelListener(o,{onAnyChange(d){}});const i=n.useMemo(()=>({}),[]),u=n.useMemo(()=>({commandHook:{beforeExecute:(d,m)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:c}),[r,c]),g=n.useMemo(()=>({variant:k.CommandButtonType.Menuitem,...i,...u}),[i,u]),b=n.useMemo(()=>({commands:t,variant:k.CommandButtonType.Menuitem,parentFloat:c,...u}),[t,u,c]),p=e.jsxs(e.Fragment,{children:[e.jsx(ro,{command:t.getCommand("copy"),...g,variant:k.CommandButtonType.Menuitem}),[],e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...b,popupCommandKeys:["moveToFront","moveForward"],quickCommand:"moveToFront"}),e.jsx(y.SimpleCommandPopupButton,{...b,popupCommandKeys:["moveToBack","moveBackward"],quickCommand:"moveToBack"}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:t.getCommand("toggleLockAspectRatio")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...b,popupCommandKeys:["formatDrawAlignLeft","formatDrawAlignCenter","formatDrawAlignRight",null,"formatDrawAlignTop","formatDrawAlignMiddle","formatDrawAlignBottom",null,"formatDrawDistributeHorz","formatDrawDistributeVert"],label:"Align",icon:"DrawAlignLeft",tooltip:"Quickly change the placement of your drawings."}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...b,popupCommandKeys:["formatAnchorTypeTwoCell","formatAnchorTypeOneCell","formatAnchorTypeAbsolute"],label:"Sizing",icon:"DrawResize",tooltip:"Determine how the drawing size will adjust as the cell sizes adjust."}),[]]});return e.jsx(T.Box,{ref:l,sx:{paddingTop:"4px",paddingBottom:"4px",...s},...h,children:p})}));vr.displayName="MovableContextMenu";const tn=n.memo(n.forwardRef((a,l)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:c=!1,readOnly:h=!1,contextMenuProps:i,renderContextMenu:u=Si,sheetsAllProps:g,renderSheetsAll:b=wi,sheetTabProps:p,renderSheetTab:d,background:m="transparent",className:S,sx:C,borderWidth:f,borderColor:x,gridTheme:w,gridStyle:j,...v}=a,[E,P]=n.useState(o?.getSelectedSheetIndex()),[B,R]=n.useState(o?.getSheets().getItems()),[D,F]=n.useState(o?.getProtection());ne.useModelListener(o,{onViewChange(Y){P(Y?.getSelectedSheetIndex())},onSheetsChange:Y=>{R(Y.getSheets().getItems())},onProtectionChange:Y=>{F(Y?.getProtection())}});const M=h||!D.isStructureAllowed(),N=n.useMemo(()=>{const Y=[];for(let _=0;_<B.length;_++)Y.push(B[_].getName());return Y},[B]),z=n.useCallback(Y=>{r?.(Y)!==!1&&(o.getSheetAt(Y).select(),s?.(Y))},[o,r,s]),I=n.useCallback((Y,_)=>{o.getSheetAt(Y).setName(_),s?.(Y)},[o,s]),A=n.useCallback((Y,_)=>{o.getSheetAt(Y).setPosition(_),s?.(_)},[o,s]),O=k.useCallbackRef(()=>{if(r?.(E)===!1)return;const Y=E+1;o.getSheets().add({name:void 0,autoSelect:!0}),s?.(Y)},[o,r,s,E]),W=n.useMemo(()=>({placement:"top-start"}),[]),Z=n.useRef(null),[J,te]=n.useState(!1),U=n.useCallback(Y=>{const{closeFloatAll:_,floatReference:ee}=Y;return b({workbook:o,gridStyle:j,floatReference:ee,closeFloatAll:_,...g})},[b,g,c,o,j]),{reference:H,component:X}=y.useFloatStack({label:"allSheet",popperProps:W,anchor:Z.current,onOpen:()=>te(!0),onClose:()=>te(!1),createPopupPanel:U}),q=n.useRef(null),[K,V]=n.useState(null),oe=n.useCallback(Y=>{const{floatReference:_}=Y;return u?.({workbook:o,index:K?.index,tabStripRef:q.current,commands:t,disabled:c,floatReference:_,...i})},[u,i,c,o,t,K]),{reference:le,component:ie}=y.useFloatStack({label:"sheetTab",popperProps:W,anchor:{getBoundingClientRect:()=>new DOMRect(K?.left||0,K?.top||0,0,0)},onClose:()=>V(null),createPopupPanel:oe});n.useEffect(()=>{K?le.open(0):le.close(0)},[K]);const ae=n.useCallback((Y,_)=>{Y.preventDefault(),V({left:Y.clientX-2,top:Y.clientY-4,index:_})},[]),Ce=k.useCallbackRef(Y=>{let _;try{_=o?.getSheetAt(Y.index)}catch{}return _?(d??ki)({sheet:_,gridTheme:w,onContextMenu:ee=>{z(Y.index),ae(ee,Y.index)},...Y,...p}):null},[d,p,o,w]),he=n.useMemo(()=>M?null:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(T.IconButton,{disabled:c,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:Y=>Y.palette.primary.main},color:Y=>Y.palette.text.icon??Y.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:Y=>{Y.button===0&&Y.preventDefault()},onClick:()=>O(),children:e.jsx(k.DynamicIcon,{iconKey:"AddCircle"})})}),[c,M,O]);return e.jsxs(T.Box,{ref:l,className:de(S),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...C},...v,children:[e.jsx(ne.TabStrip,{ref:q,selectedTabIndex:E,tabNames:N,onSelectedTabIndexChange:z,onTabNameChange:I,onTabMove:A,background:m,borderColor:x,borderWidth:f,activeColor:null,disabled:c,disableDrag:M,createScrollStartButton:y.createScrollStartButton,createScrollEndButton:y.createScrollEndButton,createScrollEdgeButton:y.createScrollEdgeButton,createTabButton:Ce,createTabDivider:Y=>{const{key:_,...ee}=Y;return e.jsx(y.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:me=>G.alpha(me.palette.divider,.25)},...ee},_)},editLabelProps:{readOnly:M,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:Y=>{o.isValidSheetNameCharacter(Y.key)||Y.preventDefault()},onCancel:()=>{s?.(E)}},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:J?"":"List all sheets",children:e.jsx(y.ExhibitIconButton,{sx:{padding:"0px",ml:.5,mr:0,mt:0,mb:0,"& svg":{transform:"scale(0.8, 1)"},color:Y=>Y.palette.text.icon??Y.palette.action.active},ref:Z,dense:!0,outlined:!1,selected:J,color:"primary","aria-label":"menu",onMouseDown:Y=>{Y.button===0&&Y.preventDefault()},onClick:()=>{J?H.close(0):H.open(0)},icon:e.jsx(k.DynamicIcon,{iconKey:"Menu"})})})}),e.jsx("div",{style:{borderTop:`solid ${x} ${f}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${x} ${f}px`,flex:"none",display:"flex",alignItems:"center"},children:he}),e.jsx("div",{style:{borderTop:`solid ${x} ${f}px`,flex:1,minWidth:"24px"}}),ie,X]})}));tn.displayName="WorkbookStrip";const on=n.memo(n.forwardRef((a,l)=>{const{workbook:o,commands:t,disabled:r,sx:s,floatReference:c,className:h,...i}=a,[u,g]=n.useReducer(M=>M+1,0),[b,p]=n.useState(o.getSelectedSheet()),[d,m]=n.useState(b.getSelectedRanges()),[S,C]=n.useState(b.getSelectedCell());ne.useModelListener(o,{onSheetsChange(){p(o.getSelectedSheet())}}),ne.useModelListener(b.getSelection(),{onChange(){m(b.getSelectedRanges()),C(b.getSelectedCell())}}),k.useCommands(t,[],{onChange:()=>{g()}});const f=n.useMemo(()=>({}),[]),x=n.useMemo(()=>({commandHook:{beforeExecute:(M,N)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:c}),[r,c]),w=n.useMemo(()=>({...f,...x,variant:k.CommandButtonType.Menuitem}),[f,x]),j=n.useMemo(()=>({commands:t,variant:k.CommandButtonType.Menuitem,parentFloat:c,...x}),[t,x,c]),v=[];let E=d.isEntireRows(),P=d.isEntireColumns();d&&(E&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideColumns"),...w,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideColumns"),...w,key:"context:"+v.length}))),P&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideRows"),...w,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideRows"),...w,key:"context:"+v.length}))),(E||P)&&v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),E&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitColumns"),...w,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...w,command:t.getCommand("resizeColumns"),key:"context:"+v.length}))),P&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitRows"),...w,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...w,command:t.getCommand("resizeRows"),key:"context:"+v.length}))));const B=[],R=t.getCommand("formatTableStyle"),D=R?.context()?.table();if(k.useCommand(R),!E&&!P){if(B.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+B.length)),S?.getHyperlink())B.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+B.length,quickCommand:"openHyperlink"}));else{const M=t.getCommand("updateHyperlink");B.push(n.createElement(y.CommandButton,{command:M,...w,key:"contextBefore:"+B.length}))}if(S?.getComments())B.push(n.createElement(y.SimpleCommandPopupButton,{...j,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+B.length,quickCommand:"updateComments"}));else{const M=t.getCommand("updateComments");B.push(n.createElement(y.CommandButton,{command:M,...w,key:"contextBefore:"+B.length}))}D?B.push(n.createElement(y.SimpleCommandPopupButton,{...j,variant:k.CommandButtonType.Menuitem,key:"contextBefore:"+B.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:D,quickCommand:"editTable"})):B.push(n.createElement(y.CommandButton,{command:t.getCommand("insertTable"),...w,key:"context:"+v.length})),B.push(n.createElement(sn,{...j,key:"contextBefore:"+B.length}))}const F=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:t.getCommand("cut"),...w}),e.jsx(ro,{command:t.getCommand("copy"),...w}),e.jsx(Wo,{command:t.getCommand("paste"),...j,includePasteAllInPopup:!1}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(zo,{...j}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(Oo,{commands:t,...j,disableSheet:!0}),e.jsx(Ao,{commands:t,...j,disableSheet:!0}),e.jsx(No,{...j}),B,v]});return e.jsx(T.Box,{ref:l,className:de("menu",h),sx:{...s},...i,children:F})}));on.displayName="WorkbookContextMenu";const pi=a=>e.jsx(vr,{...a}),fi=a=>e.jsx(on,{...a}),hi=a=>e.jsx(Yo,{...a}),gi=a=>e.jsx(Xo,{...a}),nn=a=>e.jsx(y.AnimatedLoadingPanel,{transitionDelay:"160ms",transparentBackground:!0,...a}),xi=a=>e.jsx(y.StackTraceErrorPanel,{fullscreen:!0,...a}),bi=a=>e.jsx(ne.SheetElement,{...a}),yi=a=>e.jsx(Uo,{...a}),Ci=a=>e.jsx(tn,{...a}),Si=a=>e.jsx(Qo,{...a}),wi=a=>e.jsx(Jo,{...a}),ki=a=>e.jsx(Zo,{...a}),vi={fireOnModelChange:!1},ra={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},an=n.memo(n.forwardRef((a,l)=>{const{workbook:o,onElementLoad:t,autoFocus:r=!1,sx:s,style:c,className:h,onFocus:i,onBlur:u,onKeyDown:g,onRepeatCommandChange:b,commands:p,showFormulaBar:d,formulaBarProps:m,renderFormulaBar:S=gi,showTabs:C,tabsProps:f,renderTabs:x=Ci,showStatusBar:w,statusBarProps:j,renderStatusBar:v=yi,toolbarProps:E,renderToolbar:P=Sr,contextMenuSx:B,renderContextMenu:R=fi,renderFilterMenu:D=hi,renderMovableMenu:F=pi,renderLoading:M=nn,loadingProps:N,sheetProps:z,renderSheet:I=bi,mainWrapper:A,showHorizontalScrollbar:O,showVerticalScrollbar:W,gridTheme:Z,headersTheme:J,enableDarkImages:te,...U}=a;if(!o)throw new Error("IWorkbook must be provided.");const H=G.useTheme(),X=n.useRef(null),[q,K]=n.useState(!1),V=n.useRef(null),oe=n.useMemo(()=>e.jsx(T.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:V}),[]),[le,ie]=n.useState(!1),[ae,Ce]=n.useState(!1),he=n.useCallback(()=>{ie(!0)},[]),Y=n.useRef(null),_=k.useImperativeElement(l,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>o,getSheetElement:()=>X.current,getViewportElement:()=>V.current,getFormulaBarElement:()=>Y.current,focus(){X&&X.current&&X.current.focus()}}),[o]),ee=n.useRef(null);n.useLayoutEffect(()=>{!le||!_.current||(async()=>(ee.current!==t&&(await t?.({source:_.current}),ee.current=t),Ce(!0)))()},[le,_.current]),Xn(_.current);const me=n.useCallback($=>(X.current?.submitEdit(),!0),[]),je=n.useCallback(()=>{requestAnimationFrame(()=>{X?.current?.focus()})},[]),[se,Oe]=n.useState(o.getSelectedSheet()),[Te,Q]=n.useState(o.getProtection());ne.useModelListener(o,{onSheetsChange:$=>{Oe($?.getSelectedSheet())},onViewChange($){Oe($?.getSelectedSheet())},onProtectionChange:$=>{Q($?.getProtection())}}),ne.useModelListener(o,{onRequestSelect:async($,re)=>new Promise(fe=>{X.current.getSheet()!==re?X.current.getGridElement()?.onViewChangeOnce(()=>{X.current.getSheet()!==re&&fe(!1),fe(!0)}):fe(!0)})},vi);const[ce,Ee]=n.useReducer($=>$+1,0),Fe=o.getView();ne.useModelListener(Fe,{onViewChange:$=>{Ee()}});const we=Z??H,Se=n.useMemo(()=>Mo(H,we),[H,we]),pn=J??H,Jr=n.useMemo(()=>Mo(H,pn),[H,pn]),[fn,el]=n.useState(null);n.useCallback(()=>{X.current.focus()},[]);const pe=kr({workbook:o,workbookElement:_.current,target:()=>X.current,commands:p,darkMode:Se.body.darkMode}),ft=n.useRef(null),[io,hn]=n.useState(!1),[gn,xn]=n.useState(null),[bn,tl]=n.useState(k.ToolTipPlacement.Top),[ht,ol]=n.useState(L.TypesUtils.EmptyBounds),so=n.useCallback(()=>{hn(!1),xn(null)},[]),gt=n.useCallback(($,re,fe=k.ToolTipPlacement.Top)=>{ol($),tl(fe),xn(re),ft.current!==null&&setTimeout(()=>{ft.current!==null&&ft.current.update()},160),hn(!0)},[]),[ss,yn]=n.useState("sheet"),qe=C??Fe?.isShowTabs(),Ge=O??Fe?.isShowHorizontalScrollbar(),nl=d??Fe?.isShowFormulaBar(),Ot=w??Fe?.isShowStatusBar(),Cn=W??Fe?.isShowVerticalScrollbar(),tt=Se?.header?.edgeStrokeFill||"rgb(171,171,171)",al=n.useMemo(()=>Ot?v({sheet:se,gridStyle:Se,...j}):null,[v,j,Ot,Se,se]),rl=n.useMemo(()=>P({commands:pe,workbook:_.current,...E}),[pe,P,E,H]),[ll,{width:co}]=_e(),Xe=co===0||co>560,uo=n.useMemo(()=>{if(!qe)return null;let $=x({background:Se.body.fill,borderWidth:1,borderColor:tt,gridTheme:we,gridStyle:Se,onBeforeUserChange:me,onUserChange:je,workbook:o,commands:pe,sheetTabProps:{},...f});return Xe||($=e.jsx("div",{style:{flex:"none",display:"flex"},children:$})),$},[x,f,H,o,we,Xe,pe,qe]),Sn=n.useCallback($=>{const{style:re,...fe}=$;let be=null,Be=null,ye=null;if(Ge&&(Be=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${tt} 1px`,flexDirection:"column",justifyContent:"center"},children:e.jsx(ne.SheetScrollbar,{...fe,style:{paddingLeft:"4px",paddingRight:"4px",...re},touchThumbProps:{backgroundColor:we.palette.background.paper,borderColor:we.palette.primary.main,fillColor:"grey"},endGap:700,sheet:se,onShowTooltip:ke=>{gt({x:ke.anchor.x,y:ke.anchor.y,width:0,height:0},ke.display,ke.placement)},onCloseTooltip:()=>so()})})),qe&&Xe&&(ye=uo),qe&&Xe&&!Ge&&(ye=e.jsxs(T.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[ye,e.jsx(T.Box,{sx:{borderTop:`solid ${tt} 1px`,flex:"1"}})]})),ye&&Ge)be=e.jsx(k.SplitPane,{position:o.getView().getTabRatio()/10+"%",onPositionChange:({percent:ke})=>{o.getView().setTabRatio(Math.round(10*ke))},minBefore:"200px",minAfter:"180px",resizerProps:{style:{minWidth:"11px",backgroundImage:`url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${H.palette.text.icon??H.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",borderTop:`solid ${tt} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:ye,elementAfter:Be});else if(Ge)be=Be;else{if(!ye)return e.jsx(T.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:Ot?null:`solid ${tt} 1px`}});be=ye}return e.jsx(T.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:be})},[se,me,o,Se,we,pe,qe,Ge,Ot,Xe]),[Me,xt]=n.useState(null),il=n.useMemo(()=>({placement:"right-start",...Me?.popperProps}),[Me?.popperProps]),{reference:wn,component:sl}=y.useFloatStack({label:"contextMenu",popperProps:il,anchor:Me?.anchor??{getBoundingClientRect:()=>new DOMRect(Me?.clientX||0,Me?.clientY||0)},onClose:()=>xt(null),createPopupPanel:Me?.createPopupPanel});n.useEffect(()=>{Me?wn.open(0):wn.close(0)},[Me]);const cl=k.useCallbackRef(($,re)=>{if($?.isDefaultPrevented())return!0;$.preventDefault(),Me&&Me.anchor===$.currentTarget?xt(null):xt({anchor:$.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:fe=>{const{floatReference:be}=fe;return D({filter:re,commands:pe,floatReference:be,sx:{...B}})}})},[D,B,pe,o,Me]),kn=k.useCallbackRef($=>{if($.originalEvent?.isDefaultPrevented())return!0;$.originalEvent?.preventDefault(),xt({clientX:$.clientX,clientY:$.clientY,createPopupPanel:re=>{const{floatReference:fe}=re;return R({commands:pe,workbook:o,floatReference:fe,sx:{...B}})}})},[R,B,pe,o]),dl=k.useCallbackRef(($,re)=>{if($?.isDefaultPrevented())return!0;$.preventDefault(),xt({clientX:$.clientX,clientY:$.clientY,createPopupPanel:fe=>{const{floatReference:be}=fe;return F({movable:re,commands:pe,floatReference:be,sx:{...B}})}})},[F,B,pe]);n.useMemo(()=>{const $=[new k.SimpleCommand("openContextMenu",()=>X.current,{label:"Context Menu",description:"Open the context menu.",shortcut:[{key:"F10",modifiers:[k.KeyModifiers.Shift]},{key:"ContextMenu"}]})];pe.addCommands($,!0)},[pe]),n.useEffect(()=>{pe.getCommand("openContextMenu").updateCallback(()=>{const $=se.getSelection().getCoords().cell;X.current?.getGridElement()?.scrollCellCoordsIntoView($).then(re=>{requestAnimationFrame(()=>{const fe=se.getView().getZoomScale()/100,be=se.getColumnHeaders().findOffset($.colIndex+1)*fe,Be=se.getRowHeaders().findOffset($.rowIndex+1)*fe,ye=X.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};kn({clientX:be-ye.x-re.left+6,clientY:Be-ye.y-re.top+6})})})})},[se]);const ul=k.useCallbackRef($=>{pe?.dispatchToFocusedCommand($)},[pe]),ml=k.useCallbackRef(()=>{Xn(_.current)},[]),pl=n.useCallback(()=>{yn("sheet")},[]),fl=n.useCallback(()=>{yn("formulaBar")},[]),hl=n.useCallback($=>{const{style:re,...fe}=$;return e.jsx(ne.SheetScrollbar,{...fe,style:{...re,paddingTop:"4px",paddingBottom:"4px"},touchThumbProps:{backgroundColor:we.palette.background.paper,borderColor:we.palette.primary.main,fillColor:"grey"},sheet:se,endGap:700,onShowTooltip:be=>{gt(be.anchor,be.display,k.ToolTipPlacement.Left)},onCloseTooltip:()=>so()})},[se,we]);n.useEffect(()=>{r&&X&&X.current&&X.current.focus()},[]);const[At,mo]=n.useState(null),po=n.useCallback($=>{pe?.getCommand("openWorkbook")&&($.type==="dragenter"||$.type==="dragover"?$.dataTransfer?.types.includes("Files")?$.dataTransfer.files[0]?.type?.startsWith("image/")||$.dataTransfer.items[0]?.type?.startsWith("image/")||$.dataTransfer.types.length===1&&mo("Drop to open"):($.dataTransfer?.types.includes("text/html")||$.dataTransfer?.types.includes("text/plain"),$.dataTransfer.effectAllowed="none",$.dataTransfer.dropEffect="none"):$.type==="dragleave"&&mo(null),$.preventDefault())},[pe]),gl=k.useCallbackRef($=>{if(pe?.getCommand("openWorkbook")&&($.preventDefault(),$.stopPropagation(),mo(null),$.dataTransfer.files&&$.dataTransfer.files.length>0)){const re=$.dataTransfer.files[0];if(!re)return;if(re?.type?.startsWith("image/")){const fe=X.current?.getGridElement().getViewFromClient($.clientX,$.clientY);if(!fe)return;const be=fe.getRelativePointFromClient($.clientX,$.clientY),Be=fe.toAbsoluteBounds({...be,width:0,height:0}),ye=fe.getCellCoordsFromClient($.clientX,$.clientY);if(!ye)return;pe?.getCommand("insertImageFromFile")?.execute({file:re,options:{bounds:{x:Be.x,y:Be.y}},goto:{range:{...ye}}})}else pe?.getCommand("openWorkbook")?.execute(re)}},[pe,At]),xl=n.useMemo(()=>At?e.jsx(T.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:$=>$.palette.divider,color:$=>$.palette.primary.dark},children:e.jsx(T.Typography,{variant:"h4",children:At})}):null,[At]),vn=n.useRef(null),bl=n.useMemo(()=>e.jsx(Po,{in:!ae,nodeRef:vn,timeout:500,classNames:"animating",unmountOnExit:!0,children:e.jsx(T.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",left:"0px",top:"0px",width:"100%",height:"100%",pointerEvents:ae?"none":s?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:M?.({ref:vn,...N})})}),[ae,M,N]),yl=n.useMemo(()=>S({ref:Y,sx:{marginTop:$=>$.spacing(.25),marginLeft:$=>$.spacing(1),marginRight:$=>$.spacing(1)},workbook:o,sheetElement:X.current,gridStyle:Se,onFocus:fl,...m,NamedCollectionEditorProps:{restoreFocus:$=>X.current.focus($),...m?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:pe,...m?.NamedCollectionEditorProps?.commandPopupButtonProps}}}),[S,m,o,Se,pe,ae]),Cl=n.useCallback($=>{const{movable:re,...fe}=$,be={movable:re,onContextMenuCapture:ke=>{dl(ke,re)},...fe},Be=re.getContent().getType();let ye=null;if(Be==="picture")return e.jsx(ne.PictureEditor,{loadingPanel:e.jsx(y.AnimatedLoadingPanel,{style:{position:"absolute"},transitionDelay:"100",sx:{border:ke=>`solid 1px ${ke.palette.action.active}`}}),picture:re.getContent(),description:re.getDescription()??re?.getName(),...be});if(Be==="chart"){const ke={...be,chart:re.getContent()};return e.jsx(ne.ChartEditor,{...ke})}if(ye=`Float of type '${Be}'.`,typeof ye=="string"){const ke={...be,description:ye};ye=e.jsx(ne.EmptyFrame,{...ke})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ye},re.getUUID())},[]),jn=n.useMemo(()=>I({ref:X,style:ra,onFocus:pl,gridStyle:Se,headersStyle:Jr,sheet:se,commands:pe,onSheetContextMenu:kn,onViewportChange:$=>{el($)},showScrollbars:!1,viewportComponent:oe,onRepeatCommandChange:b,onElementLoad:he,onShowColumnTooltip:$=>{gt($.anchor,$.display,k.ToolTipPlacement.Top)},onShowRowTooltip:$=>{gt($.anchor,$.display,k.ToolTipPlacement.Right)},onShowTooltip:$=>{gt({x:$.anchor.x,y:$.anchor.y,width:0,height:0},$.display,$.placement)},onCloseTooltip:()=>so(),renderMovable:Cl,...z,cellRenderProps:{onFilterButtonMouseDown:($,re)=>{z?.cellRenderProps?.onFilterButtonMouseDown($,re),cl($,re)},...z?.cellRenderProps}}),[pe,z,se,Se,b]),Sl=n.useMemo(()=>{let $=e.jsx(k.ScrollPane,{ref:ll,style:ra,viewport:fn,touchElement:X.current?.getGridElement()?.stage,onScrollViewport:re=>{X.current?.getGridElement()?.scrollTo(re)},showHorizontalScrollbar:Ge||qe,showVerticalScrollbar:Cn,createHorizontalScrollbar:Sn,createVerticalScrollbar:hl,children:jn});return Xe||co===0||($=e.jsxs(e.Fragment,{children:[$,uo]})),A?A($):$},[Ge,qe,Sn,Cn,fn,Xe,jn,uo,H,A,we]),wl=n.useMemo(()=>e.jsx(y.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:io,title:e.jsx(T.Typography,{variant:"subtitle2",component:"div",children:gn}),placement:bn,slotProps:{transition:{timeout:{exit:0}},popper:{popperRef:ft,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:io?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(ht.x,ht.y,ht.width,ht.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]}},children:e.jsx(T.Box,{})}),[io,gn,bn,ht,ft]),kl=n.useMemo(()=>({boxSizing:"border-box",background:$=>$.palette.mode!=="dark"?Se.header.fill:$.palette.background.paper,"& *":{...y.scrollbarTheming(H),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${tt} 1px`},...s}),[s,Se]),vl=n.useMemo(()=>e.jsx(T.Box,{sx:{marginBottom:$=>$.spacing(.75)}}),[]),jl=n.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:ae?void 0:0,"--sxl-app-color-high-contrast":H.palette.primary.main,"--sxl-app-color-primary":H.palette.primary.main,"--sxl-app-color-primary-dark":H.palette.primary.dark,"--sxl-app-color-primary-light":H.palette.primary.light,"--sxl-app-color-info":H.palette.info.main,"--sxl-app-color-info-dark":H.palette.info.dark,"--sxl-app-color-info-light":H.palette.info.light,"--sxl-app-color-secondary":H.palette.secondary.main,"--sxl-app-color-secondary-dark":H.palette.secondary.dark,"--sxl-app-color-secondary-light":H.palette.secondary.light,"--sxl-app-color-success":H.palette.success.main,"--sxl-app-color-success-dark":H.palette.success.dark,"--sxl-app-color-success-light":H.palette.success.light,"--sxl-app-color-warning":H.palette.warning.main,"--sxl-app-color-warning-dark":H.palette.warning.dark,"--sxl-app-color-warning-light":H.palette.warning.light,"--sxl-app-color-error":H.palette.error.main,"--sxl-app-color-error-dark":H.palette.error.dark,"--sxl-app-color-error-light":H.palette.error.light,"--sxl-app-color-text":H.palette.text.primary,"--sxl-app-color-text-secondary":H.palette.text.secondary,"--sxl-app-color-text-disabled":H.palette.text.disabled,"--sxl-app-color-background":H.palette.background.paper,"--sxl-app-color-button-surface":H.palette.grey[600],"--sxl-app-color-shadow":H.palette.action.focus,"--sxl-app-color-grey":H.palette.grey[500],"--sxl-app-filter-dark-invert":Se.body.darkMode&&te?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":Se.body.darkMode?`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`:void 0}),[Se,H,ae]),El=n.useMemo(()=>de(Ua),[]);return e.jsxs(T.Paper,{className:de("sheetxl-workbook",mi,{"Mui-focusVisible":q},oi,h),sx:kl,style:c,square:!1,...U,ref:_,onFocus:$=>{K(!0),ml(),i?.($)},onBlur:$=>{K(!1),u?.($)},onKeyDown:$=>{ul($),g?.($)},onDragStart:$=>{if($.target.src){const re=new Image;re.src=$.target.src,$.dataTransfer.setDragImage(re,1,1)}},onDragEnter:po,onDragLeave:po,onDragOver:po,onDrop:gl,children:[e.jsxs("div",{className:El,style:jl,children:[rl,nl?yl:null,vl,Sl,al,wl,sl,xl]}),bl]})}));an.displayName="WorkbookElement";const ji=(a=!1,l=!1)=>l?null:{"& input:not(:focus):not(:hover)":{color:o=>o.palette.text.secondary},backgroundColor:o=>G.alpha(o.palette.background.paper,.6),borderRadius:o=>`${o.shape.borderRadius}px`,border:o=>`solid ${a?o.palette.divider:"transparent"} 1px`,"&.Mui-disabled":{border:o=>`solid ${a?o.palette.divider:"transparent"} 1px`},"&:focus-within:not([disabled])":{backgroundColor:o=>o.palette.background.paper},"&:hover:not([disabled])":{border:o=>`solid ${a?o.palette.text?.primary:o.palette.divider} 1px`,backgroundColor:null},"&.Mui-focusVisible":{outline:o=>`solid ${o.palette.primary.main} 1px !important`,border:o=>`1px solid ${o.palette?.primary?.main} !important`}},rn=n.memo(n.forwardRef((a,l)=>{const{sx:o,workbook:t,title:r="",placeHolder:s="Untitled",onTitleChange:c,readOnly:h=!1,hidden:i,...u}=a,[g,b]=n.useState(!1),[p,d]=n.useState(!1),[m,S]=n.useState(r??""),[C,f]=n.useState(""),[x,{width:w}]=_e(),[j,{width:v}]=_e(),[E,P]=n.useState(!1),B=n.useRef(null),R=n.useRef(null),D=k.useImperativeElement(l,()=>({requestWorkbookTitle:(F=null,M)=>{R.current={onAccept:F,requestReason:M?.requestReason},M?.selectAll&&B.current?.select(),B.current?.focus(M)},focus:F=>{B.current?.focus(F)}}),[]);return n.useLayoutEffect(()=>{P(r!==m),f(r),S(r)},[r]),n.useEffect(()=>{E&&w!==0&&ve.CommonUtils.debounce(()=>{P(!1)},300)()},[E,w]),n.useEffect(()=>{d(m&&!st.IOUtils.isValidWindowsFilename(m))},[m]),i?null:e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:E?"0":"1",transition:E?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:Ke([D,j,l]),...u,children:e.jsx(y.ExhibitTooltip,{label:R.current?.requestReason??"Workbook Name",children:e.jsxs(T.Box,{className:de({"Mui-focusVisible":g}),sx:{visibility:w===0?"hidden":"visible",display:"block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:"12px",paddingRight:"12px",marginLeft:"2px",marginRight:"2px",paddingTop:"2px",paddingBottom:"1px",...ji(!0,h),...o},children:[h?e.jsx(T.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:m!==C?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:F=>p?F.palette.error.dark:void 0},children:r??s}):e.jsx(T.Input,{sx:{width:`${Math.min(w+3,Math.max(v,D.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:F=>p?F.palette.error.dark:void 0,fontStyle:m!==C?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:h,spellCheck:!1,placeholder:s,onFocus:F=>{b(!0),F.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:B},onBlur:()=>{b(!1),p?S(C):(m!==C&&(c?.(m),m&&R.current?.onAccept?.(m,"blur")),R.current=null)},onChange:F=>{if(F.target.value.length>st.IOUtils.MAX_WORKBOOK_NAME_SIZE)return F.stopPropagation(),void F.preventDefault();S(F.target.value)},onKeyDown:F=>{(st.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(F.key)||F.target?.value.length>st.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&F.preventDefault(),F.which===k.KeyCodes.Enter||F.which===k.KeyCodes.Tab?(p?S(C):(c?.(m),m&&(R.current?.onAccept?.(m,"keydown"),R.current=null)),F.stopPropagation(),F.preventDefault(),t?.focus()):F.which===k.KeyCodes.Escape&&(m===C?t?.focus():(S(C),setTimeout(()=>{F.target?.select()},0)),R.current=null,F.stopPropagation(),F.preventDefault())},value:m}),e.jsx(T.Box,{ref:x,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:m!==C?"italic":void 0,fontFamily:F=>F.typography.fontFamily,letterSpacing:"0.00938em"},children:m||s})]})})})}));rn.displayName="WorkbookTitle";const jr=n.memo(n.forwardRef((a,l)=>{const{title:o,commands:t,className:r,...s}=a,c=k.useNotifier(),[h,i]=n.useState(!1),[u,g]=n.useState(!1),b=n.useRef(null),[p,d]=n.useReducer(B=>B+1,0),[m,{width:S}]=_e(),C=k.useCommands(t,["editTable"])[0].context(),f=C.table(),[x,w]=n.useState(()=>f?C.getNames().getRanges(f.getRange()):null),j=n.useMemo(()=>f?.getName()??"",[f]);ne.useModelListener(C.table(),{onAnchorCoordsChange(B){w(C.getNames().getRanges(B.getRange()))},onProtectedChange(B){d()}});const v=k.useCallbackRef(B=>{C?.table().setName(B)},[C]),E=k.useCallbackRef(B=>{C?.table().resize(B.at(0))},[C]);let P=null;return C.table()||(P=e.jsx(T.Typography,{component:"div",style:{top:"0",left:"0",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyItems:"center",justifyContent:"center"},children:"No table selected"})),e.jsx(T.Paper,{square:!0,onFocus:()=>i(!0),onBlur:B=>{b?.current?.contains(B.relatedTarget)||i(!1)},ref:Ke([b,m,l]),sx:{display:"flex",flexDirection:"column",flex:"1 1 auto",width:"100%",height:"100%",overflow:"auto",paddingLeft:B=>B.spacing(1.5),paddingRight:B=>B.spacing(1.5),paddingTop:B=>B.spacing(1.5),paddingBottom:B=>B.spacing(1.5),boxSizing:"border-box"},className:de("sxl-table-details-panel",r,{"sxl-has-focus":h}),...s,children:P||e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 auto",flexDirection:"column",transition:"opacity 60ms",opacity:C.table()?1:0},children:[e.jsx(T.Box,{sx:{containerType:"inline-size",display:"flex",flexDirection:"column",maxWidth:"100%",boxSizing:"border-box",paddingTop:B=>B.spacing(2),paddingLeft:B=>B.spacing(2),paddingRight:B=>B.spacing(2)},children:e.jsxs(T.Box,{className:Ul,children:[e.jsx(Vo,{formName:"name",defaultInput:j,value:f?.getName()??"No table",onChangeInput:v,onValidate:B=>{f&&f.getName().toLowerCase()===B.toLowerCase()||C?.getNames().validateName(B)},disabled:f?.isProtected()??!0,onFocus:B=>{u||B.target?.select(),g(!0)}}),e.jsx(_o,{formName:"range",value:x,onChangeInput:E,resolvedAddress:C.getNames().getRanges.bind(C.getNames()),disabled:f?.isProtected()??!0,onFocus:B=>{u||B.target?.select(),g(!0)}})]})}),e.jsxs(T.Box,{sx:{minHeight:"10px",flex:"1 1 100%",display:"flex",flexDirection:"column",containerType:"inline-size",gap:B=>B.spacing(.5),marginTop:B=>B.spacing(1)},children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:B=>B.spacing(1.5),marginBottom:B=>B.spacing(.75)}}),e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",justifyContent:"start",flexDirection:"column",marginTop:B=>B.spacing(1),marginBottom:B=>B.spacing(1)},children:e.jsxs("div",{style:{display:"flex",alignItems:"start",gap:"2px"},children:[e.jsx($o,{table:f,styles:C.styles(),bodyStyle:C.bodyStyle(),cellHeight:30,isLive:!0}),e.jsx(ln,{command:t.getCommand("formatTableStyle"),commands:t,disabledQuickKey:!0})]})}),e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:B=>B.spacing(1.5),marginBottom:B=>B.spacing(.75)}}),e.jsx(Ga,{disabled:f?.isProtected(),styleOptions:f?.getStyleOptions()??null,onStyleOptionsChange:B=>{f.updateStyleOptions(B)},showHeaderRow:f?.getShowHeaders(),onShowHeaderRowChange:B=>{try{f.setShowHeaders(B)}catch(R){c.showError(R)}},showTotalRow:f?.getShowTotals(),onShowTotalRowChange:B=>{try{f.setShowTotals(B)}catch(R){c.showError(R)}},showFilterButton:f?.getFilter()?f.getShowFilterButton():null,onShowFilterButtonChange:B=>{try{f.setShowFilterButton(B)}catch(R){c.showError(R)}}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsxs(T.Box,{className:ql,children:[e.jsx(y.CommandButton,{variant:k.CommandButtonType.Menuitem,command:t.getCommand("convertTableToRange"),commandState:f}),e.jsx(y.CommandButton,{variant:k.CommandButtonType.Menuitem,commandState:f,command:t.getCommand("deleteTable")})]})]})]})})})),Er=(a,l)=>{const{model:o,commands:t,entryKey:r,frame:s,...c}=a;return e.jsx(jr,{ref:l,commands:t,...c})},Tr=()=>{k.DefaultDynamicIconService.register("plugin-table",{icons:{}}),ne.DefaultTaskPaneRegistry.registerTaskPane({key:"tableDetails",getTitle:()=>"Table Details",getIcon:()=>"Table",renderTaskPane:Er},!0)},Ei=n.memo(a=>{const{table:l,tableStyle:o,selectedTableStyleName:t,onSelectTableStyleName:r,styles:s,hasContextMenu:c=!0,bodyStyle:h,parentFloat:i,commands:u,disabled:g,commandHook:b,useCanvasPreview:p=!0,canvas:d,...m}=a,S=n.useCallback(w=>{const j={variant:k.CommandButtonType.Menuitem,commandHook:b,context:"table"},v=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...j,command:u.getCommand("formatTableStyleClearCellStyles"),commandState:o,disabled:g}),e.jsx(y.CommandButton,{...j,style:{fontWeight:550},command:u.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:u.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...j,command:u.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:g||!o||o.isBuiltIn()})]}),E=e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v})});return y.defaultCreatePopupPanel({...w,children:E})},[u]),C=o?.getName()===t,f=n.useMemo(()=>{const w={table:l,tableStyle:o,styles:s,bodyStyle:h};return p?e.jsx(qa,{canvas:d,...w}):e.jsx($o,{...w})},[l,o,s,h]);let x=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:w=>`solid ${C?w.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName()??"None",placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{r?.(o?.getName())},...m,children:f},o.getName());return c&&(x=e.jsx(y.ContextMenu,{label:l.getStyleOptions().name,parentFloat:i,createPopupPanel:S,children:x})),x}),ln=n.memo(n.forwardRef((a,l)=>{const{commands:o,command:t,commandHook:r,selectedTable:s,onSelectTableStyleName:c,disabled:h=!1,bodyStyle:i,disabledQuickKey:u=!1,usePreviewIcon:g=!1,...b}=a;k.useCommand(t);const p=t?.context(),d=p?.styles,m=s??p?.table?.();let S="insertTable";m&&(S="editTable");const C=n.useMemo(()=>((D,F)=>{const M={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new L.Table({initialAnchor:M,styles:F,json:{name:"PreviewTable",ref:M,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:D}})})(m?.getStyleOptions(),d?.()),[d?.().getDefaultTableStyle(),m?.getStyleOptions()]),f=m??C,[x,w]=n.useState(f);n.useEffect(()=>{w(f)},[f]);const j=i??p?.bodyStyle(),v=k.useCallbackRef(D=>{c?.(D),t?.execute({name:D},r)},[t,c,r]),E=n.useRef(null),P=n.useCallback((D,F)=>{const M={onSelectTableStyleName:v,styles:d(),parentFloat:D.floatReference};E.current||(E.current=document.createElement("canvas"));const N=U=>{const H=d().getTableStyle(U);return H?e.jsx(Ei,{table:x,tableStyle:H,selectedTableStyleName:x.getStyleOptions().name,bodyStyle:p.bodyStyle(),commands:F,commandHook:r,canvas:E.current,...M},U):null},z=(U,H,X=!0)=>{const q=[];for(let K=0;K<H.length;K++){const V=N(H[K]);V&&q.push(V)}return q.length===0?null:e.jsxs(T.Box,{children:[X?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:U},U+"-header"),e.jsx(T.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:q},U+"-presets")]},U)},I=[],A=d().getCustomTableStyles(),O=[];if(A.length>0){for(let U=0;U<A.length;U++)A[U].isShownInTableStyles()&&O.push(A[U].getName());I.push(z("Custom",O,!1))}const W=[];m&&!m.getStyleOptions().name&&W.push(null);for(let U=0;U<21;U++)W.push("TableStyleLight"+(U+1));I.push(z("Light",W,O.length>0));const Z=[];for(let U=0;U<28;U++)Z.push("TableStyleMedium"+(U+1));I.push(z("Medium",Z));const J=[];for(let U=0;U<11;U++)J.push("TableStyleDark"+(U+1));I.push(z("Dark",J));let te=null;return m&&(te=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:k.CommandButtonType.Menuitem,command:F.getCommand("formatTableStyleClearTableStyle"),commandHook:r,disabled:h})]})),e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:U=>`${U.shape.borderRadius}px`,paddingBottom:U=>`${U.shape.borderRadius}px`},children:[e.jsx(T.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:I}),te]})},[d,d?.().getTheme(),j,x]),B=h||!t||t.disabled(),R=n.useMemo(()=>{if(!p||!g)return t?.icon()},[x,j,B,t]);return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:u?void 0:S,createPopupPanel:P,commands:o,label:t?.label(),commandState:m,commandHook:r,selected:m!==null,createTooltip:({children:D},F)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:F,children:D}),disabled:B,icon:R,...b})})),Br=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,selectedTheme:r,onSelectTheme:s,disabled:c=!1,darkMode:h,label:i,icon:u,variant:g,...b}=a;k.useCommand(o);const p=o?.context()?.themes,d=r||o?.context()?.theme,m=h??o?.context()?.darkMode,S=c||o?.disabled(),C=k.useCallbackRef(x=>{s?.(x),o?.execute(x,t)},[s,t]),f=n.useCallback((x,w)=>{const{children:j,title:v,...E}=x;let P=x.children;return(S||w)&&(P=e.jsx("div",{children:P})),e.jsx(y.CommandTooltip,{command:o,placement:g===k.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:S||w,...E,children:P})},[o,S]);return e.jsx(er,{ref:l,themes:p,selectedTheme:d,onSelectTheme:C,variant:g===k.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:f,disabled:S,darkMode:m,...b})})),Rr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=k.useCommands(o,["themeMode"])[0],i=k.useCallbackRef((d,m)=>{const S={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...S,command:h}),e.jsx(y.CommandButton,{...S,command:m.getCommand("defaultThemeMode")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...S,command:m.getCommand("enableDarkGrid")}),e.jsx(y.CommandButton,{...S,command:m.getCommand("enableDarkImages")})]});return y.defaultCreatePopupPanel({...d,children:C})},[s,h,t,r]),u=h?.state(),g=T.useMediaQuery("(prefers-color-scheme: dark)"),b=u==="dark"||u===null&&g,p=h?.state()!==null;return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:"themeMode",commands:o,commandHook:t,createPopupPanel:i,label:"Appearance",tooltip:"Change the light/dark mode to match your viewing preference. This does not affect the view for others.",onQuickClick:()=>{h?.execute(b?"light":"dark",t)},selected:p,...c})})),Pr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,sx:c,...h}=a,i=n.useCallback((u,g)=>{const b={variant:k.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(d,m)=>t?.beforeExecute?.(d,m)!==!1&&u.floatReference.closeAll()},disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...b,command:g.getCommand("showKeyboardShortcuts")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...b,command:g.getCommand("gotoUrlGithub")}),e.jsx(y.CommandButton,{...b,command:g.getCommand("gotoUrlDiscord")}),e.jsx(y.CommandButton,{...b,command:g.getCommand("gotoUrlDocumentation")}),e.jsx(y.CommandButton,{...b,command:g.getCommand("gotoUrlIssue")})]});return y.defaultCreatePopupPanel({...u,children:p})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:l,sx:c,commands:o,disabled:s,commandHook:t,scope:r,label:"Help",tooltip:"Help, feedback, and keyboard shortcuts.",createPopupPanel:i,icon:e.jsx(k.DynamicIcon,{iconKey:"Help",style:{transform:"scale(0.75)"}}),...h})})),sn=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,preferSingleMenu:c=!0,showQuickButton:h=!0,variant:i=k.CommandButtonType.Toolbar,...u}=a,g=k.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:b,allDisabled:p}=n.useMemo(()=>{let m=null,S=0;for(let C=0;C<g.length;C++)g[C]&&!g[C]?.disabled()&&(c&&i===k.CommandButtonType.Menuitem&&(m=S===0?g[C]:null),S++);return{singleMenuCommand:m,allDisabled:S===0}},[g]),d=n.useCallback((m,S)=>{const C={variant:k.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,command:S.getCommand("insertImageFromFile")}),e.jsx(y.CommandButton,{...C,command:S.getCommand("insertImageFromURL")})]});return y.defaultCreatePopupPanel({...m,children:f})},[s,t,r]);return b?e.jsx(y.CommandButton,{ref:l,variant:i,commandHook:t,disabled:s,command:b,...u}):e.jsx(y.CommandPopupButton,{ref:l,variant:i,quickCommand:"insertImageFromFile",commands:o,commandHook:t,scope:r,disabled:s||p,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:d,icon:"InsertImage",...u})})),cn=n.memo(n.forwardRef((a,l)=>{const{...o}=a;return e.jsx(y.SimpleCommandPopupButton,{ref:l,...o,popupCommandKeys:["insertFunctionSum","insertFunctionAverage","insertFunctionCount","insertFunctionMax","insertFunctionMin",null,"insertFunction"],quickCommand:"insertFunctionSum",popupScope:"insertFunction",label:"Quick Function",tooltip:"More functions."})}));cn.displayName="InsertFunctionSumCommandPopupButton";const wo=new Map([{key:"financial",label:"Financial",icon:"FormulaFinancial"},{key:"logical",label:"Logical",icon:"FormulaLogical"},{key:"text",label:"Text",icon:"FormulaText"},{key:"dateTime",label:"Date & Time",icon:"FormulaDateTime"},{key:"lookupReference",label:"Lookup & Reference",icon:"FormulaLookupReference"},{key:"mathTrig",label:"Math & Trig",icon:"FormulaMathTrig"},{key:"statDist",label:"Statistical",icon:"FormulaStatistical"},{key:"engineering",label:"Engineering",icon:"FormulaEngineering"},{key:"information",label:"Information",icon:"FormulaInformation"},{key:"cube",label:"Cube",icon:"FormulaCube"},{key:"database",label:"Database",icon:"FormulaDatabase"},{key:"web",label:"Web",icon:"FormulaWeb"},{key:"custom",label:"Custom",icon:"FormulaCustom"}].map(a=>[a.key,a])),Ti=n.memo(a=>{const{command:l,formulaFunction:o,commandHook:t,disabled:r=!1,parentFloat:s,handleInsert:c,icon:h,label:i,sx:u,...g}=a,b=new Promise(p=>{o.getDescriptor().then(d=>{p(d.getSummary())})});return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...u},disabled:r,tooltipProps:{label:b,maxWidth:1e3},onMouseDown:p=>{p.button===0&&p.preventDefault()},onMouseUp:p=>{p.button===0&&c(o)},onKeyDown:p=>{p.keyCode===k.KeyCodes.Enter||(p.keyCode,k.KeyCodes.Space)},...g,children:e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(T.Typography,{component:"div",children:o.getName()})})})}),Mr=n.memo(n.forwardRef((a,l)=>{const{category:o,commands:t,commandHook:r,scope:s,sx:c,disabled:h=!1,parentFloat:i,...u}=a,g=k.useCommands(t,["insertFunction"])[0],b=n.useCallback((d,m)=>{const S=wo.get(o);if(!S)return console.warn("invalidate category",o),null;const C={commandHook:r,...d},f=e.jsx(Bi,{category:S.label,...C,commands:m});return y.defaultCreatePopupPanel({...d,children:f})},[o,g,r,s]),p=wo.get(o);return e.jsx(y.CommandPopupButton,{ref:l,commands:t,commandHook:r,createPopupPanel:b,label:p.label,tooltip:"Insert Function",icon:wo.get(o)?.icon??"FormulaGroup",...u})}));Mr.displayName="InsertFunctionCommandPopupButton";const Bi=n.memo(n.forwardRef((a,l)=>{const{commands:o,category:t,commandHook:r,...s}=a,c=k.useCommands(o,["insertFunction"]),[h,i]=n.useState([]),[u,g]=n.useState(!1);n.useEffect(()=>{(async()=>{g(!0);const C=c[0]?.context(),f=await C.searchByCategory(t);i(f),g(!1)})()},[]);const b=h.length,p=new Array(b),d=o.getCommand("insertFunction"),m=C=>{r?.beforeExecute?.(d,d?.state()),d.execute(C),r?.onExecute?.(d,d?.state())};for(let C=0;C<b;C++){const f=h[C];p[C]=e.jsx(Ti,{command:d,formulaFunction:f,handleInsert:m},`formula-${f.getName()}-${C}`)}const S=e.jsx(T.Box,{ref:l,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:b>0?e.jsx(e.Fragment,{children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:p})}):null});return y.defaultCreatePopupPanel({...s,children:S})})),Dr=n.memo(n.forwardRef((a,l)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoading:c=nn,loadingProps:h,...i}=a;s&&L.LicenseManager.setLicenseKey(s);const u=n.useMemo(()=>c?e.jsx(T.Paper,{sx:o,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...t},children:c({...h})}):null,[o,t,c,h]),g=n.useMemo(()=>n.lazy(async()=>await Promise.resolve().then(()=>is)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:u,children:e.jsx(g,{...i,className:r,renderLoading:c,loadingProps:{...h,transitionDelay:"0ms"},sx:o,style:t,ref:l})})})}));function Fr(a){var l,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a))for(l=0;l<a.length;l++)a[l]&&(o=Fr(a[l]))&&(t&&(t+=" "),t+=o);else for(l in a)a[l]&&(t&&(t+=" "),t+=l);return t}function Ue(){for(var a,l,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(l=Fr(a))&&(t&&(t+=" "),t+=l);return t}Dr.displayName="Studio";let Ri={data:""},Pi=a=>{if(typeof window=="object"){let l=(a?a.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return l.nonce=window.__nonce__,l.parentNode||(a||document.head).appendChild(l),l.firstChild}return a||Ri},Mi=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Di=/\/\*[^]*?\*\/| +/g,la=/\n+/g,Je=(a,l)=>{let o="",t="",r="";for(let s in a){let c=a[s];s[0]=="@"?s[1]=="i"?o=s+" "+c+";":t+=s[1]=="f"?Je(c,s):s+"{"+Je(c,s[1]=="k"?"":l)+"}":typeof c=="object"?t+=Je(c,l?l.replace(/([^,])+/g,h=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,i=>/&/.test(i)?i.replace(/&/g,h):h?h+" "+i:i)):s):c!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=Je.p?Je.p(s,c):s+":"+c+";")}return o+(l&&r?l+"{"+r+"}":r)+t},Ae={},Ir=a=>{if(typeof a=="object"){let l="";for(let o in a)l+=o+Ir(a[o]);return l}return a},Fi=(a,l,o,t,r)=>{let s=Ir(a),c=Ae[s]||(Ae[s]=(i=>{let u=0,g=11;for(;u<i.length;)g=101*g+i.charCodeAt(u++)>>>0;return"go"+g})(s));if(!Ae[c]){let i=s!==a?a:(u=>{let g,b,p=[{}];for(;g=Mi.exec(u.replace(Di,""));)g[4]?p.shift():g[3]?(b=g[3].replace(la," ").trim(),p.unshift(p[0][b]=p[0][b]||{})):p[0][g[1]]=g[2].replace(la," ").trim();return p[0]})(a);Ae[c]=Je(r?{["@keyframes "+c]:i}:i,o?"":"."+c)}let h=o&&Ae.g?Ae.g:null;return o&&(Ae.g=Ae[c]),((i,u,g,b)=>{b?u.data=u.data.replace(b,i):u.data.indexOf(i)===-1&&(u.data=g?i+u.data:u.data+i)})(Ae[c],l,t,h),c};function Do(a){let l=this||{},o=a.call?a(l.p):a;return Fi(o.unshift?o.raw?((t,r,s)=>t.reduce((c,h,i)=>{let u=r[i];if(u&&u.call){let g=u(s),b=g&&g.props&&g.props.className||/^go/.test(g)&&g;u=b?"."+b:g&&typeof g=="object"?g.props?"":Je(g,""):g===!1?"":g}return c+h+(u??"")},""))(o,[].slice.call(arguments,1),l.p):o.reduce((t,r)=>Object.assign(t,r&&r.call?r(l.p):r),{}):o,Pi(l.target),l.g,l.o,l.k)}function Nr(a,l,o){return l&&(function(t,r){for(var s=0;s<r.length;s++){var c=r[s];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(t,c.key,c)}})(a.prototype,l),a}function ue(){return ue=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var o=arguments[l];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},ue.apply(this,arguments)}function Or(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,a.__proto__=l}function It(a,l){if(a==null)return{};var o,t,r={},s=Object.keys(a);for(t=0;t<s.length;t++)o=s[t],l.indexOf(o)>=0||(r[o]=a[o]);return r}function ia(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}Do.bind({g:1}),Do.bind({k:1});var sa=function(){return""},Ar=n.createContext({enqueueSnackbar:sa,closeSnackbar:sa}),ko="@media (max-width:599.95px)",Qt="@media (min-width:600px)",ca=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},dn=function(a){return""+ca(a.vertical)+ca(a.horizontal)},_t=function(a){return!!a||a===0},Kt="unmounted",nt="exited",at="entering",jt="entered",da="exiting",un=(function(a){function l(t){var r;r=a.call(this,t)||this;var s,c=t.appear;return r.appearStatus=null,t.in?c?(s=nt,r.appearStatus=at):s=jt:s=t.unmountOnExit||t.mountOnEnter?Kt:nt,r.state={status:s},r.nextCallback=null,r}Or(l,a),l.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Kt?{status:nt}:null};var o=l.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(t){var r=null;if(t!==this.props){var s=this.state.status;this.props.in?s!==at&&s!==jt&&(r=at):s!==at&&s!==jt||(r=da)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t=this.props.timeout,r=t,s=t;return t!=null&&typeof t!="number"&&typeof t!="string"&&(s=t.exit,r=t.enter),{exit:s,enter:r}},o.updateStatus=function(t,r){t===void 0&&(t=!1),r!==null?(this.cancelNextCallback(),r===at?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===nt&&this.setState({status:Kt})},o.performEnter=function(t){var r=this,s=this.props.enter,c=t,h=this.getTimeouts();t||s?(this.props.onEnter&&this.props.onEnter(this.node,c),this.safeSetState({status:at},function(){r.props.onEntering&&r.props.onEntering(r.node,c),r.onTransitionEnd(h.enter,function(){r.safeSetState({status:jt},function(){r.props.onEntered&&r.props.onEntered(r.node,c)})})})):this.safeSetState({status:jt},function(){r.props.onEntered&&r.props.onEntered(r.node,c)})},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts();r?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:da},function(){t.props.onExiting&&t.props.onExiting(t.node),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:nt},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:nt},function(){t.props.onExited&&t.props.onExited(t.node)})},o.cancelNextCallback=function(){this.nextCallback!==null&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(){s&&(s=!1,r.nextCallback=null,t())},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=t==null&&!this.props.addEndListener;this.node&&!s?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),t!=null&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Kt)return null;var r=this.props;return(0,r.children)(t,It(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Nr(l,[{key:"node",get:function(){var t,r=(t=this.props.nodeRef)===null||t===void 0?void 0:t.current;if(!r)throw new Error("notistack - Custom snackbar is not refForwarding");return r}}]),l})(n.Component);function rt(){}function ua(a,l){typeof a=="function"?a(l):a&&(a.current=l)}function Fo(a,l){return n.useMemo(function(){return a==null&&l==null?null:function(o){ua(a,o),ua(l,o)}},[a,l])}function to(a){var l=a.timeout,o=a.style,t=o===void 0?{}:o,r=a.mode;return{duration:typeof l=="object"?l[r]||0:l,easing:t.transitionTimingFunction,delay:t.transitionDelay}}un.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:rt,onEntering:rt,onEntered:rt,onExit:rt,onExiting:rt,onExited:rt};var Ii="cubic-bezier(0.4, 0, 0.2, 1)",Ni="cubic-bezier(0.0, 0, 0.2, 1)",Oi="cubic-bezier(0.4, 0, 0.6, 1)",Lr=function(a){a.scrollTop=a.scrollTop},ma=function(a){return Math.round(a)+"ms"};function dt(a,l){a===void 0&&(a=["all"]);var o=l||{},t=o.duration,r=t===void 0?300:t,s=o.easing,c=s===void 0?Ii:s,h=o.delay,i=h===void 0?0:h;return(Array.isArray(a)?a:[a]).map(function(u){var g=typeof r=="string"?r:ma(r),b=typeof i=="string"?i:ma(i);return u+" "+g+" "+c+" "+b}).join(",")}function zr(a){var l=(function(o){return o&&o.ownerDocument||document})(a);return l.defaultView||window}function Ut(a,l){if(l){var o=(function(t,r){var s,c=r.getBoundingClientRect(),h=zr(r);if(r.fakeTransform)s=r.fakeTransform;else{var i=h.getComputedStyle(r);s=i.getPropertyValue("-webkit-transform")||i.getPropertyValue("transform")}var u=0,g=0;if(s&&s!=="none"&&typeof s=="string"){var b=s.split("(")[1].split(")")[0].split(",");u=parseInt(b[4],10),g=parseInt(b[5],10)}switch(t){case"left":return"translateX("+(h.innerWidth+u-c.left)+"px)";case"right":return"translateX(-"+(c.left+c.width-u)+"px)";case"up":return"translateY("+(h.innerHeight+g-c.top)+"px)";default:return"translateY(-"+(c.top+c.height-g)+"px)"}})(a,l);o&&(l.style.webkitTransform=o,l.style.transform=o)}}var Hr=n.forwardRef(function(a,l){var o=a.children,t=a.direction,r=t===void 0?"down":t,s=a.in,c=a.style,h=a.timeout,i=h===void 0?0:h,u=a.onEnter,g=a.onEntered,b=a.onExit,p=a.onExited,d=It(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),m=n.useRef(null),S=Fo(o.ref,m),C=Fo(S,l),f=n.useCallback(function(){m.current&&Ut(r,m.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var x=(function(j,v){var E;function P(){for(var B=this,R=arguments.length,D=new Array(R),F=0;F<R;F++)D[F]=arguments[F];clearTimeout(E),E=setTimeout(function(){j.apply(B,D)},v)}return v===void 0&&(v=166),P.clear=function(){clearTimeout(E)},P})(function(){m.current&&Ut(r,m.current)}),w=zr(m.current);return w.addEventListener("resize",x),function(){x.clear(),w.removeEventListener("resize",x)}}},[r,s]),n.useEffect(function(){s||f()},[s,f]),n.createElement(un,Object.assign({appear:!0,nodeRef:m,onEnter:function(x,w){Ut(r,x),Lr(x),u&&u(x,w)},onEntered:g,onEntering:function(x){var w=c?.transitionTimingFunction||Ni,j=to({timeout:i,mode:"enter",style:ue({},c,{transitionTimingFunction:w})});x.style.webkitTransition=dt("-webkit-transform",j),x.style.transition=dt("transform",j),x.style.webkitTransform="none",x.style.transform="none"},onExit:function(x){var w=c?.transitionTimingFunction||Oi,j=to({timeout:i,mode:"exit",style:ue({},c,{transitionTimingFunction:w})});x.style.webkitTransition=dt("-webkit-transform",j),x.style.transition=dt("transform",j),Ut(r,x),b&&b(x)},onExited:function(x){x.style.webkitTransition="",x.style.transition="",p&&p(x)},in:s,timeout:i},d),function(x,w){return n.cloneElement(o,ue({ref:C,style:ue({visibility:x!=="exited"||s?void 0:"hidden"},c,{},o.props.style)},w))})});Hr.displayName="Slide";var lo=function(a){return n.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},a))},Ai=function(){return n.createElement(lo,null,n.createElement("path",{d:`M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41
|
|
15
|
+
10.59L10 14.17L17.59 6.58L19 8L10 17Z`}))},Li=function(){return n.createElement(lo,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},zi=function(){return n.createElement(lo,null,n.createElement("path",{d:`M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,
|
|
16
|
+
6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,
|
|
17
|
+
13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z`}))},Hi=function(){return n.createElement(lo,null,n.createElement("path",{d:`M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,
|
|
18
|
+
0 22,12A10,10 0 0,0 12,2Z`}))},Qe={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Ai,null),warning:n.createElement(Li,null),error:n.createElement(zi,null),info:n.createElement(Hi,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:Hr,transitionDuration:{enter:225,exit:195}},Wi=function(a,l){return function(o,t){return t===void 0&&(t=!1),t?ue({},Qe[o],{},l[o],{},a[o]):o==="autoHideDuration"?(r=a.autoHideDuration,s=l.autoHideDuration,(c=function(h){return typeof h=="number"||h===null})(r)?r:c(s)?s:Qe.autoHideDuration):o==="transitionDuration"?(function(h,i){var u=function(g,b){return b.some(function(p){return typeof g===p})};return u(h,["string","number"])?h:u(h,["object"])?ue({},Qe.transitionDuration,{},u(i,["object"])&&i,{},h):u(i,["string","number"])?i:u(i,["object"])?ue({},Qe.transitionDuration,{},i):Qe.transitionDuration})(a.transitionDuration,l.transitionDuration):a[o]||l[o]||Qe[o];var r,s,c}};function Nt(a){return Object.entries(a).reduce(function(l,o){var t,r=o[0],s=o[1];return ue({},l,((t={})[r]=Do(s),t))},{})}var $i="notistack-SnackbarContainer",Vi="notistack-Snackbar",Wr="notistack-CollapseWrapper",_i="notistack-MuiContent",Ki=function(a){return"notistack-MuiContent-"+a},pa=Nt({root:{height:0},entered:{height:"auto"}}),vo="0px",$r=n.forwardRef(function(a,l){var o=a.children,t=a.in,r=a.onExited,s=n.useRef(null),c=n.useRef(null),h=Fo(l,c),i=function(){return s.current?s.current.clientHeight:0};return n.createElement(un,{in:t,unmountOnExit:!0,onEnter:function(u){u.style.height=vo},onEntered:function(u){u.style.height="auto"},onEntering:function(u){var g=i(),b=to({timeout:175,mode:"enter"}),p=b.duration,d=b.easing;u.style.transitionDuration=typeof p=="string"?p:p+"ms",u.style.height=g+"px",u.style.transitionTimingFunction=d||""},onExit:function(u){u.style.height=i()+"px"},onExited:r,onExiting:function(u){Lr(u);var g=to({timeout:175,mode:"exit"}),b=g.duration,p=g.easing;u.style.transitionDuration=typeof b=="string"?b:b+"ms",u.style.height=vo,u.style.transitionTimingFunction=p||""},nodeRef:c,timeout:175},function(u,g){return n.createElement("div",Object.assign({ref:h,className:Ue(pa.root,u==="entered"&&pa.entered),style:ue({pointerEvents:"all",overflow:"hidden",minHeight:vo,transition:dt("height")},u==="entered"&&{overflow:"visible"},{},u==="exited"&&!t&&{visibility:"hidden"})},g),n.createElement("div",{ref:s,className:Wr,style:{display:"flex",width:"100%"}},o))})});$r.displayName="Collapse";var fa={right:"left",left:"right",bottom:"up",top:"down"},Ui=function(a){return"anchorOrigin"+dn(a)},qi=function(){};function Mt(a,l){return a.reduce(function(o,t){return t==null?o:function(){for(var r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];var h=[].concat(s);l&&h.indexOf(l)===-1&&h.push(l),o.apply(this,h),t.apply(this,h)}},qi)}var Gi=typeof window<"u"?n.useLayoutEffect:n.useEffect;function ha(a){var l=n.useRef(a);return Gi(function(){l.current=a}),n.useCallback(function(){return l.current.apply(void 0,arguments)},[])}var jo,Vr=n.forwardRef(function(a,l){var o=a.children,t=a.className,r=a.autoHideDuration,s=a.disableWindowBlurListener,c=s!==void 0&&s,h=a.onClose,i=a.id,u=a.open,g=a.SnackbarProps,b=g===void 0?{}:g,p=n.useRef(),d=ha(function(){h&&h.apply(void 0,arguments)}),m=ha(function(f){h&&f!=null&&(p.current&&clearTimeout(p.current),p.current=setTimeout(function(){d(null,"timeout",i)},f))});n.useEffect(function(){return u&&m(r),function(){p.current&&clearTimeout(p.current)}},[u,r,m]);var S=function(){p.current&&clearTimeout(p.current)},C=n.useCallback(function(){r!=null&&m(.5*r)},[r,m]);return n.useEffect(function(){if(!c&&u)return window.addEventListener("focus",C),window.addEventListener("blur",S),function(){window.removeEventListener("focus",C),window.removeEventListener("blur",S)}},[c,C,u]),n.createElement("div",Object.assign({ref:l},b,{className:Ue(Vi,t),onMouseEnter:function(f){b.onMouseEnter&&b.onMouseEnter(f),S()},onMouseLeave:function(f){b.onMouseLeave&&b.onMouseLeave(f),C()}}),o)});Vr.displayName="Snackbar";var Xi=Nt({root:(jo={display:"flex",flexWrap:"wrap",flexGrow:1},jo[Qt]={flexGrow:"initial",minWidth:"288px"},jo)}),mn=n.forwardRef(function(a,l){var o=a.className,t=It(a,["className"]);return n.createElement("div",Object.assign({ref:l,className:Ue(Xi.root,o)},t))});mn.displayName="SnackbarContent";var Et=Nt({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),ga="notistack-snackbar",_r=n.forwardRef(function(a,l){var o=a.id,t=a.message,r=a.action,s=a.iconVariant,c=a.variant,h=a.hideIconVariant,i=a.style,u=a.className,g=s[c],b=r;return typeof b=="function"&&(b=b(o)),n.createElement(mn,{ref:l,role:"alert","aria-describedby":ga,style:i,className:Ue(_i,Ki(c),Et.root,Et[c],u,!h&&g&&Et.lessPadding)},n.createElement("div",{id:ga,className:Et.message},h?null:g,t),b&&n.createElement("div",{className:Et.action},b))});_r.displayName="MaterialDesignContent";var Tt,Eo,qt,Gt,To,Yi=n.memo(_r),Zi=Nt({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Qi=function(a){var l=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=Mt([a.snack.onClose,a.onClose]),c=n.useCallback(function(){l.current=setTimeout(function(){r(function(B){return!B})},125)},[]);n.useEffect(function(){return function(){l.current&&clearTimeout(l.current)}},[]);var h,i=a.snack,u=a.classes,g=a.Component,b=g===void 0?Yi:g,p=n.useMemo(function(){return(function(B){B===void 0&&(B={});var R={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(B).filter(function(D){return!R[D]}).reduce(function(D,F){var M;return ue({},D,((M={})[F]=B[F],M))},{})})(u)},[u]),d=i.open,m=i.SnackbarProps,S=i.TransitionComponent,C=i.TransitionProps,f=i.transitionDuration,x=i.disableWindowBlurListener,w=i.content,j=It(i,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=ue({direction:(h=j.anchorOrigin,h.horizontal!=="center"?fa[h.horizontal]:fa[h.vertical]),timeout:f},C),E=w;typeof E=="function"&&(E=E(j.id,j.message));var P=["onEnter","onEntered","onExit","onExited"].reduce(function(B,R){var D;return ue({},B,((D={})[R]=Mt([a.snack[R],a[R]],j.id),D))},{});return n.createElement($r,{in:t,onExited:P.onExited},n.createElement(Vr,{open:d,id:j.id,disableWindowBlurListener:x,autoHideDuration:j.autoHideDuration,className:Ue(Zi.wrappedRoot,p.root,p[Ui(j.anchorOrigin)]),SnackbarProps:m,onClose:s},n.createElement(S,Object.assign({},v,{appear:!0,in:d,onExit:P.onExit,onExited:c,onEnter:P.onEnter,onEntered:Mt([P.onEntered,function(){a.snack.requestClose&&s(null,"instructed",a.snack.id)}],j.id)}),E||n.createElement(b,Object.assign({},j)))))},Bt={default:20},Xt={default:6,dense:2},xa="."+Wr,Yt=Nt({root:(Tt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:dt(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Tt[xa]={padding:Xt.default+"px 0px",transition:"padding 300ms ease 0ms"},Tt.maxWidth="calc(100% - "+2*Bt.default+"px)",Tt[ko]={width:"100%",maxWidth:"calc(100% - 32px)"},Tt),rootDense:(Eo={},Eo[xa]={padding:Xt.dense+"px 0px"},Eo),top:{top:Bt.default-Xt.default+"px",flexDirection:"column"},bottom:{bottom:Bt.default-Xt.default+"px",flexDirection:"column-reverse"},left:(qt={left:Bt.default+"px"},qt[Qt]={alignItems:"flex-start"},qt[ko]={left:"16px"},qt),right:(Gt={right:Bt.default+"px"},Gt[Qt]={alignItems:"flex-end"},Gt[ko]={right:"16px"},Gt),center:(To={left:"50%",transform:"translateX(-50%)"},To[Qt]={alignItems:"center"},To)}),Ji=function(a){var l=a.classes,o=l===void 0?{}:l,t=a.anchorOrigin,r=a.dense,s=a.children,c=Ue($i,Yt[t.vertical],Yt[t.horizontal],Yt.root,o.containerRoot,o["containerAnchorOrigin"+dn(t)],r&&Yt.rootDense);return n.createElement("div",{className:c},s)},es=n.memo(Ji),ba=function(a){return!(typeof a=="string"||n.isValidElement(a))},ts=(function(a){function l(o){var t;return(t=a.call(this,o)||this).enqueueSnackbar=function(r,s){if(s===void 0&&(s={}),r==null)throw new Error("enqueueSnackbar called with invalid argument");var c=ba(r)?r:s,h=ba(r)?r.message:r,i=c.key,u=c.preventDuplicate,g=It(c,["key","preventDuplicate"]),b=_t(i),p=b?i:new Date().getTime()+Math.random(),d=Wi(g,t.props),m=ue({id:p},g,{message:h,open:!0,entered:!1,requestClose:!1,persist:d("persist"),action:d("action"),content:d("content"),variant:d("variant"),anchorOrigin:d("anchorOrigin"),disableWindowBlurListener:d("disableWindowBlurListener"),autoHideDuration:d("autoHideDuration"),hideIconVariant:d("hideIconVariant"),TransitionComponent:d("TransitionComponent"),transitionDuration:d("transitionDuration"),TransitionProps:d("TransitionProps",!0),iconVariant:d("iconVariant",!0),style:d("style",!0),SnackbarProps:d("SnackbarProps",!0),className:Ue(t.props.className,g.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState(function(S){if(u===void 0&&t.props.preventDuplicate||u){var C=function(w){return b?w.id===p:w.message===h},f=S.queue.findIndex(C)>-1,x=S.snacks.findIndex(C)>-1;if(f||x)return S}return t.handleDisplaySnack(ue({},S,{queue:[].concat(S.queue,[m])}))}),p},t.handleDisplaySnack=function(r){return r.snacks.length>=t.maxSnack?t.handleDismissOldest(r):t.processQueue(r)},t.processQueue=function(r){var s=r.queue,c=r.snacks;return s.length>0?ue({},r,{snacks:[].concat(c,[s[0]]),queue:s.slice(1,s.length)}):r},t.handleDismissOldest=function(r){if(r.snacks.some(function(i){return!i.open||i.requestClose}))return r;var s=!1,c=!1;r.snacks.reduce(function(i,u){return i+(u.open&&u.persist?1:0)},0)===t.maxSnack&&(c=!0);var h=r.snacks.map(function(i){return s||i.persist&&!c?ue({},i):(s=!0,i.entered?(i.onClose&&i.onClose(null,"maxsnack",i.id),t.props.onClose&&t.props.onClose(null,"maxsnack",i.id),ue({},i,{open:!1})):ue({},i,{requestClose:!0}))});return ue({},r,{snacks:h})},t.handleEnteredSnack=function(r,s,c){if(!_t(c))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(h){return{snacks:h.snacks.map(function(i){return i.id===c?ue({},i,{entered:!0}):ue({},i)})}})},t.handleCloseSnack=function(r,s,c){t.props.onClose&&t.props.onClose(r,s,c);var h=c===void 0;t.setState(function(i){var u=i.snacks,g=i.queue;return{snacks:u.map(function(b){return h||b.id===c?b.entered?ue({},b,{open:!1}):ue({},b,{requestClose:!0}):ue({},b)}),queue:g.filter(function(b){return b.id!==c})}})},t.closeSnackbar=function(r){var s=t.state.snacks.find(function(c){return c.id===r});_t(r)&&s&&s.onClose&&s.onClose(null,"instructed",r),t.handleCloseSnack(null,"instructed",r)},t.handleExitedSnack=function(r,s){if(!_t(s))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState(function(c){var h=t.processQueue(ue({},c,{snacks:c.snacks.filter(function(i){return i.id!==s})}));return h.queue.length===0?h:t.handleDismissOldest(h)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(ia(t)),closeSnackbar:t.closeSnackbar.bind(ia(t))}},t}return Or(l,a),l.prototype.render=function(){var o=this,t=this.state.contextValue,r=this.props,s=r.domRoot,c=r.children,h=r.dense,i=h!==void 0&&h,u=r.Components,g=u===void 0?{}:u,b=r.classes,p=this.state.snacks.reduce(function(m,S){var C,f=dn(S.anchorOrigin),x=m[f]||[];return ue({},m,((C={})[f]=[].concat(x,[S]),C))},{}),d=Object.keys(p).map(function(m){var S=p[m],C=S[0];return n.createElement(es,{key:m,dense:i,anchorOrigin:C.anchorOrigin,classes:b},S.map(function(f){return n.createElement(Qi,{key:f.id,snack:f,classes:b,Component:g[f.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:Mt([o.handleExitedSnack,o.props.onExited],f.id),onEntered:Mt([o.handleEnteredSnack,o.props.onEntered],f.id)})}))});return n.createElement(Ar.Provider,{value:t},c,s?et.createPortal(d,s):d)},Nr(l,[{key:"maxSnack",get:function(){return this.props.maxSnack||Qe.maxSnack}}]),l})(n.Component),Kr=function(){return n.useContext(Ar)};class Ur{constructor(){this._loadedIO=null}async _loadIO(){let l=this._loadedIO;if(l)return l;try{l=(await import("@sheetxl/io")).WorkbookIO,this._loadedIO=l}catch(o){throw o}return l}async getReadFormats(l){return(await this._loadIO()).getReadFormats(l)}async getWriteFormats(l){return(await this._loadIO()).getWriteFormats(l)}async writeArrayBuffer(l,o){return(await this._loadIO()).writeArrayBuffer(l,o)}async read(l,o){let t,r;try{r=await o?.showBusy?.(`Opening${l.name?` ${l.name}`:""}...`);const s=await this._loadIO(),c=await s.read({...l,progress:{async onStart(h){await l?.progress?.onStart?.(h),t=await o?.showBusy?.(`Opening '${h.name}'...`)}}});return r?.(),t?.(),c}catch(s){throw r?.(),t?.(),s}}async writeFile(l,o,t){return(await this._loadIO()).writeFile(l,o,t)}async registerReadFormat(l){return(await this._loadIO()).registerReadFormat(l)}async registerWriteFormat(l){return(await this._loadIO()).registerWriteFormat(l)}async getAllReadFormatsAsString(){const l=await this._loadIO(),o=await l.getReadFormats(),t=[],r=o.length;for(let s=0;s<r;s++){const c=o[s].exts,h=c.length;for(let i=0;i<h;i++)t.push("."+c[i])}return t.join(", ")}}const Ve=new Ur,Le={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},qr=n.memo(n.forwardRef((a,l)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:c,...h}=a,{closeSnackbar:i}=Kr(),u=G.useTheme(),[g,b]=n.useState(!1),p=ve.ErrorUtils.collectErrorChain(s,!0)?.[0]?.error,d=p&&!(p instanceof ve.ExpectedError),m=n.useCallback(()=>{b(f=>!f)},[]),S=n.useCallback(()=>{i(o)},[o,i]);let C=p?.message;return!C&&n.isValidElement(t)&&(C=t),C||typeof t!="string"||(C=t),C||(C=`Unknown Error: ${t}`),e.jsx(mn,{ref:l,className:de(Le.root,"error-snackbar"),children:e.jsxs(T.Card,{className:Le.card,style:{backgroundColor:u.palette.error.dark,border:`1px solid ${u.palette.error.dark}`},children:[e.jsxs(T.CardActions,{className:Le.actionRoot,children:[c?null:r?.error,e.jsx(T.Typography,{variant:"body2",component:"div",className:Le.typography,children:C}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Le.icons,children:[d?e.jsx(T.IconButton,{"aria-label":"Show more",size:"small",className:de(Le.expand,{[Le.expandOpen]:g}),onClick:m,children:e.jsx(k.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(T.IconButton,{size:"small",className:Le.expand,onClick:S,children:e.jsx(k.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),d?e.jsx(T.Collapse,{in:g,timeout:"auto",children:e.jsx("div",{className:Le.stackTraceContainer,style:{backgroundColor:u.palette.error.light,borderTop:`1px solid ${u.palette.error.main}`},children:e.jsx(y.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})}));qr.displayName="ToastError";const Gr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r="workbook",disabled:s=!1,...c}=a,[h,i]=n.useState([]);n.useEffect(()=>{let b=!0;return Ve.getWriteFormats().then(p=>{b&&i(p)}),()=>{b=!1}},[]);const u=k.useCallbackRef(b=>{const p={variant:k.CommandButtonType.Menuitem,parentFloat:b.floatReference,commandHook:t,scope:r,disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:o.getCommand("newWorkbook")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:o.getCommand("openWorkbook")}),e.jsx(y.CommandPopupButton,{...p,commands:o,quickCommand:"saveWorkbook",createPopupPanel:m=>{const S={...p,parentFloat:m.floatReference,scope:"saveWorkbook"},C=[];return h.forEach(f=>{if(f.isDefault)return;const x=f.key,w=o.getCommand(`saveWorkbookAs${x}`);w?C.push(n.createElement(y.CommandButton,{...S,key:x,command:w})):console.warn(`Unable to resolve command: 'saveWorkbookAs${x}'`)}),y.defaultCreatePopupPanel({...m,children:C,onClick:()=>{m.closeFloatAll()}})}})]});return y.defaultCreatePopupPanel({...b,children:d,onClick:m=>{m.isDefaultPrevented||b.closeFloatAll()}})},[s,o,t,r,h]),g="File";return e.jsx(y.CommandPopupButton,{commands:o,disabled:s,commandHook:t,scope:r,label:g,tooltip:"Options for saving and loading the workbook.",sx:{paddingBottom:"0px","& button":{paddingTop:"0px",paddingBottom:"0px",height:b=>`calc(1.25rem + ${b.spacing(2)}px)`}},...c,createPopupPanel:u,icon:e.jsx(y.LabelIcon,{className:"label",icon:null,label:g})})}));Gr.displayName="StandaloneFileCommandButton";const os=e.jsx(y.ExhibitTooltip,{label:"SheetXL",description:"Visit me at sheetxl.com.",children:e.jsx(T.Box,{sx:{width:"24px",height:"24px",marginBottom:"4px",marginLeft:"6px"},children:e.jsx(ne.LogoNoPaddingIcon,{onClick:()=>{window?.open("https://www.sheetxl.com","_blank")},style:{width:"24px",height:"24px",cursor:"pointer"}})})}),Xr=n.memo(n.forwardRef((a,l)=>{const{commands:o,workbook:t,logo:r=os,mainElement:s,showFileMenu:c=!0,showAppearanceMenu:h=!0,...i}=a,{reference:u}=y.useFloatStack(),[g,{width:b}]=_e(),p=b<530,d=c?e.jsx(Gr,{commands:o,commandHook:{beforeExecute(){u?.closeAll()},onError(f,x,w){}}}):null,m=h?e.jsx(Rr,{commands:o,commandHook:{beforeExecute(){u?.closeAll()},onError(f,x,w){}}}):null,S=n.useMemo(()=>({paddingLeft:f=>f.spacing(1),paddingRight:f=>f.spacing(1)}),[]),C=n.useRef(null);return e.jsx(T.Box,{ref:Ke([C,g,l]),...i,children:Sr({commands:o,renderCompact:p,workbook:t,selectWrapper:f=>e.jsxs(T.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:x=>x.spacing(1),paddingLeft:x=>x.spacing(1),paddingRight:x=>x.spacing(1)},children:[e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:x=>x.spacing(.5)},children:[r,e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:x=>x.spacing(.25)},children:[d,f]})]}),e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:s}),e.jsx(T.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:p&&!m?"0 0 auto":"1 1 100%"},children:m})]}),selectProps:S,toolbarsProps:{Home:{sx:{}}}})})}));Xr.displayName="StudioToolbar";const ns=()=>{window.open(window.origin.toString(),"sheetxl-"+ve.CommonUtils.uuidV4(),"popup=true")},Yr=n.memo(a=>{const{workbook:l,setWorkbook:o,refWorkbookTitle:t,titleWorkbook:r,setWorkbookTitle:s,titlePlaceHolder:c,children:h,undoManager:i,commands:u,importExportDisabled:g,themeOptions:b}=a,p=(S=>{const{workbook:C,setWorkbook:f,importExportDisabled:x,workbookTitle:w="export",setWorkbookTitle:j,requestWorkbookTitle:v,themeOptions:E,undoManager:P,commands:B,onExecute:R}=S,D=k.useNotifier(),F=k.useCallbackRef(E?.onModeChange,[E?.onModeChange]),M=k.useCallbackRef(E?.onEnabledDarkGridChange,[E?.onEnabledDarkGridChange]),N=k.useCallbackRef(E?.onEnabledDarkImagesChange,[E?.onEnabledDarkImagesChange]),z=k.useCallbackRef(async(q=null,K=null,V=null)=>{const oe=[];let le,ie=null,ae=null;if(typeof q=="string"?ae=q:ie=q,le=ie?q:await ve.CommonUtils.openFileDialog(ae??await Ve.getAllReadFormatsAsString()),!le)return null;const Ce={source:le,typedCreateWorkbookOptions:K,progress:{onWarning:Y=>{oe.push(Y)}}};V&&(Ce.progress.onStart=V);const he=await Ve.read(Ce,D);return oe.length>0&&(D.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
|
|
19
|
+
`+oe.join(`
|
|
20
|
+
`))),he},[R,D,C]),I=k.useCallbackRef(async(q,K,V)=>{if(!K&&v){const oe=await v("Enter Workbook name to "+(V?.isDefault?"Save.":`Export as ${V?.description}.`));return oe!==null&&Ve.writeFile(oe,q,{format:V.key})}return Ve.writeFile(K,q,{format:V.key})},[D,C,v]),A=n.useCallback(()=>({contains:q=>!0,focus(){}}),[]),[O,W]=n.useState([]);n.useEffect(()=>{x?W([]):(async()=>{const q=[];(await Ve.getWriteFormats()).forEach(K=>{const V=K.isDefault,oe={label:V?"Save Workbook":`Save Workbook as ${K.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${K.description}`},tags:K.tags,description:`Save the workbook to the desktop${V?"":` as ${K.description}`}.`,icon:"FileDownloadAsSheet"};V&&(oe.shortcut={key:"S",modifiers:[k.KeyModifiers.Ctrl]},q.push(new k.Command("saveWorkbookAs",A,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[k.KeyModifiers.Shift,k.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{I(C,null,K).catch(ae=>{D.showError(ae)})})));const le=K.key,ie=V?"saveWorkbook":`saveWorkbookAs${le}`;le==="CSV"?oe.icon="FileDownloadAsCSV":le==="Excel"&&(oe.icon="FileDownloadAsExcel"),q.push(new k.Command(ie,A,oe,ae=>{I(C,ae??w,K).catch(Ce=>{D.showError(Ce)})}))}),q.push(new k.Command("openWorkbook",A,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",icon:"FileOpen",shortcut:{key:"O",modifiers:[k.KeyModifiers.Ctrl]}},async(K=null)=>{const V={csv:{date1904:C.isDate1904(),...C.options}};try{let oe,le=null;const ie=async he=>{le=he.format,oe=he.name},ae=await z(K,V,ie);if(!ae)return;const Ce=ae.getSelectedSheet();if(le.mimeType==="text/csv"){const he=C.findValidSheetName(oe);await C.doBatch(async()=>{const Y={colStart:0,rowStart:0,colEnd:0,rowEnd:0};let _=Ce.getUsedRange();if(!_)return void D.showMessage("The file appears to be blank.");_=_.getUnion(Y),await C.getSheets().add({name:he,autoSelect:!0}).getRange(Y).copyFrom(_)},`Import CSV '${he}'`)}else C?.close(),j?.(ae.getName()??""),f(ae)}catch(oe){D.showError(oe)}})),q.push(new k.Command("openWorkbookFromUrl",A,{label:"Open Workbook From Web",scopedLabels:{insert:"From Web",workbook:"From Web…"},description:"Open a workbook from the web."},async function(K){if(!K){const V=await D.showInput({title:"Open Workbook from the Web",description:"Enter the web address for the workbook to open.",inputLabel:"Address",initialValue:"https://www.sheetxl.com/examples/features-checklist.xlsx",inputProps:{style:{minWidth:"440px"}},options:["Open"]});if(V.option!=="Open")return;K=V.input}K&&console.log("openWorkbookFromUrl",K)})),q.push(new k.SimpleCommand("closeWorkbook",A,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[k.KeyModifiers.Ctrl,k.KeyModifiers.Alt]}},async function(){await D.showOptions({title:"Confirm",description:"This will close the current workbook tab. Do you want to continue?",options:["Close","Cancel"],defaultOption:"Close"})==="Close"&&window.close()})),q.push(new k.SimpleCommand("newWorkbook",A,{label:"New Workbook",description:"Create a new workbook in another tab.",icon:"FileNew"},async function(){ns()})),W(q)})()},[x,D,C,w]);const Z=n.useMemo(()=>{let q=[];return E&&(q=[new k.Command("themeMode",A,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new k.Command("defaultThemeMode",A,{label:"Use System Light/Dark Mode",scopedLabels:{appearance:"Use System Default"},description:"Use the system settings to determine styling for light and dark mode."}),new k.Command("enableDarkGrid",A,{label:"Enable Dark Grid",description:"Allow the grid to render in dark mode if dark mode is being used. This is ensures that the grid will render the colors as specified in another tools (for example Excel)."}),new k.Command("enableDarkImages",A,{label:"Enable Dark Images",description:"Allow the images to render in dark mode if dark mode is being used. This is ensures that the images will render the colors as specified in another tools (for example Excel). This only has any effect if the grid is in dark mode."})]),[...q,new k.SimpleCommand("help",A,{label:"Show Help",description:"Provide Help.",icon:"Documentation",shortcut:{key:"F1"}},()=>{}),new k.SimpleCommand("showKeyboardShortcuts",A,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",icon:"Keyboard",shortcut:{key:"/",modifiers:[k.KeyModifiers.Ctrl]}},()=>{}),new k.Command("gotoUrlGithub",A,{label:"Github",description:"Download examples, explore source code, and leave a star.",icon:"Github"},()=>{window?.open("https://github.com/sheetxl/sheetxl")}),new k.Command("gotoUrlDiscord",A,{label:"Discord",description:"Join our community on discord.",icon:"Discord"},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new k.Command("gotoUrlDocumentation",A,{label:"Documentation",description:"Read the documentation.",icon:"Documentation"},()=>{window?.open("https://www.sheetxl.com/docs")}),new k.Command("gotoUrlIssue",A,{label:"Create Issue",description:"Create an issue to identify a bug or a feature request.",icon:"Ticket"},()=>{window?.open("https://github.com/sheetxl/sheetxl/issues")})]},[C,w,D,x,E]),J=n.useMemo(()=>[...Z,...O],[Z,O]),te=n.useMemo(()=>{let q=null;return q=B?B.createChildGroup(A,"standaloneWorkbook",!1):new k.CommandGroup(A,"standaloneWorkbook"),q.addCommands(J,!0),q},[B,Z,O]);k.useUndoManager({manager:P,commands:te});const U=T.useMediaQuery("(prefers-color-scheme: dark)"),{themeMode:H}=y.useResolvedThemeMode();n.useEffect(()=>{if(!E||!te)return;const q=E.mode==="dark"||!E.mode&&H==="dark";te.getCommand("themeMode").update({state:E.mode??null,label:q?"Dark Mode":"Light Mode",scopedLabels:{appearance:q?"Dark Mode":"Light Mode"},icon:q?"DarkMode":"LightMode"}).updateCallback(()=>{F(q?y.ThemeMode.Light:y.ThemeMode.Dark)}),te.getCommand("defaultThemeMode").update({state:!E.mode,icon:U?"SystemDefaultDarkMode":"SystemDefaultLightMode"}).updateCallback(()=>{F(null)}),te.getCommand("enableDarkGrid").update({state:E.enableDarkGrid}).updateCallback(()=>{M(!E.enableDarkGrid)}),te.getCommand("enableDarkImages").update({state:E.enableDarkImages}).updateCallback(()=>{N(!E.enableDarkImages)})},[H,E,J]);const{showModal:X}=y.useModal();return n.useEffect(()=>{const q=()=>new Promise((K,V)=>{const oe=n.lazy(()=>Promise.resolve().then(()=>require("./DncFK07jNQbBqKkM.cjs"))),le=X(oe,{title:"Shortcut Keys Reference",commands:te,onDone:()=>{le.hide()},slotProps:{transition:{onExited:()=>{K(!0)}}}})});te.getCommand("showKeyboardShortcuts").updateCallback(()=>q()),te.getCommand("help").updateCallback(()=>q())},[J,te]),te})({workbook:l,setWorkbook:o,importExportDisabled:g,workbookTitle:r,setWorkbookTitle:s,commands:u,requestWorkbookTitle:S=>new Promise(C=>{t.current?t.current.requestWorkbookTitle((f,x)=>{C(f)},{selectAll:!0,requestReason:S}):C(c)}),themeOptions:b,undoManager:i,onExecute:n.useCallback(()=>{},[])}),d=n.useMemo(()=>e.jsx(Pr,{commands:p,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[p]),m={commands:p};return l&&(m.statusBarProps={childrenEnd:d}),h?n.cloneElement(h,m):null});Yr.displayName="CommandsWrapper";const Zr=n.memo(a=>{const{children:l}=a,o=Kr(),t=o?o.enqueueSnackbar:()=>{},r=o?o.closeSnackbar:()=>{},[s,c]=n.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),h=n.useCallback(()=>{c(f=>({...f,isMounted:!0}))},[]),i=n.useCallback(()=>{c(f=>({...f,isMounted:!1}))},[]),u={},g=y.useLazyWindow(u),b=y.useOptionsDialog(u),p=y.useInputDialog(u),d=n.useRef(new Set),m=n.useMemo(()=>{const f=(j,v)=>{if(v?.onceKey){if(d.current.has(v.onceKey))return;const P=new Set(d.current);P.add(v.onceKey),d.current=P}const E={variant:v?.type??k.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:v?.preventDuplicate,persist:v?.persist??v?.type===k.NotifierType.Error,action:P=>e.jsx(T.IconButton,{onClick:()=>r(P),children:e.jsx(k.DynamicIcon,{iconKey:"Cancel"})})};v?.enqueueProps&&Object.assign(E,v.enqueueProps),j||console.log("message is 'null'",v),t(j??"Alert",E)},x={showMessage:f,showBusy:(j,v)=>{let E=null;const P=new Promise(B=>{E=B});return c(B=>{const R=new Map(B.starting);return R.set(P,E),{...B,label:j,starting:R}}),P},showWindow:(j,v)=>{const E=v;return v={...v,onKeyDown:P=>{P.isDefaultPrevented()||P.isPropagationStopped()||E?.onKeyDown?.(P)}},g(j,{sort:()=>Promise.resolve().then(()=>require("./BQNV7GVR6JkMal0s.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./DG1AUTzpqtpS_jVC.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./Dj9IHyA7WeKPeOcw.cjs")),comments:()=>Promise.resolve().then(()=>require("./Dc9yE1yxW-8SY3Hv.cjs")),find:()=>Promise.resolve().then(()=>require("./DoSWqHU9pvfHVYlj.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./CtrHMVYocAsdsdWM.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./hW1tQx38Ra1unYqS.cjs")),resizeHeader:()=>Promise.resolve().then(()=>require("./BU-c6ouMN5P9GFpC.cjs"))}[j],v)},showOptions:b,showInput:p,showError:j=>{let v,E=k.NotifierType.Error,P="Unknown Error";typeof j=="string"?P=j:j instanceof Error&&(v=j,j.message&&(P=j.message)),j instanceof ve.PartialError&&(E=k.NotifierType.Info),f(P,{type:E,enqueueProps:{error:v}})}},w=new k.DefaultReactNotifier;return w.setOverrides(x),w},[]);n.useEffect(()=>{s.starting.size<=0||!s.isMounted||c(f=>{const x=new Map(f.running);return f.starting.forEach((w,j)=>{const v=()=>{c(E=>{const P=new Map(E.running);return P.delete(j),{...E,running:P}})};x.set(j,v),w(v)}),{...f,starting:new Map,running:x}})},[s]);const[S,C]=n.useState(null);return n.useEffect(()=>{s.starting.size!==0||s.running.size!==0?C(e.jsx(y.AnimatedLoadingPanel,{icon:e.jsx(y.AnimatedTraversingEllipsisIcon,{sx:{transform:"scale(0.7)",marginLeft:"-6px"}}),panel:!0,label:s.label,onMount:h,onUnmount:i,sx:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",zIndex:"9999"}})):C(null)},[s.starting,s.running]),e.jsxs(k.NotifierProvider,{notifier:m,children:[S,l]})});Zr.displayName="SnackbarWrapper";const as=n.memo(n.forwardRef((a,l)=>{const{children:o,title:t,taskPanes:r,onSelect:s,selected:c,registry:h=ne.DefaultTaskPaneRegistry,style:i,iconsOnly:u,className:g,...b}=a,p=n.useMemo(()=>r.map(S=>{const C=h.getRegisteredTaskPane(S);if(!C)return null;let f=C.getIcon?.();f&&(typeof f=="string"&&(f=e.jsx(k.DynamicIcon,{iconKey:f})),f=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:f}));const x=S===c;return e.jsx(T.Tab,{value:S,label:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:C.getTitle()??"",placement:"left-start",children:e.jsxs(T.Box,{sx:{padding:"0px 0px",writingMode:"vertical-rl",textOrientation:"mixed",display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"0px",color:w=>w.palette.text.secondary},children:[f&&e.jsx(T.Box,{sx:{display:"inline-block",transformOrigin:"center",color:w=>w.palette.text.secondary},children:f}),u&&f?null:e.jsx(T.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:w=>x?w.palette.primary.main:w.palette.text.secondary},children:C.getTitle()})]})}),sx:{padding:"4px 4px",minWidth:"0px",minHeight:"0px",borderRadius:"4px"},className:de("taskpane-strip-item",{"Mui-selected":x}),onClick:()=>a.onSelect(S)},S)}),[r,c,s,h]),d=k.useImperativeElement(l,()=>({isTaskPaneStrip:()=>!0}),[]),m=n.useMemo(()=>de("taskpane-strip",g),[g]);return e.jsx(T.Box,{ref:d,className:m,sx:{paddingLeft:"2px",paddingTop:"4px",...i},...b,children:e.jsx(T.Tabs,{orientation:"vertical",variant:"scrollable",value:c,onChange:(S,C)=>{s(C)},slotProps:{list:{sx:{gap:"2px"}},indicator:{sx:{left:"0px",right:"unset"}}},children:p})})})),rs=a=>e.jsx(as,{...a}),ls=n.forwardRef((a,l)=>{const{commands:o,model:t,...r}=a,s=G.useTheme(),c=`solid ${G.alpha(s.palette.divider,.2)} 1px`,h=`${s.shape.borderRadius??4}px`,i=`${s.spacing?.(.5)??4}px`,u=n.useRef(null);return e.jsx(ne.TaskPaneArea,{model:t,ref:l,frameProps:{style:{border:c,borderRadius:h,marginBottom:i}},alwaysShowStrip:!0,renderTaskPanelTitle:g=>{const{title:b,icon:p,onClose:d,readOnly:m,focused:S,...C}=g;return e.jsx(T.DialogTitle,{className:de({"Mui-selected":S}),sx:{display:"flex",flex:"1 1 %0",color:f=>f.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:f=>`${f.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:f=>f.transitions.duration.shortest/2+"ms"},backgroundColor:f=>G.alpha(f.palette.action.hover,.03),borderBottom:f=>`solid ${G.alpha(f.palette.divider,.2)} 1px`},...C,children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:f=>f.spacing(.25),marginBottom:f=>f.spacing(.25),marginLeft:f=>f.spacing(1),marginRight:f=>f.spacing(1)},children:[e.jsx(T.Box,{sx:{flex:"1 1 100%",paddingLeft:f=>f.spacing(1)},children:b}),e.jsx(y.ExhibitTooltip,{label:"Close",children:e.jsx(T.IconButton,{"aria-label":"close",sx:{color:f=>f.palette.text.icon??f.palette.action.active},touchRippleRef:u,onPointerDown:f=>{u.current?.start(f,{center:!1}),f.stopPropagation(),f.preventDefault()},onPointerUp:()=>{d()},children:e.jsx(k.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:rs,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...r})}),ya={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},Qr=n.memo(n.forwardRef((a,l)=>{const{mainElement:o,sidebarElement:t,className:r,style:s,...c}=a,h=G.useTheme(),[i,{width:u}]=_e(),g=u>530||u===0,b=n.useRef(null);let p=null,d=4,m=13;return g?p="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":(p="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",d=13,m=4),e.jsx(k.SplitPane,{ref:Ke([b,i,l]),className:r,style:s?{...ya,...s}:ya,...c,fixedPane:"after",position:"40%",minAfter:g?"280px":"120px",splitDirection:g?"row":"column",resizerProps:{className:"styled-resizer",style:{minWidth:g?"6px":void 0,minHeight:g?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${d}' height='${m}' viewBox='0 0 ${d} ${m}' version='1.1' fill='${h.palette.text.icon??h.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${p}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:g?"left center":"top center"}},elementBefore:o,paneBeforeProps:{style:{flexDirection:"column",marginRight:t?void 0:"6px"}},elementAfter:t,paneAfterProps:{style:{marginLeft:g?"0px":"4px",marginRight:g?"8px":"4px"}}})}));Qr.displayName="StudioSplitPane",Tr(),k.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),ne.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:li},!0);const oo=n.memo(n.forwardRef((a,l)=>{const{className:o,sx:t,style:r,onElementLoad:s,onError:c,undoManager:h,renderWorkbookError:i=xi,onKeyDown:u,workbook:g,onWorkbookChange:b,logo:p,importExportDisabled:d=!1,themeOptions:m,autoFocus:S=!1,commands:C,title:f,onTitleChange:x,titleProps:w,renderLoading:j=nn,loadingProps:v,...E}=a,P=n.useRef(null),B=k.useCallbackRef(b,[b]),R=k.useCallbackRef(x??w?.onTitleChange,[x??w?.onTitleChange]),D=w?.placeHolder??"Untitled",F=m?.mode,{themeMode:M,source:N}=y.useResolvedThemeMode({mode:F}),z=n.useMemo(()=>({...m,light:y.createExhibitTheme(!1,ve.CommonUtils.deepMerge(m?.theme??{},m?.light??{})),dark:y.createExhibitTheme(!0,ve.CommonUtils.deepMerge(m?.theme??{},m?.dark??{}))}),[m]),I=M===y.ThemeMode.Dark,[A,O]=n.useState(null);n.useEffect(()=>{O(h??new ve.UndoManager)},[h]);const[W,Z]=n.useState(null),[J,te]=n.useState(null),U=ne.useDocThemes();n.useLayoutEffect(()=>{if(!g||Object.keys(g).length===0&&!ve.CommonUtils.isPromiseLike(g)){const Q={theme:U.getDefaultTheme()};te(new L.Workbook(Q))}else te(g)},[g]),n.useLayoutEffect(()=>{if(J){if(J instanceof L.Workbook)return Z({workbook:J}),void(g!==J&&B?.(J));(async()=>{try{let Q=await Promise.resolve(J);Q&&Q.source&&(Q=await Ve.read(Q));let ce=Q;B?.(ce),V(ce.getName()??""),Z({workbook:ce})}catch(Q){B?.(null),Z({error:Q})}})()}},[J]);const[H,X]=n.useState(null);n.useEffect(()=>{if(!A||!W)return;A.clear();const Q=W?.workbook?.getTransactions();if(Q)return Q.addListener({onCommitEnd:ce=>{ce.getDescription()?A.addUndoOperation({description:ce.getDescription(),undo:()=>(Q.revert(ce.getId()),H.source?.focus(),()=>{Q.restore(ce.getId()),H.source?.focus()})}):console.warn("commit has no description",ce)}})},[A,W,H]);const q=k.useCallbackRef(Q=>{Q?A.setRepeatableOperation({description:Q.label(),repeat:async()=>Q.execute()}):A.setRepeatableOperation(null)},[A]),[K,V]=n.useState(f??w?.title??"");n.useEffect(()=>{V(f??w?.title??"")},[f??w?.title]),n.useEffect(()=>{R?.(K)},[K]);const[oe,le]=n.useState(null),ie=n.useMemo(()=>{const Q=()=>({contains:ce=>!0,focus(){}});return C?C.createChildGroup(Q,"application",!1):new k.CommandGroup(Q,"application")},[C]),ae=k.useCallbackRef(async Q=>{le(Q.source.getViewportElement()),X(Q),ie.activate("sheet"),await k.DefaultDynamicIconService.prefetch(),s?.(Q)},[ie]);n.useEffect(()=>{H&&S&&H.source?.focus(typeof S=="object"?S:void 0)},[H]);const Ce=n.useRef(null),he=n.useCallback(Q=>{let ce=null;return w?.hidden||(ce=e.jsx(rn,{...w,style:{maxWidth:"100%",...w?.style},workbook:P.current,ref:Ce,title:K,placeHolder:D,onTitleChange:Ee=>{V(Ee)}})),e.jsx(Xr,{...Q,logo:p,mainElement:ce,showFileMenu:!d,showAppearanceMenu:!!(z?.onEnabledDarkGridChange||z?.onEnabledDarkImagesChange||z?.onModeChange)})},[p,K,w,z,d,ie]);n.useEffect(()=>{const Q=ce=>ce.preventDefault();return P.current?.addEventListener("wheel",Q,{passive:!1}),()=>{P.current?.removeEventListener("wheel",Q)}},[]);const Y=n.useMemo(()=>({...t,"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:Q=>Q.palette.getContrastText(Q.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:Q=>Q.palette.getContrastText(Q.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:Q=>Q.palette.getContrastText(Q.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:Q=>Q.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"}}),[t]),[_,ee]=n.useState(null),me=n.useCallback((Q,ce)=>e.jsx(ls,{ref:ce,model:W?.workbook,commands:ie,...Q}),[ie,W]),je=n.useCallback(Q=>e.jsx(Qr,{mainElement:Q,sidebarElement:_}),[_]),se=Ke([P,l]),Oe=n.useMemo(()=>{if(!W)return e.jsx(T.Paper,{sx:t,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...r},children:j({...v})});if(W.error)return e.jsx(T.Paper,{sx:t,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"stretch",justifyContent:"stretch",...r},children:i({style:{width:"100%",height:"100%",...r},error:W.error})});let Q=null,ce=null,Ee=!1;return z&&(Q=I?z.dark:z.light,ce=I&&z.enableDarkGrid?z.dark:z.light,Ee=z.enableDarkImages),e.jsx(an,{sx:Y,style:r,tabIndex:0,autoFocus:!0,workbook:W.workbook,ref:se,renderToolbar:he,onElementLoad:ae,onRepeatCommandChange:q,onKeyDown:we=>{u?.(we)},loadingProps:v,renderLoading:j,gridTheme:ce,headersTheme:Q,enableDarkImages:Ee,mainWrapper:je,className:de(o),onContextMenu:we=>we.preventDefault(),...E},"WorkbookElement")},[W,K,A,j,v,i,z,E,he,Y,je]);let Te=e.jsx(ts,{maxSnack:3,domRoot:oe,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(Q,ce,Ee)=>{P.current?.focus()},Components:{error:qr},iconVariant:{success:e.jsx(T.SvgIcon,{style:{marginRight:"8px"},children:e.jsx("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"})}),error:e.jsx(k.DynamicIcon,{iconKey:"ErrorAlert",style:{marginRight:"8px"}})},children:e.jsx(ne.TaskPaneProvider,{createArea:me,onUpdateArea:Q=>{ee(Q)},children:e.jsx(y.ModalProvider,{children:e.jsx(Zr,{children:e.jsx(k.UncaughtErrorBoundary,{children:e.jsx(k.ReactErrorBoundary,{children:e.jsx(Yr,{workbook:W?.workbook,setWorkbook:te,importExportDisabled:d,titlePlaceHolder:D,titleWorkbook:K,setWorkbookTitle:V,refWorkbookTitle:Ce,commands:ie,undoManager:A,themeOptions:z,children:Oe})})})})})})});return z&&(Te=e.jsxs(G.ThemeProvider,{theme:I?z.dark:z.light,children:[z.cssBaseline?e.jsx(T.CssBaseline,{}):null,Te]})),Te}));oo.displayName="EagerStudio";const is=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:oo,default:oo},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Rr,exports.AutoColorPosition=ut,exports.BorderCommandButton=Pa,exports.BorderPopupButton=Ra,exports.BorderStylePopupButton=Ba,exports.CellsDeleteCommandButton=Ao,exports.CellsFormatCommandButton=Lo,exports.CellsInsertCommandButton=Oo,exports.Checkboard=Ea,exports.ClearCommandButton=No,exports.ColorButton=no,exports.ColorButtonList=Rt,exports.ColorCommandButton=pt,exports.ColorPanel=Ta,exports.ColorPanelType=ja,exports.ColorPopupButton=Io,exports.DocThemeCommandButton=Br,exports.EagerStudio=oo,exports.FillCommandButton=Oa,exports.FilterColumnMenu=Yo,exports.FilterCommandButton=zl,exports.Filters=lr,exports.FindCommandButton=Fa,exports.FontFamilyCommandButton=za,exports.FontSizeCommandButton=Ia,exports.FormulaBar=Xo,exports.FreezeCommandButton=Da,exports.HelpCommandButton=Pr,exports.HorizontalAlignCommandButton=Sa,exports.InsertFunctionCommandPopupButton=Mr,exports.InsertFunctionSumCommandPopupButton=cn,exports.InsertImageCommandButton=sn,exports.MergeCommandButton=Ma,exports.NamedCollectionEditor=Go,exports.NamedInput=Vo,exports.NumberFormatCommandButton=Na,exports.PasteCommandButton=Wo,exports.PresetCellStylesCommandButton=Ka,exports.PresetTableStylesCommandButton=ln,exports.RangeInput=_o,exports.SheetTab=Zo,exports.SheetTabMenu=Qo,exports.SheetZoomScale=Ko,exports.SheetsAllMenu=Jo,exports.SortFilterCommandButton=zo,exports.StatusBar=Uo,exports.Studio=Dr,exports.StyledStrokeIcon=Bo,exports.TableDetailsPanel=jr,exports.TableDetailsTaskPane=Er,exports.TablePlugin=Tr,exports.TableStyleCanvasPreview=qa,exports.TableStyleOptionsPanel=Ga,exports.TableStylePreview=$o,exports.TextEffectsCommandButton=Ha,exports.TextOverflowCommandButton=ka,exports.TextRotateCommandButton=va,exports.ThemeSelectButton=Qa,exports.ThemeSelectPanel=Ja,exports.ThemeSelectPopupButton=er,exports.UnderlineCommandButton=Wa,exports.UndoRedoCommandButton=Ho,exports.VerticalAlignCommandButton=wa,exports.ViewGridLinesCommandButton=Aa,exports.ViewHeadingsCommandButton=$a,exports.WalkingCopyCommandButton=ro,exports.WorkbookContextMenu=on,exports.WorkbookElement=an,exports.WorkbookIO=Ve,exports.WorkbookStrip=tn,exports.WorkbookTitle=rn,exports.WorkbookViewCommandButton=Va,exports._WorkbookIO=Ur,exports._extends=Jt,exports._objectWithoutPropertiesLoose=en,exports._setPrototypeOf=eo,exports.clsx=Ue,exports.clsx$1=de,exports.commonjsGlobal=ct,exports.createGridStyleFromMUITheme=Mo,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=Ft,exports.setPrintExamplesOnLoad=a=>{ir=a},exports.useMeasure=_e,exports.useWorkbookCommands=kr;
|