@sheetxl/studio-mui 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/browser/cjs/Bt0-HMKtnBRB6IpI.cjs +20 -0
- package/browser/cjs/CJW4-NCdaLzNEwgK.cjs +6 -0
- package/browser/cjs/{BdNRaXTgqRzPmg0L.cjs → D36j1nR6-lEwM7Ht.cjs} +2 -2
- package/browser/cjs/{DefYX_aeMZivbpEt.cjs → D9RcTPcL8Gcds6uC.cjs} +2 -2
- package/browser/cjs/DPenF_1mYgI8WaQf.cjs +6 -0
- package/browser/cjs/{B8-dSgXI2XZKFvtp.cjs → DQ1bXdi-D0uVKGFA.cjs} +2 -2
- package/browser/cjs/{7MV1n9Y0yXU0hKpM.cjs → Q234HX63V75h22HJ.cjs} +1 -1
- package/browser/cjs/{Ce6JLd3qejgMgM3r.cjs → UoOVKSpyeYQ3Z04Y.cjs} +3 -3
- package/browser/cjs/WN5FOSGC22Jy3dxz.cjs +7 -0
- package/browser/cjs/index.cjs +3 -3
- package/browser/cjs/rrppjlxhsrfwBStx.cjs +6 -0
- package/browser/cjs/{-u6vWH9DiYlO1rsa.cjs → zFlqPWNVl7CHv7Iw.cjs} +1 -1
- package/browser/esm/{BnVbG5kg41edf8oz.mjs → 5Fbp4sZTl6CHhmHk.mjs} +2 -2
- package/browser/esm/{Dg_NRblGOcetqhnC.mjs → BD3NSZsAOvF6yczu.mjs} +4 -4
- package/browser/esm/{miaBr4cu9WKLs8Is.mjs → BiazW77hCkbuJPiW.mjs} +1 -1
- package/browser/esm/CUiplQS9rUodJwPi.mjs +4455 -0
- package/browser/esm/CagpAQXgCxrJrdGJ.mjs +156 -0
- package/browser/esm/Ci4cqU4bR1IUSqrT.mjs +49 -0
- package/browser/esm/{CKLhWrNo1E4r3pG7.mjs → CoIXNZVIp9Q12qM2.mjs} +7 -7
- package/browser/esm/{YfJJd16cfjuXpb8G.mjs → Cp-QoTwVeQkQClpI.mjs} +1 -1
- package/browser/esm/{yQgfM4ehXrfnEoUK.mjs → D7PjwOCMi075qK5G.mjs} +2 -2
- package/browser/esm/{nwvZlIH9rheqctQz.mjs → Dx4t6SbPV2HSf_ub.mjs} +12 -12
- package/browser/esm/index.mjs +38 -37
- package/browser/esm/{DVSjscO7zuDsOD4v.mjs → wenu-h35nL2_uEZp.mjs} +2 -2
- package/licenses/dependencies.txt +75 -108
- package/node/assets/style.css +1 -1
- package/node/esm/B21Usvp_sTqMHAZ4.mjs +157 -0
- package/node/esm/{COoX8Ir66wNuWJ_m.mjs → BAgtosqQwtrUsOYl.mjs} +8 -8
- package/node/esm/{CN79Z_qqLiF3V5r0.mjs → CYU-oRRhaNiOTVNa.mjs} +14 -14
- package/node/esm/{BTp8XtWh47Y1g1MM.mjs → Cfzjf7vBs29sO_g3.mjs} +13 -13
- package/node/esm/{Dln5o1FP_HWPs0Uf.mjs → D1n7HgHfLVQZ0KhP.mjs} +1 -1
- package/node/esm/{CNCYE_ff8SnJJMPN.mjs → D60xUWK_BS-7PMLM.mjs} +4 -4
- package/node/esm/{CxbA2L1Ap9NSJcxm.mjs → DWhJA7EI9CmoBPDY.mjs} +1 -1
- package/node/esm/{B9TRK2jd_Ki2RifT.mjs → DmdldJQanZCNdfA5.mjs} +1 -1
- package/node/esm/{qpKmKMfv4DDofXKf.mjs → GzNLdpzukdCxYbbC.mjs} +1 -1
- package/node/esm/index.mjs +1310 -1264
- package/package.json +15 -16
- package/types/index.d.ts +18 -8
- package/browser/cjs/1-LY_VyMGQ9MfeNB.cjs +0 -20
- package/browser/cjs/BEmcHbiMOFhIa91S.cjs +0 -6
- package/browser/cjs/D7AH724IJJvos02e.cjs +0 -7
- package/browser/cjs/KOj1qev47_vzzRFV.cjs +0 -6
- package/browser/cjs/St8H4B5iT2fsqOb7.cjs +0 -6
- package/browser/cjs/TS1uQTjkemJ22p1Y.cjs +0 -6
- package/browser/esm/BNxVvFkY3b2mERJf.mjs +0 -64
- package/browser/esm/CJsYe8TqU6tqj4UH.mjs +0 -154
- package/browser/esm/DdLujAMc-Cefddif.mjs +0 -49
- package/browser/esm/beUKtp_qQMnuYcVk.mjs +0 -4452
- package/node/esm/BcB8nCbI5HW5jv5q.mjs +0 -65
- package/node/esm/C5WzmLTAphEQU3CU.mjs +0 -155
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";var Ei=Object.create;var En=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Bi=Object.getOwnPropertyNames;var Pi=Object.getPrototypeOf,Ri=Object.prototype.hasOwnProperty;var Mi=(a,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Bi(i))!Ri.call(a,r)&&r!==o&&En(a,r,{get:()=>i[r],enumerable:!(t=Ti(i,r))||t.enumerable});return a};var Tn=(a,i,o)=>(o=a!=null?Ei(Pi(a)):{},Mi(i||!a||!a.__esModule?En(o,"default",{value:a,enumerable:!0}):o,a));/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.6
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/const L=require("@sheetxl/sdk"),ae=require("@sheetxl/react"),e=require("react/jsx-runtime"),n=require("react"),T=require("@mui/material"),y=require("@sheetxl/utils-mui"),S=require("@sheetxl/utils-react"),Y=require("@mui/material/styles"),Me=require("@mui/system"),Je=require("react-dom"),Ie=require("@sheetxl/utils"),st=require("@sheetxl/io");function yr(a){var i,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(i=0;i<r;i++)a[i]&&(o=yr(a[i]))&&(t&&(t+=" "),t+=o)}else for(o in a)a[o]&&(t&&(t+=" "),t+=o);return t}function pe(){for(var a,i,o=0,t="",r=arguments.length;o<r;o++)(a=arguments[o])&&(i=yr(a))&&(t&&(t+=" "),t+=i);return t}const Cr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...u}=a,l=S.useCommands(o,["formatAlignLeftToggle","formatAlignCenterToggle","formatAlignRightToggle","formatAlignJustifyToggle","formatAlignCenterContinuousToggle","formatAlignFillToggle","formatAlignDistributedHorizontalToggle"]),c=n.useMemo(()=>{for(let g=0;g<l.length;g++)if(l[g]?.state())return l[g];return l[0]},[l]),m=n.useMemo(()=>{if(!t)return null;const g={...t};return delete g.beforeExecute,g},[t]),x=n.useCallback((g,p)=>{const f={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},b=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignLeftToggle")}),e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignCenterToggle")}),e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignRightToggle")}),e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignJustifyToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignCenterContinuousToggle")}),e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignFillToggle")}),e.jsx(y.CommandButton,{...f,command:p.getCommand("formatAlignDistributedHorizontalToggle")})]}),k=e.jsxs(T.Box,{sx:{className:pe("quick-buttons"),display:"flex",alignItems:"center",justifyContent:"center"},onClick:h=>h.stopPropagation(),children:[e.jsx(y.CommandButton,{command:p.getCommand("formatIndentDecrease"),commandHook:m,scope:r,disabled:s}),e.jsx(y.CommandButton,{command:p.getCommand("formatIndentIncrease"),commandHook:m,scope:r,disabled:s})]}),C=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...u,children:[k,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:b})]});return y.defaultCreatePopupPanel({...g,children:C})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,commands:o,commandHook:t,scope:r,createPopupPanel:x,label:"Horizontal Alignment",tooltip:"Configure how text is placed in the horizontal direction of the cell.",quickCommand:c?.key(),icon:c?.icon()??"FormatAlignLeft",...u})})),Sr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=S.useCommands(o,["formatAlignTopToggle","formatAlignMiddleToggle","formatAlignBottomToggle","formatAlignJustifyVerticalToggle","formatAlignDistributedVerticalToggle"]),l=n.useMemo(()=>{for(let m=0;m<u.length;m++)if(u[m]?.state())return u[m];return u[0]},[u]),c=n.useCallback((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:x.getCommand("formatAlignTopToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatAlignMiddleToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatAlignBottomToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatAlignJustifyVerticalToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatAlignDistributedVerticalToggle")})]});return y.defaultCreatePopupPanel({...m,children:p})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:c,label:"Vertical Alignment",tooltip:"Configure how text is placed in the vertical direction of the cell.",icon:l?.icon()??"TextVerticalBottom",...d})})),kr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=S.useCommands(o,["formatTextOverflowVisibleToggle","formatTextOverflowWrapToggle","formatTextOverflowClipToggle","formatTextOverflowShrinkToggle"]),l=n.useMemo(()=>{for(let m=0;m<u.length;m++)if(u[m]?.state())return u[m];return u[0]},[u]),c=S.useCallbackRef((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:x.getCommand("formatTextOverflowVisibleToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatTextOverflowWrapToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatTextOverflowClipToggle")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatTextOverflowShrinkToggle")})]});return y.defaultCreatePopupPanel({...m,children:p})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,label:"Text Overflow",tooltip:"Configure how text behaves when it doesn't fit within a cell.",createPopupPanel:c,icon:l?.icon()??"TextHorizontalOverflow",...d})})),wr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=S.useCommands(o,["formatTextRotate0","formatTextRotate315","formatTextRotate45","formatTextRotate90","formatTextRotate270","formatSubscriptToggle","formatTextRotateCustom"]),l=n.useMemo(()=>{const x=u.length;for(let g=0;g<x;g++){const p=u[g];if(p?.state())return p}return u[1]},[u]),c=n.useCallback((x,g)=>{const p={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},f=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...p,command:g.getCommand("formatTextRotate0")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...p,command:g.getCommand("formatTextRotate315")}),e.jsx(y.CommandButton,{...p,command:g.getCommand("formatTextRotate45")}),e.jsx(y.CommandButton,{...p,command:g.getCommand("formatTextRotate90")}),e.jsx(y.CommandButton,{...p,command:g.getCommand("formatTextRotate270")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.InputCommandButton,{...p,command:g.getCommand("formatTextRotateCustom"),label:"Custom"})]});return y.defaultCreatePopupPanel({...x,children:f})},[s,t,r,o]),m=n.useMemo(()=>(o.getCommand("formatTextRotateCustom")?.state()??0)!==0,[u]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,selected:m,label:"Text Orientation",tooltip:"Rotate your text diagonally or vertically. This is a great way to label narrow columns.",createPopupPanel:c,quickCommand:m?"formatTextRotate0":"formatTextRotate315",icon:l?.icon()??"TextRotation315",...d})})),vr={Preset:"preset",Custom:"custom"},ut={Start:"start",End:"end"},xo={},Di=(a,i,o,t)=>{const r=a+"-"+i+"-"+o+(t?"-server":"");if(xo[r])return xo[r];const s=((d,u,l,c)=>{if(typeof document>"u"&&!c)return null;const m=c?new c:document.createElement("canvas");m.width=2*l,m.height=2*l;const x=m.getContext("2d");return x?(x.fillStyle=d,x.fillRect(0,0,m.width,m.height),x.fillStyle=u,x.fillRect(0,0,l,l),x.translate(l,l),x.fillRect(0,0,l,l),m.toDataURL()):null})(a,i,o,t);return xo[r]=s,s},Fi={},jr=n.memo(a=>{const{className:i,style:o=S.ReactUtils.EmptyCssProperties,white:t="transparent",grey:r="grey",size:s=8,borderRadius:d,boxShadow:u,renderers:l=Fi,children:c,...m}=a,x=c,g=n.useMemo(()=>Object.assign({borderRadius:d,boxShadow:u,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",background:`url(${Di(t,r,s,l?.canvas)}) center left`},o),[t,r,s,l]);return n.isValidElement(c)?n.cloneElement(c,{...x.props}):e.jsx("div",{style:g,...m})}),Ii=n.memo(a=>{const{selectedColor:i,onSelectColor:o,onPreviewColor:t,onClick:r,onKeyDown:s,onMouseOver:d,onMouseLeave:u,onFocus:l,style:c=S.ReactUtils.EmptyCssProperties,children:m,alphaWhite:x,alphaGrey:g,darkMode:p,alphaCheckSize:f=7,...b}=a;if(!i)throw new Error("a selectedColor is required");const k=n.useCallback(P=>{r?.(P),P.isDefaultPrevented()||(P.ctrlKey?t?.(i.toRGBA()):o?.(i.toRGBA()))},[o,t,r,i]),C=n.useCallback(P=>{d?.(P),P.isDefaultPrevented()||t?.(i.toRGBA())},[t,d,i]),h=n.useCallback(P=>{u?.(P),P.isDefaultPrevented()},[t,u]),w=n.useCallback(P=>{l?.(P),P.isDefaultPrevented()||t?.(i.toRGBA())},[t,l,i]),E=n.useCallback(P=>{s?.(P),P.isDefaultPrevented()||P.keyCode===S.KeyCodes.Enter&&o?.(i.toRGBA())},[o,s,i]),v=n.useMemo(()=>i.toRGBA().alpha===1?null:e.jsx(jr,{size:f,white:x,grey:g,style:{position:"absolute",width:"calc(100% - 1.5px)",height:"calc(100% - 1.5px)",top:"0.75px",left:"0.75px"}}),[x,g,i]);return e.jsxs("div",{style:{position:"absolute",height:"100%",width:"100%",top:"0px",left:"0px",cursor:"pointer",outline:"none",...c},tabIndex:0,...b,onClick:k,onKeyDown:E,onMouseOver:C,onMouseLeave:h,onFocus:w,children:[v,e.jsx("div",{style:{position:"absolute",top:"0px",left:"0px",height:"100%",width:"100%",background:i.toCSS(p)},children:m})]})}),io=n.memo(a=>{const{schemeColorLookup:i,selectedColor:o,previewColor:t,colorDef:r,onSelectColorDef:s,onPreviewColorDef:d,swatchProps:u,defaultButtonSize:l=24,isLarge:c=!1,compareRGB:m=!1,darkMode:x=!1,...g}=a,p=new L.Color({val:r.definition.val,adjs:r.definition.adjs},v=>i(v)),f=m?p.toRGBA().toString():p.toString(),b=o&&(m?o.toRGBA().toString():o.toString())===f,k=t&&(m?t.toRGBA().toString():t.toString())===f,C=[];C.push({[L.IColor.AdjustmentType.Inv]:!0}),C.push({[L.IColor.AdjustmentType.Alpha]:100});const h=p.adjust(C),w=n.useCallback(()=>{s?.(r)},[s,r]),E=n.useCallback(v=>{d?.(v?r:null)},[d,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:l*(c?1.2:1)+"px",height:l*(c?1.2:1)+"px",position:"relative",boxSizing:"border-box",cursor:"pointer",outline:"none"},...g,children:e.jsxs(Ii,{selectedColor:p,title:null,onSelectColor:w,onPreviewColor:E,alphaCheckSize:c?9:void 0,darkMode:x,...u,children:[e.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",top:"0px",left:"0px",pointerEvents:"none",borderColor:h.toRGBA(x).toString(),borderWidth:"2px",borderStyle:"solid",boxSizing:"border-box",opacity:b?"1":"0"}}),e.jsx("div",{style:{position:"absolute",width:.33*l*(c?1.2:1)+"px",height:.33*l*(c?1.2:1)+"px",left:"calc(50% - 0.5px)",top:"calc(50% - 0.5px)",transform:"translate(-50%,-50%)",pointerEvents:"none",background:h.toRGBA(x).toString(),borderRadius:"50%",opacity:k?"1":"0"}})]})})})}),zt=n.memo(a=>{const{title:i,schemeColorLookup:o,colorDefs:t,selectedColor:r,previewColor:s,onSelectColorDef:d,onPreviewColorDef:u,style:l=S.ReactUtils.EmptyCssProperties,compareRGB:c=!1,darkMode:m,swatchProps:x,...g}=a;let p;if(Array.isArray(t[0]))p=t;else{p=[];for(let h=0;h<t.length;h++)p.push([t[h]])}const f=n.useCallback(h=>{d?.(h)},[d]),b=n.useCallback(h=>{u?.(h)},[u]),k=n.useMemo(()=>{let h=[];for(let w=0;w<p.length;w++){let E=[],v=p[w];for(let R=0;R<v.length;R++){let M=v[R];E.push(e.jsx(io,{schemeColorLookup:o,colorDef:M,selectedColor:r,previewColor:s,onSelectColorDef:f,onPreviewColorDef:b,swatchProps:x,compareRGB:c,darkMode:m},w+" "+R))}let P=e.jsx(T.Box,{className:"button-col",sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",boxShadow:R=>R.shadows[2],borderRadius:"2px",overflow:"hidden"},children:E},""+w);h.push(P)}return h},[p,r,s,f,b]),C=n.useMemo(()=>i?e.jsx(T.Typography,{noWrap:!0,component:"div",sx:{display:"flex",flexShrink:"0",paddingLeft:"6px",paddingBottom:"4px",paddingTop:"0px",userSelect:"none",color:h=>h.palette.text.secondary},children:i}):null,[i]);return e.jsxs(T.Box,{style:{...l},children:[C,e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",gap:"6px",marginBottom:"14px",flexWrap:"wrap",justifyContent:"flex-start"},...g,children:k})]})}),Fe=(a,i)=>({description:a,definition:{val:i,adjs:[]}}),ye=(a,i,o,t,r,s)=>{const d=Fe(a,i);t?.push(d);const u=new L.Color({val:d.definition.val,adjs:d.definition.adjs},o),l=u.toString();r?.set(l,u);const c=u.toRGBA().toString();s?.set(c,u)},Ni=n.lazy(()=>Promise.resolve().then(()=>require("./DefYX_aeMZivbpEt.cjs"))),Er=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o=null,previewColor:t=a.selectedColor??null,recentColors:r,schemeLookup:s,disableAlpha:d=!1,previewDebounceTime:u=100,initialPanelType:l,defaultButtonSize:c=24,width:m,onElementLoad:x,onDone:g,onEyeDropStart:p,onEyeDropStop:f,onPreviewColor:b,onPreviewColorImmediate:k,onSelectColor:C,autoColor:h,autoColorLabel:w="Automatic",autoColorPosition:E=ut.Start,compareRGB:v=!1,darkMode:P=!1,...R}=a,M=t||o,N=S.useCallbackRef(b,[b]),A=S.useCallbackRef(k,[k]),j=S.useCallbackRef(C,[C]),B=S.useCallbackRef(p,[p]),I=S.useCallbackRef(f,[f]),[H,O]=n.useState(!1),z=Y.useTheme(),D=n.useMemo(()=>s||L.Color.getDefaultSchemeLookup(),[s]),W=n.useMemo(()=>{const V=new Map,Q=new Map,me=[];ye("Primary Background","bg1",D,me,V,Q),ye("Primary Text","tx1",D,me,V,Q),ye("Secondary Background","bg2",D,me,V,Q),ye("Secondary Text","tx2",D,me,V,Q),ye("Accent 1","accent1",D,me,V,Q),ye("Accent 2","accent2",D,me,V,Q),ye("Accent 3","accent3",D,me,V,Q),ye("Accent 4","accent4",D,me,V,Q),ye("Accent 5","accent5",D,me,V,Q),ye("Accent 6","accent6",D,me,V,Q);const Be=L.ITheme.buildPalette(me,D,V,Q),re=[];if(ye("Dark Red","C00000",D,re,V,Q),ye("Red","FF0000",D,re,V,Q),ye("Orange","FFC000",D,re,V,Q),ye("Yellow","FFFF00",D,re,V,Q),ye("Light Green","92D050",D,re,V,Q),ye("Green","00B050",D,re,V,Q),ye("Light Blue","00B0F0",D,re,V,Q),ye("Blue","0070C0",D,re,V,Q),ye("Dark Blue","002060",D,re,V,Q),d?ye("Purple Is A Fruit","7030A0",D,re,V,Q):ye("Transparent","00000000",D,re,V,Q),h){const X=h.toString();V.set(X,h)}const ge=new Map,se=typeof r=="function"?r():r,ue=[];for(let X=0;se&&X<se.length;X++){const oe=se[X].toString();ge.set(oe,se[X]),ue.push({description:"Recent "+(X+1),definition:{val:se[X].toString()}})}return{primaryColors:me,modifiedPresets:Be,standardColors:re,recentColorsLimited:ue,mapAllPresets:V,mapAllPresetsRGB:Q,mapRecent:ge}},[D,r,d,h]);n.useEffect(()=>{x?.()},[]);const[U,q]=n.useState(!1),G=n.useCallback(()=>{q(V=>!V)},[]);n.useEffect(()=>{if(l)q(l===vr.Custom);else if(o){let V=o.toString(),Q=W.mapAllPresets.get(V);Q||(V=o.toRGBA().toString(),Q=W.mapAllPresetsRGB.get(V));const me=W.mapRecent.get(V);q(!Q&&!me)}},[o,l]);const _=n.useCallback(L.CommonUtils.debounce(V=>{N?.(V)},u),[N,u]),[K,J]=n.useState();n.useEffect(()=>{J(t||o)},[t,o]);const ee=S.useCallbackRef(V=>{A&&(A(V),_(V))},[A]),F=S.useCallbackRef(V=>{ee(V?new L.Color({val:V.definition.val,adjs:V.definition.adjs},D):null)},[D]),ie=n.useCallback(V=>{V.ctrlKey&&q(!0)},[]),ne=S.useCallbackRef(V=>{let Q=!1;if(V){const me=V.toString();Q=!W.mapAllPresets.has(me)}j?.(V,Q)},[j,W]),le=S.useCallbackRef(V=>{const Q=V?new L.Color({val:V.definition.val,adjs:V.definition.adjs},D):null;Promise.resolve(g?.()).then(()=>{ne(Q)})},[D,g]),he=S.useCallbackRef(V=>{ee(V?new L.Color(V,D):null)},[D]),be=n.useMemo(()=>window.EyeDropper===void 0?e.jsx(e.Fragment,{}):e.jsx(T.IconButton,{"aria-label":"eye dropper",size:"small",sx:{color:V=>V.palette.text.icon??V.palette.action.active},onClick:async()=>{O(!0),B?.(),await new EyeDropper().open().then(V=>{O(!1),I?.();let Q=new L.Color(V.sRGBHex),me=Q.toString(),Be=W.mapAllPresets.get(me);if(Be||(me=Q.toRGBA().toString(),Be=W.mapAllPresetsRGB.get(me)),!Be){const re=Q.toRGBA(),ge=3;let se=255;W.mapAllPresetsRGB.forEach((ue,X)=>{const oe=ue.toRGBA(),ve=Math.abs(oe.red-re.red)+Math.abs(oe.blue-re.blue)+Math.abs(oe.green-re.green);ve<ge&&ve<se&&(Be=ue)})}q(!Be),ee(Be||Q)}).catch(V=>{O(!1),V?.name!=="AbortError"&&console.error(V)})},children:e.jsx(S.DynamicIcon,{iconKey:"Colorize"})}),[W,P]),Te=n.useMemo(()=>{if(!U)return;const V={opacity:U?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:V,children:e.jsx(y.LoadingPanel,{})}),children:e.jsx(Ni,{style:V,selectedColor:M?M.toRGBA().toString():"transparent",onColorChange:he,disableAlpha:d})})},[U,M]),de=n.useMemo(()=>({onClick:ie,alphaGrey:z.palette.text.icon??z.palette.action.active}),[ie,z]),Z=n.useMemo(()=>{if(!h)return null;const V={description:w,definition:{val:h.getVal(),adjs:h.getAdjustments()}};return e.jsx(e.Fragment,{children:e.jsxs(T.MenuItem,{sx:{display:"flex",color:Q=>Q.palette.text.secondary},onMouseOver:()=>{F(null)},onClick:()=>{le(null)},children:[e.jsx(T.Box,{sx:{flex:"none",boxShadow:Q=>Q.shadows[2],borderRadius:Q=>Q.spacing(.5),overflow:"hidden"},children:e.jsx(io,{schemeColorLookup:D,colorDef:V,selectedColor:o===null?h:o,previewColor:t===null?h:t,defaultButtonSize:c,isLarge:!0,darkMode:P,compareRGB:v,swatchProps:de})}),e.jsx(T.Typography,{noWrap:!0,component:"div",style:{display:"flex",flex:"1 1 100%",marginLeft:"8px",userSelect:"none"},children:w})]})})},[h,w,D,o,t]);return e.jsxs(T.Box,{ref:i,sx:{width:m,outline:"none",padding:"10px 10px",overflow:"hidden",boxSizing:"content-box"},...R,children:[e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("div",{style:{opacity:U?"0":1},children:[Z&&E===ut.Start?e.jsxs(e.Fragment,{children:[Z,e.jsx(T.Divider,{light:!0,style:{marginTop:"2px",marginBottom:"10px"}})]}):null,e.jsx(zt,{title:"Theme Colors",schemeColorLookup:D,colorDefs:W.primaryColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:de,onPreviewColorDef:F,onSelectColorDef:le,compareRGB:v,darkMode:P}),e.jsx(zt,{schemeColorLookup:D,colorDefs:W.modifiedPresets,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:de,onPreviewColorDef:F,onSelectColorDef:le,compareRGB:v,darkMode:P}),e.jsx(T.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(zt,{title:"Standard Colors",schemeColorLookup:D,colorDefs:W.standardColors,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:de,onPreviewColorDef:F,onSelectColorDef:le,compareRGB:v,darkMode:P}),e.jsxs("div",{style:{opacity:W.recentColorsLimited.length===0?"0":void 0,display:W.recentColorsLimited.length===0?"none":void 0},children:[e.jsx(T.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsx(zt,{title:"Recent Colors",schemeColorLookup:D,colorDefs:W.recentColorsLimited,selectedColor:o,previewColor:t===void 0?o:t,swatchProps:de,onPreviewColorDef:F,onSelectColorDef:le,compareRGB:v,darkMode:P})]}),Z&&E===ut.End?e.jsxs(e.Fragment,{children:[e.jsx(T.Divider,{light:!0,sx:{marginTop:"2px",marginBottom:"2px"}}),Z,e.jsx("div",{style:{marginBottom:"2px"}})]}):null]}),Te]}),e.jsx(T.Divider,{light:!0,style:{marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-around",gap:"8px",paddingLeft:"2px",paddingRight:"2px"},children:[be,e.jsx("div",{style:{flex:"1 1 100%",background:"pink"}}),e.jsx(T.Button,{style:{minWidth:"75px",maxWidth:"75px"},value:"check",variant:"outlined",size:"small",onClick:()=>{G()},children:U?e.jsx("div",{children:"Preset"}):e.jsx("div",{children:"Custom"})}),e.jsx(T.Button,{variant:"contained",size:"small",style:{minWidth:"75px"},onClick:()=>{Promise.resolve(g?.()).then(()=>{ne(K)})},children:"Done"})]})]})})),Oi=e.jsx(S.DynamicIcon,{iconKey:"circle.colored"}),Ho=n.memo(n.forwardRef((a,i)=>{const{selectedColor:o,quickColor:t,icon:r=Oi,tooltip:s,label:d,onPreviewColor:u,onPreviewColorImmediate:l,onSelectColor:c,variant:m=y.PopupButtonType.Toolbar,panelProps:x,shouldCloseFloatAll:g=!0,compareRGB:p=!1,darkMode:f=!1,...b}=a,k=S.useCallbackRef(u,[u]),C=S.useCallbackRef(l,[l]),h=S.useCallbackRef(c,[c]),[w,E]=n.useState(()=>{}),v=t||w||o||x?.autoColor,P=n.useRef(!1),R=n.useCallback(()=>{},[]),M=S.useCallbackRef(()=>{E(o)},[o]),N=S.useCallbackRef(W=>{P.current||(E(W),k?.(W))},[k]),A=S.useCallbackRef(W=>{P.current||(E(W),C?.(W))},[C]),j=S.useCallbackRef((W,U)=>{P.current||(E(void 0),h?.(W,U))},[h]),B=n.useMemo(()=>e.jsx(T.Box,{className:"color-wrapper",sx:{lineHeight:"0",color:"inherit","--sxl-color-active":`${v?.toCSS(f)??"transparent"}`,"& .activeColor":{fill:`${v?.toCSS(f)??"transparent"}`},"& .style_grey":{fill:W=>W.palette.text.icon??W.palette.action.active}},children:typeof r=="function"?r():r}),[v,r,f]),I=S.useCallbackRef(W=>{h?.(t,!1)},[h,t]),[H,O]=n.useState(!1),z=n.useCallback(W=>{const{closeFloat:U,closeFloatAll:q}=W;return e.jsx(Er,{...x,selectedColor:o,previewColor:w,onDone:g?q:U,onKeyDown:G=>{G.which===S.KeyCodes.Enter&&(g?q():U())},onPreviewColorImmediate:A,onPreviewColor:N,onSelectColor:j,onEyeDropStart:()=>O(!0),onEyeDropStop:()=>O(!1),compareRGB:p,darkMode:f})},[o,w,g,v,x?.autoColor,f]),D={onQuickClick:t?I:void 0,createPopupPanel:z,popupProps:{popperProps:{resizeOnOverflow:!1}},onPopupOpen:M,onPopupClose:R,tooltip:s||d||"Color",label:d,icon:B,...b};return m===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...D}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...D})})),eo=82,Fo=a=>{const{styleColor:i,length:o=eo,width:t=1,dashArray:r=null,sx:s,isDouble:d=!1,isAngled:u=!1,darkMode:l=!1,...c}=a;return e.jsx(T.SvgIcon,{sx:{width:`${o}px`,height:`${t}px`,color:"inherit",overflow:"visible","& .activeColor":{stroke:m=>`${i?i.toRGBA(l).toString():m.palette.text.icon??m.palette.action.active}`},"& .style_grey":{stroke:m=>m.palette.text.icon??m.palette.action.active},...s},height:t,width:o,viewBox:`0 0 ${o} ${t}`,...c,children:e.jsx(ae.StyledStrokePath,{length:o,width:t,dashArray:r,isDouble:d,isAngled:u,className:"activeColor"})})},Tr=n.memo(n.forwardRef((a,i)=>{const{variant:o,showLabels:t=!1,disabled:r=!1,createPopupPanel:s,styleColor:d,selectedStyle:u,onSelectStyle:l,showNone:c=!0,darkMode:m,sx:x,...g}=a,p=S.useCallbackRef(l,[]),f=n.useCallback(h=>{const{popupContainer:w,floatReference:E,closeFloat:v,...P}=h,R=[],M=L.IBorder.BuiltInDefinitionsArray;for(let N=0;N<M.length;N++){const A=M[N];if(A.description==="None"&&!c)continue;const j=e.jsx(Fo,{styleColor:d,length:eo,width:A.width,darkMode:m,dashArray:A.pattern,isDouble:A.description.toLowerCase().includes("double"),isAngled:A.description.toLowerCase().includes("slant")});let B=null;B=t?e.jsxs(e.Fragment,{children:[e.jsx(T.Box,{sx:{marginRight:"6px"},children:A.description}),e.jsxs(T.Box,{sx:{marginLeft:"6px",marginRight:"6px",display:"flex",alignItems:"center",flex:"1 1 100%"},children:[e.jsx("div",{style:{flex:"1 1 100%"}}),j]})]}):A.description==="None"?"None":j,R.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(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`},tooltipProps:{description:t?"":A.description},icon:null,disabled:r,onMouseDown:I=>I.preventDefault(),onMouseUp:()=>{v(),p(A.style)},onKeyDown:I=>{I.which===S.KeyCodes.Enter&&v()},selected:A.style===u,parentFloat:E,children:B},N))}return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},children:R})},[r,c,d,u,m]),b=n.useMemo(()=>{const h=L.IBorder.BuiltInDefinitions.get(u);let w;return w=h.description==="None"?e.jsx(T.Box,{sx:{minWidth:`${eo}px`},children:"None"}):e.jsx(Fo,{styleColor:d,length:eo,width:h.width,dashArray:h.pattern,darkMode:m,isDouble:h.description.toLowerCase().includes("double"),isAngled:h.description.toLowerCase().includes("slant")}),e.jsx(T.Box,{className:"border-stroke",sx:{paddingLeft:"12px",marginLeft:"4px",marginRight:"4px",height:"24px",display:"flex",alignItems:"center","& svg path.activeColor":{filter:y.createStrokeShadowFilter()}},children:w})},[u,d]),k=n.useMemo(()=>L.IBorder.BuiltInDefinitions.get(u),[u]),C={disabled:r,icon:b,tooltip:"Border Style: "+k.description,sx:{background:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`,...x},createPopupPanel:f,...g};return o===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{...C}):e.jsx(y.ExhibitPopupMenuItem,{...C})})),Br=n.memo(n.forwardRef((a,i)=>{const{autoColor:o=null,schemeLookup:t,autoStrokeStyle:r=L.IBorder.StrokeStyle.Thin,disabled:s=!1,darkMode:d=!1,showStylingBefore:u=!0,onSelectBorder:l,onPreviewBorder:c,selectedBorder:m,createTemporaryBorder:x,...g}=a,p=S.useCallbackRef(l,[l]),f=S.useCallbackRef(c,[c]),[b,k]=n.useState(),[C,h]=n.useState(),w=b??r,E=C??o,v=m||{bottom:{style:r,color:o?.toString()}},P=S.useCallbackRef(B=>{const I={},H=B?Object.keys(B):[];let O=!1;const z=H.length;for(let J=0;J<z;J++){const ee=H[J];B[ee]?.style&&(I[ee]={style:B[ee].style,color:B[ee].color},O||I[ee].style===L.IBorder.StrokeStyle.None||(O=!0))}H.length<6&&(O=!0);const D=O?I.left:null,W=O?I.top:null,U=O?I.right:null,q=O?I.bottom:null,G=O?I.vertical:null,_=O?I.horizontal:null;let K="";return W||D||(K+="M 3,5 H 5 V 3 H 3 "),W||(K+="M 7,5 H 9 V 3 H 7 "),W||G||(K+="M 11,5 h 2 V 3 h -2 "),W||(K+="M 15,5 h 2 V 3 h -2 "),W||U||(K+="M 19,5 h 2 V 3 h -2 "),D||(K+="M 3,9 H 5 V 7 H 3 "),G||(K+="M 11,9 h 2 V 7 h -2 "),U||(K+="M 19,9 h 2 V 7 h -2 "),_||D||(K+="M 3,13 H 5 V 11 H 3 "),_||(K+="M 7,13 H 9 V 11 H 7 "),_||G||(K+="M 11,13 h 2 v -2 h -2 "),_||U||(K+="M 19,13 h 2 v -2 h -2 "),_||(K+="M 15,13 h 2 v -2 h -2 "),D||(K+="M 3,17 H 5 V 15 H 3 "),G||(K+="M 11,17 h 2 v -2 h -2 "),U||(K+="M 19,17 h 2 v -2 h -2 "),q||D||(K+="M 3,21 H 5 V 19 H 3 "),q||(K+="M 7,21 H 9 V 19 H 7 "),q||G||(K+="M 11,21 h 2 v -2 h -2 "),q||(K+="M 15,21 h 2 v -2 h -2 "),q||U||(K+="M 19,21 h 2 v -2 h -2 "),e.jsxs(S.DynamicIcon,{children:[" ",e.jsxs(T.Box,{className:"border-icon",sx:{width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",position:"relative","& .grid > path":{opacity:"0.8"}},children:[e.jsx("svg",{viewBox:"0 0 24 24",className:"grid",style:{top:"0px",left:"0px",width:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",height:"calc(var(--icon-size, var(--icon-size-md)) + 1px)",position:"absolute"},children:e.jsx("path",{className:"fill",d:K})}),e.jsx(T.Box,{className:"border-container",sx:{position:"absolute",display:"flex",justifyContent:"stretch",alignItems:"stretch",top:"0px",left:"0px",width:"var(--icon-size, var(--icon-size-md))",height:"var(--icon-size, var(--icon-size-md))",padding:"1px 1px","& svg path":{filter:y.strokeShadowFilter}},children:e.jsx(ae.StaticBorderRenderer,{getBorderAt:(J,ee)=>{if(!x||H.length===0)return null;const F=J.rowIndex,ie=J.colIndex,ne={};return F===0?(ne.top=I.top,ne.bottom=I.horizontal):(ne.top=I.horizontal,ne.bottom=I.bottom),ie===0?(ne.left=I.left,ne.right=I.vertical):(ne.left=I.vertical,ne.right=I.right),x?.(ne)},darkMode:d,style:{top:"2px",left:"2px",width:"calc(100% - 5px)",height:"calc(100% - 5px)",position:"absolute"}})})]})]})},[E,w,d]),R=n.useCallback((B,I,H)=>{let O=null;if(B&&B.length>0){let z=null;(I||H)&&(z={style:H,color:I?.toString()??null}),O={};const D=B.length;for(let W=0;W<D;W++)O[B[W]]=z}return O},[]),M=n.useCallback(B=>{p?.(B)},[]),N=n.useCallback(B=>{f?.(B)},[]),A=n.useCallback(B=>{const{closeFloatAll:I,floatReference:H}=B,O=(W,U,q="bottom",G=!1)=>{const _=R(W,E??null,G?L.IBorder.StrokeStyle.None:w??null),K=G?R([],E??null,w??null):_;return e.jsx(y.ExhibitIconButton,{icon:P(K),sx:{background:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`},tooltipProps:{label:U,simple:!0,placement:q},onClick:()=>{I(),N(_),M(_)}})},z=e.jsxs(e.Fragment,{children:[e.jsxs(T.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom,L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical],"All Borders","top"),O([L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical],"Inner Borders","top"),O([L.IBorder.Edge.Horizontal],"Inside Horizontal Borders","top"),O([L.IBorder.Edge.Vertical],"Inside Vertical Borders","top"),O([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom],"Outside Borders","top")]}),e.jsxs(T.Box,{sx:{display:"flex",padding:"6px 16px",justifyContent:"center",rowGap:"2px",gap:"2px"},children:[O([L.IBorder.Edge.Left],"Left Borders"),O([L.IBorder.Edge.Top],"Top Borders"),O([L.IBorder.Edge.Right],"Right Borders"),O([L.IBorder.Edge.Bottom],"Bottom Borders"),O([L.IBorder.Edge.Left,L.IBorder.Edge.Top,L.IBorder.Edge.Right,L.IBorder.Edge.Bottom,L.IBorder.Edge.Horizontal,L.IBorder.Edge.Vertical,L.IBorder.Edge.DiagonalUp,L.IBorder.Edge.DiagonalDown],"No Borders","bottom",!0)]})]}),D=e.jsx(e.Fragment,{children:e.jsxs(T.Box,{sx:{display:"flex",padding:"6px 16px",flexDirection:"row",gap:"6px"},children:[e.jsx(Ho,{variant:y.PopupButtonType.Toolbar,icon:e.jsx(S.DynamicIcon,{iconKey:"stroke.colored"}),selectedColor:w===L.IBorder.StrokeStyle.None?new L.Color("transparent"):E,onPreviewColor:W=>{h(W)},onSelectColor:(W,U)=>{h(W)},darkMode:d,tooltip:"Border Color",panelProps:{disableAlpha:!0,autoColor:o,schemeLookup:t},disabled:s||w===L.IBorder.StrokeStyle.None,parentFloat:H,shouldCloseFloatAll:!1}),e.jsx(Tr,{selectedStyle:w,onSelectStyle:k,styleColor:E,darkMode:d,variant:y.PopupButtonType.Toolbar,parentFloat:H})]})});return e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",paddingTop:"4px",paddingBottom:"4px"},onClick:W=>W.stopPropagation(),children:[u?D:z,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),u?z:D]})},[w,E,o,t,d]),j=n.useMemo(()=>P(v),[v,d]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,createPopupPanel:A,popupProps:{popperProps:{resizeOnOverflow:!1}},createTooltip:({children:B},I)=>e.jsx(y.ExhibitTooltip,{label:"Borders",description:"Set the borders.",disabled:I,children:B}),onQuickClick:()=>{p?.(v)},quickButtonProps:{sx:{}},disabled:s,icon:j,...g})})),Pr=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,variant:s=S.CommandButtonType.Toolbar,disabled:d=!1,autoColor:u,autoStrokeStyle:l,schemeLookup:c,createTemporaryBorder:m,selectedBorder:x,onSelectBorder:g,darkMode:p,icon:f,label:b,...k}=a,C=S.useCommands(o,["formatBorder"]),h=t??C[0],w=h?.context()??null,E=w?.autoColor??u,v=w?.autoStyle??l,P=x??w?.quickBorder,R=p??w?.darkMode,M=m??w?.createTemporaryBorder,N=c??w?.schemeLookup,A=S.useCallbackRef(B=>{w?.onBorderSelect&&w.onBorderSelect(B),g?.(B),h?.execute(B,r)},[h,g,r]),j=n.useCallback((B,I)=>{const{children:H,title:O,...z}=B;let D=B.children;return(h?.disabled()||d)&&(D=e.jsx("div",{children:D})),e.jsx(y.CommandTooltip,{command:h,placement:s===S.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:I,...z,children:D})},[h,d]);return e.jsx(Br,{ref:i,autoColor:E,darkMode:R,autoStrokeStyle:v,createTemporaryBorder:M,schemeLookup:N,selectedBorder:P,onSelectBorder:A,createTooltip:j,disabled:d||!h||h.disabled(),...k})})),Rr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:c.getCommand("mergeToggle")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("mergeHorizontal")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("mergeVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:c.getCommand("unmerge")})]});return y.defaultCreatePopupPanel({...l,children:x})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,quickCommand:"mergeToggle",commandHook:t,scope:r,tooltip:"Combine or split cells.",createPopupPanel:u,icon:"MergeAll",...d})})),Mr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:c.getCommand("freezeToggle")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("freezeToggleHorizontal")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("freezeToggleVertical")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:c.getCommand("unfreeze")})]});return y.defaultCreatePopupPanel({...l,children:x})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:u,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",...d})})),Dr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:r,disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:c.getCommand("find")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("findReplace")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("goto")})]});return y.defaultCreatePopupPanel({...l,children:x})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:u,label:"Find & Select",tooltip:"Find and replace cells or go to a specific location.",quickCommand:"find",icon:"Find",...d})})),Fr=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,showQuickButtons:r=!!a.commands,commands:s,fontSizes:d=ae.FontUtils.DefaultFontSizes,disabled:u=!1,parentFloat:l,icon:c,label:m,sx:x,...g}=a;S.useCommand(o);const p=()=>o?.state()?.toString()||"11",[f,b]=n.useState(p),k=S.useCallbackRef(()=>{const M=parseFloat(f);isNaN(M)?b(p()):parseFloat(p())!==M&&o.execute(M,t)},[p,o,f,t]);n.useEffect(()=>{b(p())},[o?.state()]);const C=n.useMemo(()=>{if(!t)return null;const M={...t};return delete M.beforeExecute,M},[t]),h=S.useCommands(s,["formatFontSizeIncrease","formatFontSizeDecrease"]),w=n.useMemo(()=>h?e.jsxs(T.Box,{className:pe("quick-buttons",{}),sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:M=>M.stopPropagation(),children:[e.jsx(y.CommandButton,{command:h[0],commandHook:C}),e.jsx(y.CommandButton,{command:h[1],commandHook:C})]}):null,[h]),E=Y.useTheme(),v=n.useMemo(()=>`${L.IFont.getSharedMeasurer()("12.3",Math.round(E.typography.fontSize),E.typography.fontFamily).width}px`,[E]),P=n.useCallback(M=>{const{onMouseDown:N,onMouseUp:A,...j}=M;return e.jsx(T.IconButton,{component:"div",...j,disableRipple:!0,children:e.jsx(T.Input,{inputMode:"numeric",disabled:u||!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:B=>`1px solid ${B.palette.text.icon??B.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:B=>`1px solid ${B.palette.error.main}`},"::after":{borderBottom:B=>`1px solid ${B.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",fontSize:B=>`${Math.round(B.typography.fontSize)}px`,width:v,color:B=>B.palette.text.secondary,input:{padding:"0 0",textAlign:"center",height:"1rem",MozAppearance:"textfield","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:B=>B.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:B=>B.palette.text.primary}},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:"0"}},value:f,onFocus:B=>{B.target?.select()},onKeyDown:B=>{if(B.which===S.KeyCodes.Enter)p()!==f&&(B.stopPropagation(),B.preventDefault(),k());else if(B.which===S.KeyCodes.Escape)p()!==f&&(b(p()),setTimeout(()=>{B.target?.select()},0),B.stopPropagation(),B.preventDefault());else{if(B.key.match("[-]")||B.key.match("[0-9.]")&&(f+B.key).length>4)return B.stopPropagation(),void B.preventDefault();if(B.which===S.KeyCodes.Space)return void B.preventDefault()}},onBlur:()=>{k()},onChange:B=>{if(B.target.value.length>4)return B.stopPropagation(),void B.preventDefault();b(B.target.value)}})})},[f,u,o]),R=n.useCallback(M=>{const N=I=>{o?.execute(I,t)},A=o?.state(),j=[];for(let I=0;I<d.length;I++){const H=d[I]===A;j.push(e.jsx(y.ExhibitMenuItem,{selected:H,icon:H?e.jsx(y.SelectedIcon,{}):void 0,disabled:u||!o||o.disabled(),onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&N(d[I])},onKeyDown:O=>{O.keyCode!==S.KeyCodes.Enter&&O.keyCode!==S.KeyCodes.Space||N(d[I])},sx:{paddingTop:"4px",paddingBottom:"4px"},children:e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",justifyContent:"end"},children:d[I]})},"fontSize-"+I))}const B=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...g,children:[w,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:j})]});return y.defaultCreatePopupPanel({...M,children:B})},[u,o?.state(),t]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...x},tabIndex:-1,outlined:!0,disabled:u,parentFloat:l,createPopupPanel:R,createTooltip:({children:M},N)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:N||o?.disabled(),children:M}),createQuickButton:P,...g})})),Bn=n.memo(a=>{const{selected:i,disabled:o,formattedValue:t,handleSetFormat:r,format:s,sx:d,...u}=a;return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...d},disabled:o,selected:i,icon:i?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:l=>{l.button===0&&l.preventDefault()},onMouseUp:l=>{l.button===0&&r(s.numberFormat)},onKeyDown:l=>{l.keyCode!==S.KeyCodes.Enter&&l.keyCode!==S.KeyCodes.Space||r(s.numberFormat)},...u,children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(T.Typography,{component:"div",children:[s.formatType,s.formatType===L.NumberFormat.Type.Custom?"…":""]}),e.jsx(T.Typography,{variant:"caption",component:"div",sx:{color:l=>Me.alpha(l.palette.text.primary,.6),paddingTop:t&&t.length>0?"1px":void 0,overflow:"hidden",textOverflow:"ellipsis"},children:t&&t.length>0?t:" "})]})})}),Ir=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,sx:s,disabled:d=!1,parentFloat:u,...l}=a,c=S.useCommands(o,["formatNumberFormat"])[0],m=c?.state()?L.NumberFormat.Styles.lookupStyle(c?.state()).formatType:L.NumberFormat.Type.General,x=n.useMemo(()=>{if(!t)return null;const b={...t};return delete b.beforeExecute,b},[t]),g=n.useCallback((b,k)=>{const C=A=>{t?.beforeExecute?.(c,c?.state()),c.execute(A,t),t?.onExecute?.(c,c?.state())},h=c?.context()(),w=L.NumberFormat.Styles.lookupPrimary(),E=[];for(let A=0;A<w.length;A++){let j="";if(h&&!h.isEmpty())try{j=h.getNumberFormat(w[A].numberFormat).displayText}catch(I){console.warn(I)}j===""&&w[A].formatType===L.NumberFormat.Type.General&&(j="No specific format");const B=w[A].formatType===m;E.push(e.jsx(Bn,{selected:B,disabled:d||!c||c.disabled(),formattedValue:j,handleSetFormat:C,format:w[A]},w[A].formatType))}const v={numberFormat:"",formatType:L.NumberFormat.Type.Custom},P=m===L.NumberFormat.Type.Custom,R=e.jsx(Bn,{selected:P,disabled:d||!c||c.disabled(),formattedValue:P?h.getNumberFormat().displayText:"",handleSetFormat:()=>{t?.beforeExecute?.(c,c?.state()),k.getCommand("formatNumberDialog")?.execute(c?.state()),t?.onExecute?.(c,c?.state())},format:v,sx:{flex:"0",width:"100%"}},L.NumberFormat.Type.Custom),M=e.jsxs(T.Box,{className:"quick-buttons",sx:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:A=>A.stopPropagation(),children:[e.jsx(y.CommandButton,{command:k.getCommand("formatNumberFormatAccountingStyle"),commandHook:x,scope:r}),e.jsx(y.CommandButton,{command:k.getCommand("formatNumberFormatPercentStyle"),commandHook:x,scope:r}),e.jsx(y.CommandButton,{command:k.getCommand("formatNumberFormatCommaStyle"),commandHook:x,scope:r}),e.jsx(y.CommandButton,{command:k.getCommand("formatNumberFormatIncreaseDecimal"),commandHook:x,scope:r}),e.jsx(y.CommandButton,{command:k.getCommand("formatNumberFormatDecreaseDecimal"),commandHook:x,scope:r})]}),N=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...l,children:[M,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:E}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),R]});return y.defaultCreatePopupPanel({...b,children:N})},[c?.context(),c?.state(),t,r]),p=Y.useTheme(),f=n.useMemo(()=>{const b=L.NumberFormat.Type.MediumTime;return`${L.IFont.getSharedMeasurer()(b,Math.round(p.typography.fontSize),p.typography.fontFamily).width}px`},[p]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,sx:s,outlined:!0,disabled:d,parentFloat:u,createPopupPanel:g,createTooltip:({children:b},k)=>e.jsx(y.ExhibitTooltip,{label:c?.label(),description:c?.description(),disabled:k,children:b}),icon:e.jsx(T.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:b=>`${Math.round(b.typography.fontSize)}px`,color:b=>b.palette.text.secondary,fontFamily:b=>b.typography.fontFamily,width:f},children:e.jsx(T.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:m})}),...l})})),zo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"clear",disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:c.getCommand("clearAll")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("clearFormats")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("clearContents")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("clearComments")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("clearHyperlinks")})]});return y.defaultCreatePopupPanel({...l,children:x})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Clear",tooltip:"Clear everything in the cell, or remove just the formatting or contents.",createPopupPanel:u,icon:"ClearAll",...d})})),Nr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"fill",disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:c.getCommand("fillDown")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("fillRight")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("fillUp")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("fillLeft")})]});return y.defaultCreatePopupPanel({...l,children:x})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,label:"Fill",tooltip:"Fill the selected cells with the value from one of the corners.",createPopupPanel:u,icon:"FillDown",...d})})),Wo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:u=!0,showQuickButton:l=!0,variant:c=S.CommandButtonType.Toolbar,...m}=a,x=S.useCommands(o,["insertCellsShiftDown","insertCellsShiftRight","insertRows","insertColumns"]),{singleCommand:g,allDisabled:p}=n.useMemo(()=>{let b=null,k=0;for(let C=0;C<x.length;C++)x[C]&&!x[C]?.disabled()&&(u&&c===S.CommandButtonType.Menuitem&&(b=k===0?x[C]:null),k++);return{singleCommand:b,allDisabled:k===0}},[x]),f=n.useCallback((b,k)=>{let C=null;const h={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"insertCells",disabled:s};d||(C=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:k.getCommand("addSheet")})]}));const w=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...h,command:x[0]}),e.jsx(y.CommandButton,{...h,command:x[1]}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...h,command:x[2]}),e.jsx(y.CommandButton,{...h,command:x[3]}),C]});return y.defaultCreatePopupPanel({...b,children:w})},[s,x,t,r]);return g?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:g,...m}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,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:f,...m})})),$o=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,disableSheet:d=!1,preferSingleMenu:u=!0,showQuickButton:l=!0,variant:c=S.CommandButtonType.Toolbar,...m}=a,x=S.useCommands(o,["deleteCellsShiftUp","deleteCellsShiftLeft","deleteRows","deleteColumns"]),{singleCommand:g,allDisabled:p}=n.useMemo(()=>{let b=null,k=0;for(let C=0;C<x.length;C++)x[C]&&!x[C]?.disabled()&&(u&&c===S.CommandButtonType.Menuitem&&(b=k===0?x[C]:null),k++);return{singleCommand:b,allDisabled:k===0}},[x]),f=n.useCallback((b,k)=>{const C={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"deleteCells",disabled:s};let h=null;d||(h=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:k.getCommand("deleteSheet")})]}));const w=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,command:k.getCommand("deleteCellsShiftUp")}),e.jsx(y.CommandButton,{...C,command:k.getCommand("deleteCellsShiftLeft")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:k.getCommand("deleteRows")}),e.jsx(y.CommandButton,{...C,command:k.getCommand("deleteColumns")}),h]});return y.defaultCreatePopupPanel({...b,children:w})},[s,t,r]);return g?e.jsx(y.CommandButton,{ref:i,variant:c,commandHook:t,disabled:s,command:g,...m}):e.jsx(y.CommandPopupButton,{ref:i,variant:c,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:f,...m})})),pt=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,onSelectColor:r,disabled:s=!1,variant:d=S.CommandButtonType.Toolbar,quickColor:u,panelProps:l,isSplit:c=!1,darkMode:m,icon:x,...g}=a,{autoColor:p,schemeLookup:f,recentColors:b,...k}=l;if(g.selectedColor)throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");S.useCommand(o);const C=o?.context();let h=u??C?.quickColor;c&&!h&&(h=new L.Color("transparent"));const w=p??C?.autoColor,E=f??C?.schemeLookup,v=b??C?.recentColors,P=m??C?.darkMode,R=n.useMemo(()=>({autoColor:w,schemeLookup:E,recentColors:v,darkMode:P,...k}),[w,E,v,P]),M=S.useCallbackRef((A,j)=>{A&&j&&C?.addRecentColor&&C.addRecentColor(A),C?.onColorSelect&&C.onColorSelect(A),r?.(A,j),o?.execute(A,t)},[o,r,t,C]),N=n.useCallback((A,j)=>{const{children:B,title:I,...H}=A;let O=A.children;return(o?.disabled()||s)&&(O=e.jsx("div",{children:O})),e.jsx(y.CommandTooltip,{command:o,placement:d===S.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:j,...H,children:O})},[o,s]);return e.jsx(Ho,{ref:i,panelProps:R,icon:x,quickColor:h,selectedColor:o?.state(),onSelectColor:M,variant:d===S.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:N,label:o?.label(),disabled:s||!o||o.disabled(),compareRGB:!0,darkMode:P,...g})}));pt.displayName="ColorCommandButton";const Or=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...u}=a,l=S.useCommands(o,["gridlinesToggle","sheetViewToggleGridlinesColumns","sheetViewToggleGridlinesRows"]),c=n.useCallback((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,parentFloat:m.floatReference,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:x.getCommand("gridlinesToggle")}),e.jsx(pt,{...g,command:x.getCommand("sheetViewFormatGridlinesColor"),icon:e.jsx(S.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0}}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:x.getCommand("sheetViewToggleGridlinesColumns")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("sheetViewToggleGridlinesRows")})]});return y.defaultCreatePopupPanel({...m,children:p})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Gridlines",tooltip:"Configure how the lines between rows and columns in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:l[0],scope:"view"}),...u})})),Vo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},x=c.getCommand("sortCustom"),g=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:c.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...m,command:c.getCommand("sortDescending")}),x?e.jsx(y.CommandButton,{...m,command:x}):null,e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...m,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...m,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:g})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,scope:r,disabled:s,label:"Sort",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:u,icon:"SortIncrease",...d})})),Ai=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=n.useCallback((l,c)=>{const m={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"sort",disabled:s},x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,scope:"filter",command:c.getCommand("autoFilterToggle")}),e.jsx(y.CommandButton,{...m,scope:"filter",command:c.getCommand("autoFilterClear")}),e.jsx(y.CommandButton,{...m,scope:"filter",command:c.getCommand("autoFilterReapply")})]});return y.defaultCreatePopupPanel({...l,children:x})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,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:u,icon:"FilterToggle",...d})})),Ko=n.memo(n.forwardRef((a,i)=>{const{quickCommand:o,icon:t,isRedo:r=!1,nestRedo:s=!0,undoManager:d,scope:u,sx:l,disabled:c,commands:m,...x}=a,g=[o];!r&&s&&g.push("redo");const p=S.useCommands(m,g),f=p[0],b=p[1],k=d??f?.context?.()?.undoManager;let C=c;c||(C=!f||f.disabled(),b&&!b.disabled()&&(C=!1));const[h,w]=n.useState(0),E=n.useCallback((v,P)=>{let R=h===0?"Cancel":`${f.label()} ${h} Action${h===1?"":"s"}`,M=!1;k||(M=!0),M||(M=s?!k.hasRedo()&&!k.hasUndo():!k.hasRedo());const N=O=>{f.execute(O)},A=e.jsx(y.ExhibitMenuItem,{sx:{display:"flex",flex:"none",alignItems:"center",justifyContent:"center",padding:M?void 0:"0 0",minWidth:"180px"},icon:e.jsx(S.DynamicIcon,{}),onMouseEnter:()=>{w(0)},onMouseDown:O=>{O.button===0&&O.preventDefault()},onMouseUp:O=>{O.button===0&&N(h)},onKeyDown:O=>{O.isDefaultPrevented()||O.keyCode!==S.KeyCodes.Enter&&O.keyCode!==S.KeyCodes.Space||N(h)},children:e.jsx(T.Typography,{component:"div",variant:"caption",sx:{fontSize:"0.875rem",letterSpacing:"0.01071em"},children:R})});if(M)return A;const j=r?k?.getRedoDescriptions():k?.getUndoDescriptions(),B=[];for(let O=0;O<j.length;O++){const z=j[O];B.push(e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex"},disabled:C,selected:O<h,icon:e.jsx(S.DynamicIcon,{}),onMouseEnter:()=>{w(O+1)},onMouseDown:D=>{D.button===0&&D.preventDefault()},onMouseUp:D=>{D.button===0&&N(O+1)},onKeyDown:D=>{D.isDefaultPrevented()||D.keyCode!==S.KeyCodes.Enter&&D.keyCode!==S.KeyCodes.Space||N(O+1)},children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",alignItems:"center",overflow:"hidden"},children:[e.jsx(T.Typography,{component:"div",children:z}),e.jsx(S.DynamicIcon,{})]})},`action:${O}`))}let I=null;if(!r&&s){const O={scope:"undo",commands:P,variant:S.CommandButtonType.Menuitem,parentFloat:v.floatReference};I=[],I.push(e.jsx(Ko,{...O,quickCommand:"redo",isRedo:!0},"nested:redo")),k.hasRedo()&&k.hasUndo()&&I.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"action:redo-div"))}const H=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},onClick:()=>{v.closeFloatAll()},onMouseLeave:()=>{w(0)},children:[I,e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:B}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),A]});return y.defaultCreatePopupPanel({...v,children:H})},[f?.context(),f?.state(),u,k,h,C]);return e.jsx(y.CommandPopupButton,{ref:i,commands:m,quickCommand:o,scope:u,disabled:C,label:f?.label()??(r?"Redo":"Undo"),tooltip:e.jsx(e.Fragment,{children:e.jsx("span",{children:`${f?.label()??"No"} last actions.`})}),createPopupPanel:E,icon:t??(r?"Redo":"Undo"),selected:!1,...x})})),mt=L.IFontCollection.getFontList(),Ar=new Map;for(let a=0;a<mt.length;a++)Ar.set(mt[a].fontRef.getFamily(),mt[a]);const Lr=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,sx:r,disabled:s=!1,parentFloat:d,icon:u,label:l,...c}=a;S.useCommand(o);const m=o?.state(),x=Y.useTheme(),g=n.useMemo(()=>`${L.IFont.getSharedMeasurer()("Times New Roman",Math.round(x.typography.fontSize),x.typography.fontFamily).width}px`,[x]),p=n.useCallback(f=>{const b=w=>{o?.execute(w,t)},k=[];for(let w=0;w<mt.length;w++)k.push({key:mt[w].fontRef.getFamily(),description:mt[w].fontRef.getFamily()});Ar.get(m)||k.unshift({key:m,description:m});const C=[];for(let w=0;w<k.length;w++){const E=k[w].key===m;C.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&&b(k[w].key)},onMouseDown:v=>{v.button===0&&v.preventDefault()},onKeyDown:v=>{v.keyCode!==S.KeyCodes.Enter&&v.keyCode!==S.KeyCodes.Space||b(k[w].key)},children:e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(T.Typography,{component:"div",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:()=>k[w]?.key},children:k[w].description})})},w+""+k[w].key))}const h=e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},...c,children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:C})});return y.defaultCreatePopupPanel({...f,children:h})},[s,o?.state()]);return e.jsx(y.ExhibitPopupIconButton,{ref:i,sx:{...r},outlined:!0,disabled:s,parentFloat:d,createPopupPanel:p,createTooltip:({children:f},b)=>e.jsx(y.ExhibitTooltip,{label:o?.label(),description:o?.description(),disabled:b,children:f}),icon:e.jsx(T.Box,{sx:{display:"flex",paddingLeft:"4px",paddingRight:"4px",fontSize:f=>`${Math.round(f.typography.fontSize)}px`,fontFamily:f=>f.typography.fontFamily,color:f=>f.palette.text.secondary,width:g},children:e.jsx(T.Box,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"},children:m})}),...c})})),Hr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=S.useCommands(o,["formatStrikeThroughToggle","formatSuperscriptToggle","formatSubscriptToggle"]),l=n.useMemo(()=>{for(let m=0;m<u.length;m++)if(u[m]?.state())return u[m];return u[0]},[u]),c=n.useCallback((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"textEffects",disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:x.getCommand("formatStrikeThroughToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatSuperscriptToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatSubscriptToggle")})]});return y.defaultCreatePopupPanel({...m,children:p})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Text Effects",tooltip:"Style your text to differentiate it.",icon:l?.icon()??"TextStrike",...d})})),zr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=S.useCommands(o,["formatUnderlinedToggle","formatUnderlinedDoubleToggle","formatUnderlinedAccountingToggle","formatUnderlinedAccountingDoubleToggle"]),l=n.useMemo(()=>{for(let m=0;m<u.length;m++)if(u[m]?.state())return u[m];return u[0]},[u]),c=n.useCallback((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"underline",disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:x.getCommand("formatUnderlinedToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatUnderlinedDoubleToggle")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatUnderlinedAccountingToggle"),commandHook:t}),e.jsx(y.CommandButton,{...g,command:x.getCommand("formatUnderlinedAccountingDoubleToggle")})]});return y.defaultCreatePopupPanel({...m,children:p})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:l?.key(),commands:o,commandHook:t,label:"Underline",tooltip:"All underline stylings.",createPopupPanel:c,icon:l?.icon()??"TextUnderline",...d})})),_o=n.memo(n.forwardRef((a,i)=>{const{command:o,commands:t,commandHook:r,scope:s,includePasteAllInPopup:d=!0,disabled:u=!1,...l}=a,c=S.useCallbackRef((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,commandHook:r,scope:"paste",disabled:u},p=[];return d&&(p.push(n.createElement(y.CommandButton,{...g,command:x.getCommand("paste"),key:"paste"})),p.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"paste-div"))),p.push(n.createElement(y.CommandButton,{...g,command:x.getCommand("pasteValues"),key:"pasteValues"})),p.push(n.createElement(y.CommandButton,{...g,command:x.getCommand("pasteFormats"),key:"pasteFormats"})),p.push(n.createElement(y.CommandButton,{...g,command:x.getCommand("pasteFormulas"),key:"pasteFormulas"})),p.push(n.createElement(y.CommandButton,{...g,command:x.getCommand("pasteTranspose"),key:"pasteTranspose"})),p.push(n.createElement(y.CommandButton,{...g,command:x.getCommand("pasteLinks"),key:"pasteLinks"})),y.defaultCreatePopupPanel({...m,children:p})},[u,r,s,d]);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,scope:s,createPopupPanel:c,label:"Paste",tooltip:"Add content to the clipboard to your document.",quickCommand:"paste",icon:"paste",...l})})),Wr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,parentFloat:d,...u}=a,l=S.useCommands(o,["sheetViewToggleShowHeadings","sheetViewToggleShowHeadingColumns","sheetViewToggleShowHeadingRows"]),c=n.useCallback((m,x)=>{const g={variant:S.CommandButtonType.Menuitem,parentFloat:m.floatReference,commandHook:t,scope:r,disabled:s},p=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...g,command:x.getCommand("sheetViewToggleShowHeadings")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("sheetViewToggleShowHeadingsNumeric")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...g,command:x.getCommand("sheetViewToggleShowHeadingColumns")}),e.jsx(y.CommandButton,{...g,command:x.getCommand("sheetViewToggleShowHeadingRows")})]});return y.defaultCreatePopupPanel({...m,children:p})},[s,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,parentFloat:d,quickCommand:l[0]?.key(),commands:o,commandHook:t,createPopupPanel:c,label:"Headings",tooltip:"Configure how the column and rows headings in the sheet are displayed.",icon:e.jsx(y.LabelIcon,{command:l[0],scope:"view"}),...u})})),$r=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="view",disabled:s=!1,...d}=a,u=n.useCallback(l=>{const c={variant:S.CommandButtonType.Menuitem,parentFloat:l.floatReference,commandHook:t,scope:r,disabled:s},m=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowFormulaBar")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowTabs")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowStatusBar")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowHorizontalScrollBar")}),e.jsx(y.CommandButton,{...c,command:o.getCommand("workbookViewToggleShowVerticalScrollBar")})]});return y.defaultCreatePopupPanel({...l,children:m})},[s,o,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Workbook View",tooltip:"Options to configure how the workbook is displayed.",createPopupPanel:u,icon:e.jsx(y.LabelIcon,{icon:null,label:"Workbook View"}),...d})})),Vr=n.memo(n.forwardRef((a,i)=>{const{value:o,cellStyle:t,styles:r,createTemporaryCell:s,bodyStyle:d,sx:u,borderProps:l,disabled:c,...m}=a,x=n.useMemo(()=>s({value:o,style:t}),[o,t,s]),g=n.useMemo(()=>x.getStyle(),[x,d]),p=n.useMemo(()=>g.getFill().toCSS(d?.darkMode??!1),[g]),f=g.getInsets(),b=g.getFont(),k=n.useCallback(()=>g.getBorder(),[g]);return e.jsx(T.Box,{ref:i,sx:{width:"100px",height:"100%",textOverflow:"ellipsis",display:"flex",alignItems:"stretch",background:d?.fill,filter:c?"grayscale(0.4) opacity(0.8);":"none","& .fill":{flex:"1 1 100%",overflow:"hidden",...p},"& .text":{flex:"1 1 100%",...b.toCSS(d?.darkMode??!1,1),boxSizing:"border-box",padding:`${f.top}px ${f.right}px ${f.bottom}px ${f.left}px`,margin:"0px",outline:"none",resize:"none",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"baseline",textDecoration:b.toCSS().textDecoration,textAlign:L.ITextFrame.toCSSHorizontalTextAlign(x.getRenderHorizontalAlignment()),background:"transparent",maxHeight:"100%",whiteSpace:"pre",wordWrap:"break-word"},...u},...m,children:e.jsx(ae.StaticBorderRenderer,{getBorderAt:k,darkMode:d?.darkMode??!1,rowCount:1,columnCount:1,style:{height:"100%",width:"100%",...l?.style},...l,children:e.jsx(T.Box,{className:"fill",sx:{paddingLeft:"4px",paddingRight:"4px",marginLeft:"-1px",marginTop:"-1px",marginRight:"-2px",marginBottom:"-2px",display:"flex",alignItems:"center"},children:e.jsx(T.Box,{className:"text",children:o})})})})})),Li=n.memo(a=>{const{styles:i,namedStyle:o,selectedNamed:t,hasContextMenu:r=!0,bodyStyle:s,onSelectNamed:d,createTemporaryCell:u,parentFloat:l,commands:c,disabled:m,commandHook:x,...g}=a,p=n.useCallback(k=>{const C={variant:S.CommandButtonType.Menuitem,commandHook:x,context:"cellStyle"},h=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...C,style:{fontWeight:550},command:c.getCommand("formatCellStyle"),commandState:o,disabled:m}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...C,command:c.getCommand("modifyCellStyle"),commandState:{named:o}}),e.jsx(y.CommandButton,{...C,command:c.getCommand("deleteCellStyle"),commandState:o,disabled:m||o?.getName()===L.IStyle.BuiltInName.Normal})]}),w=e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:h})});return y.defaultCreatePopupPanel({...k,children:w})},[]),f=o?.getName()===t?.getName();let b=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:k=>`solid ${f?k.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName(),placement:"bottom-start"},disabled:m,icon:null,onClick:()=>{d?.(o)},...g,children:e.jsx(Vr,{value:o.getName(),cellStyle:{named:o.getName()},styles:i,createTemporaryCell:u,bodyStyle:s})},o.getName());return r&&(b=e.jsx(y.ContextMenu,{label:o.getName(),parentFloat:l,createPopupPanel:p,children:b})),b}),Kr=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedNamed:s,onSelectNamed:d,disabled:u=!1,bodyStyle:l,usePreviewIcon:c=!0,...m}=a;S.useCommand(t);const x=t?.context(),g=x?.styles,p=s??x?.named(),f=l??x?.bodyStyle(),b=S.useCallbackRef(E=>{d?.(E),t?.execute(E,r)},[t,d,r]),k=n.useCallback((E,v)=>{const P={onSelectNamed:b,styles:g(),parentFloat:E.floatReference},R=g().getCustomNamed(),M=new Map,N=[];for(let D=0;D<R.length;D++)M.set(R[D].getName(),R[D]),g().getNamed(R[D].getName()).getBuiltInID()===null&&N.push(R[D].getName());const A=D=>{let W=M.get(D);return W||(W=g().getNamed(D)),!W||W.isHidden()?null:e.jsx(Li,{namedStyle:W,selectedNamed:p,bodyStyle:x.bodyStyle(),createTemporaryCell:x.createTemporaryCell,commands:o,commandHook:r,...P},D)},j=(D,W,U=!0)=>{const q=[];for(let G=0;G<W.length;G++){const _=A(W[G]);_&&q.push(_)}return q.length===0?null:e.jsxs(T.Box,{children:[U?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:D},D+"-header"),e.jsx(T.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"646px",maxWidth:"100%"},children:q},D+"-presets")]},D)},B=(D,W)=>{const U=[];for(let q=0;q<W.length;q++){const G=A(W[q]);G&&U.push(G)}return U.length===0?null:e.jsx(T.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",flexDirection:"column",flex:"0 0 0%"},children:U},D+"-presets")},I=[];I.push(j("Custom",N,!1)),I.push(j("Good, Bad and Neutral",[L.IStyle.BuiltInName.Normal,L.IStyle.BuiltInName.Bad,L.IStyle.BuiltInName.Good,L.IStyle.BuiltInName.Neutral],N.length>0)),I.push(j("Data and Model",[L.IStyle.BuiltInName.Calculation,L.IStyle.BuiltInName.CheckCell,L.IStyle.BuiltInName.ExplanatoryText,L.IStyle.BuiltInName.FollowedHyperlink,L.IStyle.BuiltInName.Hyperlink,L.IStyle.BuiltInName.Input,L.IStyle.BuiltInName.LinkedCell,L.IStyle.BuiltInName.Note,L.IStyle.BuiltInName.Output,L.IStyle.BuiltInName.WarningText])),I.push(j("Titles and Headings",[L.IStyle.BuiltInName.Heading1,L.IStyle.BuiltInName.Heading2,L.IStyle.BuiltInName.Heading3,L.IStyle.BuiltInName.Heading4,L.IStyle.BuiltInName.Title,L.IStyle.BuiltInName.Total]));let H=[];var O,z;return H.push(B("Accent 1",[L.IStyle.BuiltInName.Accent1_20,L.IStyle.BuiltInName.Accent1_40,L.IStyle.BuiltInName.Accent1_60,L.IStyle.BuiltInName.Accent1])),H.push(B("Accent 2",[L.IStyle.BuiltInName.Accent2_20,L.IStyle.BuiltInName.Accent2_40,L.IStyle.BuiltInName.Accent2_60,L.IStyle.BuiltInName.Accent2])),H.push(B("Accent 3",[L.IStyle.BuiltInName.Accent3_20,L.IStyle.BuiltInName.Accent3_40,L.IStyle.BuiltInName.Accent3_60,L.IStyle.BuiltInName.Accent3])),H.push(B("Accent 4",[L.IStyle.BuiltInName.Accent4_20,L.IStyle.BuiltInName.Accent4_40,L.IStyle.BuiltInName.Accent4_60,L.IStyle.BuiltInName.Accent4])),H.push(B("Accent 5",[L.IStyle.BuiltInName.Accent5_20,L.IStyle.BuiltInName.Accent5_40,L.IStyle.BuiltInName.Accent5_60,L.IStyle.BuiltInName.Accent5])),H.push(B("Accent 6",[L.IStyle.BuiltInName.Accent6_20,L.IStyle.BuiltInName.Accent6_40,L.IStyle.BuiltInName.Accent6_60,L.IStyle.BuiltInName.Accent6])),I.push((O="Themed Cell Styles",z=H,e.jsxs(T.Box,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.ExhibitMenuHeader,{children:O},O+"-header"),e.jsx(T.Box,{sx:{display:"flex",gap:"2px",flexWrap:"wrap",alignItems:"start",flexDirection:"row"},children:z},O+"-presets")]},O))),I.push(j("Number Format",[L.IStyle.BuiltInName.Comma,L.IStyle.BuiltInName.Comma0,L.IStyle.BuiltInName.Currency,L.IStyle.BuiltInName.Currency0,L.IStyle.BuiltInName.Percent])),e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:D=>`${D.shape.borderRadius}px`,paddingBottom:D=>`${D.shape.borderRadius}px`},children:[e.jsx(T.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:S.CommandButtonType.Menuitem,commandState:p,command:v.getCommand("newCellStyle"),context:"styles",commandHook:r,disabled:u})]})},[p,g?.().getTheme(),f]),C=S.useCallbackRef(E=>{const v=18/L.IFont.getDeviceScale(),P=x?.createTemporaryCell(E);return P.getStyle().getFont().getSize()<=v?P:P.createTemporaryCell({style:{font:{size:v}}})},[x?.createTemporaryCell]),h=u||!t||t.disabled(),w=n.useMemo(()=>x&&c?e.jsx(Vr,{value:p?.getName()??"Custom",cellStyle:p?{named:p.getName()}:void 0,styles:x.styles(),createTemporaryCell:C,bodyStyle:x.bodyStyle(),className:"outline-hover",disabled:h,sx:{marginRight:"4px",borderRadius:"2px",minHeight:"calc(100% - 2px)",overflow:"hidden",outline:E=>`1px solid ${E.palette.action.hover}`},borderProps:{style:{height:"calc(100% - 2px)",width:"calc(100% - 1px)"}}}):t?.icon(),[p,f,h,t]);return e.jsx(y.CommandPopupButton,{ref:i,createPopupPanel:k,outlined:c,commands:o,createTooltip:({children:E},v)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:v,children:E}),selected:!1,disabled:h,label:t?.label(),icon:w,...m})})),_r="_sheetxl-reset_11z3j_1",Hi=10,Ur=n.memo(n.forwardRef((a,i)=>{const{styles:o,table:t,tableStyle:r=t?.getStyle()??o.getDefaultTableStyle(),bodyStyle:s,sx:d,disabled:u,className:l,forceThinBorder:c,cellHeight:m=Hi,isLive:x=!1,...g}=a,p=Math.ceil(1.3*m),[f,b]=n.useReducer(E=>E+1,0);n.useEffect(()=>{if(x&&t)return t.addListeners({onAnyChange:()=>{b()}})},[t,x]);const k=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 L.Table({initialAnchor:v,json:E,styles:o})},[f,t,r,o]),C=n.useMemo(()=>{const E=[];for(let v=0;v<5;v++)for(let P=0;P<5;P++){const R=k.getStyleAt({colIndex:P,rowIndex:v});E.push(R)}return E},[k]),h=n.useMemo(()=>{const E=(P,R,M)=>{let N=M.getFill().toCSS(s?.darkMode??!1);const A=p-(R<4?1:0),j=m-(P<4?1:0),B=M.getFont().getFill().toCSS(s?.darkMode??!1);return N={...N,position:"absolute",boxSizing:"border-box",left:R*(p-1),top:P*(m-1),width:A,height:j},e.jsx("td",{className:`table-style-fill ${P}-${R}`,style:N,children:e.jsx("div",{className:`table-style-text ${P}-${R}`,style:{position:"absolute",boxSizing:"border-box",width:"6px",left:(A-6)/2,top:(j-1)/2,borderTop:`1px solid ${B}`}})},`${P}-${R}`)},v=[];for(let P=0;P<5;P++){const R=[];for(let M=0;M<5;M++){const N=C[5*P+M];R.push(E(P,M,N))}v.push(e.jsx("tr",{children:R},P))}return v},[k,r,s]),w=n.useCallback((E,v)=>C[v].getBorder()??null,[C]);return e.jsx(T.Box,{ref:i,className:"table-format-preview",sx:{background:s?.fill,filter:u?"grayscale(0.4) opacity(0.8);":"none","& .styled-element":{position:"absolute"},...d},...g,children:e.jsx(ae.StaticBorderRenderer,{getBorderAt:w,rowCount:5,columnCount:5,forceThinBorder:c,width:5*(p-1)+1,height:5*(m-1)+1,darkMode:s?.darkMode??!1,style:{pointerEvents:"none"},children:e.jsx("table",{className:pe(l,"sheetxl-table-preview",_r),style:{borderCollapse:"collapse",width:5*(p-1)+1,height:5*(m-1)+1},children:e.jsx("tbody",{children:h})})})})})),Ct=(a,i,o,t,r)=>{a.beginPath(),a.moveTo(i+.5,o+.5),a.lineTo(t+.5,r+.5),a.stroke()},qr=n.memo(n.forwardRef((a,i)=>{const{table:o,tableStyle:t,styles:r,bodyStyle:s,disabled:d,style:u,className:l,canvas:c,...m}=a,x=n.useMemo(()=>{const f=o.toJSON(),b={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return f.styleOptions={...f.styleOptions,name:t.getName()},f.ref=b,new L.Table({initialAnchor:b,json:f,styles:r})},[o,t,r]),g=n.useMemo(()=>{const f=[];for(let b=0;b<5;b++)for(let k=0;k<5;k++){const C=x.getStyleAt({colIndex:k,rowIndex:b});f.push(C)}return f},[x]),p=n.useMemo(()=>{let f=c;if(c||(f=document.createElement("canvas")),!f)return null;f.width!==61&&(f.width=61),f.height!==46&&(f.height=46);const b=f.getContext("2d",{alpha:!1});if(!b)return null;const k=12,C=s?.darkMode??!1;for(let h=0;h<5;h++)for(let w=0;w<5;w++){const E=g[5*h+w].getFill();let v=s?.fill;E.getType()===L.IFill.Type.Solid?v=E.getColor().toCSS(C,!1):E.getType()===L.IFill.Type.Gradient?v=E.getStops[0]?.color.toCSS(C,!1):E.getType()===L.IFill.Type.Pattern&&(v=E.getForeground().toCSS(C,!1)),b.fillStyle=v;const P=w*k,R=9*h;b.fillRect(P,R,13,10)}b.lineWidth=1;for(let h=0;h<5;h++)for(let w=0;w<5;w++){const E=g[5*h+w],v=w*k,P=9*h,R=E.getBorder();if(!R.isEmpty()){const A=R.getLeft();A.isNone()||(b.strokeStyle=A.getColor().toCSS(C,!1),Ct(b,v,P,v,P+9));const j=R.getTop();j.isNone()||(b.strokeStyle=j.getColor().toCSS(C,!1),Ct(b,v,P,v+k,9*h));const B=R.getRight();B.isNone()||(b.strokeStyle=B.getColor().toCSS(C,!1),Ct(b,v+k,P,v+k,P+9));const I=R.getBottom();I.isNone()||(b.strokeStyle=I.getColor().toCSS(C,!1),Ct(b,v,P+9,v+k,P+9))}b.strokeStyle=E.getFont().getFill().toCSS(C,!1);const M=4,N=2.5;Ct(b,w*k+N,9*h+M,w*k+N+7,9*h+M)}return`url(${f.toDataURL()})`},[c,x,t,s]);return e.jsx("div",{ref:i,className:pe("table-style-preview",l),style:{backgroundImage:p,width:61,height:46,...u},...m})})),zi=n.memo(n.forwardRef((a,i)=>{const{styleOptions:o,onStyleOptionsChange:t,showHeaderRow:r,onShowHeaderRowChange:s,showTotalRow:d,onShowTotalRowChange:u,showFilterButton:l,onShowFilterButtonChange:c,sx:m,disabled:x,...g}=a;return e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flexWrap:"wrap",userSelect:"none",pt:1,pb:1,"& .MuiFormControlLabel-root":{marginLeft:p=>`${p.spacing(2)}`,marginRight:p=>`${p.spacing(2)}`},"& .MuiCheckbox-root":{padding:p=>`${p.spacing(.5)}`},...m},...g,ref:i,children:[s&&e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:r??!1,indeterminate:r==null,onChange:()=>s(!r),disabled:x||r==null}),label:"Header Row",labelPlacement:"end"}),u&&e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:d??!1,indeterminate:d==null,onChange:()=>u(!d),disabled:x||d==null}),label:"Total Row",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showRowStripes??!1,indeterminate:!o,disabled:x||!o,onChange:()=>{t?.({...o,showRowStripes:!o?.showRowStripes})}}),label:"Banded Rows",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showFirstColumn??!1,indeterminate:!o,disabled:x||!o,onChange:()=>{t?.({...o,showFirstColumn:!o?.showFirstColumn})}}),label:"First Column",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showLastColumn??!1,indeterminate:!o,disabled:x||!o,onChange:()=>{t?.({...o,showLastColumn:!o?.showLastColumn})}}),label:"Last Column",labelPlacement:"end"}),e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:o?.showColumnStripes??!1,indeterminate:!o,disabled:x||!o,onChange:()=>{t?.({...o,showColumnStripes:!o?.showColumnStripes})}}),label:"Banded Columns",labelPlacement:"end"}),c&&e.jsx(T.FormControlLabel,{control:e.jsx(T.Checkbox,{checked:l??!1,indeterminate:l==null,disabled:x||!o||l==null,onChange:()=>c(!l)}),label:"Filter Button",labelPlacement:"end"})]})})),Wi=n.memo(a=>{const{table:i,tableStyle:o,selectedTableStyleName:t,onSelectTableStyleName:r,styles:s,hasContextMenu:d=!0,bodyStyle:u,parentFloat:l,commands:c,disabled:m,commandHook:x,useCanvasPreview:g=!0,canvas:p,...f}=a,b=n.useCallback(w=>{const E={variant:S.CommandButtonType.Menuitem,commandHook:x,context:"table"},v=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...E,command:c.getCommand("formatTableStyleClearCellStyles"),commandState:o,disabled:m}),e.jsx(y.CommandButton,{...E,style:{fontWeight:550},command:c.getCommand("formatTableStyle"),commandState:{name:o.getName()},disabled:m}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...E,command:c.getCommand("setDefaultTableStyle"),commandState:o.getName(),disabled:m}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...E,command:c.getCommand("deleteTableStyle"),commandState:o?.getName(),disabled:m||!o||o.isBuiltIn()})]}),P=e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:v})});return y.defaultCreatePopupPanel({...w,children:P})},[c]),k=o?.getName()===t,C=n.useMemo(()=>{const w={table:i,tableStyle:o,styles:s,bodyStyle:u};return g?e.jsx(qr,{canvas:p,...w}):e.jsx(Ur,{...w})},[i,o,s,u]);let h=e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:w=>`solid ${k?w.palette.primary.dark:"transparent"} 1px`},tooltipProps:{label:o.getName()??"None",placement:"bottom-start"},disabled:m,icon:null,onClick:()=>{r?.(o?.getName())},...f,children:C},o.getName());return d&&(h=e.jsx(y.ContextMenu,{label:i.getStyleOptions().name,parentFloat:l,createPopupPanel:b,children:h})),h}),Gr=n.memo(n.forwardRef((a,i)=>{const{commands:o,command:t,commandHook:r,selectedTable:s,onSelectTableStyleName:d,disabled:u=!1,bodyStyle:l,usePreviewIcon:c=!1,...m}=a;S.useCommand(t);const x=t?.context(),g=x?.styles,p=s??x?.table?.();let f="insertTable";p&&(f="editTable");const b=n.useMemo(()=>((N,A)=>{const j={rowStart:0,colStart:0,rowEnd:4,colEnd:4};return new L.Table({initialAnchor:j,styles:A,json:{name:"PreviewTable",ref:j,description:"PreviewTable",headerRowCount:1,totalsRowCount:0,styleOptions:N}})})(p?.getStyleOptions(),g?.()),[g?.().getDefaultTableStyle(),p?.getStyleOptions()]),k=p??b,[C,h]=n.useState(k);n.useEffect(()=>{h(k)},[k]);const w=l??x?.bodyStyle(),E=S.useCallbackRef(N=>{d?.(N),t?.execute({name:N},r)},[t,d,r]),v=n.useRef(null),P=n.useCallback((N,A)=>{const j={onSelectTableStyleName:E,styles:g(),parentFloat:N.floatReference};v.current||(v.current=document.createElement("canvas"));const B=G=>{const _=g().getTableStyle(G);return _?e.jsx(Wi,{table:C,tableStyle:_,selectedTableStyleName:C.getStyleOptions().name,bodyStyle:x.bodyStyle(),commands:A,commandHook:r,canvas:v.current,...j},G):null},I=(G,_,K=!0)=>{const J=[];for(let ee=0;ee<_.length;ee++){const F=B(_[ee]);F&&J.push(F)}return J.length===0?null:e.jsxs(T.Box,{children:[K?e.jsx(y.ExhibitDivider,{orientation:"horizontal"}):null,e.jsx(y.ExhibitMenuHeader,{children:G},G+"-header"),e.jsx(T.Box,{sx:{display:"flex",gap:"2px",marginBottom:"6px",flexWrap:"wrap",width:"481px",maxWidth:"100%"},children:J},G+"-presets")]},G)},H=[],O=g().getCustomTableStyles(),z=[];if(O.length>0){for(let G=0;G<O.length;G++)O[G].isShownInTableStyles()&&z.push(O[G].getName());H.push(I("Custom",z,!1))}const D=[];p&&!p.getStyleOptions().name&&D.push(null);for(let G=0;G<21;G++)D.push("TableStyleLight"+(G+1));H.push(I("Light",D,z.length>0));const W=[];for(let G=0;G<28;G++)W.push("TableStyleMedium"+(G+1));H.push(I("Medium",W));const U=[];for(let G=0;G<11;G++)U.push("TableStyleDark"+(G+1));H.push(I("Dark",U));let q=null;return p&&(q=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{variant:S.CommandButtonType.Menuitem,command:A.getCommand("formatTableStyleClearTableStyle"),commandHook:r,disabled:u})]})),e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",maxWidth:"100%",paddingTop:G=>`${G.shape.borderRadius}px`,paddingBottom:G=>`${G.shape.borderRadius}px`},children:[e.jsx(T.Box,{onContextMenu:()=>{},sx:{display:"flex",flexDirection:"column",padding:"6px 16px"},children:H}),q]})},[g,g?.().getTheme(),w,C]),R=u||!t||t.disabled(),M=n.useMemo(()=>{if(!x||!c)return t?.icon()},[C,w,R,t]);return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:f,createPopupPanel:P,commands:o,label:t?.label(),commandState:p,commandHook:r,selected:p!==null,createTooltip:({children:N},A)=>e.jsx(y.ExhibitTooltip,{label:t?.label(),description:t?.description(),disabled:A,children:N}),disabled:R,icon:M,...m})})),Re=[];Re.push(Fe("Primary Background","bg1")),Re.push(Fe("Primary Text","tx1")),Re.push(Fe("Secondary Background","bg2")),Re.push(Fe("Secondary Text","tx2")),Re.push(Fe("Accent 1","accent1")),Re.push(Fe("Accent 2","accent2")),Re.push(Fe("Accent 3","accent3")),Re.push(Fe("Accent 4","accent4")),Re.push(Fe("Accent 5","accent5")),Re.push(Fe("Accent 6","accent6"));const Xr=a=>{const{docTheme:i,onSelectTheme:o,darkMode:t,isSelected:r,outlined:s,sx:d,...u}=a,l=Y.useTheme(),c=n.useMemo(()=>{let m=[];for(let x=0;x<Re.length;x++){const g=Re[x];m.push(e.jsx(io,{schemeColorLookup:i.schemeLookup(),colorDef:g,darkMode:t,selectedColor:null},x+"-colorDef"))}return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"none"},children:e.jsx(T.Box,{sx:{display:"flex",boxShadow:x=>x.shadows[2]},children:m})})},[i,l]);return e.jsx(y.ExhibitIconButton,{sx:{borderRadius:"2px",padding:"2px",margin:"0px 0px",display:"flex",border:m=>`solid ${r?m.palette.text.primary:"transparent"} 1px`,"&:hover:not([disabled])":{border:m=>`solid ${m.palette.text.primary} 1px !important`}},icon:null,...u,children:e.jsxs(T.Box,{sx:{border:m=>`solid ${m.palette.divider} 1px`,minWidth:"200px",borderRadius:"2px",padding:"4px 4px",textAlign:"left",display:"flex",gap:"4px",flexDirection:"column",alignItems:"stretch",color:m=>r?m.palette.text.primary:void 0,"&:hover:not([disabled])":{color:m=>m.palette.text.primary}},children:[e.jsx(T.Box,{sx:{},children:i.getName()}),e.jsxs(T.Box,{sx:{paddingTop:"6px",paddingLeft:"12px",paddingRight:"12px",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[c,e.jsx(T.Box,{sx:{flex:"1 1 100%",textOverflow:"ellipsis",overflow:"hidden",marginTop:"2px",whiteSpace:"pre",fontFamily:()=>i.getFontScheme().getMajorFont()},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,PopperProps:{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 '${i.getFontScheme().getMajorFont()}'.`}),placement:"bottom-start",children:e.jsx("div",{children:i.getFontScheme().getMinorFont()})})})]})]})})},Yr=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,sx:s,disabled:d=!1,darkMode:u,...l}=a,c=n.useMemo(()=>{const m=o?.getItems({selected:t})??[],x=[];if(m.length===0)return e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"6px",paddingBottom:"6px"},children:"No themes"});const g=m.length;for(let p=0;p<g;p++){const f=m[p],b=t&&f?.getName()===t.getName(),k=m[p+1];k&&k.isCustom()!==f.isCustom()&&x.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal",sx:{marginBottom:"4px"}},`divider-${p}`)),x.push(e.jsx(Xr,{docTheme:f,onSelectTheme:()=>r(f),isSelected:b,disabled:d,darkMode:u,onMouseDown:C=>{C.button===0&&C.preventDefault()},onMouseUp:C=>{C.button===0&&r(f)},onKeyDown:C=>{C.keyCode!==S.KeyCodes.Enter&&C.keyCode!==S.KeyCodes.Space||r(f)}},f.getName()))}return x},[t,r,u]);return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%"},ref:i,...l,children:e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx(y.ExhibitMenuHeader,{sx:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"2px"},children:"Themes"}),e.jsx(y.ExhibitDivider,{}),e.jsx(T.Box,{sx:{flex:"1 1 100%",overflow:"auto",padding:"6px 16px"},children:c})]})})})),Zr=n.memo(n.forwardRef((a,i)=>{const{themes:o,selectedTheme:t,onSelectTheme:r,icon:s,tooltip:d,label:u,variant:l=y.PopupButtonType.Toolbar,darkMode:c,panelProps:m,...x}=a,g=s||e.jsx(S.DynamicIcon,{iconKey:"Theme2"}),p=n.useCallback(b=>{const{closeFloatAll:k}=b;return e.jsx(Yr,{...m,themes:o,selectedTheme:t,onSelectTheme:r,darkMode:c,onKeyDown:C=>{C.which===S.KeyCodes.Enter&&k()}})},[o,t,r,m,c]),f={createPopupPanel:p,tooltip:d||u||"Theme",label:u,icon:g,...x};return l===y.PopupButtonType.Toolbar?e.jsx(y.ExhibitPopupIconButton,{ref:i,...f}):e.jsx(y.ExhibitPopupMenuItem,{ref:i,...f})})),Qr=n.memo(n.forwardRef((a,i)=>{const{command:o,commandHook:t,selectedTheme:r,onSelectTheme:s,disabled:d=!1,darkMode:u,label:l,icon:c,variant:m,...x}=a;S.useCommand(o);const g=o?.context()?.themes,p=r||o?.context()?.theme,f=u??o?.context()?.darkMode,b=d||o?.disabled(),k=S.useCallbackRef(h=>{s?.(h),o?.execute(h,t)},[s,t]),C=n.useCallback((h,w)=>{const{children:E,title:v,...P}=h;let R=h.children;return(b||w)&&(R=e.jsx("div",{children:R})),e.jsx(y.CommandTooltip,{command:o,placement:m===S.CommandButtonType.Toolbar?"bottom-start":"right-start",disabled:b||w,...P,children:R})},[o,b]);return e.jsx(Zr,{ref:i,themes:g,selectedTheme:p,onSelectTheme:k,variant:m===S.CommandButtonType.Menuitem?y.PopupButtonType.Menuitem:y.PopupButtonType.Toolbar,createTooltip:C,disabled:b,darkMode:f,...x})})),Jr=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u=S.useCommands(o,["themeMode"])[0],l=S.useCallbackRef((p,f)=>{const b={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"appearance",disabled:s},k=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...b,command:u}),e.jsx(y.CommandButton,{...b,command:f.getCommand("defaultThemeMode")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...b,command:f.getCommand("enableDarkGrid")}),e.jsx(y.CommandButton,{...b,command:f.getCommand("enableDarkImages")})]});return y.defaultCreatePopupPanel({...p,children:k})},[s,u,t,r]),c=u?.state(),m=T.useMediaQuery("(prefers-color-scheme: dark)"),x=c==="dark"||c===null&&m,g=u?.state()!==null;return e.jsx(y.CommandPopupButton,{ref:i,quickCommand:"themeMode",commands:o,commandHook:t,createPopupPanel:l,label:"Appearance",tooltip:"Change the light/dark mode to match your viewing preference. This does not affect the view for others.",onQuickClick:()=>{u?.execute(x?"light":"dark",t)},selected:g,...d})})),ea=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,sx:d,...u}=a,l=n.useCallback((c,m)=>{const x={variant:S.CommandButtonType.Menuitem,scope:"help",commandHook:{...t,beforeExecute:(p,f)=>t?.beforeExecute?.(p,f)!==!1&&c.floatReference.closeAll()},disabled:s},g=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...x,command:m.getCommand("showKeyboardShortcuts")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...x,command:m.getCommand("gotoUrlGithub")}),e.jsx(y.CommandButton,{...x,command:m.getCommand("gotoUrlDiscord")}),e.jsx(y.CommandButton,{...x,command:m.getCommand("gotoUrlDocumentation")}),e.jsx(y.CommandButton,{...x,command:m.getCommand("gotoUrlIssue")})]});return y.defaultCreatePopupPanel({...c,children:g})},[s,t]);return e.jsx(y.CommandPopupButton,{ref:i,sx:d,commands:o,disabled:s,commandHook:t,scope:r,label:"Help",tooltip:"Help, feedback, and keyboard shortcuts.",createPopupPanel:l,icon:e.jsx(S.DynamicIcon,{iconKey:"Help",style:{transform:"scale(0.75)"}}),...u})})),Uo=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,preferSingleMenu:d=!0,showQuickButton:u=!0,variant:l=S.CommandButtonType.Toolbar,...c}=a,m=S.useCommands(o,["insertImageFromFile","insertImageFromURL"]),{singleMenuCommand:x,allDisabled:g}=n.useMemo(()=>{let f=null,b=0;for(let k=0;k<m.length;k++)m[k]&&!m[k]?.disabled()&&(d&&l===S.CommandButtonType.Menuitem&&(f=b===0?m[k]:null),b++);return{singleMenuCommand:f,allDisabled:b===0}},[m]),p=n.useCallback((f,b)=>{const k={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"insertImage",disabled:s},C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...k,command:b.getCommand("insertImageFromFile")}),e.jsx(y.CommandButton,{...k,command:b.getCommand("insertImageFromURL")})]});return y.defaultCreatePopupPanel({...f,children:C})},[s,t,r]);return x?e.jsx(y.CommandButton,{ref:i,variant:l,commandHook:t,disabled:s,command:x,...c}):e.jsx(y.CommandPopupButton,{ref:i,variant:l,quickCommand:"insertImageFromFile",commands:o,commandHook:t,scope:r,disabled:s||g,tooltip:"Insert a picture from the web to complement your data.",createPopupPanel:p,icon:"InsertImage",...c})})),lo=n.memo(n.forwardRef((a,i)=>{const{command:o,...t}=a,r=S.useEditMode(),[s,d]=n.useState(!1),[u,l]=n.useState("info");return n.useEffect(()=>{const c=r.getMode();d(c?.key==="copy"||c?.key==="cut"),l(c?.key==="cut"?"warn":"accent")},[r]),e.jsx(y.CommandButton,{ref:i,command:o,icon:e.jsx(S.DynamicIcon,{iconKey:"copy.walking",sourceProps:{isWalking:s,themedType:u}}),...t})})),ta=n.memo(n.forwardRef((a,i)=>{const{...o}=a;return e.jsx(y.SimpleCommandPopupButton,{ref:i,...o,popupCommandKeys:["insertFunctionSum","insertFunctionAverage","insertFunctionCount","insertFunctionMax","insertFunctionMin",null,"insertFunction"],quickCommand:"insertFunctionSum",popupScope:"insertFunction",label:"Quick Function",tooltip:"More functions."})}));ta.displayName="InsertFunctionSumCommandPopupButton";const bo=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])),$i=n.memo(a=>{const{command:i,formulaFunction:o,commandHook:t,disabled:r=!1,parentFloat:s,handleInsert:d,icon:u,label:l,sx:c,...m}=a,x=new Promise(g=>{o.getDescriptor().then(p=>{g(p.getSummary())})});return e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"360px",display:"flex","*":{lineHeight:"1.2"},...c},disabled:r,tooltipProps:{label:x,maxWidth:1e3},onMouseDown:g=>{g.button===0&&g.preventDefault()},onMouseUp:g=>{g.button===0&&d(o)},onKeyDown:g=>{g.keyCode===S.KeyCodes.Enter||(g.keyCode,S.KeyCodes.Space)},...m,children:e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:e.jsx(T.Typography,{component:"div",children:o.getName()})})})}),oa=n.memo(n.forwardRef((a,i)=>{const{category:o,commands:t,commandHook:r,scope:s,sx:d,disabled:u=!1,parentFloat:l,...c}=a,m=S.useCommands(t,["insertFunction"])[0],x=n.useCallback((p,f)=>{const b=bo.get(o);if(!b)return console.warn("invalidate category",o),null;const k={commandHook:r,...p},C=e.jsx(Vi,{category:b.label,...k,commands:f});return y.defaultCreatePopupPanel({...p,children:C})},[o,m,r,s]),g=bo.get(o);return e.jsx(y.CommandPopupButton,{ref:i,commands:t,commandHook:r,createPopupPanel:x,label:g.label,tooltip:"Insert Function",icon:bo.get(o)?.icon??"FormulaGroup",...c})}));oa.displayName="InsertFunctionCommandPopupButton";const Vi=n.memo(n.forwardRef((a,i)=>{const{commands:o,category:t,commandHook:r,...s}=a,d=S.useCommands(o,["insertFunction"]),[u,l]=n.useState([]),[c,m]=n.useState(!1);n.useEffect(()=>{(async()=>{m(!0);const k=d[0]?.context(),C=await k.searchByCategory(t);l(C),m(!1)})()},[]);const x=u.length,g=new Array(x),p=o.getCommand("insertFunction"),f=k=>{r?.beforeExecute?.(p,p?.state()),p.execute(k),r?.onExecute?.(p,p?.state())};for(let k=0;k<x;k++){const C=u[k];g[k]=e.jsx($i,{command:p,formulaFunction:C,handleInsert:f},`formula-${C.getName()}-${k}`)}const b=e.jsx(T.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:x>0?e.jsx(e.Fragment,{children:e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:g})}):null});return y.defaultCreatePopupPanel({...s,children:b})})),na=n.createContext(null);na.displayName="HookFormContext";const ra=()=>n.useContext(na);typeof window<"u"?n.useLayoutEffect:n.useEffect;const aa=n.memo(n.forwardRef((a,i)=>{const{disabled:o,style:t,className:r,sx:s,defaultInput:d,value:u,formName:l,formOptions:c,onChangeInput:m,onValidate:x,onKeyDown:g,...p}=a,f=ra(),b=l&&f?f.register(l,c):null,[k,C]=n.useState(""),[h,w]=n.useState(""),[E,v]=n.useState(u);n.useEffect(()=>{v(u),w("")},[u]);const P=S.useCallbackRef(j=>{let B="";try{v(j),x?.(j),m?.(j)}catch(I){B=I.message??"Invalid Name"}l&&f&&(B?f.setError(l,{message:B}):f.clearErrors(l)),w(B)},[u,x,m]),R=S.useCallbackRef(async j=>{j.keyCode===S.KeyCodes.Escape&&k!==u&&(P(k),f?.setValue(l,k),f?.clearErrors(l),j.stopPropagation()),g?.(j)},[g,k,u,f]),M=S.useCallbackRef(j=>{C(j.target.value??"")},[]),N=S.useCallbackRef(j=>{C(""),b?.onBlur(j)},[]),A=n.useCallback(j=>{P(j.target.value),b?.onChange(j)},[b]);return e.jsx(T.FormControl,{sx:{paddingTop:j=>j.spacing(1.5),minWidth:135,width:"100%",...s},size:"small",ref:i,className:pe("named-input",r),...p,children:e.jsx(T.TextField,{label:"Name",placeholder:d,onFocus:M,onBlur:N,inputRef:b?.ref,disabled:o,error:!!h,helperText:h||" ",sx:{"& .MuiFormHelperText-root":{marginTop:j=>j.spacing(.5)}},InputLabelProps:{shrink:!0},InputProps:{inputProps:{className:"autoFocus",name:l,spellCheck:!1,autoComplete:"off",readOnly:o,sx:{paddingTop:j=>j.spacing(1.25),paddingBottom:j=>j.spacing(.75),backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`}}},value:E??"",onChange:A,onKeyDownCapture:R,onContextMenu:j=>{j.stopPropagation()}})})}));aa.displayName="NamedInput";const Wt=a=>a===null?"":a.toString(),ia=n.memo(n.forwardRef((a,i)=>{const{formName:o,formOptions:t,disabled:r,style:s,className:d,sx:u,onKeyDown:l,value:c,onChangeInput:m,resolvedAddress:x,...g}=a,p=ra(),f=o&&p?p.register(o,t):null,[b,k]=n.useState(""),[C,h]=n.useState(!1),[w,E]=n.useState(()=>Wt(c));n.useEffect(()=>{E(Wt(c)),k(""),o&&p&&p.clearErrors(o),h(!1)},[c]);const v=S.useCallbackRef(B=>{let I="";try{E(B);const H=Wt(c),O=x(B);O.toString()!==H&&m?.(O)}catch{I="Invalid Range"}o&&p&&(I?p.setError(o,{message:I}):p.clearErrors(o)),k(I),h(!0)},[w,m,o,p]),P=S.useCallbackRef(async B=>{if(C&&B.keyCode===S.KeyCodes.Escape){const I=Wt(c);E(I),k(""),h(!1),B.stopPropagation()}l?.(B)},[c,m,l,C]),R=S.useCallbackRef(B=>{f?.onBlur(B)},[f]),M=n.useCallback(B=>{v(B.target.value),f?.onChange(B)},[f]),[N,A]=n.useState(!1),j=n.useMemo(()=>e.jsx(T.InputAdornment,{tabIndex:-1,sx:{display:"flex",position:"relative",flex:"0"},position:"end",children:e.jsx(y.ExhibitOptionButton,{disabled:!0,selected:N,onSelectToggle:B=>{A(B)},label:"Select Range",icon:e.jsx(S.DynamicIcon,{iconKey:"SelectRangeMode"})})}),[N]);return e.jsx(T.FormControl,{sx:{paddingTop:B=>B.spacing(1.5),minWidth:135,width:"100%",...u},size:"small",ref:i,className:pe("range-input",d),...g,children:e.jsx(T.TextField,{label:"Range",placeholder:"Enter Range",onBlur:R,disabled:r,error:!!b,inputRef:f?.ref,helperText:b||" ",sx:{"& .MuiFormHelperText-root":{marginTop:B=>B.spacing(.5)}},InputLabelProps:{shrink:!0},InputProps:{inputProps:{spellCheck:!1,autoComplete:"off",readOnly:r,name:o,sx:{paddingTop:B=>B.spacing(1.25),paddingBottom:B=>B.spacing(.75)}},sx:{backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`},endAdornment:j},value:w??"",onChange:M,onKeyDownCapture:P,onContextMenu:B=>{B.stopPropagation()}})})}));ia.displayName="RangeInput";const qo=n.memo(n.forwardRef((a,i)=>{const{sheet:o,className:t,debounceDelay:r=220,sx:s,...d}=a,[u,l]=n.useState(()=>o.getView().getZoomScale()),[c,m]=n.useState(null),x=n.useRef(0);ae.useModelListener(o,{onViewChange:()=>{m(!0),x.current===0&&l(o.getView().getZoomScale())}}),n.useEffect(()=>{x.current=0,m(!1),l(o.getView().getZoomScale())},[o]),n.useEffect(()=>{x.current!==0&&L.CommonUtils.debounce(()=>{u===x.current&&(x.current=0,o.getView().update({zoomScale:u}))},r)()},[u,r]);const g=S.useCallbackRef(R=>{let M=R;R<100?M=Math.round(R/(10/9)+10):R>100&&(M=Math.round(3*R-200)),x.current=M,m(!0),l(M)},[o]),p=R=>{let M=R;return R<100?M=10/9*(R-10):R>100&&(M=(R+200)/3),M},f=p(u),[b,k]=n.useState(null),C=n.useRef(null),h=n.useCallback(()=>{const R=b;R&&requestAnimationFrame(()=>{C.current?.contains(document.activeElement)&&R.focus()})},[]),w=S.useMouseDownAndHoldListener(()=>{g(p(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10)))}),E=S.useMouseDownAndHoldListener(()=>g(p(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10)))),v=Y.useTheme(),P=n.useMemo(()=>`${L.IFont.getSharedMeasurer()("100%",Math.round(v.typography.fontSize),v.typography.fontFamily).width}px`,[v]);return e.jsxs(T.Box,{ref:i,className:pe(t),sx:{padding:"0px 0px",display:"flex",alignItems:"center",color:R=>R.palette.text.secondary,...s},onFocus:R=>{R.relatedTarget&&!b&&k(R.relatedTarget)},onBlur:R=>{b&&!C?.current?.contains(R.relatedTarget)&&k(null)},onMouseDown:R=>{R.button===0&&R.preventDefault()},onMouseUp:R=>{R.button===0&&h()},...d,children:[e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom Out",children:e.jsx(T.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:R=>R.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:R=>{R.button!==0?R.preventDefault():w(R)},children:e.jsx(S.DynamicIcon,{iconKey:"Remove"})})}),e.jsx(T.Slider,{ref:C,sx:{flex:"1 1 100%",padding:"6px 0px !important",marginRight:"2px",marginLeft:"2px","& .MuiSlider-thumb":{height:14,width:6,borderRadius:.75,"&.Mui-focusVisible":{boxShadow:R=>`0px 0px 0px 3px ${y.hexToRGB(R.palette.primary.main,.16)}`},"&:focus, &:hover, &.Mui-active":{boxShadow:R=>`0px 0px 0px 2px ${y.hexToRGB(R.palette.primary.main,.16)}`}},"& .MuiSlider-mark":{width:"1px",height:"8px"},"& .MuiSlider-markActive":{backgroundColor:"currentColor"},"& .MuiSlider-thumb:not(.MuiSlider-active)":{transition:c?"left 260ms ease-in":"none"}},valueLabelDisplay:"auto",size:"small",track:!1,min:0,step:1,value:f,max:200,marks:[{value:100}],onAnimationEnd:()=>m(!1),onWheel:R=>{g(p(L.CommonUtils.findNextStep(o.getView().getZoomScale(),R.deltaY<0,10)))},onKeyDown:R=>{R.which===S.KeyCodes.Down||R.which===S.KeyCodes.Right?(g(p(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!0,10))),R.preventDefault()):R.which===S.KeyCodes.Up||R.which===S.KeyCodes.Left?(g(p(L.CommonUtils.findNextStep(o.getView().getZoomScale(),!1,10))),R.preventDefault()):R.which!==S.KeyCodes.Enter&&R.which!==S.KeyCodes.Escape||h()},onChange:(R,M)=>{Math.abs(M-100)<3?g(100):g(M)},valueLabelFormat:(R,M)=>`Zoom: ${Math.round(u)}%`}),e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"Zoom In",children:e.jsx(T.IconButton,{sx:{padding:"0","&:hover:not([disabled])":{color:R=>R.palette.primary.main},"& svg":{width:"12px",height:"12px"}},size:"small",onPointerDown:R=>{R.button!==0?R.preventDefault():E(R)},children:e.jsx(S.DynamicIcon,{iconKey:"Add"})})}),e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(T.Box,{sx:{minWidth:"8px"}}),e.jsx(T.Typography,{noWrap:!0,component:"div",onClick:()=>{g(100)},sx:{cursor:"pointer",display:"flex",flex:"1 1 100%",fontSize:"0.70rem",marginLeft:"2px",marginRight:"2px",userSelect:"none",justifyContent:"center",width:P},children:e.jsx("div",{children:Math.round(u)+"%"})})]})]})}));qo.displayName="SheetZoomScale";const Go=n.memo(n.forwardRef((a,i)=>{const{sx:o,sheet:t,gridStyle:r,children:s,childrenEnd:d,...u}=a;n.useImperativeHandle(i,()=>({}));const l=n.useRef(null);n.useEffect(()=>{const p=f=>f.preventDefault();return l.current?.addEventListener("wheel",p,{passive:!1}),()=>{l.current?.removeEventListener("wheel",p)}},[]);const c=S.useEditMode(),m=n.useMemo(()=>{const p=c.getMode();return p?.description?p.description:"Ready"},[c]),[x,g]=n.useState(!1);return e.jsxs(T.Box,{ref:l,sx:{display:"flex",alignItems:"stretch",flexDirection:"row",flex:"0",paddingLeft:"12px",paddingRight:"12px",gap:"8px",paddingTop:"1px",minHeight:"calc(1em + 8px)",overflow:x?"visible":"hidden",boxShadow:`0px -1px 0px ${r.header.edgeStrokeFill}`,...o},onMouseOver:()=>g(!0),onMouseLeave:()=>g(!1),...u,children:[s,e.jsx("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"end",overflow:"hidden"},children:e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",color:p=>p.palette.text.secondary},variant:"caption",children:m})}),d?e.jsx(T.Box,{sx:{display:"flex",alignItems:"center"},children:d}):null,e.jsx(y.ExhibitDivider,{style:{marginTop:"6px",marginBottom:"6px"}}),e.jsx(qo,{sx:{paddingLeft:"4px",minWidth:"175px"},sheet:t})]})}));Go.displayName="StatusBar";var ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Pn,Rn,yo,Mn,Dn,$t={exports:{}},St={},kt={exports:{}},Fn={},In={exports:{}};function Ki(){return Rn?Pn:(Rn=1,Pn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}function _i(){if(Mn)return yo;Mn=1;var a=Ki();function i(){}function o(){}return o.resetWarningCache=i,yo=function(){function t(d,u,l,c,m,x){if(x!==a){var g=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 g.name="Invariant Violation",g}}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:i};return s.PropTypes=s,s},yo}function It(){return Dn||(Dn=1,In.exports=_i()()),In.exports}var Nn,Vt={exports:{}},On,Ce={},ze={};function so(){return On||(On=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.dontSetMe=function(a,i,o){if(a[i])return new Error(`Invalid prop ${i} passed to ${o} - do not set this, set it on the child.`)},ze.findInArray=function(a,i){for(let o=0,t=a.length;o<t;o++)if(i.apply(i,[a[o],o,a]))return a[o]},ze.int=function(a){return parseInt(a,10)},ze.isFunction=function(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Function]"},ze.isNum=function(a){return typeof a=="number"&&!isNaN(a)}),ze}var An,Ln,We={};function Xo(){if(Ln)return Ce;Ln=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.addClassName=d,Ce.addEvent=function(l,c,m,x){if(!l)return;const g={capture:!0,...x};l.addEventListener?l.addEventListener(c,m,g):l.attachEvent?l.attachEvent("on"+c,m):l["on"+c]=m},Ce.addUserSelectStyles=function(l){if(!l)return;let c=l.getElementById("react-draggable-style-el");c||(c=l.createElement("style"),c.type="text/css",c.id="react-draggable-style-el",c.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
8
|
-
`,c.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
9
|
-
`,l.getElementsByTagName("head")[0].appendChild(c)),l.body&&d(l.body,"react-draggable-transparent-selection")},Ce.createCSSTransform=function(l,c){const m=r(l,c,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:m}},Ce.createSVGTransform=function(l,c){return r(l,c,"")},Ce.getTouch=function(l,c){return l.targetTouches&&(0,a.findInArray)(l.targetTouches,m=>c===m.identifier)||l.changedTouches&&(0,a.findInArray)(l.changedTouches,m=>c===m.identifier)},Ce.getTouchIdentifier=function(l){if(l.targetTouches&&l.targetTouches[0])return l.targetTouches[0].identifier;if(l.changedTouches&&l.changedTouches[0])return l.changedTouches[0].identifier},Ce.getTranslation=r,Ce.innerHeight=function(l){let c=l.clientHeight;const m=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(m.paddingTop),c-=(0,a.int)(m.paddingBottom),c},Ce.innerWidth=function(l){let c=l.clientWidth;const m=l.ownerDocument.defaultView.getComputedStyle(l);return c-=(0,a.int)(m.paddingLeft),c-=(0,a.int)(m.paddingRight),c},Ce.matchesSelector=t,Ce.matchesSelectorAndParentsTo=function(l,c,m){let x=l;do{if(t(x,c))return!0;if(x===m)return!1;x=x.parentNode}while(x);return!1},Ce.offsetXYFromParent=function(l,c,m){const x=c===c.ownerDocument.body?{left:0,top:0}:c.getBoundingClientRect(),g=(l.clientX+c.scrollLeft-x.left)/m,p=(l.clientY+c.scrollTop-x.top)/m;return{x:g,y:p}},Ce.outerHeight=function(l){let c=l.clientHeight;const m=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(m.borderTopWidth),c+=(0,a.int)(m.borderBottomWidth),c},Ce.outerWidth=function(l){let c=l.clientWidth;const m=l.ownerDocument.defaultView.getComputedStyle(l);return c+=(0,a.int)(m.borderLeftWidth),c+=(0,a.int)(m.borderRightWidth),c},Ce.removeClassName=u,Ce.removeEvent=function(l,c,m,x){if(!l)return;const g={capture:!0,...x};l.removeEventListener?l.removeEventListener(c,m,g):l.detachEvent?l.detachEvent("on"+c,m):l["on"+c]=null},Ce.scheduleRemoveUserSelectStyles=function(l){window.requestAnimationFrame?window.requestAnimationFrame(()=>{s(l)}):s(l)};var a=so(),i=(function(l,c){if(typeof WeakMap=="function")var m=new WeakMap,x=new WeakMap;return(function(g,p){if(!p&&g&&g.__esModule)return g;var f,b,k={__proto__:null,default:g};if(g===null||typeof g!="object"&&typeof g!="function")return k;if(f=p?x:m){if(f.has(g))return f.get(g);f.set(g,k)}for(const C in g)C!=="default"&&{}.hasOwnProperty.call(g,C)&&((b=(f=Object.defineProperty)&&Object.getOwnPropertyDescriptor(g,C))&&(b.get||b.set)?f(k,C,b):k[C]=g[C]);return k})(l,c)})((function(){if(An)return We;An=1,Object.defineProperty(We,"__esModule",{value:!0}),We.browserPrefixToKey=m,We.browserPrefixToStyle=function(x,g){return g?`-${g.toLowerCase()}-${x}`:x},We.default=void 0,We.getPrefix=c;const l=["Moz","Webkit","O","ms"];function c(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const g=window.document?.documentElement?.style;if(!g||x in g)return"";for(let p=0;p<l.length;p++)if(m(x,l[p])in g)return l[p];return""}function m(x,g){return g?`${g}${(function(p){let f="",b=!0;for(let k=0;k<p.length;k++)b?(f+=p[k].toUpperCase(),b=!1):p[k]==="-"?b=!0:f+=p[k];return f})(x)}`:x}return We.default=c(),We})());let o="";function t(l,c){return o||(o=(0,a.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(m){return(0,a.isFunction)(l[m])})),!!(0,a.isFunction)(l[o])&&l[o](c)}function r(l,c,m){let{x,y:g}=l,p=`translate(${x}${m},${g}${m})`;return c&&(p=`translate(${`${typeof c.x=="string"?c.x:c.x+m}`}, ${`${typeof c.y=="string"?c.y:c.y+m}`})`+p),p}function s(l){if(l)try{if(l.body&&u(l.body,"react-draggable-transparent-selection"),l.selection)l.selection.empty();else{const c=(l.defaultView||window).getSelection();c&&c.type!=="Caret"&&c.removeAllRanges()}}catch{}}function d(l,c){l.classList?l.classList.add(c):l.className.match(new RegExp(`(?:^|\\s)${c}(?!\\S)`))||(l.className+=` ${c}`)}function u(l,c){l.classList?l.classList.remove(c):l.className=l.className.replace(new RegExp(`(?:^|\\s)${c}(?!\\S)`,"g"),"")}return Ce}var Hn,Ne={};function la(){if(Hn)return Ne;Hn=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.canDragX=function(t){return t.props.axis==="both"||t.props.axis==="x"},Ne.canDragY=function(t){return t.props.axis==="both"||t.props.axis==="y"},Ne.createCoreData=function(t,r,s){const d=!(0,a.isNum)(t.lastX),u=o(t);return d?{node:u,deltaX:0,deltaY:0,lastX:r,lastY:s,x:r,y:s}:{node:u,deltaX:r-t.lastX,deltaY:s-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:s}},Ne.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}},Ne.getBoundPosition=function(t,r,s){if(!t.props.bounds)return[r,s];let{bounds:d}=t.props;d=typeof d=="string"?d:(function(l){return{left:l.left,top:l.top,right:l.right,bottom:l.bottom}})(d);const u=o(t);if(typeof d=="string"){const{ownerDocument:l}=u,c=l.defaultView;let m;if(d==="parent"?m=u.parentNode:m=u.getRootNode().querySelector(d),!(m instanceof c.HTMLElement))throw new Error('Bounds selector "'+d+'" could not find an element.');const x=m,g=c.getComputedStyle(u),p=c.getComputedStyle(x);d={left:-u.offsetLeft+(0,a.int)(p.paddingLeft)+(0,a.int)(g.marginLeft),top:-u.offsetTop+(0,a.int)(p.paddingTop)+(0,a.int)(g.marginTop),right:(0,i.innerWidth)(x)-(0,i.outerWidth)(u)-u.offsetLeft+(0,a.int)(p.paddingRight)-(0,a.int)(g.marginRight),bottom:(0,i.innerHeight)(x)-(0,i.outerHeight)(u)-u.offsetTop+(0,a.int)(p.paddingBottom)-(0,a.int)(g.marginBottom)}}return(0,a.isNum)(d.right)&&(r=Math.min(r,d.right)),(0,a.isNum)(d.bottom)&&(s=Math.min(s,d.bottom)),(0,a.isNum)(d.left)&&(r=Math.max(r,d.left)),(0,a.isNum)(d.top)&&(s=Math.max(s,d.top)),[r,s]},Ne.getControlPosition=function(t,r,s){const d=typeof r=="number"?(0,i.getTouch)(t,r):null;if(typeof r=="number"&&!d)return null;const u=o(s),l=s.props.offsetParent||u.offsetParent||u.ownerDocument.body;return(0,i.offsetXYFromParent)(d||t,l,s.props.scale)},Ne.snapToGrid=function(t,r,s){const d=Math.round(r/t[0])*t[0],u=Math.round(s/t[1])*t[1];return[d,u]};var a=so(),i=Xo();function o(t){const r=t.findDOMNode();if(!r)throw new Error("<DraggableCore>: Unmounted during event!");return r}return Ne}var zn,Wn,$n,Vn,wt={},Kt={};function sa(){return zn||(zn=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.default=function(){}),Kt}function Ui(){if(Wn)return wt;Wn=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.default=void 0;var a=(function(p,f){if(typeof WeakMap=="function")var b=new WeakMap,k=new WeakMap;return(function(C,h){if(!h&&C&&C.__esModule)return C;var w,E,v={__proto__:null,default:C};if(C===null||typeof C!="object"&&typeof C!="function")return v;if(w=h?k:b){if(w.has(C))return w.get(C);w.set(C,v)}for(const P in C)P!=="default"&&{}.hasOwnProperty.call(C,P)&&((E=(w=Object.defineProperty)&&Object.getOwnPropertyDescriptor(C,P))&&(E.get||E.set)?w(v,P,E):v[P]=C[P]);return v})(p,f)})(n),i=u(It()),o=u(Je),t=Xo(),r=la(),s=so(),d=u(sa());function u(p){return p&&p.__esModule?p:{default:p}}function l(p,f,b){return(f=(function(k){var C=(function(h,w){if(typeof h!="object"||!h)return h;var E=h[Symbol.toPrimitive];if(E!==void 0){var v=E.call(h,w);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(h)})(k,"string");return typeof C=="symbol"?C:C+""})(f))in p?Object.defineProperty(p,f,{value:b,enumerable:!0,configurable:!0,writable:!0}):p[f]=b,p}const c={start:"touchstart",move:"touchmove",stop:"touchend"},m={start:"mousedown",move:"mousemove",stop:"mouseup"};let x=m,g=class extends a.Component{constructor(){super(...arguments),l(this,"dragging",!1),l(this,"lastX",NaN),l(this,"lastY",NaN),l(this,"touchIdentifier",null),l(this,"mounted",!1),l(this,"handleDragStart",p=>{if(this.props.onMouseDown(p),!this.props.allowAnyClick&&typeof p.button=="number"&&p.button!==0)return!1;const f=this.findDOMNode();if(!f||!f.ownerDocument||!f.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:b}=f;if(this.props.disabled||!(p.target instanceof b.defaultView.Node)||this.props.handle&&!(0,t.matchesSelectorAndParentsTo)(p.target,this.props.handle,f)||this.props.cancel&&(0,t.matchesSelectorAndParentsTo)(p.target,this.props.cancel,f))return;p.type!=="touchstart"||this.props.allowMobileScroll||p.preventDefault();const k=(0,t.getTouchIdentifier)(p);this.touchIdentifier=k;const C=(0,r.getControlPosition)(p,k,this);if(C==null)return;const{x:h,y:w}=C,E=(0,r.createCoreData)(this,h,w);(0,d.default)("DraggableCore: handleDragStart: %j",E),(0,d.default)("calling",this.props.onStart),this.props.onStart(p,E)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&(0,t.addUserSelectStyles)(b),this.dragging=!0,this.lastX=h,this.lastY=w,(0,t.addEvent)(b,x.move,this.handleDrag),(0,t.addEvent)(b,x.stop,this.handleDragStop))}),l(this,"handleDrag",p=>{const f=(0,r.getControlPosition)(p,this.touchIdentifier,this);if(f==null)return;let{x:b,y:k}=f;if(Array.isArray(this.props.grid)){let h=b-this.lastX,w=k-this.lastY;if([h,w]=(0,r.snapToGrid)(this.props.grid,h,w),!h&&!w)return;b=this.lastX+h,k=this.lastY+w}const C=(0,r.createCoreData)(this,b,k);if((0,d.default)("DraggableCore: handleDrag: %j",C),this.props.onDrag(p,C)!==!1&&this.mounted!==!1)this.lastX=b,this.lastY=k;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const w=document.createEvent("MouseEvents");w.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(w)}}),l(this,"handleDragStop",p=>{if(!this.dragging)return;const f=(0,r.getControlPosition)(p,this.touchIdentifier,this);if(f==null)return;let{x:b,y:k}=f;if(Array.isArray(this.props.grid)){let w=b-this.lastX||0,E=k-this.lastY||0;[w,E]=(0,r.snapToGrid)(this.props.grid,w,E),b=this.lastX+w,k=this.lastY+E}const C=(0,r.createCoreData)(this,b,k);if(this.props.onStop(p,C)===!1||this.mounted===!1)return!1;const h=this.findDOMNode();h&&this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(h.ownerDocument),(0,d.default)("DraggableCore: handleDragStop: %j",C),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,h&&((0,d.default)("DraggableCore: Removing handlers"),(0,t.removeEvent)(h.ownerDocument,x.move,this.handleDrag),(0,t.removeEvent)(h.ownerDocument,x.stop,this.handleDragStop))}),l(this,"onMouseDown",p=>(x=m,this.handleDragStart(p))),l(this,"onMouseUp",p=>(x=m,this.handleDragStop(p))),l(this,"onTouchStart",p=>(x=c,this.handleDragStart(p))),l(this,"onTouchEnd",p=>(x=c,this.handleDragStop(p)))}componentDidMount(){this.mounted=!0;const p=this.findDOMNode();p&&(0,t.addEvent)(p,c.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const p=this.findDOMNode();if(p){const{ownerDocument:f}=p;(0,t.removeEvent)(f,m.move,this.handleDrag),(0,t.removeEvent)(f,c.move,this.handleDrag),(0,t.removeEvent)(f,m.stop,this.handleDragStop),(0,t.removeEvent)(f,c.stop,this.handleDragStop),(0,t.removeEvent)(p,c.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,t.scheduleRemoveUserSelectStyles)(f)}}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=g,l(g,"displayName","DraggableCore"),l(g,"propTypes",{allowAnyClick:i.default.bool,allowMobileScroll:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(p,f){if(p[f]&&p[f].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),l(g,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),wt}function qi(){return $n||($n=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),a.default=void 0;var i=(function(f,b){if(typeof WeakMap=="function")var k=new WeakMap,C=new WeakMap;return(function(h,w){if(!w&&h&&h.__esModule)return h;var E,v,P={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return P;if(E=w?C:k){if(E.has(h))return E.get(h);E.set(h,P)}for(const R in h)R!=="default"&&{}.hasOwnProperty.call(h,R)&&((v=(E=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,R))&&(v.get||v.set)?E(P,R,v):P[R]=h[R]);return P})(f,b)})(n),o=m(It()),t=m(Je),r=(function(){if(Nn)return Vt.exports;function f(k){var C,h,w="";if(typeof k=="string"||typeof k=="number")w+=k;else if(typeof k=="object")if(Array.isArray(k)){var E=k.length;for(C=0;C<E;C++)k[C]&&(h=f(k[C]))&&(w&&(w+=" "),w+=h)}else for(h in k)k[h]&&(w&&(w+=" "),w+=h);return w}function b(){for(var k,C,h=0,w="",E=arguments.length;h<E;h++)(k=arguments[h])&&(C=f(k))&&(w&&(w+=" "),w+=C);return w}return Nn=1,Vt.exports=b,Vt.exports.clsx=b,Vt.exports})(),s=Xo(),d=la(),u=so(),l=m(Ui()),c=m(sa());function m(f){return f&&f.__esModule?f:{default:f}}function x(){return x=Object.assign?Object.assign.bind():function(f){for(var b=1;b<arguments.length;b++){var k=arguments[b];for(var C in k)({}).hasOwnProperty.call(k,C)&&(f[C]=k[C])}return f},x.apply(null,arguments)}function g(f,b,k){return(b=(function(C){var h=(function(w,E){if(typeof w!="object"||!w)return w;var v=w[Symbol.toPrimitive];if(v!==void 0){var P=v.call(w,E);if(typeof P!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(w)})(C,"string");return typeof h=="symbol"?h:h+""})(b))in f?Object.defineProperty(f,b,{value:k,enumerable:!0,configurable:!0,writable:!0}):f[b]=k,f}class p extends i.Component{static getDerivedStateFromProps(b,k){let{position:C}=b,{prevPropsPosition:h}=k;return!C||h&&C.x===h.x&&C.y===h.y?null:((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:C,prevPropsPosition:h}),{x:C.x,y:C.y,prevPropsPosition:{...C}})}constructor(b){super(b),g(this,"onDragStart",(k,C)=>{if((0,c.default)("Draggable: onDragStart: %j",C),this.props.onStart(k,(0,d.createDraggableData)(this,C))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(k,C)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",C);const h=(0,d.createDraggableData)(this,C),w={x:h.x,y:h.y,slackX:0,slackY:0};if(this.props.bounds){const{x:E,y:v}=w;w.x+=this.state.slackX,w.y+=this.state.slackY;const[P,R]=(0,d.getBoundPosition)(this,w.x,w.y);w.x=P,w.y=R,w.slackX=this.state.slackX+(E-w.x),w.slackY=this.state.slackY+(v-w.y),h.x=w.x,h.y=w.y,h.deltaX=w.x-this.state.x,h.deltaY=w.y-this.state.y}if(this.props.onDrag(k,h)===!1)return!1;this.setState(w)}),g(this,"onDragStop",(k,C)=>{if(!this.state.dragging||this.props.onStop(k,(0,d.createDraggableData)(this,C))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",C);const h={dragging:!1,slackX:0,slackY:0};if(this.props.position){const{x:w,y:E}=this.props.position;h.x=w,h.y=E}this.setState(h)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},!b.position||b.onDrag||b.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:b,bounds:k,children:C,defaultPosition:h,defaultClassName:w,defaultClassNameDragging:E,defaultClassNameDragged:v,position:P,positionOffset:R,scale:M,...N}=this.props;let A={},j=null;const B=!P||this.state.dragging,I=P||h,H={x:(0,d.canDragX)(this)&&B?this.state.x:I.x,y:(0,d.canDragY)(this)&&B?this.state.y:I.y};this.state.isElementSVG?j=(0,s.createSVGTransform)(H,R):A=(0,s.createCSSTransform)(H,R);const O=(0,r.clsx)(C.props.className||"",w,{[E]:this.state.dragging,[v]:this.state.dragged});return i.createElement(l.default,x({},N,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),i.cloneElement(i.Children.only(C),{className:O,style:{...C.props.style,...A},transform:j}))}}a.default=p,g(p,"displayName","Draggable"),g(p,"propTypes",{...l.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:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),g(p,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Fn)),Fn}function ca(){if(Vn)return kt.exports;Vn=1;const{default:a,DraggableCore:i}=qi();return kt.exports=a,kt.exports.default=a,kt.exports.DraggableCore=i,kt.exports}var Kn,_t={};function Gi(){if(Kn)return _t;Kn=1,_t.__esModule=!0,_t.cloneElement=function(s,d){return d.style&&s.props.style&&(d.style=t(t({},s.props.style),d.style)),d.className&&s.props.className&&(d.className=s.props.className+" "+d.className),i.default.cloneElement(s,d)};var a,i=(a=n)&&a.__esModule?a:{default:a};function o(s,d){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);d&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),u.push.apply(u,l)}return u}function t(s){for(var d=1;d<arguments.length;d++){var u=arguments[d]!=null?arguments[d]:{};d%2?o(Object(u),!0).forEach(function(l){r(s,l,u[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):o(Object(u)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(u,l))})}return s}function r(s,d,u){return(d=(function(l){var c=(function(m,x){if(typeof m!="object"||m===null)return m;var g=m[Symbol.toPrimitive];if(g!==void 0){var p=g.call(m,x);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(m)})(l,"string");return typeof c=="symbol"?c:String(c)})(d))in s?Object.defineProperty(s,d,{value:u,enumerable:!0,configurable:!0,writable:!0}):s[d]=u,s}return _t}var _n,Un,vt={};function da(){if(_n)return vt;_n=1,vt.__esModule=!0,vt.resizableProps=void 0;var a,i=(a=It())&&a.__esModule?a:{default:a};ca();var o={axis:i.default.oneOf(["both","x","y","none"]),className:i.default.string,children:i.default.element.isRequired,draggableOpts:i.default.shape({allowAnyClick:i.default.bool,cancel:i.default.string,children:i.default.node,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:i.default.node,grid:i.default.arrayOf(i.default.number),handle:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var d,u=r[0];return u.axis==="both"||u.axis==="y"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)},handle:i.default.oneOfType([i.default.node,i.default.func]),handleSize:i.default.arrayOf(i.default.number),lockAspectRatio:i.default.bool,maxConstraints:i.default.arrayOf(i.default.number),minConstraints:i.default.arrayOf(i.default.number),onResizeStop:i.default.func,onResizeStart:i.default.func,onResize:i.default.func,resizeHandles:i.default.arrayOf(i.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:i.default.number,width:function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var d,u=r[0];return u.axis==="both"||u.axis==="x"?(d=i.default.number).isRequired.apply(d,r):i.default.number.apply(i.default,r)}};return vt.resizableProps=o,vt}function ua(){if(Un)return St;Un=1,St.__esModule=!0,St.default=void 0;var a=(function(g,p){if(g&&g.__esModule)return g;if(g===null||typeof g!="object"&&typeof g!="function")return{default:g};var f=s(p);if(f&&f.has(g))return f.get(g);var b={},k=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in g)if(C!=="default"&&Object.prototype.hasOwnProperty.call(g,C)){var h=k?Object.getOwnPropertyDescriptor(g,C):null;h&&(h.get||h.set)?Object.defineProperty(b,C,h):b[C]=g[C]}return b.default=g,f&&f.set(g,b),b})(n),i=ca(),o=Gi(),t=da(),r=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(g){if(typeof WeakMap!="function")return null;var p=new WeakMap,f=new WeakMap;return(s=function(b){return b?f:p})(g)}function d(){return d=Object.assign?Object.assign.bind():function(g){for(var p=1;p<arguments.length;p++){var f=arguments[p];for(var b in f)Object.prototype.hasOwnProperty.call(f,b)&&(g[b]=f[b])}return g},d.apply(this,arguments)}function u(g,p){var f=Object.keys(g);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(g);p&&(b=b.filter(function(k){return Object.getOwnPropertyDescriptor(g,k).enumerable})),f.push.apply(f,b)}return f}function l(g){for(var p=1;p<arguments.length;p++){var f=arguments[p]!=null?arguments[p]:{};p%2?u(Object(f),!0).forEach(function(b){c(g,b,f[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(f)):u(Object(f)).forEach(function(b){Object.defineProperty(g,b,Object.getOwnPropertyDescriptor(f,b))})}return g}function c(g,p,f){return(p=(function(b){var k=(function(C,h){if(typeof C!="object"||C===null)return C;var w=C[Symbol.toPrimitive];if(w!==void 0){var E=w.call(C,h);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(C)})(b,"string");return typeof k=="symbol"?k:String(k)})(p))in g?Object.defineProperty(g,p,{value:f,enumerable:!0,configurable:!0,writable:!0}):g[p]=f,g}function m(g,p){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,b){return f.__proto__=b,f},m(g,p)}var x=(function(g){var p,f;function b(){for(var C,h=arguments.length,w=new Array(h),E=0;E<h;E++)w[E]=arguments[E];return(C=g.call.apply(g,[this].concat(w))||this).handleRefs={},C.lastHandleRect=null,C.slack=null,C}f=g,(p=b).prototype=Object.create(f.prototype),p.prototype.constructor=p,m(p,f);var k=b.prototype;return k.componentWillUnmount=function(){this.resetData()},k.resetData=function(){this.lastHandleRect=this.slack=null},k.runConstraints=function(C,h){var w=this.props,E=w.minConstraints,v=w.maxConstraints,P=w.lockAspectRatio;if(!E&&!v&&!P)return[C,h];if(P){var R=this.props.width/this.props.height,M=C-this.props.width,N=h-this.props.height;Math.abs(M)>Math.abs(N*R)?h=C/R:C=h*R}var A=C,j=h,B=this.slack||[0,0],I=B[0],H=B[1];return C+=I,h+=H,E&&(C=Math.max(E[0],C),h=Math.max(E[1],h)),v&&(C=Math.min(v[0],C),h=Math.min(v[1],h)),this.slack=[I+(A-C),H+(j-h)],[C,h]},k.resizeHandler=function(C,h){var w=this;return function(E,v){var P=v.node,R=v.deltaX,M=v.deltaY;C==="onResizeStart"&&w.resetData();var N=(w.props.axis==="both"||w.props.axis==="x")&&h!=="n"&&h!=="s",A=(w.props.axis==="both"||w.props.axis==="y")&&h!=="e"&&h!=="w";if(N||A){var j=h[0],B=h[h.length-1],I=P.getBoundingClientRect();w.lastHandleRect!=null&&(B==="w"&&(R+=I.left-w.lastHandleRect.left),j==="n"&&(M+=I.top-w.lastHandleRect.top)),w.lastHandleRect=I,B==="w"&&(R=-R),j==="n"&&(M=-M);var H=w.props.width+(N?R/w.props.transformScale:0),O=w.props.height+(A?M/w.props.transformScale:0),z=w.runConstraints(H,O);H=z[0],O=z[1];var D=H!==w.props.width||O!==w.props.height,W=typeof w.props[C]=="function"?w.props[C]:null;W&&!(C==="onResize"&&!D)&&(E.persist==null||E.persist(),W(E,{node:P,size:{width:H,height:O},handle:h})),C==="onResizeStop"&&w.resetData()}}},k.renderResizeHandle=function(C,h){var w=this.props.handle;if(!w)return a.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+C,ref:h});if(typeof w=="function")return w(C,h);var E=l({ref:h},typeof w.type=="string"?{}:{handleAxis:C});return a.cloneElement(w,E)},k.render=function(){var C=this,h=this.props,w=h.children,E=h.className,v=h.draggableOpts;h.width,h.height,h.handle,h.handleSize,h.lockAspectRatio,h.axis,h.minConstraints,h.maxConstraints,h.onResize,h.onResizeStop,h.onResizeStart;var P=h.resizeHandles;h.transformScale;var R=(function(M,N){if(M==null)return{};var A,j,B={},I=Object.keys(M);for(j=0;j<I.length;j++)A=I[j],N.indexOf(A)>=0||(B[A]=M[A]);return B})(h,r);return(0,o.cloneElement)(w,l(l({},R),{},{className:(E?E+" ":"")+"react-resizable",children:[].concat(w.props.children,P.map(function(M){var N,A=(N=C.handleRefs[M])!=null?N:C.handleRefs[M]=a.createRef();return a.createElement(i.DraggableCore,d({},v,{nodeRef:A,key:"resizableHandle-"+M,onStop:C.resizeHandler("onResizeStop",M),onStart:C.resizeHandler("onResizeStart",M),onDrag:C.resizeHandler("onResize",M)}),C.renderResizeHandle(M,A))}))}))},b})(a.Component);return St.default=x,x.propTypes=t.resizableProps,x.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},St}var qn,Gn,jt={};function Xi(){if(qn)return jt;qn=1,jt.__esModule=!0,jt.default=void 0;var a=(function(p,f){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var b=d(f);if(b&&b.has(p))return b.get(p);var k={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in p)if(h!=="default"&&Object.prototype.hasOwnProperty.call(p,h)){var w=C?Object.getOwnPropertyDescriptor(p,h):null;w&&(w.get||w.set)?Object.defineProperty(k,h,w):k[h]=p[h]}return k.default=p,b&&b.set(p,k),k})(n),i=s(It()),o=s(ua()),t=da(),r=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(p){return p&&p.__esModule?p:{default:p}}function d(p){if(typeof WeakMap!="function")return null;var f=new WeakMap,b=new WeakMap;return(d=function(k){return k?b:f})(p)}function u(){return u=Object.assign?Object.assign.bind():function(p){for(var f=1;f<arguments.length;f++){var b=arguments[f];for(var k in b)Object.prototype.hasOwnProperty.call(b,k)&&(p[k]=b[k])}return p},u.apply(this,arguments)}function l(p,f){var b=Object.keys(p);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(p);f&&(k=k.filter(function(C){return Object.getOwnPropertyDescriptor(p,C).enumerable})),b.push.apply(b,k)}return b}function c(p){for(var f=1;f<arguments.length;f++){var b=arguments[f]!=null?arguments[f]:{};f%2?l(Object(b),!0).forEach(function(k){m(p,k,b[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(b)):l(Object(b)).forEach(function(k){Object.defineProperty(p,k,Object.getOwnPropertyDescriptor(b,k))})}return p}function m(p,f,b){return(f=(function(k){var C=(function(h,w){if(typeof h!="object"||h===null)return h;var E=h[Symbol.toPrimitive];if(E!==void 0){var v=E.call(h,w);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(h)})(k,"string");return typeof C=="symbol"?C:String(C)})(f))in p?Object.defineProperty(p,f,{value:b,enumerable:!0,configurable:!0,writable:!0}):p[f]=b,p}function x(p,f){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,k){return b.__proto__=k,b},x(p,f)}var g=(function(p){var f,b;function k(){for(var C,h=arguments.length,w=new Array(h),E=0;E<h;E++)w[E]=arguments[E];return(C=p.call.apply(p,[this].concat(w))||this).state={width:C.props.width,height:C.props.height,propsWidth:C.props.width,propsHeight:C.props.height},C.onResize=function(v,P){var R=P.size;C.props.onResize?(v.persist==null||v.persist(),C.setState(R,function(){return C.props.onResize&&C.props.onResize(v,P)})):C.setState(R)},C}return b=p,(f=k).prototype=Object.create(b.prototype),f.prototype.constructor=f,x(f,b),k.getDerivedStateFromProps=function(C,h){return h.propsWidth!==C.width||h.propsHeight!==C.height?{width:C.width,height:C.height,propsWidth:C.width,propsHeight:C.height}:null},k.prototype.render=function(){var C=this.props,h=C.handle,w=C.handleSize;C.onResize;var E=C.onResizeStart,v=C.onResizeStop,P=C.draggableOpts,R=C.minConstraints,M=C.maxConstraints,N=C.lockAspectRatio,A=C.axis;C.width,C.height;var j=C.resizeHandles,B=C.style,I=C.transformScale,H=(function(O,z){if(O==null)return{};var D,W,U={},q=Object.keys(O);for(W=0;W<q.length;W++)D=q[W],z.indexOf(D)>=0||(U[D]=O[D]);return U})(C,r);return a.createElement(o.default,{axis:A,draggableOpts:P,handle:h,handleSize:w,height:this.state.height,lockAspectRatio:N,maxConstraints:M,minConstraints:R,onResizeStart:E,onResize:this.onResize,onResizeStop:v,resizeHandles:j,transformScale:I,width:this.state.width},a.createElement("div",u({},H,{style:c(c({},B),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},k})(a.Component);return jt.default=g,g.propTypes=c(c({},t.resizableProps),{},{children:i.default.element}),jt}var Yi=(Gn||(Gn=1,$t.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},$t.exports.Resizable=ua().default,$t.exports.ResizableBox=Xi().default),$t.exports);function Co(a,i){if(typeof a=="function")return a(i);a&&(a.current=i)}var Nt=parseInt(n.version.split(".")[0],10)>=19?function(a){return i=>{const o=[];for(const t of a){const r=Co(t,i),s=typeof r=="function";o.push(s?r:()=>Co(t,null))}return()=>{for(const t of o)t()}}}:function(a){return i=>{for(const o of a)Co(o,i)}};const Yo=n.memo(n.forwardRef((a,i)=>{const{disabled:o,names:t,workbook:r,restoreFocus:s,readonly:d=!1,disabled:u=!1,commandPopupButtonProps:l,sx:c,...m}=a,x=S.useNotifier(),[g,p]=n.useState(null),[f,b]=n.useState(()=>r.getSelectedRanges().getCoords()),[k,C]=n.useState(!1),{reference:h}=y.useFloatStack({parentFloat:l?.parentFloat}),[w,E]=n.useState(()=>d||!r.getProtection().isStructureAllowed()),v=()=>g?.text??"",[P,R]=n.useState(v),M=S.useCallbackRef(()=>{if(h?.closeAll(),!P){const ee=v();return R(v()),ee}if(v()===P)return P;const _=P.trim().toLowerCase();if(_==="r"||_==="c")return P;try{const ee=r.getRanges(P);if(ee)return ee.toString()}catch{}const K=t.getByName(P);if(K&&K.getRanges())return P;let J=null;try{const ee=r.getRanges(P),F=ee.getCoords().map(ie=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...ie}));J=r.getRanges(F)}catch{}if(!J){const ee=r.getSelectedRanges().getCoords().map(F=>({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...F}));J=r.getRanges(ee)}try{let ee=t.getByName(P);w||ee||(ee=t.addReference(P,J)),ee&&p({text:ee.getName()})}catch(ee){R(v()),x.showMessage?.(ee.message,{type:S.NotifierType.Error})}return null},[P,t,h,w,x]),N=S.useCallbackRef(()=>{if(r.isClosed())return;const _=[];for(let ee=0;ee<f.length;ee++){const F=f[ee];_.push({$colEnd:!0,$rowEnd:!0,$colStart:!0,$rowStart:!0,...F})}let K=null;try{K=t.lookupByRanges(_)}catch{}let J=null;J=K?.length>0?K[0].getName():r.getSelectedSheet().getSelectedRange().toString(),p({text:J})},[r,f]),[A,j]=n.useState(()=>t?.getItems()??null);ae.useModelListener(t,{onCollectionChange(_){j(t.getItems()),N()},onClose(_){j([])}}),n.useEffect(()=>{R(v())},[g,f]);const[B,I]=n.useState(r?.getSelectedSheet());ae.useModelListener(r,{onProtectionChange:_=>{E(d||!_.getProtection().isStructureAllowed())},onSheetsChange:_=>{I(_?.getSelectedSheet())},onViewChange(_){I(_?.getSelectedSheet())}});const[H,O]=n.useState(null),z=S.useCallbackRef(L.CommonUtils.debounce(N,H?320:0),[]);ae.useModelListener(B.getSelection(),{onChange:()=>{b(_=>{const K=r.getSelectedRanges().getCoords();return L.CoordUtils.isEqualRangesArrays(K,_)?_:K})},onAdjustingChange:_=>{O(_.getAdjusting())}}),n.useEffect(()=>{if(H){const _=r.getSelectedRange(),K=_.getRowCount(),J=_.getColumnCount();let ee=`${K}R x ${J}C`;if(ee.length>17&&(ee=`${K}x${J}`),K>1||J>1)return void p({text:ee,fontStyle:"italic",justifyContent:"center"})}p({text:r.getSelectedSheet().getSelectedRange().toString()}),z()},[f,r,H]);const D=n.useRef(null),W=n.useCallback(_=>{const{onMouseDown:K,onMouseUp:J,...ee}=_;return e.jsx(T.IconButton,{...ee,sx:{...ee?.sx,display:"flex",flex:"1 1 100%"},disableRipple:!0,children:e.jsx(T.Input,{inputMode:"text",inputProps:{tabIndex:0,name:"input-named-range",maxLength:255,className:"input",autoFocus:!1,spellCheck:!1,autoComplete:"off",ref:D},sx:{"&::before":{borderBottom:"1px solid transparent"},"&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before":{borderBottom:F=>`1px solid ${F.palette.text.icon??F.palette.action.active}`},"&:hover:not(.Mui-disabled):not(.Mui-error):before":{borderBottom:F=>`1px solid ${F.palette.primary.main}`},"::after":{borderBottom:F=>`1px solid ${F.palette.primary.main}`},paddingTop:"0px",paddingBottom:"0px",height:"1rem",fontSize:11*L.IFont.getDeviceScale(),fontStyle:g?.fontStyle,paddingLeft:F=>F.spacing(.75),paddingRight:F=>F.spacing(.75),boxShadow:"none",flex:"1",color:F=>F.palette.text.secondary,input:{padding:"0",height:"1rem",textAlign:"left","&:hover:not(.Mui-disabled):not(.Mui-error)":{color:F=>F.palette.text.primary},"&:focus:not(.Mui-disabled):not(.Mui-error)":{color:F=>F.palette.text.primary}}},value:P,onFocus:F=>{F.target?.select()},onKeyDown:F=>{if(F.which===S.KeyCodes.Enter||F.which===S.KeyCodes.Tab){let ie=P;v()!==P&&(F.stopPropagation(),F.preventDefault(),ie=M()),ie?U(ie):s?.()}else if(F.which===S.KeyCodes.Escape)v()!==P?(R(v()),setTimeout(()=>{F.target?.select()},0),F.stopPropagation(),F.preventDefault()):s?.();else if(F.which===S.KeyCodes.Space)return void F.stopPropagation()},onBlur:()=>{R(v())},onChange:F=>{R(F.target.value)}})})},[P,g]),U=S.useCallbackRef(async _=>{try{h?.closeAll();const K=t.lookupByRanges(_)?.[0];K&&await K?.select(),await r.getRanges(_)?.select()}catch(K){x.showMessage?.(K.message,{type:S.NotifierType.Error})}},[t,x,r]),q=n.useCallback(_=>{setTimeout(()=>{C(!0)},0);const K={variant:S.CommandButtonType.Menuitem,parentFloat:_.floatReference,commandHook:{...l?.commandHook,beforeExecute:(he,be)=>(h?.closeAll(),l?.commandHook?.beforeExecute?.(he,be))},scope:l?.scope,commands:l?.commands};let J=t.getItems({scope:r?.getSelectedSheet().getName()});J=J.sort((he,be)=>he.getType()===be.getType()?he.getName().localeCompare(be.getName()):he.getType()==="range"?-1:1);const ee=w?null:["editNamedReference","deleteNamedReference"],F=w?null:["editTable",null,"convertTableToRange","deleteTable"],ie=[],ne=J.length;for(let he=0;he<ne;he++){const be=J[he],Te=be.getRanges();if(!Te||be.isHidden())continue;const de=be.getType();de!==J[he-1]?.getType()&&(he>0&&ie.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},`type-divider-${ie.length}`)),ie.push(e.jsx(y.ExhibitMenuHeader,{variant:"subtitle2",sx:{paddingLeft:"16px"},children:be.getType()==="reference"?"Ranges":"Tables"},`type-header-${ie.length}`))),de==="reference"?ie.push(n.createElement(y.SimpleCommandPopupButton,{...K,key:"named-"+ie.length,popupCommandKeys:ee,popupScope:"namedItem",scope:"namedItem",commandState:be,commands:l?.commands,label:be.getName(),quickCommand:"selectNamed",disabled:!be.getRanges()||u,icon:"NamedRange"})):de==="table"&&ie.push(n.createElement(y.SimpleCommandPopupButton,{...K,key:"namedItem-"+ie.length,popupCommandKeys:F,popupScope:"namedItem",scope:"namedItem",commands:l?.commands,commandState:be,label:be.getName(),quickCommand:"selectNamed",disabled:!Te||u,icon:"InsertTable"}))}const le=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},...m,children:[w?null:e.jsx(y.CommandButton,{...K,scope:"namedItem",command:l?.commands.getCommand("addNamedReference")}),ie&&ie.length>0?e.jsxs(e.Fragment,{children:[w?null:e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:ie})]}):null]});return y.defaultCreatePopupPanel({..._,children:le})},[r,A,t,g,w]),G=S.useImperativeElement(i,()=>({focus(_){D.current?.focus(_)}}),[]);return e.jsx(T.Box,{className:"outer",sx:{minWidth:120,flex:"1 1 100%",display:"flex",alignItems:"center",justifyContent:"start",...c},ref:Nt([G,i]),...m,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%"},...c},buttonProps:{sx:{backgroundColor:_=>_.palette.background.paper,backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`}},tabIndex:-1,outlined:{color:_=>o?_.palette.action.disabled:Y.alpha(_.palette.divider,.2)},parentFloat:h,createPopupPanel:q,onPopupOpen:()=>C(!0),onPopupClose:()=>C(!1),createTooltip:({children:_},K)=>e.jsx(y.ExhibitTooltip,{title:K||k?"":"Name Box",disabled:K,leaveDelay:0,sx:{opacity:K||k?0:1},children:_}),createQuickButton:W})})}));Yo.displayName="NamedCollectionEditor";const Zi=(a,i)=>e.jsx(Yo,{ref:i,...a}),Zo=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,sheetElement:r,gridStyle:s,showNamedCollectionEditor:d=!0,NamedCollectionEditorProps:u,renderNamedCollectionEditor:l=Zi,disabled:c,commands:m,...x}=a,[g,p]=n.useState(t?.getSelectedSheet());ae.useModelListener(t,{onSheetsChange:F=>{p(F?.getSelectedSheet())},onViewChange(F){p(F?.getSelectedSheet())}});const[f,b]=n.useState(g.getSelection().getCoords().cell),k=g.getRange(f).getCell(),C=c||!k.isEditAllowed(),h=n.useRef(null),w=n.useMemo(()=>({fontSize:11}),[]);ae.useModelListener(g.getSelection(),{onChange:()=>{b(g.getSelection().getCoords().cell)}}),ae.useModelListener(g,{onProtectionChange(){b(g.getSelection().getCoords().cell)}});const E=h.current?.getLineHeight()??20,[v,P]=n.useState(E),[R,M]=n.useState(5),[N,A]=n.useState(1),j=S.useCallbackRef((F,{size:ie})=>{F.preventDefault(),F.stopPropagation();const ne=Math.floor(ie.height/E);P(ne*E+1),ne>1&&M(ne)},[E]),B=S.useCallbackRef((F,{size:ie})=>{const ne=Math.floor(ie.height/E);A(ne)},[E]),I=S.useEditMode(),H=I.getMode();let O=null;H?.key==="edit"&&(O=H.args?.stateAndCoords);const z=n.useMemo(()=>{let F=O?.editState;return F||(F=ae.createCellEditStateFromCell(()=>g.getRange(f).getCell())),e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"row",gap:4},children:e.jsx(ae.SheetCellEditor,{ref:h,activeCoords:f,sheet:g,onFocus:()=>{r?.startEdit({autoFocus:!1,editMode:!0,cell:f})},defaultTextStyle:w,useRichStyling:!1,disabled:C,onChangeEdit:ie=>{if(ie.dirty!==void 0){const ne={sheet:g,coords:f,editState:ie};I.setMode(le=>({...le,args:{...le?.args,stateAndCoords:ne}}))}},editState:F,commands:m,onCancelEdit:()=>{r?.cancelEdit(),r?.focus()},onSubmitEdit:()=>{r?.submitEdit(),r?.focus()},linesVisible:N})})},[g,O,f,N,r]),D=n.useRef(null),W=n.useMemo(()=>d?l({names:t.getNames(),workbook:t,...u},D):null,[l,u,d,g,t,C]),U=n.useMemo(()=>e.jsxs(T.Paper,{elevation:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:0,backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`,border:F=>`solid ${C?F.palette.action.disabled:Y.alpha(F.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(S.DynamicIcon,{iconKey:"CloseError"}),tooltipProps:{label:"Cancel",simple:!0},disabled:C||O===null,onMouseDown:F=>{F.button===0&&F.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(S.DynamicIcon,{iconKey:"CheckSuccess"}),tooltipProps:{label:"Enter",simple:!0},disabled:C||O===null,onMouseDown:F=>{F.button===0&&F.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(S.DynamicIcon,{iconKey:"Function",style:{transform:"scale(0.85)"}}),tooltipProps:{label:"Insert Function",simple:!0},onMouseDown:F=>{F.button===0&&F.preventDefault()}})]}),[C,O]),q=Y.useTheme(),[G,_]=n.useState(!1),K=n.useMemo(()=>e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",gap:F=>F.spacing(.5),alignItems:"start"},children:[U,e.jsxs(T.Paper,{elevation:0,sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",fontFamily:F=>F.typography.fontFamily,fontSize:11*L.IFont.getDeviceScale(),"& .editor-placement":{top:"2px !important"},minHeight:"calc(100% - 2px)",boxShadow:"none",borderRadius:F=>`${F.shape.borderRadius}px`,backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`,border:F=>`solid ${C?F.palette.action.disabled:Y.alpha(F.palette.divider,.2)} 1px`,"& textarea":{color:F=>C?`${F.palette.text.disabled} !important`:F.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:()=>_(!0),onBlur:()=>_(!1),onMouseDown:F=>{F.target?.classList.contains("react-resizable-handle")&&F.preventDefault()},children:[e.jsx(T.Box,{className:"formula-editor",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",alignSelf:"baseline",paddingLeft:F=>F.spacing(1),paddingRight:F=>F.spacing(1)},children:e.jsx(Yi.ResizableBox,{height:v,draggableOpts:{grid:[E,E]},minConstraints:[E,E],maxConstraints:[15*E,15*E],onResize:B,onResizeStop:j,resizeHandles:["s"],axis:"y",style:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:z})}),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(S.DynamicIcon,{iconKey:N>1?"ExpandLess":"ExpandMore"}),tooltipProps:{label:(N>1?"Collapse":"Expand")+" Formula Bar",simple:!0},onMouseDown:F=>{F.button===0&&F.preventDefault()},onClick:()=>{const F=N>1?1:R;P(F*E+1),A(F)}}),e.jsx(T.Box,{sx:{position:"absolute",width:"100%",height:"2px",bottom:"0",willChange:"opacity",transition:"opacity 60ms ease-in",opacity:G?1:0,borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:F=>F.palette.primary.main,borderRadius:F=>`${F.shape.borderRadius}px`}})]})]}),[U,z,G,N,E]),J=n.useMemo(()=>W||K?!W&&K?K:W&&!K?W:e.jsx(e.Fragment,{children:e.jsx(S.SplitPane,{fixedPane:"before",minBefore:"165px",minAfter:"200px",paneBeforeProps:{style:{alignItems:"flex-start"}},paneAfterProps:{style:{overflow:"visible"}},resizerProps:{style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='6' height='13' viewBox='0 0 6 13' version='1.1' fill='${q.palette.text.icon??q.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 6.5px",minWidth:"18px"}},elementBefore:W,elementAfter:K})}):null,[W,K]),ee=S.useImperativeElement(i,()=>({isFormulaBarElement:()=>!0,getNamedCollectionEditorElement:()=>D.current}),[]);return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",gap:F=>F.spacing(.5),...o},ref:ee,...x,children:J})}));Zo.displayName="FormulaBar";const Qo=n.memo(n.forwardRef((a,i)=>{const{filter:o,commands:t,disabled:r,sx:s,floatReference:d,...u}=a,l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(g,p)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),m=n.useMemo(()=>({...l,...c,variant:S.CommandButtonType.Menuitem}),[l,c]),x=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{...m,command:t.getCommand("sortAscending")}),e.jsx(y.CommandButton,{...m,command:t.getCommand("sortDescending")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:t.getCommand("autoFilterClear")}),[]]});return e.jsx(T.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",display:"flex",flexDirection:"column",...s},...u,children:x})}));Qo.displayName="FilterColumnMenu";const ma=n.memo(n.forwardRef((a,i)=>{const{children:o,className:t,disabled:r,style:s,filter:d,...u}=a,l=S.useImperativeElement(i,()=>({isFilters:()=>!0}),[]);return e.jsx("div",{ref:l,className:pe("filters",t),style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",...s},...u,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:d.getName()}),e.jsx("div",{children:"Filter Widget"})]})})}));ma.displayName="Filters";const Jo=n.memo(n.forwardRef((a,i)=>{const{children:o,sheet:t,style:r,className:s,value:d,index:u,editing:l,editable:c,disabled:m,selectedIndex:x,dragging:g,borderColor:p,borderWidth:f,activeColor:b,background:k="white",tabRadius:C=4,gridTheme:h,...w}=a,[E,v]=n.useState(()=>!!t&&t.getProtection().isLocked()),[P,R]=n.useState(()=>t?t.getTabColor():null);ae.useModelListener(t,{onProtectionChange:()=>{v(t.getProtection().isLocked())},onTabColorChange:()=>{R(t.getTabColor())},onStyleChange:()=>{R(t.getTabColor())}});const M=Y.useTheme(),N=x===u;let A=null,j=null;if(P||g){let H=k;P?(j=P.toBlackOrWhite().toCSS(),H=P?.toCSS()):N||(H=M.palette.background.paper),A=e.jsx(T.Box,{sx:{position:"absolute",boxSizing:"border-box",top:"3px",left:"4px",right:"4.5px",bottom:"1.5px",opacity:N?"50%":"100%",borderRadius:"4px",border:O=>N?`${k} solid 1px`:`${O.palette.divider} solid 1px`,background:N&&P?`linear-gradient(0deg, ${H} 0%, transparent)`:H}})}let B=null;typeof p=="string"?B=p:p?.toCSS&&(B=p.toCSS());const I=N?e.jsx(T.Box,{sx:{width:"100%",borderRadius:"4px",minWidth:"4px",height:"2px",backgroundColor:H=>H.palette.primary.main}}):null;return e.jsx(Y.ThemeProvider,{theme:N?h??M:M,children:e.jsx(T.Box,{ref:i,className:pe(s),sx:{...r,display:"flex",flexDirection:"column",minHeight:"0px",fontWeight:N?"700":"400",fontSize:"0.85rem",letterSpacing:"0",lineHeight:"1",textTransform:"none",minWidth:"unset",cursor:g?"grabbing":void 0},...w,children:e.jsx(S.RoundedTab,{style:{flex:"1 1 100%",display:"flex",flexDirection:"row"},radius:C,strokeColor:N?B:"transparent",children:e.jsx(T.Button,{sx:{textTransform:"none",borderRadius:"0px",minHeight:"0px",paddingLeft:"11px",paddingRight:"12px",paddingTop:"3px",flex:"1 1 100%",paddingBottom:"3px",fontWeight:N?"700":"400",fontSize:"0.85rem",letterSpacing:"0",transition:"none",cursor:g?"grabbing":void 0,color:N?"primary":j||"text.secondary",backgroundColor:N?k:"transparent","&:hover:not([disabled])":{backgroundColor:N?k:"transparent"},"& input":{color:H=>`${H.palette.text.primary}`,textAlign:"center",fontWeight:"500"},marginTop:"0px",minWidth:"unset"},disabled:m,disableRipple:l,component:"div",children:e.jsxs(e.Fragment,{children:[A,e.jsxs(T.Box,{sx:{zIndex:"1",display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:"1px",lineHeight:"1",marginTop:N?void 0:"1px"},children:[o,I]}),E?e.jsx(S.DynamicIcon,{iconKey:"Lock",style:{scale:"0.80",marginLeft:"2px",width:"22px",height:"22px"},color:"secondary"}):e.jsx(T.Box,{sx:{minHeight:"22px"}})]})]})},d+":"+u)})})})}));Jo.displayName="SheetTab";const en=n.memo(n.forwardRef((a,i)=>{const{workbook:o,index:t,commands:r,scope:s="sheet",disabled:d,floatReference:u,sx:l,className:c,tabStripRef:m,...x}=a,[g,p]=n.useState(o?.getProtection());ae.useModelListener(o,{onProtectionChange:h=>{p(h?.getProtection())}});const f=n.useMemo(()=>({}),[]),b=n.useMemo(()=>({commandHook:{beforeExecute:(h,w)=>u.closeAll(),onExecute(){},onError(){console.log("onError")}},scope:s,commandState:t,disabled:d||t===void 0,parentFloat:u}),[d,u]),k=n.useMemo(()=>({...f,...b}),[f,b]),C=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:r.getCommand("addSheet"),commandState:t,...k,variant:S.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r.getCommand("deleteSheet"),...k,variant:S.CommandButtonType.Menuitem}),e.jsxs(y.ExhibitMenuItem,{onMouseDown:h=>{h.button===0&&h.preventDefault()},onMouseUp:()=>{Promise.resolve(u.closeAll()).then(()=>{m?.startEdit(t)})},disabled:d||!g.isStructureAllowed(),parentFloat:u,children:["Rename",s!=="sheet"?" Sheet":""]}),e.jsx(y.CommandButton,{command:r.getCommand("duplicateSheet"),...k,variant:S.CommandButtonType.Menuitem}),e.jsx(y.CommandButton,{command:r?.getCommand("protectionSheetToggle"),...k,variant:S.CommandButtonType.Menuitem}),e.jsx(pt,{variant:S.CommandButtonType.Menuitem,command:r.getCommand("formatSheetTabColor"),icon:e.jsx(S.DynamicIcon,{iconKey:"stroke.colored"}),panelProps:{disableAlpha:!0,autoColorLabel:"No Tab Color",autoColorPosition:ut.End},parentFloat:u}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{command:r.getCommand("hideSheet"),...k,variant:S.CommandButtonType.Menuitem})]});return e.jsx(T.Box,{ref:i,className:pe("menu",c),sx:{...l},...x,children:C})}));en.displayName="SheetTabMenu";const tn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,gridStyle:t,floatReference:r,closeFloatAll:s,className:d,...u}=a,[l,c]=n.useState(o?.getSheets().getItems()),[m,x]=n.useState(o?.getProtection());ae.useModelListener(o,{onSheetsChange:p=>{c(p.getSheets().getItems())},onProtectionChange:p=>{x(p?.getProtection())}});const g=n.useMemo(()=>{const p=[],f=o.getSheets().getItems({visibility:L.ISheet.Visibility.Hidden}),b=o.getSelectedSheet();for(let k=0;k<f.length;k++){const C=f[k],h=C.getVisibility();if(h===L.ISheet.Visibility.VeryHidden)continue;const w=b===C,E=C.getProtection().isLocked(),v=C.getTabColor(),P=t?.body.fill??"transparent";let R=null,M=null,N=P;v&&(N=v.toCSS(),w||(M=v.toBlackOrWhite().toCSS()),R=e.jsx(T.Box,{sx:{position:"absolute",display:"flex",flexDirection:"column",top:"4px",left:"40px",right:"8px",bottom:"4px",background:w?N:"transparent",borderRadius:"4px",border:`solid 1px ${t.header.edgeStrokeFill}`},children:e.jsx(T.Box,{sx:{flex:"1 1 100%",boxSizing:"content-box",opacity:w||h===L.ISheet.Visibility.Hidden?"50%":"100%",border:j=>w?`${P} solid 1.5px`:`${j.palette.divider} solid 1px`,background:w&&v?`linear-gradient(0deg, ${N} 0%, ${P})`:N,borderRadius:"4px"}})}));let A=null;E&&(A=e.jsx(S.DynamicIcon,{iconKey:"Lock"})),h!==L.ISheet.Visibility.Visible&&(A=e.jsx(S.DynamicIcon,{iconKey:"VisibilityOff",style:{opacity:m.isStructureAllowed()?1:.7},color:"secondary"})),A&&(A=e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",alignItems:"center",ml:"16px","& *":{lineHeight:"1em",fontSize:"1.3em"}},children:A})),p.push(e.jsx(y.ExhibitMenuItem,{disabled:!m.isStructureAllowed()&&h===L.ISheet.Visibility.Hidden,sx:{color:j=>{let B=w?j.palette.primary.main:j.palette.text.secondary;return M&&(B=M),h===L.ISheet.Visibility.Hidden&&(B=Me.alpha(B,j.palette.action.disabledOpacity)),B},borderLeft:j=>`${w?j.palette.primary.main:"transparent"} solid 2px`,paddingLeft:"4px",fontWeight:w?"700":"400","&:hover":{fontWeight:"700"}},icon:w?e.jsx(y.SelectedIcon,{}):void 0,onMouseDown:j=>j.preventDefault(),onMouseUp:()=>{Promise.resolve(r.closeAll()).then(()=>{try{C.select()}catch(j){console.error(j)}})},children:e.jsxs(e.Fragment,{children:[R,e.jsxs(T.Box,{sx:{paddingRight:"0px",paddingLeft:"4px",display:"flex",flexDirection:"row",flex:"1 1 100%",overflow:"hidden",alignItems:"center",zIndex:2},children:[e.jsxs(T.Box,{className:"sheet-name",sx:{display:"flex",flexDirection:"column",paddingLeft:"8px",paddingRight:"8px",alignItems:"center"},children:[C.getName(),e.jsx(T.Box,{sx:{height:"0px",opacity:"0",fontWeight:"700"},children:C.getName()})]}),A]})]})},""+k))}return p},[o,m,l,r,t]);return e.jsx(T.Box,{ref:i,className:pe("menu",d),...u,children:g})}));tn.displayName="SheetsAllMenu";let Ut=!1,pa=!1,Ge=null;const Xn=async a=>{const i=await L.LicenseManager.getDetails();if(pa||i.isEval()){try{const o=top??window;o.SheetXL||(o.SheetXL=Object.freeze({getSelectedWorkbook:()=>Ge?.getWorkbook(),getSelectedSheet:()=>Ge?.getWorkbook().getSelectedSheet(),getSelectedRange:()=>Ge?.getWorkbook().getSelectedRange(),getRange:t=>Ge?.getWorkbook().getRange(t),getSelectedWorkbookElement:()=>Ge,getLicenseManager:()=>L.LicenseManager,moreExamples:()=>{console.table({"SheetXL.getRange('Sheet1!e5:f6').setValues([[110, 220], [210, 220]])":{Summary:"Set an array of values."},"SheetXL.getRange('a1:e5').setValue(100)":{Summary:"Set a single repeating value to a range."},"SheetXL.getRange('Sheet1!e5:f6').getValues()":{Summary:"Get the values as a 2d array (see forEach)."},"SheetXL.getSelectedRange().setValue(new Date())":{Summary:"Set current date/time using Javascript Date."},"SheetXL.getSelectedRange().setValue('10/23/95')":{Summary:"Set current date/time using string."},"SheetXL.getSelectedSheet().getUsedRange().getValues()":{Summary:"Get all of the values in a sheet."},"SheetXL.getSelectedRange().getStyle().update({ fill: 'accent4' })":{Summary:"Set fill to theme color 4."},"SheetXL.getRange('E:L').getStyle().update({ fill: 'accent1 lumMod 90 lumOff 40' })":{Summary:"Set some columns to a modified theme color."},"SheetXL.getRange('e5:f10').getStyle().update({ style: { border: 'double blue' }})":{Summary:"Set border."},"SheetXL.getCell().getStyle().fill.toCSS()":{Summary:"Get the fill style as css for the selected cell."},"SheetXL.getRange('a1:a3').autoFill('a1:a7')":{Summary:"Autofill down."},"SheetXL.getRange('e7:i9').merge({ orientation: 'rows' })":{Summary:"Merge cells horizontally."},"SheetXL.getSelectedRange().sort({ ascending: false, hasHeader: false })":{Summary:"Sort selected cells ascending with a header."},"SheetXL.getSelectedRange().clear('all')":{Summary:"Clear the current range a different way."},"SheetXL.getSelectedSheet().getTables().add('b2:e9')":{Summary:"Create a 4x8 table at b2 for current sheet."},"SheetXL.getRange('a1:c3').copyFrom('e1:g3')":{Summary:"Copy cells."},"SheetXL.getRange('c:t').getColumnHeaders().setSize(30)":{Summary:"Set the size of columns to 30 pixels."},"SheetXL.getRange('2:3').delete()":{Summary:"Remove rows 2 and 3 and shift up."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg')":{Summary:"Add an image."},"SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg', { bounds: { height: 100 } })":{Summary:"Add an image of height 100."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue(1.50).getStyle().update({ numberFormat: '0%' }).autoFit(); }, 'Enter 150%')":{Summary:"Set value to 100 and numberformat to 0% as a single."},"SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue('Remind Me Later').getStyle().update({ namedStyle: 'Note'}).autoFit(); }, 'Set Reminder')":{Summary:"Set a value and style to Note style and autofit text."},"SheetXL.getSelectedWorkbook().getNames().addReference('Small_Range', 'A2:E5');":{Summary:"Add a named range."},"SheetXL.getSelectedWorkbook().getRange('a1:e5').addListener((e) => { console.log('got an update for:', e.getSource().toString()) })":{Summary:"Listen for updates at a range."}})}}))}catch(o){o instanceof DOMException||console.error(o),Ut=!0}if(Ge!==a&&(Ge=a,!Ut))try{Ut=!0,(top??window).SheetXL&&(await L.LicenseManager._validate(!0),L.LicenseManager.wasPrinted()&&(()=>{Ie.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;"),Ut=!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)}}};var Qi=function(){},fa=typeof window<"u",Ji=fa?n.useLayoutEffect:n.useEffect,Yn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const ft=fa&&window.ResizeObserver!==void 0?function(){var a=n.useState(null),i=a[0],o=a[1],t=n.useState(Yn),r=t[0],s=t[1],d=n.useMemo(function(){return new window.ResizeObserver(function(u){if(u[0]){var l=u[0].contentRect,c=l.x,m=l.y,x=l.width,g=l.height,p=l.top,f=l.left,b=l.bottom,k=l.right;s({x:c,y:m,width:x,height:g,top:p,left:f,bottom:b,right:k})}})},[]);return Ji(function(){if(i)return d.observe(i),function(){d.disconnect()}},[i]),[o,r]}:function(){return[Qi,Yn]};function oo(){return oo=Object.assign?Object.assign.bind():function(a){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var t in o)({}).hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},oo.apply(null,arguments)}function on(a,i){if(a==null)return{};var o={};for(var t in a)if({}.hasOwnProperty.call(a,t)){if(i.indexOf(t)!==-1)continue;o[t]=a[t]}return o}function no(a,i){return no=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,t){return o.__proto__=t,o},no(a,i)}function ha(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,no(a,i)}function Zn(a,i){return a.replace(new RegExp("(^|\\s)"+i+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const Qn=!1,ga=n.createContext(null);var xa=function(a){return a.scrollTop},Mt="unmounted",Xe="exited",Ye="entering",it="entered",Io="exiting",He=(function(a){function i(t,r){var s;s=a.call(this,t,r)||this;var d,u=r&&!r.isMounting?t.enter:t.appear;return s.appearStatus=null,t.in?u?(d=Xe,s.appearStatus=Ye):d=it:d=t.unmountOnExit||t.mountOnEnter?Mt:Xe,s.state={status:d},s.nextCallback=null,s}ha(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Mt?{status:Xe}:null};var o=i.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!==Ye&&s!==it&&(r=Ye):s!==Ye&&s!==it||(r=Io)}this.updateStatus(!1,r)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var t,r,s,d=this.props.timeout;return t=r=s=d,d!=null&&typeof d!="number"&&(t=d.exit,r=d.enter,s=d.appear!==void 0?d.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===Ye){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Je.findDOMNode(this);s&&xa(s)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Xe&&this.setState({status:Mt})},o.performEnter=function(t){var r=this,s=this.props.enter,d=this.context?this.context.isMounting:t,u=this.props.nodeRef?[d]:[Je.findDOMNode(this),d],l=u[0],c=u[1],m=this.getTimeouts(),x=d?m.appear:m.enter;!t&&!s||Qn?this.safeSetState({status:it},function(){r.props.onEntered(l)}):(this.props.onEnter(l,c),this.safeSetState({status:Ye},function(){r.props.onEntering(l,c),r.onTransitionEnd(x,function(){r.safeSetState({status:it},function(){r.props.onEntered(l,c)})})}))},o.performExit=function(){var t=this,r=this.props.exit,s=this.getTimeouts(),d=this.props.nodeRef?void 0:Je.findDOMNode(this);r&&!Qn?(this.props.onExit(d),this.safeSetState({status:Io},function(){t.props.onExiting(d),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:Xe},function(){t.props.onExited(d)})})})):this.safeSetState({status:Xe},function(){t.props.onExited(d)})},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(d){s&&(s=!1,r.nextCallback=null,t(d))},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:Je.findDOMNode(this),d=t==null&&!this.props.addEndListener;if(s&&!d){if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],l=u[0],c=u[1];this.props.addEndListener(l,c)}t!=null&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Mt)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 d=on(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n.createElement(ga.Provider,{value:null},typeof s=="function"?s(t,d):n.cloneElement(n.Children.only(s),d))},i})(n.Component);function ot(){}He.contextType=ga,He.propTypes={},He.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ot,onEntering:ot,onEntered:ot,onExit:ot,onExiting:ot,onExited:ot},He.UNMOUNTED=Mt,He.EXITED=Xe,He.ENTERING=Ye,He.ENTERED=it,He.EXITING=Io;var So=function(a,i){return a&&i&&i.split(" ").forEach(function(o){return r=o,void((t=a).classList?t.classList.remove(r):typeof t.className=="string"?t.className=Zn(t.className,r):t.setAttribute("class",Zn(t.className&&t.className.baseVal||"",r)));var t,r})},No=(function(a){function i(){for(var t,r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];return(t=a.call.apply(a,[this].concat(s))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(u,l){var c=t.resolveArguments(u,l),m=c[0],x=c[1];t.removeClasses(m,"exit"),t.addClass(m,x?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(u,l)},t.onEntering=function(u,l){var c=t.resolveArguments(u,l),m=c[0],x=c[1]?"appear":"enter";t.addClass(m,x,"active"),t.props.onEntering&&t.props.onEntering(u,l)},t.onEntered=function(u,l){var c=t.resolveArguments(u,l),m=c[0],x=c[1]?"appear":"enter";t.removeClasses(m,x),t.addClass(m,x,"done"),t.props.onEntered&&t.props.onEntered(u,l)},t.onExit=function(u){var l=t.resolveArguments(u)[0];t.removeClasses(l,"appear"),t.removeClasses(l,"enter"),t.addClass(l,"exit","base"),t.props.onExit&&t.props.onExit(u)},t.onExiting=function(u){var l=t.resolveArguments(u)[0];t.addClass(l,"exit","active"),t.props.onExiting&&t.props.onExiting(u)},t.onExited=function(u){var l=t.resolveArguments(u)[0];t.removeClasses(l,"exit"),t.addClass(l,"exit","done"),t.props.onExited&&t.props.onExited(u)},t.resolveArguments=function(u,l){return t.props.nodeRef?[t.props.nodeRef.current,u]:[u,l]},t.getClassNames=function(u){var l=t.props.classNames,c=typeof l=="string",m=c?(c&&l?l+"-":"")+u:l[u];return{baseClassName:m,activeClassName:c?m+"-active":l[u+"Active"],doneClassName:c?m+"-done":l[u+"Done"]}},t}ha(i,a);var o=i.prototype;return o.addClass=function(t,r,s){var d=this.getClassNames(r)[s+"ClassName"],u=this.getClassNames("enter").doneClassName;r==="appear"&&s==="done"&&u&&(d+=" "+u),s==="active"&&t&&xa(t),d&&(this.appliedClasses[r][s]=d,(function(l,c){l&&c&&c.split(" ").forEach(function(m){return g=m,void((x=l).classList?x.classList.add(g):(function(p,f){return p.classList?!!f&&p.classList.contains(f):(" "+(p.className.baseVal||p.className)+" ").indexOf(" "+f+" ")!==-1})(x,g)||(typeof x.className=="string"?x.className=x.className+" "+g:x.setAttribute("class",(x.className&&x.className.baseVal||"")+" "+g)));var x,g})})(t,d))},o.removeClasses=function(t,r){var s=this.appliedClasses[r],d=s.base,u=s.active,l=s.done;this.appliedClasses[r]={},d&&So(t,d),u&&So(t,u),l&&So(t,l)},o.render=function(){var t=this.props;t.classNames;var r=on(t,["classNames"]);return n.createElement(He,oo({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},i})(n.Component);No.defaultProps={classNames:""},No.propTypes={};const ko=.12,Oo=(a,i)=>{const o={},t=l=>{const c=l.palette?.background.default??"rgba(255,255,255,1)";return{text:{fontFamily:l.typography?.fontFamily??"Calibri",fontSize:l.typography?.fontSize??8.25,fontWeight:l.typography?.fontWeightRegular??"400",fill:l.palette.mode==="dark"?l.palette?.text?.secondary:l.palette?.text?.primary},fill:c,strokeFill:y.elevateColor(c,ko,l.palette?.mode),darkMode:l.palette.mode==="dark"}},r=t(i);o.body=t(a),o.header={...o.body,strokeFill:y.elevateColor(o.body.fill,ko,a.palette?.mode),fill:i&&a.palette.mode==="dark"&&i.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=l=>({...o.header,strokeFill:y.elevateColor(l?.fill??o.body.fill,.22,a.palette?.mode),fill:y.elevateColor(l?.fill??o.header.fill,.065,a.palette?.mode),text:{...l?.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,ko,i.palette?.mode),fill:i&&i.palette.mode==="dark"&&i.palette.mode!==a.palette.mode?r.fill:y.elevateColor(r.fill,.055,i.palette?.mode),edgeStrokeFill:i.palette.mode==="dark"?r.strokeFill:y.elevateColor(r.fill,.328,i.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 d=i??a,u=d.palette.mode==="dark";return o.selection={fill:d.palette?.primary?.main?Me.alpha(d.palette?.primary?.main,.1):void 0,strokeFill:d.palette?.primary?.main},o.selectionInactive={...o.selection,fill:d.palette?.divider?Me.alpha(d.palette?.divider,.05):void 0,strokeFill:"transparent"},o.selectionRemove={...o.selection,fill:Me.alpha(d.palette.warning.light,.05),strokeFill:d.palette.warning.dark},i&&(o.body=t(i)),o.colorShadow=Me.alpha(d.palette.action.active,.5),o.colorGrey=d.palette.action.active,o.filterDarkInvert=u?"hue-rotate(180deg) invert(1) brightness(95%)":"none",o},Ft=n.memo(n.forwardRef((a,i)=>{const{children:o,sx:t,parentFloat:r,...s}=a,d=S.useImperativeElement(i,()=>({}),[]),[u,l]=ft(),c=n.useRef(null),m=n.useRef(null),[x,g]=n.useReducer(v=>v+1,0),[p,f]=n.useState(null),[b,k]=n.useState(null),[C,h]=n.useState(null),{reference:w}=y.useFloatStack({parentFloat:r,label:"overflow"});n.useLayoutEffect(()=>{m.current={refs:[]};const v=[],P=n.Children.toArray(o);let R=0;P.forEach((M,N)=>{v.push(e.jsx(T.Box,{sx:{display:"flex"},ref:A=>{R++,R===P.length&&g();const j={current:null};j.current=A,m.current.refs[N]=j},children:M},N))}),f(v)},[o,l]),n.useLayoutEffect(()=>{if(!p)return;const v=m.current.refs,P=v?v.length:0;if(!d.current||P===0)return k(null),void h(null);const R=d.current?.getBoundingClientRect(),M=[],N=[];let A=0,j=!1;for(let I=0;!j&&I<P;I++){const H=v[I];if(!H)continue;if(!H.current){j=!0;continue}const O=H.current.getBoundingClientRect();A+=O?.width,A>R.width&&(j=!0)}if(!j)return k(null),void h([]);const B=c.current?.getBoundingClientRect();A=0;for(let I=0;I<P;I++){const H=v[I];let O=!1;if(H.current){const z=H.current.getBoundingClientRect();A+=z?.width,A<R.width-B.width&&(O=!0)}O?M.push(p[I]):N.push(p[I])}k(M.length>0?M:null),h(N.length>0?N:null)},[o,p,l,w,x]);const E=S.useCallbackRef(v=>{const P=[],R=C.length;for(let N=0;N<R;N++){const A=n.Children.toArray(C[N])[0];n.Children.toArray(A.props.children?.props?.children??A.props.children).forEach((j,B)=>{const I=j,H={...I.props,key:`overflow-${N}-${B}${I.key??""}`};H.parentFloat&&v&&(H.parentFloat=v.floatReference);const O=n.cloneElement(I,H);P.push(O)})}const M=e.jsx(T.Box,{className:"overflow-palette-popup-panel",sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:N=>N.spacing(.25),paddingTop:N=>N.spacing(.5),paddingBottom:N=>N.spacing(.5),paddingLeft:N=>N.spacing(1),paddingRight:N=>N.spacing(1),overflow:"hidden"},children:P});return y.defaultCreatePopupPanel({...v,children:M})},[C]);return e.jsxs(T.Box,{className:"overflow-palette",sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",width:"100%",maxWidth:"100%",...t},ref:Nt([d,u,i]),...s,children:[e.jsx(T.Box,{sx:{flexDirection:"row",display:"flex",maxWidth:"100%",flex:"1 1 100%",alignItems:"center"},children:b??p}),e.jsx(T.Box,{className:"overflow-palette-popup-button",sx:{display:C!==null&&C.length===0?"none":"flex",flex:"1 1 0"},children:e.jsx(y.ExhibitPopupIconButton,{createPopupPanel:E,ref:c,parentFloat:w,createTooltip:({children:v},P)=>e.jsx(y.ExhibitTooltip,{label:"More",description:"More toolbar options…",disabled:P,children:v}),icon:e.jsx(S.DynamicIcon,{iconKey:"MoreHorizontal"})})})]})})),ba="https://unpkg.com/@sheetxl/scripting-templates/dist",el=a=>{if(a.metadata?.name)return a.metadata.name;let i=(a.path.split("/").pop()||"").replace(/\.[^/.]+$/,"");return a.metadata?.icon==="formula"?i.toUpperCase():(i=i.replace(/([a-z])([A-Z])/g,"$1 $2"),i.replace(/[-_]/g," ").trim().split(/\s+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "))},ya=async a=>{const i=st.IOUtils.relativePath(a,"./manifest.json"),o=await fetch(i);if(!o.ok)throw new Ie.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 Ie.ChainedError(`Failed to retrieve directory at '${a}'`);let r;try{r=JSON.parse(t)}catch(d){throw new Error(`Failed to parse directory: ${d.message}. Ensure the file is valid JSON.`)}const s=r.map(async d=>{try{const u=st.IOUtils.relativePath(a,d.path),l=await fetch(u);if(!l.ok)throw new Error(`Failed to fetch file at '${d.path}': ${l.statusText}`);const c=await l.text();let m=d.metadata;return m?.title||(m={title:el(d),...m}),{path:d.path,content:c,metadata:m}}catch(u){console.error(u.message)}return null});return(await Promise.all(s)).filter(d=>d!==null)},wo={marginRight:"4px"},vo="1em",tl=n.memo(a=>{const{disabled:i,snippet:o,description:t,handleInsert:r,sx:s,...d}=a;let u;const l=o.metadata?.icon;return u=l==="formula"?e.jsx(S.DynamicIcon,{iconKey:"ScriptFormula",size:vo,style:wo}):l==="macro"?e.jsx(S.DynamicIcon,{iconKey:"ScriptMacro",size:vo,style:wo}):e.jsx(S.DynamicIcon,{iconKey:"ScriptAutoStart",size:vo,style:wo}),e.jsx(y.ExhibitMenuItem,{sx:{maxWidth:"460px",display:"flex","*":{lineHeight:"1.2"},...s},disabled:i,icon:u,onMouseDown:c=>{c.button===0&&c.preventDefault()},onMouseUp:c=>{c.button===0&&r(o)},onKeyDown:c=>{c.keyCode!==S.KeyCodes.Enter&&c.keyCode!==S.KeyCodes.Space||r(o)},...d,children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden"},children:[e.jsx(T.Typography,{component:"div",children:o.metadata?.title??o.path}),e.jsx(T.Typography,{variant:"caption",component:"div",sx:{color:c=>Me.alpha(c.palette.text.secondary??c.palette.text.primary,.6),overflow:"hidden",textOverflow:"ellipsis"},children:o.metadata?.summary})]})})}),ol=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,scriptPath:d=ba,...u}=a,[l,c]=n.useState([]),[m,x]=n.useState(!0),g=S.useCommands(o,["executeSelectedScript"]),p=g[0]?.context?.();n.useEffect(()=>{(async()=>{try{const b=await ya(d);c(b)}catch{}finally{x(!1)}})()},[d]);const f=n.useCallback((b,k)=>{if(m)return e.jsx("div",{children:"Loading..."});const C={variant:S.CommandButtonType.Menuitem,commandHook:t,scope:"scripts",disabled:s},h=v=>{p.getEditor()?.insertSnippet(v.content),b.closeFloat()},w=[];for(let v=0;v<l.length;v++){const P=l[v];P&&w.push(e.jsx(tl,{handleInsert:h,snippet:P},P.path))}const E=e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[w.length>0?e.jsxs(e.Fragment,{children:[e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:w}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...C,key:"help",command:o.getCommand("help")})]});return y.defaultCreatePopupPanel({...b,children:E})},[s,t,r,m,p]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,disabled:s,commandHook:t,scope:r,label:"Insert Script",tooltip:"Inserts a script from a set of templates.",createPopupPanel:f,icon:"ScriptNew",...u})})),Ca=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=S.useCallbackRef(u=>{const{commandButtonProps:l,commandPopupProps:c}=u;return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flex:"1 1 100%"},children:[e.jsx("div",{children:e.jsx(Ft,{parentFloat:t,style:{},children:e.jsx(y.CommandButton,{...l,command:o?.getCommand("saveScripts")})})}),e.jsx("div",{style:{flex:"1 1 100%"}}),e.jsx("div",{children:e.jsx(Ft,{parentFloat:t,style:{},children:e.jsx(ol,{...l,commands:o})})})]})})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));Ca.displayName="ScriptEditorToolbar";const Sa=n.memo(n.forwardRef((a,i)=>{const{scriptPath:o=ba,onScriptSelect:t,sx:r=S.ReactUtils.EmptyCssProperties,className:s,buttonMinWidth:d=210,buttonMinHeight:u=80,gap:l=12,...c}=a,[m,x]=n.useState([]),[g,p]=n.useState(!0),[f,b]=n.useState(null);if(n.useEffect(()=>{(async()=>{const h=[{path:null,metadata:{title:"Blank Template...",summary:"Start with an empty script."},content:""}];try{p(!0),b(null);const w=await ya(o);for(let E=0;E<w.length;E++){const v=w[E];v&&h.push(v)}}catch(w){b(w instanceof Error?w.message:"Failed to load scripts"),w instanceof Ie.ChainedError||console.error("Error loading scripts:",w)}finally{x(h),p(!1)}})()},[o]),g)return e.jsx(T.Box,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",className:pe(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`,...r},...c,children:e.jsx(T.CircularProgress,{})});let k=null;f&&(k=e.jsxs(T.Box,{display:"flex",justifyContent:"center",alignItems:"center",className:pe(s,"script-select","error-results"),sx:{background:h=>h.palette.error.light,flex:"0",zIndex:1e3,flexDirection:"column",padding:h=>h.spacing(1),border:h=>`1px solid ${h.palette.error.main}`,borderBottomLeftRadius:1,borderBottomRightRadius:1,backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`},...c,children:[e.jsx(T.Typography,{color:"error",variant:"h6",component:"div",gutterBottom:!0,children:"Error loading Templates"}),e.jsx(T.Typography,{color:"error",component:"div",children:f})]}));const C=h=>{const w=h.metadata?.icon;return w==="macro"?e.jsx(S.DynamicIcon,{iconKey:"ScriptMacro",size:"1em"}):w==="formula"?e.jsx(S.DynamicIcon,{iconKey:"ScriptFormula",size:"1em"}):w==="autostart"?e.jsx(S.DynamicIcon,{iconKey:"ScriptAutoStart",size:"1em"}):null};return e.jsxs(T.Box,{ref:i,className:pe(s,"script-select"),sx:{background:h=>h.palette.background.paper,zIndex:1e3,backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`,...r},...c,children:[e.jsxs(T.Box,{p:3,className:"script-select-content",sx:{overflow:"auto",flex:"1 1 auto"},children:[e.jsx(T.Typography,{variant:"h6",gutterBottom:!0,children:"Script Template"}),e.jsx(T.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Choose from a template to provide a starting point to automate tasks or create user defined functions."}),e.jsx(T.Typography,{variant:"body2",component:"div",color:"text.secondary",gutterBottom:!0,children:"Templates provide a foundation to customize and meet your specific needs."}),e.jsx(T.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${d}px, 1fr))`,gap:`${l}px`,padding:2,paddingLeft:"0px",paddingRight:"0px"},children:m.map((h,w)=>e.jsxs(T.Button,{variant:"outlined",sx:{minWidth:d,minHeight:u,display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",textAlign:"left",padding:2,textTransform:"none",overflow:"hidden",...w===0&&{borderStyle:"dashed",marginBottom:"8px"},...w===1&&{gridColumn:"1"}},onClick:()=>t?.(h),children:[e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:.5},children:[e.jsx(T.Typography,{variant:"subtitle2",component:"div",children:h.metadata?.title||h.path.split("/").pop()?.replace(/\.\w+$/,"")||"Untitled"}),C(h)]}),h.metadata?.summary&&e.jsx(T.Typography,{variant:"body2",component:"div",color:"text.secondary",sx:{overflow:"hidden",display:"flex",flexDirection:"column",textOverflow:"ellipsis",alignItems:"flex-start"},children:h.metadata.summary})]},`${h.path}-${w}`))})]}),k]})}));Sa.displayName="TemplateSelectPanel";const ka=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,editorProps:r,commands:s,readOnly:d=!1,frame:u,autoFocusSel:l,autoFocus:c=!0,scripts:m,...x}=a,g=Y.useTheme(),[p,f]=n.useState(!1),b=n.useRef(!1),[k,C]=n.useState({message:"Loading",cursor:"",dirty:!1}),[h,w]=n.useState(null);n.useEffect(()=>{let z=!1;return w(null),(async function(){if(m&&(await m.start(),!z)){const D=m.getModules().getItems()[0]?.getSource();w({source:D||null})}})(),()=>{z=!0}},[m]);const E=n.useCallback(z=>{C(D=>({...D,...z}))},[]),v=n.useRef(null),[P,R]=n.useState(null),M=n.useRef(null),N=S.useCallbackRef(z=>{if(P)return P.focus(z),!0;if(l){const D=v.current?.querySelectorAll?.(l);if(D&&D.length>0)return D[0]?.focus?.(z),!0}return v.current?.focus?.(z),!1},[P,l,c]),A=n.useMemo(()=>e.jsx(y.LoadingPanel,{transitionDelay:"160ms",style:{position:"absolute",width:"100%",height:"100%"},transparentBackground:!1}),[]),j=n.useMemo(()=>e.jsx(T.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(Ca,{commands:s})}),[g,s]),B=n.useMemo(()=>e.jsx(T.Box,{className:pe("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 ${g.palette.divider}`},children:e.jsxs("div",{style:{flex:"1 1 100%",display:"flex",alignItems:"center",flexDirection:"row",justifyContent:"center"},children:[e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"1 1 100%",color:z=>z.palette.text.secondary},variant:"caption",children:k.message}),e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",color:z=>z.palette.text.secondary},variant:"caption",children:k.dirty?"Unsaved":""}),e.jsx(T.Typography,{component:"div",sx:{userSelect:"none",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",flex:"none",marginLeft:"8px",minWidth:"90px",display:"flex",justifyContent:"end",color:z=>z.palette.text.secondary},variant:"caption",children:k.cursor})]})}),[k]),I=n.useMemo(()=>e.jsxs(T.Box,{className:pe("script-editor-content"),sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"column",boxSizing:"border-box"},children:[j,e.jsx(T.Box,{sx:{display:"flex",flex:"1 1 100%",width:"100%",flexDirection:"row",position:"relative",boxSizing:"border-box"},children:e.jsx(ae.ScriptEditor,{ref:v,loadingPanel:A,readOnly:d,frame:u,autoFocus:c,commands:s,onStatusChange:E,darkMode:g.palette.mode==="dark",...r})}),B]}),[g,s,j,B,p,A,d,r,c,l,u,E]),H=n.useMemo(()=>{let z;return h===null?null:(h.source===null&&(z=e.jsx(Sa,{sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",position:"absolute",boxSizing:"border-box",width:"100%",height:"100%"},onScriptSelect:D=>{v.current?.getEditor()?.insertSnippet(D.content),w({source:D.content??""})}})),e.jsx(T.Box,{tabIndex:0,className:pe("script-workspace",o),sx:{display:"flex",flex:"1 1 100%",flexDirection:"column",overflow:"hidden",alignItems:"stretch",userSelect:"none",flexGrow:0,outline:"none"},onPointerDown:D=>{D.isDefaultPrevented()||v.current?.focus()},children:e.jsxs(T.Box,{sx:{flex:"1 1 100%",position:"relative",display:"flex"},children:[I,z]})}))},[j,I,o,h]),O=S.useImperativeElement(i,()=>({isScriptWorkspaceElement:()=>!0,focus:z=>{N(z)}}),[]);return e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 100%",position:"relative",...t},ref:O,...x,onFocus:z=>{f(!0),b.current=!0,O.current?.contains(z.target)&&z.target!==O.current&&R(z.target),z.relatedTarget&&!M.current&&(M.current=z.relatedTarget),x?.onFocus?.(z)},onBlur:z=>{O?.current?.contains(z.relatedTarget)||O?.current===z.relatedTarget||(M.current=null,b.current=!1,f(!1)),x?.onBlur?.(z)},children:H})}));ka.displayName="ScriptWorkspace";const nl=(a,i)=>{const{model:o,commands:t,entryKey:r,frame:s,...d}=a;return e.jsx(ka,{ref:i,readOnly:!1,commands:t,frame:s,scripts:o?.getScripts(),...d})},wa=n.memo(n.forwardRef((a,i)=>{const{commands:o,...t}=a,r=S.useCommands(o,["executeScript","showScriptEditor"]),[s,d]=n.useState([]),[u,l]=n.useState(!1),c=r[0]?.context?.();n.useEffect(()=>{const f=c?.getScripts();f&&(async()=>{l(!0);const b=await f.searchFunctions({type:"macro"});d(b),l(!1)})()},[]);const m={variant:S.CommandButtonType.Menuitem,parentFloat:a.floatReference,scope:"scripts",shortcut:null},x=[],g=s.length;for(let f=0;f<g;f++){const b=s[f];x.push(e.jsx(y.CommandButton,{...m,command:o.getCommand("executeScript"),commandState:{declaration:b},tooltipProps:{description:`Execute ${b.getName()??"macro"}`},icon:e.jsx(S.DynamicIcon,{iconKey:"ScriptMacro"}),label:b.getName()??`Script '${b.getName()}'`},`macro-${b.getName()}-${f}`))}const p=e.jsxs(T.Box,{ref:i,sx:{display:"flex",flexDirection:"column",flex:"1 1 100%",overflow:"hidden"},children:[x.length>0?e.jsxs(e.Fragment,{children:[e.jsx(T.Box,{sx:{overflow:"auto",flex:"1 1 100%"},children:x}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"})]}):null,n.createElement(y.CommandButton,{...m,key:"show-editor",command:o.getCommand("showScriptEditor")})]});return y.defaultCreatePopupPanel({...t,children:p})}));wa.displayName="RunScriptPopupPanel";const va=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r,disabled:s=!1,...d}=a,u="showScriptEditor",l=S.useCommands(o,["executeScript","showScriptEditor"])[0].context(),c=n.useCallback((m,x)=>{const g=e.jsx(wa,{...m,commands:x});return y.defaultCreatePopupPanel({...m,children:g})},[s,l,t,r]);return e.jsx(y.CommandPopupButton,{ref:i,commands:o,commandHook:t,createPopupPanel:c,selected:o.getCommand(u).state(),label:"Macros",tooltip:"Run or manage macros.",quickCommand:u,...d})})),rl=a=>e.jsx(y.CommandButton,{...a}),ja=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,[d,u]=n.useState(!1),l=S.useCommands(o,["executeScript","showScriptEditor"]),c=l[0]?.context?.();n.useEffect(()=>{const g=c?.getScripts();if(!g)return;const p=l[1],f=async()=>{if(!p)return;let C=!1;if(!p.state()){const h=await g.searchFunctions({type:"macro"}),w=h?.length??0;for(let E=0;h&&!C&&E<w;E++)C=!0}u(C||!!p.state())};f();const b=p.addPropertyListener(()=>{f()}),k=g.addListeners({onChange:()=>{f()}});return()=>{k(),b()}},[c]);const m=ae.useTaskPaneArea(),x=n.useCallback(g=>{const{commandButtonProps:p,commandPopupProps:f}=g,b=ae.DefaultTaskPaneRegistry.findContributions("ribbon/home");let k;const C=b.length;if(C>0){k=[];for(let R=0;R<C;R++){const M=b[R],N=M.createCommand?.(m);if(!N)continue;const A={command:N,...f},j=(M.createCommandButton??rl)(A);k.push(j)}}const h=e.jsx(pt,{...f,command:o.getCommand("formatFontColor"),icon:e.jsx(S.DynamicIcon,{iconKey:"text.colored"}),isSplit:!0,panelProps:{disableAlpha:!0}}),w=e.jsx(pt,{...f,command:o.getCommand("formatFillColor"),icon:e.jsx(S.DynamicIcon,{iconKey:"fill.colored"}),isSplit:!0,panelProps:{disableAlpha:!0,autoColorLabel:"No Fill",autoColorPosition:ut.End}}),E=o.getCommand("undo")?e.jsx(e.Fragment,{children:e.jsx(Ko,{...f,quickCommand:"undo"})}):null,v=o.getCommand("find")?e.jsx(e.Fragment,{children:e.jsx(Dr,{...f})}):null;let P=null;return d&&(P=e.jsxs(e.Fragment,{children:[e.jsx(y.ExhibitDivider,{}),e.jsx(va,{...f})]})),e.jsxs(Ft,{parentFloat:t,children:[E,null,E?e.jsx(y.ExhibitDivider,{}):null,e.jsx(_o,{...f,command:o.getCommand("paste")}),e.jsx(y.CommandButton,{...p,command:o.getCommand("formatPainterToggle")}),e.jsx(lo,{...p,command:o.getCommand("copy")}),e.jsx(y.ExhibitDivider,{}),e.jsx(Lr,{...f,command:o.getCommand("formatFontFamily")}),e.jsx(Fr,{...f,command:o.getCommand("formatFontSize")}),e.jsx(y.CommandButton,{...p,command:o.getCommand("formatBoldToggle")}),e.jsx(y.CommandButton,{...p,command:o.getCommand("formatItalicToggle")}),e.jsx(zr,{...f}),e.jsx(Hr,{...f}),e.jsx(Pr,{...f}),w,h,e.jsx(y.ExhibitDivider,{}),e.jsx(Cr,{...f}),e.jsx(Sr,{...f}),e.jsx(wr,{...f}),e.jsx(kr,{...f}),e.jsx(Rr,{...f}),e.jsx(y.ExhibitDivider,{}),e.jsx(Ir,{...f}),e.jsx(Kr,{command:o.getCommand("formatCellStyle"),...f}),e.jsx(Gr,{command:o.getCommand("formatTableStyle"),...f}),e.jsx(y.ExhibitDivider,{}),e.jsx(Wo,{...f}),e.jsx($o,{...f}),e.jsx(y.ExhibitDivider,{}),e.jsx(Nr,{...f}),null,e.jsx(zo,{...f}),e.jsx(Vo,{...f}),v,P,k]})},[o,l,d,m]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:x,...s})}));ja.displayName="HomeToolbar";const Ea=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=S.useCallbackRef(u=>{const{commandButtonProps:l,commandPopupProps:c}=u;return e.jsxs(Ft,{parentFloat:t,children:[e.jsx(y.CommandButton,{...l,command:o.getCommand("insertTable")}),e.jsx(Uo,{...c}),null,e.jsx(y.CommandButton,{...l,command:o.getCommand("updateHyperlink")}),e.jsx(y.CommandButton,{...l,command:o.getCommand("updateComments")})]})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));Ea.displayName="InsertToolbar";const Ta=n.memo(n.forwardRef((a,i)=>{const{commands:o,parentFloat:t,commandButtonProps:r,...s}=a,d=S.useCallbackRef(u=>{const{commandButtonProps:l,commandPopupProps:c}=u;return e.jsxs(Ft,{parentFloat:t,children:[e.jsx(Mr,{...c}),e.jsx(y.CommandButton,{...l,command:o.getCommand("protectionSheetToggle")}),e.jsx(y.ExhibitDivider,{}),e.jsx(Or,{...c}),e.jsx(Wr,{...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...l,command:o.getCommand("sheetViewToggleFormulaView"),scope:"view"}),e.jsx(y.CommandButton,{...l,command:o.getCommand("sheetViewToggleShowZeros"),scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx($r,{...c}),e.jsx(Qr,{command:o.getCommand("selectTheme"),...c}),e.jsx(y.ExhibitDivider,{}),e.jsx(va,{...c,scope:"view"}),e.jsx(y.ExhibitDivider,{}),e.jsx(y.CommandButton,{...l,command:o.getCommand("fullScreenToggle"),scope:"view"})]})},[o]);return e.jsx(y.CommandToolbar,{ref:i,commands:o,parentFloat:t,commandButtonProps:r,createToolbarPalette:d,...s})}));Ta.displayName="ViewToolbar";const Ba=a=>e.jsx(Pa,{...a}),al=n.memo(a=>{const{sx:i,...o}=a;return e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",position:"relative","&:hover:not([disabled]) .indicator":{borderBottom:t=>`${Y.alpha(t.palette.primary.main,.35)} solid 2px`}},children:[e.jsx(T.Tab,{disableRipple:!0,onMouseDown:t=>{t.button===0&&t.preventDefault()},sx:{textTransform:"none",flex:"1 1 100%",fontWeight:t=>t.typography.fontWeightRegular,padding:"2px 6px",minHeight:"0px",minWidth:"0px",marginRight:t=>t.spacing(.5),"&.Mui-selected":{},"&.Mui-focusVisible":{},...i},...o}),e.jsx(T.Box,{className:"indicator",sx:{width:"90%",borderRadius:"4px",minWidth:"4px",position:"absolute",bottom:"0",alignSelf:"center",display:"flex"}})]})}),il=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,sx:r,...s}=a,d=n.useMemo(()=>{const u=[];for(let l=0;l<i.length;l++)u.push(e.jsx(al,{label:i[l].label},i[l].label));return u},[i]);return e.jsx(T.Tabs,{value:o,onChange:(u,l)=>{t?.(l)},variant:"scrollable",scrollButtons:!1,sx:{paddingLeft:u=>u.spacing(1.5),paddingRight:u=>u.spacing(1.5),paddingTop:u=>u.spacing(0),paddingBottom:u=>u.spacing(0),minHeight:"26px",alignItems:"center","& .MuiTabs-indicator":{display:"flex",justifyContent:"center",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{width:"90%",borderRadius:"4px",minWidth:"4px",backgroundColor:u=>u.palette.primary.main},"& .MuiTab-root":{marginRight:"0px"},...r},slotProps:{indicator:{children:e.jsx("span",{className:"MuiTabs-indicatorSpan"})}},...s,children:d})}),ll=n.memo(a=>{const{toolbars:i,value:o,onToolbarChange:t,selectProps:r,...s}=a,d=n.useCallback(l=>{t?.(l.target.value)},[t]),u=n.useMemo(()=>{const l=[];for(let c=0;c<i.length;c++){const m=i[c].label;l.push(e.jsx(T.MenuItem,{value:c,sx:{color:x=>{if(o===c)return x.palette.primary.main}},children:m},m))}return l},[i,o]);return e.jsx(T.FormControl,{sx:{minWidth:"125px",maxWidth:"125px","& .MuiInputBase-root":{paddingLeft:"0px",paddingRight:"0px"},"& .MuiSelect-select":{paddingTop:l=>l.spacing(.5),paddingBottom:l=>l.spacing(.5),paddingLeft:l=>l.spacing(2),color:l=>l.palette.primary.main},"& .MuiSelect-icon":{fill:l=>l.palette.text.icon??l.palette.action.active,"&:hover:not(.Mui-disabled)":{color:l=>l.palette.text.icon??l.palette.action.active}},...r},size:"small",children:e.jsx(T.Select,{value:o,onChange:d,variant:"outlined",sx:{backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`},...s,children:u})})}),Pa=n.memo(n.forwardRef((a,i)=>{const{commands:o,selectWrapper:t,selectProps:r={},renderCompact:s=!1,paletteWrapper:d,toolbarsProps:u,paletteProps:l={},workbook:c,sx:m,...x}=a,g=n.useMemo(()=>{const v=[],{ref:P,...R}=u?.Home||{};v.push({label:"Home",component:e.jsx(ja,{commands:o,...R})});const{ref:M,...N}=u?.Insert||{};v.push({label:"Insert",component:e.jsx(Ea,{commands:o,...N})});const{ref:A,...j}=u?.View||{};return v.push({label:"View",component:e.jsx(Ta,{commands:o,...j})}),v},[o,c]),p=n.useMemo(()=>{const v=[];for(let P=0;P<g.length;P++)v.push(n.cloneElement(g[P].component,{...g[P].component.props,key:g[P].key??g[P].label}));return v},[g]),[f,b]=n.useState(0),k=v=>{b(v)},C=n.useMemo(()=>s?e.jsx(ll,{toolbars:g,value:f,onToolbarChange:k,sx:r}):e.jsx(il,{toolbars:g,value:f,onToolbarChange:k,sx:r}),[g,f,r,s]),{sx:h,...w}=l,E=e.jsx(T.Paper,{elevation:2,tabIndex:0,sx:{display:"flex",alignItems:"center",userSelect:"none",flexGrow:1,borderRadius:"8px",backgroundImage:`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`,marginLeft:v=>v.spacing(1),marginRight:v=>v.spacing(1),marginTop:v=>v.spacing(.5),marginBottom:v=>v.spacing(.5),...h},...w,children:p[f]});return e.jsxs(T.Box,{ref:i,className:"toolbarWrappers",sx:{display:"flex",flexDirection:"column",paddingTop:v=>v.spacing(.5),"*":{userSelect:"none"},...m},...x,children:[t?t(C):C,d?d(E):E]})}));var Jn,er;Pa.displayName="WorkbookToolbars",(function(){if(er)return Jn;er=1;var a=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,t=/^0o[0-7]+$/i,r=parseInt,s=typeof ct=="object"&&ct&&ct.Object===Object&&ct,d=typeof self=="object"&&self&&self.Object===Object&&self,u=s||d||Function("return this")(),l=Object.prototype.toString,c=Math.max,m=Math.min,x=function(){return u.Date.now()};function g(f){var b=typeof f;return!!f&&(b=="object"||b=="function")}function p(f){if(typeof f=="number")return f;if((function(C){return typeof C=="symbol"||(function(h){return!!h&&typeof h=="object"})(C)&&l.call(C)=="[object Symbol]"})(f))return NaN;if(g(f)){var b=typeof f.valueOf=="function"?f.valueOf():f;f=g(b)?b+"":b}if(typeof f!="string")return f===0?f:+f;f=f.replace(a,"");var k=o.test(f);return k||t.test(f)?r(f.slice(2),k?2:8):i.test(f)?NaN:+f}Jn=function(f,b,k){var C,h,w,E,v,P,R=0,M=!1,N=!1,A=!0;if(typeof f!="function")throw new TypeError("Expected a function");function j(z){var D=C,W=h;return C=h=void 0,R=z,E=f.apply(W,D)}function B(z){var D=z-P;return P===void 0||D>=b||D<0||N&&z-R>=w}function I(){var z=x();if(B(z))return H(z);v=setTimeout(I,(function(D){var W=b-(D-P);return N?m(W,w-(D-R)):W})(z))}function H(z){return v=void 0,A&&C?j(z):(C=h=void 0,E)}function O(){var z=x(),D=B(z);if(C=arguments,h=this,P=z,D){if(v===void 0)return(function(W){return R=W,v=setTimeout(I,b),M?j(W):E})(P);if(N)return v=setTimeout(I,b),j(P)}return v===void 0&&(v=setTimeout(I,b)),E}return b=p(b)||0,g(k)&&(M=!!k.leading,w=(N="maxWait"in k)?c(p(k.maxWait)||0,b):w,A="trailing"in k?!!k.trailing:A),O.cancel=function(){v!==void 0&&clearTimeout(v),R=0,C=P=h=v=void 0},O.flush=function(){return v===void 0?E:H(x())},O}})();var tr,or,nr={exports:{}},jo={};or||(or=1,nr.exports=(function(){if(tr)return jo;tr=1;var a=n,i=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},o=a.useState,t=a.useEffect,r=a.useLayoutEffect,s=a.useDebugValue;function d(l){var c=l.getSnapshot;l=l.value;try{var m=c();return!i(l,m)}catch{return!0}}var u=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,c){return c()}:function(l,c){var m=c(),x=o({inst:{value:m,getSnapshot:c}}),g=x[0].inst,p=x[1];return r(function(){g.value=m,g.getSnapshot=c,d(g)&&p({inst:g})},[l,m,c]),t(function(){return d(g)&&p({inst:g}),l(function(){d(g)&&p({inst:g})})},[l]),s(m),m};return jo.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:u,jo})()),nr.exports;var rr,ar,Et={exports:{}},lt={exports:{}},sl=lt.exports;(function(){if(ar)return Et.exports;ar=1;for(var a=(rr||(rr=1,function(){var x,g,p,f,b,k;typeof performance<"u"&&performance!==null&&performance.now?lt.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(lt.exports=function(){return(x()-b)/1e6},g=process.hrtime,f=(x=function(){var C;return 1e9*(C=g())[0]+C[1]})(),k=1e9*process.uptime(),b=f-k):Date.now?(lt.exports=function(){return Date.now()-p},p=Date.now()):(lt.exports=function(){return new Date().getTime()-p},p=new Date().getTime())}.call(sl)),lt.exports),i=typeof window>"u"?ct:window,o=["moz","webkit"],t="AnimationFrame",r=i["request"+t],s=i["cancel"+t]||i["cancelRequest"+t],d=0;!r&&d<o.length;d++)r=i[o[d]+"Request"+t],s=i[o[d]+"Cancel"+t]||i[o[d]+"CancelRequest"+t];if(!r||!s){var u=0,l=0,c=[],m=1e3/60;r=function(x){if(c.length===0){var g=a(),p=Math.max(0,m-(g-u));u=p+g,setTimeout(function(){var f=c.slice(0);c.length=0;for(var b=0;b<f.length;b++)if(!f[b].cancelled)try{f[b].callback(u)}catch(k){setTimeout(function(){throw k},0)}},Math.round(p))}return c.push({handle:++l,callback:x,cancelled:!1}),l},s=function(x){for(var g=0;g<c.length;g++)c[g].handle===x&&(c[g].cancelled=!0)}}Et.exports=function(x){return r.call(i,x)},Et.exports.cancel=function(){s.apply(i,arguments)},Et.exports.polyfill=function(x){x||(x=i),x.requestAnimationFrame=r,x.cancelAnimationFrame=s},Et.exports})();var Oe={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 i=this.getEventsNames();return i?a==="change"?i[0]:i[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,i){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,i)},exitFullscreen(){if(typeof document>"u")throw new Error(this.DOM_UNAVAILABLE_ERROR);const a=document,i=a.exitFullscreen||a.webkitExitFullscreen||a.webkitCancelFullScreen||a.mozCancelFullScreen||a.msExitFullscreen;if(!i)throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);return i.call(a)},on(a,i){const o=this.getEventName(a);o&&document.addEventListener(o,i)},off(a,i){const o=this.getEventName(a);o&&document.removeEventListener(o,i)}};const Ra=a=>{const{workbook:i,workbookElement:o,target:t,commands:r,darkMode:s,onNewWorkbook:d=Ma}=a,u=S.useNotifier(),[l,c]=n.useState(i?.getSelectedSheet()),[m,x]=n.useState(i?.getSheets().getItems()),g=S.useCallbackRef(d,[d]),p=ae.useTaskPaneArea(),f=n.useMemo(()=>[new S.SimpleCommand("activateTask",t,{label:"Activate Task",description:"Activate Task Pane.",shortcut:{key:"F6"}}),new S.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}}),new S.SimpleCommand("workbookStatistics",t,{label:"Workbook Statistics",description:"Show the workbook statistics.",shortcut:{key:"G",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}}),new S.SimpleCommand("showFormat",t,{label:"Show Format",description:"Open the format pane.",shortcut:{key:"F",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}}),new S.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 S.Command("deleteCellStyle",t,{label:"Delete Cell Style",scopedLabels:{cellStyle:"Delete"},description:"Remove a named style that is no longer needed."}),new S.Command("modifyCellStyle",t,{label:"Modify Cell Style",scopedLabels:{cellStyle:"Modify"},description:"Update a style with the currently style."}),new S.SimpleCommand("find",t,{label:"Find",description:"Open the Find window.",icon:"Find",shortcut:[{key:"F",modifiers:[S.KeyModifiers.Ctrl]},{key:"F5",modifiers:[S.KeyModifiers.Shift]}]}),new S.SimpleCommand("findReplace",t,{label:"Find & Replace",description:"Open the Find & Replace window.",icon:"FindReplace",shortcut:[{key:"H",modifiers:[S.KeyModifiers.Ctrl]},{key:"H",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Alt]}]}),new S.SimpleCommand("goto",t,{label:"Go To",description:"Open the 'Go To' window.",icon:"Goto",shortcut:[{key:"G",modifiers:[S.KeyModifiers.Ctrl]}]}),new S.SimpleCommand("workbookViewToggleExpandFormulaBar",t,{label:"Toggle Expand Formula bar",description:"Expand or collapse the formula bar.",shortcut:{key:"U",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}}),new S.SimpleCommand("workbookViewToggleShowFormulaBar",t,{label:"View Formula bar",scopedLabels:{view:"Formula Bar"},description:"Show or hide the formula bar."}),new S.SimpleCommand("workbookViewToggleShowTabs",t,{label:"View Sheet Tabs",description:"Show or hide the sheet tabs.",scopedLabels:{view:"Sheet Tabs"}}),new S.SimpleCommand("workbookViewToggleShowStatusBar",t,{label:"View Status Bar",description:"Show or hide the status bar.",scopedLabels:{view:"Status Bar"}}),new S.SimpleCommand("workbookViewToggleShowHorizontalScrollBar",t,{label:"View Horizontal Scrollbar",description:"Show or hide the horizontal scrollbar.",scopedLabels:{view:"Horizontal Scrollbar"}}),new S.SimpleCommand("workbookViewToggleShowVerticalScrollBar",t,{label:"View Vertical Scrollbar",description:"Show or hide the vertical scrollbar.",scopedLabels:{view:"Vertical Scrollbar"}}),new S.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 S.Command("deleteSheet",t,{label:"Delete Sheet",scopedLabels:{sheet:"Delete"},description:"Delete the sheet and all the data."}),new S.Command("addSheet",t,{label:"Insert Sheet",scopedLabels:{sheet:"Insert"},description:"Insert sheet before the current sheet.",shortcut:[{key:"F11",modifiers:[S.KeyModifiers.Shift]},{key:"F1",modifiers:[S.KeyModifiers.Alt,S.KeyModifiers.Shift]}]}),new S.Command("duplicateSheet",t,{label:"Duplicate Sheet",description:"Duplicate the current sheet.",scopedLabels:{sheet:"Duplicate"}}),new S.Command("nextSheet",t,{label:"Next Sheet",scopedLabels:{sheet:"Next"},description:"Activate the next sheet.",shortcut:[{key:"PageDown",modifiers:[S.KeyModifiers.Ctrl]}]}),new S.Command("previousSheet",t,{label:"Previous Sheet",scopedLabels:{sheet:"Previous"},description:"Activate the previous sheet.",shortcut:[{key:"PageUp",modifiers:[S.KeyModifiers.Ctrl]}]}),new S.Command("selectNextSheet",t,{label:"Select Next Sheet",scopedLabels:{sheet:"Select Next"},description:"Select the next sheet.",shortcut:[{key:"PageDown",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}]}),new S.Command("selectPreviousSheet",t,{label:"Select Previous Sheet",scopedLabels:{sheet:"Select Previous"},description:"Select the previous sheet.",shortcut:[{key:"PageUp",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}]}),new S.Command("selectTheme",t,{label:"Theme",description:"Select a theme that coveys a style suitable for your data."}),new S.Command("selectNamed",t,{label:j=>j?.getName()??"Select Named Item",scopedLabels:{namedItem:j=>j?.getName()??"Select"},description:"Select the item."}),new S.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:"NamedRangeInsert"}),new S.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 S.Command("deleteNamedReference",t,{label:"Delete Named Reference",scopedLabels:{namedItem:"Delete"},description:"Remove the named reference.",icon:"NamedRangeRemove"}),new S.SimpleCommand("activeNameBox",t,{label:"Activate Name Box",description:"Move the focus to the name box.",shortcut:{key:"F3",modifiers:[S.KeyModifiers.Alt]}}),new S.SimpleCommand("createNamedReferenceFromSelection",t,{label:"Create from Selection",description:"Automatically generate names from the selected cells.",shortcut:{key:"F3",modifiers:[S.KeyModifiers.Ctrl,S.KeyModifiers.Shift]}}),new S.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:[S.KeyModifiers.Ctrl]}}),new S.Command("fullScreenToggle",t,{label:"FullScreen",description:"Toggle showing the workbook using the full screen.",shortcut:{key:"F11"},icon:"FullScreen"}),new S.Command("showScriptEditor",t,{label:"Scripts",scopedLabels:{scripts:"Script Editor…"},description:"Show the script editor.",icon:"ScriptRun",shortcut:[{key:"F11",modifiers:[S.KeyModifiers.Alt]}]}),new S.Command("executeScript",t,{label:"Run Script",description:"Run the selected or last executed script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new S.Command("executeSelectedScript",t,{label:"Run Script",description:"Run the selected script.",icon:"ScriptRun",shortcut:{key:"F8"}}),new S.Command("saveScripts",t,{label:"Save Script",description:"Save the current scripts.",icon:"ScriptSave"}),new S.Command("maximumWorkbookToggle",t,{label:"Maximize",description:"Toggle showing the workbook maximized.",shortcut:{key:"F10",modifiers:[S.KeyModifiers.Ctrl]}}),new S.Command("spellCheck",t,{label:"Spell Check",description:"Check the workbook for spelling mistakes.",shortcut:{key:"F7"}}),new S.Command("calculateAll",t,{label:"Calculate Now",description:"Recalculate all formulas.",icon:"Calculate",shortcut:{key:"F9"}}),new S.SimpleCommand("closeWorkbook",t,{label:"Close Workbook",description:"Close the workbook.",shortcut:{key:"W",modifiers:[S.KeyModifiers.Ctrl]}}),new S.SimpleCommand("newWorkbook",t,{label:"New Workbook",description:"Create a new workbook in another tab.",icon:"FileNew"})],[]),b=n.useMemo(()=>{let j=null;return j=r?r.createChildGroup(t,"workbook",!1):new S.CommandGroup(t,"workbook"),j.addCommands(f,!0),j},[r,f]),k=S.useEditMode(),C=n.useRef(null),h=S.useCallbackRef(()=>{let j,B=null;const I=b.getCommand("executeScript");if(I.update({disabled:!1,context:{getScripts:()=>i.getScripts()}}),!I)return;const H=b.getCommand("showScriptEditor");H.updateCallback(function(D=!0){B?B.close():p.activateTaskPane("scriptEditor",{})});const O=b.getCommand("executeSelectedScript");if(!O)return;const z={saveSource:async D=>{let W=null,U=null;const q=i.getScripts();try{D&&(U=await u.showBusy("Saving Scripts..."),W=await q.createModule({source:D})),q.addModule("scripts",W,{replace:!0}),U?.()}catch(G){U?.(),console.warn("Unable to compile",G),u.showError(G)}return W},addContainerListener:D=>(w.current=D,()=>{w.current=null}),setSelectedFunction:D=>{j=D??C.current??null,Promise.resolve(j).then(W=>{O.update({disabled:W===null})})},quickInsertFunction:D=>{const W=`=${D.toUpperCase()}(`,U={text:W+")",editMode:!0,initialSelection:{start:W.length,end:W.length+0}};k.setMode(q=>q?.key==="edit"?{...q,args:{...q.args}}:{key:"edit",args:{stateAndCoords:null,start:U}})},getSelectedFunction:()=>j,setEditor:D=>{B=D??null,H.update({state:B!==null})},getEditor:()=>B,getRanges:D=>{try{return i.getRanges(D)}catch{}return null},getScripts:()=>i.getScripts()};O.update({context:z})},[b,i,o,u]),w=n.useRef(null);ae.useModelListener(i,{onBeforeSave:async()=>{await w.current?.onBeforeSave()},onProtectionChange:()=>{w.current?.onReadonlyChange()},onLoad:()=>{(async()=>(await i.getCalculation().start(),i.getScripts().start(),w.current?.onScriptChange()))()}}),ae.useModelListener(i,{onSheetsChange:j=>{x(j.getSheets().getItems())},onViewChange(j){c(j?.getSelectedSheet())},onProtectionChange:j=>{const B={disabled:!j.getProtection().isStructureAllowed()};b.getCommand("hideSheet").update(B),b.getCommand("deleteSheet").update(B),b.getCommand("addSheet").update(B),b.getCommand("duplicateSheet").update(B),b.getCommand("selectTheme").update(B),b.getCommand("addNamedReference").update(B),b.getCommand("editNamedReference").update(B),b.getCommand("deleteNamedReference").update(B)},onScriptsChange:j=>{h()}});const{isFullscreenAvailable:E,isFullscreenEnabled:v,toggleFullscreen:P}=(function(j={}){const{target:B,onChange:I,onError:H,requestFullScreenOptions:O}=j,[z,D]=n.useState(!1),[W,U]=n.useState(null),[q,G]=n.useState(!1),_=n.useCallback(()=>Oe.requestFullscreen(B?.current||null,O),[B,O]),K=n.useCallback(()=>Oe.exitFullscreen(),[]),J=n.useCallback(()=>Oe.fullscreenElement?K():_(),[_,K]),ee=n.useCallback(ie=>{const ne=Oe.fullscreenElement;U(ne),G(!!ne),I?.(ie)},[I]),F=n.useCallback(ie=>{const ne=Oe.fullscreenElement;U(ne),G(!!ne),H?.(ie)},[H]);return n.useEffect(()=>{D(Oe.fullscreenEnabled)},[]),n.useEffect(()=>(Oe.on("change",ee),Oe.on("error",F),()=>{Oe.off("change",ee),Oe.off("error",F)}),[ee,F]),{isFullscreenAvailable:z,fullscreenElement:W,isFullscreenEnabled:q,enableFullscreen:_,disableFullscreen:K,toggleFullscreen:J}})({target:{current:o??document.body}}),R=ae.useDocThemes();n.useEffect(()=>{b.getCommand("selectTheme").update({state:()=>i.getTheme(),context:()=>({theme:i.getTheme(),themes:R,darkMode:s})})},[i?.getTheme(),s]);const M=S.useCallbackRef(async function(j,B){let I=null;const H=i.getScripts();if(j?.declaration||j?.functionName){const O=j.declaration?j.declaration.getName():j.functionName;(await H.searchFunctions({name:O})).length>0&&(I=O)}if(I)try{await H.executeMacro(I),C.current=Promise.resolve({source:null,name:I})}catch(O){return void u.showError(O)}},[i,u]);n.useEffect(()=>{b.getCommand("newCellStyle").updateCallback(j=>{u.showInputOptions({initialValue:(()=>{let B=0;for(;;){B++;const I=`Style ${B}`;try{return i.getStyles().validateStyleName(I,!0),I}catch{}}})(),title:b.getCommand("newCellStyle")?.label("cellStyle"),description:"Enter a name for the new cell style.",inputLabel:"Style Name",inputProps:{style:{minWidth:"300px"}},options:["Ok","Cancel"],defaultOption:"Ok",onValidateInputOption:async(B,I)=>{let H=null;try{i.getStyles().validateStyleName(B,!1)}catch(D){H=D.message}let O=i.getStyles().getNamed(B),z=H;return!z&&O&&(z=`Update style '${O.getName()}'.`),{valid:H===null,message:z}}}).then(({input:B,option:I})=>{const H=i.getSelectedSheet().getSelectedRange();if(I!=="Ok")return;const O=i.getStyles().setNamed({name:B,style:H.getCell().getStyle()});H.getStyle().update({named:O.getName()})})}),b.getCommand("deleteCellStyle").updateCallback(j=>{j.delete()}),b.getCommand("modifyCellStyle").updateCallback(({named:j})=>{const B=i.getSelectedSheet().getSelectedRange();i.getStyles().setNamed({name:j.getName(),style:B.getCell().getStyle()})}),b.getCommand("hideSheet").updateCallback(j=>{i.getSheetAt(j).setVisibility(L.ISheet.Visibility.Hidden)}),b.getCommand("deleteSheet").updateCallback(async j=>{i.getSheetAt(j??i.getSelectedSheetIndex())?.delete()}),b.getCommand("addSheet").updateCallback(j=>{i.getSheets().add({index:j,autoSelect:!0})}),b.getCommand("duplicateSheet").updateCallback(async j=>{(await i.getSheetAt(j??i.getSelectedSheetIndex())?.duplicate())?.select()}),b.getCommand("nextSheet").updateCallback(j=>{i.getNextSheet(j??i.getSelectedSheetIndex()).select()}),b.getCommand("previousSheet").updateCallback(j=>{i.getPreviousSheet(j??i.getSelectedSheetIndex()).select()}),b.getCommand("selectNextSheet").updateCallback(j=>{i.getNextSheet(j??i.getSelectedSheetIndex()).select()}),b.getCommand("selectPreviousSheet").updateCallback(j=>{i.getPreviousSheet(j??i.getSelectedSheetIndex()).select()}),b.getCommand("selectTheme").updateCallback(j=>{i.setTheme(j)}),b.getCommand("calculateAll").updateCallback(()=>{i.getSelectedSheet().getEntireRange().calculate(!0)}),b.getCommand("closeWorkbook").updateCallback(async()=>{await u.showOptions({title:"Confirm",description:"This will close the current workbook tab. Do you want to continue?",options:["Close","Cancel"],defaultOption:"Close"})==="Close"&&window.close()}),b.getCommand("newWorkbook").updateCallback(()=>{g?.()}),b.getCommand("executeScript").updateCallback(M),b.getCommand("executeSelectedScript").updateCallback(M)},[i,u]);const N=S.useCallbackRef(async j=>{let B=0,I=null,H="Find & Replace";j?.replace&&!j?.replaceOptions?.maxCount&&(H="Replace All");const O=await u.showBusy(H);try{const z=j?.scope??"sheet";let D=null;const W=i.getSelectedSheet(),U={from:W.getSelectedCell(),...j.findOptions};if(D=z==="sheet"?i.getSelectedSheet().find(j.findText,U):i.find(j.findText,U),j.replace){const q=i.replace(D,j.replaceText,j.replaceOptions);B=q.count,j.replaceOptions.maxCount&&(I=q.last)}else{let q=D.next();q.done||(B++,I=q.value)}I?.select({autoFocus:!1}),O?.(),!j.replaceOptions.maxCount&&B>1&&u.showMessage(`We replaced ${B} cells.`)}catch(z){O?.(),u.showError(z)}return B},[i,o]),A=S.useCallbackRef(j=>{const B={value:j,context:{selection:()=>{const I=i.getSelectedRanges(),H=[];for(let O=0;O<I.getCount();O++){const z=I.at(O).getFixed(!0).getCoords();H.push(z)}return i.getRanges(H)},getNames:()=>i.getNames()},onUpdate:async I=>{try{await I.select()}catch(H){u.showMessage(H.message,{type:S.NotifierType.Error})}}};return u.showWindow("namedDetails",B)},[u,i,o]);return n.useEffect(()=>{const j=(B=!1)=>{const I=i.getSelectedCell(),H={onFindOrReplace:N,onKeyDown:O=>{b.findCommandByEvent(O)!==b.getCommand("find")&&b.findCommandByEvent(O)!==b.getCommand("findReplace")||O.preventDefault()},findOptions:{},findText:I.toTextUnformatted(!0)};H.replace=B,u.showWindow?.("find",H,{disableAutoDestroy:!0})};b.getCommand("find")?.update({disabled:!u.showWindow}).updateCallback(()=>{j()}),b.getCommand("findReplace")?.update({disabled:!u.showWindow}).updateCallback(()=>{j(!0)}),b.getCommand("activateTask")?.update({disabled:!u}).updateCallback(()=>{const B={onInputOption:async I=>{try{p.activateTaskPane(I)}catch(H){u.showMessage(H.message,{type:S.NotifierType.Error})}},title:b.getCommand("activateTask")?.label(),inputLabel:"Task Name",options:["Activate"]};u.showInputOptions(B)}),b.getCommand("goto")?.update({disabled:!u}).updateCallback(()=>{const B={onInputOption:async I=>{try{await i.getRanges(I).select()}catch(H){u.showMessage(H.message,{type:S.NotifierType.Error})}},onKeyDown:I=>{b.findCommandByEvent(I)===b.getCommand("goto")&&I.preventDefault()},title:b.getCommand("goto")?.label(),inputLabel:"Location",options:["Go To"]};u.showInputOptions(B)}),b.getCommand("selectNamed")?.update({disabled:!u}).updateCallback(async B=>{if(B)try{await B.select()}catch(I){u.showError(I)}}),b.getCommand("addNamedReference")?.updateCallback(async function(B){A(null)}),b.getCommand("editNamedReference")?.updateCallback(async function(B){A(B)}),b.getCommand("deleteNamedReference")?.updateCallback(async function(B){B?.delete?.()}),b.getCommand("activeNameBox")?.updateCallback(async function(){o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus()})},[o,i,u]),ae.useModelListener(i?.getView(),{onViewChange:j=>{b.getCommand("workbookViewToggleShowFormulaBar").update({state:j.isShowFormulaBar()}).updateCallback(()=>{j.setShowFormulaBar(!j.isShowFormulaBar())}),b.getCommand("workbookViewToggleShowTabs").update({state:j.isShowTabs()}).updateCallback(()=>{j.setShowTabs(!j.isShowTabs())}),b.getCommand("workbookViewToggleShowStatusBar").update({state:j.isShowStatusBar()}).updateCallback(()=>{j.setShowStatusBar(!j.isShowStatusBar())}),b.getCommand("workbookViewToggleShowHorizontalScrollBar").update({state:j.isShowHorizontalScrollbar()}).updateCallback(()=>{j.setShowHorizontalScrollbar(!j.isShowHorizontalScrollbar())}),b.getCommand("workbookViewToggleShowVerticalScrollBar").update({state:j.isShowVerticalScrollbar()}).updateCallback(()=>{j.setShowVerticalScrollbar(!j.isShowVerticalScrollbar())})}}),n.useEffect(()=>{b.getCommand("fullScreenToggle").update({state:v,disabled:!E,icon:v?"FullScreenOff":"FullScreen"}).updateCallback(()=>{P()})},[v,E]),n.useEffect(()=>{const j=i.getProtection().isStructureAllowed();b.getCommand("hideSheet").update({disabled:m.length<=1||!j}),b.getCommand("deleteSheet").update({disabled:m.length<=1||!j})},[m,l]),b},Ma=()=>{window.open(window.origin.toString(),"sheetxl-"+L.CommonUtils.uuidV4(),"popup=true")},cl="_sheetxl-theme_4opcr_2",dl="_sheetxl-workbook_g5t6x_5",ul=a=>e.jsx(en,{...a}),ml=a=>e.jsx(tn,{...a}),pl=a=>e.jsx(Jo,{...a}),nn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,onBeforeUserChange:r,onUserChange:s,disabled:d=!1,readOnly:u=!1,contextMenuProps:l,renderContextMenu:c=ul,sheetsAllProps:m,renderSheetsAll:x=ml,sheetTabProps:g,renderSheetTab:p,background:f="transparent",className:b,sx:k,borderWidth:C,borderColor:h,gridTheme:w,gridStyle:E,...v}=a,[P,R]=n.useState(o?.getSelectedSheetIndex()),[M,N]=n.useState(o?.getSheets().getItems()),[A,j]=n.useState(o?.getProtection());ae.useModelListener(o,{onViewChange(Z){R(Z?.getSelectedSheetIndex())},onSheetsChange:Z=>{N(Z.getSheets().getItems())},onProtectionChange:Z=>{j(Z?.getProtection())}});const B=u||!A.isStructureAllowed(),I=n.useMemo(()=>{const Z=[];for(let V=0;V<M.length;V++)Z.push(M[V].getName());return Z},[M]),H=n.useCallback(Z=>{r?.(Z)!==!1&&(o.getSheetAt(Z).select(),s?.(Z))},[o,r,s]),O=n.useCallback((Z,V)=>{o.getSheetAt(Z).setName(V),s?.(Z)},[o,s]),z=n.useCallback((Z,V)=>{o.getSheetAt(Z).setPosition(V),s?.(V)},[o,s]),D=S.useCallbackRef(()=>{if(r?.(P)===!1)return;const Z=P+1;o.getSheets().add({name:void 0,autoSelect:!0}),s?.(Z)},[o,r,s,P]),W=n.useMemo(()=>({placement:"top-start"}),[]),U=n.useRef(null),[q,G]=n.useState(!1),_=n.useCallback(Z=>{const{closeFloatAll:V,floatReference:Q}=Z;return x({workbook:o,gridStyle:E,floatReference:Q,closeFloatAll:V,...m})},[x,m,d,o,E]),{reference:K,component:J}=y.useFloatStack({label:"allSheet",popperProps:W,anchor:U.current,onOpen:()=>G(!0),onClose:()=>G(!1),createPopupPanel:_}),ee=n.useRef(null),[F,ie]=n.useState(null),ne=n.useCallback(Z=>{const{floatReference:V}=Z;return c?.({workbook:o,index:F?.index,tabStripRef:ee.current,commands:t,disabled:d,floatReference:V,...l})},[c,l,d,o,t,F]),{reference:le,component:he}=y.useFloatStack({label:"sheetTab",popperProps:W,anchor:{getBoundingClientRect:()=>new DOMRect(F?.left||0,F?.top||0,0,0)},onClose:()=>ie(null),createPopupPanel:ne});n.useEffect(()=>{F?le.open(0):le.close(0)},[F]);const be=n.useCallback((Z,V)=>{Z.preventDefault(),ie({left:Z.clientX-2,top:Z.clientY-4,index:V})},[]),Te=S.useCallbackRef(Z=>{let V;try{V=o?.getSheetAt(Z.index)}catch{}return V?(p??pl)({sheet:V,gridTheme:w,onContextMenu:Q=>{H(Z.index),be(Q,Z.index)},...Z,...g}):null},[p,g,o,w]),de=n.useMemo(()=>B?null:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:"New sheet",children:e.jsx(T.IconButton,{disabled:d,component:"div",sx:{padding:"0","&:hover:not([disabled])":{color:Z=>Z.palette.primary.main},color:Z=>Z.palette.text.icon??Z.palette.action.active,"& svg":{width:"18px",height:"18px"}},"aria-label":"addTab",size:"small",onMouseDown:Z=>{Z.button===0&&Z.preventDefault()},onClick:()=>D(),children:e.jsx(S.DynamicIcon,{iconKey:"AddCircle"})})}),[d,B,D]);return e.jsxs(T.Box,{ref:i,className:pe(b),sx:{position:"relative",display:"flex",alignItems:"stretch",flex:"1 1 100%",maxWidth:"100%",...k},...v,children:[e.jsx(ae.TabStrip,{ref:ee,selectedTabIndex:P,tabNames:I,onSelectedTabIndexChange:H,onTabNameChange:O,onTabMove:z,background:f,borderColor:h,borderWidth:C,activeColor:null,disabled:d,disableDrag:B,createScrollStartButton:y.createScrollStartButton,createScrollEndButton:y.createScrollEndButton,createScrollEdgeButton:y.createScrollEdgeButton,createTabButton:Te,createTabDivider:Z=>{const{key:V,...Q}=Z;return e.jsx(y.ExhibitDivider,{sx:{marginLeft:"-1px",marginRight:"0px",marginTop:"6px",marginBottom:"6px",background:me=>Y.alpha(me.palette.divider,.25)},...Q},V)},editLabelProps:{readOnly:B,maxLength:31,styleHover:{fontWeight:"700"},onKeyPress:Z=>{o.isValidSheetNameCharacter(Z.key)||Z.preventDefault()},onCancel:()=>{s?.(P)}},children:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:q?"":"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:Z=>Z.palette.text.icon??Z.palette.action.active},ref:U,dense:!0,outlined:!1,selected:q,color:"primary","aria-label":"menu",onMouseDown:Z=>{Z.button===0&&Z.preventDefault()},onClick:()=>{q?K.close(0):K.open(0)},icon:e.jsx(S.DynamicIcon,{iconKey:"Menu"})})})}),e.jsx("div",{style:{borderTop:`solid ${h} ${C}px`,minWidth:"4px"}}),e.jsx("div",{style:{borderTop:`solid ${h} ${C}px`,flex:"none",display:"flex",alignItems:"center"},children:de}),e.jsx("div",{style:{borderTop:`solid ${h} ${C}px`,flex:1,minWidth:"24px"}}),he,J]})}));nn.displayName="WorkbookStrip";const rn=n.memo(n.forwardRef((a,i)=>{const{workbook:o,commands:t,disabled:r,sx:s,floatReference:d,className:u,...l}=a,[c,m]=n.useReducer(B=>B+1,0),[x,g]=n.useState(o.getSelectedSheet()),[p,f]=n.useState(x.getSelectedRanges()),[b,k]=n.useState(x.getSelectedCell());ae.useModelListener(o,{onSheetsChange(){g(o.getSelectedSheet())}}),ae.useModelListener(x.getSelection(),{onChange(){f(x.getSelectedRanges()),k(x.getSelectedCell())}}),S.useCommands(t,[],{onChange:()=>{m()}});const C=n.useMemo(()=>({}),[]),h=n.useMemo(()=>({commandHook:{beforeExecute:(B,I)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,scope:"contextMenu",parentFloat:d}),[r,d]),w=n.useMemo(()=>({...C,...h,variant:S.CommandButtonType.Menuitem}),[C,h]),E=n.useMemo(()=>({commands:t,variant:S.CommandButtonType.Menuitem,parentFloat:d,...h}),[t,h,d]),v=[];let P=p.isEntireRows(),R=p.isEntireColumns();p&&(P&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideColumns"),...w,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideColumns"),...w,key:"context:"+v.length}))),R&&(v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),v.push(n.createElement(y.CommandButton,{command:t.getCommand("hideRows"),...w,key:"context:"+v.length})),v.push(n.createElement(y.CommandButton,{command:t.getCommand("unhideRows"),...w,key:"context:"+v.length}))),(P||R)&&v.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"context:"+v.length)),P&&v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitColumns"),...w,key:"context:"+v.length})),R&&v.push(n.createElement(y.CommandButton,{command:t.getCommand("autoFitRows"),...w,key:"context:"+v.length})));const M=[],N=t.getCommand("formatTableStyle"),A=N?.context()?.table();if(S.useCommand(N),!P&&!R){if(M.push(e.jsx(y.ExhibitDivider,{orientation:"horizontal"},"contextBefore:"+M.length)),b?.getHyperlink())M.push(n.createElement(y.SimpleCommandPopupButton,{...E,popupCommandKeys:["updateHyperlink","deleteHyperlink"],popupScope:"hyperlink",key:"contextBefore:action"+M.length,quickCommand:"openHyperlink"}));else{const B=t.getCommand("updateHyperlink");M.push(n.createElement(y.CommandButton,{command:B,...w,key:"contextBefore:"+M.length}))}if(b?.getComments())M.push(n.createElement(y.SimpleCommandPopupButton,{...E,popupCommandKeys:["deleteComments"],key:"contextBefore:action"+M.length,quickCommand:"updateComments"}));else{const B=t.getCommand("updateComments");M.push(n.createElement(y.CommandButton,{command:B,...w,key:"contextBefore:"+M.length}))}A?M.push(n.createElement(y.SimpleCommandPopupButton,{...E,variant:S.CommandButtonType.Menuitem,key:"contextBefore:"+M.length,popupCommandKeys:["convertTableToRange","deleteTable"],popupScope:"table",scope:"context",commandState:A,quickCommand:"editTable"})):M.push(n.createElement(y.CommandButton,{command:t.getCommand("insertTable"),...w,key:"context:"+v.length})),M.push(n.createElement(Uo,{...E,key:"contextBefore:"+M.length}))}const j=e.jsxs(e.Fragment,{children:[e.jsx(y.CommandButton,{command:t.getCommand("cut"),...w}),e.jsx(lo,{command:t.getCommand("copy"),...w}),e.jsx(_o,{command:t.getCommand("paste"),...E,includePasteAllInPopup:!1}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(Vo,{...E}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(Wo,{commands:t,...E,disableSheet:!0}),e.jsx($o,{commands:t,...E,disableSheet:!0}),e.jsx(zo,{...E}),M,v]});return e.jsx(T.Box,{ref:i,className:pe("menu",u),sx:{...s},...l,children:j})}));rn.displayName="WorkbookContextMenu";const Da=n.memo(n.forwardRef((a,i)=>{const{movable:o,commands:t,disabled:r,sx:s,floatReference:d,...u}=a;ae.useModelListener(o,{onAnyChange(p){}});const l=n.useMemo(()=>({}),[]),c=n.useMemo(()=>({commandHook:{beforeExecute:(p,f)=>d.closeAll(),onExecute(){},onError(){console.log("onError")}},disabled:r,parentFloat:d}),[r,d]),m=n.useMemo(()=>({variant:S.CommandButtonType.Menuitem,...l,...c}),[l,c]),x=n.useMemo(()=>({commands:t,variant:S.CommandButtonType.Menuitem,parentFloat:d,...c}),[t,c,d]),g=e.jsxs(e.Fragment,{children:[e.jsx(lo,{command:t.getCommand("copy"),...m,variant:S.CommandButtonType.Menuitem}),[],e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...x,popupCommandKeys:["moveToFront","moveForward"],quickCommand:"moveToFront"}),e.jsx(y.SimpleCommandPopupButton,{...x,popupCommandKeys:["moveToBack","moveBackward"],quickCommand:"moveToBack"}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.CommandButton,{...m,command:t.getCommand("toggleLockAspectRatio")}),e.jsx(y.ExhibitDivider,{orientation:"horizontal"}),e.jsx(y.SimpleCommandPopupButton,{...x,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,{...x,popupCommandKeys:["formatAnchorTypeTwoCell","formatAnchorTypeOneCell","formatAnchorTypeAbsolute"],label:"Sizing",icon:"DrawResize",tooltip:"Determine how the drawing size will adjust as the cell sizes adjust."}),[]]});return e.jsx(T.Box,{ref:i,sx:{paddingTop:"4px",paddingBottom:"4px",...s},...u,children:g})}));Da.displayName="MovableContextMenu";const fl=a=>e.jsx(Da,{...a}),hl=a=>e.jsx(rn,{...a}),gl=a=>e.jsx(Qo,{...a}),xl=(a,i)=>e.jsx(Zo,{ref:i,...a}),bl=a=>e.jsx(y.LoadingPanel,{...a}),yl=(a,i)=>e.jsx(ae.SheetElement,{ref:i,...a}),Cl=a=>e.jsx(Go,{...a}),Sl=a=>e.jsx(nn,{...a}),kl={fireOnModelChange:!1},Eo={flex:"1 1 100%",display:"flex"},an=n.memo(n.forwardRef((a,i)=>{const{workbook:o,createWorkbookOptions:t,onNewWorkbook:r,onElementLoad:s,autoFocus:d=!1,sx:u,style:l,className:c,onFocus:m,onBlur:x,onKeyDown:g,onRepeatCommandChange:p,commands:f,showFormulaBar:b,formulaBarProps:k,renderFormulaBar:C=xl,showTabs:h,tabsProps:w,renderTabs:E=Sl,showStatusBar:v,statusBarProps:P,renderStatusBar:R=Cl,toolbarProps:M,renderToolbar:N=Ba,contextMenuSx:A,renderContextMenu:j=hl,renderFilterMenu:B=gl,renderMovableMenu:I=fl,renderLoadingPanel:H=bl,loadingPanelProps:O,sheetProps:z,sheetWrapper:D,renderSheet:W=yl,sideBarElement:U,showHorizontalScrollbar:q,showVerticalScrollbar:G,gridTheme:_,headersTheme:K,enableDarkImages:J,...ee}=a,F=Y.useTheme(),ie=ae.useDocThemes(),ne=n.useMemo(()=>{const $={theme:ie.getDefaultTheme(),...t};return o??new L.Workbook($)},[o]),le=n.useRef(null),[he,be]=n.useState(!1),Te=n.useRef(null),de=n.useMemo(()=>e.jsx(T.Box,{className:"sheetxl-viewport",sx:{width:"100%",height:"100%",boxSizing:"border-box",position:"absolute",pointerEvents:"none !important","& > :first-of-type":{position:"relative"}},ref:Te}),[]),[Z,V]=n.useState(!1),[Q,me]=n.useState(!1),Be=n.useCallback(()=>{V(!0)},[]),re=n.useRef(null),ge=S.useImperativeElement(i,()=>({isWorkbookElement:()=>!0,getWorkbook:()=>ne,getSheetElement:()=>le.current,getViewportElement:()=>Te.current,getFormulaBarElement:()=>re.current,focus(){le&&le.current&&le.current.focus()}}),[ne]),se=n.useRef(null);n.useLayoutEffect(()=>{!Z||!ge.current||(async()=>(se.current!==s&&(await s?.({source:ge.current}),se.current=s),me(!0)))()},[Z,ge.current]),Xn(ge.current);const ue=n.useCallback($=>(le.current?.submitEdit(),!0),[]),X=n.useCallback(()=>{requestAnimationFrame(()=>{le?.current?.focus()})},[]),[oe,ve]=n.useState(ne?.getSelectedSheet()),[Pe,Ke]=n.useState(ne?.getProtection());ae.useModelListener(ne,{onSheetsChange:$=>{ve($?.getSelectedSheet())},onViewChange($){ve($?.getSelectedSheet())},onProtectionChange:$=>{Ke($?.getProtection())}}),ae.useModelListener(ne,{onRequestSelect:async($,te)=>new Promise(ce=>{le.current.getSheet()!==te?le.current.getGridElement()?.onViewChangeOnce(()=>{le.current.getSheet()!==te&&ce(!1),ce(!0)}):ce(!0)})},kl);const[uo,un]=n.useReducer($=>$+1,0),et=ne?.getView();ae.useModelListener(et,{onViewChange:$=>{un()}});const ht=_??F,Ee=n.useMemo(()=>Oo(F,ht),[F,ht]),mn=K??F,Qa=n.useMemo(()=>Oo(F,mn),[F,mn]),[pn,Ja]=n.useState(null);n.useCallback(()=>{le.current.focus()},[]);const xe=Ra({workbook:ne,workbookElement:ge.current,target:()=>le.current,commands:f,darkMode:Ee.body.darkMode,onNewWorkbook:r}),gt=n.useRef(null),[mo,fn]=n.useState(!1),[hn,gn]=n.useState(null),[xn,ei]=n.useState(S.ToolTipPlacement.Top),[xt,ti]=n.useState(L.TypesUtils.EmptyBounds),po=n.useCallback(()=>{fn(!1),gn(null)},[]),bt=n.useCallback(($,te,ce=S.ToolTipPlacement.Top)=>{ti($),ei(ce),gn(te),gt.current!==null&&setTimeout(()=>{gt.current!==null&>.current.update()},160),fn(!0)},[]),[is,bn]=n.useState("sheet"),_e=h??et?.isShowTabs(),Ue=q??et?.isShowHorizontalScrollbar(),oi=b??et?.isShowFormulaBar(),Lt=v??et?.isShowStatusBar(),yn=G??et?.isShowVerticalScrollbar(),tt=Ee?.header?.edgeStrokeFill||"rgb(171,171,171)",ni=n.useMemo(()=>Lt?R({sheet:oe,gridStyle:Ee,...P}):null,[R,P,Lt,Ee,oe]),ri=n.useMemo(()=>N({commands:xe,workbook:ge.current,...M}),[xe,N,M,F]),[ai,{width:Cn}]=ft(),je=Cn===0||Cn>560,fo=n.useMemo(()=>{if(!_e)return null;let $=E({background:Ee.body.fill,borderWidth:1,borderColor:tt,gridTheme:ht,gridStyle:Ee,onBeforeUserChange:ue,onUserChange:X,workbook:ne,commands:xe,sheetTabProps:{},...w});return je||($=e.jsx("div",{style:{flex:"none",display:"flex"},children:$})),$},[E,w,F,ne,ht,je,xe,_e]),Sn=n.useCallback($=>{const te=L.CommonUtils.getOS()===L.CommonUtils.OSType.Firefox;let ce=null,we=null,Se=null;if(Ue&&(we=e.jsx("div",{style:{display:"flex",flex:"1 1 100%",borderTop:`solid ${tt} 1px`,maxWidth:"100%"},children:e.jsx(ae.SheetScrollbar,{style:{alignItems:"center",borderTop:(te?6:3)+"px solid transparent",borderBottom:(je?6:3)+"px solid transparent",borderLeft:(te?3:0)+"px solid transparent",borderRight:(te?3:0)+"px solid transparent"},...$,endGap:700,sheet:oe,showCustomScrollButtons:!te,onShowTooltip:ke=>{bt({x:ke.anchor.x,y:ke.anchor.y,width:0,height:0},ke.display,ke.placement)},onCloseTooltip:()=>po()})})),_e&&je&&(Se=fo),_e&&je&&!Ue&&(Se=e.jsxs(T.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:[Se,e.jsx(T.Box,{sx:{borderTop:`solid ${tt} 1px`,flex:"1"}})]})),Se&&Ue)ce=e.jsx(S.SplitPane,{position:ne.getView().getTabRatio()/10+"%",onPositionChange:({percent:ke})=>{ne.getView().setTabRatio(Math.round(10*ke))},minBefore:"200px",minAfter:"180px",resizerProps:{style:{minWidth:"11px",backgroundImage:`url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${F.palette.text.icon??F.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",borderTop:`solid ${tt} 1px`,borderBottom:"solid 3px transparent"}},elementBefore:Se,elementAfter:we});else if(Ue)ce=we;else{if(!Se)return e.jsx(T.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center",height:"1px",borderTop:Lt?null:`solid ${tt} 1px`}});ce=Se}return e.jsx(T.Box,{sx:{display:"flex",flex:"1",position:"relative",alignContent:"center"},children:ce})},[oe,ue,ne,Ee,ht,xe,_e,Ue,Lt,je]),[De,yt]=n.useState(null),ii=n.useMemo(()=>({placement:"right-start",...De?.popperProps}),[De?.popperProps]),{reference:kn,component:li}=y.useFloatStack({label:"contextMenu",popperProps:ii,anchor:De?.anchor??{getBoundingClientRect:()=>new DOMRect(De?.clientX||0,De?.clientY||0)},onClose:()=>yt(null),createPopupPanel:De?.createPopupPanel});n.useEffect(()=>{De?kn.open(0):kn.close(0)},[De]);const si=S.useCallbackRef(($,te)=>{if($?.isDefaultPrevented())return!0;$.preventDefault(),De&&De.anchor===$.currentTarget?yt(null):yt({anchor:$.currentTarget,popperProps:{offsets:[-4,2]},createPopupPanel:ce=>{const{floatReference:we}=ce;return B({filter:te,commands:xe,floatReference:we,sx:{...A}})}})},[B,A,xe,ne,De]),wn=S.useCallbackRef($=>{if($.originalEvent?.isDefaultPrevented())return!0;$.originalEvent?.preventDefault(),yt({clientX:$.clientX,clientY:$.clientY,createPopupPanel:te=>{const{floatReference:ce}=te;return j({commands:xe,workbook:ne,floatReference:ce,sx:{...A}})}})},[j,A,xe,ne]),ci=S.useCallbackRef(($,te)=>{if($?.isDefaultPrevented())return!0;$.preventDefault(),yt({clientX:$.clientX,clientY:$.clientY,createPopupPanel:ce=>{const{floatReference:we}=ce;return I({movable:te,commands:xe,floatReference:we,sx:{...A}})}})},[I,A,xe]);n.useMemo(()=>{const $=[new S.SimpleCommand("openContextMenu",()=>le.current,{label:"Context Menu",description:"Open the context menu.",shortcut:[{key:"F10",modifiers:[S.KeyModifiers.Shift]},{key:"ContextMenu"}]})];xe.addCommands($,!0)},[xe]),n.useEffect(()=>{xe.getCommand("openContextMenu").updateCallback(()=>{const $=oe.getSelection().getCoords().cell;le.current?.getGridElement()?.scrollCellCoordsIntoView($).then(te=>{requestAnimationFrame(()=>{const ce=oe.getView().getZoomScale()/100,we=oe.getColumnHeaders().findOffset($.colIndex+1)*ce,Se=oe.getRowHeaders().findOffset($.rowIndex+1)*ce,ke=le.current?.getGridElement()?.getRelativePointFromClient(0,0)||{x:0,y:0};wn({clientX:we-ke.x-te.left+6,clientY:Se-ke.y-te.top+6})})})})},[oe]);const di=S.useCallbackRef($=>{xe?.dispatchToFocusedCommand($)},[xe]),ui=S.useCallbackRef(()=>{Xn(ge.current)},[ne,ge.current]),mi=n.useCallback(()=>{bn("sheet")},[]),pi=n.useCallback(()=>{bn("formulaBar")},[]),fi=S.useCallbackRef($=>{const te=L.CommonUtils.getOS()===L.CommonUtils.OSType.Firefox;return e.jsx(ae.SheetScrollbar,{style:{borderLeft:"3px solid transparent",borderRight:"0px solid transparent",borderTop:(te?3:0)+"px solid transparent",borderBottom:(te?3:0)+"px solid transparent",width:te?"13px":void 0},...$,sheet:oe,endGap:700,showCustomScrollButtons:!te,onShowTooltip:ce=>{bt(ce.anchor,ce.display,S.ToolTipPlacement.Left)},onCloseTooltip:()=>po()})},[oe]);n.useEffect(()=>{d&&le&&le.current&&le.current.focus()},[]);const[Ht,ho]=n.useState(null),go=n.useCallback($=>{xe?.getCommand("openWorkbook")&&($.type==="dragenter"||$.type==="dragover"?$.dataTransfer?.types.includes("Files")?$.dataTransfer.files[0]?.type?.startsWith("image/")||$.dataTransfer.items[0]?.type?.startsWith("image/")||$.dataTransfer.types.length===1&&ho("Drop to open"):($.dataTransfer?.types.includes("text/html")||$.dataTransfer?.types.includes("text/plain"),$.dataTransfer.effectAllowed="none",$.dataTransfer.dropEffect="none"):$.type==="dragleave"&&ho(null),$.preventDefault())},[xe]),hi=S.useCallbackRef($=>{if(xe?.getCommand("openWorkbook")&&($.preventDefault(),$.stopPropagation(),ho(null),$.dataTransfer.files&&$.dataTransfer.files.length>0)){const te=$.dataTransfer.files[0];if(!te)return;if(te?.type?.startsWith("image/")){const ce=le.current?.getGridElement().getViewFromClient($.clientX,$.clientY);if(!ce)return;const we=ce.getRelativePointFromClient($.clientX,$.clientY),Se=ce.toAbsoluteBounds({...we,width:0,height:0}),ke=ce.getCellCoordsFromClient($.clientX,$.clientY);if(!ke)return;xe?.getCommand("insertImageFromFile")?.execute({file:te,options:{bounds:{x:Se.x,y:Se.y}},goto:{range:{...ke}}})}else xe?.getCommand("openWorkbook")?.execute(te)}},[xe,Ht]),gi=n.useMemo(()=>Ht?e.jsx(T.Box,{sx:{position:"absolute",width:"100%",height:"100%",boxSizing:"border-box",pointerEvents:"none",display:"flex",justifyContent:"center",alignItems:"center",background:$=>$.palette.divider,color:$=>$.palette.primary.dark},children:e.jsx(T.Typography,{variant:"h4",children:Ht})}):null,[Ht]),vn=n.useRef(null),xi=n.useMemo(()=>e.jsx(No,{in:!Q,nodeRef:vn,timeout:500,classNames:"animating",unmountOnExit:!0,children:e.jsx(T.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",left:"0px",top:"0px",width:"100%",height:"100%",pointerEvents:Q?"none":u?.pointerEvents,position:"absolute",boxSizing:"border-box"},children:H({ref:vn,transitionDelay:"0",transparentBackground:!1,sx:{opacity:Q?0:u?.opacity,pointerEvents:Q?"none":u?.pointerEvents,position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",...O}})})}),[Q,H,O]),bi=n.useMemo(()=>C({sx:{marginTop:$=>$.spacing(.25),marginLeft:$=>$.spacing(1),marginRight:$=>$.spacing(1)},workbook:ne,sheetElement:le.current,gridStyle:Ee,onFocus:pi,...k,NamedCollectionEditorProps:{restoreFocus:$=>le.current.focus($),...k?.NamedCollectionEditorProps,commandPopupButtonProps:{commands:xe,...k?.NamedCollectionEditorProps?.commandPopupButtonProps}}},re),[C,k,ne,Ee,xe,Q]),yi=n.useCallback($=>{const{movable:te,...ce}=$,we={movable:te,onContextMenuCapture:qe=>{ci(qe,te)},...ce},Se=te.getContent().getType();let ke=null;if(Se==="picture")return e.jsx(ae.PictureEditor,{loadingPanel:e.jsx(y.LoadingPanel,{transitionDelay:"100",style:{position:"absolute"},sx:{border:qe=>`solid 1px ${qe.palette.action.active}`}}),picture:te.getContent(),description:te.getDescription()??te?.getName(),...we});if(Se==="chart"){const qe={...we,chart:te.getContent()};return e.jsx(ae.ChartEditor,{...qe})}if(ke=`Float of type '${Se}'.`,typeof ke=="string"){const qe={...we,description:ke};ke=e.jsx(ae.EmptyFrame,{...qe})}return e.jsx("div",{style:{position:"absolute",clipPath:"inset(0px)",display:"flex",alignItems:"stretch",justifyContent:"stretch",pointerEvents:"all"},children:ke},te.getUUID())},[]),jn=n.useMemo(()=>{const $=W({style:Eo,onFocus:mi,gridStyle:Ee,headersStyle:Qa,sheet:oe,commands:xe,onSheetContextMenu:wn,onViewportChange:te=>{Ja(te)},showScrollbars:!1,viewportComponent:de,onRepeatCommandChange:p,onElementLoad:Be,onShowColumnTooltip:te=>{bt(te.anchor,te.display,S.ToolTipPlacement.Top)},onShowRowTooltip:te=>{bt(te.anchor,te.display,S.ToolTipPlacement.Right)},onShowTooltip:te=>{bt({x:te.anchor.x,y:te.anchor.y,width:0,height:0},te.display,te.placement)},onCloseTooltip:()=>po(),renderMovable:yi,...z,cellRenderProps:{onFilterButtonMouseDown:(te,ce)=>{z?.cellRenderProps?.onFilterButtonMouseDown(te,ce),si(te,ce)},...z?.cellRenderProps}},le);return D?D($):$},[W,D,xe,z,oe,Ee,p]),Ci=n.useMemo(()=>{const $=e.jsx(S.ScrollPane,{style:{...Eo,marginRight:U&&je?"0px":"6px"},viewport:pn,touchElement:le.current?.getGridElement()?.stage,onScrollViewport:ke=>{le.current?.getGridElement()?.scrollTo(ke)},showHorizontalScrollbar:Ue||_e,showVerticalScrollbar:yn,createHorizontalScrollbar:Sn,createVerticalScrollbar:fi,children:jn});let te=$;je||(te=e.jsxs(e.Fragment,{children:[$,fo]}));let ce=null,we=4,Se=13;return je?ce="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":(ce="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",we=13,Se=4),e.jsx(S.SplitPane,{fixedPane:"after",position:"40%",minAfter:je?"280px":"120px",splitDirection:je?"row":"column",style:Eo,ref:ai,resizerProps:{className:"styled-resizer",style:{minWidth:je?"6px":void 0,minHeight:je?void 0:"6px",maskImage:`url("data:image/svg+xml,%3Csvg width='${we}' height='${Se}' viewBox='0 0 ${we} ${Se}' version='1.1' fill='${F.palette.text.icon??F.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${ce}' /%3E%3C/svg%3E%0A")`,maskRepeat:"no-repeat",maskPosition:je?"left center":"top center"}},elementBefore:te,paneBeforeProps:{style:{flexDirection:"column"}},elementAfter:U,paneAfterProps:{style:{marginLeft:je?"0px":"4px",marginRight:je?"8px":"4px"}}})},[Ue,_e,Sn,yn,pn,U,jn,fo,F,je]),Si=n.useMemo(()=>e.jsx(y.SimpleTooltip,{arrow:!0,disableInteractive:!0,open:mo,title:e.jsx(T.Typography,{variant:"subtitle2",component:"div",children:hn}),placement:xn,TransitionProps:{timeout:{exit:0}},PopperProps:{popperRef:gt,sx:{"& .MuiTooltip-tooltip":{padding:"2px 6px","& .MuiTooltip-arrow":{display:mo?"visible":"none"}}},anchorEl:{getBoundingClientRect:()=>new DOMRect(xt.x,xt.y,xt.width,xt.height)},modifiers:[{name:"offset",options:{offset:[0,0]}}]},children:e.jsx(T.Box,{})}),[mo,hn,xn,xt,gt]),ki=n.useMemo(()=>({boxSizing:"border-box",background:$=>$.palette.mode!=="dark"?Ee.header.fill:$.palette.background.paper,"& *":{...y.scrollbarTheming(F),fontWeight:400},"&.Mui-focusVisible":{},"& .viewport-overlay":{borderRight:`solid ${tt} 1px`},...u}),[u,Ee]),wi=n.useMemo(()=>e.jsx(T.Box,{sx:{marginBottom:$=>$.spacing(.75)}}),[]),vi=n.useMemo(()=>({flex:"1 1 100%",width:"100%",display:"flex",flexDirection:"column",opacity:Q?void 0:0,"--sxl-app-color-high-contrast":F.palette.primary.main,"--sxl-app-color-primary":F.palette.primary.main,"--sxl-app-color-primary-dark":F.palette.primary.dark,"--sxl-app-color-primary-light":F.palette.primary.light,"--sxl-app-color-info":F.palette.info.main,"--sxl-app-color-info-dark":F.palette.info.dark,"--sxl-app-color-info-light":F.palette.info.light,"--sxl-app-color-secondary":F.palette.secondary.main,"--sxl-app-color-secondary-dark":F.palette.secondary.dark,"--sxl-app-color-secondary-light":F.palette.secondary.light,"--sxl-app-color-success":F.palette.success.main,"--sxl-app-color-success-dark":F.palette.success.dark,"--sxl-app-color-success-light":F.palette.success.light,"--sxl-app-color-warning":F.palette.warning.main,"--sxl-app-color-warning-dark":F.palette.warning.dark,"--sxl-app-color-warning-light":F.palette.warning.light,"--sxl-app-color-error":F.palette.error.main,"--sxl-app-color-error-dark":F.palette.error.dark,"--sxl-app-color-error-light":F.palette.error.light,"--sxl-app-color-text":F.palette.text.primary,"--sxl-app-color-text-secondary":F.palette.text.secondary,"--sxl-app-color-text-disabled":F.palette.text.disabled,"--sxl-app-color-background":F.palette.background.paper,"--sxl-app-color-button-surface":F.palette.grey[600],"--sxl-app-color-shadow":F.palette.action.focus,"--sxl-app-color-grey":F.palette.grey[500],"--sxl-app-filter-dark-invert":Ee.body.darkMode&&J?"hue-rotate(180deg) invert(1) brightness(95%)":"none","--sxl-app-image-background":Ee.body.darkMode?`linear-gradient(${Y.alpha("#fff",Y.getOverlayAlpha(5))}, ${Y.alpha("#fff",Y.getOverlayAlpha(5))})`:void 0}),[Ee,F,Q]),ji=n.useMemo(()=>pe(_r),[]);return e.jsxs(T.Paper,{className:pe("sheetxl-workbook",dl,{"Mui-focusVisible":he},cl,c),sx:ki,style:l,square:!1,...ee,ref:ge,onFocus:$=>{be(!0),ui(),m?.($)},onBlur:$=>{be(!1),x?.($)},onKeyDown:$=>{di($),g?.($)},onDragStart:$=>{if($.target.src){const te=new Image;te.src=$.target.src,$.dataTransfer.setDragImage(te,1,1)}},onDragEnter:go,onDragLeave:go,onDragOver:go,onDrop:hi,children:[e.jsxs("div",{className:ji,style:vi,children:[ri,oi?bi:null,wi,Ci,ni,Si,li,gi]}),xi]})}));an.displayName="WorkbookElement";const wl=(a=!1,i=!1)=>i?null:{"& input:not(:focus):not(:hover)":{color:o=>o.palette.text.secondary},backgroundColor:o=>Y.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`}},ln=n.memo(n.forwardRef((a,i)=>{const{sx:o,workbook:t,title:r="",placeHolder:s="Untitled",onTitleChange:d,readOnly:u=!1,hidden:l,...c}=a,[m,x]=n.useState(!1),[g,p]=n.useState(!1),[f,b]=n.useState(r??""),[k,C]=n.useState(""),[h,{width:w}]=ft(),[E,{width:v}]=ft(),[P,R]=n.useState(!1),M=n.useRef(null),N=n.useRef(null),A=S.useImperativeElement(i,()=>({requestWorkbookTitle:(j=null,B)=>{N.current={onAccept:j,requestReason:B?.requestReason},B?.selectAll&&M.current?.select(),M.current?.focus(B)},focus:j=>{M.current?.focus(j)}}),[]);return n.useLayoutEffect(()=>{R(r!==f),C(r),b(r)},[r]),n.useEffect(()=>{P&&w!==0&&Ie.CommonUtils.debounce(()=>{R(!1)},300)()},[P,w]),n.useEffect(()=>{p(f&&!st.IOUtils.isValidWindowsFilename(f))},[f]),l?null:e.jsx(T.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",opacity:P?"0":"1",transition:P?void 0:"opacity .25s ease-in","& .tooltip-wrapper":{maxWidth:"100%"}},ref:Nt([A,E,i]),...c,children:e.jsx(y.ExhibitTooltip,{label:N.current?.requestReason??"Workbook Name",children:e.jsxs(T.Box,{className:pe({"Mui-focusVisible":m}),sx:{visibility:w===0?"hidden":"visible",display:"block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:"12px",paddingRight:"12px",marginLeft:"2px",marginRight:"2px",paddingTop:"2px",paddingBottom:"1px",...wl(!0,u),...o},children:[u?e.jsx(T.Typography,{variant:"subtitle1",component:"div",sx:{whiteSpace:"nowrap",fontStyle:f!==k?"italic":void 0,userSelect:"none",textOverflow:"ellipsis",lineHeight:"1.4375em",border:"transparent 1px solid",color:j=>g?j.palette.error.dark:void 0},children:r??s}):e.jsx(T.Input,{sx:{width:`${Math.min(w+3,Math.max(v,A.current?.getBoundingClientRect()?.width))}px`,overflow:"hidden",whiteSpace:"nowrap",fontWeight:"600",maxWidth:"100%",border:"none",padding:"0px",margin:"0px",color:j=>g?j.palette.error.dark:void 0,fontStyle:f!==k?"italic":void 0,"& input":{paddingTop:"0px",paddingBottom:"0px",textOverflow:"ellipsis"}},disableUnderline:!0,fullWidth:!1,multiline:!1,readOnly:u,spellCheck:!1,placeholder:s,onFocus:j=>{x(!0),j.target?.select()},inputProps:{name:"input-workbook-title",autoComplete:"off",ref:M},onBlur:()=>{x(!1),g?b(k):(f!==k&&(d?.(f),f&&N.current?.onAccept?.(f,"blur")),N.current=null)},onChange:j=>{if(j.target.value.length>st.IOUtils.MAX_WORKBOOK_NAME_SIZE)return j.stopPropagation(),void j.preventDefault();b(j.target.value)},onKeyDown:j=>{(st.IOUtils.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(j.key)||j.target?.value.length>st.IOUtils.MAX_WORKBOOK_NAME_SIZE)&&j.preventDefault(),j.which===S.KeyCodes.Enter||j.which===S.KeyCodes.Tab?(g?b(k):(d?.(f),f&&(N.current?.onAccept?.(f,"keydown"),N.current=null)),j.stopPropagation(),j.preventDefault(),t?.focus()):j.which===S.KeyCodes.Escape&&(f===k?t?.focus():(b(k),setTimeout(()=>{j.target?.select()},0)),N.current=null,j.stopPropagation(),j.preventDefault())},value:f}),e.jsx(T.Box,{ref:h,sx:{position:"absolute",visibility:"hidden",top:"-9999px",fontWeight:"600 !important",whiteSpace:"pre",fontStyle:f!==k?"italic":void 0,fontFamily:j=>j.typography.fontFamily,letterSpacing:"0.00938em"},children:f||s})]})})})}));ln.displayName="WorkbookTitle";const Fa=n.memo(n.forwardRef((a,i)=>{const{sx:o,style:t,className:r,licenseKey:s,renderLoadingPanel:d,...u}=a;s&&L.LicenseManager.setLicenseKey(s);const l=n.useMemo(()=>{const m={transitionDelay:"160ms",transparentBackground:!0};return e.jsx(T.Box,{sx:o,style:{width:"100%",height:"100%",position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",...t},children:d?.(m)??e.jsx(y.LoadingPanel,{...m})})},[o,t,d]),c=n.useMemo(()=>n.lazy(async()=>await Promise.resolve().then(()=>as)),[]);return e.jsx(e.Fragment,{children:e.jsx(n.Suspense,{fallback:l,children:e.jsx(c,{...u,className:r,renderLoadingPanel:d,sx:o,style:t,ref:i})})})}));Fa.displayName="Studio";const vl=n.createContext(null),To={didCatch:!1,error:null};class jl extends n.Component{constructor(i){super(i),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=To}static getDerivedStateFromError(i){return{didCatch:!0,error:i}}resetErrorBoundary(){const{error:i}=this.state;if(i!==null){for(var o,t,r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];(o=(t=this.props).onReset)===null||o===void 0||o.call(t,{args:s,reason:"imperative-api"}),this.setState(To)}}componentDidCatch(i,o){var t,r;(t=(r=this.props).onError)===null||t===void 0||t.call(r,i,o)}componentDidUpdate(i,o){const{didCatch:t}=this.state,{resetKeys:r}=this.props;var s,d;t&&o.error!==null&&(function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return u.length!==l.length||u.some((c,m)=>!Object.is(c,l[m]))})(i.resetKeys,r)&&((s=(d=this.props).onReset)===null||s===void 0||s.call(d,{next:r,prev:i.resetKeys,reason:"keys"}),this.setState(To))}render(){const{children:i,fallbackRender:o,FallbackComponent:t,fallback:r}=this.props,{didCatch:s,error:d}=this.state;let u=i;if(s){const l={error:d,resetErrorBoundary:this.resetErrorBoundary};if(typeof o=="function")u=o(l);else if(t)u=n.createElement(t,l);else{if(r===void 0)throw d;u=r}}return n.createElement(vl.Provider,{value:{didCatch:s,error:d,resetErrorBoundary:this.resetErrorBoundary}},u)}}function Ia(a){var i,o,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a))for(i=0;i<a.length;i++)a[i]&&(o=Ia(a[i]))&&(t&&(t+=" "),t+=o);else for(i in a)a[i]&&(t&&(t+=" "),t+=i);return t}function Ve(){for(var a,i,o=0,t="";o<arguments.length;)(a=arguments[o++])&&(i=Ia(a))&&(t&&(t+=" "),t+=i);return t}let El={data:""},Tl=a=>typeof window=="object"?((a?a.querySelector("#_goober"):window._goober)||Object.assign((a||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:a||El,Bl=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Pl=/\/\*[^]*?\*\/| +/g,ir=/\n+/g,Qe=(a,i)=>{let o="",t="",r="";for(let s in a){let d=a[s];s[0]=="@"?s[1]=="i"?o=s+" "+d+";":t+=s[1]=="f"?Qe(d,s):s+"{"+Qe(d,s[1]=="k"?"":i)+"}":typeof d=="object"?t+=Qe(d,i?i.replace(/([^,])+/g,u=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,u):u?u+" "+l:l)):s):d!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=Qe.p?Qe.p(s,d):s+":"+d+";")}return o+(i&&r?i+"{"+r+"}":r)+t},Ae={},Na=a=>{if(typeof a=="object"){let i="";for(let o in a)i+=o+Na(a[o]);return i}return a},Rl=(a,i,o,t,r)=>{let s=Na(a),d=Ae[s]||(Ae[s]=(l=>{let c=0,m=11;for(;c<l.length;)m=101*m+l.charCodeAt(c++)>>>0;return"go"+m})(s));if(!Ae[d]){let l=s!==a?a:(c=>{let m,x,g=[{}];for(;m=Bl.exec(c.replace(Pl,""));)m[4]?g.shift():m[3]?(x=m[3].replace(ir," ").trim(),g.unshift(g[0][x]=g[0][x]||{})):g[0][m[1]]=m[2].replace(ir," ").trim();return g[0]})(a);Ae[d]=Qe(r?{["@keyframes "+d]:l}:l,o?"":"."+d)}let u=o&&Ae.g?Ae.g:null;return o&&(Ae.g=Ae[d]),((l,c,m,x)=>{x?c.data=c.data.replace(x,l):c.data.indexOf(l)===-1&&(c.data=m?l+c.data:c.data+l)})(Ae[d],i,t,u),d};function Ao(a){let i=this||{},o=a.call?a(i.p):a;return Rl(o.unshift?o.raw?((t,r,s)=>t.reduce((d,u,l)=>{let c=r[l];if(c&&c.call){let m=c(s),x=m&&m.props&&m.props.className||/^go/.test(m)&&m;c=x?"."+x:m&&typeof m=="object"?m.props?"":Qe(m,""):m===!1?"":m}return d+u+(c??"")},""))(o,[].slice.call(arguments,1),i.p):o.reduce((t,r)=>Object.assign(t,r&&r.call?r(i.p):r),{}):o,Tl(i.target),i.g,i.o,i.k)}function Oa(a,i,o){return i&&(function(t,r){for(var s=0;s<r.length;s++){var d=r[s];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(t,d.key,d)}})(a.prototype,i),a}function fe(){return fe=Object.assign||function(a){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=o[t])}return a},fe.apply(this,arguments)}function Aa(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.__proto__=i}function Ot(a,i){if(a==null)return{};var o,t,r={},s=Object.keys(a);for(t=0;t<s.length;t++)o=s[t],i.indexOf(o)>=0||(r[o]=a[o]);return r}function lr(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}Ao.bind({g:1}),Ao.bind({k:1});var sr=function(){return""},La=n.createContext({enqueueSnackbar:sr,closeSnackbar:sr}),Bo="@media (max-width:599.95px)",to="@media (min-width:600px)",cr=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},sn=function(a){return""+cr(a.vertical)+cr(a.horizontal)},qt=function(a){return!!a||a===0},Gt="unmounted",nt="exited",rt="entering",Tt="entered",dr="exiting",cn=(function(a){function i(t){var r;r=a.call(this,t)||this;var s,d=t.appear;return r.appearStatus=null,t.in?d?(s=nt,r.appearStatus=rt):s=Tt:s=t.unmountOnExit||t.mountOnEnter?Gt:nt,r.state={status:s},r.nextCallback=null,r}Aa(i,a),i.getDerivedStateFromProps=function(t,r){return t.in&&r.status===Gt?{status:nt}:null};var o=i.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!==rt&&s!==Tt&&(r=rt):s!==rt&&s!==Tt||(r=dr)}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===rt?this.performEnter(t):this.performExit()):this.props.unmountOnExit&&this.state.status===nt&&this.setState({status:Gt})},o.performEnter=function(t){var r=this,s=this.props.enter,d=t,u=this.getTimeouts();t||s?(this.props.onEnter&&this.props.onEnter(this.node,d),this.safeSetState({status:rt},function(){r.props.onEntering&&r.props.onEntering(r.node,d),r.onTransitionEnd(u.enter,function(){r.safeSetState({status:Tt},function(){r.props.onEntered&&r.props.onEntered(r.node,d)})})})):this.safeSetState({status:Tt},function(){r.props.onEntered&&r.props.onEntered(r.node,d)})},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:dr},function(){t.props.onExiting&&t.props.onExiting(t.node),t.onTransitionEnd(s.exit,function(){t.safeSetState({status:nt},function(){t.props.onExited&&t.props.onExited(t.node)})})})):this.safeSetState({status:nt},function(){t.props.onExited&&t.props.onExited(t.node)})},o.cancelNextCallback=function(){this.nextCallback!==null&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(t,r){r=this.setNextCallback(r),this.setState(t,r)},o.setNextCallback=function(t){var r=this,s=!0;return this.nextCallback=function(){s&&(s=!1,r.nextCallback=null,t())},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(t,r){this.setNextCallback(r);var s=t==null&&!this.props.addEndListener;this.node&&!s?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),t!=null&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if(t===Gt)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"]))},Oa(i,[{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}}]),i})(n.Component);function at(){}function ur(a,i){typeof a=="function"?a(i):a&&(a.current=i)}function Lo(a,i){return n.useMemo(function(){return a==null&&i==null?null:function(o){ur(a,o),ur(i,o)}},[a,i])}function ro(a){var i=a.timeout,o=a.style,t=o===void 0?{}:o,r=a.mode;return{duration:typeof i=="object"?i[r]||0:i,easing:t.transitionTimingFunction,delay:t.transitionDelay}}cn.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};var Ml="cubic-bezier(0.4, 0, 0.2, 1)",Dl="cubic-bezier(0.0, 0, 0.2, 1)",Fl="cubic-bezier(0.4, 0, 0.6, 1)",Ha=function(a){a.scrollTop=a.scrollTop},mr=function(a){return Math.round(a)+"ms"};function dt(a,i){a===void 0&&(a=["all"]);var o=i||{},t=o.duration,r=t===void 0?300:t,s=o.easing,d=s===void 0?Ml:s,u=o.delay,l=u===void 0?0:u;return(Array.isArray(a)?a:[a]).map(function(c){var m=typeof r=="string"?r:mr(r),x=typeof l=="string"?l:mr(l);return c+" "+m+" "+d+" "+x}).join(",")}function za(a){var i=(function(o){return o&&o.ownerDocument||document})(a);return i.defaultView||window}function Xt(a,i){if(i){var o=(function(t,r){var s,d=r.getBoundingClientRect(),u=za(r);if(r.fakeTransform)s=r.fakeTransform;else{var l=u.getComputedStyle(r);s=l.getPropertyValue("-webkit-transform")||l.getPropertyValue("transform")}var c=0,m=0;if(s&&s!=="none"&&typeof s=="string"){var x=s.split("(")[1].split(")")[0].split(",");c=parseInt(x[4],10),m=parseInt(x[5],10)}switch(t){case"left":return"translateX("+(u.innerWidth+c-d.left)+"px)";case"right":return"translateX(-"+(d.left+d.width-c)+"px)";case"up":return"translateY("+(u.innerHeight+m-d.top)+"px)";default:return"translateY(-"+(d.top+d.height-m)+"px)"}})(a,i);o&&(i.style.webkitTransform=o,i.style.transform=o)}}var Wa=n.forwardRef(function(a,i){var o=a.children,t=a.direction,r=t===void 0?"down":t,s=a.in,d=a.style,u=a.timeout,l=u===void 0?0:u,c=a.onEnter,m=a.onEntered,x=a.onExit,g=a.onExited,p=Ot(a,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),f=n.useRef(null),b=Lo(o.ref,f),k=Lo(b,i),C=n.useCallback(function(){f.current&&Xt(r,f.current)},[r]);return n.useEffect(function(){if(!s&&r!=="down"&&r!=="right"){var h=(function(E,v){var P;function R(){for(var M=this,N=arguments.length,A=new Array(N),j=0;j<N;j++)A[j]=arguments[j];clearTimeout(P),P=setTimeout(function(){E.apply(M,A)},v)}return v===void 0&&(v=166),R.clear=function(){clearTimeout(P)},R})(function(){f.current&&Xt(r,f.current)}),w=za(f.current);return w.addEventListener("resize",h),function(){h.clear(),w.removeEventListener("resize",h)}}},[r,s]),n.useEffect(function(){s||C()},[s,C]),n.createElement(cn,Object.assign({appear:!0,nodeRef:f,onEnter:function(h,w){Xt(r,h),Ha(h),c&&c(h,w)},onEntered:m,onEntering:function(h){var w=d?.transitionTimingFunction||Dl,E=ro({timeout:l,mode:"enter",style:fe({},d,{transitionTimingFunction:w})});h.style.webkitTransition=dt("-webkit-transform",E),h.style.transition=dt("transform",E),h.style.webkitTransform="none",h.style.transform="none"},onExit:function(h){var w=d?.transitionTimingFunction||Fl,E=ro({timeout:l,mode:"exit",style:fe({},d,{transitionTimingFunction:w})});h.style.webkitTransition=dt("-webkit-transform",E),h.style.transition=dt("transform",E),Xt(r,h),x&&x(h)},onExited:function(h){h.style.webkitTransition="",h.style.transition="",g&&g(h)},in:s,timeout:l},p),function(h,w){return n.cloneElement(o,fe({ref:k,style:fe({visibility:h!=="exited"||s?void 0:"hidden"},d,{},o.props.style)},w))})});Wa.displayName="Slide";var co=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))},Il=function(){return n.createElement(co,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`}))},Nl=function(){return n.createElement(co,null,n.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Ol=function(){return n.createElement(co,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`}))},Al=function(){return n.createElement(co,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`}))},Ze={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:n.createElement(Il,null),warning:n.createElement(Nl,null),error:n.createElement(Ol,null),info:n.createElement(Al,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:Wa,transitionDuration:{enter:225,exit:195}},Ll=function(a,i){return function(o,t){return t===void 0&&(t=!1),t?fe({},Ze[o],{},i[o],{},a[o]):o==="autoHideDuration"?(r=a.autoHideDuration,s=i.autoHideDuration,(d=function(u){return typeof u=="number"||u===null})(r)?r:d(s)?s:Ze.autoHideDuration):o==="transitionDuration"?(function(u,l){var c=function(m,x){return x.some(function(g){return typeof m===g})};return c(u,["string","number"])?u:c(u,["object"])?fe({},Ze.transitionDuration,{},c(l,["object"])&&l,{},u):c(l,["string","number"])?l:c(l,["object"])?fe({},Ze.transitionDuration,{},l):Ze.transitionDuration})(a.transitionDuration,i.transitionDuration):a[o]||i[o]||Ze[o];var r,s,d}};function At(a){return Object.entries(a).reduce(function(i,o){var t,r=o[0],s=o[1];return fe({},i,((t={})[r]=Ao(s),t))},{})}var Hl="notistack-SnackbarContainer",zl="notistack-Snackbar",$a="notistack-CollapseWrapper",Wl="notistack-MuiContent",$l=function(a){return"notistack-MuiContent-"+a},pr=At({root:{height:0},entered:{height:"auto"}}),Po="0px",Va=n.forwardRef(function(a,i){var o=a.children,t=a.in,r=a.onExited,s=n.useRef(null),d=n.useRef(null),u=Lo(i,d),l=function(){return s.current?s.current.clientHeight:0};return n.createElement(cn,{in:t,unmountOnExit:!0,onEnter:function(c){c.style.height=Po},onEntered:function(c){c.style.height="auto"},onEntering:function(c){var m=l(),x=ro({timeout:175,mode:"enter"}),g=x.duration,p=x.easing;c.style.transitionDuration=typeof g=="string"?g:g+"ms",c.style.height=m+"px",c.style.transitionTimingFunction=p||""},onExit:function(c){c.style.height=l()+"px"},onExited:r,onExiting:function(c){Ha(c);var m=ro({timeout:175,mode:"exit"}),x=m.duration,g=m.easing;c.style.transitionDuration=typeof x=="string"?x:x+"ms",c.style.height=Po,c.style.transitionTimingFunction=g||""},nodeRef:d,timeout:175},function(c,m){return n.createElement("div",Object.assign({ref:u,className:Ve(pr.root,c==="entered"&&pr.entered),style:fe({pointerEvents:"all",overflow:"hidden",minHeight:Po,transition:dt("height")},c==="entered"&&{overflow:"visible"},{},c==="exited"&&!t&&{visibility:"hidden"})},m),n.createElement("div",{ref:s,className:$a,style:{display:"flex",width:"100%"}},o))})});Va.displayName="Collapse";var fr={right:"left",left:"right",bottom:"up",top:"down"},Vl=function(a){return"anchorOrigin"+sn(a)},Kl=function(){};function Dt(a,i){return a.reduce(function(o,t){return t==null?o:function(){for(var r=arguments.length,s=new Array(r),d=0;d<r;d++)s[d]=arguments[d];var u=[].concat(s);i&&u.indexOf(i)===-1&&u.push(i),o.apply(this,u),t.apply(this,u)}},Kl)}var _l=typeof window<"u"?n.useLayoutEffect:n.useEffect;function hr(a){var i=n.useRef(a);return _l(function(){i.current=a}),n.useCallback(function(){return i.current.apply(void 0,arguments)},[])}var Ro,Ka=n.forwardRef(function(a,i){var o=a.children,t=a.className,r=a.autoHideDuration,s=a.disableWindowBlurListener,d=s!==void 0&&s,u=a.onClose,l=a.id,c=a.open,m=a.SnackbarProps,x=m===void 0?{}:m,g=n.useRef(),p=hr(function(){u&&u.apply(void 0,arguments)}),f=hr(function(C){u&&C!=null&&(g.current&&clearTimeout(g.current),g.current=setTimeout(function(){p(null,"timeout",l)},C))});n.useEffect(function(){return c&&f(r),function(){g.current&&clearTimeout(g.current)}},[c,r,f]);var b=function(){g.current&&clearTimeout(g.current)},k=n.useCallback(function(){r!=null&&f(.5*r)},[r,f]);return n.useEffect(function(){if(!d&&c)return window.addEventListener("focus",k),window.addEventListener("blur",b),function(){window.removeEventListener("focus",k),window.removeEventListener("blur",b)}},[d,k,c]),n.createElement("div",Object.assign({ref:i},x,{className:Ve(zl,t),onMouseEnter:function(C){x.onMouseEnter&&x.onMouseEnter(C),b()},onMouseLeave:function(C){x.onMouseLeave&&x.onMouseLeave(C),k()}}),o)});Ka.displayName="Snackbar";var Ul=At({root:(Ro={display:"flex",flexWrap:"wrap",flexGrow:1},Ro[to]={flexGrow:"initial",minWidth:"288px"},Ro)}),dn=n.forwardRef(function(a,i){var o=a.className,t=Ot(a,["className"]);return n.createElement("div",Object.assign({ref:i,className:Ve(Ul.root,o)},t))});dn.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"}}),gr="notistack-snackbar",_a=n.forwardRef(function(a,i){var o=a.id,t=a.message,r=a.action,s=a.iconVariant,d=a.variant,u=a.hideIconVariant,l=a.style,c=a.className,m=s[d],x=r;return typeof x=="function"&&(x=x(o)),n.createElement(dn,{ref:i,role:"alert","aria-describedby":gr,style:l,className:Ve(Wl,$l(d),Bt.root,Bt[d],c,!u&&m&&Bt.lessPadding)},n.createElement("div",{id:gr,className:Bt.message},u?null:m,t),x&&n.createElement("div",{className:Bt.action},x))});_a.displayName="MaterialDesignContent";var Pt,Mo,Yt,Zt,Do,ql=n.memo(_a),Gl=At({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Xl=function(a){var i=n.useRef(),o=n.useState(!0),t=o[0],r=o[1],s=Dt([a.snack.onClose,a.onClose]),d=n.useCallback(function(){i.current=setTimeout(function(){r(function(M){return!M})},125)},[]);n.useEffect(function(){return function(){i.current&&clearTimeout(i.current)}},[]);var u,l=a.snack,c=a.classes,m=a.Component,x=m===void 0?ql:m,g=n.useMemo(function(){return(function(M){M===void 0&&(M={});var N={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(M).filter(function(A){return!N[A]}).reduce(function(A,j){var B;return fe({},A,((B={})[j]=M[j],B))},{})})(c)},[c]),p=l.open,f=l.SnackbarProps,b=l.TransitionComponent,k=l.TransitionProps,C=l.transitionDuration,h=l.disableWindowBlurListener,w=l.content,E=Ot(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),v=fe({direction:(u=E.anchorOrigin,u.horizontal!=="center"?fr[u.horizontal]:fr[u.vertical]),timeout:C},k),P=w;typeof P=="function"&&(P=P(E.id,E.message));var R=["onEnter","onEntered","onExit","onExited"].reduce(function(M,N){var A;return fe({},M,((A={})[N]=Dt([a.snack[N],a[N]],E.id),A))},{});return n.createElement(Va,{in:t,onExited:R.onExited},n.createElement(Ka,{open:p,id:E.id,disableWindowBlurListener:h,autoHideDuration:E.autoHideDuration,className:Ve(Gl.wrappedRoot,g.root,g[Vl(E.anchorOrigin)]),SnackbarProps:f,onClose:s},n.createElement(b,Object.assign({},v,{appear:!0,in:p,onExit:R.onExit,onExited:d,onEnter:R.onEnter,onEntered:Dt([R.onEntered,function(){a.snack.requestClose&&s(null,"instructed",a.snack.id)}],E.id)}),P||n.createElement(x,Object.assign({},E)))))},Rt={default:20},Qt={default:6,dense:2},xr="."+$a,Jt=At({root:(Pt={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:dt(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},Pt[xr]={padding:Qt.default+"px 0px",transition:"padding 300ms ease 0ms"},Pt.maxWidth="calc(100% - "+2*Rt.default+"px)",Pt[Bo]={width:"100%",maxWidth:"calc(100% - 32px)"},Pt),rootDense:(Mo={},Mo[xr]={padding:Qt.dense+"px 0px"},Mo),top:{top:Rt.default-Qt.default+"px",flexDirection:"column"},bottom:{bottom:Rt.default-Qt.default+"px",flexDirection:"column-reverse"},left:(Yt={left:Rt.default+"px"},Yt[to]={alignItems:"flex-start"},Yt[Bo]={left:"16px"},Yt),right:(Zt={right:Rt.default+"px"},Zt[to]={alignItems:"flex-end"},Zt[Bo]={right:"16px"},Zt),center:(Do={left:"50%",transform:"translateX(-50%)"},Do[to]={alignItems:"center"},Do)}),Yl=function(a){var i=a.classes,o=i===void 0?{}:i,t=a.anchorOrigin,r=a.dense,s=a.children,d=Ve(Hl,Jt[t.vertical],Jt[t.horizontal],Jt.root,o.containerRoot,o["containerAnchorOrigin"+sn(t)],r&&Jt.rootDense);return n.createElement("div",{className:d},s)},Zl=n.memo(Yl),br=function(a){return!(typeof a=="string"||n.isValidElement(a))},Ql=(function(a){function i(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 d=br(r)?r:s,u=br(r)?r.message:r,l=d.key,c=d.preventDuplicate,m=Ot(d,["key","preventDuplicate"]),x=qt(l),g=x?l:new Date().getTime()+Math.random(),p=Ll(m,t.props),f=fe({id:g},m,{message:u,open:!0,entered:!1,requestClose:!1,persist:p("persist"),action:p("action"),content:p("content"),variant:p("variant"),anchorOrigin:p("anchorOrigin"),disableWindowBlurListener:p("disableWindowBlurListener"),autoHideDuration:p("autoHideDuration"),hideIconVariant:p("hideIconVariant"),TransitionComponent:p("TransitionComponent"),transitionDuration:p("transitionDuration"),TransitionProps:p("TransitionProps",!0),iconVariant:p("iconVariant",!0),style:p("style",!0),SnackbarProps:p("SnackbarProps",!0),className:Ve(t.props.className,m.className)});return f.persist&&(f.autoHideDuration=void 0),t.setState(function(b){if(c===void 0&&t.props.preventDuplicate||c){var k=function(w){return x?w.id===g:w.message===u},C=b.queue.findIndex(k)>-1,h=b.snacks.findIndex(k)>-1;if(C||h)return b}return t.handleDisplaySnack(fe({},b,{queue:[].concat(b.queue,[f])}))}),g},t.handleDisplaySnack=function(r){return r.snacks.length>=t.maxSnack?t.handleDismissOldest(r):t.processQueue(r)},t.processQueue=function(r){var s=r.queue,d=r.snacks;return s.length>0?fe({},r,{snacks:[].concat(d,[s[0]]),queue:s.slice(1,s.length)}):r},t.handleDismissOldest=function(r){if(r.snacks.some(function(l){return!l.open||l.requestClose}))return r;var s=!1,d=!1;r.snacks.reduce(function(l,c){return l+(c.open&&c.persist?1:0)},0)===t.maxSnack&&(d=!0);var u=r.snacks.map(function(l){return s||l.persist&&!d?fe({},l):(s=!0,l.entered?(l.onClose&&l.onClose(null,"maxsnack",l.id),t.props.onClose&&t.props.onClose(null,"maxsnack",l.id),fe({},l,{open:!1})):fe({},l,{requestClose:!0}))});return fe({},r,{snacks:u})},t.handleEnteredSnack=function(r,s,d){if(!qt(d))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState(function(u){return{snacks:u.snacks.map(function(l){return l.id===d?fe({},l,{entered:!0}):fe({},l)})}})},t.handleCloseSnack=function(r,s,d){t.props.onClose&&t.props.onClose(r,s,d);var u=d===void 0;t.setState(function(l){var c=l.snacks,m=l.queue;return{snacks:c.map(function(x){return u||x.id===d?x.entered?fe({},x,{open:!1}):fe({},x,{requestClose:!0}):fe({},x)}),queue:m.filter(function(x){return x.id!==d})}})},t.closeSnackbar=function(r){var s=t.state.snacks.find(function(d){return d.id===r});qt(r)&&s&&s.onClose&&s.onClose(null,"instructed",r),t.handleCloseSnack(null,"instructed",r)},t.handleExitedSnack=function(r,s){if(!qt(s))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState(function(d){var u=t.processQueue(fe({},d,{snacks:d.snacks.filter(function(l){return l.id!==s})}));return u.queue.length===0?u:t.handleDismissOldest(u)})},t.enqueueSnackbar,t.closeSnackbar,t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar.bind(lr(t)),closeSnackbar:t.closeSnackbar.bind(lr(t))}},t}return Aa(i,a),i.prototype.render=function(){var o=this,t=this.state.contextValue,r=this.props,s=r.domRoot,d=r.children,u=r.dense,l=u!==void 0&&u,c=r.Components,m=c===void 0?{}:c,x=r.classes,g=this.state.snacks.reduce(function(f,b){var k,C=sn(b.anchorOrigin),h=f[C]||[];return fe({},f,((k={})[C]=[].concat(h,[b]),k))},{}),p=Object.keys(g).map(function(f){var b=g[f],k=b[0];return n.createElement(Zl,{key:f,dense:l,anchorOrigin:k.anchorOrigin,classes:x},b.map(function(C){return n.createElement(Xl,{key:C.id,snack:C,classes:x,Component:m[C.variant],onClose:o.handleCloseSnack,onEnter:o.props.onEnter,onExit:o.props.onExit,onExited:Dt([o.handleExitedSnack,o.props.onExited],C.id),onEntered:Dt([o.handleEnteredSnack,o.props.onEntered],C.id)})}))});return n.createElement(La.Provider,{value:t},d,s?Je.createPortal(p,s):p)},Oa(i,[{key:"maxSnack",get:function(){return this.props.maxSnack||Ze.maxSnack}}]),i})(n.Component),Ua=function(){return n.useContext(La)};const Jl=[{key:"SheetXL",description:"SheetXL",mimeType:".sxl",exts:["sxl"],handler:null,isDefault:!0},{key:"CSV",description:"Comma Delimited",mimeType:"text/csv",exts:["csv"],handler:null},{key:"Excel",description:"Excel Workbook",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",exts:["xlsx","xls","xlsm"],handler:null}],es=[{key:"SheetXL",mimeType:"application/vnd.sheetxl.sheet",description:"SheetXL",ext:"sxl",handler:null,isDefault:!0},{key:"CSV",mimeType:"text/csv",description:"Comma Delimited",ext:"csv",handler:null},{key:"Excel",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",description:"Excel Workbook",ext:"xlsx",tags:["SheetJS Pro"],handler:null}];class qa{constructor(i=Jl,o=es){this._readFormatType=[],this._writeFormatType=[],this._readFormatType=Object.freeze([...i]),this._writeFormatType=Object.freeze([...o])}getReadFormats(){return this._readFormatType}getWriteFormats(){return this._writeFormatType}getAllReadFormatTypeAsString(){const i=[],o=this._readFormatType;for(let t=0;t<o.length;t++)for(let r=0;r<o[t].exts.length;r++)i.push("."+o[t].exts[r]);return i}async writeFile(i,o,t){if(!o||!i)throw new Error("Workbook model or file name must be provided.");try{return(await import("@sheetxl/io")).WorkbookIO.writeFile(i,o,t)}catch(r){throw new Error("Unable to load io library",{cause:r})}}async read(i,o){let t,r;const s=await o?.showBusy?.(`Opening${i.name?` ${i.name}`:""}...`);try{r=await import("@sheetxl/io")}catch(d){throw d}try{return await r.WorkbookIO.read({...i,progress:{async onStart(d){await i?.progress?.onStart?.(d),t=await o?.showBusy?.(`Opening '${d}'...`)}}})}catch(d){throw s?.(),t?.(),d}finally{s?.(),t?.()}}}const $e=new qa,Le={card:"_card_1a398_7",actionRoot:"_actionRoot_1a398_11",icons:"_icons_1a398_16",expand:"_expand_1a398_22",expandOpen:"_expandOpen_1a398_29",stackTraceContainer:"_stackTraceContainer_1a398_33"},Ga=n.forwardRef((a,i)=>{const{id:o,message:t,iconVariant:r,error:s,hideIconVariant:d,...u}=a,{closeSnackbar:l}=Ua(),c=Y.useTheme(),[m,x]=n.useState(!1),g=n.useCallback(()=>{x(b=>!b)},[]),p=n.useCallback(()=>{l(o)},[o,l]);let f=s?.message;return!f&&n.isValidElement(t)&&(f=t),f||typeof t!="string"||(f=t),f||(f=`Unknown Error: ${t}`),e.jsx(dn,{ref:i,className:pe(Le.root,"error-snackbar"),children:e.jsxs(T.Card,{className:Le.card,style:{backgroundColor:c.palette.error.dark,border:`1px solid ${c.palette.error.dark}`},children:[e.jsxs(T.CardActions,{className:Le.actionRoot,children:[d?null:r?.error,e.jsx(T.Typography,{variant:"body2",component:"div",className:Le.typography,children:f}),e.jsx("div",{style:{flex:"1 1 auto"}}),e.jsxs("div",{className:Le.icons,children:[s?e.jsx(T.IconButton,{"aria-label":"Show more",size:"small",className:pe(Le.expand,{[Le.expandOpen]:m}),onClick:g,children:e.jsx(S.DynamicIcon,{iconKey:"ExpandMore"})}):null,e.jsx(T.IconButton,{size:"small",className:Le.expand,onClick:p,children:e.jsx(S.DynamicIcon,{iconKey:"Close",style:{transform:"scale(0.8)"}})})]})]}),s?e.jsx(T.Collapse,{in:m,timeout:"auto",unmountOnExit:!0,children:e.jsx("div",{className:Le.stackTraceContainer,style:{backgroundColor:c.palette.error.light,borderTop:`1px solid ${c.palette.error.main}`},children:e.jsx(y.StackTrace,{error:s,hideLineNumbers:!0})})}):null]})})});Ga.displayName="ToastError";const Xa=n.memo(n.forwardRef((a,i)=>{const{commands:o,commandHook:t,scope:r="workbook",disabled:s=!1,...d}=a,u=S.useCallbackRef(c=>{const m={variant:S.CommandButtonType.Menuitem,parentFloat:c.floatReference,commandHook:t,scope:r,disabled:s},x=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:g=>{const p={...m,parentFloat:g.floatReference,scope:"saveWorkbook"},f=[];return $e.getWriteFormats().forEach(b=>{if(b.isDefault)return;const k=b.key,C=o.getCommand(`saveWorkbookAs${k}`);C?f.push(n.createElement(y.CommandButton,{...p,key:k,command:C})):console.warn(`Unable to resolve command: 'saveWorkbookAs${k}'`)}),y.defaultCreatePopupPanel({...g,children:f,onClick:()=>{g.closeFloatAll()}})}})]});return y.defaultCreatePopupPanel({...c,children:x,onClick:g=>{g.isDefaultPrevented||c.closeFloatAll()}})},[s,o,t,r]),l="File";return e.jsx(y.CommandPopupButton,{commands:o,disabled:s,commandHook:t,scope:r,label:l,tooltip:"Options for saving and loading the workbook.",sx:{paddingBottom:"0px","& button":{paddingTop:"0px",paddingBottom:"0px",height:c=>`calc(1.25rem + ${c.spacing(2)}px)`}},...d,createPopupPanel:u,icon:e.jsx(y.LabelIcon,{className:"label",icon:null,label:l})})}));Xa.displayName="StandaloneFileCommandButton";const ts=e.jsx(y.ExhibitTooltip,{label:"SheetXL",description:"Visit me at sheetxl.com.",children:e.jsx(T.Box,{sx:{width:"24px",height:"24px",marginBottom:"4px",marginLeft:"6px"},children:e.jsx(ae.LogoNoPaddingIcon,{onClick:()=>{window?.open("https://www.sheetxl.com","_blank")},style:{width:"24px",height:"24px",cursor:"pointer"}})})}),Ya=n.memo(n.forwardRef((a,i)=>{const{commands:o,workbook:t,logo:r=ts,mainElement:s,showFileMenu:d=!0,showAppearanceMenu:u=!0,...l}=a,{reference:c}=y.useFloatStack(),[m,{width:x}]=ft(),g=x<530,p=d?e.jsx(Xa,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(C,h,w){}}}):null,f=u?e.jsx(Jr,{commands:o,commandHook:{beforeExecute(){c?.closeAll()},onError(C,h,w){}}}):null,b=n.useMemo(()=>({paddingLeft:C=>C.spacing(1),paddingRight:C=>C.spacing(1)}),[]),k=n.useRef(null);return e.jsx(T.Box,{ref:Nt([k,m,i]),...l,children:Ba({commands:o,renderCompact:g,workbook:t,selectWrapper:C=>e.jsxs(T.Box,{sx:{display:"flex",flex:"1",flexDirection:"row",alignItems:"stretch",gap:h=>h.spacing(1),paddingLeft:h=>h.spacing(1),paddingRight:h=>h.spacing(1)},children:[e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",flex:"1 1 100%",gap:h=>h.spacing(.5)},children:[r,e.jsxs(T.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:h=>h.spacing(.25)},children:[p,C]})]}),e.jsx(T.Box,{sx:{display:"flex",flexDirection:"row",flex:"1 1 300%",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:s}),e.jsx(T.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"end",flex:g&&!f?"0 0 auto":"1 1 100%"},children:f})]}),selectProps:b,toolbarsProps:{Home:{sx:{}}}})})}));Ya.displayName="StudioToolbar";const Za=n.memo(n.forwardRef((a,i)=>{const{workbook:o,setWorkbook:t,refWorkbookTitle:r,titleWorkbook:s,setWorkbookTitle:d,titlePlaceHolder:u,children:l,undoManager:c,commands:m,importExportDisabled:x,themeOptions:g}=a,p=Ua(),f=p?p.enqueueSnackbar:()=>{},b=p?p.closeSnackbar:()=>{},[k,C]=n.useState({isMounted:!1,label:null,starting:new Map,running:new Map}),h=n.useCallback(()=>{C(z=>({...z,isMounted:!0}))},[]),w=n.useCallback(()=>{C(z=>({...z,isMounted:!1}))},[]),E={},v=y.useLazyWindow(E),P=y.useOptionsDialog(E),R=y.useInputDialog(E),M=n.useRef(new Set),N=n.useMemo(()=>{const z=(U,q)=>{if(q?.onceKey){if(M.current.has(q.onceKey))return;const _=new Set(M.current);_.add(q.onceKey),M.current=_}const G={variant:q?.type??S.NotifierType.Info,anchorOrigin:{vertical:"top",horizontal:"center"},preventDuplicate:q?.preventDuplicate,persist:q?.persist??q?.type===S.NotifierType.Error,action:_=>e.jsx(T.IconButton,{onClick:()=>b(_),children:e.jsx(S.DynamicIcon,{iconKey:"Cancel"})})};q?.enqueueProps&&Object.assign(G,q.enqueueProps),U||console.log("message is 'null'",q),f(U??"Alert",G)},D={showMessage:z,showBusy:(U,q)=>{let G=null;const _=new Promise(K=>{G=K});return C(K=>{const J=new Map(K.starting);return J.set(_,G),{...K,label:U,starting:J}}),_},showWindow:(U,q,G)=>{const _={...q,onKeyDown:K=>{m?.dispatchToFocusedCommand(K),K.isDefaultPrevented()||K.isPropagationStopped()||q?.onKeyDown?.(K)}};return v(U,{sort:()=>Promise.resolve().then(()=>require("./7MV1n9Y0yXU0hKpM.cjs")),numberFormat:()=>Promise.resolve().then(()=>require("./KOj1qev47_vzzRFV.cjs")),hyperlink:()=>Promise.resolve().then(()=>require("./St8H4B5iT2fsqOb7.cjs")),comments:()=>Promise.resolve().then(()=>require("./D7AH724IJJvos02e.cjs")),find:()=>Promise.resolve().then(()=>require("./BEmcHbiMOFhIa91S.cjs")),tableDetails:()=>Promise.resolve().then(()=>require("./TS1uQTjkemJ22p1Y.cjs")),tableNew:()=>Promise.resolve().then(()=>require("./BdNRaXTgqRzPmg0L.cjs")),namedDetails:()=>Promise.resolve().then(()=>require("./B8-dSgXI2XZKFvtp.cjs"))}[U],_,G)},showOptions:P,showInputOptions:R,showError:U=>{let q,G=S.NotifierType.Error,_="Unknown Error";typeof U=="string"?_=U:U instanceof Error&&(q=U,U.message&&(_=U.message)),U instanceof Ie.PartialError&&(G=S.NotifierType.Info),z(_,{type:G,enqueueProps:{error:q}})}},W=new S.DefaultReactNotifier;return W.setOverrides(D),W},[]),A=n.useCallback(()=>{},[]),j=(z=>{const{workbook:D,setWorkbook:W,notifier:U,importExportDisabled:q,workbookTitle:G="export",setWorkbookTitle:_,requestWorkbookTitle:K,themeOptions:J,undoManager:ee,commands:F,onExecute:ie}=z,ne=S.useCallbackRef(J?.onModeChange,[J?.onModeChange]),le=S.useCallbackRef(J?.onEnabledDarkGridChange,[J?.onEnabledDarkGridChange]),he=S.useCallbackRef(J?.onEnabledDarkImagesChange,[J?.onEnabledDarkImagesChange]),be=S.useCallbackRef(async(re=null,ge=null)=>{const se=[];let ue,X=null,oe=null;if(typeof re=="string"?oe=re:X=re,ue=X?re:await Ie.CommonUtils.openFileDialog(oe??$e.getAllReadFormatTypeAsString().join(",")),!ue)return null;const ve={source:ue,createWorkbookOptions:ge,onWarning:Ke=>{se.push(Ke)}},Pe=await $e.read(ve,U);return se.length>0&&(U.showMessage("Some elements were not able to be imported. See console for details."),console.warn(`Import warnings:
|
|
19
|
-
`+se.join(`
|
|
20
|
-
`))),Pe},[ie,U,D]),Te=S.useCallbackRef(async(re,ge,se)=>{if(!ge&&K){const ue=await K("Enter Workbook name to "+(se.isDefault?"Save.":`Export as ${se.description}.`));return ue!==null&&$e.writeFile(ue,re,{formatType:se.key})}return $e.writeFile(ge,re,{formatType:se.key})},[U,D,K]),de=n.useCallback(()=>({contains:re=>!0,focus(){}}),[]),Z=n.useMemo(()=>{const re=[];q||($e.getWriteFormats().forEach(se=>{const ue=se.isDefault,X={label:ue?"Save Workbook":`Save Workbook as ${se.description}`,scopedLabels:{workbook:"Save",saveWorkbook:`as ${se.description}`},tags:se.tags,description:`Save the workbook to the desktop${ue?"":` as ${se.description}`}.`,icon:"FileDownloadAsSheet"};ue&&(X.shortcut={key:"S",modifiers:[S.KeyModifiers.Ctrl]},re.push(new S.Command("saveWorkbookAs",de,{label:"Save Workbook As…",scopedLabels:{workbook:"Save as…",saveWorkbook:"as…"},shortcut:[{key:"S",modifiers:[S.KeyModifiers.Shift,S.KeyModifiers.Ctrl]},{key:"F12"}],description:"Save the workbook to the desktop with the provided name."},()=>{Te(D,null,se).catch(Pe=>{U.showError(Pe)})})));const oe=se.key,ve=ue?"saveWorkbook":`saveWorkbookAs${oe}`;oe==="CSV"?X.icon="FileDownloadAsCSV":oe==="Excel"&&(X.icon="FileDownloadAsExcel"),re.push(new S.Command(ve,de,X,Pe=>{Te(D,Pe??G,se).catch(Ke=>{U.showError(Ke)})}))}),re.push(new S.Command("openWorkbook",de,{label:"Open Workbook…",scopedLabels:{workbook:"Open…"},description:"Open a workbook from the desktop.",icon:"FileOpen",shortcut:{key:"O",modifiers:[S.KeyModifiers.Ctrl]}},async(se=null)=>{const ue={date1904:D.isDate1904(),...D.options};try{const X=await be(se,ue);if(!X)return;const oe=X.title,ve=X.workbook,Pe=ve.getSelectedSheet();if(X.formatType.mimeType==="text/csv"){const Ke=D.findValidSheetName(oe);await D.doBatch(async()=>{const uo=Pe.getUsedRange();if(!uo)return void U.showMessage("The file appears to be blank.");await D.getSheets().add({name:Ke,autoSelect:!0}).getRange({colStart:0,rowStart:0,colEnd:0,rowEnd:0}).copyFrom(uo)},`Import CSV '${oe}'`)}else D?.close(),_?.(oe),W(ve)}catch(X){U.showError(X)}})),re.push(new S.Command("openWorkbookFromUrl",de,{label:"Open Workbook From Web",scopedLabels:{insert:"From Web",workbook:"From Web…"},description:"Open a workbook from the web."},async function(se){if(!se){const ue=await U.showInputOptions({title:"Open Workbook from the Web",description:"Enter the web address for the workbook to open.",inputLabel:"Address",initialValue:"https://www.sheetxl.com/examples/features-checklist.xlsx",inputProps:{style:{minWidth:"440px"}},options:["Open"]});if(ue.option!=="Open")return;se=ue.input}se&&console.log("openWorkbookFromUrl",se)})));let ge=[];return J&&(ge=[new S.Command("themeMode",de,{label:"Light/Dark Mode",scopedLabels:{appearance:"Light/Dark Mode"},description:"Toggle the application styling between light and dark mode."}),new S.Command("defaultThemeMode",de,{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 S.Command("enableDarkGrid",de,{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 S.Command("enableDarkImages",de,{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,...ge,new S.SimpleCommand("help",de,{label:"Show Help",description:"Provide Help.",icon:"Documentation",shortcut:{key:"F1"}},()=>{}),new S.SimpleCommand("showKeyboardShortcuts",de,{label:"Keyboard Shortcuts",description:"Show keyboard shortcuts.",icon:"Keyboard",shortcut:{key:"/",modifiers:[S.KeyModifiers.Ctrl]}},()=>{}),new S.Command("gotoUrlGithub",de,{label:"Github",description:"Download examples, explore source code, and leave a star.",icon:"Github"},()=>{window?.open("https://github.com/sheetxl/sheetxl")}),new S.Command("gotoUrlDiscord",de,{label:"Discord",description:"Join our community on discord.",icon:"Discord"},()=>{window?.open("https://discord.gg/NTKdwUgK9p")}),new S.Command("gotoUrlDocumentation",de,{label:"Documentation",description:"Read the documentation.",icon:"Documentation"},()=>{window?.open("https://www.sheetxl.com/docs")}),new S.Command("gotoUrlIssue",de,{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")})]},[D,G,U,q,J,F,ee]),V=n.useMemo(()=>{let re=null;return re=F?F.createChildGroup(de,"standaloneWorkbook",!1):new S.CommandGroup(de,"standaloneWorkbook"),re.addCommands(Z,!0),re},[F,Z]);S.useUndoManager({manager:ee,commands:V});const Q=T.useMediaQuery("(prefers-color-scheme: dark)"),{themeMode:me}=y.useResolvedThemeMode();n.useEffect(()=>{if(!J||!V)return;const re=J.mode==="dark"||!J.mode&&me==="dark";V.getCommand("themeMode").update({state:J.mode??null,label:re?"Dark Mode":"Light Mode",scopedLabels:{appearance:re?"Dark Mode":"Light Mode"},icon:re?"DarkMode":"LightMode"}).updateCallback(()=>{ne(re?y.ThemeMode.Light:y.ThemeMode.Dark)}),V.getCommand("defaultThemeMode").update({state:!J.mode,icon:Q?"SystemDefaultDarkMode":"SystemDefaultLightMode"}).updateCallback(()=>{ne(null)}),V.getCommand("enableDarkGrid").update({state:J.enableDarkGrid}).updateCallback(()=>{le(!J.enableDarkGrid)}),V.getCommand("enableDarkImages").update({state:J.enableDarkImages}).updateCallback(()=>{he(!J.enableDarkImages)})},[me,J,Z]);const{showModal:Be}=y.useModal();return n.useEffect(()=>{const re=()=>new Promise((ge,se)=>{const ue=n.lazy(()=>Promise.resolve().then(()=>require("./Ce6JLd3qejgMgM3r.cjs"))),X=Be(ue,{title:"Shortcut Keys Reference",commands:V,onDone:()=>{X.hide()},TransitionProps:{onExited:()=>{ge(!0)}}})});V.getCommand("showKeyboardShortcuts").updateCallback(()=>re()),V.getCommand("help").updateCallback(()=>re())},[Z,V]),V})({notifier:N,workbook:o,setWorkbook:t,importExportDisabled:x,workbookTitle:s,setWorkbookTitle:d,commands:m,requestWorkbookTitle:z=>new Promise(D=>{r.current?r.current.requestWorkbookTitle((W,U)=>{D(W)},{selectAll:!0,requestReason:z}):D(u)}),themeOptions:g,undoManager:c,onExecute:A});n.useEffect(()=>{k.starting.size<=0||!k.isMounted||C(z=>{const D=new Map(z.running);return z.starting.forEach((W,U)=>{const q=()=>{C(G=>{const _=new Map(G.running);return _.delete(U),{...G,running:_}})};D.set(U,q),W(q)}),{...z,starting:new Map,running:D}})},[k]);const[B,I]=n.useState(null);n.useEffect(()=>{k.starting.size!==0||k.running.size!==0?I(e.jsx(y.LoadingPanel,{icon:e.jsx(y.AnimatedTraversingEllipsisIcon,{sx:{transform:"scale(0.7)",marginLeft:"-6px"}}),panel:!0,label:k.label,onMount:h,onUnmount:w,sx:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",zIndex:"9999"}})):I(null)},[k.starting,k.running]);const H=n.useMemo(()=>e.jsx(ea,{commands:j,disableHover:!0,sx:{padding:"0"},buttonProps:{sx:{maxHeight:"22px"}}}),[j]),O={commands:j};return o&&(O.statusBarProps={childrenEnd:H}),e.jsxs(S.NotifierProvider,{notifier:N,children:[B,l?n.cloneElement(l,O):null]})}));Za.displayName="SnackbarAndCommandsWrapper";const os=n.memo(n.forwardRef((a,i)=>{const{children:o,title:t,taskPanes:r,onSelect:s,selected:d,registry:u=ae.DefaultTaskPaneRegistry,style:l,iconsOnly:c,className:m,...x}=a,g=n.useMemo(()=>r.map(b=>{const k=u.getRegisteredTaskPane(b);if(!k)return null;let C=k.getIcon?.();C&&(typeof C=="string"&&(C=e.jsx(S.DynamicIcon,{iconKey:C})),C=e.jsx("span",{style:{display:"inline-block",transform:"rotate(90deg)",transformOrigin:"center"},children:C}));const h=b===d;return e.jsx(T.Tab,{value:b,label:e.jsx(y.SimpleTooltip,{disableInteractive:!0,title:k.getTitle()??"",placement:"left-start",children:e.jsxs(T.Box,{sx:{padding:"0px 0px",writingMode:"vertical-rl",textOrientation:"mixed",display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"0px",color:w=>w.palette.text.secondary},children:[C&&e.jsx(T.Box,{sx:{display:"inline-block",transformOrigin:"center",color:w=>w.palette.text.secondary},children:C}),c&&C?null:e.jsx(T.Typography,{component:"div",textTransform:"none",sx:{padding:"4px 0px",color:w=>h?w.palette.primary.main:w.palette.text.secondary},children:k.getTitle()})]})}),sx:{padding:"4px 4px",minWidth:"0px",minHeight:"0px",borderRadius:"4px"},className:pe("taskpane-strip-item",{"Mui-selected":h}),onClick:()=>a.onSelect(b)},b)}),[r,d,s,u]),p=S.useImperativeElement(i,()=>({isTaskPaneStrip:()=>!0}),[]),f=n.useMemo(()=>pe("taskpane-strip",m),[m]);return e.jsx(T.Box,{ref:p,className:f,sx:{paddingLeft:"2px",paddingTop:"4px",...l},...x,children:e.jsx(T.Tabs,{orientation:"vertical",variant:"scrollable",value:d,onChange:(b,k)=>{s(k)},slotProps:{list:{sx:{gap:"2px"}},indicator:{sx:{left:"0px",right:"unset"}}},children:g})})})),ns=(a,i)=>e.jsx(os,{ref:i,...a}),rs=n.forwardRef((a,i)=>{const{commands:o,themeOptions:t,model:r,...s}=a,d=`solid ${Y.alpha(t.palette.divider,.2)} 1px`,u=`${t.shape.borderRadius??4}px`,l=`${t.spacing?.(.5)??4}px`,c=n.useRef(null);return e.jsx(ae.TaskPaneArea,{model:r,ref:i,frameProps:{style:{border:d,borderRadius:u,marginBottom:l}},alwaysShowStrip:!0,renderTaskPanelTitle:(m,x)=>{const{title:g,icon:p,onClose:f,readOnly:b,focused:k,...C}=m;return e.jsx(T.DialogTitle,{className:pe({"Mui-selected":k}),sx:{display:"flex",flex:"1 1 %0",color:h=>h.palette.text.secondary,boxSizing:"border-box",padding:"0 0",transitionProperty:"opacity",transitionDuration:h=>`${h.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:h=>h.transitions.duration.shortest/2+"ms"},backgroundColor:h=>Y.alpha(h.palette.action.hover,.03),borderBottom:h=>`solid ${Y.alpha(h.palette.divider,.2)} 1px`},...C,children:e.jsxs(T.Box,{sx:{display:"flex",flex:"1 1 10%",flexDirection:"row",alignItems:"center",marginTop:h=>h.spacing(.25),marginBottom:h=>h.spacing(.25),marginLeft:h=>h.spacing(1),marginRight:h=>h.spacing(1)},children:[e.jsx(T.Box,{sx:{flex:"1 1 100%",paddingLeft:h=>h.spacing(1)},children:g}),e.jsx(y.ExhibitTooltip,{label:"Close",children:e.jsx(T.IconButton,{"aria-label":"close",sx:{color:h=>h.palette.text.icon??h.palette.action.active},touchRippleRef:c,onPointerDown:h=>{c.current?.start(h,{center:!1}),h.stopPropagation(),h.preventDefault()},onPointerUp:()=>{f()},children:e.jsx(S.DynamicIcon,{iconKey:"Close"})})})]})})},renderTaskPaneStrip:ns,...a,onOpen:()=>{a?.onOpen?.()},onClose:()=>{a?.onClose?.()},commands:o,...s})});S.DefaultDynamicIconService.register("plugin-scripts",{icons:{}}),ae.DefaultTaskPaneRegistry.registerTaskPane({key:"scriptEditor",getTitle:()=>"Script (Typescript)",getIcon:()=>"ScriptRun",renderTaskPane:nl},!0);const ao=n.memo(n.forwardRef((a,i)=>{const{className:o,sx:t,style:r,onElementLoad:s,onError:d,undoManager:u,errorPanel:l=y.ErrorPanel,onKeyDown:c,workbook:m,createWorkbookOptions:x,onWorkbookChange:g,logo:p,importExportDisabled:f=!1,themeOptions:b,autoFocus:k=!1,commands:C,title:h,onTitleChange:w,titleProps:E,renderLoadingPanel:v,...P}=a,R=n.useRef(null),M=S.useCallbackRef(g,[g]),N=S.useCallbackRef(w??E?.onTitleChange,[w??E?.onTitleChange]),A=E?.placeHolder??"Untitled",j=b?.mode,{themeMode:B,source:I}=y.useResolvedThemeMode({mode:j}),H=n.useMemo(()=>({...b,light:y.createExhibitTheme(!1,Ie.CommonUtils.deepMerge(b?.theme??{},b?.light??{})),dark:y.createExhibitTheme(!0,Ie.CommonUtils.deepMerge(b?.theme??{},b?.dark??{}))}),[b]),O=B===y.ThemeMode.Dark,[z,D]=n.useState(null);n.useEffect(()=>{D(u??new Ie.UndoManager)},[u]);const[W,U]=n.useState(null),[q,G]=n.useState(null),_=ae.useDocThemes();n.useLayoutEffect(()=>{if(!m||Object.keys(m).length===0&&!Ie.CommonUtils.isPromiseLike(m)){const X={theme:_.getDefaultTheme(),...x};G(new L.Workbook(X))}else G(m)},[m]),n.useLayoutEffect(()=>{if(q){if(q instanceof L.Workbook)return U({workbook:q}),void(m!==q&&M?.(q));(async()=>{try{let X,oe=await Promise.resolve(q);oe&&oe.source&&(oe=await $e.read(oe)),oe.workbook?(ie(oe.title),X=oe.workbook):X=oe,M?.(X),U({workbook:X})}catch(X){M?.(null),U({error:X})}})()}},[q]);const[K,J]=n.useState(null);n.useEffect(()=>{if(!z||!W)return;z.clear();const X=W?.workbook?.getTransactions();if(X)return X.addListener({onCommitEnd:oe=>{oe.getDescription()?z.addUndoOperation({description:oe.getDescription(),undo:()=>(X.revert(oe.getId()),K.source?.focus(),()=>{X.restore(oe.getId()),K.source?.focus()})}):console.warn("commit has no description",oe)}})},[z,W,K]);const ee=S.useCallbackRef(X=>{X?z.setRepeatableOperation({description:X.label(),repeat:async()=>X.execute()}):z.setRepeatableOperation(null)},[z]),[F,ie]=n.useState(h??E?.title??"");n.useEffect(()=>{ie(h??E?.title??"")},[h??E?.title]),n.useEffect(()=>{N?.(F)},[F]);const[ne,le]=n.useState(null),he=n.useMemo(()=>{const X=()=>({contains:oe=>!0,focus(){}});return C?C.createChildGroup(X,"application",!1):new S.CommandGroup(X,"application")},[C]),be=S.useCallbackRef(async X=>{le(X.source.getViewportElement()),J(X),he.activate("sheet"),await S.DefaultDynamicIconService.prefetch(),s?.(X)},[he]);n.useEffect(()=>{K&&k&&K.source?.focus(typeof k=="object"?k:void 0)},[K]);const Te=n.useRef(null),de=n.useCallback(X=>{let oe=null;return E?.hidden||(oe=e.jsx(ln,{...E,style:{maxWidth:"100%",...E?.style},workbook:R.current,ref:Te,title:F,placeHolder:A,onTitleChange:ve=>{ie(ve)}})),e.jsx(Ya,{...X,logo:p,mainElement:oe,showFileMenu:!f,showAppearanceMenu:!!(H?.onEnabledDarkGridChange||H?.onEnabledDarkImagesChange||H?.onModeChange)})},[p,F,E,H,f,he]);n.useEffect(()=>{const X=oe=>oe.preventDefault();return R.current?.addEventListener("wheel",X,{passive:!1}),()=>{R.current?.removeEventListener("wheel",X)}},[]);const Z=n.useMemo(()=>{const X={transparentBackground:!0};return e.jsx(T.Box,{sx:t,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",...r},children:v?.(X)??e.jsx(y.LoadingPanel,{...X})})},[t,r,v]),V=n.useCallback(({error:X})=>(d?.(X),e.jsx(l,{sx:t,style:r,error:X??"Unable to display empty workbook."})),[t,r,d]),Q=n.useMemo(()=>({...t,"& .SnackbarContainer-root":{position:"absolute !important"},"& .notistack-SnackbarContainer > div":{maxWidth:"100%"},"& .notistack-Snackbar":{minWidth:"unset"},"& .notistack-Snackbar > .error-snackbar .MuiTypography-root":{color:X=>X.palette.getContrastText(X.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiCardActions-root":{color:X=>X.palette.getContrastText(X.palette.error.main)},"& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root":{color:X=>X.palette.getContrastText(X.palette.error.main)},"& .notistack-MuiContent *":{fontFamily:X=>X.typography.fontFamily},"& #notistack-snackbar":{maxWidth:"560px",whiteSpace:"pre-wrap"},"*":{userSelect:"none"}}),[t]),[me,Be]=n.useState(null),re=n.useCallback((X,oe)=>e.jsx(rs,{ref:oe,themeOptions:O?H.dark:H.light,model:q,commands:he,...X}),[he,q,O,H]),ge=Nt([R,i]),se=n.useMemo(()=>{if(!W)return Z;if(W.error||!W.workbook)return V({error:W.error});let X=null,oe=null,ve=!1;return H&&(X=O?H.dark:H.light,oe=O&&H.enableDarkGrid?H.dark:H.light,ve=H.enableDarkImages),e.jsx(an,{sx:Q,style:r,tabIndex:0,autoFocus:!0,workbook:W.workbook,ref:ge,renderToolbar:de,onElementLoad:be,onRepeatCommandChange:ee,onKeyDown:Pe=>{c?.(Pe)},renderLoadingPanel:v,gridTheme:oe,headersTheme:X,enableDarkImages:ve,sideBarElement:me,className:pe(o),onContextMenu:Pe=>Pe.preventDefault(),...P},"WorkbookElement")},[W,F,z,Z,v,H,P,de,Q]);let ue=e.jsx(jl,{fallbackRender:V,children:e.jsx(Ql,{maxSnack:3,domRoot:ne,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:3500,onClose:(X,oe,ve)=>{R.current?.focus()},Components:{error:Ga},iconVariant:{success:e.jsx(T.SvgIcon,{style:{marginRight:"8px"},children:e.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"})}),error:e.jsx(S.DynamicIcon,{iconKey:"ErrorAlert",style:{marginRight:"8px"}})},children:e.jsx(ae.TaskPaneProvider,{createArea:re,onUpdateArea:X=>{Be(X)},children:e.jsx(y.ModalProvider,{children:e.jsx(Za,{workbook:W?.workbook,setWorkbook:G,importExportDisabled:f,titlePlaceHolder:A,titleWorkbook:F,setWorkbookTitle:ie,refWorkbookTitle:Te,commands:he,undoManager:z,themeOptions:H,children:se})})})})});return H&&(ue=e.jsxs(Y.ThemeProvider,{theme:O?H.dark:H.light,children:[H.cssBaseline?e.jsx(T.CssBaseline,{}):null,ue]})),ue}));ao.displayName="EagerStudio";const as=Object.freeze(Object.defineProperty({__proto__:null,EagerStudio:ao,default:ao},Symbol.toStringTag,{value:"Module"}));exports.AppearanceCommandButton=Jr,exports.AutoColorPosition=ut,exports.BorderCommandButton=Pr,exports.BorderPopupButton=Br,exports.BorderStyleButton=Tr,exports.Checkboard=jr,exports.ClearCommandButton=zo,exports.ColorButton=io,exports.ColorCommandButton=pt,exports.ColorPanel=Er,exports.ColorPanelType=vr,exports.ColorPopupButton=Ho,exports.DeleteCellsCommandButton=$o,exports.DocThemeCommandButton=Qr,exports.EagerStudio=ao,exports.FillCommandButton=Nr,exports.FilterColumnMenu=Qo,exports.FilterCommandButton=Ai,exports.Filters=ma,exports.FindCommandButton=Dr,exports.FontFamilyCommandButton=Lr,exports.FontSizeCommandButton=Fr,exports.FormulaBar=Zo,exports.FreezeCommandButton=Mr,exports.HelpCommandButton=ea,exports.HorizontalAlignCommandButton=Cr,exports.InsertCellsCommandButton=Wo,exports.InsertFunctionCommandPopupButton=oa,exports.InsertFunctionSumCommandPopupButton=ta,exports.InsertImageCommandButton=Uo,exports.MergeCommandButton=Rr,exports.NamedCollectionEditor=Yo,exports.NamedInput=aa,exports.NumberFormatCommandButton=Ir,exports.PasteCommandButton=_o,exports.PresetCellStylesCommandButton=Kr,exports.PresetTableStylesCommandButton=Gr,exports.RangeInput=ia,exports.SheetTab=Jo,exports.SheetTabMenu=en,exports.SheetZoomScale=qo,exports.SheetsAllMenu=tn,exports.SortFilterCommandButton=Vo,exports.StatusBar=Go,exports.Studio=Fa,exports.StyledStrokeIcon=Fo,exports.TableStyleCanvasPreview=qr,exports.TableStyleOptionsPanel=zi,exports.TableStylePreview=Ur,exports.TextEffectsCommandButton=Hr,exports.TextOverflowCommandButton=kr,exports.TextRotateCommandButton=wr,exports.ThemeSelectButton=Xr,exports.ThemeSelectPanel=Yr,exports.ThemeSelectPopupButton=Zr,exports.UnderlineCommandButton=zr,exports.UndoRedoCommandButton=Ko,exports.VerticalAlignCommandButton=Sr,exports.ViewGridLinesCommandButton=Or,exports.ViewHeadingsCommandButton=Wr,exports.WalkingCopyCommandButton=lo,exports.WorkbookContextMenu=rn,exports.WorkbookElement=an,exports.WorkbookIO=$e,exports.WorkbookStrip=nn,exports.WorkbookTitle=ln,exports.WorkbookViewCommandButton=$r,exports._WorkbookIO=qa,exports._extends=oo,exports._objectWithoutPropertiesLoose=on,exports._setPrototypeOf=no,exports.clsx=Ve,exports.clsx$1=pe,exports.commonjsGlobal=ct,exports.createGridStyleFromMUITheme=Oo,exports.defaultNewWorkbook=Ma,exports.getDefaultExportFromCjs=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},exports.requirePropTypes=It,exports.setPrintExamplesOnLoad=a=>{pa=a},exports.useMeasure=ft,exports.useWorkbookCommands=Ra;
|