@sheetxl/studio-mui 0.7.20 → 0.7.22
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/{DG1AUTzpqtpS_jVC.cjs → BCSkf7oG5MtK-XGZ.cjs} +1 -1
- package/browser/cjs/{CtrHMVYocAsdsdWM.cjs → BOj9VP_ZCebWTfxc.cjs} +2 -2
- package/browser/cjs/{hW1tQx38Ra1unYqS.cjs → Biy5SuviR3Cz0S4F.cjs} +2 -2
- package/browser/cjs/{DncFK07jNQbBqKkM.cjs → C1PlAY37pY831-YP.cjs} +7 -7
- package/browser/cjs/{BQNV7GVR6JkMal0s.cjs → Cc3dH2YOCi1SjPK4.cjs} +1 -1
- package/browser/cjs/{CPXMzOdl6xxPLfPn.cjs → Ccx9l-If3BC4K6LY.cjs} +2 -2
- package/browser/cjs/{DoSWqHU9pvfHVYlj.cjs → DR8b8OAx9_mnaJoN.cjs} +2 -2
- package/browser/cjs/{BU-c6ouMN5P9GFpC.cjs → D_R6KuQiPoJdxVa_.cjs} +1 -1
- package/browser/cjs/{Dc9yE1yxW-8SY3Hv.cjs → DkGstRdRpze8sHAr.cjs} +1 -1
- package/browser/cjs/{C_j6lCasu1t14O9Y.cjs → StW-maKM8OSYcle5.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/{Dj9IHyA7WeKPeOcw.cjs → kjlgjQkY0fb-Rc-P.cjs} +1 -1
- package/browser/cjs/qoo14c2KOLE_IfIO.cjs +20 -0
- package/browser/esm/{MNeM7EdplvhB32i_.mjs → 0OyyoHlgiaso9tYr.mjs} +1 -1
- package/browser/esm/{BG8BFBORDGBJ3nhX.mjs → BE92YslAajVEiBuX.mjs} +2 -2
- package/browser/esm/{BZ9mDgpYGUEkfYek.mjs → BJO2iGA4QZN4Tzfv.mjs} +7 -7
- package/browser/esm/{R5qqTNvjnM3WxJs7.mjs → BQGW_5yvCb0eTpib.mjs} +1 -1
- package/browser/esm/{CzI2pgZrodF1v9Qy.mjs → BYAdBaegvg_SoS6K.mjs} +2 -2
- package/browser/esm/{BW4phvITufQ_VYkF.mjs → BsxSk3HxwjxRtPtZ.mjs} +2 -2
- package/browser/esm/{tHtBuu4Jh64s0gfO.mjs → D-9Ar2kzfZAziktn.mjs} +1 -1
- package/browser/esm/{BCJfGxexFSseQSX1.mjs → D4Z_3xY0vO_3FL6K.mjs} +1 -1
- package/browser/esm/DB1mGkEgnMnMQ8CH.mjs +4533 -0
- package/browser/esm/{CzbyIwG_G4o6kvXx.mjs → HmzSBdi0ej5oeXZ1.mjs} +1 -1
- package/browser/esm/{DnnkEOAQ3T-BZ8YN.mjs → ePSxe_g7wEvzmkJ7.mjs} +1 -1
- package/browser/esm/index.mjs +2 -2
- package/browser/esm/{CCw88yjz7gsAET8V.mjs → pshi0IoaQJ-EyVt3.mjs} +2 -2
- package/licenses/dependencies.txt +51 -51
- package/node/esm/{BcKSdSKQD8WAIJsN.mjs → B67HtQl_OohbFhFm.mjs} +1 -1
- package/node/esm/{BrOlE1aJNCNuEX5e.mjs → BD8iIgRl14sLSdN1.mjs} +1 -1
- package/node/esm/{Cy29Wsw-LIboDmIX.mjs → BKeEywP27oPbnpFS.mjs} +1 -1
- package/node/esm/{xfteOmuy00dffn5q.mjs → BkQRle53yjTwYnC4.mjs} +28 -28
- package/node/esm/{DxLeMhSCAbLseA57.mjs → Bl77xZWpq8Ix5EEF.mjs} +1 -1
- package/node/esm/{DzH9wpTF59hEQ5jd.mjs → C1HBS_UNswHQvckQ.mjs} +1 -1
- package/node/esm/{BFHAvoo6cadd7zYQ.mjs → C4wnaXAtg_BfPjQR.mjs} +1 -1
- package/node/esm/{BCop3xTgurk_pOXZ.mjs → Dhp7eefBNVIcSWf6.mjs} +1 -1
- package/node/esm/{BScUpdKO-b4Gr5Xm.mjs → bp_PxnEExWX_-i_8.mjs} +1 -1
- package/node/esm/index.mjs +1163 -1143
- package/node/esm/{QXAsw9Yj3OjQnfqS.mjs → j5ssn9j67ROjzwGT.mjs} +1 -1
- package/package.json +8 -8
- package/types/index.d.ts +94 -116
- package/browser/cjs/9A8PR69vLQMV7BcN.cjs +0 -20
- package/browser/esm/DuBLWU88ClLWzYcS.mjs +0 -4510
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";var Sl=Object.create;var vn=Object.defineProperty;var wl=Object.getOwnPropertyDescriptor;var kl=Object.getOwnPropertyNames;var vl=Object.getPrototypeOf,jl=Object.prototype.hasOwnProperty;var El=(a,l,o,t)=>{if(l&&typeof l=="object"||typeof l=="function")for(let r of kl(l))!jl.call(a,r)&&r!==o&&vn(a,r,{get:()=>l[r],enumerable:!(t=wl(l,r))||t.enumerable});return a};var Tl=(a,l,o)=>(o=a!=null?Sl(vl(a)):{},El(l||!a||!a.__esModule?vn(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.22
|
|
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 A=require("@sheetxl/sdk"),ne=require("@sheetxl/react"),e=require("react/jsx-runtime"),n=require("react"),B=require("@mui/material"),y=require("@sheetxl/utils-mui"),G=require("@mui/material/styles"),w=require("@sheetxl/utils-react"),ot=require("react-dom"),Me=require("@mui/system"),Ce=require("@sheetxl/utils"),ct=require("@sheetxl/io");function ba(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=ba(a[l]))&&(t&&(t+=" "),t+=o)}else for(o in a)a[o]&&(t&&(t+=" "),t+=o);return t}function ue(){for(var a,l,o=0,t="",r=arguments.length;o<r;o++)(a=arguments[o])&&(l=ba(a))&&(t&&(t+=" "),t+=l);return t}const ya=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...h}=a,i=w.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),u=n.useMemo(()=>{for(let m=0;m<i.length;m++)if(i[m]?.getState())return i[m];return i[0]},[i]),g=n.useMemo(()=>{if(!t)return null;const m={...t};return delete m.beforeExecute,m},[t]),b=n.useCallback((m,d)=>{const p={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignLeftToggle")}),e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignCenterToggle")}),e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignRightToggle")}),e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignJustifyToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignFillToggle")}),e.jsx(y.CommandButton,{...p,command:d.getCommand("formatAlignDistributedHorizontalToggle")})]}),S=e.jsxs(B.Box,{sx:{className:ue("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(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...h,children:[S,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:C})]});return y.defaultCreatePopupPanel({...m,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?.getKey(),icon:u?.getIcon()??"FormatAlignLeft",...h})})),Ca=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),{activeCommand:i,allDisabled:u}=n.useMemo(()=>{const b=h.length;let m,d=0;for(let p=0;p<b;p++){const C=h[p];C&&!C.disabled()&&(!m&&C?.getState()&&(m=C),d++)}return m=m??h[0],{activeCommand:m,allDisabled:d===0}},[h]),g=n.useCallback((b,m)=>{const d={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...d,command:m.getCommand("formatAlignTopToggle")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatAlignMiddleToggle")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatAlignBottomToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatAlignDistributedVerticalToggle")})]});return y.defaultCreatePopupPanel({...b,children:p})},[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?.getIcon()??"TextVerticalBottom",...c})})),Sa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),{activeCommand:i,allDisabled:u}=n.useMemo(()=>{const b=h.length;let m,d=0;for(let p=0;p<b;p++){const C=h[p];C&&!C.disabled()&&(!m&&C?.getState()&&(m=C),d++)}return m=m??h[0],{activeCommand:m,allDisabled:d===0}},[h]),g=w.useCallbackRef((b,m)=>{const d={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextOverflowWrapToggle")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextOverflowClipToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextOverflowShrinkToggle")})]});return y.defaultCreatePopupPanel({...b,children:p})},[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?.getIcon()??"TextHorizontalOverflow",...c})})),wa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),i=n.useMemo(()=>{const b=h.length;for(let m=0;m<b;m++){const d=h[m];if(d?.getState())return d}return h[1]},[h]),u=n.useCallback((b,m)=>{const d={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextRotate0")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextRotate315")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextRotate45")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextRotate90")}),e.jsx(y.CommandButton,{...d,command:m.getCommand("formatTextRotate270")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.InputCommandButton,{...d,command:m.getCommand("formatTextRotateCustom"),label:"Custom"})]});return y.defaultCreatePopupPanel({...b,children:p})},[s,t,r,o]),g=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.getState()??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?.getIcon()??"TextRotation315",...c})})),ka={Preset:"preset",Custom:"custom"},pt={Start:"start",End:"end"},fo={},Bl=(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},Rl={},va=n.memo(a=>{const{className:l,style:o=w.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:c,boxShadow:h,renderers:i=Rl,children:u,...g}=a,b=u,m=n.useMemo(()=>Object.assign({borderRadius:c,boxShadow:h,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Bl(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:m,...g})}),Ml=n.memo(a=>{const{selectedColor:l,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:c,onMouseLeave:h,onFocus:i,style:u=w.ReactUtils.EmptyCssProperties,children:g,alphaWhite:b,alphaGrey:m,darkMode:d,alphaCheckSize:p=7,...C}=a;if(!l)throw new Error("a selectedColor is required");const S=n.useCallback(j=>{r?.(j),j.isDefaultPrevented()||(j.ctrlKey?t?.(l.toRGBA()):o?.(l.toRGBA()))},[o,t,r,l]),f=n.useCallback(j=>{c?.(j),j.isDefaultPrevented()||t?.(l.toRGBA())},[t,c,l]),x=n.useCallback(j=>{h?.(j),j.isDefaultPrevented()},[t,h]),k=n.useCallback(j=>{i?.(j),j.isDefaultPrevented()||t?.(l.toRGBA())},[t,i,l]),E=n.useCallback(j=>{s?.(j),j.isDefaultPrevented()||j.keyCode===w.KeyCodes.Enter&&o?.(l.toRGBA())},[o,s,l]),v=n.useMemo(()=>l.toRGBA().alpha===1?null:e.jsx(va,{size:p,white:b,grey:m,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[b,m,l]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...u},tabIndex:0,...C,onClick:S,onKeyDown:E,onMouseOver:f,onMouseLeave:x,onFocus:k,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:l.toCSS(d)},children:g})]})}),ro=n.memo(a=>{const{schemeColorLookup:l,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:c,propsSwatch:h,defaultButtonSize:i=24,isLarge:u=!1,compareRGB:g=!1,darkMode:b=!1,...m}=a,d=new A.Color({val:r.definition.val,adjs:r.definition.adjs},v=>l(v)),p=g?d.toRGBA().toString():d.toString(),C=o&&(g?o.toRGBA().toString():o.toString())===p,S=t&&(g?t.toRGBA().toString():t.toString())===p,f=[];f.push({[A.IColor.AdjustmentType.Inv]:!0}),f.push({[A.IColor.AdjustmentType.Alpha]:100});const x=d.adjust(f),k=n.useCallback(()=>{s?.(r)},[s,r]),E=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"},...m,children:e.jsxs(Ml,{selectedColor:d,title:null,onSelectColor:k,onPreviewColor:E,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:C?"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:S?"1":"0"}})]})})})}),Dt=n.memo(a=>{const{title:l,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:c,onPreviewColorDef:h,style:i=w.ReactUtils.EmptyCssProperties,compareRGB:u=!1,darkMode:g,propsSwatch:b,...m}=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 p=n.useCallback(x=>{c?.(x)},[c]),C=n.useCallback(x=>{h?.(x)},[h]),S=n.useMemo(()=>{let x=[];for(let k=0;k<d.length;k++){let E=[],v=d[k];for(let T=0;T<v.length;T++){let M=v[T];E.push(e.jsx(ro,{schemeColorLookup:o,colorDef:M,selectedColor:r,previewColor:s,onSelectColorDef:p,onPreviewColorDef:C,propsSwatch:b,compareRGB:u,darkMode:g},k+" "+T))}let j=e.jsx(B.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:T=>T.shadows[2],borderRadius:"2px",overflow:"hidden"},children:E},""+k);x.push(j)}return x},[d,r,s,p,C]),f=n.useMemo(()=>l?e.jsx(B.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(B.Box,{style:{...i},children:[f,e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...m,children:S})]})}),Pe=(a,l)=>({description:a,definition:{val:l,adjs:[]}}),xe=(a,l,o,t,r,s)=>{const c=Pe(a,l);t?.push(c);const h=new A.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)},Dl=n.lazy(()=>Promise.resolve().then(()=>require("./Ccx9l-If3BC4K6LY.cjs"))),ja=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:m,onEyeDropStart:d,onEyeDropStop:p,onPreviewColor:C,onPreviewColorImmediate:S,onSelectColor:f,autoColor:x,autoColorLabel:k="Automatic",autoColorPosition:E=pt.Start,compareRGB:v=!1,darkMode:j=!1,...T}=a,M=t||o,R=w.useCallbackRef(C,[C]),F=w.useCallbackRef(S,[S]),P=w.useCallbackRef(f,[f]),D=w.useCallbackRef(d,[d]),I=w.useCallbackRef(p,[p]),[V,O]=n.useState(!1),z=G.useTheme(),N=n.useMemo(()=>s||A.Color.getDefaultSchemeLookup(),[s]),$=n.useMemo(()=>{const W=new Map,X=new Map,se=[];xe("Primary Background","bg1",N,se,W,X),xe("Primary Text","tx1",N,se,W,X),xe("Secondary Background","bg2",N,se,W,X),xe("Secondary Text","tx2",N,se,W,X),xe("Accent 1","accent1",N,se,W,X),xe("Accent 2","accent2",N,se,W,X),xe("Accent 3","accent3",N,se,W,X),xe("Accent 4","accent4",N,se,W,X),xe("Accent 5","accent5",N,se,W,X),xe("Accent 6","accent6",N,se,W,X);const le=A.ITheme.buildPalette(se,N,W,X),pe=[];if(xe("Dark Red","C00000",N,pe,W,X),xe("Red","FF0000",N,pe,W,X),xe("Orange","FFC000",N,pe,W,X),xe("Yellow","FFFF00",N,pe,W,X),xe("Light Green","92D050",N,pe,W,X),xe("Green","00B050",N,pe,W,X),xe("Light Blue","00B0F0",N,pe,W,X),xe("Blue","0070C0",N,pe,W,X),xe("Dark Blue","002060",N,pe,W,X),c?xe("Purple Is A Fruit","7030A0",N,pe,W,X):xe("Transparent","00000000",N,pe,W,X),x){const Ee=x.toString();W.set(Ee,x)}const je=new Map,Se=typeof r=="function"?r():r,Be=[];for(let Ee=0;Se&&Ee<Se.length;Ee++){const ke=Se[Ee].toString();je.set(ke,Se[Ee]),Be.push({description:"Recent "+(Ee+1),definition:{val:Se[Ee].toString()}})}return{primaryColors:se,modifiedPresets:le,standardColors:pe,recentColorsLimited:Be,mapAllPresets:W,mapAllPresetsRGB:X,mapRecent:je}},[N,r,c,x]);n.useEffect(()=>{b?.()},[]);const[Z,te]=n.useState(!1),ee=n.useCallback(()=>{te(W=>!W)},[]);n.useEffect(()=>{if(i)te(i===ka.Custom);else if(o){let W=o.toString(),X=$.mapAllPresets.get(W);X||(W=o.toRGBA().toString(),X=$.mapAllPresetsRGB.get(W));const se=$.mapRecent.get(W);te(!X&&!se)}},[o,i]);const L=n.useCallback(A.CommonUtils.debounce(W=>{R?.(W)},h),[R,h]),[H,J]=n.useState();n.useEffect(()=>{J(t||o)},[t,o]);const Q=w.useCallbackRef(W=>{F&&(F(W),L(W))},[F]),q=w.useCallbackRef(W=>{Q(W?new A.Color({val:W.definition.val,adjs:W.definition.adjs},N):null)},[N]),_=n.useCallback(W=>{W.ctrlKey&&te(!0)},[]),oe=w.useCallbackRef(W=>{let X=!1;if(W){const se=W.toString();X=!$.mapAllPresets.has(se)}P?.(W,X)},[P,$]),me=w.useCallbackRef(W=>{const X=W?new A.Color({val:W.definition.val,adjs:W.definition.adjs},N):null;Promise.resolve(m?.()).then(()=>{oe(X)})},[N,m]),de=w.useCallbackRef(W=>{Q(W?new A.Color(W,N):null)},[N]),he=n.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(B.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:W=>W.palette.text.icon??W.palette.action.active},onClick:async()=>{O(!0),D?.(),await new EyeDropper().open().then(W=>{O(!1),I?.();let X=new A.Color(W.sRGBHex),se=X.toString(),le=$.mapAllPresets.get(se);if(le||(se=X.toRGBA().toString(),le=$.mapAllPresetsRGB.get(se)),!le){const pe=X.toRGBA(),je=3;let Se=255;$.mapAllPresetsRGB.forEach((Be,Ee)=>{const ke=Be.toRGBA(),Y=Math.abs(ke.red-pe.red)+Math.abs(ke.blue-pe.blue)+Math.abs(ke.green-pe.green);Y<je&&Y<Se&&(le=Be)})}te(!le),Q(le||X)}).catch(W=>{O(!1),W?.name!=="AbortError"&&console.error(W)})},children:e.jsx(w.DynamicIcon,{iconKey:"Colorize"})}),[$,j]),re=n.useMemo(()=>{if(!Z)return;const W={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:W,children:e.jsx(y.AnimatedLoadingPanel,{})}),children:e.jsx(Dl,{style:W,selectedColor:M?M.toRGBA().toString():"transparent",onColorChange:de,disableAlpha:c})})},[Z,M]),ae=n.useMemo(()=>({onClick:_,alphaGrey:z.palette.text.icon??z.palette.action.active}),[_,z]),K=n.useMemo(()=>{if(!x)return null;const W={description:k,definition:{val:x.getVal(),adjs:x.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(B.MenuItem,{sx:{display:"flex",color:X=>X.palette.text.secondary},onMouseOver:()=>{q(null)},onClick:()=>{me(null)},children:[e.jsx(B.Box,{sx:{flex:"none",boxShadow:X=>X.shadows[2],borderRadius:X=>X.spacing(.5),overflow:"hidden"},children:e.jsx(ro,{schemeColorLookup:N,colorDef:W,selectedColor:o===null?x:o,previewColor:t===null?x:t,defaultButtonSize:u,isLarge:!0,darkMode:j,compareRGB:v,propsSwatch:ae})}),e.jsx(B.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:k})]})})},[x,k,N,o,t]);return e.jsxs(B.Box,{ref:l,sx:{width:g,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...T,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:Z?"0":1},children:[K&&E===pt.Start?e.jsxs(e.Fragment,{children:[K,e.jsx(B.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(Dt,{title:"Theme Colors",schemeColorLookup:N,colorDefs:$.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,propsSwatch:ae,onPreviewColorDef:q,onSelectColorDef:me,compareRGB:v,darkMode:j}),e.jsx(Dt,{schemeColorLookup:N,colorDefs:$.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,propsSwatch:ae,onPreviewColorDef:q,onSelectColorDef:me,compareRGB:v,darkMode:j}),e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Standard Colors",schemeColorLookup:N,colorDefs:$.standardColors,selectedColor:o,previewColor:t===void 0?o:t,propsSwatch:ae,onPreviewColorDef:q,onSelectColorDef:me,compareRGB:v,darkMode:j}),e.jsxs("div",{style:{opacity:$.recentColorsLimited.length===0?"0":void 0,display:$.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(B.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(Dt,{title:"Recent Colors",schemeColorLookup:N,colorDefs:$.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,propsSwatch:ae,onPreviewColorDef:q,onSelectColorDef:me,compareRGB:v,darkMode:j})]}),K&&E===pt.End?e.jsxs(e.Fragment,{children:[e.jsx(B.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),K,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),re]}),e.jsx(B.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:[he,e.jsx("div",{style:{flex:"1 1 100%",background:"pink"}}),e.jsx(B.Button,{style:{minWidth:"75px",maxWidth:"75px"},value:"check",variant:"outlined",size:"small",onClick:()=>{ee()},children:Z?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(B.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(m?.()).then(()=>{oe(H)})},children:"Done"})]})]})})),Pl=e.jsx(w.DynamicIcon,{iconKey:"circle.colored"}),Io=n.memo(n.forwardRef((a,l)=>{const{selectedColor:o,quickColor:t,icon:r=Pl,tooltip:s,label:c,onPreviewColor:h,onPreviewColorImmediate:i,onSelectColor:u,variant:g=y.PopupButtonType.Toolbar,propsPanel:b,shouldCloseFloatAll:m=!0,compareRGB:d=!1,darkMode:p=!1,...C}=a,S=w.useCallbackRef(h,[h]),f=w.useCallbackRef(i,[i]),x=w.useCallbackRef(u,[u]),[k,E]=n.useState(()=>{}),v=t||k||o||b?.autoColor,j=n.useRef(!1),T=n.useCallback(()=>{},[]),M=w.useCallbackRef(()=>{E(o)},[o]),R=w.useCallbackRef($=>{j.current||(E($),S?.($))},[S]),F=w.useCallbackRef($=>{j.current||(E($),f?.($))},[f]),P=w.useCallbackRef(($,Z)=>{j.current||(E(void 0),x?.($,Z))},[x]),D=n.useMemo(()=>e.jsx(B.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(p)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(p)??"transparent"}`},"& .style_grey":{fill:$=>$.palette.text.icon??$.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,p]),I=w.useCallbackRef($=>{x?.(t,!1)},[x,t]),[V,O]=n.useState(!1),z=n.useCallback($=>{const{closeFloat:Z,closeFloatAll:te}=$;return e.jsx(ja,{...b,selectedColor:o,previewColor:k,onDone:m?te:Z,onKeyDown:ee=>{ee.which===w.KeyCodes.Enter&&(m?te():Z())},onPreviewColorImmediate:F,onPreviewColor:R,onSelectColor:P,onEyeDropStart:()=>O(!0),onEyeDropStop:()=>O(!1),compareRGB:d,darkMode:p})},[o,k,m,v,b?.autoColor,p]),N={onQuickClick:t?I:void 0,createPopupPanel:z,propsPopup:{propsPopper:{resizeOnOverflow:!1}},onPopupOpen:M,onPopupClose:T,tooltip:s||c||"Color",label:c,icon:D,...C};return g===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:l,...N}):e.jsx(y.ExhibitPopupMenuItem,{ref:l,...N})})),Jt=82,Bo=a=>{const{styleColor:l,length:o=Jt,width:t=1,dashArray:r=null,sx:s,isDouble:c=!1,isAngled:h=!1,darkMode:i=!1,...u}=a;return e.jsx(B.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"})})},Ea=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,...m}=a,d=w.useCallbackRef(i,[]),p=n.useCallback(x=>{const{popupContainer:k,floatReference:E,closeFloat:v,...j}=x,T=[],M=A.IBorder.BuiltInDefinitionsArray;for(let R=0;R<M.length;R++){const F=M[R];if(F.description==="None"&&!u)continue;const P=e.jsx(Bo,{styleColor:c,length:Jt,width:F.width,darkMode:g,dashArray:F.pattern,isDouble:F.description.toLowerCase().includes("double"),isAngled:F.description.toLowerCase().includes("slant")});let D=null;D=t?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{marginRight:"6px"},children:F.description}),e.jsxs(B.Box,{sx:{marginLeft:"6px",marginRight:"6px",display:"flex",alignItems:"center",flex:"1 1 100%"},children:[e.jsx("div",{style:{flex:"1 1 100%"}}),P]})]}):F.description==="None"?"None":P,T.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))})`},propsTooltip:{description:t?"":F.description},icon:null,disabled:r,onMouseDown:I=>I.preventDefault(),onMouseUp:()=>{v(),d(F.style)},onKeyDown:I=>{I.which===w.KeyCodes.Enter&&v()},selected:F.style===h,parentFloat:E,children:D},R))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:T})},[r,u,c,h,g]),C=n.useMemo(()=>{const x=A.IBorder.BuiltInDefinitions.get(h);let k;return k=x.description==="None"?e.jsx(B.Box,{sx:{minWidth:`${Jt}px`},children:"None"}):e.jsx(Bo,{styleColor:c,length:Jt,width:x.width,dashArray:x.pattern,darkMode:g,isDouble:x.description.toLowerCase().includes("double"),isAngled:x.description.toLowerCase().includes("slant")}),e.jsx(B.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:y.createStrokeShadowFilter()}},children:k})},[h,c]),S=n.useMemo(()=>A.IBorder.BuiltInDefinitions.get(h),[h]),f={disabled:r,icon:C,tooltip:"Border Style: "+S.description,sx:{background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,...b},createPopupPanel:p,...m};return o===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{...f}):e.jsx(y.ExhibitPopupMenuItem,{...f})})),Ta=n.memo(n.forwardRef((a,l)=>{const{autoColor:o=null,schemeLookup:t,autoStrokeStyle:r=A.IBorder.StrokeStyle.Thin,disabled:s=!1,darkMode:c=!1,showStylingBefore:h=!0,onSelectBorder:i,onPreviewBorder:u,selectedBorder:g,createTemporaryBorder:b,...m}=a,d=w.useCallbackRef(i,[i]),p=w.useCallbackRef(u,[u]),[C,S]=n.useState(),[f,x]=n.useState(),k=C??r,E=f??o,v=g||{bottom:{style:r,color:o?.toString()}},j=w.useCallbackRef(D=>{const I={},V=D?Object.keys(D):[];let O=!1;const z=V.length;for(let J=0;J<z;J++){const Q=V[J];D[Q]?.style&&(I[Q]={style:D[Q].style,color:D[Q].color},O||I[Q].style===A.IBorder.StrokeStyle.None||(O=!0))}V.length<6&&(O=!0);const N=O?I.left:null,$=O?I.top:null,Z=O?I.right:null,te=O?I.bottom:null,ee=O?I.vertical:null,L=O?I.horizontal:null;let H="";return $||N||(H+="M 3,5 H 5 V 3 H 3 "),$||(H+="M 7,5 H 9 V 3 H 7 "),$||ee||(H+="M 11,5 h 2 V 3 h -2 "),$||(H+="M 15,5 h 2 V 3 h -2 "),$||Z||(H+="M 19,5 h 2 V 3 h -2 "),N||(H+="M 3,9 H 5 V 7 H 3 "),ee||(H+="M 11,9 h 2 V 7 h -2 "),Z||(H+="M 19,9 h 2 V 7 h -2 "),L||N||(H+="M 3,13 H 5 V 11 H 3 "),L||(H+="M 7,13 H 9 V 11 H 7 "),L||ee||(H+="M 11,13 h 2 v -2 h -2 "),L||Z||(H+="M 19,13 h 2 v -2 h -2 "),L||(H+="M 15,13 h 2 v -2 h -2 "),N||(H+="M 3,17 H 5 V 15 H 3 "),ee||(H+="M 11,17 h 2 v -2 h -2 "),Z||(H+="M 19,17 h 2 v -2 h -2 "),te||N||(H+="M 3,21 H 5 V 19 H 3 "),te||(H+="M 7,21 H 9 V 19 H 7 "),te||ee||(H+="M 11,21 h 2 v -2 h -2 "),te||(H+="M 15,21 h 2 v -2 h -2 "),te||Z||(H+="M 19,21 h 2 v -2 h -2 "),e.jsxs(w.DynamicIcon,{children:[" ",e.jsxs(B.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(B.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:(J,Q)=>{if(!b||V.length===0)return null;const q=J.rowIndex,_=J.colIndex,oe={};return q===0?(oe.top=I.top,oe.bottom=I.horizontal):(oe.top=I.horizontal,oe.bottom=I.bottom),_===0?(oe.left=I.left,oe.right=I.vertical):(oe.left=I.vertical,oe.right=I.right),b?.(oe)},darkMode:c,style:{top:"2px",left:"2px",width:"calc(100% - 5px)",height:"calc(100% - 5px)",position:"absolute"}})})]})]})},[E,k,c]),T=n.useCallback((D,I,V)=>{let O=null;if(D&&D.length>0){let z=null;(I||V)&&(z={style:V,color:I?.toString()??null}),O={};const N=D.length;for(let $=0;$<N;$++)O[D[$]]=z}return O},[]),M=n.useCallback(D=>{d?.(D)},[]),R=n.useCallback(D=>{p?.(D)},[]),F=n.useCallback(D=>{const{closeFloatAll:I,floatReference:V}=D,O=($,Z,te="bottom",ee=!1)=>{const L=T($,E??null,ee?A.IBorder.StrokeStyle.None:k??null),H=ee?T([],E??null,k??null):L;return e.jsx(y.ExhibitIconButton,{icon:j(H),sx:{background:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`},propsTooltip:{label:Z,simple:!0,placement:te},onClick:()=>{I(),R(L),M(L)}})},z=e.jsxs(e.Fragment,{children:[e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"All Borders","top"),O([A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical],"Inner Borders","top"),O([A.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),O([A.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([A.IBorder.Edge.Left],"Left Borders"),O([A.IBorder.Edge.Top],"Top Borders"),O([A.IBorder.Edge.Right],"Right Borders"),O([A.IBorder.Edge.Bottom],"Bottom Borders"),O([A.IBorder.Edge.Left,A.IBorder.Edge.Top,A.IBorder.Edge.Right,A.IBorder.Edge.Bottom,A.IBorder.Edge.Horizontal,A.IBorder.Edge.Vertical,A.IBorder.Edge.DiagonalUp,A.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),N=e.jsx(e.Fragment,{children:e.jsxs(B.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Io,{variant:y.PopupButtonType.Toolbar,icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),selectedColor:k===A.IBorder.StrokeStyle.None?new A.Color("transparent"):E,onPreviewColor:$=>{x($)},onSelectColor:($,Z)=>{x($)},darkMode:c,tooltip:"Border Color",propsPanel:{disableAlpha:!0,autoColor:o,schemeLookup:t},disabled:s||k===A.IBorder.StrokeStyle.None,parentFloat:V,shouldCloseFloatAll:!1}),e.jsx(Ea,{selectedStyle:k,onSelectStyle:S,styleColor:E,darkMode:c,variant:y.PopupButtonType.Toolbar,parentFloat:V})]})});return e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:$=>$.stopPropagation(),children:[h?N:z,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),h?z:N]})},[k,E,o,t,c]),P=n.useMemo(()=>j(v),[v,c]);return e.jsx(y.ExhibitPopupIconButton,{ref:l,createPopupPanel:F,propsPopup:{propsPopper:{resizeOnOverflow:!1}},createTooltip:({children:D},I)=>e.jsx(y.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:I,children:D}),onQuickClick:()=>{d?.(v)},disabled:s,icon:P,...m})})),Ba=n.memo(n.forwardRef((a,l)=>{const{commands:o,command:t,commandHook:r,variant:s=w.CommandButtonType.Toolbar,disabled:c=!1,autoColor:h,autoStrokeStyle:i,schemeLookup:u,createTemporaryBorder:g,selectedBorder:b,onSelectBorder:m,darkMode:d,icon:p,label:C,...S}=a,f=w.useCommands(o,["formatBorder"]),x=t??f[0],k=x?.getContext()??null,E=k?.autoColor??h,v=k?.autoStyle??i,j=b??k?.quickBorder,T=d??k?.darkMode,M=g??k?.createTemporaryBorder,R=u??k?.schemeLookup,F=w.useCallbackRef(D=>{k?.onBorderSelect&&k.onBorderSelect(D),m?.(D),x?.execute(D,r)},[x,m,r]),P=n.useCallback((D,I)=>{const{children:V,title:O,...z}=D;let N=D.children;return(x?.disabled()||c)&&(N=e.jsx("div",{children:N})),e.jsx(y.CommandTooltip,{command:x,placement:s===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:I,...z,children:N})},[x,c]);return e.jsx(Ta,{ref:l,autoColor:E,darkMode:T,autoStrokeStyle:v,createTemporaryBorder:M,schemeLookup:R,selectedBorder:j,onSelectBorder:F,createTooltip:P,disabled:c||!x||x.disabled(),...S})})),Ra=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:w.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})})),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:w.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})})),Da=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"}))),Pa=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:c=A.FontUtils.DefaultFontSizes,disabled:h=!1,parentFloat:i,icon:u,label:g,sx:b,...m}=a;w.useCommand(o);const d=()=>o?.getState()?.toString()||"11",[p,C]=n.useState(d),S=w.useCallbackRef(()=>{const M=parseFloat(p);isNaN(M)?C(d()):parseFloat(d())!==M&&o.execute(M,t)},[d,o,p,t]);n.useEffect(()=>{C(d())},[o?.getState()]);const f=n.useMemo(()=>{if(!t)return null;const M={...t};return delete M.beforeExecute,M},[t]),x=w.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),k=n.useMemo(()=>x?e.jsxs(B.Box,{className:ue("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:M=>M.stopPropagation(),children:[e.jsx(y.CommandButton,{command:x[0],commandHook:f}),e.jsx(y.CommandButton,{command:x[1],commandHook:f})]}):null,[x]),E=G.useTheme(),v=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("12.3",Math.round(E.typography.fontSize),E.typography.fontFamily).width}px`,[E]),j=n.useCallback(M=>{const{onMouseDown:R,onMouseUp:F,...P}=M;return e.jsx(B.IconButton,{component:"div",...P,disableRipple:!0,children:e.jsx(B.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:D=>`1px solid ${D.palette.text.icon??D.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:D=>`1px solid ${D.palette.error.main}`},"::after":{borderBottom:D=>`1px solid ${D.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:D=>`${Math.round(D.typography.fontSize)}px`,width:v,color:D=>D.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:D=>D.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:D=>D.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:p,onFocus:D=>{D.target?.select()},onKeyDown:D=>{if(D.which===w.KeyCodes.Enter)d()!==p&&(D.stopPropagation(),D.preventDefault(),S());else if(D.which===w.KeyCodes.Escape)d()!==p&&(C(d()),setTimeout(()=>{D.target?.select()},0),D.stopPropagation(),D.preventDefault());else{if(D.key.match("[-]")||D.key.match("[0-9.]")&&(p+D.key).length>4)return D.stopPropagation(),void D.preventDefault();if(D.which===w.KeyCodes.Space)return void D.preventDefault()}},onBlur:()=>{S()},onChange:D=>{if(D.target.value.length>4)return D.stopPropagation(),void D.preventDefault();C(D.target.value)}})})},[p,h,o]),T=n.useCallback(M=>{const R=I=>{o?.execute(I,t)},F=o?.getState(),P=[];for(let I=0;I<c.length;I++){const V=c[I]===F;P.push(e.jsx(y.ExhibitMenuItem,{selected:V,icon:V?e.jsx(y.SelectedIcon,{}):void 0,disabled:h||!o||o.disabled(),onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&R(c[I])},onKeyDown:O=>{O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||R(c[I])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:c[I]})},"fontSize-"+I))}const D=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...m,children:[k,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:P})]});return y.defaultCreatePopupPanel({...M,children:D})},[h,o?.getState(),t]);return e.jsx(y.ExhibitPopupIconButton,{ref:l,sx:{...b},tabIndex:-1,outlined:!0,disabled:h,parentFloat:i,createPopupPanel:T,createTooltip:({children:M},R)=>e.jsx(y.ExhibitTooltip,{label:o?.getLabel(),description:o?.getDescription(),disabled:R||o?.disabled(),children:M}),renderQuickButton:j,...m})})),jn=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!==w.KeyCodes.Enter&&i.keyCode!==w.KeyCodes.Space||r(s.numberFormat)},...h,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(B.Typography,{component:"div",children:[s.formatType,s.formatType===A.NumberFormat.Type.Custom?"…":""]}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:i=>Me.alpha(i.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),Fa=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:c=!1,parentFloat:h,...i}=a,u=w.useCommands(o,["formatNumberFormat"])[0],g=u?.getState()?A.NumberFormat.Styles.lookupStyle(u?.getState()).formatType:A.NumberFormat.Type.General,b=n.useMemo(()=>{if(!t)return null;const C={...t};return delete C.beforeExecute,C},[t]),m=n.useCallback((C,S)=>{const f=F=>{t?.beforeExecute?.(u,u?.getState()),u.execute(F,t),t?.onExecute?.(u,u?.getState())},x=u?.getContext()(),k=A.NumberFormat.Styles.lookupPrimary(),E=[];for(let F=0;F<k.length;F++){let P="";if(x&&!x.isEmpty())try{P=x.getNumberFormat(k[F].numberFormat).displayText}catch(I){console.warn(I)}P===""&&k[F].formatType===A.NumberFormat.Type.General&&(P="No specific format");const D=k[F].formatType===g;E.push(e.jsx(jn,{selected:D,disabled:c||!u||u.disabled(),formattedValue:P,handleSetFormat:f,format:k[F]},k[F].formatType))}const v={numberFormat:"",formatType:A.NumberFormat.Type.Custom},j=g===A.NumberFormat.Type.Custom,T=e.jsx(jn,{selected:j,disabled:c||!u||u.disabled(),formattedValue:j?x.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(u,u?.getState()),S.getCommand("formatNumberDialog")?.execute(u?.getState()),t?.onExecute?.(u,u?.getState())},format:v,sx:{flex:"0",width:"100%"}},A.NumberFormat.Type.Custom),M=e.jsxs(B.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:F=>F.stopPropagation(),children:[e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatAccountingStyle"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatPercentStyle"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatCommaStyle"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:b,scope:r}),e.jsx(y.CommandButton,{command:S.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:b,scope:r})]}),R=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...i,children:[M,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:E}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),T]});return y.defaultCreatePopupPanel({...C,children:R})},[u?.getContext(),u?.getState(),t,r]),d=G.useTheme(),p=n.useMemo(()=>{const C=A.NumberFormat.Type.MediumTime;return`${A.IFont.getSharedMeasurer()(C,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:m,createTooltip:({children:C},S)=>e.jsx(y.ExhibitTooltip,{label:u?.getLabel(),description:u?.getDescription(),disabled:S,children:C}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:C=>`${Math.round(C.typography.fontSize)}px`,color:C=>C.palette.text.secondary,fontFamily:C=>C.typography.fontFamily,width:p},children:e.jsx(B.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"}))),Ia=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=w.CommandButtonType.Toolbar,...g}=a,b=["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns","addSheet"];c||b.push("addSheet");const m=w.useCommands(o,b),{singleCommand:d,allDisabled:p}=n.useMemo(()=>{let S=null,f=0;const x=m.length;for(let k=0;k<x;k++){const E=m[k];E&&!E.disabled()&&(h&&u===w.CommandButtonType.Menuitem&&(S=f===0?E:null),f++)}return{singleCommand:S,allDisabled:f===0}},[m]),C=n.useCallback((S,f)=>{let x=null;const k={variant:w.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,{...k,command:f.getCommand("addSheet")})]}));const E=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...k,command:m[0]}),e.jsx(y.CommandButton,{...k,command:m[1]}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...k,command:m[2]}),e.jsx(y.CommandButton,{...k,command:m[3]}),x]});return y.defaultCreatePopupPanel({...S,children:E})},[s,m,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||p,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:C,...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=w.CommandButtonType.Toolbar,...g}=a,b=["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"];c||b.push("deleteSheet");const m=w.useCommands(o,b),{singleCommand:d,allDisabled:p}=n.useMemo(()=>{let S=null,f=0;const x=m.length;for(let k=0;k<x;k++){const E=m[k];E&&!E.disabled()&&(h&&u===w.CommandButtonType.Menuitem&&(S=f===0?E:null),f++)}return{singleCommand:S,allDisabled:f===0}},[m]),C=n.useCallback((S,f)=>{const x={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let k=null;c||(k=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:f.getCommand("deleteSheet")})]}));const E=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")}),k]});return y.defaultCreatePopupPanel({...S,children:E})},[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||p,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:C,...g})})),Lo=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["resizeRows","autoFitRows","resizeColumns","autoFitColumns","hideColumns","hideRows","unhideColumns","unhideRows"]),{allDisabled:i}=n.useMemo(()=>{let g=0;const b=h.length;for(let m=0;m<b;m++){const d=h[m];d&&!d.disabled()&&g++}return{allDisabled:g===0}},[h]),u=n.useCallback((g,b)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"formatCells"},d={commands:b,parentFloat:g.floatReference,...m},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:b.getCommand("resizeRows")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("autoFitRows")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:b.getCommand("resizeColumns")}),e.jsx(y.CommandButton,{...m,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:p})},[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 Na=n.createContext(null);Na.displayName="HookFormContext";const Oa=()=>n.useContext(Na);typeof window<"u"?n.useLayoutEffect:n.useEffect;const zo=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:m,...d}=a,p=Oa(),C=i&&p?p.register(i,u):null,[S,f]=n.useState(""),[x,k]=n.useState(""),[E,v]=n.useState(h);n.useEffect(()=>{v(h),k("")},[h]);const j=w.useCallbackRef(P=>{let D="";try{v(P),b?.(P),g?.(P)}catch(I){D=I.message??"Invalid Name"}i&&p&&(D?p.setError(i,{message:D}):p.clearErrors(i)),k(D)},[h,b,g]),T=w.useCallbackRef(async P=>{P.keyCode===w.KeyCodes.Escape&&S!==h&&(j(S),p?.setValue(i,S),p?.clearErrors(i),P.stopPropagation()),m?.(P)},[m,S,h,p]),M=w.useCallbackRef(P=>{f(P.target.value??"")},[]),R=w.useCallbackRef(P=>{f(""),C?.onBlur(P)},[]),F=n.useCallback(P=>{j(P.target.value),C?.onChange(P)},[C]);return e.jsx(B.FormControl,{sx:{paddingTop:P=>P.spacing(1.5),minWidth:135,width:"100%",...s},size:"small",ref:l,className:ue("named-input",r),...d,children:e.jsx(B.TextField,{label:"Name",placeholder:c,onFocus:M,onBlur:R,inputRef:C?.ref,disabled:o,error:!!x,helperText:x||" ",sx:{"& .MuiFormHelperText-root":{marginTop:P=>P.spacing(.5)}},slotProps:{inputLabel:{shrink:!0},htmlInput:{className:"autoFocus",name:i,spellCheck:!1,autoComplete:"off",readOnly:o,sx:{paddingTop:P=>P.spacing(1.25),paddingBottom:P=>P.spacing(.75),backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`}}},value:E??"",onChange:F,onKeyDownCapture:T,onContextMenu:P=>{P.stopPropagation()}})})}));zo.displayName="NamedInput";const Ht=a=>a===null?"":a.toString(),Ho=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,...m}=a,d=Oa(),p=o&&d?d.register(o,t):null,[C,S]=n.useState(""),[f,x]=n.useState(!1),[k,E]=n.useState(()=>Ht(u));n.useEffect(()=>{E(Ht(u)),S(""),o&&d&&d.clearErrors(o),x(!1)},[u]);const v=w.useCallbackRef(D=>{let I="";try{E(D);const V=Ht(u),O=b(D);O.toString()!==V&&g?.(O)}catch{I="Invalid Range"}o&&d&&(I?d.setError(o,{message:I}):d.clearErrors(o)),S(I),x(!0)},[k,g,o,d]),j=w.useCallbackRef(async D=>{if(f&&D.keyCode===w.KeyCodes.Escape){const I=Ht(u);E(I),S(""),x(!1),D.stopPropagation()}i?.(D)},[u,g,i,f]),T=w.useCallbackRef(D=>{p?.onBlur(D)},[p]),M=n.useCallback(D=>{v(D.target.value),p?.onChange(D)},[p]),[R,F]=n.useState(!1),P=n.useMemo(()=>e.jsx(B.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(y.ExhibitOptionButton,{disabled:!0,selected:R,onSelectToggle:D=>{F(D)},label:"Select Range",icon:e.jsx(w.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[R]);return e.jsx(B.FormControl,{sx:{paddingTop:D=>D.spacing(1.5),minWidth:135,width:"100%",...h},size:"small",ref:l,className:ue("range-input",c),...m,children:e.jsx(B.TextField,{label:"Range",placeholder:"Enter Range",onBlur:T,disabled:r,error:!!C,inputRef:p?.ref,helperText:C||" ",sx:{"& .MuiFormHelperText-root":{marginTop:D=>D.spacing(.5)}},slotProps:{input:{endAdornment:P},inputLabel:{shrink:!0},htmlInput:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:D=>D.spacing(1.25),paddingBottom:D=>D.spacing(.75)}}},value:k??"",onChange:M,onKeyDownCapture:j,onContextMenu:D=>{D.stopPropagation()}})})}));Ho.displayName="RangeInput";const Re=[];Re.push(Pe("Primary Background","bg1")),Re.push(Pe("Primary Text","tx1")),Re.push(Pe("Secondary Background","bg2")),Re.push(Pe("Secondary Text","tx2")),Re.push(Pe("Accent 1","accent1")),Re.push(Pe("Accent 2","accent2")),Re.push(Pe("Accent 3","accent3")),Re.push(Pe("Accent 4","accent4")),Re.push(Pe("Accent 5","accent5")),Re.push(Pe("Accent 6","accent6"));const Aa=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 m=Re[b];g.push(e.jsx(ro,{schemeColorLookup:l.schemeLookup(),colorDef:m,darkMode:t,selectedColor:null},b+"-colorDef"))}return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(B.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(B.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(B.Box,{sx:{},children:l.getName()}),e.jsxs(B.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[u,e.jsx(B.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()})})})]})]})})},La=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 m=g.length;for(let d=0;d<m;d++){const p=g[d],C=t&&p?.getName()===t.getName(),S=g[d+1];S&&S.isCustom()!==p.isCustom()&&b.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${d}`)),b.push(e.jsx(Aa,{docTheme:p,onSelectTheme:()=>r(p),isSelected:C,disabled:c,darkMode:h,onMouseDown:f=>{f.button===0&&f.preventDefault()},onMouseUp:f=>{f.button===0&&r(p)},onKeyDown:f=>{f.keyCode!==w.KeyCodes.Enter&&f.keyCode!==w.KeyCodes.Space||r(p)}},p.getName()))}return b},[t,r,h]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},ref:l,...i,children:e.jsxs(B.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(B.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:u})]})})})),za=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,propsPanel:g,...b}=a,m=s||e.jsx(w.DynamicIcon,{iconKey:"Theme2"}),d=n.useCallback(C=>{const{closeFloatAll:S}=C;return e.jsx(La,{...g,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:u,onKeyDown:f=>{f.which===w.KeyCodes.Enter&&S()}})},[o,t,r,g,u]),p={createPopupPanel:d,tooltip:c||h||"Theme",label:h,icon:m,...b};return i===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:l,...p}):e.jsx(y.ExhibitPopupMenuItem,{ref:l,...p})}));function ho(a,l){if(typeof a=="function")return a(l);a&&(a.current=l)}var ze=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)}};const Wo=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&&A.CommonUtils.debounce(()=>{h===b.current&&(b.current=0,o.getView().update({zoomScale:h}))},r)()},[h,r]);const m=w.useCallbackRef(T=>{let M=T;T<100?M=Math.round(T/(10/9)+10):T>100&&(M=Math.round(3*T-200)),b.current=M,g(!0),i(M)},[o]),d=T=>{let M=T;return T<100?M=10/9*(T-10):T>100&&(M=(T+200)/3),M},p=d(h),[C,S]=n.useState(null),f=n.useRef(null),x=n.useCallback(()=>{const T=C;T&&requestAnimationFrame(()=>{f.current?.contains(document.activeElement)&&T.focus()})},[]),k=w.useMouseDownAndHoldListener(()=>{m(d(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),E=w.useMouseDownAndHoldListener(()=>m(d(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10)))),v=G.useTheme(),j=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("100%",Math.round(v.typography.fontSize),v.typography.fontFamily).width}px`,[v]);return e.jsxs(B.Box,{ref:l,className:ue(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:T=>T.palette.text.secondary,...s},onFocus:T=>{T.relatedTarget&&!C&&S(T.relatedTarget)},onBlur:T=>{C&&!f?.current?.contains(T.relatedTarget)&&S(null)},onMouseDown:T=>{T.button===0&&T.preventDefault()},onMouseUp:T=>{T.button===0&&x()},...c,children:[e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:T=>T.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:T=>{T.button!==0?T.preventDefault():k(T)},children:e.jsx(w.DynamicIcon,{iconKey:"Remove"})})}),e.jsx(B.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:T=>`0px 0px 0px 3px ${y.hexToRGB(T.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:T=>`0px 0px 0px 2px ${y.hexToRGB(T.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:p,max:200,marks:[{value:100}],onAnimationEnd:()=>g(!1),onWheel:T=>{m(d(A.CommonUtils.findNextStep(o.getView().getZoomScale(),T.deltaY<0,10)))},onKeyDown:T=>{T.which===w.KeyCodes.Down||T.which===w.KeyCodes.Right?(m(d(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),T.preventDefault()):T.which===w.KeyCodes.Up||T.which===w.KeyCodes.Left?(m(d(A.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),T.preventDefault()):T.which!==w.KeyCodes.Enter&&T.which!==w.KeyCodes.Escape||x()},onChange:(T,M)=>{Math.abs(M-100)<3?m(100):m(M)},valueLabelFormat:(T,M)=>`Zoom: ${Math.round(h)}%`}),e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom In",children:e.jsx(B.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:T=>T.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:T=>{T.button!==0?T.preventDefault():E(T)},children:e.jsx(w.DynamicIcon,{iconKey:"Add"})})}),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(B.Box,{sx:{minWidth:"8px"}}),e.jsx(B.Typography,{noWrap:!0,component:"div",onClick:()=>{m(100)},sx:{cursor:"pointer",display:"flex",flex:"1 1 100%",fontSize:"0.70rem",marginLeft:"2px",marginRight:"2px",userSelect:"none",justifyContent:"center",width:j},children:e.jsx("div",{children:Math.round(h)+"%"})})]})]})}));Wo.displayName="SheetZoomScale";const $o=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=p=>p.preventDefault();return i.current?.addEventListener("wheel",d,{passive:!1}),()=>{i.current?.removeEventListener("wheel",d)}},[]);const u=w.useEditMode(),g=n.useMemo(()=>{const d=u.getMode();return d?.description?d.description:"Ready"},[u]),[b,m]=n.useState(!1);return e.jsxs(B.Box,{className:"statusBar",ref:ze([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:()=>m(!0),onMouseLeave:()=>m(!1),...h,children:[s,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(B.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(B.Box,{sx:{display:"flex",alignItems:"center"},children:c}):null,e.jsx(y.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(Wo,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));$o.displayName="StatusBar";var ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},En,Tn,go,Bn,Rn,Wt={exports:{}},Ct={},St={exports:{}},Mn={},Dn={exports:{}};function Fl(){return Tn?En:(Tn=1,En="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function Il(){if(Bn)return go;Bn=1;var a=Fl();function l(){}function o(){}return o.resetWarningCache=l,go=function(){function t(c,h,i,u,g,b){if(b!==a){var m=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 m.name="Invariant Violation",m}}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 Nt(){return Rn||(Rn=1,Dn.exports=Il()()),Dn.exports}var Pn,$t={exports:{}},Fn,be={},He={};function lo(){return Fn||(Fn=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 In,Nn,We={};function Vo(){if(Nn)return be;Nn=1,Object.defineProperty(be,"__esModule",{value:!0}),be.addClassName=c,be.addEvent=function(i,u,g,b){if(!i)return;const m={capture:!0,...b};i.addEventListener?i.addEventListener(u,g,m):i.attachEvent?i.attachEvent("on"+u,g):i["on"+u]=g},be.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")},be.createCSSTransform=function(i,u){const g=r(i,u,"px");return{[(0,l.browserPrefixToKey)("transform",l.default)]:g}},be.createSVGTransform=function(i,u){return r(i,u,"")},be.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)},be.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},be.getTranslation=r,be.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},be.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},be.matchesSelector=t,be.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},be.offsetXYFromParent=function(i,u,g){const b=u===u.ownerDocument.body?{left:0,top:0}:u.getBoundingClientRect(),m=(i.clientX+u.scrollLeft-b.left)/g,d=(i.clientY+u.scrollTop-b.top)/g;return{x:m,y:d}},be.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},be.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},be.removeClassName=h,be.removeEvent=function(i,u,g,b){if(!i)return;const m={capture:!0,...b};i.removeEventListener?i.removeEventListener(u,g,m):i.detachEvent?i.detachEvent("on"+u,g):i["on"+u]=null},be.scheduleRemoveUserSelectStyles=function(i){window.requestAnimationFrame?window.requestAnimationFrame(()=>{s(i)}):s(i)};var a=lo(),l=(function(i,u){if(typeof WeakMap=="function")var g=new WeakMap,b=new WeakMap;return(function(m,d){if(!d&&m&&m.__esModule)return m;var p,C,S={__proto__:null,default:m};if(m===null||typeof m!="object"&&typeof m!="function")return S;if(p=d?b:g){if(p.has(m))return p.get(m);p.set(m,S)}for(const f in m)f!=="default"&&{}.hasOwnProperty.call(m,f)&&((C=(p=Object.defineProperty)&&Object.getOwnPropertyDescriptor(m,f))&&(C.get||C.set)?p(S,f,C):S[f]=m[f]);return S})(i,u)})((function(){if(In)return We;In=1,Object.defineProperty(We,"__esModule",{value:!0}),We.browserPrefixToKey=g,We.browserPrefixToStyle=function(b,m){return m?`-${m.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 m=window.document?.documentElement?.style;if(!m||b in m)return"";for(let d=0;d<i.length;d++)if(g(b,i[d])in m)return i[d];return""}function g(b,m){return m?`${m}${(function(d){let p="",C=!0;for(let S=0;S<d.length;S++)C?(p+=d[S].toUpperCase(),C=!1):d[S]==="-"?C=!0:p+=d[S];return p})(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:m}=i,d=`translate(${b}${g},${m}${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 be}var On,Fe={};function Ha(){if(On)return Fe;On=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Fe.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Fe.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}},Fe.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}},Fe.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,m=u.getComputedStyle(h),d=u.getComputedStyle(b);c={left:-h.offsetLeft+(0,a.int)(d.paddingLeft)+(0,a.int)(m.marginLeft),top:-h.offsetTop+(0,a.int)(d.paddingTop)+(0,a.int)(m.marginTop),right:(0,l.innerWidth)(b)-(0,l.outerWidth)(h)-h.offsetLeft+(0,a.int)(d.paddingRight)-(0,a.int)(m.marginRight),bottom:(0,l.innerHeight)(b)-(0,l.outerHeight)(h)-h.offsetTop+(0,a.int)(d.paddingBottom)-(0,a.int)(m.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]},Fe.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)},Fe.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=lo(),l=Vo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return Fe}var An,Ln,zn,Hn,wt={},Vt={};function Wa(){return An||(An=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.default=function(){}),Vt}function Nl(){if(Ln)return wt;Ln=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.default=void 0;var a=(function(d,p){if(typeof WeakMap=="function")var C=new WeakMap,S=new WeakMap;return(function(f,x){if(!x&&f&&f.__esModule)return f;var k,E,v={__proto__:null,default:f};if(f===null||typeof f!="object"&&typeof f!="function")return v;if(k=x?S:C){if(k.has(f))return k.get(f);k.set(f,v)}for(const j in f)j!=="default"&&{}.hasOwnProperty.call(f,j)&&((E=(k=Object.defineProperty)&&Object.getOwnPropertyDescriptor(f,j))&&(E.get||E.set)?k(v,j,E):v[j]=f[j]);return v})(d,p)})(n),l=h(Nt()),o=h(ot),t=Vo(),r=Ha(),s=lo(),c=h(Wa());function h(d){return d&&d.__esModule?d:{default:d}}function i(d,p,C){return(p=(function(S){var f=(function(x,k){if(typeof x!="object"||!x)return x;var E=x[Symbol.toPrimitive];if(E!==void 0){var v=E.call(x,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(x)})(S,"string");return typeof f=="symbol"?f:f+""})(p))in d?Object.defineProperty(d,p,{value:C,enumerable:!0,configurable:!0,writable:!0}):d[p]=C,d}const u={start:"touchstart",move:"touchmove",stop:"touchend"},g={start:"mousedown",move:"mousemove",stop:"mouseup"};let b=g,m=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 p=this.findDOMNode();if(!p||!p.ownerDocument||!p.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:C}=p;if(this.props.disabled||!(d.target instanceof C.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(d.target,this.props.handle,p)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(d.target,this.props.cancel,p))return;d.type!=="touchstart"||this.props.allowMobileScroll||d.preventDefault();const S=(0,t.getTouchIdentifier)(d);this.touchIdentifier=S;const f=(0,r.getControlPosition)(d,S,this);if(f==null)return;const{x,y:k}=f,E=(0,r.createCoreData)(this,x,k);(0,c.default)("DraggableCore: handleDragStart: %j",E),(0,c.default)("calling",this.props.onStart),this.props.onStart(d,E)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(C),this.dragging=!0,this.lastX=x,this.lastY=k,(0,t.addEvent)(C,b.move,this.handleDrag),(0,t.addEvent)(C,b.stop,this.handleDragStop))}),i(this,"handleDrag",d=>{const p=(0,r.getControlPosition)(d,this.touchIdentifier,this);if(p==null)return;let{x:C,y:S}=p;if(Array.isArray(this.props.grid)){let x=C-this.lastX,k=S-this.lastY;if([x,k]=(0,r.snapToGrid)(this.props.grid,x,k),!x&&!k)return;C=this.lastX+x,S=this.lastY+k}const f=(0,r.createCoreData)(this,C,S);if((0,c.default)("DraggableCore: handleDrag: %j",f),this.props.onDrag(d,f)!==!1&&this.mounted!==!1)this.lastX=C,this.lastY=S;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const k=document.createEvent("MouseEvents");k.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(k)}}),i(this,"handleDragStop",d=>{if(!this.dragging)return;const p=(0,r.getControlPosition)(d,this.touchIdentifier,this);if(p==null)return;let{x:C,y:S}=p;if(Array.isArray(this.props.grid)){let k=C-this.lastX||0,E=S-this.lastY||0;[k,E]=(0,r.snapToGrid)(this.props.grid,k,E),C=this.lastX+k,S=this.lastY+E}const f=(0,r.createCoreData)(this,C,S);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:p}=d;(0,t.removeEvent)(p,g.move,this.handleDrag),(0,t.removeEvent)(p,u.move,this.handleDrag),(0,t.removeEvent)(p,g.stop,this.handleDragStop),(0,t.removeEvent)(p,u.stop,this.handleDragStop),(0,t.removeEvent)(d,u.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(p)}}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 wt.default=m,i(m,"displayName","DraggableCore"),i(m,"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,p){if(d[p]&&d[p].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(m,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),wt}function Ol(){return zn||(zn=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(p,C){if(typeof WeakMap=="function")var S=new WeakMap,f=new WeakMap;return(function(x,k){if(!k&&x&&x.__esModule)return x;var E,v,j={__proto__:null,default:x};if(x===null||typeof x!="object"&&typeof x!="function")return j;if(E=k?f:S){if(E.has(x))return E.get(x);E.set(x,j)}for(const T in x)T!=="default"&&{}.hasOwnProperty.call(x,T)&&((v=(E=Object.defineProperty)&&Object.getOwnPropertyDescriptor(x,T))&&(v.get||v.set)?E(j,T,v):j[T]=x[T]);return j})(p,C)})(n),o=g(Nt()),t=g(ot),r=(function(){if(Pn)return $t.exports;function p(S){var f,x,k="";if(typeof S=="string"||typeof S=="number")k+=S;else if(typeof S=="object")if(Array.isArray(S)){var E=S.length;for(f=0;f<E;f++)S[f]&&(x=p(S[f]))&&(k&&(k+=" "),k+=x)}else for(x in S)S[x]&&(k&&(k+=" "),k+=x);return k}function C(){for(var S,f,x=0,k="",E=arguments.length;x<E;x++)(S=arguments[x])&&(f=p(S))&&(k&&(k+=" "),k+=f);return k}return Pn=1,$t.exports=C,$t.exports.clsx=C,$t.exports})(),s=Vo(),c=Ha(),h=lo(),i=g(Nl()),u=g(Wa());function g(p){return p&&p.__esModule?p:{default:p}}function b(){return b=Object.assign?Object.assign.bind():function(p){for(var C=1;C<arguments.length;C++){var S=arguments[C];for(var f in S)({}).hasOwnProperty.call(S,f)&&(p[f]=S[f])}return p},b.apply(null,arguments)}function m(p,C,S){return(C=(function(f){var x=(function(k,E){if(typeof k!="object"||!k)return k;var v=k[Symbol.toPrimitive];if(v!==void 0){var j=v.call(k,E);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(k)})(f,"string");return typeof x=="symbol"?x:x+""})(C))in p?Object.defineProperty(p,C,{value:S,enumerable:!0,configurable:!0,writable:!0}):p[C]=S,p}class d extends l.Component{static getDerivedStateFromProps(C,S){let{position:f}=C,{prevPropsPosition:x}=S;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(C){super(C),m(this,"onDragStart",(S,f)=>{if((0,u.default)("Draggable: onDragStart: %j",f),this.props.onStart(S,(0,c.createDraggableData)(this,f))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(S,f)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",f);const x=(0,c.createDraggableData)(this,f),k={x:x.x,y:x.y,slackX:0,slackY:0};if(this.props.bounds){const{x:E,y:v}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[j,T]=(0,c.getBoundPosition)(this,k.x,k.y);k.x=j,k.y=T,k.slackX=this.state.slackX+(E-k.x),k.slackY=this.state.slackY+(v-k.y),x.x=k.x,x.y=k.y,x.deltaX=k.x-this.state.x,x.deltaY=k.y-this.state.y}if(this.props.onDrag(S,x)===!1)return!1;this.setState(k)}),m(this,"onDragStop",(S,f)=>{if(!this.state.dragging||this.props.onStop(S,(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:k,y:E}=this.props.position;x.x=k,x.y=E}this.setState(x)}),this.state={dragging:!1,dragged:!1,x:C.position?C.position.x:C.defaultPosition.x,y:C.position?C.position.y:C.defaultPosition.y,prevPropsPosition:{...C.position},slackX:0,slackY:0,isElementSVG:!1},!C.position||C.onDrag||C.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:C,bounds:S,children:f,defaultPosition:x,defaultClassName:k,defaultClassNameDragging:E,defaultClassNameDragged:v,position:j,positionOffset:T,scale:M,...R}=this.props;let F={},P=null;const D=!j||this.state.dragging,I=j||x,V={x:(0,c.canDragX)(this)&&D?this.state.x:I.x,y:(0,c.canDragY)(this)&&D?this.state.y:I.y};this.state.isElementSVG?P=(0,s.createSVGTransform)(V,T):F=(0,s.createCSSTransform)(V,T);const O=(0,r.clsx)(f.props.className||"",k,{[E]: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:O,style:{...f.props.style,...F},transform:P}))}}a.default=d,m(d,"displayName","Draggable"),m(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}),m(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})})(Mn)),Mn}function $a(){if(Hn)return St.exports;Hn=1;const{default:a,DraggableCore:l}=Ol();return St.exports=a,St.exports.default=a,St.exports.DraggableCore=l,St.exports}var Wn,_t={};function Al(){if(Wn)return _t;Wn=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 m=g[Symbol.toPrimitive];if(m!==void 0){var d=m.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 $n,Vn,kt={};function Va(){if($n)return kt;$n=1,kt.__esModule=!0,kt.resizableProps=void 0;var a,l=(a=Nt())&&a.__esModule?a:{default:a};$a();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 kt.resizableProps=o,kt}function _a(){if(Vn)return Ct;Vn=1,Ct.__esModule=!0,Ct.default=void 0;var a=(function(m,d){if(m&&m.__esModule)return m;if(m===null||typeof m!="object"&&typeof m!="function")return{default:m};var p=s(d);if(p&&p.has(m))return p.get(m);var C={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in m)if(f!=="default"&&Object.prototype.hasOwnProperty.call(m,f)){var x=S?Object.getOwnPropertyDescriptor(m,f):null;x&&(x.get||x.set)?Object.defineProperty(C,f,x):C[f]=m[f]}return C.default=m,p&&p.set(m,C),C})(n),l=$a(),o=Al(),t=Va(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(m){if(typeof WeakMap!="function")return null;var d=new WeakMap,p=new WeakMap;return(s=function(C){return C?p:d})(m)}function c(){return c=Object.assign?Object.assign.bind():function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var C in p)Object.prototype.hasOwnProperty.call(p,C)&&(m[C]=p[C])}return m},c.apply(this,arguments)}function h(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(m);d&&(C=C.filter(function(S){return Object.getOwnPropertyDescriptor(m,S).enumerable})),p.push.apply(p,C)}return p}function i(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?h(Object(p),!0).forEach(function(C){u(m,C,p[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):h(Object(p)).forEach(function(C){Object.defineProperty(m,C,Object.getOwnPropertyDescriptor(p,C))})}return m}function u(m,d,p){return(d=(function(C){var S=(function(f,x){if(typeof f!="object"||f===null)return f;var k=f[Symbol.toPrimitive];if(k!==void 0){var E=k.call(f,x);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(f)})(C,"string");return typeof S=="symbol"?S:String(S)})(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function g(m,d){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(p,C){return p.__proto__=C,p},g(m,d)}var b=(function(m){var d,p;function C(){for(var f,x=arguments.length,k=new Array(x),E=0;E<x;E++)k[E]=arguments[E];return(f=m.call.apply(m,[this].concat(k))||this).handleRefs={},f.lastHandleRect=null,f.slack=null,f}p=m,(d=C).prototype=Object.create(p.prototype),d.prototype.constructor=d,g(d,p);var S=C.prototype;return S.componentWillUnmount=function(){this.resetData()},S.resetData=function(){this.lastHandleRect=this.slack=null},S.runConstraints=function(f,x){var k=this.props,E=k.minConstraints,v=k.maxConstraints,j=k.lockAspectRatio;if(!E&&!v&&!j)return[f,x];if(j){var T=this.props.width/this.props.height,M=f-this.props.width,R=x-this.props.height;Math.abs(M)>Math.abs(R*T)?x=f/T:f=x*T}var F=f,P=x,D=this.slack||[0,0],I=D[0],V=D[1];return f+=I,x+=V,E&&(f=Math.max(E[0],f),x=Math.max(E[1],x)),v&&(f=Math.min(v[0],f),x=Math.min(v[1],x)),this.slack=[I+(F-f),V+(P-x)],[f,x]},S.resizeHandler=function(f,x){var k=this;return function(E,v){var j=v.node,T=v.deltaX,M=v.deltaY;f==="onResizeStart"&&k.resetData();var R=(k.props.axis==="both"||k.props.axis==="x")&&x!=="n"&&x!=="s",F=(k.props.axis==="both"||k.props.axis==="y")&&x!=="e"&&x!=="w";if(R||F){var P=x[0],D=x[x.length-1],I=j.getBoundingClientRect();k.lastHandleRect!=null&&(D==="w"&&(T+=I.left-k.lastHandleRect.left),P==="n"&&(M+=I.top-k.lastHandleRect.top)),k.lastHandleRect=I,D==="w"&&(T=-T),P==="n"&&(M=-M);var V=k.props.width+(R?T/k.props.transformScale:0),O=k.props.height+(F?M/k.props.transformScale:0),z=k.runConstraints(V,O);V=z[0],O=z[1];var N=V!==k.props.width||O!==k.props.height,$=typeof k.props[f]=="function"?k.props[f]:null;$&&!(f==="onResize"&&!N)&&(E.persist==null||E.persist(),$(E,{node:j,size:{width:V,height:O},handle:x})),f==="onResizeStop"&&k.resetData()}}},S.renderResizeHandle=function(f,x){var k=this.props.handle;if(!k)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+f,ref:x});if(typeof k=="function")return k(f,x);var E=i({ref:x},typeof k.type=="string"?{}:{handleAxis:f});return a.cloneElement(k,E)},S.render=function(){var f=this,x=this.props,k=x.children,E=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 j=x.resizeHandles;x.transformScale;var T=(function(M,R){if(M==null)return{};var F,P,D={},I=Object.keys(M);for(P=0;P<I.length;P++)F=I[P],R.indexOf(F)>=0||(D[F]=M[F]);return D})(x,r);return(0,o.cloneElement)(k,i(i({},T),{},{className:(E?E+" ":"")+"react-resizable",children:[].concat(k.props.children,j.map(function(M){var R,F=(R=f.handleRefs[M])!=null?R:f.handleRefs[M]=a.createRef();return a.createElement(l.DraggableCore,c({},v,{nodeRef:F,key:"resizableHandle-"+M,onStop:f.resizeHandler("onResizeStop",M),onStart:f.resizeHandler("onResizeStart",M),onDrag:f.resizeHandler("onResize",M)}),f.renderResizeHandle(M,F))}))}))},C})(a.Component);return Ct.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},Ct}var _n,Kn,vt={};function Ll(){if(_n)return vt;_n=1,vt.__esModule=!0,vt.default=void 0;var a=(function(d,p){if(d&&d.__esModule)return d;if(d===null||typeof d!="object"&&typeof d!="function")return{default:d};var C=c(p);if(C&&C.has(d))return C.get(d);var S={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in d)if(x!=="default"&&Object.prototype.hasOwnProperty.call(d,x)){var k=f?Object.getOwnPropertyDescriptor(d,x):null;k&&(k.get||k.set)?Object.defineProperty(S,x,k):S[x]=d[x]}return S.default=d,C&&C.set(d,S),S})(n),l=s(Nt()),o=s(_a()),t=Va(),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 p=new WeakMap,C=new WeakMap;return(c=function(S){return S?C:p})(d)}function h(){return h=Object.assign?Object.assign.bind():function(d){for(var p=1;p<arguments.length;p++){var C=arguments[p];for(var S in C)Object.prototype.hasOwnProperty.call(C,S)&&(d[S]=C[S])}return d},h.apply(this,arguments)}function i(d,p){var C=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);p&&(S=S.filter(function(f){return Object.getOwnPropertyDescriptor(d,f).enumerable})),C.push.apply(C,S)}return C}function u(d){for(var p=1;p<arguments.length;p++){var C=arguments[p]!=null?arguments[p]:{};p%2?i(Object(C),!0).forEach(function(S){g(d,S,C[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(C)):i(Object(C)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(C,S))})}return d}function g(d,p,C){return(p=(function(S){var f=(function(x,k){if(typeof x!="object"||x===null)return x;var E=x[Symbol.toPrimitive];if(E!==void 0){var v=E.call(x,k);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(x)})(S,"string");return typeof f=="symbol"?f:String(f)})(p))in d?Object.defineProperty(d,p,{value:C,enumerable:!0,configurable:!0,writable:!0}):d[p]=C,d}function b(d,p){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(C,S){return C.__proto__=S,C},b(d,p)}var m=(function(d){var p,C;function S(){for(var f,x=arguments.length,k=new Array(x),E=0;E<x;E++)k[E]=arguments[E];return(f=d.call.apply(d,[this].concat(k))||this).state={width:f.props.width,height:f.props.height,propsWidth:f.props.width,propsHeight:f.props.height},f.onResize=function(v,j){var T=j.size;f.props.onResize?(v.persist==null||v.persist(),f.setState(T,function(){return f.props.onResize&&f.props.onResize(v,j)})):f.setState(T)},f}return C=d,(p=S).prototype=Object.create(C.prototype),p.prototype.constructor=p,b(p,C),S.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},S.prototype.render=function(){var f=this.props,x=f.handle,k=f.handleSize;f.onResize;var E=f.onResizeStart,v=f.onResizeStop,j=f.draggableOpts,T=f.minConstraints,M=f.maxConstraints,R=f.lockAspectRatio,F=f.axis;f.width,f.height;var P=f.resizeHandles,D=f.style,I=f.transformScale,V=(function(O,z){if(O==null)return{};var N,$,Z={},te=Object.keys(O);for($=0;$<te.length;$++)N=te[$],z.indexOf(N)>=0||(Z[N]=O[N]);return Z})(f,r);return a.createElement(o.default,{axis:F,draggableOpts:j,handle:x,handleSize:k,height:this.state.height,lockAspectRatio:R,maxConstraints:M,minConstraints:T,onResizeStart:E,onResize:this.onResize,onResizeStop:v,resizeHandles:P,transformScale:I,width:this.state.width},a.createElement("div",h({},V,{style:u(u({},D),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},S})(a.Component);return vt.default=m,m.propTypes=u(u({},t.resizableProps),{},{children:l.default.element}),vt}var zl=(Kn||(Kn=1,Wt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Wt.exports.Resizable=_a().default,Wt.exports.ResizableBox=Ll().default),Wt.exports);const _o=n.memo(n.forwardRef((a,l)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:c=!1,disabled:h=!1,propsCommandPopupButton:i,sx:u,...g}=a,b=w.useNotifier(),[m,d]=n.useState(null),[p,C]=n.useState(()=>r.getSelectedRanges().getCoords()),[S,f]=n.useState(!1),{reference:x}=y.useFloatStack({parentFloat:i?.parentFloat}),[k,E]=n.useState(()=>c||!r.getProtection().isStructureAllowed()),v=()=>m?.text??"",[j,T]=n.useState(v),M=w.useCallbackRef(()=>{if(x?.closeAll(),!j){const Q=v();return T(v()),Q}if(v()===j)return j;const L=j.trim().toLowerCase();if(L==="r"||L==="c")return j;try{const Q=r.getRanges(j);if(Q)return Q.toString()}catch{}const H=t.getByName(j);if(H&&H.getRanges())return j;let J=null;try{const Q=r.getRanges(j),q=Q.getCoords().map(_=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,..._}));J=r.getRanges(q)}catch{}if(!J){const Q=r.getSelectedRanges().getCoords().map(q=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...q}));J=r.getRanges(Q)}try{let Q=t.getByName(j);k||Q||(Q=t.addReference(j,J)),Q&&d({text:Q.getName()})}catch(Q){T(v()),b.showMessage?.(Q.message,{type:w.NotifierType.Error})}return null},[j,t,x,k,b]),R=w.useCallbackRef(()=>{if(r.isClosed())return;const L=[];for(let Q=0;Q<p.length;Q++){const q=p[Q];L.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...q})}let H=null;try{H=t.lookupByRanges(L)}catch{}let J=null;J=H?.length>0?H[0].getName():r.getSelectedSheet().getSelectedRange().toString(),d({text:J})},[r,p]),[F,P]=n.useState(()=>t?.getItems()??null);ne.useModelListener(t,{onCollectionChange(L){P(t.getItems()),R()},onClose(L){P([])}}),n.useEffect(()=>{T(v())},[m,p]);const[D,I]=n.useState(r?.getSelectedSheet());ne.useModelListener(r,{onProtectionChange:L=>{E(c||!L.getProtection().isStructureAllowed())},onSheetsChange:L=>{I(L?.getSelectedSheet())},onViewChange(L){I(L?.getSelectedSheet())}});const[V,O]=n.useState(null),z=w.useCallbackRef(A.CommonUtils.debounce(R,V?320:0),[]);ne.useModelListener(D.getSelection(),{onChange:()=>{C(L=>{const H=r.getSelectedRanges().getCoords();return A.CoordUtils.isEqualRangesArrays(H,L)?L:H})},onAdjustingChange:L=>{O(L.getAdjusting())}}),n.useEffect(()=>{if(V){const L=r.getSelectedRange(),H=L.getRowCount(),J=L.getColumnCount();let Q=`${H}R x ${J}C`;if(Q.length>17&&(Q=`${H}x${J}`),H>1||J>1)return void d({text:Q,fontStyle:"italic",justifyContent:"center"})}d({text:r.getSelectedSheet().getSelectedRange().toString()}),z()},[p,r,V]);const N=n.useRef(null),$=n.useCallback(L=>{const{onMouseDown:H,onMouseUp:J,...Q}=L;return e.jsx(B.IconButton,{...Q,sx:{...Q?.sx,display:"flex",flex:"1 1 100%"},disableRipple:!0,children:e.jsx(B.Input,{inputMode:"text",inputProps:{tabIndex:0,name:"input-named-range",maxLength:255,className:"input",autoFocus:!1,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:"done",ref:N},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:q=>`1px solid ${q.palette.text.icon??q.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:q=>`1px solid ${q.palette.primary.main}`},"::after":{borderBottom:q=>`1px solid ${q.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",height:"1rem",fontSize:11*A.IFont.getDeviceScale(),fontStyle:m?.fontStyle,paddingLeft:q=>q.spacing(.75),paddingRight:q=>q.spacing(.75),boxShadow:"none",flex:"1",color:q=>q.palette.text.secondary,input:{padding:"0",height:"1rem",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:q=>q.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:q=>q.palette.text.primary}}},value:j,onFocus:q=>{q.target?.select()},onKeyDown:q=>{if(q.which===w.KeyCodes.Enter||q.which===w.KeyCodes.Tab){let _=j;v()!==j&&(q.stopPropagation(),q.preventDefault(),_=M()),_?Z(_):s?.()}else if(q.which===w.KeyCodes.Escape)v()!==j?(T(v()),setTimeout(()=>{q.target?.select()},0),q.stopPropagation(),q.preventDefault()):s?.();else if(q.which===w.KeyCodes.Space)return void q.stopPropagation()},onBlur:()=>{T(v())},onChange:q=>{T(q.target.value)}})})},[j,m]),Z=w.useCallbackRef(async L=>{try{x?.closeAll();const H=t.lookupByRanges(L)?.[0];H&&await H?.select(),await r.getRanges(L)?.select({autoFocus:!0})}catch(H){b.showMessage?.(H.message,{type:w.NotifierType.Error})}},[t,b,r]),te=n.useCallback(L=>{setTimeout(()=>{f(!0)},0);const H={variant:w.CommandButtonType.Menuitem,parentFloat:L.floatReference,commandHook:{...i?.commandHook,beforeExecute:(de,he)=>(x?.closeAll(),i?.commandHook?.beforeExecute?.(de,he))},scope:i?.scope,commands:i?.commands};let J=t.getItems({scope:r?.getSelectedSheet().getName()});J=J.sort((de,he)=>de.getType()===he.getType()?de.getName().localeCompare(he.getName()):de.getType()==="range"?-1:1);const Q=k?null:["editNamedReference","deleteNamedReference"],q=k?null:["editTable",null,"convertTableToRange","deleteTable"],_=[],oe=J.length;for(let de=0;de<oe;de++){const he=J[de],re=he.getRanges();if(!re||he.isHidden())continue;const ae=he.getType();ae!==J[de-1]?.getType()&&(de>0&&_.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},`type-divider-${_.length}`)),_.push(e.jsx(y.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:he.getType()==="reference"?"Ranges":"Tables"},`type-header-${_.length}`))),ae==="reference"?_.push(n.createElement(y.SimpleCommandPopupButton,{...H,key:"named-"+_.length,popupCommandKeys:Q,popupScope:"namedItem",scope:"namedItem",commandState:he,commands:i?.commands,label:he.getName(),quickCommand:"selectNamed",disabled:!he.getRanges()||h,icon:"NamedRange"})):ae==="table"&&_.push(n.createElement(y.SimpleCommandPopupButton,{...H,key:"namedItem-"+_.length,popupCommandKeys:q,popupScope:"namedItem",scope:"namedItem",commands:i?.commands,commandState:he,label:he.getName(),quickCommand:"selectNamed",disabled:!re||h,icon:"InsertTable"}))}const me=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...g,children:[k?null:e.jsx(y.CommandButton,{...H,scope:"namedItem",command:i?.commands.getCommand("addNamedReference")}),_&&_.length>0?e.jsxs(e.Fragment,{children:[k?null:e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:_})]}):null]});return y.defaultCreatePopupPanel({...L,children:me})},[r,F,t,m,k]),ee=w.useImperativeElement(l,()=>({focus(L){N.current?.focus(L)}}),[]);return e.jsx(B.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...u},ref:ze([ee,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},propsButton:{sx:{backgroundColor:L=>L.palette.background.paper,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:L=>o?L.palette.action.disabled:G.alpha(L.palette.divider,.2)},parentFloat:x,createPopupPanel:te,onPopupOpen:()=>f(!0),onPopupClose:()=>f(!1),createTooltip:({children:L},H)=>e.jsx(y.ExhibitTooltip,{title:H||S?"":"Name Box",disabled:H,leaveDelay:0,sx:{opacity:H||S?0:1},children:L}),renderQuickButton:$})})}));_o.displayName="NamedCollectionEditor";const Hl=(a,l)=>e.jsx(_o,{ref:l,...a}),Ko=n.memo(n.forwardRef((a,l)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:c=!0,propsNamedCollectionEditor:h,renderNamedCollectionEditor:i=Hl,disabled:u,commands:g,...b}=a,[m,d]=n.useState(t?.getSelectedSheet()),[p,C]=n.useState(m.getSelectedCell().getCoords()),[S,f]=n.useState(!1),x=u||S;ne.useModelListener(t,{onSheetsChange:_=>{const oe=_?.getSelectedSheet();C(oe.getSelectedCell().getCoords()),d(oe)},onViewChange(_){const oe=_?.getSelectedSheet();C(oe.getSelectedCell().getCoords()),d(oe)}});const k=n.useRef(null),E=n.useMemo(()=>({fontSize:11}),[]);ne.useModelListener(m.getSelection(),{onChange:()=>{const _=m.getSelectedCell();f(!_.isEditAllowed()),C(_.getCoords())}}),ne.useModelListener(m,{onProtectionChange(){f(!m.getSelectedCell().isEditAllowed())}});const v=k.current?.getLineHeight()??20,[j,T]=n.useState(v),[M,R]=n.useState(5),[F,P]=n.useState(1),D=w.useCallbackRef((_,{size:oe})=>{_.preventDefault(),_.stopPropagation();const me=Math.floor(oe.height/v);T(me*v+1),me>1&&R(me)},[v]),I=w.useCallbackRef((_,{size:oe})=>{const me=Math.floor(oe.height/v);P(me)},[v]),V=w.useEditMode(),O=V.getMode();let z=null;O?.key==="edit"&&(z=O.args?.stateAndCoords);const N=n.useMemo(()=>{let _=z?.editState;return _||(_=ne.createCellEditStateFromCell(()=>m.getRange(p).getCell())),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(ne.SheetCellEditor,{ref:k,activeCoords:p,sheet:m,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:p})},defaultTextStyle:E,useRichStyling:!1,disabled:x,onChangeEdit:oe=>{if(oe.dirty!==void 0){const me={sheet:m,coords:p,editState:oe};V.setMode(de=>({...de,args:{...de?.args,stateAndCoords:me}}))}},editState:_,commands:g,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:F})})},[m,z,p,F,r]),$=n.useRef(null),Z=n.useMemo(()=>c?i({names:t.getNames(),workbook:t,...h},$):null,[i,h,c,m,t,x]),te=n.useMemo(()=>e.jsxs(B.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:_=>`solid ${x?_.palette.action.disabled:G.alpha(_.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(w.DynamicIcon,{iconKey:"CloseError"}),propsTooltip:{label:"Cancel",simple:!0},disabled:x||z===null,onMouseDown:_=>{_.button===0&&_.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(w.DynamicIcon,{iconKey:"CheckSuccess"}),propsTooltip:{label:"Enter",simple:!0},disabled:x||z===null,onMouseDown:_=>{_.button===0&&_.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(w.DynamicIcon,{iconKey:"Function",style:{transform:"scale(0.85)"}}),propsTooltip:{label:"Insert Function",simple:!0},onMouseDown:_=>{_.button===0&&_.preventDefault()}})]}),[x,z]),ee=G.useTheme(),[L,H]=n.useState(!1),J=n.useMemo(()=>e.jsxs(B.Box,{className:"formula-bar",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:_=>_.spacing(.5),alignItems:"start"},children:[te,e.jsxs(B.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:_=>_.typography.fontFamily,fontSize:11*A.IFont.getDeviceScale(),alignItems:"stretch",paddingTop:"2px",paddingBottom:"2px",boxShadow:"none",borderRadius:_=>`${_.shape.borderRadius}px`,backgroundImage:`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`,border:_=>`solid ${x?_.palette.action.disabled:G.alpha(_.palette.divider,.2)} 1px`,"& textarea":{color:_=>x?`${_.palette.text.disabled} !important`:_.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:_=>{_.target?.classList.contains("react-resizable-handle")&&_.preventDefault()},children:[e.jsx(B.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignItems:"center",marginTop:"0px",paddingLeft:_=>_.spacing(1),paddingRight:_=>_.spacing(1)},children:e.jsx(zl.ResizableBox,{height:j,draggableOpts:{grid:[v,v]},minConstraints:[v,v],maxConstraints:[15*v,15*v],onResize:I,onResizeStop:D,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:N})}),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(w.DynamicIcon,{iconKey:F>1?"ExpandLess":"ExpandMore"}),propsTooltip:{label:(F>1?"Collapse":"Expand")+" Formula Bar",simple:!0},onMouseDown:_=>{_.button===0&&_.preventDefault()},onClick:()=>{const _=F>1?1:M;T(_*v+1),P(_)}}),e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:L?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:_=>_.palette.primary.main,borderRadius:_=>`${_.shape.borderRadius}px`}})]})]}),[te,N,L,F,v]),Q=n.useMemo(()=>Z||J?!Z&&J?J:Z&&!J?Z:e.jsx(e.Fragment,{children:e.jsx(w.SplitPane,{fixedPane:"before",minBefore:"165px",minAfter:"200px",propsPaneBefore:{style:{alignItems:"flex-start"}},propsPaneAfter:{style:{overflow:"visible"}},propsResizer:{style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='6' height='13' viewBox='0 0 6 13' version='1.1' fill='${ee.palette.text.icon??ee.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:J})}):null,[Z,J]),q=w.useImperativeElement(l,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>$.current}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",gap:_=>_.spacing(.5),...o},ref:q,...b,children:Q})}));Ko.displayName="FormulaBar";const Uo=n.memo(n.forwardRef((a,l)=>{const{filter:o,commands:t,disabled:r,style:s,floatReference:c,...h}=a,i=n.useMemo(()=>({}),[]),u=n.useMemo(()=>({commandHook:{beforeExecute:(m,d)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:c}),[r,c]),g=n.useMemo(()=>({...i,...u,variant:w.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(B.Box,{ref:l,style:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...h,children:b})}));Uo.displayName="FilterColumnMenu";const Ka=n.memo(n.forwardRef((a,l)=>{const{children:o,className:t,disabled:r,style:s,filter:c,...h}=a,i=w.useImperativeElement(l,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:i,className:ue("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"})]})})}));Ka.displayName="Filters";const Ua="_sheetxl-reset_11z3j_1",Wl=10,qo=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,...m}=a,d=Math.ceil(1.3*g),[p,C]=n.useReducer(E=>E+1,0);n.useEffect(()=>{if(b&&t)return t.addListeners({onAnyChange:()=>{C()}})},[t,b]);const S=n.useMemo(()=>{let E=t?.toJSON()??{};const v={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return E&&(E.styleOptions={...E.styleOptions,name:r.getName()}),E.ref=v,new A.Table({initialAnchor:v,json:E,styles:o})},[p,t,r,o]),f=n.useMemo(()=>{const E=[];for(let v=0;v<5;v++)for(let j=0;j<5;j++){const T=S.getStyleAt({colIndex:j,rowIndex:v});E.push(T)}return E},[S]),x=n.useMemo(()=>{const E=(j,T,M)=>{let R=M.getFill().toCSS(s?.darkMode??!1);const F=d-(T<4?1:0),P=g-(j<4?1:0),D=M.getFont().getFill().toCSS(s?.darkMode??!1);return R={...R,position:"absolute",boxSizing:"border-box",left:T*(d-1),top:j*(g-1),width:F,height:P},e.jsx("td",{className:`table-style-fill ${j}-${T}`,style:R,children:e.jsx("div",{className:`table-style-text ${j}-${T}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(F-6)/2,top:(P-1)/2,borderTop:`1px solid ${D}`}})},`${j}-${T}`)},v=[];for(let j=0;j<5;j++){const T=[];for(let M=0;M<5;M++){const R=f[5*j+M];T.push(E(j,M,R))}v.push(e.jsx("tr",{children:T},j))}return v},[S,r,s]),k=n.useCallback((E,v)=>f[v].getBorder()??null,[f]);return e.jsx(B.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},...m,children:e.jsx(ne.StaticBorderRenderer,{getBorderAt:k,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:ue(i,"sheetxl-table-preview",Ua),style:{borderCollapse:"collapse",width:5*(d-1)+1,height:5*(g-1)+1},children:e.jsx("tbody",{children:x})})})})})),jt=(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 p=o.toJSON(),C={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return p.styleOptions={...p.styleOptions,name:t.getName()},p.ref=C,new A.Table({initialAnchor:C,json:p,styles:r})},[o,t,r]),m=n.useMemo(()=>{const p=[];for(let C=0;C<5;C++)for(let S=0;S<5;S++){const f=b.getStyleAt({colIndex:S,rowIndex:C});p.push(f)}return p},[b]),d=n.useMemo(()=>{let p=u;if(u||(p=document.createElement("canvas")),!p)return null;p.width!==61&&(p.width=61),p.height!==46&&(p.height=46);const C=p.getContext("2d",{alpha:!1});if(!C)return null;const S=12,f=s?.darkMode??!1;for(let x=0;x<5;x++)for(let k=0;k<5;k++){const E=m[5*x+k].getFill();let v=s?.fill;E.getType()===A.IFill.Type.Solid?v=E.getColor().toCSS(f,!1):E.getType()===A.IFill.Type.Gradient?v=E.getStops[0]?.color.toCSS(f,!1):E.getType()===A.IFill.Type.Pattern&&(v=E.getForeground().toCSS(f,!1)),C.fillStyle=v;const j=k*S,T=9*x;C.fillRect(j,T,13,10)}C.lineWidth=1;for(let x=0;x<5;x++)for(let k=0;k<5;k++){const E=m[5*x+k],v=k*S,j=9*x,T=E.getBorder();if(!T.isEmpty()){const F=T.getLeft();F.isNone()||(C.strokeStyle=F.getColor().toCSS(f,!1),jt(C,v,j,v,j+9));const P=T.getTop();P.isNone()||(C.strokeStyle=P.getColor().toCSS(f,!1),jt(C,v,j,v+S,9*x));const D=T.getRight();D.isNone()||(C.strokeStyle=D.getColor().toCSS(f,!1),jt(C,v+S,j,v+S,j+9));const I=T.getBottom();I.isNone()||(C.strokeStyle=I.getColor().toCSS(f,!1),jt(C,v,j+9,v+S,j+9))}C.strokeStyle=E.getFont().getFill().toCSS(f,!1);const M=4,R=2.5;jt(C,k*S+R,9*x+M,k*S+R+7,9*x+M)}return`url(${p.toDataURL()})`},[u,b,t,s]);return e.jsx("div",{ref:l,className:ue("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:m,...d}=a;return e.jsx("div",{className:$l,children:e.jsxs(B.Box,{sx:{pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:p=>`${p.spacing(2)}`,marginRight:p=>`${p.spacing(2)}`},"& .MuiCheckbox-root":{padding:p=>`${p.spacing(.5)}`},...g},...d,ref:l,className:ue(b,Vl),children:[s&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:m||r==null}),label:"Header Row",labelPlacement:"end"}),h&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:c??!1,indeterminate:c==null,onChange:()=>h(!c),disabled:m||c==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:m||!o,onChange:()=>{t?.({...o,showRowStripes:!o?.showRowStripes})}}),label:"Banded Rows",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showFirstColumn??!1,indeterminate:!o,disabled:m||!o,onChange:()=>{t?.({...o,showFirstColumn:!o?.showFirstColumn})}}),label:"First Column",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showLastColumn??!1,indeterminate:!o,disabled:m||!o,onChange:()=>{t?.({...o,showLastColumn:!o?.showLastColumn})}}),label:"Last Column",labelPlacement:"end"}),e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:o?.showColumnStripes??!1,indeterminate:!o,disabled:m||!o,onChange:()=>{t?.({...o,showColumnStripes:!o?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),u&&e.jsx(B.FormControlLabel,{control:e.jsx(B.Checkbox,{checked:i??!1,indeterminate:i==null,disabled:m||!o||i==null,onChange:()=>u(!i)}),label:"Filter Button",labelPlacement:"end"})]})})}));var _l=function(){},Xa=typeof window<"u",Kl=Xa?n.useLayoutEffect:n.useEffect,Un={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(Un),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,m=i.height,d=i.top,p=i.left,C=i.bottom,S=i.right;s({x:u,y:g,width:b,height:m,top:d,left:p,bottom:C,right:S})}})},[]);return Kl(function(){if(l)return c.observe(l),function(){c.disconnect()}},[l]),[o,r]}:function(){return[_l,Un]},Ul="_range-row_akhf4_1",ql="_action-row_akhf4_15",Ya=n.memo(n.forwardRef((a,l)=>{const{title:o,commands:t,className:r,...s}=a,c=w.useNotifier(),[h,i]=n.useState(!1),[u,g]=n.useState(!1),b=n.useRef(null),[m,d]=n.useReducer(M=>M+1,0),[p,{width:C}]=_e(),S=w.useCommands(t,["editTable"])[0].getContext(),f=S.table(),[x,k]=n.useState(()=>f?S.getNames().getRanges(f.getRange()):null),E=n.useMemo(()=>f?.getName()??"",[f]);ne.useModelListener(S.table(),{onAnchorCoordsChange(M){k(S.getNames().getRanges(M.getRange()))},onProtectedChange(M){d()}});const v=w.useCallbackRef(M=>{S?.table().setName(M)},[S]),j=w.useCallbackRef(M=>{S?.table().resize(M.at(0))},[S]);let T=null;return S.table()||(T=e.jsx(B.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(B.Paper,{square:!0,onFocus:()=>i(!0),onBlur:M=>{b?.current?.contains(M.relatedTarget)||i(!1)},ref:ze([b,p,l]),sx:{display:"flex",flexDirection:"column",flex:"1 1 auto",width:"100%",height:"100%",overflow:"auto",paddingLeft:M=>M.spacing(1.5),paddingRight:M=>M.spacing(1.5),paddingTop:M=>M.spacing(1.5),paddingBottom:M=>M.spacing(1.5),boxSizing:"border-box"},className:ue("sxl-table-details-panel",r,{"sxl-has-focus":h}),...s,children:T||e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 auto",flexDirection:"column",transition:"opacity 60ms",opacity:S.table()?1:0},children:[e.jsx(B.Box,{sx:{containerType:"inline-size",display:"flex",flexDirection:"column",maxWidth:"100%",boxSizing:"border-box",paddingTop:M=>M.spacing(2),paddingLeft:M=>M.spacing(2),paddingRight:M=>M.spacing(2)},children:e.jsxs(B.Box,{className:Ul,children:[e.jsx(zo,{formName:"name",defaultInput:E,value:f?.getName()??"No table",onChangeInput:v,onValidate:M=>{f&&f.getName().toLowerCase()===M.toLowerCase()||S?.getNames().validateName(M)},disabled:f?.isProtected()??!0,onFocus:M=>{u||M.target?.select(),g(!0)}}),e.jsx(Ho,{formName:"range",value:x,onChangeInput:j,resolvedAddress:S.getNames().getRanges.bind(S.getNames()),disabled:f?.isProtected()??!0,onFocus:M=>{u||M.target?.select(),g(!0)}})]})}),e.jsxs(B.Box,{sx:{minHeight:"10px",flex:"1 1 100%",display:"flex",flexDirection:"column",containerType:"inline-size",gap:M=>M.spacing(.5),marginTop:M=>M.spacing(1)},children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:M=>M.spacing(1.5),marginBottom:M=>M.spacing(.75)}}),e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",justifyContent:"start",flexDirection:"column",marginTop:M=>M.spacing(1),marginBottom:M=>M.spacing(1)},children:e.jsxs("div",{style:{display:"flex",alignItems:"start",gap:"2px"},children:[e.jsx(qo,{table:f,styles:S.styles(),bodyStyle:S.bodyStyle(),cellHeight:30,isLive:!0}),e.jsx(ln,{command:t.getCommand("formatTableStyle"),commands:t,disabledQuickKey:!0})]})}),e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginTop:M=>M.spacing(1.5),marginBottom:M=>M.spacing(.75)}}),e.jsx(Ga,{disabled:f?.isProtected(),styleOptions:f?.getStyleOptions()??null,onStyleOptionsChange:M=>{f.updateStyleOptions(M)},showHeaderRow:f?.getShowHeaders(),onShowHeaderRowChange:M=>{try{f.setShowHeaders(M)}catch(R){c.showError(R)}},showTotalRow:f?.getShowTotals(),onShowTotalRowChange:M=>{try{f.setShowTotals(M)}catch(R){c.showError(R)}},showFilterButton:f?.getFilter()?f.getShowFilterButton():null,onShowFilterButtonChange:M=>{try{f.setShowFilterButton(M)}catch(R){c.showError(R)}}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsxs(B.Box,{className:ql,children:[e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:t.getCommand("convertTableToRange"),commandState:f}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:f,command:t.getCommand("deleteTable")})]})]})]})})})),Za=(a,l)=>{const{model:o,commands:t,entryKey:r,frame:s,...c}=a;return e.jsx(Ya,{ref:l,commands:t,...c})},Qa=()=>{w.DefaultDynamicIconService.register("plugin-table",{icons:{}}),ne.DefaultTaskPaneRegistry.registerTaskPane({key:"tableDetails",getTitle:()=>"Table Details",getIcon:()=>"Table",renderTaskPane:Za},!0)},Go=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:m,borderColor:d,borderWidth:p,activeColor:C,background:S="white",tabRadius:f=4,gridTheme:x,...k}=a,[E,v]=n.useState(()=>!!t&&t.getProtection().isLocked()),[j,T]=n.useState(()=>t?t.getTabColor():null);ne.useModelListener(t,{onProtectionChange:()=>{v(t.getProtection().isLocked())},onTabColorChange:()=>{T(t.getTabColor())},onStyleChange:()=>{T(t.getTabColor())}});const M=G.useTheme(),R=b===h;let F=null,P=null;if(j||m){let V=S;j?(P=j.toBlackOrWhite().toCSS(),V=j?.toCSS()):R||(V=M.palette.background.paper),F=e.jsx(B.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:R?"50%":"100%",borderRadius:"4px",border:O=>R?`${S} solid 1px`:`${O.palette.divider} solid 1px`,background:R&&j?`linear-gradient(0deg, ${V} 0%, transparent)`:V}})}let D=null;typeof d=="string"?D=d:d?.toCSS&&(D=d.toCSS());const I=R?e.jsx(B.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:V=>V.palette.primary.main}}):null;return e.jsx(G.ThemeProvider,{theme:R?x??M:M,children:e.jsx(B.Box,{ref:l,className:ue(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:m?"grabbing":void 0},...k,children:e.jsx(w.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:f,strokeColor:R?D:"transparent",children:e.jsx(B.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:m?"grabbing":void 0,color:R?"primary":P||"text.secondary",backgroundColor:R?S:"transparent","&:hover:not([disabled])":{backgroundColor:R?S:"transparent"},"& input":{color:V=>`${V.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:g,disableRipple:i,component:"div",children:e.jsxs(e.Fragment,{children:[F,e.jsxs(B.Box,{sx:{zIndex:"1",display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:"1px",lineHeight:"1",marginTop:R?void 0:"1px"},children:[o,I]}),E?e.jsx(w.DynamicIcon,{iconKey:"Lock",style:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(B.Box,{sx:{minHeight:"22px"}})]})]})},c+":"+h)})})})}));Go.displayName="SheetTab";const Xo=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,[m,d]=n.useState(o?.getProtection());ne.useModelListener(o,{onProtectionChange:x=>{d(x?.getProtection())}});const p=n.useMemo(()=>({}),[]),C=n.useMemo(()=>({commandHook:{beforeExecute:(x,k)=>h.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:c||t===void 0,parentFloat:h}),[c,h]),S=n.useMemo(()=>({...p,...C}),[p,C]),f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:r.getCommand("addSheet"),commandState:t,...S,variant:w.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r.getCommand("deleteSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsxs(y.ExhibitMenuItem,{onMouseDown:x=>{x.button===0&&x.preventDefault()},onMouseUp:()=>{Promise.resolve(h.closeAll()).then(()=>{g?.startEdit(t)})},disabled:c||!m.isStructureAllowed(),parentFloat:h,children:["Rename",s!=="sheet"?" Sheet":""]}),e.jsx(y.CommandButton,{command:r.getCommand("duplicateSheet"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r?.getCommand("protectionSheetToggle"),...S,variant:w.CommandButtonType.Menuitem}),e.jsx(ht,{variant:w.CommandButtonType.Menuitem,command:r.getCommand("formatSheetTabColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),propsPanel:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:pt.End},parentFloat:h}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{command:r.getCommand("hideSheet"),...S,variant:w.CommandButtonType.Menuitem})]});return e.jsx(B.Box,{ref:l,className:ue("menu",u),sx:{...i},...b,children:f})}));Xo.displayName="SheetTabMenu";const Yo=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 m=n.useMemo(()=>{const d=[],p=o.getSheets().getItems({visibility:A.ISheet.Visibility.Hidden}),C=o.getSelectedSheet();for(let S=0;S<p.length;S++){const f=p[S],x=f.getVisibility();if(x===A.ISheet.Visibility.VeryHidden)continue;const k=C===f,E=f.getProtection().isLocked(),v=f.getTabColor(),j=t?.body.fill??"transparent";let T=null,M=null,R=j;v&&(R=v.toCSS(),k||(M=v.toBlackOrWhite().toCSS()),T=e.jsx(B.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:k?R:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(B.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:k||x===A.ISheet.Visibility.Hidden?"50%":"100%",border:P=>k?`${j} solid 1.5px`:`${P.palette.divider} solid 1px`,background:k&&v?`linear-gradient(0deg, ${R} 0%, ${j})`:R,borderRadius:"4px"}})}));let F=null;E&&(F=e.jsx(w.DynamicIcon,{iconKey:"Lock"})),x!==A.ISheet.Visibility.Visible&&(F=e.jsx(w.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:g.isStructureAllowed()?1:.7},color:"secondary"})),F&&(F=e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:F})),d.push(e.jsx(y.ExhibitMenuItem,{disabled:!g.isStructureAllowed()&&x===A.ISheet.Visibility.Hidden,sx:{color:P=>{let D=k?P.palette.primary.main:P.palette.text.secondary;return M&&(D=M),x===A.ISheet.Visibility.Hidden&&(D=Me.alpha(D,P.palette.action.disabledOpacity)),D},borderLeft:P=>`${k?P.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",paddingTop:"4px",paddingBottom:"4px",fontWeight:k?"700":"400","&:hover":{fontWeight:"700"}},icon:k?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:P=>P.preventDefault(),onMouseUp:()=>{Promise.resolve(r.closeAll()).then(()=>{try{f.select()}catch(P){console.error(P)}})},children:e.jsxs(e.Fragment,{children:[T,e.jsxs(B.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(B.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[f.getName(),e.jsx(B.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:f.getName()})]}),F]})]})},""+S))}return d},[o,g,i,r,t]);return e.jsx(B.Box,{ref:l,className:ue("menu",c),...h,children:m})}));Yo.displayName="SheetsAllMenu";let Kt=!1,Ja=!1,$e=null;const qn=async a=>{const l=await A.LicenseManager.getDetails();if(Ja||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:()=>A.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),Kt=!0}if($e!==a&&($e=a,!Kt))try{Kt=!0,(top??window).SheetXL&&(await A.LicenseManager._validate(!0),A.LicenseManager.wasPrinted()&&(()=>{Ce.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;"),Kt=!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 to(){return to=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},to.apply(null,arguments)}function Zo(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 oo(a,l){return oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,t){return o.__proto__=t,o},oo(a,l)}function er(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,oo(a,l)}function Gn(a,l){return a.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const Xn=!1,tr=n.createContext(null);var or=function(a){return a.scrollTop},Pt="unmounted",Qe="exited",Je="entering",st="entered",Ro="exiting",Le=(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=Qe,s.appearStatus=Je):c=st:c=t.unmountOnExit||t.mountOnEnter?Pt:Qe,s.state={status:c},s.nextCallback=null,s}er(l,a),l.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Pt?{status:Qe}: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!==Je&&s!==st&&(r=Je):s!==Je&&s!==st||(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===Je){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:ot.findDOMNode(this);s&&or(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Qe&&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]:[ot.findDOMNode(this),c],i=h[0],u=h[1],g=this.getTimeouts(),b=c?g.appear:g.enter;!t&&!s||Xn?this.safeSetState({status:st},function(){r.props.onEntered(i)}):(this.props.onEnter(i,u),this.safeSetState({status:Je},function(){r.props.onEntering(i,u),r.onTransitionEnd(b,function(){r.safeSetState({status:st},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:ot.findDOMNode(this);r&&!Xn?(this.props.onExit(c),this.safeSetState({status:Ro},function(){t.props.onExiting(c),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:Qe},function(){t.props.onExited(c)})})})):this.safeSetState({status:Qe},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:ot.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=Zo(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n.createElement(tr.Provider,{value:null},typeof s=="function"?s(t,c):n.cloneElement(n.Children.only(s),c))},l})(n.Component);function at(){}Le.contextType=tr,Le.propTypes={},Le.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:at,onEntering:at,onEntered:at,onExit:at,onExiting:at,onExited:at},Le.UNMOUNTED=Pt,Le.EXITED=Qe,Le.ENTERING=Je,Le.ENTERED=st,Le.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=Gn(t.className,r):t.setAttribute("class",Gn(t.className&&t.className.baseVal||"",r)));var t,r})},Mo=(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}er(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&&or(t),c&&(this.appliedClasses[r][s]=c,(function(i,u){i&&u&&u.split(" ").forEach(function(g){return m=g,void((b=i).classList?b.classList.add(m):(function(d,p){return d.classList?!!p&&d.classList.contains(p):(" "+(d.className.baseVal||d.className)+" ").indexOf(" "+p+" ")!==-1})(b,m)||(typeof b.className=="string"?b.className=b.className+" "+m:b.setAttribute("class",(b.className&&b.className.baseVal||"")+" "+m)));var b,m})})(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=Zo(t,["classNames"]);return n.createElement(Le,to({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},l})(n.Component);Mo.defaultProps={classNames:""},Mo.propTypes={};const bo=.12,Do=(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:Me.alpha(s,.2),text:{...o.header.text,fill:a.palette.primary.main},dividerStrokeFill:Me.alpha(s,.7)},o.headerSelectAll={...o.headerSelect,fill:Me.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?Me.alpha(a.palette?.primary?.main,.1):void 0,strokeFill:a.palette?.primary?.main},o.headerSelectionInactive={...o.headerSelection,fill:a.palette?.divider?Me.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?Me.alpha(c.palette?.primary?.main,.1):void 0,strokeFill:c.palette?.primary?.main},o.selectionInactive={...o.selection,fill:c.palette?.divider?Me.alpha(c.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Me.alpha(c.palette.warning.light,.05),strokeFill:c.palette.warning.dark},l&&(o.body=t(l)),o.colorShadow=Me.alpha(c.palette.action.active,.5),o.colorGrey=c.palette.action.active,o.filterDarkInvert=h?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},Gl="_sheetxl-theme_4opcr_2",It=n.memo(n.forwardRef((a,l)=>{const{children:o,sx:t,parentFloat:r,...s}=a,c=w.useImperativeElement(l,()=>({}),[]),[h,i]=_e(),u=n.useRef(null),g=n.useRef(null),[b,m]=n.useReducer(v=>v+1,0),[d,p]=n.useState(null),[C,S]=n.useState(null),[f,x]=n.useState(null),{reference:k}=y.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{g.current={refs:[]};const v=[],j=n.Children.toArray(o);let T=0;j.forEach((M,R)=>{v.push(e.jsx(B.Box,{sx:{display:"flex"},ref:F=>{T++,T===j.length&&m();const P={current:null};P.current=F,g.current.refs[R]=P},children:M},R))}),p(v)},[o,i]),n.useLayoutEffect(()=>{if(!d)return;const v=g.current.refs,j=v?v.length:0;if(!c.current||j===0)return S(null),void x(null);const T=c.current?.getBoundingClientRect(),M=[],R=[];let F=0,P=!1;for(let I=0;!P&&I<j;I++){const V=v[I];if(!V)continue;if(!V.current){P=!0;continue}const O=V.current.getBoundingClientRect();F+=O?.width,F>T.width&&(P=!0)}if(!P)return S(null),void x([]);const D=u.current?.getBoundingClientRect();F=0;for(let I=0;I<j;I++){const V=v[I];let O=!1;if(V.current){const z=V.current.getBoundingClientRect();F+=z?.width,F<T.width-D.width&&(O=!0)}O?M.push(d[I]):R.push(d[I])}S(M.length>0?M:null),x(R.length>0?R:null)},[o,d,i,k,b]);const E=w.useCallbackRef(v=>{const j=[],T=f.length;for(let R=0;R<T;R++){const F=n.Children.toArray(f[R])[0];n.Children.toArray(F.props.children?.props?.children??F.props.children).forEach((P,D)=>{const I=P,V={...I.props,key:`overflow-${R}-${D}${I.key??""}`};V.parentFloat&&v&&(V.parentFloat=v.floatReference);const O=n.cloneElement(I,V);j.push(O)})}const M=e.jsx(B.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:j});return y.defaultCreatePopupPanel({...v,children:M})},[f]);return e.jsxs(B.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:ze([c,h,l]),...s,children:[e.jsx(B.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:C??d}),e.jsx(B.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:E,ref:u,parentFloat:k,createTooltip:({children:v},j)=>e.jsx(y.ExhibitTooltip,{label:"More",description:"More toolbar options…",disabled:j,children:v}),icon:e.jsx(w.DynamicIcon,{iconKey:"MoreHorizontal"})})})]})})),nr="https://unpkg.com/@sheetxl/scripting-templates/dist",Xl=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(" "))},ar=async a=>{const l=ct.IOUtils.relativePath(a,"./manifest.json"),o=await fetch(l);if(!o.ok)throw new Ce.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 Ce.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=ct.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:Xl(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",Yl=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(w.DynamicIcon,{iconKey:"ScriptFormula",size:Co,style:yo}):i==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:Co,style:yo}):e.jsx(w.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!==w.KeyCodes.Enter&&u.keyCode!==w.KeyCodes.Space||r(o)},...c,children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:o.metadata?.title??o.path}),e.jsx(B.Typography,{variant:"caption",component:"div",sx:{color:u=>Me.alpha(u.palette.text.secondary??u.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),Zl=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:c=nr,...h}=a,[i,u]=n.useState([]),[g,b]=n.useState(!0),m=w.useCommands(o,["executeSelectedScript"]),d=m[0]?.getContext();n.useEffect(()=>{(async()=>{try{const C=await ar(c);u(C)}catch{}finally{b(!1)}})()},[c]);const p=n.useCallback((C,S)=>{if(g)return e.jsx("div",{children:"Loading..."});const f={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},x=v=>{d.getEditor()?.insertSnippet(v.content),C.closeFloat()},k=[];for(let v=0;v<i.length;v++){const j=i[v];j&&k.push(e.jsx(Yl,{handleInsert:x,snippet:j},j.path))}const E=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[k.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:k}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...f,key:"help",command:o.getCommand("help")})]});return y.defaultCreatePopupPanel({...C,children:E})},[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:p,icon:"ScriptInsert",...h})})),rr=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,propsCommandButton:r,...s}=a,c=w.useCallbackRef(h=>{const{propsCommandButton:i,propsCommandPopup: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(It,{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(It,{parentFloat:t,style:{},children:e.jsx(Zl,{...i,commands:o})})})]})})},[o]);return e.jsx(y.CommandToolbar,{ref:l,commands:o,parentFloat:t,propsCommandButton:r,renderToolbarPalette:c,...s})}));rr.displayName="ScriptEditorToolbar";const lr=n.memo(n.forwardRef((a,l)=>{const{scriptPath:o=nr,onScriptSelect:t,sx:r=w.ReactUtils.EmptyCssProperties,className:s,buttonMinWidth:c=210,buttonMinHeight:h=80,gap:i=12,...u}=a,[g,b]=n.useState([]),[m,d]=n.useState(!0),[p,C]=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),C(null);const k=await ar(o);for(let E=0;E<k.length;E++){const v=k[E];v&&x.push(v)}}catch(k){C(k instanceof Error?k.message:"Failed to load scripts"),k instanceof Ce.ChainedError||console.error("Error loading scripts:",k)}finally{b(x),d(!1)}})()},[o]),m)return e.jsx(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:ue(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(B.CircularProgress,{})});let S=null;p&&(S=e.jsxs(B.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:ue(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(B.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(B.Typography,{color:"error",component:"div",children:p})]}));const f=x=>{const k=x.metadata?.icon;return k==="macro"?e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro",size:"1em"}):k==="formula"?e.jsx(w.DynamicIcon,{iconKey:"ScriptFormula",size:"1em"}):k==="autostart"?e.jsx(w.DynamicIcon,{iconKey:"ScriptAutoStart",size:"1em"}):null};return e.jsxs(B.Box,{ref:l,className:ue(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(B.Box,{p:3,className:"script-select-content",sx:{overflow:"auto",flex:"1 1 auto"},children:[e.jsx(B.Typography,{variant:"h6",gutterBottom:!0,children:"Script Template"}),e.jsx(B.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(B.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Templates provide a foundation to customize and meet your specific needs."}),e.jsx(B.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,k)=>e.jsxs(B.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",...k===0&&{borderStyle:"dashed",marginBottom:"8px"},...k===1&&{gridColumn:"1"}},onClick:()=>t?.(x),children:[e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:x.metadata?.title||x.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),f(x)]}),x.metadata?.summary&&e.jsx(B.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}-${k}`))})]}),S]})}));lr.displayName="TemplateSelectPanel";const ir=n.memo(n.forwardRef((a,l)=>{const{className:o,sx:t,propsScriptEditor:r,commands:s,readOnly:c=!1,frame:h,autoFocusSel:i,autoFocus:u=!0,scripts:g,...b}=a,m=G.useTheme(),[d,p]=n.useState(!1),C=n.useRef(!1),[S,f]=n.useState({message:"Loading",cursor:"",dirty:!1}),[x,k]=n.useState(null);n.useEffect(()=>{let z=!1;return k(null),(async function(){if(g&&(await g.start(),!z)){const N=g.getModules().getItems()[0]?.getSource();k({source:N||null})}})(),()=>{z=!0}},[g]);const E=n.useCallback(z=>{f(N=>({...N,...z}))},[]),v=n.useRef(null),[j,T]=n.useState(null),M=n.useRef(null),R=w.useCallbackRef(z=>{if(j)return j.focus(z),!0;if(i){const N=v.current?.querySelectorAll?.(i);if(N&&N.length>0)return N[0]?.focus?.(z),!0}return v.current?.focus?.(z),!1},[j,i,u]),F=n.useMemo(()=>e.jsx(y.AnimatedLoadingPanel,{transitionDelay:"160ms",style:{position:"absolute",width:"100%",height:"100%"},transparentBackground:!1}),[]),P=n.useMemo(()=>e.jsx(B.Paper,{elevation:1,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,marginLeft:z=>z.spacing(.5),marginRight:z=>z.spacing(.5),marginTop:z=>z.spacing(1),marginBottom:z=>z.spacing(1)},children:e.jsx(rr,{commands:s})}),[m,s]),D=n.useMemo(()=>e.jsx(B.Box,{className:ue("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 ${m.palette.divider}`},children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"center",flexDirection:"row",justifyContent:"center"},children:[e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"1 1 100%",color:z=>z.palette.text.secondary},variant:"caption",children:S.message}),e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",color:z=>z.palette.text.secondary},variant:"caption",children:S.dirty?"Unsaved":""}),e.jsx(B.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",marginLeft:"8px",minWidth:"90px",display:"flex",justifyContent:"end",color:z=>z.palette.text.secondary},variant:"caption",children:S.cursor})]})}),[S]),I=n.useMemo(()=>e.jsxs(B.Box,{className:ue("script-editor-content"),sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"column",boxSizing:"border-box"},children:[P,e.jsx(B.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:F,readOnly:c,frame:h,autoFocus:u,commands:s,onStatusChange:E,darkMode:m.palette.mode==="dark",...r})}),D]}),[m,s,P,D,d,F,c,r,u,i,h,E]),V=n.useMemo(()=>{let z;return x===null?null:(x.source===null&&(z=e.jsx(lr,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:N=>{v.current?.getEditor()?.insertSnippet(N.content),k({source:N.content??""})}})),e.jsx(B.Box,{tabIndex:0,className:ue("script-workspace",o),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none"},onPointerDown:N=>{N.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(B.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[I,z]})}))},[P,I,o,x]),O=w.useImperativeElement(l,()=>({isScriptWorkspaceElement:()=>!0,focus:z=>{R(z)}}),[]);return e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:O,...b,onFocus:z=>{p(!0),C.current=!0,O.current?.contains(z.target)&&z.target!==O.current&&T(z.target),z.relatedTarget&&!M.current&&(M.current=z.relatedTarget),b?.onFocus?.(z)},onBlur:z=>{O?.current?.contains(z.relatedTarget)||O?.current===z.relatedTarget||(M.current=null,C.current=!1,p(!1)),b?.onBlur?.(z)},children:V})}));ir.displayName="ScriptWorkspace";const Ql=(a,l)=>{const{model:o,commands:t,entryKey:r,frame:s,...c}=a;return e.jsx(ir,{ref:l,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...c})},sr=n.memo(n.forwardRef((a,l)=>{const{commands:o,...t}=a,r=w.useCommands(o,["executeScript","showScriptEditor"]),[s,c]=n.useState([]),[h,i]=n.useState(!1),u=r[0]?.getContext();n.useEffect(()=>{const p=u?.getScripts();p&&(async()=>{i(!0);const C=await p.searchFunctions({type:"macro"});c(C),i(!1)})()},[]);const g={variant:w.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},b=[],m=s.length;for(let p=0;p<m;p++){const C=s[p];b.push(e.jsx(y.CommandButton,{...g,command:o.getCommand("executeScript"),commandState:{declaration:C},propsTooltip:{description:`Execute ${C.getName()??"macro"}`},icon:e.jsx(w.DynamicIcon,{iconKey:"ScriptMacro"}),label:C.getName()??`Script '${C.getName()}'`},`macro-${C.getName()}-${p}`))}const d=e.jsxs(B.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(B.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})}));sr.displayName="RunScriptPopupPanel";const dr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h="showScriptEditor",i=w.useCommands(o,["executeScript","showScriptEditor"])[0].getContext(),u=n.useCallback((g,b)=>{const m=e.jsx(sr,{...g,commands:b});return y.defaultCreatePopupPanel({...g,children:m})},[s,i,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,commands:o,commandHook:t,createPopupPanel:u,selected:o.getCommand(h).getState(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:h,...c})})),Jl=a=>e.jsx(y.CommandButton,{...a}),cr=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,propsCommandButton:r,...s}=a,[c,h]=n.useState(!1),i=w.useCommands(o,["executeScript","showScriptEditor"]),u=i[0]?.getContext();n.useEffect(()=>{const m=u?.getScripts();if(!m)return;const d=i[1],p=async()=>{if(!d)return;let f=!1;if(!d.getState()){const x=await m.searchFunctions({type:"macro"}),k=x?.length??0;for(let E=0;x&&!f&&E<k;E++)f=!0}h(f||!!d.getState())};p();const C=d.addPropertyListener(()=>{p()}),S=m.addListeners({onChange:()=>{p()}});return()=>{S(),C()}},[u]);const g=ne.useTaskPaneArea(),b=n.useCallback(m=>{const{propsCommandButton:d,propsCommandPopup:p}=m,C=ne.DefaultTaskPaneRegistry.findContributions("ribbon/home");let S;const f=C.length;if(f>0){S=[];for(let T=0;T<f;T++){const M=C[T],R=M.createCommand?.(g);if(!R)continue;const F={command:R,...p},P=(M.createCommandButton??Jl)(F);S.push(P)}}const x=e.jsx(ht,{...p,command:o.getCommand("formatFontColor"),isSplit:!0,propsPanel:{disableAlpha:!0}}),k=e.jsx(ht,{...p,command:o.getCommand("formatFillColor"),isSplit:!0,propsPanel:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:pt.End}}),E=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(an,{...p,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Da,{...p})}):null;let j=null;return c&&(j=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{}),e.jsx(dr,{...p})]})),e.jsxs(It,{parentFloat:t,children:[E,null,E?e.jsx(y.ExhibitDivider,{}):null,e.jsx(rn,{...p,command:o.getCommand("paste")}),e.jsx(y.CommandButton,{...d,command:o.getCommand("formatPainterToggle")}),e.jsx(io,{...d,command:o.getCommand("copy")}),e.jsx(y.ExhibitDivider,{}),e.jsx(yr,{...p,command:o.getCommand("formatFontFamily")}),e.jsx(Pa,{...p,command:o.getCommand("formatFontSize")}),e.jsx(y.CommandButton,{...d,command:o.getCommand("formatBoldToggle")}),e.jsx(y.CommandButton,{...d,command:o.getCommand("formatItalicToggle")}),e.jsx(Sr,{...p}),e.jsx(Cr,{...p}),e.jsx(Ba,{...p}),k,x,e.jsx(y.ExhibitDivider,{}),e.jsx(ya,{...p}),e.jsx(Ca,{...p}),e.jsx(wa,{...p}),e.jsx(Sa,{...p}),e.jsx(Ra,{...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(Fa,{...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(jr,{command:o.getCommand("formatCellStyle"),...p}),e.jsx(ln,{command:o.getCommand("formatTableStyle"),...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(Oo,{...p}),e.jsx(Ao,{...p}),e.jsx(Lo,{...p}),e.jsx(y.ExhibitDivider,{}),e.jsx(dn,{...p}),e.jsx(Ia,{...p}),e.jsx(No,{...p}),e.jsx(nn,{...p}),v,j,S]})},[o,i,c,g]);return e.jsx(y.CommandToolbar,{ref:l,commands:o,parentFloat:t,propsCommandButton:r,renderToolbarPalette:b,...s})}));cr.displayName="HomeToolbar";const ur=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,propsCommandButton:r,...s}=a,c=w.useCallbackRef(h=>{const{propsCommandButton:i,propsCommandPopup:u}=h;return e.jsxs(It,{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,propsCommandButton:r,renderToolbarPalette:c,...s})}));ur.displayName="InsertToolbar";const mr=n.memo(n.forwardRef((a,l)=>{const{commands:o,parentFloat:t,propsCommandButton:r,...s}=a,c=w.useCallbackRef(h=>{const{propsCommandButton:i,propsCommandPopup:u}=h;return e.jsxs(It,{parentFloat:t,children:[e.jsx(Ma,{...u}),e.jsx(y.CommandButton,{...u,command:o.getCommand("protectionSheetToggle")}),e.jsx(y.ExhibitDivider,{}),e.jsx(xr,{...u}),e.jsx(wr,{...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(kr,{...u}),e.jsx(Er,{command:o.getCommand("selectTheme"),...u}),e.jsx(y.ExhibitDivider,{}),e.jsx(dr,{...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,propsCommandButton:r,renderToolbarPalette:c,...s})}));mr.displayName="ViewToolbar";const pr=a=>e.jsx(fr,{...a}),ei=n.memo(a=>{const{sx:l,...o}=a;return e.jsxs(B.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(B.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(B.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),ti=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(ei,{label:l[i].label},l[i].label));return h},[l]);return e.jsx(B.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})}),oi=n.memo(a=>{const{toolbars:l,value:o,onToolbarChange:t,propsSelect: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(B.MenuItem,{value:u,sx:{color:b=>{if(o===u)return b.palette.primary.main}},children:g},g))}return i},[l,o]);return e.jsx(B.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(B.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})})}),fr=n.memo(n.forwardRef((a,l)=>{const{commands:o,wrapperSelect:t,propsSelect:r=Ce.CommonUtils.EmptyObject,isCompact:s=!1,wrapperPalette:c,propsToolbars:h=Ce.CommonUtils.EmptyObject,propsPalette:i=Ce.CommonUtils.EmptyObject,workbook:u,sx:g,...b}=a,m=n.useMemo(()=>{const v=[],{ref:j,...T}=h?.Home||Ce.CommonUtils.EmptyObject;v.push({label:"Home",component:e.jsx(cr,{commands:o,...T})});const{ref:M,...R}=h?.Insert||Ce.CommonUtils.EmptyObject;v.push({label:"Insert",component:e.jsx(ur,{commands:o,...R})});const{ref:F,...P}=h?.View||Ce.CommonUtils.EmptyObject;return v.push({label:"View",component:e.jsx(mr,{commands:o,...P})}),v},[o,u]),d=n.useMemo(()=>{const v=[];for(let j=0;j<m.length;j++)v.push(n.cloneElement(m[j].component,{...m[j].component.props,key:m[j].key??m[j].label}));return v},[m]),[p,C]=n.useState(0),S=v=>{C(v)},f=n.useMemo(()=>s?e.jsx(oi,{toolbars:m,value:p,onToolbarChange:S,sx:r}):e.jsx(ti,{toolbars:m,value:p,onToolbarChange:S,sx:r}),[m,p,r,s]),{sx:x,...k}=i,E=e.jsx(B.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},...k,children:d[p]});return e.jsxs(B.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(E):E]})}));var Yn,Zn;fr.displayName="WorkbookToolbars",(function(){if(Zn)return Yn;Zn=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 ut=="object"&&ut&&ut.Object===Object&&ut,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 m(p){var C=typeof p;return!!p&&(C=="object"||C=="function")}function d(p){if(typeof p=="number")return p;if((function(f){return typeof f=="symbol"||(function(x){return!!x&&typeof x=="object"})(f)&&i.call(f)=="[object Symbol]"})(p))return NaN;if(m(p)){var C=typeof p.valueOf=="function"?p.valueOf():p;p=m(C)?C+"":C}if(typeof p!="string")return p===0?p:+p;p=p.replace(a,"");var S=o.test(p);return S||t.test(p)?r(p.slice(2),S?2:8):l.test(p)?NaN:+p}Yn=function(p,C,S){var f,x,k,E,v,j,T=0,M=!1,R=!1,F=!0;if(typeof p!="function")throw new TypeError("Expected a function");function P(z){var N=f,$=x;return f=x=void 0,T=z,E=p.apply($,N)}function D(z){var N=z-j;return j===void 0||N>=C||N<0||R&&z-T>=k}function I(){var z=b();if(D(z))return V(z);v=setTimeout(I,(function(N){var $=C-(N-j);return R?g($,k-(N-T)):$})(z))}function V(z){return v=void 0,F&&f?P(z):(f=x=void 0,E)}function O(){var z=b(),N=D(z);if(f=arguments,x=this,j=z,N){if(v===void 0)return(function($){return T=$,v=setTimeout(I,C),M?P($):E})(j);if(R)return v=setTimeout(I,C),P(j)}return v===void 0&&(v=setTimeout(I,C)),E}return C=d(C)||0,m(S)&&(M=!!S.leading,k=(R="maxWait"in S)?u(d(S.maxWait)||0,C):k,F="trailing"in S?!!S.trailing:F),O.cancel=function(){v!==void 0&&clearTimeout(v),T=0,f=j=x=v=void 0},O.flush=function(){return v===void 0?E:V(b())},O}})();var Qn,Jn,ea={exports:{}},So={};Jn||(Jn=1,ea.exports=(function(){if(Qn)return So;Qn=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}}),m=b[0].inst,d=b[1];return r(function(){m.value=g,m.getSnapshot=u,c(m)&&d({inst:m})},[i,g,u]),t(function(){return c(m)&&d({inst:m}),i(function(){c(m)&&d({inst:m})})},[i]),s(g),g};return So.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:h,So})()),ea.exports;var ta,oa,Et={exports:{}},dt={exports:{}},ni=dt.exports;(function(){if(oa)return Et.exports;oa=1;for(var a=(ta||(ta=1,function(){var b,m,d,p,C,S;typeof performance<"u"&&performance!==null&&performance.now?dt.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(dt.exports=function(){return(b()-C)/1e6},m=process.hrtime,p=(b=function(){var f;return 1e9*(f=m())[0]+f[1]})(),S=1e9*process.uptime(),C=p-S):Date.now?(dt.exports=function(){return Date.now()-d},d=Date.now()):(dt.exports=function(){return new Date().getTime()-d},d=new Date().getTime())}.call(ni)),dt.exports),l=typeof window>"u"?ut: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 m=a(),d=Math.max(0,g-(m-h));h=d+m,setTimeout(function(){var p=u.slice(0);u.length=0;for(var C=0;C<p.length;C++)if(!p[C].cancelled)try{p[C].callback(h)}catch(S){setTimeout(function(){throw S},0)}},Math.round(d))}return u.push({handle:++i,callback:b,cancelled:!1}),i},s=function(b){for(var m=0;m<u.length;m++)u[m].handle===b&&(u[m].cancelled=!0)}}Et.exports=function(b){return r.call(l,b)},Et.exports.cancel=function(){s.apply(l,arguments)},Et.exports.polyfill=function(b){b||(b=l),b.requestAnimationFrame=r,b.cancelAnimationFrame=s},Et.exports})();var Ie={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 hr=a=>{const{workbook:l,workbookElement:o,target:t,commands:r,darkMode:s}=a,c=w.useNotifier(),[h,i]=n.useState(l?.getSelectedSheet()),[u,g]=n.useState(l?.getSheets().getItems()),b=ne.useTaskPaneArea(),m=n.useMemo(()=>[new w.SimpleCommand("activateTask",t,{label:"Activate Task",description:"Activate Task Pane.",shortcut:{key:"F6"}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.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 w.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new w.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new w.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",icon:"Find",shortcut:[{key:"F",modifiers:[w.KeyModifiers.Ctrl]},{key:"F5",modifiers:[w.KeyModifiers.Shift]}]}),new w.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",icon:"FindReplace",shortcut:[{key:"H",modifiers:[w.KeyModifiers.Ctrl]},{key:"H",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Alt]}]}),new w.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",icon:"GoTo",shortcut:[{key:"G",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new w.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new w.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new w.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new w.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new w.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 w.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new w.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Shift]},{key:"F1",modifiers:[w.KeyModifiers.Alt,w.KeyModifiers.Shift]}]}),new w.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new w.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl]}]}),new w.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}]}),new w.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new w.Command("selectNamed",t,{label:R=>R?.getName()??"Select Named Item",scopedLabels:{namedItem:R=>R?.getName()??"Select"},description:"Select the item."}),new w.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 w.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 w.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference.",icon:"DeleteNamedRange"}),new w.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Alt]}}),new w.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Shift]}}),new w.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:[w.KeyModifiers.Ctrl]}}),new w.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"},icon:"FullScreen"}),new w.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",icon:"ScriptRun",shortcut:[{key:"F11",modifiers:[w.KeyModifiers.Alt]}]}),new w.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new w.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts.",icon:"ScriptSave"}),new w.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[w.KeyModifiers.Ctrl]}}),new w.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new w.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 w.CommandGroup(t,"workbook"),R.addCommands(m,!0),R},[r,m]),p=w.useEditMode(),C=n.useRef(null),S=w.useCallbackRef(()=>{let R,F=null;const P=d.getCommand("executeScript");if(P.update({disabled:!1,context:{getScripts:()=>l.getScripts()}}),!P)return;const D=d.getCommand("showScriptEditor");D.updateCallback(function(O=!0){F?F.close():b.activateTaskPane("scriptEditor",{})});const I=d.getCommand("executeSelectedScript");if(!I)return;const V={saveSource:async O=>{let z=null,N=null;const $=l.getScripts();try{O&&(N=await c.showBusy("Saving Scripts..."),z=await $.createModule({source:O})),$.addModule("scripts",z,{replace:!0}),N?.()}catch(Z){N?.(),console.warn("Unable to compile",Z),c.showError(Z)}return z},addContainerListener:O=>(f.current=O,()=>{f.current=null}),setSelectedFunction:O=>{R=O??C.current??null,Promise.resolve(R).then(z=>{I.update({disabled:z===null})})},quickInsertFunction:O=>{const z=`=${O.toUpperCase()}(`,N={text:z+")",editMode:!0,initialSelection:{start:z.length,end:z.length+0}};p.setMode($=>$?.key==="edit"?{...$,args:{...$.args}}:{key:"edit",args:{stateAndCoords:null,start:N}})},getSelectedFunction:()=>R,setEditor:O=>{F=O??null,D.update({state:F!==null})},getEditor:()=>F,getRanges:O=>{try{return l.getRanges(O)}catch{}return null},getScripts:()=>l.getScripts()};I.update({context:V})},[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 F={disabled:!R.getProtection().isStructureAllowed()};d.getCommand("hideSheet").update(F),d.getCommand("deleteSheet").update(F),d.getCommand("addSheet").update(F),d.getCommand("duplicateSheet").update(F),d.getCommand("selectTheme").update(F),d.getCommand("addNamedReference").update(F),d.getCommand("editNamedReference").update(F),d.getCommand("deleteNamedReference").update(F)},onScriptsChange:R=>{S()}});const{isFullscreenAvailable:x,isFullscreenEnabled:k,toggleFullscreen:E}=(function(R={}){const{target:F,onChange:P,onError:D,requestFullScreenOptions:I}=R,[V,O]=n.useState(!1),[z,N]=n.useState(null),[$,Z]=n.useState(!1),te=n.useCallback(()=>Ie.requestFullscreen(F?.current||null,I),[F,I]),ee=n.useCallback(()=>Ie.exitFullscreen(),[]),L=n.useCallback(()=>Ie.fullscreenElement?ee():te(),[te,ee]),H=n.useCallback(Q=>{const q=Ie.fullscreenElement;N(q),Z(!!q),P?.(Q)},[P]),J=n.useCallback(Q=>{const q=Ie.fullscreenElement;N(q),Z(!!q),D?.(Q)},[D]);return n.useEffect(()=>{O(Ie.fullscreenEnabled)},[]),n.useEffect(()=>(Ie.on("change",H),Ie.on("error",J),()=>{Ie.off("change",H),Ie.off("error",J)}),[H,J]),{isFullscreenAvailable:V,fullscreenElement:z,isFullscreenEnabled:$,enableFullscreen:te,disableFullscreen:ee,toggleFullscreen:L}})({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 j=w.useCallbackRef(async function(R,F){let P=null;const D=l.getScripts();if(R?.declaration||R?.functionName){const I=R.declaration?R.declaration.getName():R.functionName;(await D.searchFunctions({name:I})).length>0&&(P=I)}if(P)try{await D.executeMacro(P),C.current=Promise.resolve({source:null,name:P})}catch(I){return void c.showError(I)}},[l,c]);n.useEffect(()=>{d.getCommand("newCellStyle").updateCallback(R=>{c.showInput({initialValue:(()=>{let F=0;for(;;){F++;const P=`Style ${F}`;try{return l.getStyles().validateStyleName(P,!0),P}catch{}}})(),title:d.getCommand("newCellStyle")?.getLabel("cellStyle"),description:"Enter a name for the new cell style.",inputLabel:"Style Name",propsInput:{style:{minWidth:"300px"}},options:["Ok","Cancel"],defaultOption:"Ok",onValidateInput:async(F,P)=>{let D=null;try{l.getStyles().validateStyleName(F,!1)}catch(O){D=O.message}let I=l.getStyles().getNamed(F),V=D;return!V&&I&&(V=`Update style '${I.getName()}'.`),{valid:D===null,message:V}}}).then(({input:F,option:P})=>{const D=l.getSelectedSheet().getSelectedRange();if(P!=="Ok")return;const I=l.getStyles().setNamed({name:F,style:D.getCell().getStyle()});D.getStyle().update({named:I.getName()})})}),d.getCommand("deleteCellStyle").updateCallback(R=>{R.delete()}),d.getCommand("modifyCellStyle").updateCallback(({named:R})=>{const F=l.getSelectedSheet().getSelectedRange();l.getStyles().setNamed({name:R.getName(),style:F.getCell().getStyle()})}),d.getCommand("hideSheet").updateCallback(R=>{l.getSheetAt(R).setVisibility(A.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(j),d.getCommand("executeSelectedScript").updateCallback(j)},[l,c]);const T=w.useCallbackRef(async R=>{let F=0,P=null,D="Find & Replace";R?.replace&&!R?.replaceOptions?.maxCount&&(D="Replace All");const I=await c.showBusy(D);try{const V=R?.scope??"sheet";let O=null;const z=l.getSelectedSheet(),N={from:z.getSelectedCell(),...R.findOptions};if(O=V==="sheet"?l.getSelectedSheet().find(N):l.find(N),R.replace){const $=l.replace(O,R.replaceText,R.replaceOptions);F=$.count,R.replaceOptions.maxCount&&(P=$.last)}else{let $=O.next();$.done||(F++,P=$.value)}P?.select({autoFocus:!1}),I?.(),!R.replaceOptions.maxCount&&F>1&&c.showMessage(`We replaced ${F} cells.`)}catch(V){I?.(),c.showError(V)}return F},[l,o]),M=w.useCallbackRef(R=>{const F={selection:()=>{const D=l.getSelectedRanges(),I=D.getCount(),V=new Array(I);for(let O=0;O<I;O++){const z=D.at(O).getFixed(!0).getCoords();V[O]=z}return l.getRanges(V)},getNames:()=>l.getNames()},P={initialValue:R,context:()=>F,onInput:async D=>{try{await D.select()}catch(I){c.showMessage(I.message,{type:w.NotifierType.Error})}}};return c.showWindow("namedDetails",P)},[c,l,o]);return n.useEffect(()=>{const R=(F=!1)=>{const P={initialValue:{findOptions:{text:l.getSelectedCell().toTextUnformatted(!0)},replace:F},context:()=>T,onKeyDown:D=>{d.findCommandByEvent(D)!==d.getCommand("find")&&d.findCommandByEvent(D)!==d.getCommand("findReplace")||D.preventDefault()},autoFocus:!0,disableAutoDestroy:!0};c.showWindow("find",P)};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 F={onInput:async P=>{try{b.activateTaskPane(P)}catch(D){c.showError(D.message)}},title:d.getCommand("activateTask")?.getLabel(),inputLabel:"Task Name",options:["Activate"]};c.showInput(F)}),d.getCommand("goto")?.update({disabled:!c}).updateCallback(()=>{const F={onInput:async P=>{try{await l.getRanges(P).select()}catch(D){c.showMessage(D.message,{type:w.NotifierType.Error})}},title:d.getCommand("goto")?.getLabel(),inputLabel:"Location",options:["Go To"]};c.showInput(F)}),d.getCommand("selectNamed")?.update({disabled:!c}).updateCallback(async F=>{if(F)try{await F.select()}catch(P){c.showError(P)}}),d.getCommand("addNamedReference")?.updateCallback(async function(F){M(null)}),d.getCommand("editNamedReference")?.updateCallback(async function(F){M(F)}),d.getCommand("deleteNamedReference")?.updateCallback(async function(F){F?.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:k,disabled:!x,icon:k?"FullScreenOff":"FullScreen"}).updateCallback(()=>{E()})},[k,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},ai="_sheetxl-workbook_g5t6x_5",io=n.memo(n.forwardRef((a,l)=>{const{command:o,...t}=a,r=w.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(w.DynamicIcon,{iconKey:"copy.walking",propsSource:{isWalking:s,themedType:h}}),...t})})),gr=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,p)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:c}),[r,c]),g=n.useMemo(()=>({variant:w.CommandButtonType.Menuitem,...i,...u}),[i,u]),b=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:c,...u}),[t,u,c]),m=e.jsxs(e.Fragment,{children:[e.jsx(io,{command:t.getCommand("copy"),...g,variant:w.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(B.Box,{ref:l,sx:{paddingTop:"4px",paddingBottom:"4px",...s},...h,children:m})}));gr.displayName="MovableContextMenu";const Qo=n.memo(n.forwardRef((a,l)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:c=!1,readOnly:h=!1,propsContextMenu:i,renderContextMenu:u=pi,propsSheetsAll:g,renderSheetsAll:b=fi,propsSheetTab:m,renderSheetTab:d,background:p="transparent",className:C,sx:S,borderWidth:f,borderColor:x,gridTheme:k,gridStyle:E,...v}=a,[j,T]=n.useState(o?.getSelectedSheetIndex()),[M,R]=n.useState(o?.getSheets().getItems()),[F,P]=n.useState(o?.getProtection());ne.useModelListener(o,{onViewChange(K){T(K?.getSelectedSheetIndex())},onSheetsChange:K=>{R(K.getSheets().getItems())},onProtectionChange:K=>{P(K?.getProtection())}});const D=h||!F.isStructureAllowed(),I=n.useMemo(()=>{const K=[];for(let W=0;W<M.length;W++)K.push(M[W].getName());return K},[M]),V=n.useCallback(K=>{r?.(K)!==!1&&(o.getSheetAt(K).select(),s?.(K))},[o,r,s]),O=n.useCallback((K,W)=>{o.getSheetAt(K).setName(W),s?.(K)},[o,s]),z=n.useCallback((K,W)=>{o.getSheetAt(K).setPosition(W),s?.(W)},[o,s]),N=w.useCallbackRef(()=>{if(r?.(j)===!1)return;const K=j+1;o.getSheets().add({name:void 0,autoSelect:!0}),s?.(K)},[o,r,s,j]),$=n.useMemo(()=>({placement:"top-start"}),[]),Z=n.useRef(null),[te,ee]=n.useState(!1),L=n.useCallback(K=>{const{closeFloatAll:W,floatReference:X}=K;return b({workbook:o,gridStyle:E,floatReference:X,closeFloatAll:W,...g})},[b,g,c,o,E]),{reference:H,component:J}=y.useFloatStack({label:"allSheet",propsPopper:$,anchor:Z.current,onOpen:()=>ee(!0),onClose:()=>ee(!1),createPopupPanel:L}),Q=n.useRef(null),[q,_]=n.useState(null),oe=n.useCallback(K=>{const{floatReference:W}=K;return u?.({workbook:o,index:q?.index,tabStripRef:Q.current,commands:t,disabled:c,floatReference:W,...i})},[u,i,c,o,t,q]),{reference:me,component:de}=y.useFloatStack({label:"sheetTab",propsPopper:$,anchor:{getBoundingClientRect:()=>new DOMRect(q?.left||0,q?.top||0,0,0)},onClose:()=>_(null),createPopupPanel:oe});n.useEffect(()=>{q?me.open(0):me.close(0)},[q]);const he=n.useCallback((K,W)=>{K.preventDefault(),_({left:K.clientX-2,top:K.clientY-4,index:W})},[]),re=w.useCallbackRef(K=>{let W;try{W=o?.getSheetAt(K.index)}catch{}return W?(d??hi)({sheet:W,gridTheme:k,onContextMenu:X=>{V(K.index),he(X,K.index)},...K,...m}):null},[d,m,o,k]),ae=n.useMemo(()=>D?null:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(B.IconButton,{disabled:c,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:K=>K.palette.primary.main},color:K=>K.palette.text.icon??K.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:K=>{K.button===0&&K.preventDefault()},onClick:()=>N(),children:e.jsx(w.DynamicIcon,{iconKey:"AddCircle"})})}),[c,D,N]);return e.jsxs(B.Box,{ref:l,className:ue(C),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...S},...v,children:[e.jsx(ne.TabStrip,{ref:Q,selectedTabIndex:j,tabNames:I,onSelectedTabIndexChange:V,onTabNameChange:O,onTabMove:z,background:p,borderColor:x,borderWidth:f,activeColor:null,disabled:c,disableDrag:D,renderScrollButtonStart:y.renderScrollButtonStart,renderScrollButtonEnd:y.renderScrollButtonEnd,renderScrollButtonEdge:y.renderScrollButtonEdge,renderTabButton:re,renderTabDivider:K=>{const{key:W,...X}=K;return e.jsx(y.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:se=>G.alpha(se.palette.divider,.25)},...X},W)},propsEditLabel:{readOnly:D,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:K=>{o.isValidSheetNameCharacter(K.key)||K.preventDefault()},onCancel:()=>{s?.(j)}},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:te?"":"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:K=>K.palette.text.icon??K.palette.action.active},ref:Z,dense:!0,outlined:!1,selected:te,color:"primary","aria-label":"menu",onMouseDown:K=>{K.button===0&&K.preventDefault()},onClick:()=>{te?H.close(0):H.open(0)},icon:e.jsx(w.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:ae}),e.jsx("div",{style:{borderTop:`solid ${x} ${f}px`,flex:1,minWidth:"24px"}}),de,J]})}));Qo.displayName="WorkbookStrip";const Jo=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(D=>D+1,0),[b,m]=n.useState(o.getSelectedSheet()),[d,p]=n.useState(b.getSelectedRanges()),[C,S]=n.useState(b.getSelectedCell());ne.useModelListener(o,{onSheetsChange(){m(o.getSelectedSheet())}}),ne.useModelListener(b.getSelection(),{onChange(){p(b.getSelectedRanges()),S(b.getSelectedCell())}}),w.useCommands(t,[],{onChange:()=>{g()}});const f=n.useMemo(()=>({}),[]),x=n.useMemo(()=>({commandHook:{beforeExecute:(D,I)=>c.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:c}),[r,c]),k=n.useMemo(()=>({...f,...x,variant:w.CommandButtonType.Menuitem}),[f,x]),E=n.useMemo(()=>({commands:t,variant:w.CommandButtonType.Menuitem,parentFloat:c,...x}),[t,x,c]),v=[];let j=d.isEntireRows(),T=d.isEntireColumns();d&&(j&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideColumns"),...k,key:"context:"+v.length}))),T&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideRows"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideRows"),...k,key:"context:"+v.length}))),(j||T)&&v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),j&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitColumns"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...k,command:t.getCommand("resizeColumns"),key:"context:"+v.length}))),T&&(v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitRows"),...k,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{...k,command:t.getCommand("resizeRows"),key:"context:"+v.length}))));const M=[],R=t.getCommand("formatTableStyle"),F=R?.getContext()?.table();if(w.useCommand(R),!j&&!T){if(M.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+M.length)),C?.getHyperlink())M.push(n.createElement(y.SimpleCommandPopupButton,{...E,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+M.length,quickCommand:"openHyperlink"}));else{const D=t.getCommand("updateHyperlink");M.push(n.createElement(y.CommandButton,{command:D,...k,key:"contextBefore:"+M.length}))}if(C?.getComments())M.push(n.createElement(y.SimpleCommandPopupButton,{...E,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+M.length,quickCommand:"updateComments"}));else{const D=t.getCommand("updateComments");M.push(n.createElement(y.CommandButton,{command:D,...k,key:"contextBefore:"+M.length}))}F?M.push(n.createElement(y.SimpleCommandPopupButton,{...E,variant:w.CommandButtonType.Menuitem,key:"contextBefore:"+M.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:F,quickCommand:"editTable"})):M.push(n.createElement(y.CommandButton,{command:t.getCommand("insertTable"),...k,key:"context:"+v.length})),M.push(n.createElement(sn,{...E,key:"contextBefore:"+M.length}))}const P=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:t.getCommand("cut"),...k}),e.jsx(io,{command:t.getCommand("copy"),...k}),e.jsx(rn,{command:t.getCommand("paste"),...E,includePasteAllInPopup:!1}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(nn,{...E}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(Oo,{commands:t,...E,disableSheet:!0}),e.jsx(Ao,{commands:t,...E,disableSheet:!0}),e.jsx(No,{...E}),M,v]});return e.jsx(B.Box,{ref:l,className:ue("menu",h),sx:{...s},...i,children:P})}));Jo.displayName="WorkbookContextMenu";const ri=a=>e.jsx(gr,{...a}),li=a=>e.jsx(Jo,{...a}),ii=a=>e.jsx(Uo,{...a}),si=a=>e.jsx(Ko,{...a}),en=a=>e.jsx(y.AnimatedLoadingPanel,{transitionDelay:"160ms",transparentBackground:!0,...a}),di=a=>e.jsx(y.StackTraceErrorPanel,{fullscreen:!0,...a}),ci=a=>e.jsx(ne.SheetElement,{...a}),ui=a=>e.jsx($o,{...a}),mi=a=>e.jsx(Qo,{...a}),pi=a=>e.jsx(Xo,{...a}),fi=a=>e.jsx(Yo,{...a}),hi=a=>e.jsx(Go,{...a}),gi={fireOnModelChange:!1},na={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},tn=n.memo(n.forwardRef((a,l)=>{const{workbook:o,onElementLoad:t,autoFocus:r=!1,style:s,className:c,onFocus:h,onBlur:i,onKeyDown:u,onRepeatCommandChange:g,commands:b,showFormulaBar:m,propsFormulaBar:d,renderFormulaBar:p=si,showTabs:C,propsTabs:S,renderTabs:f=mi,showStatusBar:x,propsStatusBar:k,renderStatusBar:E=ui,propsToolbar:v,renderToolbar:j=pr,propsContextMenu:T,renderContextMenu:M=li,renderFilterMenu:R=ii,renderMovableMenu:F=ri,renderLoading:P=en,propsLoading:D,propsSheet:I,renderSheet:V=ci,wrapperMain:O,showHorizontalScrollbar:z,showVerticalScrollbar:N,gridTheme:$,headersTheme:Z,enableDarkImages:te,...ee}=a;if(!o)throw new Error("IWorkbook must be provided.");const L=G.useTheme(),H=n.useRef(null),[J,Q]=n.useState(!1),q=n.useRef(null),_=n.useMemo(()=>e.jsx(B.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:q}),[]),[oe,me]=n.useState(!1),[de,he]=n.useState(!1),re=n.useCallback(()=>{me(!0)},[]),ae=n.useRef(null),K=w.useImperativeElement(l,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>o,getSheetElement:()=>H.current,getViewportElement:()=>q.current,getFormulaBarElement:()=>ae.current,focus(){H&&H.current&&H.current.focus()}}),[o]),W=n.useRef(null);n.useLayoutEffect(()=>{!oe||!K.current||(async()=>(W.current!==t&&(await t?.({source:K.current}),W.current=t),he(!0)))()},[oe,K.current]),qn(K.current);const X=n.useCallback(U=>(H.current?.submitEdit(),!0),[]),se=n.useCallback(()=>{requestAnimationFrame(()=>{H?.current?.focus()})},[]),[le,pe]=n.useState(o.getSelectedSheet()),[je,Se]=n.useState(o.getProtection());ne.useModelListener(o,{onSheetsChange:U=>{pe(U?.getSelectedSheet())},onViewChange(U){pe(U?.getSelectedSheet())},onProtectionChange:U=>{Se(U?.getProtection())}}),ne.useModelListener(o,{onRequestSelect:async(U,ce)=>new Promise(ye=>{H.current.getSheet()!==ce?H.current.getGridElement()?.onViewChangeOnce(()=>{H.current.getSheet()!==ce&&ye(!1),ye(!0)}):ye(!0)})},gi);const[Be,Ee]=n.useReducer(U=>U+1,0),ke=o.getView();ne.useModelListener(ke,{onViewChange:U=>{Ee()}});const Y=$??L,ie=n.useMemo(()=>Do(L,Y),[L,Y]),Ue=Z??L,co=n.useMemo(()=>Do(L,Ue),[L,Ue]),[gt,Lt]=n.useState(null);n.useCallback(()=>{H.current.focus()},[]);const ge=hr({workbook:o,workbookElement:K.current,target:()=>H.current,commands:b,darkMode:ie.body.darkMode}),qe=n.useRef(null),[Ge,pn]=n.useState(!1),[fn,hn]=n.useState(null),[gn,Zr]=n.useState(w.ToolTipPlacement.Top),[xt,Qr]=n.useState(A.TypesUtils.EmptyBounds),uo=n.useCallback(()=>{pn(!1),hn(null)},[]),bt=n.useCallback((U,ce,ye=w.ToolTipPlacement.Top)=>{Qr(U),Zr(ye),hn(ce),qe.current!==null&&setTimeout(()=>{qe.current!==null&&qe.current.update()},160),pn(!0)},[]),[os,xn]=n.useState("sheet"),Xe=C??ke?.isShowTabs(),Ye=z??ke?.isShowHorizontalScrollbar(),Jr=m??ke?.isShowFormulaBar(),zt=x??ke?.isShowStatusBar(),bn=N??ke?.isShowVerticalScrollbar(),nt=ie?.header?.edgeStrokeFill||"rgb(171,171,171)",el=n.useMemo(()=>zt?E({sheet:le,gridStyle:ie,...k}):null,[E,k,zt,ie,le]),tl=n.useMemo(()=>j({commands:ge,workbook:K.current,...v}),[ge,j,v,L]),[ol,{width:mo}]=_e(),Ze=mo===0||mo>560,po=n.useMemo(()=>{if(!Xe)return null;let U=f({background:ie.body.fill,borderWidth:1,borderColor:nt,gridTheme:Y,gridStyle:ie,onBeforeUserChange:X,onUserChange:se,workbook:o,commands:ge,propsSheetTab:{},...S});return Ze||(U=e.jsx("div",{style:{flex:"none",display:"flex"},children:U})),U},[f,S,L,o,Y,Ze,ge,Xe]),yn=n.useCallback(U=>{const{style:ce,...ye}=U;let we=null,Ne=null,ve=null;if(Ye&&(Ne=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${nt} 1px`,flexDirection:"column",justifyContent:"center"},children:e.jsx(ne.SheetScrollbar,{...ye,style:{paddingLeft:"4px",paddingRight:"4px",...ce},propsTouchThumb:{backgroundColor:Y.palette.background.paper,borderColor:Y.palette.primary.main,fillColor:"grey"},endGap:700,sheet:le,onShowTooltip:Te=>{bt({x:Te.anchor.x,y:Te.anchor.y,width:0,height:0},Te.display,Te.placement)},onCloseTooltip:()=>uo()})})),Xe&&Ze&&(ve=po),Xe&&Ze&&!Ye&&(ve=e.jsxs(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[ve,e.jsx(B.Box,{sx:{borderTop:`solid ${nt} 1px`,flex:"1"}})]})),ve&&Ye)we=e.jsx(w.SplitPane,{position:o.getView().getTabRatio()/10+"%",onPositionChange:({percent:Te})=>{o.getView().setTabRatio(Math.round(10*Te))},minBefore:"200px",minAfter:"180px",propsResizer:{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='${L.palette.text.icon??L.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 ${nt} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:ve,elementAfter:Ne});else if(Ye)we=Ne;else{if(!ve)return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:zt?null:`solid ${nt} 1px`}});we=ve}return e.jsx(B.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:we})},[le,X,o,ie,Y,ge,Xe,Ye,zt,Ze]),[De,yt]=n.useState(null),nl=n.useMemo(()=>({placement:"right-start",...De?.propsPopper}),[De?.propsPopper]),{reference:Cn,component:al}=y.useFloatStack({label:"contextMenu",propsPopper:nl,anchor:De?.anchor??{getBoundingClientRect:()=>new DOMRect(De?.clientX||0,De?.clientY||0)},onClose:()=>yt(null),createPopupPanel:De?.createPopupPanel});n.useEffect(()=>{De?Cn.open(0):Cn.close(0)},[De]);const rl=w.useCallbackRef((U,ce)=>{if(U?.isDefaultPrevented())return!0;U.preventDefault(),De&&De.anchor===U.currentTarget?yt(null):yt({anchor:U.currentTarget,propsPopper:{offsets:[-4,2]},createPopupPanel:ye=>{const{floatReference:we}=ye;return R({filter:ce,commands:ge,floatReference:we,...T})}})},[R,T,ge,o,De]),Sn=w.useCallbackRef(U=>{if(U.originalEvent?.isDefaultPrevented())return!0;U.originalEvent?.preventDefault(),yt({clientX:U.clientX,clientY:U.clientY,createPopupPanel:ce=>{const{floatReference:ye}=ce;return M({commands:ge,workbook:o,floatReference:ye,...T})}})},[M,T,ge,o]),ll=w.useCallbackRef((U,ce)=>{if(U?.isDefaultPrevented())return!0;U.preventDefault(),yt({clientX:U.clientX,clientY:U.clientY,createPopupPanel:ye=>{const{floatReference:we}=ye;return F({movable:ce,commands:ge,floatReference:we,...T})}})},[F,T,ge]);n.useMemo(()=>{const U=[new w.SimpleCommand("openContextMenu",()=>H.current,{label:"Context Menu",description:"Open the context menu.",shortcut:[{key:"F10",modifiers:[w.KeyModifiers.Shift]},{key:"ContextMenu"}]})];ge.addCommands(U,!0)},[ge]),n.useEffect(()=>{ge.getCommand("openContextMenu").updateCallback(()=>{const U=le.getSelection().getCoords().cell;H.current?.getGridElement()?.scrollCellCoordsIntoView(U).then(ce=>{requestAnimationFrame(()=>{const ye=le.getView().getZoomScale()/100,we=le.getColumnHeaders().findOffset(U.colIndex+1)*ye,Ne=le.getRowHeaders().findOffset(U.rowIndex+1)*ye,ve=H.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};Sn({clientX:we-ve.x-ce.left+6,clientY:Ne-ve.y-ce.top+6})})})})},[le]);const il=w.useCallbackRef(U=>{ge?.dispatchToFocusedCommand(U)},[ge]),sl=w.useCallbackRef(()=>{qn(K.current)},[]),dl=n.useCallback(()=>{xn("sheet")},[]),cl=n.useCallback(()=>{xn("formulaBar")},[]),ul=n.useCallback(U=>{const{style:ce,...ye}=U;return e.jsx(ne.SheetScrollbar,{...ye,style:{...ce,paddingTop:"4px",paddingBottom:"4px"},propsTouchThumb:{backgroundColor:Y.palette.background.paper,borderColor:Y.palette.primary.main,fillColor:"grey"},sheet:le,endGap:700,onShowTooltip:we=>{bt(we.anchor,we.display,w.ToolTipPlacement.Left)},onCloseTooltip:()=>uo()})},[le,Y]);n.useEffect(()=>{r&&H&&H.current&&H.current.focus()},[]);const wn=n.useRef(null),ml=n.useMemo(()=>e.jsx(Mo,{in:!de,nodeRef:wn,timeout:500,classNames:"animating",unmountOnExit:!0,children:e.jsx(B.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",left:"0px",top:"0px",width:"100%",height:"100%",position:"absolute",boxSizing:"border-box",pointerEvents:de?"none":s?.pointerEvents},children:P?.({ref:wn,...D})})}),[de,P,D]),pl=n.useMemo(()=>p({ref:ae,sx:{marginTop:U=>U.spacing(.25),marginLeft:U=>U.spacing(1),marginRight:U=>U.spacing(1)},workbook:o,sheetElement:H.current,gridStyle:ie,onFocus:cl,...d,propsNamedCollectionEditor:{restoreFocus:U=>H.current.focus(U),...d?.propsNamedCollectionEditor,propsCommandPopupButton:{commands:ge,...d?.propsNamedCollectionEditor?.propsCommandPopupButton}}}),[p,d,o,ie,ge,de]),fl=n.useCallback(U=>{const{movable:ce,...ye}=U,we={movable:ce,onContextMenuCapture:Te=>{ll(Te,ce)},...ye},Ne=ce.getContent().getType();let ve=null;if(Ne==="picture")return e.jsx(ne.PictureEditor,{loadingPanel:e.jsx(y.AnimatedLoadingPanel,{style:{position:"absolute"},transitionDelay:"100",sx:{border:Te=>`solid 1px ${Te.palette.action.active}`}}),picture:ce.getContent(),description:ce.getDescription()??ce?.getName(),...we});if(Ne==="chart"){const Te={...we,chart:ce.getContent()};return e.jsx(ne.ChartEditor,{...Te})}if(ve=`Float of type '${Ne}'.`,typeof ve=="string"){const Te={...we,description:ve};ve=e.jsx(ne.EmptyFrame,{...Te})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ve},ce.getUUID())},[]),kn=n.useMemo(()=>V({ref:H,style:na,onFocus:dl,gridStyle:ie,headersStyle:co,sheet:le,commands:ge,onSheetContextMenu:Sn,onViewportChange:U=>{Lt(U)},showScrollbars:!1,viewportComponent:_,onRepeatCommandChange:g,onElementLoad:re,onShowColumnTooltip:U=>{bt(U.anchor,U.display,w.ToolTipPlacement.Top)},onShowRowTooltip:U=>{bt(U.anchor,U.display,w.ToolTipPlacement.Right)},onShowTooltip:U=>{bt({x:U.anchor.x,y:U.anchor.y,width:0,height:0},U.display,U.placement)},onCloseTooltip:()=>uo(),renderMovable:fl,...I,propsCellRender:{onFilterButtonMouseDown:(U,ce)=>{I?.propsCellRender?.onFilterButtonMouseDown(U,ce),rl(U,ce)},...I?.propsCellRender}}),[ge,I,le,ie,g]),hl=n.useMemo(()=>{let U=e.jsx(w.ScrollPane,{ref:ol,style:na,viewport:gt,touchElement:H.current?.getGridElement()?.stage,onScrollViewport:ce=>{H.current?.getGridElement()?.scrollTo(ce)},showHorizontalScrollbar:Ye||Xe,showVerticalScrollbar:bn,renderScrollbarHorizontal:yn,renderScrollbarVertical:ul,children:kn});return Ze||mo===0||(U=e.jsxs(e.Fragment,{children:[U,po]})),O?O(U):U},[Ye,Xe,yn,bn,gt,Ze,kn,po,L,O,Y]),gl=n.useMemo(()=>e.jsx(y.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:Ge,title:e.jsx(B.Typography,{variant:"subtitle2",component:"div",children:fn}),placement:gn,slotProps:{transition:{timeout:{exit:0}},popper:{popperRef:qe,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:Ge?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(xt.x,xt.y,xt.width,xt.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]}},children:e.jsx(B.Box,{})}),[Ge,fn,gn,xt,qe]),xl=n.useMemo(()=>({boxSizing:"border-box",background:U=>U.palette.mode!=="dark"?ie.header.fill:U.palette.background.paper,"& *":{...y.scrollbarTheming(L),fontWeight:400},"& .viewport-overlay":{borderRight:`solid ${nt} 1px`},...s}),[s,ie]),bl=n.useMemo(()=>e.jsx(B.Box,{sx:{marginBottom:U=>U.spacing(.75)}}),[]),yl=n.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:de?void 0:0,"--sxl-app-color-high-contrast":L.palette.primary.main,"--sxl-app-color-primary":L.palette.primary.main,"--sxl-app-color-primary-dark":L.palette.primary.dark,"--sxl-app-color-primary-light":L.palette.primary.light,"--sxl-app-color-info":L.palette.info.main,"--sxl-app-color-info-dark":L.palette.info.dark,"--sxl-app-color-info-light":L.palette.info.light,"--sxl-app-color-secondary":L.palette.secondary.main,"--sxl-app-color-secondary-dark":L.palette.secondary.dark,"--sxl-app-color-secondary-light":L.palette.secondary.light,"--sxl-app-color-success":L.palette.success.main,"--sxl-app-color-success-dark":L.palette.success.dark,"--sxl-app-color-success-light":L.palette.success.light,"--sxl-app-color-warning":L.palette.warning.main,"--sxl-app-color-warning-dark":L.palette.warning.dark,"--sxl-app-color-warning-light":L.palette.warning.light,"--sxl-app-color-error":L.palette.error.main,"--sxl-app-color-error-dark":L.palette.error.dark,"--sxl-app-color-error-light":L.palette.error.light,"--sxl-app-color-text":L.palette.text.primary,"--sxl-app-color-text-secondary":L.palette.text.secondary,"--sxl-app-color-text-disabled":L.palette.text.disabled,"--sxl-app-color-background":L.palette.background.paper,"--sxl-app-color-button-surface":L.palette.grey[600],"--sxl-app-color-shadow":L.palette.action.focus,"--sxl-app-color-grey":L.palette.grey[500],"--sxl-app-filter-dark-invert":ie.body.darkMode&&te?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":ie.body.darkMode?`linear-gradient(${G.alpha("#fff",G.getOverlayAlpha(5))}, ${G.alpha("#fff",G.getOverlayAlpha(5))})`:void 0}),[ie,L,de]),Cl=n.useMemo(()=>ue(Ua),[]);return e.jsxs(B.Box,{className:ue("sheetxl-workbook",ai,{"Mui-focusVisible":J},Gl,c),sx:xl,style:s,...ee,ref:K,onFocus:U=>{Q(!0),sl(),h?.(U)},onBlur:U=>{Q(!1),i?.(U)},onKeyDown:U=>{il(U),u?.(U)},children:[e.jsxs("div",{className:Cl,style:yl,children:[tl,Jr?pl:null,bl,hl,el,gl,al]}),ml]})}));tn.displayName="WorkbookElement";const xi=(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`}},on=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),[m,d]=n.useState(!1),[p,C]=n.useState(r??""),[S,f]=n.useState(""),[x,{width:k}]=_e(),[E,{width:v}]=_e(),[j,T]=n.useState(!1),M=n.useRef(null),R=n.useRef(null),F=w.useImperativeElement(l,()=>({requestWorkbookTitle:(P=null,D)=>{R.current={onAccept:P,requestReason:D?.requestReason},D?.selectAll&&M.current?.select(),M.current?.focus(D)},focus:P=>{M.current?.focus(P)}}),[]);return n.useLayoutEffect(()=>{T(r!==p),f(r),C(r)},[r]),n.useEffect(()=>{j&&k!==0&&Ce.CommonUtils.debounce(()=>{T(!1)},300)()},[j,k]),n.useEffect(()=>{d(p&&!ct.IOUtils.isValidWindowsFilename(p))},[p]),i?null:e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:j?"0":"1",transition:j?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:ze([F,E,l]),...u,children:e.jsx(y.ExhibitTooltip,{label:R.current?.requestReason??"Workbook Name",children:e.jsxs(B.Box,{className:ue({"Mui-focusVisible":g}),sx:{visibility:k===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",...xi(!0,h),...o},children:[h?e.jsx(B.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:p!==S?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:P=>m?P.palette.error.dark:void 0},children:r??s}):e.jsx(B.Input,{sx:{width:`${Math.min(k+3,Math.max(v,F.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:P=>m?P.palette.error.dark:void 0,fontStyle:p!==S?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:h,spellCheck:!1,placeholder:s,onFocus:P=>{b(!0),P.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:M},onBlur:()=>{b(!1),m?C(S):(p!==S&&(c?.(p),p&&R.current?.onAccept?.(p,"blur")),R.current=null)},onChange:P=>{if(P.target.value.length>ct.IOUtils.MAX_WORKBOOK_NAME_SIZE)return P.stopPropagation(),void P.preventDefault();C(P.target.value)},onKeyDown:P=>{(ct.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(P.key)||P.target?.value.length>ct.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&P.preventDefault(),P.which===w.KeyCodes.Enter||P.which===w.KeyCodes.Tab?(m?C(S):(c?.(p),p&&(R.current?.onAccept?.(p,"keydown"),R.current=null)),P.stopPropagation(),P.preventDefault(),t?.focus()):P.which===w.KeyCodes.Escape&&(p===S?t?.focus():(C(S),setTimeout(()=>{P.target?.select()},0)),R.current=null,P.stopPropagation(),P.preventDefault())},value:p}),e.jsx(B.Box,{ref:x,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:p!==S?"italic":void 0,fontFamily:P=>P.typography.fontFamily,letterSpacing:"0.00938em"},children:p||s})]})})})}));on.displayName="WorkbookTitle";const ht=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:c=w.CommandButtonType.Toolbar,quickColor:h,propsPanel:i,isSplit:u=!1,darkMode:g,icon:b,...m}=a,{autoColor:d,schemeLookup:p,recentColors:C,...S}=i;if(m.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");w.useCommand(o);const f=o?.getContext();let x=h??f?.quickColor;u&&!x&&(x=new A.Color("transparent"));const k=d??f?.autoColor,E=p??f?.schemeLookup,v=C??f?.recentColors,j=g??f?.darkMode,T=n.useMemo(()=>({autoColor:k,schemeLookup:E,recentColors:v,darkMode:j,...S}),[k,E,v,j]),M=w.useCallbackRef((F,P)=>{F&&P&&f?.addRecentColor&&f.addRecentColor(F),f?.onColorSelect&&f.onColorSelect(F),r?.(F,P),o?.execute(F,t)},[o,r,t,f]),R=n.useCallback((F,P)=>{const{children:D,title:I,...V}=F;let O=F.children;return(o?.disabled()||s)&&(O=e.jsx("div",{children:O})),e.jsx(y.CommandTooltip,{command:o,placement:c===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:P,...V,children:O})},[o,s]);return e.jsx(Io,{ref:l,propsPanel:T,icon:b??o?.getIcon(f),quickColor:x,selectedColor:o?.getState(),onSelectColor:M,variant:c===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:R,label:o?.getLabel(),disabled:s||!o||o.disabled(),compareRGB:!0,darkMode:j,...m})}));ht.displayName="ColorCommandButton";const xr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...h}=a,i=w.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),u=n.useCallback((g,b)=>{const m={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:b.getCommand("gridlinesToggle")}),e.jsx(ht,{...m,command:b.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(w.DynamicIcon,{iconKey:"stroke.colored"}),propsPanel:{disableAlpha:!0}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:b.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("sheetViewToggleGridlinesRows")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:l,parentFloat:c,quickCommand:i[0]?.getKey(),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})})),nn=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"}))),bi=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:w.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})})),an=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,m=[o];!r&&s&&m.push("redo");const d=w.useCommands(g,m),p=d[0],C=d[1],S=c??p?.getContext?.()?.undoManager;let f=u;u||(f=!p||p.disabled(),C&&!C.disabled()&&(f=!1));const[x,k]=n.useState(0),E=n.useCallback((v,j)=>{let T=x===0?"Cancel":`${p.getLabel()} ${x} Action${x===1?"":"s"}`,M=!1;S||(M=!0),M||(M=s?!S.hasRedo()&&!S.hasUndo():!S.hasRedo());const R=O=>{p.execute(O)},F=e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:M?void 0:"0 0",minWidth:"180px"},icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(0)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&R(x)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==w.KeyCodes.Enter&&O.keyCode!==w.KeyCodes.Space||R(x)},children:e.jsx(B.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:T})});if(M)return F;const P=r?S?.getRedoDescriptions():S?.getUndoDescriptions(),D=[];for(let O=0;O<P.length;O++){const z=P[O];D.push(e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:f,selected:O<x,icon:e.jsx(w.DynamicIcon,{}),onMouseEnter:()=>{k(O+1)},onMouseDown:N=>{N.button===0&&N.preventDefault()},onMouseUp:N=>{N.button===0&&R(O+1)},onKeyDown:N=>{N.isDefaultPrevented()||N.keyCode!==w.KeyCodes.Enter&&N.keyCode!==w.KeyCodes.Space||R(O+1)},children:e.jsxs(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(B.Typography,{component:"div",children:z}),e.jsx(w.DynamicIcon,{})]})},`action:${O}`))}let I=null;if(!r&&s){const O={scope:"undo",commands:j,variant:w.CommandButtonType.Menuitem,parentFloat:v.floatReference};I=[],I.push(e.jsx(an,{...O,quickCommand:"redo",isRedo:!0},"nested:redo")),S.hasRedo()&&S.hasUndo()&&I.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const V=e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{v.closeFloatAll()},onMouseLeave:()=>{k(0)},children:[I,e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:D}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),F]});return y.defaultCreatePopupPanel({...v,children:V})},[p?.getContext(),p?.getState(),h,S,x,f]);return e.jsx(y.CommandPopupButton,{ref:l,commands:g,quickCommand:o,scope:h,disabled:f,label:p?.getLabel()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${p?.getLabel()??"No"} last actions.`})}),createPopupPanel:E,icon:t??(r?"Redo":"Undo"),selected:!1,...b})})),ft=A.IFontCollection.getFontList(),br=new Map;for(let a=0;a<ft.length;a++)br.set(ft[a].fontRef.getFamily(),ft[a]);const yr=n.memo(n.forwardRef((a,l)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:c,icon:h,label:i,...u}=a;w.useCommand(o);const g=o?.getState(),b=G.useTheme(),m=n.useMemo(()=>`${A.IFont.getSharedMeasurer()("Times New Roman",Math.round(b.typography.fontSize),b.typography.fontFamily).width}px`,[b]),d=n.useCallback(p=>{const C=k=>{o?.execute(k,t)},S=[];for(let k=0;k<ft.length;k++)S.push({key:ft[k].fontRef.getFamily(),description:ft[k].fontRef.getFamily()});br.get(g)||S.unshift({key:g,description:g});const f=[];for(let k=0;k<S.length;k++){const E=S[k].key===g;f.push(e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",paddingTop:"4px",paddingBottom:"4px"},selected:E,disabled:s||!o||o.disabled(),icon:E?e.jsx(y.SelectedIcon,{}):void 0,onMouseUp:v=>{v.button===0&&C(S[k].key)},onMouseDown:v=>{v.button===0&&v.preventDefault()},onKeyDown:v=>{v.keyCode!==w.KeyCodes.Enter&&v.keyCode!==w.KeyCodes.Space||C(S[k].key)},children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>S[k]?.key},children:S[k].description})})},k+""+S[k].key))}const x=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...u,children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:f})});return y.defaultCreatePopupPanel({...p,children:x})},[s,o?.getState()]);return e.jsx(y.ExhibitPopupIconButton,{ref:l,sx:{...r},outlined:!0,disabled:s,parentFloat:c,createPopupPanel:d,createTooltip:({children:p},C)=>e.jsx(y.ExhibitTooltip,{label:o?.getLabel(),description:o?.getDescription(),disabled:C,children:p}),icon:e.jsx(B.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:p=>`${Math.round(p.typography.fontSize)}px`,fontFamily:p=>p.typography.fontFamily,color:p=>p.palette.text.secondary,width:m},children:e.jsx(B.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:g})}),...u})})),Cr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),i=n.useMemo(()=>{const g=h.length;for(let b=0;b<g;b++){const m=h[b];if(m?.getState())return m}return h[0]},[h]),u=n.useCallback((g,b)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:b.getCommand("formatStrikeThroughToggle")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("formatSuperscriptToggle")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("formatSubscriptToggle")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:i?.getKey(),commands:o,commandHook:t,createPopupPanel:u,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:i?.getIcon()??"TextStrike",...c})})),Sr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),i=n.useMemo(()=>{const g=h.length;for(let b=0;b<g;b++)if(h[b]?.getState())return h[b];return h[0]},[h]),u=n.useCallback((g,b)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:b.getCommand("formatUnderlinedToggle")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(y.CommandButton,{...m,command:b.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return y.defaultCreatePopupPanel({...g,children:d})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:i?.getKey(),commands:o,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:u,icon:i?.getIcon()??"TextUnderline",...c})})),rn=n.memo(n.forwardRef((a,l)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:c=!0,disabled:h=!1,...i}=a,u=w.useCallbackRef((g,b)=>{const m={variant:w.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:h},d=[];return c&&(d.push(n.createElement(y.CommandButton,{...m,command:b.getCommand("paste"),key:"paste"})),d.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),d.push(n.createElement(y.CommandButton,{...m,command:b.getCommand("pasteValues"),key:"pasteValues"})),d.push(n.createElement(y.CommandButton,{...m,command:b.getCommand("pasteFormats"),key:"pasteFormats"})),d.push(n.createElement(y.CommandButton,{...m,command:b.getCommand("pasteFormulas"),key:"pasteFormulas"})),d.push(n.createElement(y.CommandButton,{...m,command:b.getCommand("pasteTranspose"),key:"pasteTranspose"})),d.push(n.createElement(y.CommandButton,{...m,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})})),wr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:c,...h}=a,i=w.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),u=n.useCallback((g,b)=>{const m={variant:w.CommandButtonType.Menuitem,parentFloat:g.floatReference,commandHook:t,scope:r,disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:b.getCommand("sheetViewToggleShowHeadings")}),e.jsx(y.CommandButton,{...m,command:b.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:b.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(y.CommandButton,{...m,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]?.getKey(),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})})),kr=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:w.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})})),vr=n.memo(n.forwardRef((a,l)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:c,sx:h,propsBorder:i,disabled:u,...g}=a,b=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),m=n.useMemo(()=>b.getStyle(),[b,c]),d=n.useMemo(()=>m.getFill().toCSS(c?.darkMode??!1),[m]),p=m.getInsets(),C=m.getFont(),S=n.useCallback(()=>m.getBorder(),[m]);return e.jsx(B.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%",...C.toCSS(c?.darkMode??!1,1),boxSizing:"border-box",padding:`${p.top}px ${p.right}px ${p.bottom}px ${p.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:C.toCSS().textDecoration,textAlign:A.ITextFrame.toCSSHorizontalTextAlign(b.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...h},...g,children:e.jsx(ne.StaticBorderRenderer,{getBorderAt:S,darkMode:c?.darkMode??!1,rowCount:1,columnCount:1,style:{height:"100%",width:"100%",...i?.style},...i,children:e.jsx(B.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-2px",marginBottom:"-2px",display:"flex",alignItems:"center"},children:e.jsx(B.Box,{className:"text",children:o})})})})})),yi=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,...m}=a,d=n.useCallback(S=>{const f={variant:w.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()===A.IStyle.BuiltInName.Normal})]}),k=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x})});return y.defaultCreatePopupPanel({...S,children:k})},[]),p=o?.getName()===t?.getName();let C=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:S=>`solid ${p?S.palette.primary.dark:"transparent"} 1px`},propsTooltip:{label:o.getName(),placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{c?.(o)},...m,children:e.jsx(vr,{value:o.getName(),cellStyle:{named:o.getName()},styles:l,createTemporaryCell:h,bodyStyle:s})},o.getName());return r&&(C=e.jsx(y.ContextMenu,{label:o.getName(),parentFloat:i,createPopupPanel:d,children:C})),C}),jr=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;w.useCommand(t);const b=t?.getContext(),m=b?.styles,d=s??b?.named(),p=i??b?.bodyStyle(),C=w.useCallbackRef(E=>{c?.(E),t?.execute(E,r)},[t,c,r]),S=n.useCallback((E,v)=>{const j={onSelectNamed:C,styles:m(),parentFloat:E.floatReference},T=m().getCustomNamed(),M=new Map,R=[];for(let N=0;N<T.length;N++)M.set(T[N].getName(),T[N]),m().getNamed(T[N].getName()).getBuiltInID()===null&&R.push(T[N].getName());const F=N=>{let $=M.get(N);return $||($=m().getNamed(N)),!$||$.isHidden()?null:e.jsx(yi,{namedStyle:$,selectedNamed:d,bodyStyle:b.bodyStyle(),createTemporaryCell:b.createTemporaryCell,commands:o,commandHook:r,...j},N)},P=(N,$,Z=!0)=>{const te=[];for(let ee=0;ee<$.length;ee++){const L=F($[ee]);L&&te.push(L)}return te.length===0?null:e.jsxs(B.Box,{children:[Z?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:N},N+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:te},N+"-presets")]},N)},D=(N,$)=>{const Z=[];for(let te=0;te<$.length;te++){const ee=F($[te]);ee&&Z.push(ee)}return Z.length===0?null:e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:Z},N+"-presets")},I=[];I.push(P("Custom",R,!1)),I.push(P("Good, Bad and Neutral",[A.IStyle.BuiltInName.Normal,A.IStyle.BuiltInName.Bad,A.IStyle.BuiltInName.Good,A.IStyle.BuiltInName.Neutral],R.length>0)),I.push(P("Data and Model",[A.IStyle.BuiltInName.Calculation,A.IStyle.BuiltInName.CheckCell,A.IStyle.BuiltInName.ExplanatoryText,A.IStyle.BuiltInName.FollowedHyperlink,A.IStyle.BuiltInName.Hyperlink,A.IStyle.BuiltInName.Input,A.IStyle.BuiltInName.LinkedCell,A.IStyle.BuiltInName.Note,A.IStyle.BuiltInName.Output,A.IStyle.BuiltInName.WarningText])),I.push(P("Titles and Headings",[A.IStyle.BuiltInName.Heading1,A.IStyle.BuiltInName.Heading2,A.IStyle.BuiltInName.Heading3,A.IStyle.BuiltInName.Heading4,A.IStyle.BuiltInName.Title,A.IStyle.BuiltInName.Total]));let V=[];var O,z;return V.push(D("Accent 1",[A.IStyle.BuiltInName.Accent1_20,A.IStyle.BuiltInName.Accent1_40,A.IStyle.BuiltInName.Accent1_60,A.IStyle.BuiltInName.Accent1])),V.push(D("Accent 2",[A.IStyle.BuiltInName.Accent2_20,A.IStyle.BuiltInName.Accent2_40,A.IStyle.BuiltInName.Accent2_60,A.IStyle.BuiltInName.Accent2])),V.push(D("Accent 3",[A.IStyle.BuiltInName.Accent3_20,A.IStyle.BuiltInName.Accent3_40,A.IStyle.BuiltInName.Accent3_60,A.IStyle.BuiltInName.Accent3])),V.push(D("Accent 4",[A.IStyle.BuiltInName.Accent4_20,A.IStyle.BuiltInName.Accent4_40,A.IStyle.BuiltInName.Accent4_60,A.IStyle.BuiltInName.Accent4])),V.push(D("Accent 5",[A.IStyle.BuiltInName.Accent5_20,A.IStyle.BuiltInName.Accent5_40,A.IStyle.BuiltInName.Accent5_60,A.IStyle.BuiltInName.Accent5])),V.push(D("Accent 6",[A.IStyle.BuiltInName.Accent6_20,A.IStyle.BuiltInName.Accent6_40,A.IStyle.BuiltInName.Accent6_60,A.IStyle.BuiltInName.Accent6])),I.push((O="Themed Cell Styles",z=V,e.jsxs(B.Box,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.ExhibitMenuHeader,{children:O},O+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:z},O+"-presets")]},O))),I.push(P("Number Format",[A.IStyle.BuiltInName.Comma,A.IStyle.BuiltInName.Comma0,A.IStyle.BuiltInName.Currency,A.IStyle.BuiltInName.Currency0,A.IStyle.BuiltInName.Percent])),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:N=>`${N.shape.borderRadius}px`,paddingBottom:N=>`${N.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",paddingTop:"6px",paddingBottom:"0px",paddingLeft:"16px",paddingRight:"16px"},children:I}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,commandState:d,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:h})]})},[d,m?.().getTheme(),p]),f=w.useCallbackRef(E=>{const v=18/A.IFont.getDeviceScale(),j=b?.createTemporaryCell(E);return j.getStyle().getFont().getSize()<=v?j:j.createTemporaryCell({style:{font:{size:v}}})},[b?.createTemporaryCell]),x=h||!t||t.disabled(),k=n.useMemo(()=>b&&u?e.jsx(vr,{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:E=>`1px solid ${E.palette.action.hover}`},propsBorder:{style:{height:"calc(100% - 2px)",width:"calc(100% - 1px)"}}}):t?.getIcon(),[d,p,x,t]);return e.jsx(y.CommandPopupButton,{ref:l,createPopupPanel:S,outlined:u,commands:o,createTooltip:({children:E},v)=>e.jsx(y.ExhibitTooltip,{label:t?.getLabel(),description:t?.getDescription(),disabled:v,children:E}),selected:!1,disabled:x,label:t?.getLabel(),icon:k,...g})})),Ci=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:m=!0,canvas:d,...p}=a,C=n.useCallback(k=>{const E={variant:w.CommandButtonType.Menuitem,commandHook:b,context:"table"},v=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...E,command:u.getCommand("formatTableStyleClearCellStyles"),commandState:o,disabled:g}),e.jsx(y.CommandButton,{...E,style:{fontWeight:550},command:u.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...E,command:u.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:g}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...E,command:u.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:g||!o||o.isBuiltIn()})]}),j=e.jsx(B.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v})});return y.defaultCreatePopupPanel({...k,children:j})},[u]),S=o?.getName()===t,f=n.useMemo(()=>{const k={table:l,tableStyle:o,styles:s,bodyStyle:h};return m?e.jsx(qa,{canvas:d,...k}):e.jsx(qo,{...k})},[l,o,s,h]);let x=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:k=>`solid ${S?k.palette.primary.dark:"transparent"} 1px`},propsTooltip:{label:o.getName()??"None",placement:"bottom-start"},disabled:g,icon:null,onClick:()=>{r?.(o?.getName())},...p,children:f},o.getName());return c&&(x=e.jsx(y.ContextMenu,{label:l.getStyleOptions().name,parentFloat:i,createPopupPanel:C,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;w.useCommand(t);const m=t?.getContext(),d=m?.styles,p=s??m?.table?.();let C="insertTable";p&&(C="editTable");const S=n.useMemo(()=>((F,P)=>{const D={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new A.Table({initialAnchor:D,styles:P,json:{name:"PreviewTable",ref:D,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:F}})})(p?.getStyleOptions(),d?.()),[d?.().getDefaultTableStyle(),p?.getStyleOptions()]),f=p??S,[x,k]=n.useState(f);n.useEffect(()=>{k(f)},[f]);const E=i??m?.bodyStyle(),v=w.useCallbackRef(F=>{c?.(F),t?.execute({name:F},r)},[t,c,r]),j=n.useRef(null),T=n.useCallback((F,P)=>{const D={onSelectTableStyleName:v,styles:d(),parentFloat:F.floatReference};j.current||(j.current=document.createElement("canvas"));const I=L=>{const H=d().getTableStyle(L);return H?e.jsx(Ci,{table:x,tableStyle:H,selectedTableStyleName:x.getStyleOptions().name,bodyStyle:m.bodyStyle(),commands:P,commandHook:r,canvas:j.current,...D},L):null},V=(L,H,J=!0)=>{const Q=[];for(let q=0;q<H.length;q++){const _=I(H[q]);_&&Q.push(_)}return Q.length===0?null:e.jsxs(B.Box,{children:[J?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:L},L+"-header"),e.jsx(B.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:Q},L+"-presets")]},L)},O=[],z=d().getCustomTableStyles(),N=[];if(z.length>0){for(let L=0;L<z.length;L++)z[L].isShownInTableStyles()&&N.push(z[L].getName());O.push(V("Custom",N,!1))}const $=[];p&&!p.getStyleOptions().name&&$.push(null);for(let L=0;L<21;L++)$.push("TableStyleLight"+(L+1));O.push(V("Light",$,N.length>0));const Z=[];for(let L=0;L<28;L++)Z.push("TableStyleMedium"+(L+1));O.push(V("Medium",Z));const te=[];for(let L=0;L<11;L++)te.push("TableStyleDark"+(L+1));O.push(V("Dark",te));let ee=null;return p&&(ee=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:w.CommandButtonType.Menuitem,command:P.getCommand("formatTableStyleClearTableStyle"),commandHook:r,disabled:h})]})),e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:L=>`${L.shape.borderRadius}px`,paddingBottom:L=>`${L.shape.borderRadius}px`},children:[e.jsx(B.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:O}),ee]})},[d,d?.().getTheme(),E,x]),M=h||!t||t.disabled(),R=n.useMemo(()=>{if(!m||!g)return t?.getIcon()},[x,E,M,t]);return e.jsx(y.CommandPopupButton,{ref:l,quickCommand:u?void 0:C,createPopupPanel:T,commands:o,label:t?.getLabel(),commandState:p,commandHook:r,selected:p!==null,createTooltip:({children:F},P)=>e.jsx(y.ExhibitTooltip,{label:t?.getLabel(),description:t?.getDescription(),disabled:P,children:F}),disabled:M,icon:R,...b})})),Er=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;w.useCommand(o);const m=o?.getContext()?.themes,d=r||o?.getContext()?.theme,p=h??o?.getContext()?.darkMode,C=c||o?.disabled(),S=w.useCallbackRef(x=>{s?.(x),o?.execute(x,t)},[s,t]),f=n.useCallback((x,k)=>{const{children:E,title:v,...j}=x;let T=x.children;return(C||k)&&(T=e.jsx("div",{children:T})),e.jsx(y.CommandTooltip,{command:o,placement:g===w.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:C||k,...j,children:T})},[o,C]);return e.jsx(za,{ref:l,themes:m,selectedTheme:d,onSelectTheme:S,variant:g===w.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:f,disabled:C,darkMode:p,...b})})),Tr=n.memo(n.forwardRef((a,l)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...c}=a,h=w.useCommands(o,["themeMode"])[0],i=w.useCallbackRef((d,p)=>{const C={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},S=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,command:h}),e.jsx(y.CommandButton,{...C,command:p.getCommand("defaultThemeMode")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:p.getCommand("enableDarkGrid")}),e.jsx(y.CommandButton,{...C,command:p.getCommand("enableDarkImages")})]});return y.defaultCreatePopupPanel({...d,children:S})},[s,h,t,r]),u=h?.getState(),g=B.useMediaQuery("(prefers-color-scheme: dark)"),b=u==="dark"||u===null&&g,m=h?.getState()!==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:m,...c})})),Br=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:w.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(d,p)=>t?.beforeExecute?.(d,p)!==!1&&u.floatReference.closeAll()},disabled:s},m=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:m})},[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(w.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=w.CommandButtonType.Toolbar,...u}=a,g=w.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:b,allDisabled:m}=n.useMemo(()=>{let p=null,C=0;for(let S=0;S<g.length;S++)g[S]&&!g[S]?.disabled()&&(c&&i===w.CommandButtonType.Menuitem&&(p=C===0?g[S]:null),C++);return{singleMenuCommand:p,allDisabled:C===0}},[g]),d=n.useCallback((p,C)=>{const S={variant:w.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...S,command:C.getCommand("insertImageFromFile")}),e.jsx(y.CommandButton,{...S,command:C.getCommand("insertImageFromURL")})]});return y.defaultCreatePopupPanel({...p,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||m,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:d,icon:"InsertImage",...u})})),dn=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."})}));dn.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])),Si=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(m=>{o.getDescriptor().then(d=>{m(d.getSummary())})});return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...u},disabled:r,propsTooltip:{label:b,maxWidth:1e3},onMouseDown:m=>{m.button===0&&m.preventDefault()},onMouseUp:m=>{m.button===0&&c(o)},onKeyDown:m=>{m.keyCode===w.KeyCodes.Enter||(m.keyCode,w.KeyCodes.Space)},...g,children:e.jsx(B.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(B.Typography,{component:"div",children:o.getName()})})})}),Rr=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=w.useCommands(t,["insertFunction"])[0],b=n.useCallback((d,p)=>{const C=wo.get(o);if(!C)return console.warn("invalidate category",o),null;const S={commandHook:r,...d},f=e.jsx(wi,{category:C.label,...S,commands:p});return y.defaultCreatePopupPanel({...d,children:f})},[o,g,r,s]),m=wo.get(o);return e.jsx(y.CommandPopupButton,{ref:l,commands:t,commandHook:r,createPopupPanel:b,label:m.label,tooltip:"Insert Function",icon:wo.get(o)?.icon??"FormulaGroup",...u})}));Rr.displayName="InsertFunctionCommandPopupButton";const wi=n.memo(n.forwardRef((a,l)=>{const{commands:o,category:t,commandHook:r,...s}=a,c=w.useCommands(o,["insertFunction"]),[h,i]=n.useState([]),[u,g]=n.useState(!1);n.useEffect(()=>{(async()=>{g(!0);const S=c[0]?.getContext(),f=await S.searchByCategory(t);i(f),g(!1)})()},[]);const b=h.length,m=new Array(b),d=o.getCommand("insertFunction"),p=S=>{r?.beforeExecute?.(d,d?.getState()),d.execute(S),r?.onExecute?.(d,d?.getState())};for(let S=0;S<b;S++){const f=h[S];m[S]=e.jsx(Si,{command:d,formulaFunction:f,handleInsert:p},`formula-${f.getName()}-${S}`)}const C=e.jsx(B.Box,{ref:l,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:b>0?e.jsx(e.Fragment,{children:e.jsx(B.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:m})}):null});return y.defaultCreatePopupPanel({...s,children:C})})),Mr=n.memo(n.forwardRef((a,l)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoading:c=en,propsLoading:h,...i}=a;s&&A.LicenseManager.setLicenseKey(s);const u=n.useMemo(()=>c?e.jsx(B.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(()=>ts)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:u,children:e.jsx(g,{...i,className:r,renderLoading:c,propsLoading:{...h,transitionDelay:"0ms"},sx:o,style:t,ref:l})})})}));function Dr(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=Dr(a[l]))&&(t&&(t+=" "),t+=o);else for(l in a)a[l]&&(t&&(t+=" "),t+=l);return t}function Ke(){for(var a,l,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(l=Dr(a))&&(t&&(t+=" "),t+=l);return t}Mr.displayName="Studio";let ki={data:""},vi=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||ki},ji=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ei=/\/\*[^]*?\*\/| +/g,aa=/\n+/g,tt=(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"?tt(c,s):s+"{"+tt(c,s[1]=="k"?"":l)+"}":typeof c=="object"?t+=tt(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+=tt.p?tt.p(s,c):s+":"+c+";")}return o+(l&&r?l+"{"+r+"}":r)+t},Oe={},Pr=a=>{if(typeof a=="object"){let l="";for(let o in a)l+=o+Pr(a[o]);return l}return a},Ti=(a,l,o,t,r)=>{let s=Pr(a),c=Oe[s]||(Oe[s]=(i=>{let u=0,g=11;for(;u<i.length;)g=101*g+i.charCodeAt(u++)>>>0;return"go"+g})(s));if(!Oe[c]){let i=s!==a?a:(u=>{let g,b,m=[{}];for(;g=ji.exec(u.replace(Ei,""));)g[4]?m.shift():g[3]?(b=g[3].replace(aa," ").trim(),m.unshift(m[0][b]=m[0][b]||{})):m[0][g[1]]=g[2].replace(aa," ").trim();return m[0]})(a);Oe[c]=tt(r?{["@keyframes "+c]:i}:i,o?"":"."+c)}let h=o&&Oe.g?Oe.g:null;return o&&(Oe.g=Oe[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)})(Oe[c],l,t,h),c};function Po(a){let l=this||{},o=a.call?a(l.p):a;return Ti(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?"":tt(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,vi(l.target),l.g,l.o,l.k)}function Fr(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 fe(){return fe=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},fe.apply(this,arguments)}function Ir(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,a.__proto__=l}function Ot(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 ra(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}Po.bind({g:1}),Po.bind({k:1});var la=function(){return""},Nr=n.createContext({enqueueSnackbar:la,closeSnackbar:la}),ko="@media (max-width:599.95px)",eo="@media (min-width:600px)",ia=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},cn=function(a){return""+ia(a.vertical)+ia(a.horizontal)},Ut=function(a){return!!a||a===0},qt="unmounted",rt="exited",lt="entering",Tt="entered",sa="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=rt,r.appearStatus=lt):s=Tt:s=t.unmountOnExit||t.mountOnEnter?qt:rt,r.state={status:s},r.nextCallback=null,r}Ir(l,a),l.getDerivedStateFromProps=function(t,r){return t.in&&r.status===qt?{status:rt}: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!==lt&&s!==Tt&&(r=lt):s!==lt&&s!==Tt||(r=sa)}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===lt?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===rt&&this.setState({status:qt})},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:lt},function(){r.props.onEntering&&r.props.onEntering(r.node,c),r.onTransitionEnd(h.enter,function(){r.safeSetState({status:Tt},function(){r.props.onEntered&&r.props.onEntered(r.node,c)})})})):this.safeSetState({status:Tt},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:sa},function(){t.props.onExiting&&t.props.onExiting(t.node),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:rt},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:rt},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===qt)return null;var r=this.props;return(0,r.children)(t,Ot(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Fr(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 it(){}function da(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){da(a,o),da(l,o)}},[a,l])}function no(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:it,onEntering:it,onEntered:it,onExit:it,onExiting:it,onExited:it};var Bi="cubic-bezier(0.4, 0, 0.2, 1)",Ri="cubic-bezier(0.0, 0, 0.2, 1)",Mi="cubic-bezier(0.4, 0, 0.6, 1)",Or=function(a){a.scrollTop=a.scrollTop},ca=function(a){return Math.round(a)+"ms"};function mt(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?Bi: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:ca(r),b=typeof i=="string"?i:ca(i);return u+" "+g+" "+c+" "+b}).join(",")}function Ar(a){var l=(function(o){return o&&o.ownerDocument||document})(a);return l.defaultView||window}function Gt(a,l){if(l){var o=(function(t,r){var s,c=r.getBoundingClientRect(),h=Ar(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 Lr=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,m=a.onExited,d=Ot(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),p=n.useRef(null),C=Fo(o.ref,p),S=Fo(C,l),f=n.useCallback(function(){p.current&&Gt(r,p.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var x=(function(E,v){var j;function T(){for(var M=this,R=arguments.length,F=new Array(R),P=0;P<R;P++)F[P]=arguments[P];clearTimeout(j),j=setTimeout(function(){E.apply(M,F)},v)}return v===void 0&&(v=166),T.clear=function(){clearTimeout(j)},T})(function(){p.current&&Gt(r,p.current)}),k=Ar(p.current);return k.addEventListener("resize",x),function(){x.clear(),k.removeEventListener("resize",x)}}},[r,s]),n.useEffect(function(){s||f()},[s,f]),n.createElement(un,Object.assign({appear:!0,nodeRef:p,onEnter:function(x,k){Gt(r,x),Or(x),u&&u(x,k)},onEntered:g,onEntering:function(x){var k=c?.transitionTimingFunction||Ri,E=no({timeout:i,mode:"enter",style:fe({},c,{transitionTimingFunction:k})});x.style.webkitTransition=mt("-webkit-transform",E),x.style.transition=mt("transform",E),x.style.webkitTransform="none",x.style.transform="none"},onExit:function(x){var k=c?.transitionTimingFunction||Mi,E=no({timeout:i,mode:"exit",style:fe({},c,{transitionTimingFunction:k})});x.style.webkitTransition=mt("-webkit-transform",E),x.style.transition=mt("transform",E),Gt(r,x),b&&b(x)},onExited:function(x){x.style.webkitTransition="",x.style.transition="",m&&m(x)},in:s,timeout:i},d),function(x,k){return n.cloneElement(o,fe({ref:S,style:fe({visibility:x!=="exited"||s?void 0:"hidden"},c,{},o.props.style)},k))})});Lr.displayName="Slide";var so=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))},Di=function(){return n.createElement(so,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`}))},Pi=function(){return n.createElement(so,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Fi=function(){return n.createElement(so,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`}))},Ii=function(){return n.createElement(so,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`}))},et={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Di,null),warning:n.createElement(Pi,null),error:n.createElement(Fi,null),info:n.createElement(Ii,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:Lr,transitionDuration:{enter:225,exit:195}},Ni=function(a,l){return function(o,t){return t===void 0&&(t=!1),t?fe({},et[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:et.autoHideDuration):o==="transitionDuration"?(function(h,i){var u=function(g,b){return b.some(function(m){return typeof g===m})};return u(h,["string","number"])?h:u(h,["object"])?fe({},et.transitionDuration,{},u(i,["object"])&&i,{},h):u(i,["string","number"])?i:u(i,["object"])?fe({},et.transitionDuration,{},i):et.transitionDuration})(a.transitionDuration,l.transitionDuration):a[o]||l[o]||et[o];var r,s,c}};function At(a){return Object.entries(a).reduce(function(l,o){var t,r=o[0],s=o[1];return fe({},l,((t={})[r]=Po(s),t))},{})}var Oi="notistack-SnackbarContainer",Ai="notistack-Snackbar",zr="notistack-CollapseWrapper",Li="notistack-MuiContent",zi=function(a){return"notistack-MuiContent-"+a},ua=At({root:{height:0},entered:{height:"auto"}}),vo="0px",Hr=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=no({timeout:175,mode:"enter"}),m=b.duration,d=b.easing;u.style.transitionDuration=typeof m=="string"?m:m+"ms",u.style.height=g+"px",u.style.transitionTimingFunction=d||""},onExit:function(u){u.style.height=i()+"px"},onExited:r,onExiting:function(u){Or(u);var g=no({timeout:175,mode:"exit"}),b=g.duration,m=g.easing;u.style.transitionDuration=typeof b=="string"?b:b+"ms",u.style.height=vo,u.style.transitionTimingFunction=m||""},nodeRef:c,timeout:175},function(u,g){return n.createElement("div",Object.assign({ref:h,className:Ke(ua.root,u==="entered"&&ua.entered),style:fe({pointerEvents:"all",overflow:"hidden",minHeight:vo,transition:mt("height")},u==="entered"&&{overflow:"visible"},{},u==="exited"&&!t&&{visibility:"hidden"})},g),n.createElement("div",{ref:s,className:zr,style:{display:"flex",width:"100%"}},o))})});Hr.displayName="Collapse";var ma={right:"left",left:"right",bottom:"up",top:"down"},Hi=function(a){return"anchorOrigin"+cn(a)},Wi=function(){};function Ft(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)}},Wi)}var $i=typeof window<"u"?n.useLayoutEffect:n.useEffect;function pa(a){var l=n.useRef(a);return $i(function(){l.current=a}),n.useCallback(function(){return l.current.apply(void 0,arguments)},[])}var jo,Wr=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,m=n.useRef(),d=pa(function(){h&&h.apply(void 0,arguments)}),p=pa(function(f){h&&f!=null&&(m.current&&clearTimeout(m.current),m.current=setTimeout(function(){d(null,"timeout",i)},f))});n.useEffect(function(){return u&&p(r),function(){m.current&&clearTimeout(m.current)}},[u,r,p]);var C=function(){m.current&&clearTimeout(m.current)},S=n.useCallback(function(){r!=null&&p(.5*r)},[r,p]);return n.useEffect(function(){if(!c&&u)return window.addEventListener("focus",S),window.addEventListener("blur",C),function(){window.removeEventListener("focus",S),window.removeEventListener("blur",C)}},[c,S,u]),n.createElement("div",Object.assign({ref:l},b,{className:Ke(Ai,t),onMouseEnter:function(f){b.onMouseEnter&&b.onMouseEnter(f),C()},onMouseLeave:function(f){b.onMouseLeave&&b.onMouseLeave(f),S()}}),o)});Wr.displayName="Snackbar";var Vi=At({root:(jo={display:"flex",flexWrap:"wrap",flexGrow:1},jo[eo]={flexGrow:"initial",minWidth:"288px"},jo)}),mn=n.forwardRef(function(a,l){var o=a.className,t=Ot(a,["className"]);return n.createElement("div",Object.assign({ref:l,className:Ke(Vi.root,o)},t))});mn.displayName="SnackbarContent";var Bt=At({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"}}),fa="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":fa,style:i,className:Ke(Li,zi(c),Bt.root,Bt[c],u,!h&&g&&Bt.lessPadding)},n.createElement("div",{id:fa,className:Bt.message},h?null:g,t),b&&n.createElement("div",{className:Bt.action},b))});$r.displayName="MaterialDesignContent";var Rt,Eo,Xt,Yt,To,_i=n.memo($r),Ki=At({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Ui=function(a){var l=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=Ft([a.snack.onClose,a.onClose]),c=n.useCallback(function(){l.current=setTimeout(function(){r(function(M){return!M})},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?_i:g,m=n.useMemo(function(){return(function(M){M===void 0&&(M={});var R={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(M).filter(function(F){return!R[F]}).reduce(function(F,P){var D;return fe({},F,((D={})[P]=M[P],D))},{})})(u)},[u]),d=i.open,p=i.SnackbarProps,C=i.TransitionComponent,S=i.TransitionProps,f=i.transitionDuration,x=i.disableWindowBlurListener,k=i.content,E=Ot(i,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=fe({direction:(h=E.anchorOrigin,h.horizontal!=="center"?ma[h.horizontal]:ma[h.vertical]),timeout:f},S),j=k;typeof j=="function"&&(j=j(E.id,E.message));var T=["onEnter","onEntered","onExit","onExited"].reduce(function(M,R){var F;return fe({},M,((F={})[R]=Ft([a.snack[R],a[R]],E.id),F))},{});return n.createElement(Hr,{in:t,onExited:T.onExited},n.createElement(Wr,{open:d,id:E.id,disableWindowBlurListener:x,autoHideDuration:E.autoHideDuration,className:Ke(Ki.wrappedRoot,m.root,m[Hi(E.anchorOrigin)]),SnackbarProps:p,onClose:s},n.createElement(C,Object.assign({},v,{appear:!0,in:d,onExit:T.onExit,onExited:c,onEnter:T.onEnter,onEntered:Ft([T.onEntered,function(){a.snack.requestClose&&s(null,"instructed",a.snack.id)}],E.id)}),j||n.createElement(b,Object.assign({},E)))))},Mt={default:20},Zt={default:6,dense:2},ha="."+zr,Qt=At({root:(Rt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:mt(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Rt[ha]={padding:Zt.default+"px 0px",transition:"padding 300ms ease 0ms"},Rt.maxWidth="calc(100% - "+2*Mt.default+"px)",Rt[ko]={width:"100%",maxWidth:"calc(100% - 32px)"},Rt),rootDense:(Eo={},Eo[ha]={padding:Zt.dense+"px 0px"},Eo),top:{top:Mt.default-Zt.default+"px",flexDirection:"column"},bottom:{bottom:Mt.default-Zt.default+"px",flexDirection:"column-reverse"},left:(Xt={left:Mt.default+"px"},Xt[eo]={alignItems:"flex-start"},Xt[ko]={left:"16px"},Xt),right:(Yt={right:Mt.default+"px"},Yt[eo]={alignItems:"flex-end"},Yt[ko]={right:"16px"},Yt),center:(To={left:"50%",transform:"translateX(-50%)"},To[eo]={alignItems:"center"},To)}),qi=function(a){var l=a.classes,o=l===void 0?{}:l,t=a.anchorOrigin,r=a.dense,s=a.children,c=Ke(Oi,Qt[t.vertical],Qt[t.horizontal],Qt.root,o.containerRoot,o["containerAnchorOrigin"+cn(t)],r&&Qt.rootDense);return n.createElement("div",{className:c},s)},Gi=n.memo(qi),ga=function(a){return!(typeof a=="string"||n.isValidElement(a))},Xi=(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=ga(r)?r:s,h=ga(r)?r.message:r,i=c.key,u=c.preventDuplicate,g=Ot(c,["key","preventDuplicate"]),b=Ut(i),m=b?i:new Date().getTime()+Math.random(),d=Ni(g,t.props),p=fe({id:m},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:Ke(t.props.className,g.className)});return p.persist&&(p.autoHideDuration=void 0),t.setState(function(C){if(u===void 0&&t.props.preventDuplicate||u){var S=function(k){return b?k.id===m:k.message===h},f=C.queue.findIndex(S)>-1,x=C.snacks.findIndex(S)>-1;if(f||x)return C}return t.handleDisplaySnack(fe({},C,{queue:[].concat(C.queue,[p])}))}),m},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?fe({},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?fe({},i):(s=!0,i.entered?(i.onClose&&i.onClose(null,"maxsnack",i.id),t.props.onClose&&t.props.onClose(null,"maxsnack",i.id),fe({},i,{open:!1})):fe({},i,{requestClose:!0}))});return fe({},r,{snacks:h})},t.handleEnteredSnack=function(r,s,c){if(!Ut(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?fe({},i,{entered:!0}):fe({},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?fe({},b,{open:!1}):fe({},b,{requestClose:!0}):fe({},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});Ut(r)&&s&&s.onClose&&s.onClose(null,"instructed",r),t.handleCloseSnack(null,"instructed",r)},t.handleExitedSnack=function(r,s){if(!Ut(s))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState(function(c){var h=t.processQueue(fe({},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(ra(t)),closeSnackbar:t.closeSnackbar.bind(ra(t))}},t}return Ir(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,m=this.state.snacks.reduce(function(p,C){var S,f=cn(C.anchorOrigin),x=p[f]||[];return fe({},p,((S={})[f]=[].concat(x,[C]),S))},{}),d=Object.keys(m).map(function(p){var C=m[p],S=C[0];return n.createElement(Gi,{key:p,dense:i,anchorOrigin:S.anchorOrigin,classes:b},C.map(function(f){return n.createElement(Ui,{key:f.id,snack:f,classes:b,Component:g[f.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:Ft([o.handleExitedSnack,o.props.onExited],f.id),onEntered:Ft([o.handleEnteredSnack,o.props.onEntered],f.id)})}))});return n.createElement(Nr.Provider,{value:t},c,s?ot.createPortal(d,s):d)},Fr(l,[{key:"maxSnack",get:function(){return this.props.maxSnack||et.maxSnack}}]),l})(n.Component),Vr=function(){return n.useContext(Nr)};class _r{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 _r,Ae={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},Kr=n.memo(n.forwardRef((a,l)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:c,...h}=a,{closeSnackbar:i}=Vr(),u=G.useTheme(),[g,b]=n.useState(!1),m=Ce.ErrorUtils.collectErrorChain(s,!0)?.[0]?.error,d=m&&!(m instanceof Ce.ExpectedError),p=n.useCallback(()=>{b(f=>!f)},[]),C=n.useCallback(()=>{i(o)},[o,i]);let S=m?.message;return!S&&n.isValidElement(t)&&(S=t),S||typeof t!="string"||(S=t),S||(S=`Unknown Error: ${t}`),e.jsx(mn,{ref:l,className:ue(Ae.root,"error-snackbar"),children:e.jsxs(B.Card,{className:Ae.card,style:{backgroundColor:u.palette.error.dark,border:`1px solid ${u.palette.error.dark}`},children:[e.jsxs(B.CardActions,{className:Ae.actionRoot,children:[c?null:r?.error,e.jsx(B.Typography,{variant:"body2",component:"div",className:Ae.typography,children:S}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Ae.icons,children:[d?e.jsx(B.IconButton,{"aria-label":"Show more",size:"small",className:ue(Ae.expand,{[Ae.expandOpen]:g}),onClick:p,children:e.jsx(w.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(B.IconButton,{size:"small",className:Ae.expand,onClick:C,children:e.jsx(w.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),d?e.jsx(B.Collapse,{in:g,timeout:"auto",children:e.jsx("div",{className:Ae.stackTraceContainer,style:{backgroundColor:u.palette.error.light,borderTop:`1px solid ${u.palette.error.main}`},children:e.jsx(y.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})}));Kr.displayName="ToastError";const Ur=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(m=>{b&&i(m)}),()=>{b=!1}},[]);const u=w.useCallbackRef(b=>{const m={variant:w.CommandButtonType.Menuitem,parentFloat:b.floatReference,commandHook:t,scope:r,disabled:s},d=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:o.getCommand("newWorkbook")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:o.getCommand("openWorkbook")}),e.jsx(y.CommandPopupButton,{...m,commands:o,quickCommand:"saveWorkbook",createPopupPanel:p=>{const C={...m,parentFloat:p.floatReference,scope:"saveWorkbook"},S=[];return h.forEach(f=>{if(f.isDefault)return;const x=f.key,k=o.getCommand(`saveWorkbookAs${x}`);k?S.push(n.createElement(y.CommandButton,{...C,key:x,command:k})):console.warn(`Unable to resolve command: 'saveWorkbookAs${x}'`)}),y.defaultCreatePopupPanel({...p,children:S,onClick:()=>{p.closeFloatAll()}})}})]});return y.defaultCreatePopupPanel({...b,children:d,onClick:p=>{p.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})})}));Ur.displayName="StandaloneFileCommandButton";const Yi=e.jsx(y.ExhibitTooltip,{label:"SheetXL",description:"Visit me at sheetxl.com.",children:e.jsx(B.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"}})})}),qr=n.memo(n.forwardRef((a,l)=>{const{commands:o,workbook:t,logo:r=Yi,mainElement:s,showFileMenu:c=!0,showAppearanceMenu:h=!0,...i}=a,{reference:u}=y.useFloatStack(),[g,{width:b}]=_e(),m=b<530,d=c?e.jsx(Ur,{commands:o,commandHook:{beforeExecute(){u?.closeAll()},onError(f,x,k){}}}):null,p=h?e.jsx(Tr,{commands:o,commandHook:{beforeExecute(){u?.closeAll()},onError(f,x,k){}}}):null,C=n.useMemo(()=>({paddingLeft:f=>f.spacing(1),paddingRight:f=>f.spacing(1)}),[]),S=n.useRef(null);return e.jsx(B.Box,{ref:ze([S,g,l]),...i,children:pr({commands:o,isCompact:m,workbook:t,wrapperSelect:f=>e.jsxs(B.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(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:x=>x.spacing(.5)},children:[r,e.jsxs(B.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:x=>x.spacing(.25)},children:[d,f]})]}),e.jsx(B.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:s}),e.jsx(B.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:m&&!p?"0 0 auto":"1 1 100%"},children:p})]}),propsSelect:C,propsToolbars:{Home:{sx:{}}}})})}));qr.displayName="StudioToolbar";const Zi=()=>{window.open(window.origin.toString(),"sheetxl-"+Ce.CommonUtils.uuidV4(),"popup=true")},Gr=n.memo(a=>{const{workbook:l,setWorkbook:o,refWorkbookTitle:t,titleWorkbook:r,setWorkbookTitle:s,titlePlaceHolder:c,undoManager:h,commands:i,importExportDisabled:u,themeOptions:g,renderWorkbook:b}=a,m=(j=>{const{workbook:T,setWorkbook:M,importExportDisabled:R,workbookTitle:F="export",setWorkbookTitle:P,requestWorkbookTitle:D,themeOptions:I,undoManager:V,commands:O,onExecute:z}=j,N=w.useNotifier(),$=w.useCallbackRef(I?.onModeChange,[I?.onModeChange]),Z=w.useCallbackRef(I?.onEnabledDarkGridChange,[I?.onEnabledDarkGridChange]),te=w.useCallbackRef(I?.onEnabledDarkImagesChange,[I?.onEnabledDarkImagesChange]),ee=w.useCallbackRef(async(re=null,ae=null,K=null)=>{const W=[];let X,se=null,le=null;if(typeof re=="string"?le=re:se=re,X=se?re:await Ce.CommonUtils.openFileDialog(le??await Ve.getAllReadFormatsAsString()),!X)return null;const pe={source:X,typedCreateWorkbookOptions:ae,progress:{onWarning:Se=>{W.push(Se)}}};K&&(pe.progress.onStart=K);const je=await Ve.read(pe,N);return W.length>0&&(N.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
|
|
19
|
+
`+W.join(`
|
|
20
|
+
`))),je},[z,N,T]),L=w.useCallbackRef(async(re,ae,K)=>{if(!ae&&D){const W=await D("Enter Workbook name to "+(K?.isDefault?"Save.":`Export as ${K?.description}.`));return W!==null&&Ve.writeFile(W,re,{format:K.key})}return Ve.writeFile(ae,re,{format:K.key})},[N,T,D]),H=n.useCallback(()=>({contains:re=>!0,focus(){}}),[]),[J,Q]=n.useState([]);n.useEffect(()=>{R?Q([]):(async()=>{const re=[];(await Ve.getWriteFormats()).forEach(ae=>{const K=ae.isDefault,W={label:K?"Save Workbook":`Save Workbook as ${ae.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${ae.description}`},tags:ae.tags,description:`Save the workbook to the desktop${K?"":` as ${ae.description}`}.`,icon:"FileDownloadAsSheet"};K&&(W.shortcut={key:"S",modifiers:[w.KeyModifiers.Ctrl]},re.push(new w.Command("saveWorkbookAs",H,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[w.KeyModifiers.Shift,w.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{L(T,null,ae).catch(le=>{N.showError(le)})})));const X=ae.key,se=K?"saveWorkbook":`saveWorkbookAs${X}`;X==="CSV"?W.icon="FileDownloadAsCSV":X==="Excel"&&(W.icon="FileDownloadAsExcel"),re.push(new w.Command(se,H,W,le=>{L(T,le??F,ae).catch(pe=>{N.showError(pe)})}))}),re.push(new w.Command("openWorkbook",H,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",icon:"FileOpen",shortcut:{key:"O",modifiers:[w.KeyModifiers.Ctrl]}},async(ae=null)=>{const K={csv:{date1904:T.isDate1904(),...T.options}};try{let W,X=null;const se=async je=>{X=je.format,W=je.name},le=await ee(ae,K,se);if(!le)return;const pe=le.getSelectedSheet();if(X.mimeType==="text/csv"){const je=T.findValidSheetName(W);await T.doBatch(async()=>{const Se={colStart:0,rowStart:0,colEnd:0,rowEnd:0};let Be=pe.getUsedRange();if(!Be)return void N.showMessage("The file appears to be blank.");Be=Be.getUnion(Se),await T.getSheets().add({name:je,autoSelect:!0}).getRange(Se).copyFrom(Be)},`Import CSV '${je}'`)}else T?.close(),P?.(le.getName()??""),M(le)}catch(W){N.showError(W)}})),re.push(new w.Command("openWorkbookFromUrl",H,{label:"Open Workbook From Web",scopedLabels:{insert:"From Web",workbook:"From Web…"},description:"Open a workbook from the web."},async function(ae){if(!ae){const K=await N.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",propsInput:{style:{minWidth:"440px"}},options:["Open"]});if(K.option!=="Open")return;ae=K.input}ae&&console.log("openWorkbookFromUrl",ae)})),re.push(new w.SimpleCommand("closeWorkbook",H,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[w.KeyModifiers.Ctrl,w.KeyModifiers.Alt]}},async function(){await N.showOptions({title:"Confirm",description:"This will close the current workbook tab. Do you want to continue?",options:["Close","Cancel"],defaultOption:"Close"})==="Close"&&window.close()})),re.push(new w.SimpleCommand("newWorkbook",H,{label:"New Workbook",description:"Create a new workbook in another tab.",icon:"FileNew"},async function(){Zi()})),Q(re)})()},[R,N,T,F]);const q=n.useMemo(()=>{let re=[];return I&&(re=[new w.Command("themeMode",H,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new w.Command("defaultThemeMode",H,{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 w.Command("enableDarkGrid",H,{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 w.Command("enableDarkImages",H,{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."})]),[...re,new w.SimpleCommand("help",H,{label:"Show Help",description:"Provide Help.",icon:"Documentation",shortcut:{key:"F1"}},()=>{}),new w.SimpleCommand("showKeyboardShortcuts",H,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",icon:"Keyboard",shortcut:{key:"/",modifiers:[w.KeyModifiers.Ctrl]}},()=>{}),new w.Command("gotoUrlGithub",H,{label:"Github",description:"Download examples, explore source code, and leave a star.",icon:"Github"},()=>{window?.open("https://github.com/sheetxl/sheetxl")}),new w.Command("gotoUrlDiscord",H,{label:"Discord",description:"Join our community on discord.",icon:"Discord"},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new w.Command("gotoUrlDocumentation",H,{label:"Documentation",description:"Read the documentation.",icon:"Documentation"},()=>{window?.open("https://www.sheetxl.com/docs")}),new w.Command("gotoUrlIssue",H,{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")})]},[T,F,N,R,I]),_=n.useMemo(()=>[...q,...J],[q,J]),oe=n.useMemo(()=>{let re=null;return re=O?O.createChildGroup(H,"standaloneWorkbook",!1):new w.CommandGroup(H,"standaloneWorkbook"),re.addCommands(_,!0),re},[O,q,J]);w.useUndoManager({manager:V,commands:oe});const me=B.useMediaQuery("(prefers-color-scheme: dark)"),{themeMode:de}=y.useResolvedThemeMode();n.useEffect(()=>{if(!I||!oe)return;const re=I.mode==="dark"||!I.mode&&de==="dark";oe.getCommand("themeMode").update({state:I.mode??null,label:re?"Dark Mode":"Light Mode",scopedLabels:{appearance:re?"Dark Mode":"Light Mode"},icon:re?"DarkMode":"LightMode"}).updateCallback(()=>{$(re?y.ThemeMode.Light:y.ThemeMode.Dark)}),oe.getCommand("defaultThemeMode").update({state:!I.mode,icon:me?"SystemDefaultDarkMode":"SystemDefaultLightMode"}).updateCallback(()=>{$(null)}),oe.getCommand("enableDarkGrid").update({state:I.enableDarkGrid}).updateCallback(()=>{Z(!I.enableDarkGrid)}),oe.getCommand("enableDarkImages").update({state:I.enableDarkImages}).updateCallback(()=>{te(!I.enableDarkImages)})},[de,I,_]);const{showModal:he}=y.useModal();return n.useEffect(()=>{const re=()=>new Promise((ae,K)=>{const W=n.lazy(()=>Promise.resolve().then(()=>require("./C1PlAY37pY831-YP.cjs"))),X=he(W,{title:"Shortcut Keys Reference",commands:oe,onDone:()=>{X.hide()},slotProps:{transition:{onExited:()=>{ae(!0)}}}})});oe.getCommand("showKeyboardShortcuts").updateCallback(()=>re()),oe.getCommand("help").updateCallback(()=>re())},[_,oe]),oe})({workbook:l,setWorkbook:o,importExportDisabled:u,workbookTitle:r,setWorkbookTitle:s,commands:i,requestWorkbookTitle:j=>new Promise(T=>{t.current?t.current.requestWorkbookTitle((M,R)=>{T(M)},{selectAll:!0,requestReason:j}):T(c)}),themeOptions:g,undoManager:h,onExecute:n.useCallback(()=>{},[])}),d=n.useMemo(()=>e.jsx(Br,{commands:m,disableHover:!0,sx:{padding:"0"},propsButton:{sx:{maxHeight:"22px"}}}),[m]),[p,C]=n.useState(null),S=n.useCallback(j=>{const T=j.dataTransfer;if(m?.getCommand("openWorkbook")&&T){if(j.type==="dragenter"||j.type==="dragover"){const M=D=>{const I=T.items,V=I.length;for(let O=0;O<V;O++){const z=I[O];if(z.type.startsWith(D))return z}return null};let R=null;R=M("image/");const F=T.types,P=T.items;R?C({item:R,text:""}):F.includes("Files")&&P.length>0?C({item:P[0],text:"Drop to open"}):F.includes("text/html")||F.includes("text/plain")?(C({item:P[0],text:""}),T.effectAllowed="none",T.dropEffect="none"):(T.effectAllowed="none",T.dropEffect="none")}else j.type==="dragleave"&&C(null);j.preventDefault()}},[m]),f=n.useRef(null),x=w.useCallbackRef(j=>{if(p&&m&&(j.preventDefault(),j.stopPropagation(),C(null),j.dataTransfer.files&&j.dataTransfer.files.length>0)){const T=j.dataTransfer.files[0];if(!T)return;if(T?.type?.startsWith("image/")){const M=f.current?.getSheetElement()?.getGridElement().getViewFromClient(j.clientX,j.clientY);if(!M)return;const R=M.getRelativePointFromClient(j.clientX,j.clientY),F=M.toAbsoluteBounds({...R,width:0,height:0}),P=M.getCellCoordsFromClient(j.clientX,j.clientY);m.getCommand("insertImageFromFile")?.execute({file:T,options:{bounds:{x:F.x,y:F.y}},goto:{range:{...P}}})}else m.getCommand("openWorkbook")?.execute(T)}},[m,p]),k=n.useMemo(()=>p&&p.text?e.jsx(B.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:j=>j.palette.divider,color:j=>j.palette.primary.dark},children:e.jsx(B.Typography,{variant:"h4",children:p.text})}):null,[p]),E={ref:f,commands:m,onDragStart:j=>{if(j.target.src){const T=new Image;T.src=j.target.src,j.dataTransfer.setDragImage(T,1,1)}},onDragEnter:S,onDragLeave:S,onDragOver:S,onDrop:x};l&&(E.propsStatusBar={childrenEnd:d});let v=b(E);return k?e.jsxs(e.Fragment,{children:[v,k]}):v});Gr.displayName="CommandsWrapper";const Xr=n.memo(a=>{const{children:l}=a,o=Vr(),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),m=y.useInputDialog(u),d=n.useRef(new Set),p=n.useMemo(()=>{const f=(E,v)=>{if(v?.onceKey){if(d.current.has(v.onceKey))return;const T=new Set(d.current);T.add(v.onceKey),d.current=T}const j={variant:v?.type??w.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:v?.preventDuplicate,persist:v?.persist??v?.type===w.NotifierType.Error,action:T=>e.jsx(B.IconButton,{onClick:()=>r(T),children:e.jsx(w.DynamicIcon,{iconKey:"Cancel"})})};v?.enqueueProps&&Object.assign(j,v.enqueueProps),E||console.log("message is 'null'",v),t(E??"Alert",j)},x={showMessage:f,showBusy:(E,v)=>{let j=null;const T=new Promise(M=>{j=M});return c(M=>{const R=new Map(M.starting);return R.set(T,j),{...M,label:E,starting:R}}),T},showWindow:(E,v)=>{const j=v;return v={...v,onKeyDown:T=>{T.isDefaultPrevented()||T.isPropagationStopped()||j?.onKeyDown?.(T)}},g(E,{sort:()=>Promise.resolve().then(()=>require("./Cc3dH2YOCi1SjPK4.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./BCSkf7oG5MtK-XGZ.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./kjlgjQkY0fb-Rc-P.cjs")),comments:()=>Promise.resolve().then(()=>require("./DkGstRdRpze8sHAr.cjs")),find:()=>Promise.resolve().then(()=>require("./DR8b8OAx9_mnaJoN.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./BOj9VP_ZCebWTfxc.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./Biy5SuviR3Cz0S4F.cjs")),resizeHeader:()=>Promise.resolve().then(()=>require("./D_R6KuQiPoJdxVa_.cjs"))}[E],v)},showOptions:b,showInput:m,showError:E=>{let v,j=w.NotifierType.Error,T="Unknown Error";typeof E=="string"?T=E:E instanceof Error&&(v=E,E.message&&(T=E.message)),E instanceof Ce.PartialError&&(j=w.NotifierType.Info),f(T,{type:j,enqueueProps:{error:v}})}},k=new w.DefaultReactNotifier;return k.setOverrides(x),k},[]);n.useEffect(()=>{s.starting.size<=0||!s.isMounted||c(f=>{const x=new Map(f.running);return f.starting.forEach((k,E)=>{const v=()=>{c(j=>{const T=new Map(j.running);return T.delete(E),{...j,running:T}})};x.set(E,v),k(v)}),{...f,starting:new Map,running:x}})},[s]);const[C,S]=n.useState(null);return n.useEffect(()=>{s.starting.size!==0||s.running.size!==0?S(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"}})):S(null)},[s.starting,s.running]),e.jsxs(w.NotifierProvider,{notifier:p,children:[C,l]})});Xr.displayName="SnackbarWrapper";const Qi=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,m=n.useMemo(()=>r.map(C=>{const S=h.getRegisteredTaskPane(C);if(!S)return null;let f=S.getIcon?.();f&&(typeof f=="string"&&(f=e.jsx(w.DynamicIcon,{iconKey:f})),f=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:f}));const x=C===c;return e.jsx(B.Tab,{value:C,label:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:S.getTitle()??"",placement:"left-start",children:e.jsxs(B.Box,{sx:{padding:"0px 0px",writingMode:"vertical-rl",textOrientation:"mixed",display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"0px",color:k=>k.palette.text.secondary},children:[f&&e.jsx(B.Box,{sx:{display:"inline-block",transformOrigin:"center",color:k=>k.palette.text.secondary},children:f}),u&&f?null:e.jsx(B.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:k=>x?k.palette.primary.main:k.palette.text.secondary},children:S.getTitle()})]})}),sx:{padding:"4px 4px",minWidth:"0px",minHeight:"0px",borderRadius:"4px"},className:ue("taskpane-strip-item",{"Mui-selected":x}),onClick:()=>a.onSelect(C)},C)}),[r,c,s,h]),d=w.useImperativeElement(l,()=>({isTaskPaneStrip:()=>!0}),[]),p=n.useMemo(()=>ue("taskpane-strip",g),[g]);return e.jsx(B.Box,{ref:d,className:p,sx:{paddingLeft:"2px",paddingTop:"4px",...i},...b,children:e.jsx(B.Tabs,{orientation:"vertical",variant:"scrollable",value:c,onChange:(C,S)=>{s(S)},slotProps:{list:{sx:{gap:"2px"}},indicator:{sx:{left:"0px",right:"unset"}}},children:m})})})),Ji=a=>e.jsx(Qi,{...a}),es=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,propsFrame:{style:{border:c,borderRadius:h,marginBottom:i}},alwaysShowStrip:!0,renderTaskPanelTitle:g=>{const{title:b,icon:m,onClose:d,readOnly:p,focused:C,...S}=g;return e.jsx(B.DialogTitle,{className:ue({"Mui-selected":C}),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`},...S,children:e.jsxs(B.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(B.Box,{sx:{flex:"1 1 100%",paddingLeft:f=>f.spacing(1)},children:b}),e.jsx(y.ExhibitTooltip,{label:"Close",children:e.jsx(B.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(w.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:Ji,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...r})}),xa={flex:"1 1 100%",display:"flex",boxSizing:"border-box"},Yr=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 m=null,d=4,p=13;return g?m="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":(m="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,p=4),e.jsx(w.SplitPane,{ref:ze([b,i,l]),className:r,style:s?{...xa,...s}:xa,...c,fixedPane:"after",position:"40%",minAfter:g?"280px":"120px",splitDirection:g?"row":"column",propsResizer:{className:"styled-resizer",style:{minWidth:g?"6px":void 0,minHeight:g?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${d}' height='${p}' viewBox='0 0 ${d} ${p}' 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}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:g?"left center":"top center"}},elementBefore:o,propsPaneBefore:{style:{flexDirection:"column",marginRight:t?void 0:"6px"}},elementAfter:t,propsPaneAfter:{style:{marginLeft:g?"0px":"4px",marginRight:g?"8px":"4px"}}})}));Yr.displayName="StudioSplitPane",Qa(),w.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),ne.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:Ql},!0);const ao=n.memo(n.forwardRef((a,l)=>{const{className:o,sx:t,square:r,elevation:s,variant:c,style:h,onElementLoad:i,onError:u,undoManager:g,renderWorkbookError:b=di,onKeyDown:m,workbook:d,onWorkbookChange:p,logo:C,importExportDisabled:S=!1,themeOptions:f,autoFocus:x=!1,commands:k,title:E,onWorkbookTitleChange:v,propsWorkbookTitle:j,renderLoading:T=en,propsLoading:M,...R}=a,F=n.useRef(null),P=w.useCallbackRef(p,[p]),D=w.useCallbackRef(v??j?.onTitleChange,[v??j?.onTitleChange]),I=j?.placeHolder??"Untitled",V=f?.mode,{themeMode:O,source:z}=y.useResolvedThemeMode({mode:V}),N=n.useMemo(()=>({...f,light:y.createExhibitTheme(!1,Ce.CommonUtils.deepMerge(f?.theme??{},f?.light??{})),dark:y.createExhibitTheme(!0,Ce.CommonUtils.deepMerge(f?.theme??{},f?.dark??{}))}),[f]),$=O===y.ThemeMode.Dark,[Z,te]=n.useState(null);n.useEffect(()=>{te(g??new Ce.UndoManager)},[g]);const[ee,L]=n.useState(null),[H,J]=n.useState(null),Q=ne.useDocThemes();n.useLayoutEffect(()=>{if(!d||Object.keys(d).length===0&&!Ce.CommonUtils.isPromiseLike(d)){const Y={theme:Q.getDefaultTheme()};J(new A.Workbook(Y))}else J(d)},[d]),n.useLayoutEffect(()=>{if(H){if(H instanceof A.Workbook)return L({workbook:H}),void(d!==H&&P?.(H));(async()=>{try{let Y=await Promise.resolve(H);Y&&Y.source&&(Y=await Ve.read(Y));let ie=Y;P?.(ie),de(ie.getName()??""),L({workbook:ie})}catch(Y){P?.(null),L({error:Y})}})()}},[H]);const[q,_]=n.useState(null);n.useEffect(()=>{if(!Z||!ee)return;Z.clear();const Y=ee?.workbook?.getTransactions();if(Y)return Y.addListener({onCommitEnd:ie=>{ie.getDescription()?Z.addUndoOperation({description:ie.getDescription(),undo:()=>(Y.revert(ie.getId()),q.source?.focus(),()=>{Y.restore(ie.getId()),q.source?.focus()})}):console.warn("commit has no description",ie)}})},[Z,ee,q]);const oe=w.useCallbackRef(Y=>{Y?Z.setRepeatableOperation({description:Y.getLabel(),repeat:async()=>Y.execute()}):Z.setRepeatableOperation(null)},[Z]),[me,de]=n.useState(E??j?.title??"");n.useEffect(()=>{de(E??j?.title??"")},[E??j?.title]),n.useEffect(()=>{D?.(me)},[me]);const[he,re]=n.useState(null),ae=n.useMemo(()=>{const Y=()=>({contains:ie=>!0,focus(){}});return k?k.createChildGroup(Y,"application",!1):new w.CommandGroup(Y,"application")},[k]),K=w.useCallbackRef(async Y=>{re(Y.source.getViewportElement()),_(Y),ae.activate("sheet"),await w.DefaultDynamicIconService.prefetch(),i?.(Y)},[ae]);n.useEffect(()=>{q&&x&&q.source?.focus(typeof x=="object"?x:void 0)},[q,x]);const W=n.useRef(null),X=n.useCallback(Y=>{let ie=null;return j?.hidden||(ie=e.jsx(on,{...j,style:{maxWidth:"100%",...j?.style},workbook:F.current,ref:W,title:me,placeHolder:I,onTitleChange:Ue=>{de(Ue)}})),e.jsx(qr,{...Y,logo:C,mainElement:ie,showFileMenu:!S,showAppearanceMenu:!!(N?.onEnabledDarkGridChange||N?.onEnabledDarkImagesChange||N?.onModeChange)})},[C,me,j,N,S,ae]);n.useEffect(()=>{const Y=ie=>ie.preventDefault();return F.current?.addEventListener("wheel",Y,{passive:!1}),()=>{F.current?.removeEventListener("wheel",Y)}},[]);const se=n.useMemo(()=>({"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:Y=>Y.palette.getContrastText(Y.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:Y=>Y.palette.getContrastText(Y.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:Y=>Y.palette.getContrastText(Y.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:Y=>Y.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"},...t}),[t]),[le,pe]=n.useState(null),je=n.useCallback(Y=>e.jsx(es,{model:ee?.workbook,commands:ae,...Y}),[ae,ee]),Se=n.useCallback(Y=>e.jsx(Yr,{mainElement:Y,sidebarElement:le}),[le]),Be=ze([F,l]),Ee=n.useCallback(Y=>{const{commands:ie,ref:Ue,...co}=Y;if(!ee)return e.jsx(B.Paper,{sx:t,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...h},children:T({...M})});if(ee.error)return e.jsx(B.Paper,{sx:t,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"stretch",justifyContent:"stretch",...h},children:b({style:{width:"100%",height:"100%",...h},error:ee.error})});let gt=null,Lt=null,ge=!1;N&&(gt=$?N.dark:N.light,Lt=$&&N.enableDarkGrid?N.dark:N.light,ge=N.enableDarkImages);const qe=e.jsx(tn,{tabIndex:0,autoFocus:!1,workbook:ee.workbook,ref:ze([Ue,Be]),renderToolbar:X,onElementLoad:K,onRepeatCommandChange:oe,onKeyDown:Ge=>{m?.(Ge)},propsLoading:M,renderLoading:T,gridTheme:Lt,headersTheme:gt,enableDarkImages:ge,wrapperMain:Se,className:ue(o),onContextMenu:Ge=>Ge.preventDefault(),commands:ie,...R,...co},"WorkbookElement");return e.jsx(B.Paper,{sx:se,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"stretch",justifyContent:"stretch",...h},square:r,elevation:s,variant:c,children:qe})},[ee,me,Z,T,M,R,r,s,c,b,N,X,se,Se]);let ke=e.jsx(Xi,{maxSnack:3,domRoot:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(Y,ie,Ue)=>{F.current?.focus()},Components:{error:Kr},iconVariant:{success:e.jsx(B.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(w.DynamicIcon,{iconKey:"ErrorAlert",style:{marginRight:"8px"}})},children:e.jsx(ne.TaskPaneProvider,{renderArea:je,onUpdateArea:Y=>{pe(Y)},children:e.jsx(y.ModalProvider,{children:e.jsx(Xr,{children:e.jsx(w.UncaughtErrorBoundary,{children:e.jsx(w.ReactErrorBoundary,{children:e.jsx(Gr,{workbook:ee?.workbook,renderWorkbook:Ee,setWorkbook:J,importExportDisabled:S,titlePlaceHolder:I,titleWorkbook:me,setWorkbookTitle:de,refWorkbookTitle:W,commands:ae,undoManager:Z,themeOptions:N})})})})})})});return N&&(ke=e.jsxs(G.ThemeProvider,{theme:$?N.dark:N.light,children:[N.cssBaseline?e.jsx(B.CssBaseline,{}):null,ke]})),ke}));ao.displayName="EagerStudio";const ts=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ao,default:ao},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Tr,exports.AutoColorPosition=pt,exports.BorderCommandButton=Ba,exports.BorderPopupButton=Ta,exports.BorderStylePopupButton=Ea,exports.CellsDeleteCommandButton=Ao,exports.CellsFormatCommandButton=Lo,exports.CellsInsertCommandButton=Oo,exports.Checkboard=va,exports.ClearCommandButton=No,exports.ColorButton=ro,exports.ColorButtonList=Dt,exports.ColorCommandButton=ht,exports.ColorPanel=ja,exports.ColorPanelType=ka,exports.ColorPopupButton=Io,exports.DocThemeCommandButton=Er,exports.EagerStudio=ao,exports.FillCommandButton=Ia,exports.FilterColumnMenu=Uo,exports.FilterCommandButton=bi,exports.Filters=Ka,exports.FindCommandButton=Da,exports.FontFamilyCommandButton=yr,exports.FontSizeCommandButton=Pa,exports.FormulaBar=Ko,exports.FreezeCommandButton=Ma,exports.HelpCommandButton=Br,exports.HorizontalAlignCommandButton=ya,exports.InsertFunctionCommandPopupButton=Rr,exports.InsertFunctionSumCommandPopupButton=dn,exports.InsertImageCommandButton=sn,exports.MergeCommandButton=Ra,exports.NamedCollectionEditor=_o,exports.NamedInput=zo,exports.NumberFormatCommandButton=Fa,exports.PasteCommandButton=rn,exports.PresetCellStylesCommandButton=jr,exports.PresetTableStylesCommandButton=ln,exports.RangeInput=Ho,exports.SheetTab=Go,exports.SheetTabMenu=Xo,exports.SheetZoomScale=Wo,exports.SheetsAllMenu=Yo,exports.SortFilterCommandButton=nn,exports.StatusBar=$o,exports.Studio=Mr,exports.StyledStrokeIcon=Bo,exports.TableDetailsPanel=Ya,exports.TableDetailsTaskPane=Za,exports.TablePlugin=Qa,exports.TableStyleCanvasPreview=qa,exports.TableStyleOptionsPanel=Ga,exports.TableStylePreview=qo,exports.TextEffectsCommandButton=Cr,exports.TextOverflowCommandButton=Sa,exports.TextRotateCommandButton=wa,exports.ThemeSelectButton=Aa,exports.ThemeSelectPanel=La,exports.ThemeSelectPopupButton=za,exports.UnderlineCommandButton=Sr,exports.UndoRedoCommandButton=an,exports.VerticalAlignCommandButton=Ca,exports.ViewGridLinesCommandButton=xr,exports.ViewHeadingsCommandButton=wr,exports.WalkingCopyCommandButton=io,exports.WorkbookContextMenu=Jo,exports.WorkbookElement=tn,exports.WorkbookIO=Ve,exports.WorkbookStrip=Qo,exports.WorkbookTitle=on,exports.WorkbookViewCommandButton=kr,exports._WorkbookIO=_r,exports._extends=to,exports._objectWithoutPropertiesLoose=Zo,exports._setPrototypeOf=oo,exports.clsx=Ke,exports.clsx$1=ue,exports.commonjsGlobal=ut,exports.createGridStyleFromMUITheme=Do,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=Nt,exports.setPrintExamplesOnLoad=a=>{Ja=a},exports.useMeasure=_e,exports.useWorkbookCommands=hr;
|