e&&(z.width=e-z.x)}}else if(d&&a===v-1){let s=typeof p=="number"?p:p(a);z.y=r-s,z.height=s}else{let s=o>a?-1:1;if(typeof p=="number"){let f=a-o;z.y+=f*p}else for(let f=o;f!==a;f+=s)z.y+=p(f)*s;z.height=(typeof p=="number"?p:p(a))+1}return z}var Ot='',ab=t=>{let a=t.fgColor,e=t.bgColor;return`
+Please report this to https://github.com/markedjs/marked.`,a.silent)return"An error occurred:
"+V0(e.message+"",!0)+" ";throw e}};j1.Parser=I2;j1.parser=I2.parse;j1.Renderer=$n;j1.TextRenderer=V5;j1.Lexer=ta;j1.lexer=ta.lex;j1.Tokenizer=Nn;j1.Slugger=R5;j1.parse=j1;var pO=j1.options,zO=j1.setOptions,mO=j1.use,MO=j1.walkTokens,HO=j1.parseInline;var xO=I2.parse,wO=ta.lex;var h2=F1(U1(),1),o4=F1(U1(),1),Gz=F1(U1(),1),Kz=F1(U1(),1),Xz=F1(U1(),1),ea=F1(U1(),1),m_=F1(U1(),1);function Jp(t="This should not happen"){throw new Error(t)}function i2(t,a="Assertion failed"){if(!t)return Jp(a)}function sr(t,a){return Jp(a??"Hell froze over")}function hk(t,a){try{return t()}catch{return a}}var Fp=Object.prototype.hasOwnProperty;function I5(t,a){let e,r;if(t===a)return!0;if(t&&a&&(e=t.constructor)===a.constructor){if(e===Date)return t.getTime()===a.getTime();if(e===RegExp)return t.toString()===a.toString();if(e===Array){if((r=t.length)===a.length)for(;r--&&I5(t[r],a[r]););return r===-1}if(!e||typeof t=="object"){r=0;for(e in t)if(Fp.call(t,e)&&++r&&!Fp.call(a,e)||!(e in a)||!I5(t[e],a[e]))return!1;return Object.keys(a).length===r}}return t!==t&&a!==a}var rz=class extends pr.PureComponent{constructor(){super(...arguments),this.wrapperRef=pr.createRef(),this.clickOutside=t=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(t))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(t.target)){let a=t.target;for(;a!==null;){if(a.classList.contains("click-outside-ignore"))return;a=a.parentElement}this.props.onClickOutside()}}}componentDidMount(){document.addEventListener("touchend",this.clickOutside,!0),document.addEventListener("mousedown",this.clickOutside,!0),document.addEventListener("contextmenu",this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener("touchend",this.clickOutside,!0),document.removeEventListener("mousedown",this.clickOutside,!0),document.removeEventListener("contextmenu",this.clickOutside,!0)}render(){let{onClickOutside:t,isOutsideClick:a,...e}=this.props;return pr.createElement("div",{...e,ref:this.wrapperRef},this.props.children)}};function iz(t){var a,e;return{"--gdg-accent-color":t.accentColor,"--gdg-accent-fg":t.accentFg,"--gdg-accent-light":t.accentLight,"--gdg-text-dark":t.textDark,"--gdg-text-medium":t.textMedium,"--gdg-text-light":t.textLight,"--gdg-text-bubble":t.textBubble,"--gdg-bg-icon-header":t.bgIconHeader,"--gdg-fg-icon-header":t.fgIconHeader,"--gdg-text-header":t.textHeader,"--gdg-text-group-header":(a=t.textGroupHeader)!=null?a:t.textHeader,"--gdg-text-header-selected":t.textHeaderSelected,"--gdg-bg-cell":t.bgCell,"--gdg-bg-cell-medium":t.bgCellMedium,"--gdg-bg-header":t.bgHeader,"--gdg-bg-header-has-focus":t.bgHeaderHasFocus,"--gdg-bg-header-hovered":t.bgHeaderHovered,"--gdg-bg-bubble":t.bgBubble,"--gdg-bg-bubble-selected":t.bgBubbleSelected,"--gdg-bg-search-result":t.bgSearchResult,"--gdg-border-color":t.borderColor,"--gdg-horizontal-border-color":(e=t.horizontalBorderColor)!=null?e:t.borderColor,"--gdg-drilldown-border":t.drilldownBorder,"--gdg-link-color":t.linkColor,"--gdg-cell-horizontal-padding":`${t.cellHorizontalPadding}px`,"--gdg-cell-vertical-padding":`${t.cellVerticalPadding}px`,"--gdg-header-font-style":t.headerFontStyle,"--gdg-base-font-style":t.baseFontStyle,"--gdg-marker-font-style":t.markerFontStyle,"--gdg-font-family":t.fontFamily,"--gdg-editor-font-size":t.editorFontSize}}var lz={accentColor:"#4F5DFF",accentFg:"#FFFFFF",accentLight:"rgba(62, 116, 253, 0.1)",textDark:"#313139",textMedium:"#737383",textLight:"#B2B2C0",textBubble:"#313139",bgIconHeader:"#737383",fgIconHeader:"#FFFFFF",textHeader:"#313139",textGroupHeader:"#313139BB",textHeaderSelected:"#FFFFFF",bgCell:"#FFFFFF",bgCellMedium:"#FAFAFB",bgHeader:"#F7F7F8",bgHeaderHasFocus:"#E9E9EB",bgHeaderHovered:"#EFEFF1",bgBubble:"#EDEDF3",bgBubbleSelected:"#FFFFFF",bgSearchResult:"#fff9e3",borderColor:"rgba(115, 116, 131, 0.16)",drilldownBorder:"rgba(0, 0, 0, 0)",linkColor:"#4F5DFF",cellHorizontalPadding:8,cellVerticalPadding:3,headerIconSize:18,headerFontStyle:"600 13px",baseFontStyle:"13px",markerFontStyle:"9px",fontFamily:"Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",editorFontSize:"13px",lineHeight:1.4};function kp(){return lz}var oz=nz.default.createContext(lz);function ck(t,a){let[e,r]=a;if(t.columns.hasIndex(e)||t.rows.hasIndex(r))return!0;if(t.current!==void 0){if(t.current.cell[0]===e&&t.current.cell[1]===r)return!0;let n=[t.current.range,...t.current.rangeStack];for(let i of n)if(e>=i.x&&e=i.y&&r{if(a===0)return this;let e=this.items.map(r=>[r[0]+a,r[1]+a]);return new dr(e)},this.add=a=>{let e=typeof a=="number"?[a,a+1]:a,r=gk([...this.items,e]);return new dr(r)},this.remove=a=>{let e=[...this.items],r=typeof a=="number"?a:a[0],n=typeof a=="number"?a+1:a[1];for(let[i,l]of e.entries()){let[o,h]=l;if(o<=n&&r<=h){let c=[];o{if(this.items.length!==0)return this.items[0][0]},this.last=()=>{if(this.items.length!==0)return this.items.slice(-1)[0][1]-1},this.hasIndex=a=>{for(let e=0;e=r&&a{for(let e=a[0];e{for(let e of this)if(a(e))return!0;return!1},this.equals=a=>{if(a===this)return!0;if(a.items.length!==this.items.length)return!1;for(let e=0;e{let a=[];for(let[e,r]of this.items)for(let n=e;nw8??(w8=new dr([]));mt.fromSingleSelection=t=>dr.empty().add(t);var dk=()=>t=>t.targetY,sk=()=>t=>t.targetX-1,uk=()=>t=>t.targetY-1,fk=()=>t=>t.targetWidth+2,pk=()=>t=>t.targetHeight+2,zk=()=>t=>t.targetY+10,mk=()=>t=>Math.max(0,(t.targetHeight-28)/2),Mk=L0("div")({name:"DataGridOverlayEditorStyle",class:"d1t1th9s",vars:{"d1t1th9s-0":[dk(),"px"],"d1t1th9s-1":[sk(),"px"],"d1t1th9s-2":[uk(),"px"],"d1t1th9s-3":[fk(),"px"],"d1t1th9s-4":[pk(),"px"],"d1t1th9s-5":[zk(),"px"],"d1t1th9s-6":[mk(),"px"]}});function Hk(){let[t,a]=ma.useState();return[t??void 0,a]}function xk(){let[t,a]=Hk(),[e,r]=ma.useState(0),[n,i]=ma.useState(!0);ma.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;let o=new IntersectionObserver(h=>{h.length!==0&&i(h[0].isIntersecting)},{threshold:1});return o.observe(t),()=>o.disconnect()},[t]),ma.useEffect(()=>{if(n||t===void 0)return;let o,h=()=>{let{right:c}=t.getBoundingClientRect();r(v=>Math.min(v+window.innerWidth-c-10,0)),o=requestAnimationFrame(h)};return o=requestAnimationFrame(h),()=>{o!==void 0&&cancelAnimationFrame(o)}},[t,n]);let l=ma.useMemo(()=>({transform:`translateX(${e}px)`}),[e]);return{ref:a,style:l}}var wk=t=>{let{target:a,content:e,onFinishEditing:r,forceEditMode:n,initialValue:i,imageEditorOverride:l,markdownDivCreateNode:o,highlight:h,className:c,theme:v,id:g,cell:d,validateCell:u,getCellRenderer:p,provideEditor:z,isOutsideClick:w}=t,[s,f]=o0.useState(n?e:void 0),m=o0.useRef(s??e);m.current=s??e;let[H,x]=o0.useState(()=>u===void 0?!0:!(Da(e)&&u?.(d,e,m.current)===!1)),y=o0.useCallback((o1,H1)=>{r(H?o1:void 0,H1)},[H,r]),R=o0.useCallback(o1=>{if(u!==void 0&&o1!==void 0&&Da(o1)){let H1=u(d,o1,m.current);H1===!1?x(!1):(typeof H1=="object"&&(o1=H1),x(!0))}f(o1)},[d,u]),L=o0.useRef(!1),V=o0.useRef(void 0),C=o0.useCallback(()=>{y(s,[0,0]),L.current=!0},[s,y]),k=o0.useCallback((o1,H1)=>{var P1;y(o1,(P1=H1??V.current)!=null?P1:[0,0]),L.current=!0},[y]),b=o0.useCallback(async o1=>{let H1=!1;o1.key==="Escape"?(o1.stopPropagation(),o1.preventDefault(),V.current=[0,0]):o1.key==="Enter"&&!o1.shiftKey?(o1.stopPropagation(),o1.preventDefault(),V.current=[0,1],H1=!0):o1.key==="Tab"&&(o1.stopPropagation(),o1.preventDefault(),V.current=[o1.shiftKey?-1:1,0],H1=!0),window.setTimeout(()=>{!L.current&&V.current!==void 0&&(y(H1?s:void 0,V.current),L.current=!0)},0)},[y,s]),F=s??e,[_,j]=o0.useMemo(()=>{var o1,H1;if(Le(e))return[];let P1=z?.(e);return P1!==void 0?[P1,!1]:[(H1=(o1=p(e))==null?void 0:o1.provideEditor)==null?void 0:H1.call(o1,e),!1]},[e,p,z]),{ref:i1,style:Z}=xk(),d1=!0,O,a1=!0,W;if(_!==void 0){d1=_.disablePadding!==!0,a1=_.disableStyling!==!0;let o1=gz(_);o1&&(W=_.styleOverride);let H1=o1?_.editor:_;O=o0.createElement(H1,{isHighlighted:h,onChange:R,value:F,initialValue:i,onFinishedEditing:k,validatedSelection:Da(F)?F.selectionRange:void 0,forceEditMode:n,target:a,imageEditorOverride:l,markdownDivCreateNode:o,isValid:H})}W={...W,...Z};let L1=document.getElementById("portal");if(L1===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `
` as the last child of your ``.'),null;let p1=a1?"gdg-style":"gdg-unstyle";return H||(p1+=" invalid"),d1&&(p1+=" pad"),(0,ez.createPortal)(o0.createElement(oz.Provider,{value:v},o0.createElement(rz,{style:iz(v),className:c,onClickOutside:C,isOutsideClick:w},o0.createElement(Mk,{ref:i1,id:g,className:p1,style:W,as:j===!0?"label":void 0,targetX:a.x,targetY:a.y,targetWidth:a.width,targetHeight:a.height},o0.createElement("div",{className:"clip-region",onKeyDown:b},O)))),L1)},Lk=wk,O8=1<<16,L8=[];function Ep(t,a){return a*O8+t}function uz(t){return t%O8}function fz(t,a){return(t-a)/O8}function Vk(t){let a=uz(t),e=fz(t,a);return[a,e]}var Rk=class{constructor(){this.imageLoaded=()=>{},this.loadedLocations=[],this.visibleWindow={x:0,y:0,width:0,height:0},this.freezeCols=0,this.isInWindow=t=>{let a=uz(t),e=fz(t,a),r=this.visibleWindow;return a=r.y&&e<=r.y+r.height?!0:a>=r.x&&a<=r.x+r.width&&e>=r.y&&e<=r.y+r.height},this.cache={},this.sendLoaded=(0,sz.default)(()=>{this.imageLoaded(this.loadedLocations),this.loadedLocations=[]},20),this.clearOutOfWindow=()=>{let t=Object.keys(this.cache);for(let a of t){let e=this.cache[a],r=!1;for(let n=0;n{o||(o=!0,L8.length<12?L8.unshift(l):i||(l.src=""))}},c=new Promise(v=>l.addEventListener("load",()=>v(null)));requestAnimationFrame(async()=>{try{l.src=t,await c,await l.decode();let v=this.cache[r];if(v!==void 0&&!o){v.img=l;for(let g of v.cells)this.loadedLocations.push(Vk(g));i=!0,this.sendLoaded()}}catch{h.cancel()}}),this.cache[r]=h}loadOrGetImage(t,a,e){let r=t,n=this.cache[r];if(n!==void 0){let i=Ep(a,e);return n.cells.includes(i)||n.cells.push(i),n.img}else this.loadImage(t,a,e,r)}},yk=Rk;function W0(t,a,e,r,n=!1){let i=Zt.useRef();i.current=a,Zt.useEffect(()=>{if(e===null||e.addEventListener===void 0)return;let l=e,o=h=>{var c;(c=i.current)==null||c.call(l,h)};return l.addEventListener(t,o,{passive:r,capture:n}),()=>{l.removeEventListener(t,o,{capture:n})}},[t,e,r,n])}function jn(t,a){return t===void 0?void 0:a}var Ck=Math.PI;function _p(t){return t*Ck/180}var zz=(t,a,e)=>({x1:t-e/2,y1:a-e/2,x2:t+e/2,y2:a+e/2}),mz=(t,a,e,r,n)=>{switch(t){case"left":return Math.floor(a)+r+n/2;case"center":return Math.floor(a+e/2);case"right":return Math.floor(a+e)-r-n/2}},Mz=(t,a,e)=>Math.min(t,a-e*2),Hz=(t,a,e)=>e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2,D8=t=>{var a;let e=(a=t.fgColor)!=null?a:"currentColor";return Zt.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zt.createElement("path",{d:"M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}),Zt.createElement("path",{d:"M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}))},Bk=t=>{var a;let e=(a=t.fgColor)!=null?a:"currentColor";return Zt.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zt.createElement("path",{d:"M19 6L10.3802 17L5.34071 11.8758",vectorEffect:"non-scaling-stroke",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))};function Sk(t,a,e){let[r,n]=Zt.useState(t),i=Zt.useRef(!0);Zt.useEffect(()=>()=>{i.current=!1},[]);let l=Zt.useRef((0,pz.default)(o=>{i.current&&n(o)},e));return Zt.useLayoutEffect(()=>{i.current&&l.current(()=>t())},a),r}var xz="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",wz="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Ak=new RegExp("^[^"+wz+"]*["+xz+"]"),Fk=new RegExp("^[^"+xz+"]*["+wz+"]");function N8(t){return Ak.test(t)?"rtl":Fk.test(t)?"ltr":"neutral"}var S5=void 0;function kk(){if(S5!==void 0)return S5;let t=document.createElement("p");t.style.width="100%",t.style.height="200px";let a=document.createElement("div");a.id="testScrollbar",a.style.position="absolute",a.style.top="0px",a.style.left="0px",a.style.visibility="hidden",a.style.width="200px",a.style.height="150px",a.style.overflow="hidden",a.append(t),document.body.append(a);let e=t.offsetWidth;a.style.overflow="scroll";let r=t.offsetWidth;return e===r&&(r=a.clientWidth),a.remove(),S5=e-r,S5}var r4=Symbol();function bk(t){let a=Zt.useRef([r4,t]);a.current[1]!==t&&(a.current[0]=t),a.current[1]=t;let[e,r]=Zt.useState(t),[,n]=Zt.useState(),i=Zt.useCallback(o=>{let h=a.current[0];h!==r4&&(o=typeof o=="function"?o(h):o,o===h)||(h!==r4&&n({}),r(c=>typeof o=="function"?o(h===r4?c:h):o),a.current[0]=r4)},[]),l=Zt.useCallback(()=>{a.current[0]=r4,n({})},[]);return[a.current[0]===r4?e:a.current[0],i,l]}function Ek(t,a){return Lz.default.useMemo(()=>t.map((e,r)=>({...e,sourceIndex:r,sticky:r=a.span[0]&&r<=a.span[1]}function Tp(t,a,e){let r=e.x,n=e.x+e.width-1,i=e.y,l=e.y+e.height-1,[o,h]=t;if(hl)return!1;if(a.span===void 0)return o>=r&&o<=n;let[c,v]=a.span;return c>=r&&c<=n||v>=r&&c<=n||cn}function Tk(t,a,e){let r=0;if(e.current===void 0)return r;Tp(t,a,e.current.range)&&r++;for(let n of e.current.rangeStack)Tp(t,a,n)&&r++;return r}function Vz(t,a){let e=t;if(a!==void 0){let r=[...t],n=e[a.src];a.src>a.dest?(r.splice(a.src,1),r.splice(a.dest,0,n)):(r.splice(a.dest+1,0,n),r.splice(a.src,1)),r=r.map((i,l)=>({...i,sticky:t[l].sticky})),e=r}return e}function ur(t,a){let e=0,r=Vz(t,a);for(let n=0;n0)for(let c of l)e-=c.width;let o=a,h=n??0;for(;h<=e&&oa-g)return i-1;let d=i-(c?1:0),u=t-(h??0);if(typeof l=="number"){let p=Math.floor((u-v)/l)+o;return p>=d?void 0:p}else{let p=v;for(let z=o;z"u";async function Dk(){var t;Ok||((t=document?.fonts)==null?void 0:t.ready)===void 0||(await document.fonts.ready,k5=0,b5={},as())}Dk();function Nk(t,a,e,r){return`${t}_${r??a.font}_${e}`}function $8(t,a,e){let r=Nk(t,a,"middle",e),n=b5[r];return n===void 0&&(n=a.measureText(t),b5[r]=n,k5++),k5>1e4&&(b5={},k5=0),n}function $a(t,a){return typeof a!="string"&&(a=`${a.baseFontStyle} ${a.fontFamily}`),$k(t,a)}function Pp(t,a){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZ";t.save(),t.textBaseline=a;let r=t.measureText(e);return t.restore(),r}var Ip=[];function $k(t,a){for(let i of Ip)if(i.key===a)return i.val;let e=Pp(t,"alphabetic"),n=-(Pp(t,"middle").actualBoundingBoxDescent-e.actualBoundingBoxDescent)+e.actualBoundingBoxAscent/2;return Ip.push({key:a,val:n}),n}function Uk(t,a,e,r,n){let{ctx:i,rect:l,theme:o}=t,h=Number.MAX_SAFE_INTEGER,c=500;if(a!==void 0&&(h=e-a,hp&&(a=a.slice(0,p))}let d=$a(i,o),u=N8(a)==="rtl";if(e===void 0&&u&&(e="right"),u&&(i.direction="rtl"),a.length>0){let p=!1;if(e==="right"?(i.textAlign="right",p=!0):e!==void 0&&e!=="left"&&(i.textAlign=e,p=!0),!r)Op(i,a,h,c,v,g,d,o,e);else{let z=`${o.fontFamily} ${o.baseFontStyle}`,w=es(i,a,z,v-o.cellHorizontalPadding*2,n??!1),s=Rz(i,z),f=o.lineHeight*s,m=s+f*(w.length-1),H=m+o.cellVerticalPadding>g;H&&(i.save(),i.rect(h,c,v,g),i.clip());let x=c+g/2-m/2,y=Math.max(c+o.cellVerticalPadding,x);for(let R of w)if(Op(i,R,h,y,v,s,d,o,e),y+=f,y>c+g)break;H&&i.restore()}p&&(i.textAlign="start"),u&&(i.direction="inherit")}}function Wk(t,a,e){let{ctx:r,rect:n,hoverAmount:i,theme:l,spriteManager:o}=t,{x:h,y:c,width:v,height:g}=n;r.beginPath(),r.globalAlpha=i,r.rect(h,c,v,g),r.fillStyle=l.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();let d=a!=="",u=0;if(e!==void 0){let z=g-8,w=h+8/2,s=c+8/2;o.drawSprite(e,"normal",r,w,s,z,l,d?1:i),u=z}else{u=24;let p=12,z=d?p:i*p,w=d?0:(1-i)*p*.5,s=l.cellHorizontalPadding+4;z>0&&(r.moveTo(h+s+w,c+g/2),r.lineTo(h+s+w+z,c+g/2),r.moveTo(h+s+w+z*.5,c+g/2-z*.5),r.lineTo(h+s+w+z*.5,c+g/2+z*.5),r.lineWidth=2,r.strokeStyle=l.bgIconHeader,r.lineCap="round",r.stroke())}r.fillStyle=l.textMedium,r.fillText(a,u+h+l.cellHorizontalPadding+.5,c+g/2+$a(r,l)),r.beginPath()}function U8(t,a,e,r,n,i,l,o,h=-20,c=-20,v=32,g="center"){let d=Math.floor(n+l/2),u=4,p=Mz(v,l,a.cellVerticalPadding),z=p/2,w=mz(g,r,i,a.cellHorizontalPadding,p),s=zz(w,d,p),f=Hz(r+h,n+c,s);switch(e){case!0:{t.beginPath(),Re(t,w-p/2,d-p/2,p,p,u),t.fillStyle=o?a.accentColor:a.textMedium,t.fill(),t.beginPath(),t.moveTo(w-z+p/4.23,d-z+p/1.97),t.lineTo(w-z+p/2.42,d-z+p/1.44),t.lineTo(w-z+p/1.29,d-z+p/3.25),t.strokeStyle=a.bgCell,t.lineJoin="round",t.lineCap="round",t.lineWidth=1.9,t.stroke();break}case Qn:case!1:{t.beginPath(),Re(t,w-p/2+.5,d-p/2+.5,p-1,p-1,u),t.lineWidth=1,t.strokeStyle=f?a.textDark:a.textMedium,t.stroke();break}case I8:{t.beginPath(),Re(t,w-p/2,d-p/2,p,p,u),t.fillStyle=f?a.textMedium:a.textLight,t.fill(),t.beginPath(),t.moveTo(w-p/3,d),t.lineTo(w+p/3,d),t.strokeStyle=a.bgCell,t.lineCap="round",t.lineWidth=1.9,t.stroke();break}default:sr(e)}}function jk(t,a){let{ctx:e,theme:r}=t,n=`9px ${r.fontFamily}`,i=a??{};return i?.font!==n&&(e.font=n,i.font=n),i.deprep=qk,e.textAlign="center",i}function qk(t){let{ctx:a}=t;a.textAlign="start"}function Gk(t,a,e,r,n){let{ctx:i,rect:l,hoverAmount:o,theme:h}=t,{x:c,y:v,width:g,height:d}=l,u=e?1:r==="checkbox-visible"?.6+.4*o:o;if(r!=="number"&&u>0){i.globalAlpha=u;let p=7*(e?o:1);if(U8(i,h,e,n?c+p:c,v,n?g-p:g,d,!0,void 0,void 0,18),n){i.globalAlpha=o,i.beginPath();for(let z of[3,6])for(let w of[-5,-1,3])i.rect(c+z,v+d/2+w,2,2);i.fillStyle=h.textLight,i.fill(),i.beginPath()}i.globalAlpha=1}if(r==="number"||r==="both"&&!e){let p=a.toString(),z=`${h.markerFontStyle} ${h.fontFamily}`,w=c+g/2;r==="both"&&o!==0&&(i.globalAlpha=1-o),i.fillStyle=h.textLight,i.font=z,i.fillText(p,w,v+d/2+$a(i,z)),o!==0&&(i.globalAlpha=1)}}function Kk(t){let{ctx:a,theme:e,rect:r}=t,{x:n,y:i,height:l}=r;a.beginPath();let o=2.5,h=n+e.cellHorizontalPadding+o,c=i+l/2,v=Math.cos(_p(30))*o,g=Math.sin(_p(30))*o;for(let d=0;d<12;d++)a.moveTo(h,c-o),a.lineTo(h,c+o),a.moveTo(h+v,c-g),a.lineTo(h-v,c+g),a.moveTo(h-v,c-g),a.lineTo(h+v,c+g),h+=8;a.lineWidth=1.1,a.lineCap="square",a.strokeStyle=e.textLight,a.stroke()}function Re(t,a,e,r,n,i){typeof i=="number"&&(i={tl:i,tr:i,br:i,bl:i}),i={tl:Math.min(i.tl,n/2,r/2),tr:Math.min(i.tr,n/2,r/2),bl:Math.min(i.bl,n/2,r/2),br:Math.min(i.br,n/2,r/2)},t.moveTo(a+i.tl,e),t.arcTo(a+r,e,a+r,e+i.tr,i.tr),t.arcTo(a+r,e+n,a+r-i.br,e+n,i.br),t.arcTo(a,e+n,a,e+n-i.bl,i.bl),t.arcTo(a,e,a+i.tl,e,i.tl)}function Xk(t,a,e,r){if(!e&&a===Qn)return;let{ctx:n,hoverAmount:i,theme:l,rect:o,highlighted:h,hoverX:c,hoverY:v,cell:{contentAlign:g}}=t,{x:d,y:u,width:p,height:z}=o,w=.35,s=e?1-w+w*i:.4;a===Qn&&(s*=i),s!==0&&(n.globalAlpha=s,U8(n,l,a,d,u,p,z,h,c,v,r,g),n.globalAlpha=1)}var Yn=4;function Yk(t,a){let{rect:e,theme:r,ctx:n,highlighted:i}=t,{x:l,y:o,width:h,height:c}=e,v=20,g=8,d=Yn,u=l+r.cellHorizontalPadding,p=[];for(let z of a){if(u>l+h)break;let w=$8(z,n,`${r.baseFontStyle} ${r.fontFamily}`).width;p.push({x:u,width:w}),u+=w+g*2+d}n.beginPath();for(let z of p)Re(n,z.x,o+(c-v)/2,z.width+g*2,v,v/2);n.fillStyle=i?r.bgBubbleSelected:r.bgBubble,n.fill();for(let[z,w]of p.entries())n.beginPath(),n.fillStyle=r.textBubble,n.fillText(a[z],w.x+g,o+c/2+$a(n,r))}var V8={};function Qk(t,a,e){let r=Math.ceil(window.devicePixelRatio),n=5,i=e-n*2,l=4,o=6,h=e*r,c=o+n,v=o*3,g=(v+n*2)*r,d=`${t},${a},${r},${e}`;if(V8[d]!==void 0)return{el:V8[d],height:h,width:g,middleWidth:l*r,sideWidth:c*r,padding:n*r,dpr:r};let u=document.createElement("canvas"),p=u.getContext("2d");if(p===null)return null;u.width=g,u.height=h,p.scale(r,r),V8[d]=u;let z=Math.min(o,v/2,i/2);return p.beginPath(),Re(p,n,n,v,i,z),p.shadowColor="rgba(24, 25, 34, 0.4)",p.shadowBlur=1,p.fillStyle=t,p.fill(),p.shadowColor="rgba(24, 25, 34, 0.3)",p.shadowOffsetY=1,p.shadowBlur=5,p.fillStyle=t,p.fill(),p.shadowOffsetY=0,p.shadowBlur=0,p.shadowBlur=0,p.beginPath(),Re(p,n+.5,n+.5,v,i,z),p.strokeStyle=a,p.lineWidth=1,p.stroke(),{el:u,height:h,width:g,sideWidth:c*r,middleWidth:o*r,padding:n*r,dpr:r}}function Zk(t,a){let{rect:e,theme:r,ctx:n,imageLoader:i,col:l,row:o}=t,{x:h,width:c}=e,v=`${r.baseFontStyle} ${r.fontFamily}`,g=Rz(n,v),d=Math.min(e.height,Math.max(16,Math.ceil(g*r.lineHeight)*2)),u=Math.floor(e.y+(e.height-d)/2),p=d-10,z=8,w=Yn,s=h+r.cellHorizontalPadding,f=Qk(r.bgCell,r.drilldownBorder,d),m=[];for(let H of a){if(s>h+c)break;let y=$8(H.text,n,v).width,R=0;H.img!==void 0&&i.loadOrGetImage(H.img,l,o)!==void 0&&(R=p-8+4);let L=y+R+z*2;m.push({x:s,width:L}),s+=L+w}if(f!==null){let{el:H,height:x,middleWidth:y,sideWidth:R,width:L,dpr:V,padding:C}=f,k=R/V,b=C/V;for(let F of m){let _=Math.floor(F.x),j=Math.floor(F.width),i1=j-(k-b)*2;n.imageSmoothingEnabled=!1,n.drawImage(H,0,0,R,x,_-b,u,k,d),i1>0&&n.drawImage(H,R,0,y,x,_+(k-b),u,i1,d),n.drawImage(H,L-R,0,R,x,_+j-(k-b),u,k,d),n.imageSmoothingEnabled=!0}}n.beginPath();for(let[H,x]of m.entries()){let y=a[H],R=x.x+z;if(y.img!==void 0){let L=i.loadOrGetImage(y.img,l,o);if(L!==void 0){let V=p-8,C=0,k=0,b=L.width,F=L.height;b>F?(C+=(b-F)/2,b=F):F>b&&(k+=(F-b)/2,F=b),n.beginPath(),Re(n,R,u+d/2-V/2,V,V,3),n.save(),n.clip(),n.drawImage(L,C,k,b,F,R,u+d/2-V/2,V,V),n.restore(),R+=V+4}}n.beginPath(),n.fillStyle=r.textBubble,n.fillText(y.text,R,u+d/2+$a(n,r))}}function Jk(t,a,e=4,r){let{rect:n,col:i,row:l,theme:o,ctx:h,imageLoader:c}=t,{x:v,y:g,height:d,width:u}=n,p=d-o.cellVerticalPadding*2,z=[],w=0;for(let f=0;f0&&(Re(h,s,g+o.cellVerticalPadding,m,p,e),h.save(),h.clip()),h.drawImage(f,s,g+o.cellVerticalPadding,m,p),e>0&&h.restore(),s+=m+Yn}}function tb(t,a,e){let r=function(o,h){let c=h.x-o.x,v=h.y-o.y,g=Math.sqrt(c*c+v*v),d=c/g,u=v/g;return{x:c,y:h.y-o.y,len:g,nx:d,ny:u,ang:Math.atan2(u,d)}},n,i=a.length,l=a[i-1];for(let o=0;o1?1:d),z=1,w=!1;u<0?p<0?p=Math.PI+p:(p=Math.PI-p,z=-1,w=!0):p>0&&(z=-1,w=!0),n=h.radius!==void 0?h.radius:e;let s=p/2,f=Math.abs(Math.cos(s)*n/Math.sin(s)),m;f>Math.min(v.len/2,g.len/2)?(f=Math.min(v.len/2,g.len/2),m=Math.abs(f*Math.sin(s)/Math.cos(s))):m=n;let H=h.x+g.nx*f,x=h.y+g.ny*f;H+=-g.ny*m*z,x+=g.nx*m*z,t.arc(H,x,m,v.ang+Math.PI/2*z,g.ang-Math.PI/2*z,w),l=h,h=c}t.closePath()}function Kn(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p){let z={x:0,y:i+c,width:0,height:0},w=i-n;if(t>=g){let s=l>t?-1:1,f=ur(u);z.x+=f+h;for(let m=l;m!==t;m+=s)z.x+=u[s===1?m:m-1].width*s}else for(let s=0;s0&&Zn(u[s-1].group,f)&&u[s-1].sticky===m;){let x=u[s-1];z.x-=x.width,z.width+=x.width,s--}let H=t;for(;H+1e&&(z.width=e-z.x)}}else if(d&&a===v-1){let s=typeof p=="number"?p:p(a);z.y=r-s,z.height=s}else{let s=o>a?-1:1;if(typeof p=="number"){let f=a-o;z.y+=f*p}else for(let f=o;f!==a;f+=s)z.y+=p(f)*s;z.height=(typeof p=="number"?p:p(a))+1}return z}var Ot='',ab=t=>{let a=t.fgColor,e=t.bgColor;return`
${Ot} `},eb=t=>{let a=t.fgColor,e=t.bgColor;return`
${Ot} `},rb=t=>{let a=t.fgColor,e=t.bgColor;return`${Ot}
@@ -173,19 +173,19 @@ Please report this to https://github.com/markedjs/marked.`,a.silent)return"An
-`},Sb={headerRowID:ab,headerNumber:rb,headerCode:eb,headerString:nb,headerBoolean:ib,headerAudioUri:ob,headerVideoUri:hb,headerEmoji:cb,headerImage:vb,headerUri:yz,headerPhone:gb,headerMarkdown:db,headerDate:sb,headerTime:ub,headerEmail:fb,headerReference:pb,headerIfThenElse:zb,headerSingleValue:mb,headerLookup:Mb,headerTextTemplate:Hb,headerMath:xb,headerRollup:wb,headerJoinStrings:Lb,headerSplitString:Vb,headerGeoDistance:Rb,headerArray:yb,rowOwnerOverlay:Cb,protectedColumnOverlay:Bb,renameIcon:lb};function Ab(t,a){return t==="normal"?[a.bgIconHeader,a.fgIconHeader]:t==="selected"?["white",a.accentColor]:[a.accentColor,a.bgHeader]}var Fb=class{constructor(t,a){this.onSettled=a,this.spriteMap=new Map,this.inFlight=0,this.headerIcons={...Sb,...t}}drawSprite(t,a,e,r,n,i,l,o=1){let[h,c]=Ab(a,l),v=i*Math.ceil(window.devicePixelRatio),g=`${h}_${c}_${v}_${t}`,d=this.spriteMap.get(g);if(d===void 0){let u=this.headerIcons[t];if(u===void 0)return;d=document.createElement("canvas");let p=d.getContext("2d");if(p===null)return;let z=new Image;z.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u({fgColor:c,bgColor:h}))}`,this.spriteMap.set(g,d);let w=z.decode();if(w===void 0)return;this.inFlight++,w.then(()=>{p.drawImage(z,0,0,v,v)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else o<1&&(e.globalAlpha=o),e.drawImage(d,0,0,v,v,r,n,i,i),o<1&&(e.globalAlpha=1)}},R8={},Me=null;function kb(){let t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function k8(t){let a=t.toLowerCase().trim();if(R8[a]!==void 0)return R8[a];Me=Me||kb(),Me.style.color="#000",Me.style.color=a;let e=getComputedStyle(Me).color;Me.style.color="#fff",Me.style.color=a;let r=getComputedStyle(Me).color;if(r!==e)return[0,0,0,1];let n=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return n.length<4&&n.push(1),n=n.map(i=>{let l=Number.isNaN(i);return l&&console.warn("Could not parse color",t),l?0:i}),R8[a]=n,n}function fr(t,a){let[e,r,n]=k8(t);return`rgba(${e}, ${r}, ${n}, ${a})`}function Le(t,a){if(a===void 0)return t;let[e,r,n,i]=k8(t);if(i===1)return t;let[l,o,h,c]=k8(a),v=i+c*(1-i),g=(i*e+c*l*(1-i))/v,d=(i*r+c*o*(1-i))/v,u=(i*n+c*h*(1-i))/v;return`rgba(${g}, ${d}, ${u}, ${v})`}var bb={kind:l1.Loading,allowOverlay:!1};function Sz(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s,f,m){let H,x;p!==void 0&&p[0][0]===r&&p[0][1]===a&&(H=p[1][0],x=p[1][1]);let y,R={ctx:t,theme:c,col:r,row:a,cell:e,rect:{x:n,y:i,width:l,height:o},highlighted:h,hoverAmount:u,hoverX:H,hoverY:x,imageLoader:g,spriteManager:d,hyperWrapping:z,requestAnimationFrame:()=>{L=!0}},L=!1;return(Uk(R,e.lastUpdated,w,s,()=>{var C,k;if(!(we(e)?!1:v?.(R)===!0)){let F=m(e);if(F!==void 0){s?.renderer!==F&&((C=s?.deprep)==null||C.call(s,R),s=void 0);let _=(k=F.drawPrep)==null?void 0:k.call(F,R,s);F.draw(R,e),y={deprep:_?.deprep,fillStyle:_?.fillStyle,font:_?.font,renderer:F}}}})||L)&&f?.([r,a]),y}function Eb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w){let s=[],f=!1;t.imageSmoothingEnabled=!1;let m=Math.min(e.cellYOffset,n),H=Math.max(e.cellYOffset,n),x=0;if(typeof z=="number")x+=(H-m)*z;else for(let F=m;Fe.cellYOffset&&(x=-x),x+=l-e.translateY;let y=Math.min(e.cellXOffset,r),R=Math.max(e.cellXOffset,r),L=0;for(let F=y;Fe.cellXOffset&&(L=-L),L+=i-e.translateX;let V=ur(p);if(V>0&&V++,L!==0&&x!==0)return{regions:[],yOnly:!1};let C=o?typeof z=="number"?z:z(v-1):0,k=h-V-Math.abs(L),b=c-g-C-Math.abs(x)-1;if(k>150&&b>150){f=L===0;let F={sx:0,sy:0,sw:h*d,sh:c*d,dx:0,dy:0,dw:h*d,dh:c*d};x>0?(F.sy=(g+1)*d,F.sh=b*d,F.dy=(x+g+1)*d,F.dh=b*d,s.push({x:0,y:g,width:h,height:x+1})):x<0&&(F.sy=(-x+g+1)*d,F.sh=b*d,F.dy=(g+1)*d,F.dh=b*d,s.push({x:0,y:c+x-C,width:h,height:-x+C})),L>0?(F.sx=V*d,F.sw=k*d,F.dx=(L+V)*d,F.dw=k*d,s.push({x:V-1,y:0,width:L+2,height:c})):L<0&&(F.sx=(V-L)*d,F.sw=k*d,F.dx=V*d,F.dw=k*d,s.push({x:h+L,y:0,width:-L,height:c})),t.setTransform(1,0,0,1,0,0),V>0&&L!==0&&x===0&&w&&t.drawImage(a,0,0,V*d,c*d,0,0,V*d,c*d),t.drawImage(a,F.sx,F.sy,F.sw,F.sh,F.dx,F.dy,F.dw,F.dh),t.scale(d,d)}return t.imageSmoothingEnabled=!0,{regions:s,yOnly:f}}function _b(t,a,e,r,n,i,l,o,h,c){let v=[];return a!==t.cellXOffset||e!==t.cellYOffset||r!==t.translateX||n!==t.translateY||h4(h,e,r,n,o,(g,d,u,p)=>{if(g.sourceIndex===c){let z=Math.max(d,p)+1;return v.push({x:z,y:0,width:i-z,height:l}),!0}}),v}function Dp(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s=!1){var f,m,H;if(h!==void 0){t.beginPath(),t.save(),t.rect(0,0,i,l);for(let Z of h)t.rect(Z.x+1,Z.y+1,Z.width-1,Z.height-1);t.clip("evenodd")}let x=(f=w.horizontalBorderColor)!=null?f:w.borderColor,y=w.borderColor,R=0,L=i,V=0,C=l;if(o!==void 0&&o.length>0){R=Number.MAX_SAFE_INTEGER,V=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,C=Number.MIN_SAFE_INTEGER;for(let Z of o)R=Math.min(R,Z.x-1),L=Math.max(L,Z.x+Z.width+1),V=Math.min(V,Z.y-1),C=Math.max(C,Z.y+Z.height+1)}let k=[];t.beginPath();let b=.5;for(let Z=0;Z=R&&O<=L&&u(Z+1)&&k.push({x1:O,y1:Math.max(c,V),x2:O,y2:Math.min(l,C),color:y})}let F=g(z-1),_=l-F+.5,j=p==="sticky";if(j&&k.push({x1:R,y1:_,x2:L,y2:_,color:x}),s!==!0){let Z=v+.5,d1=e,O=j?l-F:l;for(;Z+n<=O;){let a1=Z+n;if(a1>=V&&a1<=C-1&&(!j||d1!==z-1||Math.abs(a1-_)>1)){let W=d?.(d1);k.push({x1:R,y1:a1,x2:L,y2:a1,color:(H=(m=W?.horizontalBorderColor)!=null?m:W?.borderColor)!=null?H:x})}Z+=g(d1),d1++}}let n1=(0,Bz.default)(k,Z=>Z.color);for(let Z of Object.keys(n1)){t.strokeStyle=Z;for(let d1 of n1[Z])t.moveTo(d1.x1,d1.y1),t.lineTo(d1.x2,d1.y2);t.stroke(),t.beginPath()}h!==void 0&&t.restore()}function Az(t,a){let e=[],r=t.x+t.width-26*a.length,n=t.y+t.height/2-13,i=26,l=26;for(let o=0;o=t.x&&a<=t.x+t.width&&e>=t.y&&e<=t.y+t.height}function Tb(t,a,e,r,n,i,l,o,h,c,v,g){var d;let[p,z]=(d=i?.[0])!=null?d:[],w=0;_z(a,e,r,n,(s,f,m,H,x,y)=>{var R,L;if(g!==void 0&&!g.some(F=>F[1]===-2&&F[0]>=s[0]&&F[0]<=s[1]))return;t.save(),t.beginPath(),t.rect(m,H,x,y),t.clip();let V=v(f),C=V?.overrideTheme===void 0?l:{...l,...V.overrideTheme},k=z===-2&&p!==void 0&&p>=s[0]&&p<=s[1],b=k?C.bgHeaderHovered:C.bgHeader;if(b!==l.bgHeader&&(t.fillStyle=b,t.fill()),t.fillStyle=(R=C.textGroupHeader)!=null?R:C.textHeader,V!==void 0){let F=m;if(V.icon!==void 0&&(o.drawSprite(V.icon,"normal",t,F+8,(n-20)/2,20,C),F+=26),t.fillText(V.name,F+8,n/2+Na(t,`${l.headerFontStyle} ${l.fontFamily}`)),V.actions!==void 0&&k){let _=Az({x:m,y:H,width:x,height:y},V.actions);t.beginPath();let j=_[0].x-10,n1=m+x-j;t.rect(j,0,n1,n);let Z=t.createLinearGradient(j,0,j+n1,0),d1=fr(b,0);Z.addColorStop(0,d1),Z.addColorStop(10/n1,b),Z.addColorStop(1,b),t.fillStyle=Z,t.fill(),t.globalAlpha=.6;let[O,a1]=(L=i?.[1])!=null?L:[-1,-1];for(let W=0;W35){let R=z?35:r-35,L=z?35*.7:r-35*.7,V=R/r,C=L/r,k=t.createLinearGradient(a,0,a+r,0),b=fr(f,0);k.addColorStop(z?1:0,f),k.addColorStop(V,f),k.addColorStop(C,b),k.addColorStop(z?0:1,b),t.fillStyle=k}else t.fillStyle=f;if(z&&(t.textAlign="right"),t.fillText(i.title,x,e+n/2+Na(t,`${o.headerFontStyle} ${o.fontFamily}`)),z&&(t.textAlign="left"),m&&i.hasMenu===!0){t.beginPath();let y=w.x+w.width/2-5.5,R=w.y+w.height/2-3;tb(t,[{x:y,y:R},{x:y+11,y:R},{x:y+5.5,y:R+6}],1),t.fillStyle=f,t.fill()}}function Pb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s,f){var m;let H=l+o;if(H<=0)return;t.fillStyle=g.bgHeader,t.fillRect(0,0,n,H);let[x,y]=(m=r?.[0])!=null?m:[],R=`${g.headerFontStyle} ${g.fontFamily}`;t.font=R,h4(a,0,i,0,H,(L,V,C,k)=>{var b,F,_;if(w!==void 0&&!w.some(K1=>K1[1]===-1&&K1[0]===L.sourceIndex))return;let j=Math.max(0,k-V);t.save(),t.beginPath(),t.rect(V+j,o,L.width-j,l),t.clip();let n1=z((b=L.group)!=null?b:"").overrideTheme,Z=L.themeOverride===void 0&&n1===void 0?g:{...g,...n1,...L.themeOverride};Z.bgHeader!==g.bgHeader&&(t.fillStyle=Z.bgHeader,t.fill());let d1=`${Z.headerFontStyle} ${Z.fontFamily}`;R!==d1&&(t.font=d1);let O=v.columns.hasIndex(L.sourceIndex),a1=h!==void 0||c,W=!a1&&y===-1&&x===L.sourceIndex,L1=a1?0:(_=(F=u.find(K1=>K1.item[0]===L.sourceIndex&&K1.item[1]===-1))==null?void 0:F.hoverAmount)!=null?_:0,p1=v?.current!==void 0&&v.current.cell[0]===L.sourceIndex,o1=O?Z.accentColor:p1?Z.bgHeaderHasFocus:Z.bgHeader,H1=e?o:0,P1=L.sourceIndex===0?0:1;O?(t.fillStyle=o1,t.fillRect(V+P1,H1,L.width-P1,l)):(p1||L1>0)&&(t.beginPath(),t.rect(V+P1,H1,L.width-P1,l),p1&&(t.fillStyle=Z.bgHeaderHasFocus,t.fill()),L1>0&&(t.globalAlpha=L1,t.fillStyle=Z.bgHeaderHovered,t.fill(),t.globalAlpha=1)),bz(t,V,H1,L.width,l,L,O,Z,W,p1,L1,d,s,f),t.restore()}),e&&Tb(t,a,n,i,o,r,g,d,u,p,z,w)}function Re(t,a,e,r,n,i,l,o){return t<=n+l&&n<=t+e&&a<=i+o&&i<=a+r}function Np(t,a,e,r,n,i,l,o,h,c,v,g,d,u){if(d===void 0||d.length===0)return;let p=g==="sticky"?v(c-1):0;t.beginPath(),_z(a,e,l,n,(z,w,s,f,m,H)=>{for(let x=0;x=z[0]&&y[0]<=z[1]){t.rect(s,f,m,H);break}}}),h4(a,h,l,o,i,(z,w,s,f,m)=>{let H=Math.max(0,f-w),x=w+H+1,y=z.width-H-1;for(let R=0;R{let k=!1;for(let b=0;b0&&t.rect(x,b,y,_)}})}),t.clip()}function Ez(t,a,e,r,n,i,l){var o,h;let[c,v]=t,g,d,u=(h=(o=l.find(p=>!p.sticky))==null?void 0:o.sourceIndex)!=null?h:0;if(v>u){let p=Math.max(c,u),z=a,w=r;for(let s=i.sourceIndex-1;s>=p;s--)z-=l[s].width,w+=l[s].width;for(let s=i.sourceIndex+1;s<=v;s++)w+=l[s].width;d={x:z,y:e,width:w,height:n}}if(u>c){let p=Math.min(v,u-1),z=a,w=r;for(let s=i.sourceIndex-1;s>=c;s--)z-=l[s].width,w+=l[s].width;for(let s=i.sourceIndex+1;s<=p;s++)w+=l[s].width;g={x:z,y:e,width:w,height:n}}return[g,d]}function $p(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s,f,m,H,x,y,R,L,V,C,k,b,F,_){var j;let n1=(j=f?.length)!=null?j:Number.MAX_SAFE_INTEGER,Z=performance.now(),d1=`${b.baseFontStyle} ${b.fontFamily}`;t.font=d1;let O,a1=new Set;return h4(a,o,i,l,n,(W,L1,p1,o1,H1)=>{var P1;let K1=Math.max(0,o1-L1),W1=L1+K1,Bt=n+1,T1=W.width-K1,X1=r-n-1;if(s.length>0){let v1=!1;for(let D=0;D{t.save(),t.beginPath(),t.rect(W1,Bt,T1,X1),t.clip()},N=m.columns.hasIndex(W.sourceIndex),s1=g((P1=W.group)!=null?P1:"").overrideTheme,x1=W.themeOverride===void 0&&s1===void 0?b:{...b,...s1,...W.themeOverride},f1=`${x1.baseFontStyle} ${x1.fontFamily}`;f1!==d1&&(d1=f1,t.font=f1),Y();let U;return ai(H1,p1,r,h,c,w,(v1,D,I,C1,D1)=>{var et,B1,c1,e1;if(D<0)return;if(f!==void 0){let dt=!1;for(let At=0;At0){let dt=!1;for(let At=0;AtI1.span!==void 0&&dt>=I1.span[0]&&dt<=I1.span[1]);Mt&&!p&&z?C0=0:Mt&&(C0=Math.max(C0,1)),Z0&&C0++,Mt||(u1&&C0++,N&&!C1&&C0++);let B0=I1.kind===l1.Protected?J1.bgCellMedium:J1.bgCell,t0;if((C1||B0!==b.bgCell)&&(t0=Le(B0,t0)),C0>0||M1){M1&&(t0=Le(J1.bgHeader,t0));for(let dt=0;dtdt[0]===W.sourceIndex&&dt[1]===D)===!0&&(t0=Le(J1.bgSearchResult,t0));if(x!==void 0)for(let dt of x){let At=dt.range;At.x<=W.sourceIndex&&W.sourceIndexdt.item[0]===W.sourceIndex&&dt.item[1]===D);if(St>10&&!Ut){let dt=`${J1.baseFontStyle} ${J1.fontFamily}`;dt!==d1&&(t.font=dt,d1=dt),U=Sz(t,D,I1,W.sourceIndex,Q1,v1,St,I,C0>0,J1,y,R,L,(c1=Ma?.hoverAmount)!=null?c1:0,C,k,Z,U,F,_)}return I1.style==="faded"&&(t.globalAlpha=1),n1--,jt&&(t.restore(),(e1=U?.deprep)==null||e1.call(U,{ctx:t}),U=void 0,Y(),d1=f1,t.font=f1),n1<=0}),t.restore(),n1<=0}),O}function Ib(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s){w!==void 0||a[a.length-1]!==e[a.length-1]||h4(a,h,l,o,i,(f,m,H,x,y)=>{if(f!==a[a.length-1])return;m+=f.width;let R=Math.max(m,x);R>r||(t.save(),t.beginPath(),t.rect(R,i+1,1e4,n-i-1),t.clip(),ai(y,H,n,c,v,p,(L,V,C,k)=>{if(!k&&z.length>0&&!z.some(n1=>Re(m,L,1e4,C,n1.x,n1.y,n1.width,n1.height)))return;let b=d.hasIndex(V),F=u.hasIndex(V);t.beginPath();let _=g?.(V),j=_===void 0?s:{...s,..._};j.bgCell!==s.bgCell&&(t.fillStyle=j.bgCell,t.fillRect(m,L,1e4,C)),F&&(t.fillStyle=j.bgHeader,t.fillRect(m,L,1e4,C)),b&&(t.fillStyle=j.accentLight,t.fillRect(m,L,1e4,C))}),t.restore())})}function Ob(t,a,e,r,n,i,l,o,h){var c;let v=!1;for(let p of a)if(!p.sticky){v=l(p.sourceIndex);break}let g=(c=h.horizontalBorderColor)!=null?c:h.borderColor,d=h.borderColor,u=v?ur(a):0;if(u!==0&&(t.beginPath(),t.moveTo(u+.5,0),t.lineTo(u+.5,r),t.strokeStyle=Le(d,h.bgCell),t.stroke()),n){let p=o(i-1);t.beginPath(),t.moveTo(0,r-p+.5),t.lineTo(e,r-p+.5),t.strokeStyle=Le(g,h.bgCell),t.stroke()}}function Db(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p){let z=p?.filter(m=>m.style!=="no-outline");if(z===void 0||z.length===0)return;let w=z.map(m=>{var H,x,y,R,L;let V=m.range,C=Kn(V.x,V.y,a,e,v,c+v,r,n,i,l,u,h,d,o,g);if(V.width===1&&V.height===1)return V.x=h){let b=Kn(h-1,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g),F=Kn(h,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g);return[{color:m.color,style:(y=m.style)!=null?y:"dashed",rect:{x:C.x,y:C.y,width:b.x+b.width-C.x,height:b.y+b.height-C.y}},{color:m.color,style:(R=m.style)!=null?R:"dashed",rect:{x:F.x,y:F.y,width:k.x+k.width-F.x,height:k.y+k.height-F.y}}]}else return[void 0,{color:m.color,style:(L=m.style)!=null?L:"dashed",rect:{x:C.x,y:C.y,width:k.x+k.width-C.x,height:k.y+k.height-C.y}}]}),s=ur(o),f=()=>{t.beginPath(),t.save();let m=!1,H=y=>{m!==y&&(t.setLineDash(y?[5,3]:[]),m=y)};t.lineWidth=1;for(let y of w){let[R]=y;R!==void 0&&Re(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(H(R.style==="dashed"),t.strokeStyle=fr(R.color,1),t.strokeRect(R.rect.x+1,R.rect.y+1,R.rect.width-2,R.rect.height-2))}let x=!1;for(let y of w){let[,R]=y;R!==void 0&&Re(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(H(R.style==="dashed"),!x&&R.rect.x{var C;return V.sourceIndex===((C=v.current)==null?void 0:C.cell[0])}))return;let[s,f]=v.current.cell,m=d(v.current.cell),H=(w=m.span)!=null?w:[s,s],x=u==="sticky"&&f===z-1,y=u==="sticky"&&!x?g(z-1)-1:0,R;if(h4(l,r,n,i,c,(V,C,k,b,F)=>{if(!(V.sticky&&s>V.sourceIndex)&&!(V.sourceIndexH[1]))return ai(F,k,e,z,g,u,(_,j,n1)=>{if(j!==f)return;let Z=C,d1=V.width;if(m.span!==void 0){let O=Ez(m.span,C,_,V.width,n1,V,o),a1=V.sticky?O[0]:O[1];a1!==void 0&&(Z=a1.x,d1=a1.width)}return R=()=>{var O,a1,W,L1;b>Z&&!V.sticky&&(t.beginPath(),t.rect(b,0,a-b,e),t.clip()),t.beginPath(),t.rect(Z+.5,_+.5,d1,n1),t.strokeStyle=(a1=(O=V.themeOverride)==null?void 0:O.accentColor)!=null?a1:h.accentColor,t.lineWidth=1,t.stroke(),p&&(t.beginPath(),t.rect(Z+d1-4,_+n1-4,4,4),t.fillStyle=(L1=(W=V.themeOverride)==null?void 0:W.accentColor)!=null?L1:h.accentColor,t.fill())},!0}),!0}),R===void 0)return;let L=()=>{t.save(),t.beginPath(),t.rect(0,c,a,e-c-y),t.clip(),R?.(),t.restore()};return L(),L}function Nb(t,a,e,r,n,i,l,o,h){let c=0;return h4(t,i,r,n,e,(v,g,d,u,p)=>(ai(p,d,a,l,o,h,(z,w,s,f)=>{f||(c=Math.max(w,c))}),!0)),c}function $b(t,a){if(a===void 0||t.width!==a.width||t.height!==a.height||t.theme!==a.theme||t.headerHeight!==a.headerHeight||t.rowHeight!==a.rowHeight||t.rows!==a.rows||t.getRowThemeOverride!==a.getRowThemeOverride||t.isFocused!==a.isFocused||t.isResizing!==a.isResizing||t.verticalBorder!==a.verticalBorder||t.getCellContent!==a.getCellContent||t.highlightRegions!==a.highlightRegions||t.selection!==a.selection||t.dragAndDropState!==a.dragAndDropState||t.prelightCells!==a.prelightCells||t.touchMode!==a.touchMode||t.scrolling!==a.scrolling)return!1;if(t.mappedColumns!==a.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==a.mappedColumns.length)return!1;let e;for(let r=0;rx:x;D1.save(),D1.beginPath(),B1.save(),B1.beginPath(),D1.textBaseline="middle",B1.textBaseline="middle",x1!==1&&(D1.scale(x1,x1),B1.scale(x1,x1));let u1=A8(d,h,l,z,v),M1=[],I1=s&&((r=L.current)==null?void 0:r.cell[1])===c&&g===0,Q1=()=>{var ot,J1;Pb(D1,u1,u,o1,l,v,f,m,z,R,L,w,H1,L1,y,F,N,Z,K1),Dp(D1,u1,c,v,g,l,o,void 0,void 0,m,v1,e1,_,y,C,k,w,!0),D1.beginPath(),D1.moveTo(0,D-.5),D1.lineTo(l,D-.5),D1.strokeStyle=Le((J1=(ot=w.headerBottomBorderColor)!=null?ot:w.horizontalBorderColor)!=null?J1:w.borderColor,w.bgHeader),D1.stroke(),I1&&y8(D1,l,o,c,v,g,u1,d,w,v1,L,e1,b,C,V,k)};if(N!==void 0){let ot=!1;N=N.filter(J1=>(ot=ot||J1[1]<0,J1[1]<0||Re(h,c,u1.length,300,J1[0],J1[1],1,1)||Re(0,c,p,300,J1[0],J1[1],1,1)||C&&Re(h,k-1,u1.length,1,J1[0],J1[1],1,1))),N.length>0&&(Np(B1,u1,l,o,m,v1,v,g,c,k,e1,C,N,!0),B1.fillStyle=w.bgCell,B1.fillRect(0,v1+1,l,o-v1-1),$p(B1,u1,d,o,v1,v,g,c,k,e1,b,F,_,H,j,s,C,M1,N,L,d1,O,n1,a1,H1,L1,o1,p1,w,W1,Bt),V&&s&&L.current!==void 0&&N.some(J1=>{var Jt,Mt;return J1[0]===((Jt=L.current)==null?void 0:Jt.cell[0])&&J1[1]===((Mt=L.current)==null?void 0:Mt.cell[1])})&&y8(B1,l,o,c,v,g,u1,d,w,v1,L,e1,b,C,V,k)),ot&&(Np(D1,u1,l,v1,m,v1,v,g,c,k,e1,C,N,!1),Q1()),B1.restore(),D1.restore(),C1!==null&&(C1.fillStyle=w.bgCell,C1.fillRect(0,0,l,o),C1.drawImage(B1.canvas,0,0));return}if((f1!==!0||h!==I?.cellXOffset||v!==I?.translateX||I1!==I?.mustDrawFocusOnHeader)&&Q1(),f1===!0){i2(c1!==void 0&&I!==void 0);let{regions:ot}=Eb(B1,c1,I,h,c,v,g,C==="sticky",l,o,k,v1,x1,d,u1,x,s1);M1=ot}else f1!==!1&&(i2(I!==void 0),M1=_b(I,h,c,v,g,l,o,v1,u1,f1));Ob(B1,u1,l,o,C==="sticky",k,y,e1,w);let St=s?y8(B1,l,o,c,v,g,u1,d,w,v1,L,e1,b,C,V,k):void 0,jt=Db(B1,l,o,h,c,v,g,d,p,f,m,x,C==="sticky",k,O);if(B1.fillStyle=w.bgCell,M1.length>0){B1.beginPath();for(let ot of M1)B1.rect(ot.x,ot.y,ot.width,ot.height);B1.clip(),B1.fill(),B1.beginPath()}else B1.fillRect(0,0,l,o);let Ut=$p(B1,u1,d,o,v1,v,g,c,k,e1,b,F,_,H,j,s,C,M1,N,L,d1,O,n1,a1,H1,L1,o1,p1,w,W1,Bt);Ib(B1,u1,d,l,o,v1,v,g,c,k,e1,_,L.rows,H,C,M1,N,w),Dp(B1,u1,c,v,g,l,o,M1,Ut,m,v1,e1,_,y,C,k,w),St?.(),jt?.(),C1!==null&&(C1.fillStyle=w.bgCell,C1.fillRect(0,0,l,o),C1.drawImage(B1.canvas,0,0));let Et=Nb(u1,o,v1,v,g,c,k,e1,C);a1?.setWindow({x:h,y:c,width:u1.length,height:Et-c},p),W.current={cellXOffset:h,cellYOffset:c,translateX:v,translateY:g,mustDrawFocusOnHeader:I1,lastBuffer:s1?et===X1?"a":"b":void 0},B1.restore(),D1.restore()}function ai(t,a,e,r,n,i,l){let o=a,h=t,c=i==="sticky";for(;o=e;v&&(c=!1,h=r-1);let g=n(h);if(v&&(o=e-g),!(c&&h===r-1)&&l(o,h,g,v,i!=="none"&&h===r-1)===!0||v)break;o+=g,h++}}function h4(t,a,e,r,n,i){let l=0,o=0,h=n+r;for(let c of t){let v=c.sticky?o:l+e;if(i(c,v,h,o,a)===!0)break;l+=c.width,o+=c.sticky?c.width:0}}function _z(t,a,e,r,n){var i;let l=0,o=0;for(let h=0;ha?.[0]===e?.[0]&&a?.[1]===e?.[1],this.addToLeavingItems=a=>{this.leavingItems.some(r=>this.areSameItems(r.item,a.item))||this.leavingItems.push(a)},this.removeFromLeavingItems=a=>{var e;let r=this.leavingItems.find(n=>this.areSameItems(n.item,a));return this.leavingItems=this.leavingItems.filter(n=>n!==r),(e=r?.hoverAmount)!=null?e:0},this.cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(a=>a.hoverAmount>0)},this.shouldStep=()=>{let a=this.leavingItems.length>0,e=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return a||e},this.getAnimatingItems=()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(a=>({...a,hoverAmount:Wb(a.hoverAmount)})),this.step=a=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=a;else{let r=(a-this.lastAnimationTime)/Ub;for(let i of this.leavingItems)i.hoverAmount=(0,b8.default)(i.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,b8.default)(this.currentHoveredItem.hoverAmount+r,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=a,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0},this.setHovered=a=>{var e;if(!this.areSameItems((e=this.currentHoveredItem)==null?void 0:e.item,a)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),a!==void 0){let r=this.removeFromLeavingItems(a);this.currentHoveredItem={item:a,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}}}},qb=class{constructor(t){this.fn=t}get value(){var t;return(t=this.val)!=null?t:this.val=this.fn()}};function W8(t){return new qb(t)}var Gb=W8(()=>window.navigator.userAgent.includes("Firefox")),Tz=W8(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),E5=W8(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function Kb(t,a){for(let e of t)if(e[0]===a[0]&&e[1]===a[1])return!0;return!1}function Xb(t){let a=l4.useRef([]),e=l4.useRef(0),r=l4.useRef(t);r.current=t;let n=l4.useCallback(()=>{let i=()=>window.requestAnimationFrame(l),l=()=>{let o=a.current;a.current=[],r.current(o),a.current.length>0?e.current++:e.current=0};window.requestAnimationFrame(e.current>600?i:l)},[]);return l4.useCallback(i=>{Kb(a.current,i)||(a.current.length===0&&n(),a.current.push(i))},[n])}var Yb=(t,a)=>{var e;if(t.kind===l1.Custom)return t.copyData;let r=a?.(t);return(e=r?.getAccessibilityString(t))!=null?e:""},Qb=(t,a)=>{var e,r,n,i,l,o,h,c;let{width:v,height:g,accessibilityHeight:d,columns:u,cellXOffset:p,cellYOffset:z,headerHeight:w,fillHandle:s=!1,groupHeaderHeight:f,rowHeight:m,rows:H,getCellContent:x,getRowThemeOverride:y,onHeaderMenuClick:R,enableGroups:L,isFilling:V,onCanvasFocused:C,onCanvasBlur:k,isFocused:b,selection:F,freezeColumns:_,onContextMenu:j,trailingRowType:n1,fixedShadowX:Z=!0,fixedShadowY:d1=!0,drawFocusRing:O=!0,onMouseDown:a1,onMouseUp:W,onMouseMoveRaw:L1,onMouseMove:p1,onItemHovered:o1,dragAndDropState:H1,firstColAccessible:P1,onKeyDown:K1,onKeyUp:W1,highlightRegions:Bt,canvasRef:T1,onDragStart:X1,onDragEnd:Y,eventTargetRef:N,isResizing:s1,isDragging:x1,isDraggable:f1=!1,allowResize:U,disabledRows:v1,getGroupDetails:D,theme:I,prelightCells:C1,headerIcons:D1,verticalBorder:et,drawHeader:B1,drawCustomCell:c1,onCellFocused:e1,onDragOverCell:u1,onDrop:M1,onDragLeave:I1,imageWindowLoader:Q1,smoothScrollX:St=!1,smoothScrollY:jt=!1,experimental:Ut,getCellRenderer:Et}=t,ot=(e=t.translateX)!=null?e:0,J1=(r=t.translateY)!=null?r:0,Jt=Math.max(_,Math.min(u.length-1,p)),Mt=r1.useRef(null),C0=r1.useMemo(()=>new yk,[]),Z0=Q1??C0,B0=r1.useRef(),[t0,Ma]=r1.useState(!1),dt=r1.useRef([]),At=r1.useRef(),[h0,wt]=r1.useState(),[Ft,qt]=r1.useState(),c2=r1.useRef(null),[v2,$a]=r1.useState(!1),O2=r1.useRef(v2);O2.current=v2;let j0=r1.useMemo(()=>new Fb(D1,()=>{la.current=void 0,oa.current()}),[D1]),g2=L?f+w:w,D2=r1.useRef(-1),ri=Ut?.enableFirefoxRescaling!==!0;r1.useLayoutEffect(()=>{!Gb.value||window.devicePixelRatio===1||ri||(D2.current!==-1&&Ma(!0),window.clearTimeout(D2.current),D2.current=window.setTimeout(()=>{Ma(!1),D2.current=-1},200))},[z,Jt,ot,J1,ri]);let u0=Ek(u,_),Ht=r1.useCallback((S,G,b1)=>{let z1=S.getBoundingClientRect();if(G>=u0.length||b1>=H)return;let E1=z1.width/v,h1=Kn(G,b1,v,g,f,g2,Jt,z,ot,J1,H,_,n1==="sticky",u0,m);return E1!==1&&(h1.x*=E1,h1.y*=E1,h1.width*=E1,h1.height*=E1),h1.x+=z1.x,h1.y+=z1.y,h1},[v,g,f,g2,Jt,z,ot,J1,H,_,n1,u0,m]),m0=r1.useCallback((S,G,b1,z1)=>{var E1,h1;let $1=S.getBoundingClientRect(),st=$1.width/v,S1=(G-$1.left)/st,_1=(b1-$1.top)/st,a0=5,tt=A8(u0,Jt,v,void 0,ot),ut=0;z1 instanceof MouseEvent&&(ut=z1.button);let ht=Pk(S1,tt,ot),xt=Ik(_1,g,L,w,f,H,m,z,J1,n1==="sticky"),_t=z1?.shiftKey===!0,Ca=z1?.ctrlKey===!0,y2=z1?.metaKey===!0,C2=z1!==void 0&&!(z1 instanceof MouseEvent)||z1?.pointerType==="touch",N2=20,B2=[Math.abs(S1)v||_1>g){let G1=S1>v?-1:S1<0?1:0,Gt=_1>g?1:_1<0?-1:0,n0=!1;if(ht===-1&&xt===-1){let A0=Ht(S,u0.length-1,-1);i2(A0!==void 0),n0=G=0?(Gt=!0,G1=Ht(S,n0,xt),i2(G1!==void 0),u2={kind:L&&xt===-2?w2:xe,location:[n0,xt],bounds:G1,group:(E1=u0[n0].group)!=null?E1:"",isEdge:Gt,shiftKey:_t,ctrlKey:Ca,metaKey:y2,isTouch:C2,localEventX:G-G1.x,localEventY:b1-G1.y,button:ut,scrollEdge:B2}):u2={kind:L&&xt===-2?w2:xe,group:(h1=u0[ht].group)!=null?h1:"",location:[ht,xt],bounds:G1,isEdge:Gt,shiftKey:_t,ctrlKey:Ca,metaKey:y2,isTouch:C2,localEventX:G-G1.x,localEventY:b1-G1.y,button:ut,scrollEdge:B2}}else{let G1=Ht(S,ht,xt);i2(G1!==void 0);let Gt=G1!==void 0&&G1.x+G1.width-G{}),xr=r1.useRef(h0);xr.current=h0;let[Se,Ae]=r1.useMemo(()=>{let S=document.createElement("canvas"),G=document.createElement("canvas");return S.style.display="none",S.style.opacity="0",S.style.position="fixed",G.style.display="none",G.style.opacity="0",G.style.position="fixed",[S,G]},[]);r1.useLayoutEffect(()=>(document.documentElement.append(Se),document.documentElement.append(Ae),()=>{Se.remove(),Ae.remove()}),[Se,Ae]);let la=r1.useRef(),Ha=r1.useCallback(()=>{var S,G;let b1=Mt.current,z1=c2.current;if(b1===null||z1===null)return;let E1=la.current,h1={canvas:b1,bufferA:Se,bufferB:Ae,headerCanvas:z1,width:v,height:g,cellXOffset:Jt,cellYOffset:z,translateX:Math.round(ot),translateY:Math.round(J1),mappedColumns:u0,enableGroups:L,freezeColumns:_,dragAndDropState:H1,theme:I,headerHeight:w,groupHeaderHeight:f,disabledRows:v1??mt.empty(),rowHeight:m,verticalBorder:et,isResizing:s1,isFocused:b,selection:F,fillHandle:s,lastRowSticky:n1,rows:H,drawFocus:O,getCellContent:x,getGroupDetails:D??($1=>({name:$1})),getRowThemeOverride:y,drawCustomCell:c1,drawHeaderCallback:B1,prelightCells:C1,highlightRegions:Bt,imageLoader:Z0,lastBlitData:At,damage:B0.current,hoverValues:dt.current,hoverInfo:xr.current,spriteManager:j0,scrolling:t0,hyperWrapping:(S=Ut?.hyperWrapping)!=null?S:!1,touchMode:v2,enqueue:ni.current,renderStrategy:(G=Ut?.renderStrategy)!=null?G:Tz.value?"double-buffer":"single-buffer",getCellRenderer:Et};h1.damage===void 0?(la.current=h1,Up(h1,E1)):Up(h1,void 0)},[Se,Ae,v,g,Jt,z,ot,J1,u0,L,_,H1,I,w,f,v1,m,et,s1,b,F,s,n1,H,O,x,D,y,c1,B1,C1,Bt,Z0,j0,t0,Ut?.hyperWrapping,Ut?.renderStrategy,v2,Et]),oa=r1.useRef(Ha);r1.useLayoutEffect(()=>{Ha(),oa.current=Ha},[Ha]),r1.useLayoutEffect(()=>{(async()=>{var G;((G=document?.fonts)==null?void 0:G.ready)!==void 0&&(await document.fonts.ready,la.current=void 0,oa.current())})()},[]);let xa=r1.useCallback(S=>{B0.current=S,oa.current(),B0.current=void 0},[]),q5=Xb(xa);ni.current=q5;let ii=r1.useCallback(S=>{xa(S.map(G=>G.cell))},[xa]);Z0.setCallback(xa);let[G5,li]=r1.useState(!1),[c4,Fe]=ia??[],oi=c4!==void 0&&Fe===-1,wr=c4!==void 0&&Fe===-2,ke=!1,v4=!1,d2;if(c4!==void 0&&Fe!==void 0&&Fe>-1){let S=x([c4,Fe],!0);ke=S.kind===o2.NewRow||S.kind===o2.Marker&&S.markerKind!=="number",v4=S.kind===l1.Boolean&&S8(S),d2=S.cursor}let wa=x1?"grabbing":(Ft??!1)||s1?"col-resize":G5||V?"crosshair":d2!==void 0?d2:oi||ke||v4||wr?"pointer":"default",Ua=r1.useMemo(()=>({contain:"strict",display:"block",cursor:wa}),[wa]),hi=r1.useRef("default"),ci=N?.current;ci!=null&&hi.current!==Ua.cursor&&(ci.style.cursor=hi.current=Ua.cursor);let La=r1.useCallback((S,G,b1,z1)=>{if(D===void 0)return;let E1=D(S);if(E1.actions!==void 0){let h1=Az(G,E1.actions);for(let[$1,st]of h1.entries())if(Fz(st,b1+G.x,z1+st.y))return E1.actions[$1]}},[D]),ha=r1.useCallback((S,G,b1,z1)=>{let E1=u[G];if(!x1&&!s1&&E1.hasMenu===!0&&!(Ft??!1)){let h1=Ht(S,G,-1);i2(h1!==void 0);let $1=kz(h1.x,h1.y,h1.width,h1.height,N8(E1.title)==="rtl");if(b1>$1.x&&b1<$1.x+$1.width&&z1>$1.y&&z1<$1.y+$1.height)return h1}},[u,Ht,Ft,x1,s1]),M0=r1.useRef(0),Va=r1.useRef(),g4=r1.useRef(!1),Lr=r1.useCallback(S=>{let G=Mt.current,b1=N?.current;if(G===null||S.target!==G&&S.target!==b1)return;g4.current=!0;let z1,E1;if(S instanceof MouseEvent?(z1=S.clientX,E1=S.clientY):(z1=S.touches[0].clientX,E1=S.touches[0].clientY),S.target===b1&&b1!==null){let $1=b1.getBoundingClientRect();if(z1>$1.right||E1>$1.bottom)return}let h1=m0(G,z1,E1,S);Va.current=h1.location,h1.isTouch&&(M0.current=Date.now()),O2.current!==h1.isTouch&&$a(h1.isTouch),!(h1.kind===xe&&ha(G,h1.location[0],z1,E1)!==void 0)&&(h1.kind===w2&&La(h1.group,h1.bounds,h1.localEventX,h1.localEventY)!==void 0||(a1?.(h1),!h1.isTouch&&f1!==!0&&f1!==h1.kind&&S.preventDefault()))},[N,f1,m0,La,ha,a1]);W0("touchstart",Lr,window,!1),W0("mousedown",Lr,window,!1);let vi=r1.useCallback(S=>{var G,b1;let z1=Mt.current;if(g4.current=!1,W===void 0||z1===null)return;let E1=N?.current,h1=S.target!==z1&&S.target!==E1,$1,st;if(S instanceof MouseEvent){if($1=S.clientX,st=S.clientY,S.pointerType==="touch")return}else $1=S.changedTouches[0].clientX,st=S.changedTouches[0].clientY;let S1=m0(z1,$1,st,S);S1.isTouch&&M0.current!==0&&Date.now()-M0.current>500&&(S1={...S1,isLongTouch:!0}),O2.current!==S1.isTouch&&$a(S1.isTouch),!h1&&S.cancelable&&S.preventDefault();let[_1]=S1.location,a0=ha(z1,_1,$1,st);if(S1.kind===xe&&a0!==void 0){(S1.button!==0||((G=Va.current)==null?void 0:G[0])!==_1||((b1=Va.current)==null?void 0:b1[1])!==-1)&&W(S1,!0);return}else if(S1.kind===w2){let tt=La(S1.group,S1.bounds,S1.localEventX,S1.localEventY);if(tt!==void 0){S1.button===0&&tt.onClick(S1);return}}W(S1,h1)},[W,N,m0,ha,La]);W0("mouseup",vi,window,!1),W0("touchend",vi,window,!1);let K5=r1.useCallback(S=>{var G,b1;let z1=Mt.current;if(z1===null)return;let E1=N?.current,h1=S.target!==z1&&S.target!==E1,$1,st;S instanceof MouseEvent?($1=S.clientX,st=S.clientY):($1=S.changedTouches[0].clientX,st=S.changedTouches[0].clientY);let S1=m0(z1,$1,st,S);O2.current!==S1.isTouch&&$a(S1.isTouch),!h1&&S.cancelable&&S.preventDefault();let[_1]=S1.location,a0=ha(z1,_1,$1,st);if(S1.kind===xe&&a0!==void 0)S1.button===0&&((G=Va.current)==null?void 0:G[0])===_1&&((b1=Va.current)==null?void 0:b1[1])===-1&&R?.(_1,a0);else if(S1.kind===w2){let tt=La(S1.group,S1.bounds,S1.localEventX,S1.localEventY);tt!==void 0&&S1.button===0&&tt.onClick(S1)}},[N,m0,ha,R,La]);W0("click",K5,window,!1);let Lt=r1.useCallback(S=>{let G=Mt.current;if(G===null||j===void 0)return;let b1=m0(G,S.clientX,S.clientY,S);j(b1,()=>{S.cancelable&&S.preventDefault()})},[m0,j]);W0("contextmenu",Lt,(n=N?.current)!=null?n:null,!1);let Wa=r1.useCallback(S=>{B0.current=S.map(G=>G.item),dt.current=S,oa.current(),B0.current=void 0},[]),s2=r1.useMemo(()=>new jb(Wa),[Wa]),P=r1.useRef(s2);P.current=s2,r1.useLayoutEffect(()=>{let S=P.current;if(ia===void 0||ia[1]<0){S.setHovered(ia);return}let G=x(ia),b1=Et(G);S.setHovered(b1===void 0&&G.kind===l1.Custom||b1?.needsHover===!0?ia:void 0)},[x,Et,ia]);let H0=r1.useRef(),V2=r1.useCallback(S=>{var G;let b1=Mt.current;if(b1===null)return;let z1=N?.current,E1=S.target!==b1&&S.target!==z1,h1=m0(b1,S.clientX,S.clientY,S);if(h1.kind!=="out-of-bounds"&&E1&&!g4.current&&!h1.isTouch)return;if(!j5(h1,H0.current))o1?.(h1),wt(h1.kind===O5?void 0:[h1.location,[h1.localEventX,h1.localEventY]]),H0.current=h1;else if(h1.kind==="cell"||h1.kind===xe||h1.kind===w2){let st=[h1.location,[h1.localEventX,h1.localEventY]];if(wt(st),xr.current=st,h1.kind==="cell"){let S1=x(h1.location);(S1.kind===l1.Custom||((G=Et(S1))==null?void 0:G.needsHoverPosition)===!0)&&xa([h1.location])}else h1.kind===w2&&xa([h1.location])}let $1=h1.location[0]>=(P1?0:1);if(qt(h1.kind===xe&&h1.isEdge&&$1&&U===!0),s&&F.current!==void 0){let[st,S1]=F.current.cell,_1=Ht(b1,st,S1),a0=S.clientX,tt=S.clientY;i2(_1!==void 0),li(a0>=_1.x+_1.width-6&&a0<=_1.x+_1.width&&tt>=_1.y+_1.height-6&&tt<=_1.y+_1.height)}else li(!1);L1?.(S),p1(h1)},[N,m0,P1,U,s,F,L1,p1,o1,x,Et,xa,Ht]);W0("mousemove",V2,window,!0);let X5=r1.useCallback(S=>{let G=Mt.current;if(G===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(G,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),K1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[K1,F,Ht]),gi=r1.useCallback(S=>{let G=Mt.current;if(G===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(G,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),W1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[W1,F,Ht]),Y5=r1.useCallback(S=>{Mt.current=S,T1!==void 0&&(T1.current=S)},[T1]),Q5=r1.useCallback(S=>{let G=Mt.current;if(G===null||f1===!1||s1){S.preventDefault();return}let b1,z1,E1=m0(G,S.clientX,S.clientY);if(f1!==!0&&E1.kind!==f1){S.preventDefault();return}let h1=(tt,ut)=>{b1=tt,z1=ut},$1,st,S1,_1=(tt,ut,ht)=>{$1=tt,st=ut,S1=ht},a0=!1;if(X1?.({...E1,setData:h1,setDragImage:_1,preventDefault:()=>a0=!0,defaultPrevented:()=>a0}),!a0&&b1!==void 0&&z1!==void 0&&S.dataTransfer!==null)if(S.dataTransfer.setData(b1,z1),S.dataTransfer.effectAllowed="copyLink",$1!==void 0&&st!==void 0&&S1!==void 0)S.dataTransfer.setDragImage($1,st,S1);else{let[tt,ut]=E1.location;if(ut!==void 0){let ht=document.createElement("canvas"),xt=Ht(G,tt,ut);i2(xt!==void 0),ht.width=xt.width,ht.height=xt.height;let _t=ht.getContext("2d");_t!==null&&(_t.textBaseline="middle",ut===-1?(_t.font=`${I.headerFontStyle} ${I.fontFamily}`,_t.fillStyle=I.bgHeader,_t.fillRect(0,0,ht.width,ht.height),bz(_t,0,0,xt.width,xt.height,u0[tt],!1,I,!1,!1,0,j0,B1,!1)):(_t.font=`${I.baseFontStyle} ${I.fontFamily}`,_t.fillStyle=I.bgCell,_t.fillRect(0,0,ht.width,ht.height),Sz(_t,ut,x([tt,ut]),0,0,0,xt.width,xt.height,!1,I,c1,Z0,j0,1,void 0,!1,0,void 0,void 0,Et))),ht.style.left="-100%",ht.style.position="absolute",document.body.append(ht),S.dataTransfer.setDragImage(ht,xt.width/2,xt.height/2),window.setTimeout(()=>{ht.remove()},0)}}else S.preventDefault()},[f1,s1,m0,X1,Ht,I,u0,j0,B1,x,c1,Z0,Et]);W0("dragstart",Q5,(i=N?.current)!=null?i:null,!1,!1);let d4=r1.useRef(),q=r1.useCallback(S=>{var G;let b1=Mt.current;if(M1!==void 0&&S.preventDefault(),b1===null||u1===void 0)return;let z1=m0(b1,S.clientX,S.clientY),[E1,h1]=z1.location,$1=E1-(P1?0:1),[st,S1]=(G=d4.current)!=null?G:[];(st!==$1||S1!==h1)&&(d4.current=[$1,h1],u1([$1,h1],S.dataTransfer))},[P1,m0,u1,M1]);W0("dragover",q,(l=N?.current)!=null?l:null,!1,!1);let R2=r1.useCallback(()=>{d4.current=void 0,Y?.()},[Y]);W0("dragend",R2,(o=N?.current)!=null?o:null,!1,!1);let P0=r1.useCallback(S=>{let G=Mt.current;if(G===null||M1===void 0)return;S.preventDefault();let b1=m0(G,S.clientX,S.clientY),[z1,E1]=b1.location,h1=z1-(P1?0:1);M1([h1,E1],S.dataTransfer)},[P1,m0,M1]);W0("drop",P0,(h=N?.current)!=null?h:null,!1,!1);let Z5=r1.useCallback(()=>{I1?.()},[I1]);W0("dragleave",Z5,(c=N?.current)!=null?c:null,!1,!1);let di=r1.useRef(F);di.current=F;let Ra=r1.useRef(null),J0=r1.useCallback(S=>{var G;Mt.current===null||!Mt.current.contains(document.activeElement)||(S===null&&di.current.current!==void 0?(G=T1?.current)==null||G.focus({preventScroll:!0}):S!==null&&S.focus({preventScroll:!0}),Ra.current=S)},[T1]);r1.useImperativeHandle(a,()=>({focus:()=>{var S;let G=Ra.current;G===null||!document.contains(G)?(S=T1?.current)==null||S.focus({preventScroll:!0}):G.focus({preventScroll:!0})},getBounds:(S,G)=>{if(!(T1===void 0||T1.current===null))return Ht(T1.current,S,G??-1)},damage:ii}),[T1,ii,Ht]);let ya=r1.useRef(),J5=Sk(()=>{var S,G,b1,z1;if(v<50)return null;let E1=A8(u0,Jt,v,H1,ot),h1=P1?0:-1;!P1&&((S=E1[0])==null?void 0:S.sourceIndex)===0&&(E1=E1.slice(1));let[$1,st]=(b1=(G=F.current)==null?void 0:G.cell)!=null?b1:[],S1=(z1=F.current)==null?void 0:z1.range,_1=E1.map(tt=>tt.sourceIndex),a0=(0,Cz.default)(z,Math.min(H,z+d));return $1!==void 0&&st!==void 0&&!(_1.includes($1)&&a0.includes(st))&&J0(null),r1.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":H+1,"aria-multiselectable":"true","aria-colcount":u0.length+h1},r1.createElement("thead",{role:"rowgroup"},r1.createElement("tr",{role:"row","aria-rowindex":1},E1.map(tt=>r1.createElement("th",{role:"columnheader","aria-selected":F.columns.hasIndex(tt.sourceIndex),"aria-colindex":tt.sourceIndex+1+h1,tabIndex:-1,onFocus:ut=>{if(ut.target!==Ra.current)return e1?.([tt.sourceIndex,-1])},key:tt.sourceIndex},tt.title)))),r1.createElement("tbody",{role:"rowgroup"},a0.map(tt=>r1.createElement("tr",{role:"row","aria-selected":F.rows.hasIndex(tt),key:tt,"aria-rowindex":tt+2},E1.map(ut=>{let ht=ut.sourceIndex,xt=`${ht},${tt}`,_t=$1===ht&&st===tt,Ca=S1!==void 0&&ht>=S1.x&&ht=S1.y&&tt{let B2=T1?.current;if(B2!=null)return K1?.({bounds:Ht(B2,ht,tt),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:C2})},onFocusCapture:B2=>{var u2,G1;if(!(B2.target===Ra.current||((u2=ya.current)==null?void 0:u2[0])===ht&&((G1=ya.current)==null?void 0:G1[1])===tt))return ya.current=C2,e1?.(C2)},ref:_t?J0:void 0,tabIndex:-1},Yb(N2,Et))})))))},[v,u0,Jt,H1,ot,H,z,d,F,J0,x,T1,K1,Ht,e1],200),Vr=Z?ur(u0,H1):0,s4=_===0||!Z?0:Jt>_?1:(0,F8.default)(-ot/100,0,1),Rr=-z*32+J1,c0=d1?(0,F8.default)(-Rr/100,0,1):0,S0=r1.useMemo(()=>{if(!s4&&!c0)return null;let S={position:"absolute",top:0,left:Vr,width:v-Vr,height:g,opacity:s4,pointerEvents:"none",transition:St?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},G={position:"absolute",top:g2,left:0,width:v,height:g,opacity:c0,pointerEvents:"none",transition:jt?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return r1.createElement(r1.Fragment,null,s4>0&&r1.createElement("div",{id:"shadow-x",style:S}),c0>0&&r1.createElement("div",{id:"shadow-y",style:G}))},[s4,c0,Vr,v,St,g2,g,jt]),v0=r1.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return r1.createElement(r1.Fragment,null,r1.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:X5,onKeyUp:gi,onFocus:C,onBlur:k,ref:Y5,style:Ua},J5),r1.createElement("canvas",{ref:c2,style:v0}),S0)},Zb=r1.memo(r1.forwardRef(Qb));function qn(t,a,e,r){var n;return(0,dz.default)(Math.round(a-((n=t.growOffset)!=null?n:0)),Math.ceil(e),Math.floor(r))}var Jb=t=>{var a;let[e,r]=It.useState(),[n,i]=It.useState(),[l,o]=It.useState(),[h,c]=It.useState(),[v,g]=It.useState(!1),[d,u]=It.useState(),[p,z]=It.useState(),[w,s]=It.useState(),[f,m]=It.useState(!1),[H,x]=It.useState(),{onHeaderMenuClick:y,getCellContent:R,onColumnMoved:L,onColumnResize:V,onColumnResizeStart:C,onColumnResizeEnd:k,gridRef:b,maxColumnWidth:F,minColumnWidth:_,onRowMoved:j,lockColumns:n1,onMouseDown:Z,onMouseUp:d1,onItemHovered:O,onDragStart:a1,canvasRef:W}=t,L1=((a=V??k)!=null?a:C)!==void 0,{columns:p1,selection:o1}=t,H1=o1.columns,P1=It.useCallback(U=>{let[v1,D]=U.location;l!==void 0&&h!==v1&&v1>=n1?(g(!0),c(v1)):p!==void 0&&D!==void 0?(m(!0),s(Math.max(0,D))):O?.(U)},[l,p,h,O,n1]),K1=L!==void 0,W1=It.useCallback(U=>{var v1,D;if(U.button===0){let[I,C1]=U.location;if(U.kind==="out-of-bounds"&&U.isEdge&&L1){let D1=(v1=b?.current)==null?void 0:v1.getBounds(p1.length-1,-1);D1!==void 0&&(r(D1.x),i(p1.length-1))}else if(U.kind==="header"&&I>=n1){let D1=W?.current;if(U.isEdge&&L1&&D1){r(U.bounds.x),i(I);let B1=D1.getBoundingClientRect().width/D1.offsetWidth,c1=U.bounds.width/B1;C?.(p1[I],c1,I,c1+((D=p1[I].growOffset)!=null?D:0))}else U.kind==="header"&&K1&&(u(U.bounds.x),o(I))}else U.kind==="cell"&&n1>0&&I===0&&C1!==void 0&&j!==void 0&&(x(U.bounds.y),z(C1))}Z?.(U)},[Z,L1,n1,j,b,p1,K1,C,W]),Bt=It.useCallback((U,v1)=>{v||f||y?.(U,v1)},[v,f,y]),T1=It.useRef(-1),X1=It.useCallback(()=>{T1.current=-1,z(void 0),s(void 0),x(void 0),m(!1),o(void 0),c(void 0),u(void 0),g(!1),i(void 0),r(void 0)},[]),Y=It.useCallback((U,v1)=>{var D,I,C1;if(U.button===0){if(n!==void 0){if(H1?.hasIndex(n)===!0)for(let et of H1){if(et===n)continue;let B1=p1[et],c1=qn(B1,T1.current,_,F);V?.(B1,c1,et,c1+((D=B1.growOffset)!=null?D:0))}let D1=qn(p1[n],T1.current,_,F);if(k?.(p1[n],D1,n,D1+((I=p1[n].growOffset)!=null?I:0)),H1.hasIndex(n))for(let et of H1){if(et===n)continue;let B1=p1[et],c1=qn(B1,T1.current,_,F);k?.(B1,c1,et,c1+((C1=B1.growOffset)!=null?C1:0))}}X1(),l!==void 0&&h!==void 0&&L?.(l,h),p!==void 0&&w!==void 0&&j?.(p,w)}d1?.(U,v1)},[d1,n,l,h,p,w,H1,k,p1,_,F,V,L,j,X1]),N=It.useMemo(()=>{if(!(l===void 0||h===void 0)&&l!==h)return{src:l,dest:h}},[l,h]),s1=It.useCallback(U=>{var v1,D;let I=W?.current;if(l!==void 0&&d!==void 0)Math.abs(U.clientX-d)>20&&g(!0);else if(p!==void 0&&H!==void 0)Math.abs(U.clientY-H)>20&&m(!0);else if(n!==void 0&&e!==void 0&&I){let D1=I.getBoundingClientRect().width/I.offsetWidth,et=(U.clientX-e)/D1,B1=p1[n],c1=qn(B1,et,_,F);if(V?.(B1,c1,n,c1+((v1=B1.growOffset)!=null?v1:0)),T1.current=et,H1?.first()===n)for(let e1 of H1){if(e1===n)continue;let u1=p1[e1],M1=qn(u1,T1.current,_,F);V?.(u1,M1,e1,M1+((D=u1.growOffset)!=null?D:0))}}},[l,d,p,H,n,e,p1,_,F,V,H1,W]),x1=It.useCallback((U,v1)=>{if(p===void 0||w===void 0)return R(U,v1);let[D,I]=U;return I===w?I=p:(I>w&&(I-=1),I>=p&&(I+=1)),R([D,I],v1)},[p,w,R]),f1=It.useCallback(U=>{a1?.(U),U.defaultPrevented()||X1()},[X1,a1]);return It.createElement(Zb,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:x1,isResizing:n!==void 0,onHeaderMenuClick:Bt,isDragging:v,onItemHovered:P1,onDragStart:f1,onMouseDown:W1,allowResize:L1,onMouseUp:Y,dragAndDropState:N,onMouseMoveRaw:s1,ref:b})},tE=Jb;function aE(t){let a=(0,zr.useRef)(null),[e,r]=(0,zr.useState)({width:t?.[0],height:t?.[1]});return(0,zr.useLayoutEffect)(()=>{let n=l=>{for(let o of l){let{width:h,height:c}=o&&o.contentRect||{};r(v=>v.width===h&&v.height===c?v:{width:h,height:c})}},i=new window.ResizeObserver(n);return a.current&&i.observe(a.current,void 0),()=>{i.disconnect()}},[a.current]),{ref:a,...e}}var eE=()=>t=>t.isSafari?"scroll":"auto",rE=L0("div")({name:"ScrollRegionStyle",class:"s1jz82f8",vars:{"s1jz82f8-0":[eE()]}});function C8(t){t.stopPropagation()}function nE(t){let[a,e]=lt.useState(!1),r=lt.useRef(0);return W0("touchstart",lt.useCallback(()=>{window.clearTimeout(r.current),e(!0)},[]),window,!0,!1),W0("touchend",lt.useCallback(n=>{n.touches.length===0&&(r.current=window.setTimeout(()=>e(!1),t))},[t]),window,!0,!1),a}var iE=t=>{var a,e,r,n;let{children:i,clientHeight:l,scrollHeight:o,scrollWidth:h,update:c,draggable:v,className:g,preventDiagonalScrolling:d=!1,paddingBottom:u=0,paddingRight:p=0,rightElement:z,rightElementProps:w,scrollRef:s,scrollToEnd:f,initialSize:m,minimap:H}=t,x=[],y=(a=w?.sticky)!=null?a:!1,R=(e=w?.fill)!=null?e:!1,L=lt.useRef(0),V=lt.useRef(0),C=lt.useRef(null),k=window.devicePixelRatio;lt.useEffect(()=>{let W1=C.current;W1===null||f!==!0||(W1.scrollLeft=W1.scrollWidth-W1.clientWidth)},[f]);let b=lt.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),F=lt.useRef(null),_=nE(200),[j,n1]=lt.useState(!0),Z=lt.useRef(0);lt.useEffect(()=>{if(!j||_||b.current.lockDirection===void 0)return;let W1=C.current;if(W1===null)return;let[Bt,T1]=b.current.lockDirection;Bt!==void 0?W1.scrollLeft=Bt:T1!==void 0&&(W1.scrollTop=T1),b.current.lockDirection=void 0},[_,j]);let d1=lt.useCallback(()=>{var W1,Bt,T1,X1;let Y=C.current;if(Y===null)return;let N=Y.scrollTop,s1=Y.scrollLeft,x1=b.current.scrollTop,f1=b.current.scrollLeft,U=s1-f1,v1=N-x1;_&&U!==0&&v1!==0&&(Math.abs(U)>3||Math.abs(v1)>3)&&d&&b.current.lockDirection===void 0&&(b.current.lockDirection=Math.abs(U)0&&(Math.abs(C1)>2e3||I===0||I===D1)&&o>Y.scrollHeight+5){let et=I/D1,B1=(o-Y.clientHeight)*et;L.current=B1-I}D!==void 0&&(window.clearTimeout(Z.current),n1(!1),Z.current=window.setTimeout(()=>n1(!0),200)),c({x:s1,y:I+L.current,width:Y.clientWidth-p,height:Y.clientHeight-u,paddingRight:(X1=(T1=F.current)==null?void 0:T1.clientWidth)!=null?X1:0})},[u,p,o,c,d,_]),O=lt.useRef(d1);O.current=d1;let a1=lt.useRef(),W=lt.useRef(!1);lt.useEffect(()=>{W.current?d1():W.current=!0},[d1,u,p]);let L1=lt.useCallback(W1=>{C.current=W1,s!==void 0&&(s.current=W1)},[s]),p1=0,o1=0;for(x.push(lt.createElement("div",{key:p1++,style:{width:h,height:0}}));o1O.current(),0),a1.current={width:P1,height:K1}),(P1??0)===0||(K1??0)===0?lt.createElement("div",{ref:H1}):lt.createElement("div",{ref:H1},lt.createElement(rE,{isSafari:Tz.value},H,lt.createElement("div",{className:"dvn-underlay"},i),lt.createElement("div",{ref:L1,style:a1.current,draggable:v,onDragStart:W1=>{v||(W1.stopPropagation(),W1.preventDefault())},className:"dvn-scroller "+(g??""),onScroll:d1},lt.createElement("div",{className:"dvn-scroll-inner"+(z===void 0?" hidden":"")},lt.createElement("div",{className:"dvn-stack"},x),z!==void 0&<.createElement(lt.Fragment,null,!R&<.createElement("div",{className:"dvn-spacer"}),lt.createElement("div",{ref:F,onMouseDown:C8,onMouseUp:C8,onMouseMove:C8,style:{height:K1,maxHeight:l-Math.ceil(k%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:p,flexGrow:R?1:void 0,right:y?p??0:void 0,pointerEvents:"auto"}},z))))))},lE=L0("div")({name:"MinimapStyle",class:"m15w2ly5"}),oE=t=>{var a,e,r;let{columns:n,rows:i,rowHeight:l,headerHeight:o,groupHeaderHeight:h,enableGroups:c,freezeColumns:v,experimental:g,clientSize:d,className:u,onVisibleRegionChanged:p,scrollToEnd:z,scrollRef:w,preventDiagonalScrolling:s,rightElement:f,rightElementProps:m,overscrollX:H,overscrollY:x,showMinimap:y=!1,initialSize:R,smoothScrollX:L=!1,smoothScrollY:V=!1,isDraggable:C}=t,{paddingRight:k,paddingBottom:b}=g??{},[F,_]=d,j=d0.useRef(),n1=d0.useRef(),Z=d0.useRef(),d1=d0.useRef(),O=d0.useMemo(()=>{let f1=Math.max(0,H??0);for(let U of n)f1+=U.width;return f1},[n,H]),a1=c?o+h:o;if(typeof l=="number")a1+=i*l;else for(let f1=0;f1{var f1,U,v1;if(W.current===void 0)return;let D={...W.current},I=0,C1=D.x<0?-D.x:0,D1=0,et=0;D.x=D.x<0?0:D.x;let B1=0;for(let Q1=0;Q1=St+Q1.width)I+=Q1.width,et++,D1++;else if(D.x>St)I+=Q1.width,L?C1+=St-D.x:et++,D1++;else if(D.x+D.width>St)I+=Q1.width,D1++;else break}let c1=0,e1=0,u1=0;if(typeof l=="number")V?(e1=Math.floor(D.y/l),c1=e1*l-D.y):e1=Math.ceil(D.y/l),u1=Math.ceil(D.height/l)+e1,c1<0&&u1++;else{let Q1=0;for(let St=0;St=Q1+jt)Q1+=jt,e1++,u1++;else if(D.y>Ut)Q1+=jt,V?c1+=Ut-D.y:e1++,u1++;else if(D.y+D.height>jt/2+Q1)Q1+=jt,u1++;else break}}let M1={x:et,y:e1,width:D1-et,height:u1-e1},I1=j.current;(I1===void 0||I1.y!==M1.y||I1.x!==M1.x||I1.height!==M1.height||I1.width!==M1.width||n1.current!==C1||Z.current!==c1||D.width!==((f1=d1.current)==null?void 0:f1[0])||D.height!==((U=d1.current)==null?void 0:U[1]))&&(p?.({x:et,y:e1,width:D1-et,height:u1-e1},D.width,D.height,(v1=D.paddingRight)!=null?v1:0,C1,c1),j.current=M1,n1.current=C1,Z.current=c1,d1.current=[D.width,D.height])},[n,l,i,p,v,L,V]),p1=d0.useCallback(f1=>{W.current=f1,L1()},[L1]);d0.useEffect(()=>{L1()},[L1]);let o1=(a=w?.current)!=null?a:void 0,H1=(0,Pz.default)(O/a1,2/3,1.5),P1=200,K1=H1>1?P1:Math.ceil(P1*H1),W1=H1>1?Math.ceil(P1/H1):P1,Bt=K1/O,T1=W1/a1,X1=Math.min(F*Math.max(Bt,.01),K1),Y=Math.min(_*Math.max(T1,.01),W1),N=((e=o1?.scrollLeft)!=null?e:0)/(O-F)*(K1-X1),s1=((r=o1?.scrollTop)!=null?r:0)/(a1-_)*(W1-Y),x1=d0.useMemo(()=>{if(!y||X1===0||Y===0)return;let f1=U=>{if(o1===void 0)return;let v1=U.currentTarget.getBoundingClientRect(),D=U.clientX-v1.x-X1/2,I=U.clientY-v1.y-Y/2,C1=(O-o1.clientWidth)*(D/(K1-X1)),D1=(a1-o1.clientHeight)*(I/(W1-Y));o1.scrollTo({left:C1,top:D1,behavior:U.type==="mousemove"?"auto":"smooth"})};return d0.createElement(lE,{style:{width:K1,height:W1},"data-testid":"minimap-container",onMouseMove:U=>{U.buttons===1&&f1(U)},onClick:f1},d0.createElement("div",{className:"header"}),d0.createElement("div",{className:"locationMarker",onDragStart:U=>U.preventDefault(),style:{left:N,top:s1,width:X1,height:Y,borderRadius:Math.min(X1,Y*.2,9)}}))},[W1,a1,N,o1,y,s1,Y,X1,K1,O]);return d0.createElement(iE,{scrollRef:w,minimap:x1,className:u,preventDiagonalScrolling:s,draggable:C===!0||typeof C=="string",scrollWidth:O+(k??0),scrollHeight:a1+(b??0),clientHeight:_,rightElement:f,paddingBottom:b,paddingRight:k,rightElementProps:m,update:p1,initialSize:R,scrollToEnd:z},d0.createElement(tE,{eventTargetRef:w,width:F,height:_,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},hE=oE,cE=()=>t=>t.showSearch?0:400,vE=L0("div")({name:"SearchWrapper",class:"sxep88s",vars:{"sxep88s-0":[cE(),"px"]}}),gE=q1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},q1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),dE=q1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},q1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),sE=q1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},q1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),uE=10,fE=t=>{let{canvasRef:a,cellYOffset:e,rows:r,columns:n,searchInputRef:i,searchValue:l,searchResults:o,onSearchValueChange:h,getCellsForSelection:c,onSearchResultsChanged:v,showSearch:g=!1,onSearchClose:d}=t,[u]=q1.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,z]=q1.useState(""),w=l??p,s=q1.useCallback(O=>{z(O),h?.(O)},[h]),[f,m]=q1.useState(),H=q1.useRef(f);H.current=f,q1.useEffect(()=>{o!==void 0&&(o.length>0?m(O=>{var a1;return{rowsSearched:r,results:o.length,selectedIndex:(a1=O?.selectedIndex)!=null?a1:-1}}):m(void 0))},[r,o]);let x=q1.useRef(new AbortController),y=q1.useRef(),[R,L]=q1.useState([]),V=o??R,C=q1.useCallback(()=>{y.current!==void 0&&(window.cancelAnimationFrame(y.current),y.current=void 0,x.current.abort())},[]),k=q1.useRef(e);k.current=e;let b=q1.useCallback(O=>{let a1=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i"),W=k.current,L1=Math.min(10,r),p1=0;m(void 0),L([]);let o1=[],H1=async()=>{var P1,K1;if(c===void 0)return;let W1=performance.now(),Bt=r-p1,T1=c({x:0,y:W,width:n.length,height:Math.min(L1,Bt,r-W)},x.current.signal);typeof T1=="function"&&(T1=await T1());let X1=!1;for(let[U,v1]of T1.entries())for(let[D,I]of v1.entries()){let C1;switch(I.kind){case l1.Text:case l1.Number:C1=I.displayData;break;case l1.Uri:case l1.Markdown:C1=I.data;break;case l1.Boolean:C1=typeof I.data=="boolean"?I.data.toString():void 0;break;case l1.Image:case l1.Bubble:C1=I.data.join("\u{1F433}");break;case l1.Custom:C1=I.copyData;break}C1!==void 0&&a1.test(C1)&&(o1.push([D,U+W]),X1=!0)}let Y=performance.now();X1&&L([...o1]),p1+=T1.length,i2(p1<=r);let N=(K1=(P1=H.current)==null?void 0:P1.selectedIndex)!=null?K1:-1;m({results:o1.length,rowsSearched:p1,selectedIndex:N}),v?.(o1,N),W+L1>=r?W=0:W+=L1;let s1=Y-W1,x1=Math.max(s1,1),f1=uE/x1;L1=Math.ceil(L1*f1),p1{var O;d?.(),m(void 0),L([]),v?.([],-1),C(),(O=a?.current)==null||O.focus()},[C,a,d,v]),_=q1.useCallback(O=>{s(O.target.value),o===void 0&&(O.target.value===""?(m(void 0),L([]),C()):b(O.target.value))},[b,C,s,o]);q1.useEffect(()=>{g&&i.current!==null&&(s(""),i.current.focus({preventScroll:!0}))},[g,i,s]);let j=q1.useCallback(O=>{var a1;if((a1=O?.stopPropagation)==null||a1.call(O),f===void 0)return;let W=(f.selectedIndex+1)%f.results;m({...f,selectedIndex:W}),v?.(V,W)},[f,v,V]),n1=q1.useCallback(O=>{var a1;if((a1=O?.stopPropagation)==null||a1.call(O),f===void 0)return;let W=(f.selectedIndex-1)%f.results;W<0&&(W+=f.results),m({...f,selectedIndex:W}),v?.(V,W)},[v,V,f]),Z=q1.useCallback(O=>{(O.ctrlKey||O.metaKey)&&O.nativeEvent.code==="KeyF"||O.key==="Escape"?(F(),O.stopPropagation(),O.preventDefault()):O.key==="Enter"&&(O.shiftKey?n1():j())},[F,j,n1]);q1.useEffect(()=>()=>{C()},[C]);let d1=q1.useMemo(()=>{var O,a1,W;let L1;f!==void 0&&(L1=f.results>=1e3?"over 1000":`${f.results} result${f.results!==1?"s":""}`,f.selectedIndex>=0&&(L1=`${f.selectedIndex+1} of ${L1}`));let p1=P1=>{P1.stopPropagation()},H1={width:`${Math.floor(((O=f?.rowsSearched)!=null?O:0)/r*100)}%`};return q1.createElement(vE,{showSearch:g,onMouseDown:p1,onMouseMove:p1,onMouseUp:p1,onClick:p1},q1.createElement("div",{className:"search-bar-inner"},q1.createElement("input",{id:u,"aria-hidden":!g,"data-testid":"search-input",ref:i,onChange:_,value:w,tabIndex:g?void 0:-1,onKeyDownCapture:Z}),q1.createElement("button",{"aria-label":"Previous Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:n1,disabled:((a1=f?.results)!=null?a1:0)===0},gE),q1.createElement("button",{"aria-label":"Next Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:j,disabled:((W=f?.results)!=null?W:0)===0},dE),d!==void 0&&q1.createElement("button",{"aria-label":"Close Search","aria-hidden":!g,"data-testid":"search-close-button",tabIndex:g?void 0:-1,onClick:F},sE)),f!==void 0?q1.createElement(q1.Fragment,null,q1.createElement("div",{className:"search-status"},q1.createElement("div",{"data-testid":"search-result-area"},L1)),q1.createElement("div",{className:"search-progress",style:H1})):q1.createElement("div",{className:"search-status"},q1.createElement("label",{htmlFor:u},"Type to search")))},[F,j,n1,_,d,Z,r,f,w,g,u,i]);return q1.createElement(q1.Fragment,null,q1.createElement(hE,{prelightCells:V,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,showMinimap:t.showMinimap,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,scrollToEnd:t.scrollToEnd}),d1)},pE=fE,zE=()=>t=>Math.max(16,t.targetHeight-10),mE=L0("input")({name:"RenameInput",class:"r1kzy40b",vars:{"r1kzy40b-0":[zE(),"px"]}}),ME=t=>{let{bounds:a,group:e,onClose:r,canvasBounds:n,onFinish:i}=t,[l,o]=_5.default.useState(e);return _5.default.createElement(rz,{style:{position:"absolute",left:a.x-n.left+1,top:a.y-n.top,width:a.width-2,height:a.height},className:"c1sqdbw3",onClickOutside:r},_5.default.createElement(mE,{targetHeight:a.height,"data-testid":"group-rename-input",value:l,onBlur:r,onFocus:h=>h.target.setSelectionRange(0,l.length),onChange:h=>o(h.target.value),onKeyDown:h=>{h.key==="Enter"?i(l):h.key==="Escape"&&r()},autoFocus:!0}))},E8=150;function HE(t,a,e,r){var n,i;let l=r(a);return(i=(n=l?.measure)==null?void 0:n.call(l,t,a,e))!=null?i:E8}function Iz(t,a,e,r,n,i,l,o,h){let c=[];if(n!==void 0&&c.push(...n.map(d=>d[r]).map(d=>HE(t,d,a,h))),c.length>5&&o){let d=c.reduce((u,p)=>u+p)/c.length;c=c.filter(u=>u{if(typeof window>"u")return[null,null];let f=document.createElement("canvas");return f.style.display="none",f.style.opacity="0",f.style.position="fixed",[f,f.getContext("2d",{alpha:!1})]},[]);l2.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d?.remove()}),[d]);let p=l2.useRef({}),z=l2.useRef(),[w,s]=l2.useState();return l2.useLayoutEffect(()=>{let f=v.current;if(f===void 0||t.every(B5))return;let m=Math.max(1,10-Math.floor(t.length/1e4)),H=0;m1&&(m--,H=1);let x={x:0,y:0,width:t.length,height:Math.min(c.current,m)},y={x:0,y:c.current-1,width:t.length,height:1};(async()=>{let L=f(x,h.signal),V=H>0?f(y,h.signal):void 0,C;typeof L=="object"?C=L:C=await bp(L),V!==void 0&&(typeof V=="object"?C=[...C,...V]:C=[...C,...await bp(V)]),z.current=t,s(C)})()},[h.signal,t]),l2.useMemo(()=>{var f;let H=(()=>t.every(B5)?t:u===null?t.map(L=>B5(L)?L:{...L,width:E8}):(u.font=`${g.current.baseFontStyle} ${g.current.fontFamily}`,t.map((L,V)=>{if(B5(L))return L;if(p.current[L.id]!==void 0)return{...L,width:p.current[L.id]};if(w===void 0||z.current!==t||L.id===void 0)return{...L,width:E8};let C=Iz(u,l,L,V,w,n,i,!0,o);return p.current[L.id]=C.width,C})))(),x=0,y=0,R=[];for(let[L,V]of H.entries())x+=V.width,V.grow!==void 0&&V.grow>0&&(y+=V.grow,R.push(L));if(x0){let L=[...H],V=r-x,C=V;for(let k=0;k1&&t.startsWith("_")){if(Number.parseInt(t.slice(1))!==a.keyCode)return!1}else if(t!==a.key)return!1;return!0}function T0(t,a){if(t.length===0)return!1;let e=!1,r=!1,n=!1,i=!1,l=t.split("+"),o=l.pop();if(!wE(o,a))return!1;for(let h of l)switch(h){case"ctrl":e=!0;break;case"shift":r=!0;break;case"alt":n=!0;break;case"meta":i=!0;break;case"primary":E5.value?i=!0:e=!0;break}return a.altKey===n&&a.ctrlKey===e&&a.shiftKey===r&&a.metaKey===i}function LE(t,a,e,r,n,i){let l=T5.default.useCallback((c,v,g,d)=>{var u,p;(i==="cell"||i==="multi-cell")&&c!==void 0&&(c={...c,range:{x:c.cell[0],y:c.cell[1],width:1,height:1}});let z=e==="mixed"&&(g||d==="drag"),w=r==="mixed"&&z,s=n==="mixed"&&z,f={current:c===void 0?void 0:{...c,rangeStack:d==="drag"?(p=(u=t.current)==null?void 0:u.rangeStack)!=null?p:[]:[]},columns:w?t.columns:mt.empty(),rows:s?t.rows:mt.empty()};g&&(i==="multi-rect"||i==="multi-cell")&&f.current!==void 0&&t.current!==void 0&&(f={...f,current:{...f.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),a(f,v)},[r,t,e,i,n,a]),o=T5.default.useCallback((c,v,g)=>{c=c??t.rows,v!==void 0&&(c=c.add(v));let d;if(n==="exclusive"&&c.length>0)d={current:void 0,columns:mt.empty(),rows:c};else{let u=g&&e==="mixed",p=g&&r==="mixed";d={current:u?t.current:void 0,columns:p?t.columns:mt.empty(),rows:c}}a(d,!1)},[r,t,e,n,a]),h=T5.default.useCallback((c,v,g)=>{c=c??t.columns,v!==void 0&&(c=c.add(v));let d;if(r==="exclusive"&&c.length>0)d={current:void 0,rows:mt.empty(),columns:c};else{let u=g&&e==="mixed",p=g&&n==="mixed";d={current:u?t.current:void 0,rows:p?t.rows:mt.empty(),columns:c}}a(d,!1)},[r,t,e,n,a]);return[l,o,h]}function VE(t,a,e,r,n){let i=_8.useCallback(c=>{var v;if(t===!0){let g=[];for(let d=c.y;d=n?u.push({kind:l1.Loading,allowOverlay:!1}):u.push(a([p,d]));g.push(u)}return g}return(v=t?.(c,r.signal))!=null?v:[]},[r.signal,a,t,n]),l=t!==void 0?i:void 0,o=_8.useCallback(c=>{if(l===void 0)return[];let v={...c,x:c.x-e};if(v.x<0){v.x=0,v.width--;let g=l(v,r.signal);return typeof g=="function"?async()=>(await g()).map(d=>[{kind:l1.Loading,allowOverlay:!1},...d]):g.map(d=>[{kind:l1.Loading,allowOverlay:!1},...d])}return l(v,r.signal)},[r.signal,l,e]);return[t!==void 0?o:void 0,l]}function RE(t,a,e,r,n){var i,l;let o=t;if(r==="allowPartial"||t.current===void 0)return t;if(a!==void 0){let h=!1;do{if(t?.current===void 0)break;let c=(i=t.current)==null?void 0:i.range,v=[];if(c.width>2){let u=a({x:c.x,y:c.y,width:1,height:c.height},n.signal);if(typeof u=="function")return o;v.push(...u);let p=a({x:c.x+c.width-1,y:c.y,width:1,height:c.height},n.signal);if(typeof p=="function")return o;v.push(...p)}else{let u=a({x:c.x,y:c.y,width:c.width,height:c.height},n.signal);if(typeof u=="function")return o;v.push(...u)}let g=c.x-e,d=c.x+c.width-1-e;for(let u of v)for(let p of u)p.span!==void 0&&(g=Math.min(p.span[0],g),d=Math.max(p.span[1],d));g===c.x-e&&d===c.x+c.width-1-e?h=!0:t={current:{cell:(l=t.current.cell)!=null?l:[0,0],range:{x:g+e,y:c.y,width:d-g+1,height:c.height},rangeStack:t.current.rangeStack},columns:t.columns,rows:t.rows}}while(!h)}return t}function Wp(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function yE(t){var a;(function(o){o[o.None=0]="None",o[o.inString=1]="inString",o[o.inStringPostQuote=2]="inStringPostQuote"})(a||(a={}));let e=[],r=[],n=0,i=0;t=t.replace(/\r\n/g,`
+`},Sb={headerRowID:ab,headerNumber:rb,headerCode:eb,headerString:nb,headerBoolean:ib,headerAudioUri:ob,headerVideoUri:hb,headerEmoji:cb,headerImage:vb,headerUri:yz,headerPhone:gb,headerMarkdown:db,headerDate:sb,headerTime:ub,headerEmail:fb,headerReference:pb,headerIfThenElse:zb,headerSingleValue:mb,headerLookup:Mb,headerTextTemplate:Hb,headerMath:xb,headerRollup:wb,headerJoinStrings:Lb,headerSplitString:Vb,headerGeoDistance:Rb,headerArray:yb,rowOwnerOverlay:Cb,protectedColumnOverlay:Bb,renameIcon:lb};function Ab(t,a){return t==="normal"?[a.bgIconHeader,a.fgIconHeader]:t==="selected"?["white",a.accentColor]:[a.accentColor,a.bgHeader]}var Fb=class{constructor(t,a){this.onSettled=a,this.spriteMap=new Map,this.inFlight=0,this.headerIcons={...Sb,...t}}drawSprite(t,a,e,r,n,i,l,o=1){let[h,c]=Ab(a,l),v=i*Math.ceil(window.devicePixelRatio),g=`${h}_${c}_${v}_${t}`,d=this.spriteMap.get(g);if(d===void 0){let u=this.headerIcons[t];if(u===void 0)return;d=document.createElement("canvas");let p=d.getContext("2d");if(p===null)return;let z=new Image;z.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u({fgColor:c,bgColor:h}))}`,this.spriteMap.set(g,d);let w=z.decode();if(w===void 0)return;this.inFlight++,w.then(()=>{p.drawImage(z,0,0,v,v)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else o<1&&(e.globalAlpha=o),e.drawImage(d,0,0,v,v,r,n,i,i),o<1&&(e.globalAlpha=1)}},R8={},He=null;function kb(){let t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function k8(t){let a=t.toLowerCase().trim();if(R8[a]!==void 0)return R8[a];He=He||kb(),He.style.color="#000",He.style.color=a;let e=getComputedStyle(He).color;He.style.color="#fff",He.style.color=a;let r=getComputedStyle(He).color;if(r!==e)return[0,0,0,1];let n=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return n.length<4&&n.push(1),n=n.map(i=>{let l=Number.isNaN(i);return l&&console.warn("Could not parse color",t),l?0:i}),R8[a]=n,n}function fr(t,a){let[e,r,n]=k8(t);return`rgba(${e}, ${r}, ${n}, ${a})`}function Ve(t,a){if(a===void 0)return t;let[e,r,n,i]=k8(t);if(i===1)return t;let[l,o,h,c]=k8(a),v=i+c*(1-i),g=(i*e+c*l*(1-i))/v,d=(i*r+c*o*(1-i))/v,u=(i*n+c*h*(1-i))/v;return`rgba(${g}, ${d}, ${u}, ${v})`}var bb={kind:n1.Loading,allowOverlay:!1};function Sz(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s,f,m){let H,x;p!==void 0&&p[0][0]===r&&p[0][1]===a&&(H=p[1][0],x=p[1][1]);let y,R={ctx:t,theme:c,col:r,row:a,cell:e,rect:{x:n,y:i,width:l,height:o},highlighted:h,hoverAmount:u,hoverX:H,hoverY:x,imageLoader:g,spriteManager:d,hyperWrapping:z,requestAnimationFrame:()=>{L=!0}},L=!1;return(Uk(R,e.lastUpdated,w,s,()=>{var C,k;if(!(Le(e)?!1:v?.(R)===!0)){let F=m(e);if(F!==void 0){s?.renderer!==F&&((C=s?.deprep)==null||C.call(s,R),s=void 0);let _=(k=F.drawPrep)==null?void 0:k.call(F,R,s);F.draw(R,e),y={deprep:_?.deprep,fillStyle:_?.fillStyle,font:_?.font,renderer:F}}}})||L)&&f?.([r,a]),y}function Eb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w){let s=[],f=!1;t.imageSmoothingEnabled=!1;let m=Math.min(e.cellYOffset,n),H=Math.max(e.cellYOffset,n),x=0;if(typeof z=="number")x+=(H-m)*z;else for(let F=m;Fe.cellYOffset&&(x=-x),x+=l-e.translateY;let y=Math.min(e.cellXOffset,r),R=Math.max(e.cellXOffset,r),L=0;for(let F=y;Fe.cellXOffset&&(L=-L),L+=i-e.translateX;let V=ur(p);if(V>0&&V++,L!==0&&x!==0)return{regions:[],yOnly:!1};let C=o?typeof z=="number"?z:z(v-1):0,k=h-V-Math.abs(L),b=c-g-C-Math.abs(x)-1;if(k>150&&b>150){f=L===0;let F={sx:0,sy:0,sw:h*d,sh:c*d,dx:0,dy:0,dw:h*d,dh:c*d};x>0?(F.sy=(g+1)*d,F.sh=b*d,F.dy=(x+g+1)*d,F.dh=b*d,s.push({x:0,y:g,width:h,height:x+1})):x<0&&(F.sy=(-x+g+1)*d,F.sh=b*d,F.dy=(g+1)*d,F.dh=b*d,s.push({x:0,y:c+x-C,width:h,height:-x+C})),L>0?(F.sx=V*d,F.sw=k*d,F.dx=(L+V)*d,F.dw=k*d,s.push({x:V-1,y:0,width:L+2,height:c})):L<0&&(F.sx=(V-L)*d,F.sw=k*d,F.dx=V*d,F.dw=k*d,s.push({x:h+L,y:0,width:-L,height:c})),t.setTransform(1,0,0,1,0,0),V>0&&L!==0&&x===0&&w&&t.drawImage(a,0,0,V*d,c*d,0,0,V*d,c*d),t.drawImage(a,F.sx,F.sy,F.sw,F.sh,F.dx,F.dy,F.dw,F.dh),t.scale(d,d)}return t.imageSmoothingEnabled=!0,{regions:s,yOnly:f}}function _b(t,a,e,r,n,i,l,o,h,c){let v=[];return a!==t.cellXOffset||e!==t.cellYOffset||r!==t.translateX||n!==t.translateY||h4(h,e,r,n,o,(g,d,u,p)=>{if(g.sourceIndex===c){let z=Math.max(d,p)+1;return v.push({x:z,y:0,width:i-z,height:l}),!0}}),v}function Dp(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s=!1){var f,m,H;if(h!==void 0){t.beginPath(),t.save(),t.rect(0,0,i,l);for(let Z of h)t.rect(Z.x+1,Z.y+1,Z.width-1,Z.height-1);t.clip("evenodd")}let x=(f=w.horizontalBorderColor)!=null?f:w.borderColor,y=w.borderColor,R=0,L=i,V=0,C=l;if(o!==void 0&&o.length>0){R=Number.MAX_SAFE_INTEGER,V=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,C=Number.MIN_SAFE_INTEGER;for(let Z of o)R=Math.min(R,Z.x-1),L=Math.max(L,Z.x+Z.width+1),V=Math.min(V,Z.y-1),C=Math.max(C,Z.y+Z.height+1)}let k=[];t.beginPath();let b=.5;for(let Z=0;Z=R&&O<=L&&u(Z+1)&&k.push({x1:O,y1:Math.max(c,V),x2:O,y2:Math.min(l,C),color:y})}let F=g(z-1),_=l-F+.5,j=p==="sticky";if(j&&k.push({x1:R,y1:_,x2:L,y2:_,color:x}),s!==!0){let Z=v+.5,d1=e,O=j?l-F:l;for(;Z+n<=O;){let a1=Z+n;if(a1>=V&&a1<=C-1&&(!j||d1!==z-1||Math.abs(a1-_)>1)){let W=d?.(d1);k.push({x1:R,y1:a1,x2:L,y2:a1,color:(H=(m=W?.horizontalBorderColor)!=null?m:W?.borderColor)!=null?H:x})}Z+=g(d1),d1++}}let i1=(0,Bz.default)(k,Z=>Z.color);for(let Z of Object.keys(i1)){t.strokeStyle=Z;for(let d1 of i1[Z])t.moveTo(d1.x1,d1.y1),t.lineTo(d1.x2,d1.y2);t.stroke(),t.beginPath()}h!==void 0&&t.restore()}function Az(t,a){let e=[],r=t.x+t.width-26*a.length,n=t.y+t.height/2-13,i=26,l=26;for(let o=0;o=t.x&&a<=t.x+t.width&&e>=t.y&&e<=t.y+t.height}function Tb(t,a,e,r,n,i,l,o,h,c,v,g){var d;let[p,z]=(d=i?.[0])!=null?d:[],w=0;_z(a,e,r,n,(s,f,m,H,x,y)=>{var R,L;if(g!==void 0&&!g.some(F=>F[1]===-2&&F[0]>=s[0]&&F[0]<=s[1]))return;t.save(),t.beginPath(),t.rect(m,H,x,y),t.clip();let V=v(f),C=V?.overrideTheme===void 0?l:{...l,...V.overrideTheme},k=z===-2&&p!==void 0&&p>=s[0]&&p<=s[1],b=k?C.bgHeaderHovered:C.bgHeader;if(b!==l.bgHeader&&(t.fillStyle=b,t.fill()),t.fillStyle=(R=C.textGroupHeader)!=null?R:C.textHeader,V!==void 0){let F=m;if(V.icon!==void 0&&(o.drawSprite(V.icon,"normal",t,F+8,(n-20)/2,20,C),F+=26),t.fillText(V.name,F+8,n/2+$a(t,`${l.headerFontStyle} ${l.fontFamily}`)),V.actions!==void 0&&k){let _=Az({x:m,y:H,width:x,height:y},V.actions);t.beginPath();let j=_[0].x-10,i1=m+x-j;t.rect(j,0,i1,n);let Z=t.createLinearGradient(j,0,j+i1,0),d1=fr(b,0);Z.addColorStop(0,d1),Z.addColorStop(10/i1,b),Z.addColorStop(1,b),t.fillStyle=Z,t.fill(),t.globalAlpha=.6;let[O,a1]=(L=i?.[1])!=null?L:[-1,-1];for(let W=0;W35){let R=z?35:r-35,L=z?35*.7:r-35*.7,V=R/r,C=L/r,k=t.createLinearGradient(a,0,a+r,0),b=fr(f,0);k.addColorStop(z?1:0,f),k.addColorStop(V,f),k.addColorStop(C,b),k.addColorStop(z?0:1,b),t.fillStyle=k}else t.fillStyle=f;if(z&&(t.textAlign="right"),t.fillText(i.title,x,e+n/2+$a(t,`${o.headerFontStyle} ${o.fontFamily}`)),z&&(t.textAlign="left"),m&&i.hasMenu===!0){t.beginPath();let y=w.x+w.width/2-5.5,R=w.y+w.height/2-3;tb(t,[{x:y,y:R},{x:y+11,y:R},{x:y+5.5,y:R+6}],1),t.fillStyle=f,t.fill()}}function Pb(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s,f){var m;let H=l+o;if(H<=0)return;t.fillStyle=g.bgHeader,t.fillRect(0,0,n,H);let[x,y]=(m=r?.[0])!=null?m:[],R=`${g.headerFontStyle} ${g.fontFamily}`;t.font=R,h4(a,0,i,0,H,(L,V,C,k)=>{var b,F,_;if(w!==void 0&&!w.some(K1=>K1[1]===-1&&K1[0]===L.sourceIndex))return;let j=Math.max(0,k-V);t.save(),t.beginPath(),t.rect(V+j,o,L.width-j,l),t.clip();let i1=z((b=L.group)!=null?b:"").overrideTheme,Z=L.themeOverride===void 0&&i1===void 0?g:{...g,...i1,...L.themeOverride};Z.bgHeader!==g.bgHeader&&(t.fillStyle=Z.bgHeader,t.fill());let d1=`${Z.headerFontStyle} ${Z.fontFamily}`;R!==d1&&(t.font=d1);let O=v.columns.hasIndex(L.sourceIndex),a1=h!==void 0||c,W=!a1&&y===-1&&x===L.sourceIndex,L1=a1?0:(_=(F=u.find(K1=>K1.item[0]===L.sourceIndex&&K1.item[1]===-1))==null?void 0:F.hoverAmount)!=null?_:0,p1=v?.current!==void 0&&v.current.cell[0]===L.sourceIndex,o1=O?Z.accentColor:p1?Z.bgHeaderHasFocus:Z.bgHeader,H1=e?o:0,P1=L.sourceIndex===0?0:1;O?(t.fillStyle=o1,t.fillRect(V+P1,H1,L.width-P1,l)):(p1||L1>0)&&(t.beginPath(),t.rect(V+P1,H1,L.width-P1,l),p1&&(t.fillStyle=Z.bgHeaderHasFocus,t.fill()),L1>0&&(t.globalAlpha=L1,t.fillStyle=Z.bgHeaderHovered,t.fill(),t.globalAlpha=1)),bz(t,V,H1,L.width,l,L,O,Z,W,p1,L1,d,s,f),t.restore()}),e&&Tb(t,a,n,i,o,r,g,d,u,p,z,w)}function ye(t,a,e,r,n,i,l,o){return t<=n+l&&n<=t+e&&a<=i+o&&i<=a+r}function Np(t,a,e,r,n,i,l,o,h,c,v,g,d,u){if(d===void 0||d.length===0)return;let p=g==="sticky"?v(c-1):0;t.beginPath(),_z(a,e,l,n,(z,w,s,f,m,H)=>{for(let x=0;x=z[0]&&y[0]<=z[1]){t.rect(s,f,m,H);break}}}),h4(a,h,l,o,i,(z,w,s,f,m)=>{let H=Math.max(0,f-w),x=w+H+1,y=z.width-H-1;for(let R=0;R{let k=!1;for(let b=0;b0&&t.rect(x,b,y,_)}})}),t.clip()}function Ez(t,a,e,r,n,i,l){var o,h;let[c,v]=t,g,d,u=(h=(o=l.find(p=>!p.sticky))==null?void 0:o.sourceIndex)!=null?h:0;if(v>u){let p=Math.max(c,u),z=a,w=r;for(let s=i.sourceIndex-1;s>=p;s--)z-=l[s].width,w+=l[s].width;for(let s=i.sourceIndex+1;s<=v;s++)w+=l[s].width;d={x:z,y:e,width:w,height:n}}if(u>c){let p=Math.min(v,u-1),z=a,w=r;for(let s=i.sourceIndex-1;s>=c;s--)z-=l[s].width,w+=l[s].width;for(let s=i.sourceIndex+1;s<=p;s++)w+=l[s].width;g={x:z,y:e,width:w,height:n}}return[g,d]}function $p(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s,f,m,H,x,y,R,L,V,C,k,b,F,_){var j;let i1=(j=f?.length)!=null?j:Number.MAX_SAFE_INTEGER,Z=performance.now(),d1=`${b.baseFontStyle} ${b.fontFamily}`;t.font=d1;let O,a1=new Set;return h4(a,o,i,l,n,(W,L1,p1,o1,H1)=>{var P1;let K1=Math.max(0,o1-L1),W1=L1+K1,Bt=n+1,T1=W.width-K1,X1=r-n-1;if(s.length>0){let v1=!1;for(let D=0;D{t.save(),t.beginPath(),t.rect(W1,Bt,T1,X1),t.clip()},N=m.columns.hasIndex(W.sourceIndex),s1=g((P1=W.group)!=null?P1:"").overrideTheme,x1=W.themeOverride===void 0&&s1===void 0?b:{...b,...s1,...W.themeOverride},f1=`${x1.baseFontStyle} ${x1.fontFamily}`;f1!==d1&&(d1=f1,t.font=f1),Y();let U;return ai(H1,p1,r,h,c,w,(v1,D,I,C1,D1)=>{var et,B1,h1,e1;if(D<0)return;if(f!==void 0){let dt=!1;for(let At=0;At0){let dt=!1;for(let At=0;AtI1.span!==void 0&&dt>=I1.span[0]&&dt<=I1.span[1]);Mt&&!p&&z?C0=0:Mt&&(C0=Math.max(C0,1)),Z0&&C0++,Mt||(u1&&C0++,N&&!C1&&C0++);let B0=I1.kind===n1.Protected?J1.bgCellMedium:J1.bgCell,t0;if((C1||B0!==b.bgCell)&&(t0=Ve(B0,t0)),C0>0||M1){M1&&(t0=Ve(J1.bgHeader,t0));for(let dt=0;dtdt[0]===W.sourceIndex&&dt[1]===D)===!0&&(t0=Ve(J1.bgSearchResult,t0));if(x!==void 0)for(let dt of x){let At=dt.range;At.x<=W.sourceIndex&&W.sourceIndexdt.item[0]===W.sourceIndex&&dt.item[1]===D);if(St>10&&!Ut){let dt=`${J1.baseFontStyle} ${J1.fontFamily}`;dt!==d1&&(t.font=dt,d1=dt),U=Sz(t,D,I1,W.sourceIndex,Q1,v1,St,I,C0>0,J1,y,R,L,(h1=Ma?.hoverAmount)!=null?h1:0,C,k,Z,U,F,_)}return I1.style==="faded"&&(t.globalAlpha=1),i1--,jt&&(t.restore(),(e1=U?.deprep)==null||e1.call(U,{ctx:t}),U=void 0,Y(),d1=f1,t.font=f1),i1<=0}),t.restore(),i1<=0}),O}function Ib(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p,z,w,s){w!==void 0||a[a.length-1]!==e[a.length-1]||h4(a,h,l,o,i,(f,m,H,x,y)=>{if(f!==a[a.length-1])return;m+=f.width;let R=Math.max(m,x);R>r||(t.save(),t.beginPath(),t.rect(R,i+1,1e4,n-i-1),t.clip(),ai(y,H,n,c,v,p,(L,V,C,k)=>{if(!k&&z.length>0&&!z.some(i1=>ye(m,L,1e4,C,i1.x,i1.y,i1.width,i1.height)))return;let b=d.hasIndex(V),F=u.hasIndex(V);t.beginPath();let _=g?.(V),j=_===void 0?s:{...s,..._};j.bgCell!==s.bgCell&&(t.fillStyle=j.bgCell,t.fillRect(m,L,1e4,C)),F&&(t.fillStyle=j.bgHeader,t.fillRect(m,L,1e4,C)),b&&(t.fillStyle=j.accentLight,t.fillRect(m,L,1e4,C))}),t.restore())})}function Ob(t,a,e,r,n,i,l,o,h){var c;let v=!1;for(let p of a)if(!p.sticky){v=l(p.sourceIndex);break}let g=(c=h.horizontalBorderColor)!=null?c:h.borderColor,d=h.borderColor,u=v?ur(a):0;if(u!==0&&(t.beginPath(),t.moveTo(u+.5,0),t.lineTo(u+.5,r),t.strokeStyle=Ve(d,h.bgCell),t.stroke()),n){let p=o(i-1);t.beginPath(),t.moveTo(0,r-p+.5),t.lineTo(e,r-p+.5),t.strokeStyle=Ve(g,h.bgCell),t.stroke()}}function Db(t,a,e,r,n,i,l,o,h,c,v,g,d,u,p){let z=p?.filter(m=>m.style!=="no-outline");if(z===void 0||z.length===0)return;let w=z.map(m=>{var H,x,y,R,L;let V=m.range,C=Kn(V.x,V.y,a,e,v,c+v,r,n,i,l,u,h,d,o,g);if(V.width===1&&V.height===1)return V.x=h){let b=Kn(h-1,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g),F=Kn(h,V.y+V.height-1,a,e,v,c+v,r,n,i,l,u,h,d,o,g);return[{color:m.color,style:(y=m.style)!=null?y:"dashed",rect:{x:C.x,y:C.y,width:b.x+b.width-C.x,height:b.y+b.height-C.y}},{color:m.color,style:(R=m.style)!=null?R:"dashed",rect:{x:F.x,y:F.y,width:k.x+k.width-F.x,height:k.y+k.height-F.y}}]}else return[void 0,{color:m.color,style:(L=m.style)!=null?L:"dashed",rect:{x:C.x,y:C.y,width:k.x+k.width-C.x,height:k.y+k.height-C.y}}]}),s=ur(o),f=()=>{t.beginPath(),t.save();let m=!1,H=y=>{m!==y&&(t.setLineDash(y?[5,3]:[]),m=y)};t.lineWidth=1;for(let y of w){let[R]=y;R!==void 0&&ye(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(H(R.style==="dashed"),t.strokeStyle=fr(R.color,1),t.strokeRect(R.rect.x+1,R.rect.y+1,R.rect.width-2,R.rect.height-2))}let x=!1;for(let y of w){let[,R]=y;R!==void 0&&ye(0,0,a,e,R.rect.x,R.rect.y,R.rect.width,R.rect.height)&&(H(R.style==="dashed"),!x&&R.rect.x{var C;return V.sourceIndex===((C=v.current)==null?void 0:C.cell[0])}))return;let[s,f]=v.current.cell,m=d(v.current.cell),H=(w=m.span)!=null?w:[s,s],x=u==="sticky"&&f===z-1,y=u==="sticky"&&!x?g(z-1)-1:0,R;if(h4(l,r,n,i,c,(V,C,k,b,F)=>{if(!(V.sticky&&s>V.sourceIndex)&&!(V.sourceIndexH[1]))return ai(F,k,e,z,g,u,(_,j,i1)=>{if(j!==f)return;let Z=C,d1=V.width;if(m.span!==void 0){let O=Ez(m.span,C,_,V.width,i1,V,o),a1=V.sticky?O[0]:O[1];a1!==void 0&&(Z=a1.x,d1=a1.width)}return R=()=>{var O,a1,W,L1;b>Z&&!V.sticky&&(t.beginPath(),t.rect(b,0,a-b,e),t.clip()),t.beginPath(),t.rect(Z+.5,_+.5,d1,i1),t.strokeStyle=(a1=(O=V.themeOverride)==null?void 0:O.accentColor)!=null?a1:h.accentColor,t.lineWidth=1,t.stroke(),p&&(t.beginPath(),t.rect(Z+d1-4,_+i1-4,4,4),t.fillStyle=(L1=(W=V.themeOverride)==null?void 0:W.accentColor)!=null?L1:h.accentColor,t.fill())},!0}),!0}),R===void 0)return;let L=()=>{t.save(),t.beginPath(),t.rect(0,c,a,e-c-y),t.clip(),R?.(),t.restore()};return L(),L}function Nb(t,a,e,r,n,i,l,o,h){let c=0;return h4(t,i,r,n,e,(v,g,d,u,p)=>(ai(p,d,a,l,o,h,(z,w,s,f)=>{f||(c=Math.max(w,c))}),!0)),c}function $b(t,a){if(a===void 0||t.width!==a.width||t.height!==a.height||t.theme!==a.theme||t.headerHeight!==a.headerHeight||t.rowHeight!==a.rowHeight||t.rows!==a.rows||t.getRowThemeOverride!==a.getRowThemeOverride||t.isFocused!==a.isFocused||t.isResizing!==a.isResizing||t.verticalBorder!==a.verticalBorder||t.getCellContent!==a.getCellContent||t.highlightRegions!==a.highlightRegions||t.selection!==a.selection||t.dragAndDropState!==a.dragAndDropState||t.prelightCells!==a.prelightCells||t.touchMode!==a.touchMode||t.scrolling!==a.scrolling)return!1;if(t.mappedColumns!==a.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==a.mappedColumns.length)return!1;let e;for(let r=0;rx:x;D1.save(),D1.beginPath(),B1.save(),B1.beginPath(),D1.textBaseline="middle",B1.textBaseline="middle",x1!==1&&(D1.scale(x1,x1),B1.scale(x1,x1));let u1=A8(d,h,l,z,v),M1=[],I1=s&&((r=L.current)==null?void 0:r.cell[1])===c&&g===0,Q1=()=>{var ot,J1;Pb(D1,u1,u,o1,l,v,f,m,z,R,L,w,H1,L1,y,F,N,Z,K1),Dp(D1,u1,c,v,g,l,o,void 0,void 0,m,v1,e1,_,y,C,k,w,!0),D1.beginPath(),D1.moveTo(0,D-.5),D1.lineTo(l,D-.5),D1.strokeStyle=Ve((J1=(ot=w.headerBottomBorderColor)!=null?ot:w.horizontalBorderColor)!=null?J1:w.borderColor,w.bgHeader),D1.stroke(),I1&&y8(D1,l,o,c,v,g,u1,d,w,v1,L,e1,b,C,V,k)};if(N!==void 0){let ot=!1;N=N.filter(J1=>(ot=ot||J1[1]<0,J1[1]<0||ye(h,c,u1.length,300,J1[0],J1[1],1,1)||ye(0,c,p,300,J1[0],J1[1],1,1)||C&&ye(h,k-1,u1.length,1,J1[0],J1[1],1,1))),N.length>0&&(Np(B1,u1,l,o,m,v1,v,g,c,k,e1,C,N,!0),B1.fillStyle=w.bgCell,B1.fillRect(0,v1+1,l,o-v1-1),$p(B1,u1,d,o,v1,v,g,c,k,e1,b,F,_,H,j,s,C,M1,N,L,d1,O,i1,a1,H1,L1,o1,p1,w,W1,Bt),V&&s&&L.current!==void 0&&N.some(J1=>{var Jt,Mt;return J1[0]===((Jt=L.current)==null?void 0:Jt.cell[0])&&J1[1]===((Mt=L.current)==null?void 0:Mt.cell[1])})&&y8(B1,l,o,c,v,g,u1,d,w,v1,L,e1,b,C,V,k)),ot&&(Np(D1,u1,l,v1,m,v1,v,g,c,k,e1,C,N,!1),Q1()),B1.restore(),D1.restore(),C1!==null&&(C1.fillStyle=w.bgCell,C1.fillRect(0,0,l,o),C1.drawImage(B1.canvas,0,0));return}if((f1!==!0||h!==I?.cellXOffset||v!==I?.translateX||I1!==I?.mustDrawFocusOnHeader)&&Q1(),f1===!0){i2(h1!==void 0&&I!==void 0);let{regions:ot}=Eb(B1,h1,I,h,c,v,g,C==="sticky",l,o,k,v1,x1,d,u1,x,s1);M1=ot}else f1!==!1&&(i2(I!==void 0),M1=_b(I,h,c,v,g,l,o,v1,u1,f1));Ob(B1,u1,l,o,C==="sticky",k,y,e1,w);let St=s?y8(B1,l,o,c,v,g,u1,d,w,v1,L,e1,b,C,V,k):void 0,jt=Db(B1,l,o,h,c,v,g,d,p,f,m,x,C==="sticky",k,O);if(B1.fillStyle=w.bgCell,M1.length>0){B1.beginPath();for(let ot of M1)B1.rect(ot.x,ot.y,ot.width,ot.height);B1.clip(),B1.fill(),B1.beginPath()}else B1.fillRect(0,0,l,o);let Ut=$p(B1,u1,d,o,v1,v,g,c,k,e1,b,F,_,H,j,s,C,M1,N,L,d1,O,i1,a1,H1,L1,o1,p1,w,W1,Bt);Ib(B1,u1,d,l,o,v1,v,g,c,k,e1,_,L.rows,H,C,M1,N,w),Dp(B1,u1,c,v,g,l,o,M1,Ut,m,v1,e1,_,y,C,k,w),St?.(),jt?.(),C1!==null&&(C1.fillStyle=w.bgCell,C1.fillRect(0,0,l,o),C1.drawImage(B1.canvas,0,0));let Et=Nb(u1,o,v1,v,g,c,k,e1,C);a1?.setWindow({x:h,y:c,width:u1.length,height:Et-c},p),W.current={cellXOffset:h,cellYOffset:c,translateX:v,translateY:g,mustDrawFocusOnHeader:I1,lastBuffer:s1?et===X1?"a":"b":void 0},B1.restore(),D1.restore()}function ai(t,a,e,r,n,i,l){let o=a,h=t,c=i==="sticky";for(;o=e;v&&(c=!1,h=r-1);let g=n(h);if(v&&(o=e-g),!(c&&h===r-1)&&l(o,h,g,v,i!=="none"&&h===r-1)===!0||v)break;o+=g,h++}}function h4(t,a,e,r,n,i){let l=0,o=0,h=n+r;for(let c of t){let v=c.sticky?o:l+e;if(i(c,v,h,o,a)===!0)break;l+=c.width,o+=c.sticky?c.width:0}}function _z(t,a,e,r,n){var i;let l=0,o=0;for(let h=0;ha?.[0]===e?.[0]&&a?.[1]===e?.[1],this.addToLeavingItems=a=>{this.leavingItems.some(r=>this.areSameItems(r.item,a.item))||this.leavingItems.push(a)},this.removeFromLeavingItems=a=>{var e;let r=this.leavingItems.find(n=>this.areSameItems(n.item,a));return this.leavingItems=this.leavingItems.filter(n=>n!==r),(e=r?.hoverAmount)!=null?e:0},this.cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(a=>a.hoverAmount>0)},this.shouldStep=()=>{let a=this.leavingItems.length>0,e=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return a||e},this.getAnimatingItems=()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(a=>({...a,hoverAmount:Wb(a.hoverAmount)})),this.step=a=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=a;else{let r=(a-this.lastAnimationTime)/Ub;for(let i of this.leavingItems)i.hoverAmount=(0,b8.default)(i.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,b8.default)(this.currentHoveredItem.hoverAmount+r,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=a,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0},this.setHovered=a=>{var e;if(!this.areSameItems((e=this.currentHoveredItem)==null?void 0:e.item,a)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),a!==void 0){let r=this.removeFromLeavingItems(a);this.currentHoveredItem={item:a,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}}}},qb=class{constructor(t){this.fn=t}get value(){var t;return(t=this.val)!=null?t:this.val=this.fn()}};function W8(t){return new qb(t)}var Gb=W8(()=>window.navigator.userAgent.includes("Firefox")),Tz=W8(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),E5=W8(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function Kb(t,a){for(let e of t)if(e[0]===a[0]&&e[1]===a[1])return!0;return!1}function Xb(t){let a=l4.useRef([]),e=l4.useRef(0),r=l4.useRef(t);r.current=t;let n=l4.useCallback(()=>{let i=()=>window.requestAnimationFrame(l),l=()=>{let o=a.current;a.current=[],r.current(o),a.current.length>0?e.current++:e.current=0};window.requestAnimationFrame(e.current>600?i:l)},[]);return l4.useCallback(i=>{Kb(a.current,i)||(a.current.length===0&&n(),a.current.push(i))},[n])}var Yb=(t,a)=>{var e;if(t.kind===n1.Custom)return t.copyData;let r=a?.(t);return(e=r?.getAccessibilityString(t))!=null?e:""},Qb=(t,a)=>{var e,r,n,i,l,o,h,c;let{width:v,height:g,accessibilityHeight:d,columns:u,cellXOffset:p,cellYOffset:z,headerHeight:w,fillHandle:s=!1,groupHeaderHeight:f,rowHeight:m,rows:H,getCellContent:x,getRowThemeOverride:y,onHeaderMenuClick:R,enableGroups:L,isFilling:V,onCanvasFocused:C,onCanvasBlur:k,isFocused:b,selection:F,freezeColumns:_,onContextMenu:j,trailingRowType:i1,fixedShadowX:Z=!0,fixedShadowY:d1=!0,drawFocusRing:O=!0,onMouseDown:a1,onMouseUp:W,onMouseMoveRaw:L1,onMouseMove:p1,onItemHovered:o1,dragAndDropState:H1,firstColAccessible:P1,onKeyDown:K1,onKeyUp:W1,highlightRegions:Bt,canvasRef:T1,onDragStart:X1,onDragEnd:Y,eventTargetRef:N,isResizing:s1,isDragging:x1,isDraggable:f1=!1,allowResize:U,disabledRows:v1,getGroupDetails:D,theme:I,prelightCells:C1,headerIcons:D1,verticalBorder:et,drawHeader:B1,drawCustomCell:h1,onCellFocused:e1,onDragOverCell:u1,onDrop:M1,onDragLeave:I1,imageWindowLoader:Q1,smoothScrollX:St=!1,smoothScrollY:jt=!1,experimental:Ut,getCellRenderer:Et}=t,ot=(e=t.translateX)!=null?e:0,J1=(r=t.translateY)!=null?r:0,Jt=Math.max(_,Math.min(u.length-1,p)),Mt=r1.useRef(null),C0=r1.useMemo(()=>new yk,[]),Z0=Q1??C0,B0=r1.useRef(),[t0,Ma]=r1.useState(!1),dt=r1.useRef([]),At=r1.useRef(),[h0,wt]=r1.useState(),[Ft,qt]=r1.useState(),c2=r1.useRef(null),[v2,Ua]=r1.useState(!1),O2=r1.useRef(v2);O2.current=v2;let j0=r1.useMemo(()=>new Fb(D1,()=>{la.current=void 0,oa.current()}),[D1]),g2=L?f+w:w,D2=r1.useRef(-1),ri=Ut?.enableFirefoxRescaling!==!0;r1.useLayoutEffect(()=>{!Gb.value||window.devicePixelRatio===1||ri||(D2.current!==-1&&Ma(!0),window.clearTimeout(D2.current),D2.current=window.setTimeout(()=>{Ma(!1),D2.current=-1},200))},[z,Jt,ot,J1,ri]);let u0=Ek(u,_),Ht=r1.useCallback((S,G,b1)=>{let z1=S.getBoundingClientRect();if(G>=u0.length||b1>=H)return;let E1=z1.width/v,c1=Kn(G,b1,v,g,f,g2,Jt,z,ot,J1,H,_,i1==="sticky",u0,m);return E1!==1&&(c1.x*=E1,c1.y*=E1,c1.width*=E1,c1.height*=E1),c1.x+=z1.x,c1.y+=z1.y,c1},[v,g,f,g2,Jt,z,ot,J1,H,_,i1,u0,m]),m0=r1.useCallback((S,G,b1,z1)=>{var E1,c1;let $1=S.getBoundingClientRect(),st=$1.width/v,S1=(G-$1.left)/st,_1=(b1-$1.top)/st,a0=5,tt=A8(u0,Jt,v,void 0,ot),ut=0;z1 instanceof MouseEvent&&(ut=z1.button);let ht=Pk(S1,tt,ot),xt=Ik(_1,g,L,w,f,H,m,z,J1,i1==="sticky"),_t=z1?.shiftKey===!0,Ca=z1?.ctrlKey===!0,y2=z1?.metaKey===!0,C2=z1!==void 0&&!(z1 instanceof MouseEvent)||z1?.pointerType==="touch",N2=20,B2=[Math.abs(S1)v||_1>g){let G1=S1>v?-1:S1<0?1:0,Gt=_1>g?1:_1<0?-1:0,n0=!1;if(ht===-1&&xt===-1){let A0=Ht(S,u0.length-1,-1);i2(A0!==void 0),n0=G=0?(Gt=!0,G1=Ht(S,n0,xt),i2(G1!==void 0),u2={kind:L&&xt===-2?w2:we,location:[n0,xt],bounds:G1,group:(E1=u0[n0].group)!=null?E1:"",isEdge:Gt,shiftKey:_t,ctrlKey:Ca,metaKey:y2,isTouch:C2,localEventX:G-G1.x,localEventY:b1-G1.y,button:ut,scrollEdge:B2}):u2={kind:L&&xt===-2?w2:we,group:(c1=u0[ht].group)!=null?c1:"",location:[ht,xt],bounds:G1,isEdge:Gt,shiftKey:_t,ctrlKey:Ca,metaKey:y2,isTouch:C2,localEventX:G-G1.x,localEventY:b1-G1.y,button:ut,scrollEdge:B2}}else{let G1=Ht(S,ht,xt);i2(G1!==void 0);let Gt=G1!==void 0&&G1.x+G1.width-G{}),xr=r1.useRef(h0);xr.current=h0;let[Se,Ae]=r1.useMemo(()=>{let S=document.createElement("canvas"),G=document.createElement("canvas");return S.style.display="none",S.style.opacity="0",S.style.position="fixed",G.style.display="none",G.style.opacity="0",G.style.position="fixed",[S,G]},[]);r1.useLayoutEffect(()=>(document.documentElement.append(Se),document.documentElement.append(Ae),()=>{Se.remove(),Ae.remove()}),[Se,Ae]);let la=r1.useRef(),Ha=r1.useCallback(()=>{var S,G;let b1=Mt.current,z1=c2.current;if(b1===null||z1===null)return;let E1=la.current,c1={canvas:b1,bufferA:Se,bufferB:Ae,headerCanvas:z1,width:v,height:g,cellXOffset:Jt,cellYOffset:z,translateX:Math.round(ot),translateY:Math.round(J1),mappedColumns:u0,enableGroups:L,freezeColumns:_,dragAndDropState:H1,theme:I,headerHeight:w,groupHeaderHeight:f,disabledRows:v1??mt.empty(),rowHeight:m,verticalBorder:et,isResizing:s1,isFocused:b,selection:F,fillHandle:s,lastRowSticky:i1,rows:H,drawFocus:O,getCellContent:x,getGroupDetails:D??($1=>({name:$1})),getRowThemeOverride:y,drawCustomCell:h1,drawHeaderCallback:B1,prelightCells:C1,highlightRegions:Bt,imageLoader:Z0,lastBlitData:At,damage:B0.current,hoverValues:dt.current,hoverInfo:xr.current,spriteManager:j0,scrolling:t0,hyperWrapping:(S=Ut?.hyperWrapping)!=null?S:!1,touchMode:v2,enqueue:ni.current,renderStrategy:(G=Ut?.renderStrategy)!=null?G:Tz.value?"double-buffer":"single-buffer",getCellRenderer:Et};c1.damage===void 0?(la.current=c1,Up(c1,E1)):Up(c1,void 0)},[Se,Ae,v,g,Jt,z,ot,J1,u0,L,_,H1,I,w,f,v1,m,et,s1,b,F,s,i1,H,O,x,D,y,h1,B1,C1,Bt,Z0,j0,t0,Ut?.hyperWrapping,Ut?.renderStrategy,v2,Et]),oa=r1.useRef(Ha);r1.useLayoutEffect(()=>{Ha(),oa.current=Ha},[Ha]),r1.useLayoutEffect(()=>{(async()=>{var G;((G=document?.fonts)==null?void 0:G.ready)!==void 0&&(await document.fonts.ready,la.current=void 0,oa.current())})()},[]);let xa=r1.useCallback(S=>{B0.current=S,oa.current(),B0.current=void 0},[]),q5=Xb(xa);ni.current=q5;let ii=r1.useCallback(S=>{xa(S.map(G=>G.cell))},[xa]);Z0.setCallback(xa);let[G5,li]=r1.useState(!1),[c4,Fe]=ia??[],oi=c4!==void 0&&Fe===-1,wr=c4!==void 0&&Fe===-2,ke=!1,v4=!1,d2;if(c4!==void 0&&Fe!==void 0&&Fe>-1){let S=x([c4,Fe],!0);ke=S.kind===o2.NewRow||S.kind===o2.Marker&&S.markerKind!=="number",v4=S.kind===n1.Boolean&&S8(S),d2=S.cursor}let wa=x1?"grabbing":(Ft??!1)||s1?"col-resize":G5||V?"crosshair":d2!==void 0?d2:oi||ke||v4||wr?"pointer":"default",Wa=r1.useMemo(()=>({contain:"strict",display:"block",cursor:wa}),[wa]),hi=r1.useRef("default"),ci=N?.current;ci!=null&&hi.current!==Wa.cursor&&(ci.style.cursor=hi.current=Wa.cursor);let La=r1.useCallback((S,G,b1,z1)=>{if(D===void 0)return;let E1=D(S);if(E1.actions!==void 0){let c1=Az(G,E1.actions);for(let[$1,st]of c1.entries())if(Fz(st,b1+G.x,z1+st.y))return E1.actions[$1]}},[D]),ha=r1.useCallback((S,G,b1,z1)=>{let E1=u[G];if(!x1&&!s1&&E1.hasMenu===!0&&!(Ft??!1)){let c1=Ht(S,G,-1);i2(c1!==void 0);let $1=kz(c1.x,c1.y,c1.width,c1.height,N8(E1.title)==="rtl");if(b1>$1.x&&b1<$1.x+$1.width&&z1>$1.y&&z1<$1.y+$1.height)return c1}},[u,Ht,Ft,x1,s1]),M0=r1.useRef(0),Va=r1.useRef(),g4=r1.useRef(!1),Lr=r1.useCallback(S=>{let G=Mt.current,b1=N?.current;if(G===null||S.target!==G&&S.target!==b1)return;g4.current=!0;let z1,E1;if(S instanceof MouseEvent?(z1=S.clientX,E1=S.clientY):(z1=S.touches[0].clientX,E1=S.touches[0].clientY),S.target===b1&&b1!==null){let $1=b1.getBoundingClientRect();if(z1>$1.right||E1>$1.bottom)return}let c1=m0(G,z1,E1,S);Va.current=c1.location,c1.isTouch&&(M0.current=Date.now()),O2.current!==c1.isTouch&&Ua(c1.isTouch),!(c1.kind===we&&ha(G,c1.location[0],z1,E1)!==void 0)&&(c1.kind===w2&&La(c1.group,c1.bounds,c1.localEventX,c1.localEventY)!==void 0||(a1?.(c1),!c1.isTouch&&f1!==!0&&f1!==c1.kind&&S.preventDefault()))},[N,f1,m0,La,ha,a1]);W0("touchstart",Lr,window,!1),W0("mousedown",Lr,window,!1);let vi=r1.useCallback(S=>{var G,b1;let z1=Mt.current;if(g4.current=!1,W===void 0||z1===null)return;let E1=N?.current,c1=S.target!==z1&&S.target!==E1,$1,st;if(S instanceof MouseEvent){if($1=S.clientX,st=S.clientY,S.pointerType==="touch")return}else $1=S.changedTouches[0].clientX,st=S.changedTouches[0].clientY;let S1=m0(z1,$1,st,S);S1.isTouch&&M0.current!==0&&Date.now()-M0.current>500&&(S1={...S1,isLongTouch:!0}),O2.current!==S1.isTouch&&Ua(S1.isTouch),!c1&&S.cancelable&&S.preventDefault();let[_1]=S1.location,a0=ha(z1,_1,$1,st);if(S1.kind===we&&a0!==void 0){(S1.button!==0||((G=Va.current)==null?void 0:G[0])!==_1||((b1=Va.current)==null?void 0:b1[1])!==-1)&&W(S1,!0);return}else if(S1.kind===w2){let tt=La(S1.group,S1.bounds,S1.localEventX,S1.localEventY);if(tt!==void 0){S1.button===0&&tt.onClick(S1);return}}W(S1,c1)},[W,N,m0,ha,La]);W0("mouseup",vi,window,!1),W0("touchend",vi,window,!1);let K5=r1.useCallback(S=>{var G,b1;let z1=Mt.current;if(z1===null)return;let E1=N?.current,c1=S.target!==z1&&S.target!==E1,$1,st;S instanceof MouseEvent?($1=S.clientX,st=S.clientY):($1=S.changedTouches[0].clientX,st=S.changedTouches[0].clientY);let S1=m0(z1,$1,st,S);O2.current!==S1.isTouch&&Ua(S1.isTouch),!c1&&S.cancelable&&S.preventDefault();let[_1]=S1.location,a0=ha(z1,_1,$1,st);if(S1.kind===we&&a0!==void 0)S1.button===0&&((G=Va.current)==null?void 0:G[0])===_1&&((b1=Va.current)==null?void 0:b1[1])===-1&&R?.(_1,a0);else if(S1.kind===w2){let tt=La(S1.group,S1.bounds,S1.localEventX,S1.localEventY);tt!==void 0&&S1.button===0&&tt.onClick(S1)}},[N,m0,ha,R,La]);W0("click",K5,window,!1);let Lt=r1.useCallback(S=>{let G=Mt.current;if(G===null||j===void 0)return;let b1=m0(G,S.clientX,S.clientY,S);j(b1,()=>{S.cancelable&&S.preventDefault()})},[m0,j]);W0("contextmenu",Lt,(n=N?.current)!=null?n:null,!1);let ja=r1.useCallback(S=>{B0.current=S.map(G=>G.item),dt.current=S,oa.current(),B0.current=void 0},[]),s2=r1.useMemo(()=>new jb(ja),[ja]),P=r1.useRef(s2);P.current=s2,r1.useLayoutEffect(()=>{let S=P.current;if(ia===void 0||ia[1]<0){S.setHovered(ia);return}let G=x(ia),b1=Et(G);S.setHovered(b1===void 0&&G.kind===n1.Custom||b1?.needsHover===!0?ia:void 0)},[x,Et,ia]);let H0=r1.useRef(),V2=r1.useCallback(S=>{var G;let b1=Mt.current;if(b1===null)return;let z1=N?.current,E1=S.target!==b1&&S.target!==z1,c1=m0(b1,S.clientX,S.clientY,S);if(c1.kind!=="out-of-bounds"&&E1&&!g4.current&&!c1.isTouch)return;if(!j5(c1,H0.current))o1?.(c1),wt(c1.kind===O5?void 0:[c1.location,[c1.localEventX,c1.localEventY]]),H0.current=c1;else if(c1.kind==="cell"||c1.kind===we||c1.kind===w2){let st=[c1.location,[c1.localEventX,c1.localEventY]];if(wt(st),xr.current=st,c1.kind==="cell"){let S1=x(c1.location);(S1.kind===n1.Custom||((G=Et(S1))==null?void 0:G.needsHoverPosition)===!0)&&xa([c1.location])}else c1.kind===w2&&xa([c1.location])}let $1=c1.location[0]>=(P1?0:1);if(qt(c1.kind===we&&c1.isEdge&&$1&&U===!0),s&&F.current!==void 0){let[st,S1]=F.current.cell,_1=Ht(b1,st,S1),a0=S.clientX,tt=S.clientY;i2(_1!==void 0),li(a0>=_1.x+_1.width-6&&a0<=_1.x+_1.width&&tt>=_1.y+_1.height-6&&tt<=_1.y+_1.height)}else li(!1);L1?.(S),p1(c1)},[N,m0,P1,U,s,F,L1,p1,o1,x,Et,xa,Ht]);W0("mousemove",V2,window,!0);let X5=r1.useCallback(S=>{let G=Mt.current;if(G===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(G,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),K1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[K1,F,Ht]),gi=r1.useCallback(S=>{let G=Mt.current;if(G===null)return;let b1,z1;F.current!==void 0&&(b1=Ht(G,F.current.cell[0],F.current.cell[1]),z1=F.current.cell),W1?.({bounds:b1,stopPropagation:()=>S.stopPropagation(),preventDefault:()=>S.preventDefault(),cancel:()=>{},ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey,altKey:S.altKey,key:S.key,keyCode:S.keyCode,rawEvent:S,location:z1})},[W1,F,Ht]),Y5=r1.useCallback(S=>{Mt.current=S,T1!==void 0&&(T1.current=S)},[T1]),Q5=r1.useCallback(S=>{let G=Mt.current;if(G===null||f1===!1||s1){S.preventDefault();return}let b1,z1,E1=m0(G,S.clientX,S.clientY);if(f1!==!0&&E1.kind!==f1){S.preventDefault();return}let c1=(tt,ut)=>{b1=tt,z1=ut},$1,st,S1,_1=(tt,ut,ht)=>{$1=tt,st=ut,S1=ht},a0=!1;if(X1?.({...E1,setData:c1,setDragImage:_1,preventDefault:()=>a0=!0,defaultPrevented:()=>a0}),!a0&&b1!==void 0&&z1!==void 0&&S.dataTransfer!==null)if(S.dataTransfer.setData(b1,z1),S.dataTransfer.effectAllowed="copyLink",$1!==void 0&&st!==void 0&&S1!==void 0)S.dataTransfer.setDragImage($1,st,S1);else{let[tt,ut]=E1.location;if(ut!==void 0){let ht=document.createElement("canvas"),xt=Ht(G,tt,ut);i2(xt!==void 0),ht.width=xt.width,ht.height=xt.height;let _t=ht.getContext("2d");_t!==null&&(_t.textBaseline="middle",ut===-1?(_t.font=`${I.headerFontStyle} ${I.fontFamily}`,_t.fillStyle=I.bgHeader,_t.fillRect(0,0,ht.width,ht.height),bz(_t,0,0,xt.width,xt.height,u0[tt],!1,I,!1,!1,0,j0,B1,!1)):(_t.font=`${I.baseFontStyle} ${I.fontFamily}`,_t.fillStyle=I.bgCell,_t.fillRect(0,0,ht.width,ht.height),Sz(_t,ut,x([tt,ut]),0,0,0,xt.width,xt.height,!1,I,h1,Z0,j0,1,void 0,!1,0,void 0,void 0,Et))),ht.style.left="-100%",ht.style.position="absolute",document.body.append(ht),S.dataTransfer.setDragImage(ht,xt.width/2,xt.height/2),window.setTimeout(()=>{ht.remove()},0)}}else S.preventDefault()},[f1,s1,m0,X1,Ht,I,u0,j0,B1,x,h1,Z0,Et]);W0("dragstart",Q5,(i=N?.current)!=null?i:null,!1,!1);let d4=r1.useRef(),q=r1.useCallback(S=>{var G;let b1=Mt.current;if(M1!==void 0&&S.preventDefault(),b1===null||u1===void 0)return;let z1=m0(b1,S.clientX,S.clientY),[E1,c1]=z1.location,$1=E1-(P1?0:1),[st,S1]=(G=d4.current)!=null?G:[];(st!==$1||S1!==c1)&&(d4.current=[$1,c1],u1([$1,c1],S.dataTransfer))},[P1,m0,u1,M1]);W0("dragover",q,(l=N?.current)!=null?l:null,!1,!1);let R2=r1.useCallback(()=>{d4.current=void 0,Y?.()},[Y]);W0("dragend",R2,(o=N?.current)!=null?o:null,!1,!1);let P0=r1.useCallback(S=>{let G=Mt.current;if(G===null||M1===void 0)return;S.preventDefault();let b1=m0(G,S.clientX,S.clientY),[z1,E1]=b1.location,c1=z1-(P1?0:1);M1([c1,E1],S.dataTransfer)},[P1,m0,M1]);W0("drop",P0,(h=N?.current)!=null?h:null,!1,!1);let Z5=r1.useCallback(()=>{I1?.()},[I1]);W0("dragleave",Z5,(c=N?.current)!=null?c:null,!1,!1);let di=r1.useRef(F);di.current=F;let Ra=r1.useRef(null),J0=r1.useCallback(S=>{var G;Mt.current===null||!Mt.current.contains(document.activeElement)||(S===null&&di.current.current!==void 0?(G=T1?.current)==null||G.focus({preventScroll:!0}):S!==null&&S.focus({preventScroll:!0}),Ra.current=S)},[T1]);r1.useImperativeHandle(a,()=>({focus:()=>{var S;let G=Ra.current;G===null||!document.contains(G)?(S=T1?.current)==null||S.focus({preventScroll:!0}):G.focus({preventScroll:!0})},getBounds:(S,G)=>{if(!(T1===void 0||T1.current===null))return Ht(T1.current,S,G??-1)},damage:ii}),[T1,ii,Ht]);let ya=r1.useRef(),J5=Sk(()=>{var S,G,b1,z1;if(v<50)return null;let E1=A8(u0,Jt,v,H1,ot),c1=P1?0:-1;!P1&&((S=E1[0])==null?void 0:S.sourceIndex)===0&&(E1=E1.slice(1));let[$1,st]=(b1=(G=F.current)==null?void 0:G.cell)!=null?b1:[],S1=(z1=F.current)==null?void 0:z1.range,_1=E1.map(tt=>tt.sourceIndex),a0=(0,Cz.default)(z,Math.min(H,z+d));return $1!==void 0&&st!==void 0&&!(_1.includes($1)&&a0.includes(st))&&J0(null),r1.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":H+1,"aria-multiselectable":"true","aria-colcount":u0.length+c1},r1.createElement("thead",{role:"rowgroup"},r1.createElement("tr",{role:"row","aria-rowindex":1},E1.map(tt=>r1.createElement("th",{role:"columnheader","aria-selected":F.columns.hasIndex(tt.sourceIndex),"aria-colindex":tt.sourceIndex+1+c1,tabIndex:-1,onFocus:ut=>{if(ut.target!==Ra.current)return e1?.([tt.sourceIndex,-1])},key:tt.sourceIndex},tt.title)))),r1.createElement("tbody",{role:"rowgroup"},a0.map(tt=>r1.createElement("tr",{role:"row","aria-selected":F.rows.hasIndex(tt),key:tt,"aria-rowindex":tt+2},E1.map(ut=>{let ht=ut.sourceIndex,xt=`${ht},${tt}`,_t=$1===ht&&st===tt,Ca=S1!==void 0&&ht>=S1.x&&ht=S1.y&&tt{let B2=T1?.current;if(B2!=null)return K1?.({bounds:Ht(B2,ht,tt),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:C2})},onFocusCapture:B2=>{var u2,G1;if(!(B2.target===Ra.current||((u2=ya.current)==null?void 0:u2[0])===ht&&((G1=ya.current)==null?void 0:G1[1])===tt))return ya.current=C2,e1?.(C2)},ref:_t?J0:void 0,tabIndex:-1},Yb(N2,Et))})))))},[v,u0,Jt,H1,ot,H,z,d,F,J0,x,T1,K1,Ht,e1],200),Vr=Z?ur(u0,H1):0,s4=_===0||!Z?0:Jt>_?1:(0,F8.default)(-ot/100,0,1),Rr=-z*32+J1,c0=d1?(0,F8.default)(-Rr/100,0,1):0,S0=r1.useMemo(()=>{if(!s4&&!c0)return null;let S={position:"absolute",top:0,left:Vr,width:v-Vr,height:g,opacity:s4,pointerEvents:"none",transition:St?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},G={position:"absolute",top:g2,left:0,width:v,height:g,opacity:c0,pointerEvents:"none",transition:jt?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return r1.createElement(r1.Fragment,null,s4>0&&r1.createElement("div",{id:"shadow-x",style:S}),c0>0&&r1.createElement("div",{id:"shadow-y",style:G}))},[s4,c0,Vr,v,St,g2,g,jt]),v0=r1.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return r1.createElement(r1.Fragment,null,r1.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:X5,onKeyUp:gi,onFocus:C,onBlur:k,ref:Y5,style:Wa},J5),r1.createElement("canvas",{ref:c2,style:v0}),S0)},Zb=r1.memo(r1.forwardRef(Qb));function qn(t,a,e,r){var n;return(0,dz.default)(Math.round(a-((n=t.growOffset)!=null?n:0)),Math.ceil(e),Math.floor(r))}var Jb=t=>{var a;let[e,r]=It.useState(),[n,i]=It.useState(),[l,o]=It.useState(),[h,c]=It.useState(),[v,g]=It.useState(!1),[d,u]=It.useState(),[p,z]=It.useState(),[w,s]=It.useState(),[f,m]=It.useState(!1),[H,x]=It.useState(),{onHeaderMenuClick:y,getCellContent:R,onColumnMoved:L,onColumnResize:V,onColumnResizeStart:C,onColumnResizeEnd:k,gridRef:b,maxColumnWidth:F,minColumnWidth:_,onRowMoved:j,lockColumns:i1,onMouseDown:Z,onMouseUp:d1,onItemHovered:O,onDragStart:a1,canvasRef:W}=t,L1=((a=V??k)!=null?a:C)!==void 0,{columns:p1,selection:o1}=t,H1=o1.columns,P1=It.useCallback(U=>{let[v1,D]=U.location;l!==void 0&&h!==v1&&v1>=i1?(g(!0),c(v1)):p!==void 0&&D!==void 0?(m(!0),s(Math.max(0,D))):O?.(U)},[l,p,h,O,i1]),K1=L!==void 0,W1=It.useCallback(U=>{var v1,D;if(U.button===0){let[I,C1]=U.location;if(U.kind==="out-of-bounds"&&U.isEdge&&L1){let D1=(v1=b?.current)==null?void 0:v1.getBounds(p1.length-1,-1);D1!==void 0&&(r(D1.x),i(p1.length-1))}else if(U.kind==="header"&&I>=i1){let D1=W?.current;if(U.isEdge&&L1&&D1){r(U.bounds.x),i(I);let B1=D1.getBoundingClientRect().width/D1.offsetWidth,h1=U.bounds.width/B1;C?.(p1[I],h1,I,h1+((D=p1[I].growOffset)!=null?D:0))}else U.kind==="header"&&K1&&(u(U.bounds.x),o(I))}else U.kind==="cell"&&i1>0&&I===0&&C1!==void 0&&j!==void 0&&(x(U.bounds.y),z(C1))}Z?.(U)},[Z,L1,i1,j,b,p1,K1,C,W]),Bt=It.useCallback((U,v1)=>{v||f||y?.(U,v1)},[v,f,y]),T1=It.useRef(-1),X1=It.useCallback(()=>{T1.current=-1,z(void 0),s(void 0),x(void 0),m(!1),o(void 0),c(void 0),u(void 0),g(!1),i(void 0),r(void 0)},[]),Y=It.useCallback((U,v1)=>{var D,I,C1;if(U.button===0){if(n!==void 0){if(H1?.hasIndex(n)===!0)for(let et of H1){if(et===n)continue;let B1=p1[et],h1=qn(B1,T1.current,_,F);V?.(B1,h1,et,h1+((D=B1.growOffset)!=null?D:0))}let D1=qn(p1[n],T1.current,_,F);if(k?.(p1[n],D1,n,D1+((I=p1[n].growOffset)!=null?I:0)),H1.hasIndex(n))for(let et of H1){if(et===n)continue;let B1=p1[et],h1=qn(B1,T1.current,_,F);k?.(B1,h1,et,h1+((C1=B1.growOffset)!=null?C1:0))}}X1(),l!==void 0&&h!==void 0&&L?.(l,h),p!==void 0&&w!==void 0&&j?.(p,w)}d1?.(U,v1)},[d1,n,l,h,p,w,H1,k,p1,_,F,V,L,j,X1]),N=It.useMemo(()=>{if(!(l===void 0||h===void 0)&&l!==h)return{src:l,dest:h}},[l,h]),s1=It.useCallback(U=>{var v1,D;let I=W?.current;if(l!==void 0&&d!==void 0)Math.abs(U.clientX-d)>20&&g(!0);else if(p!==void 0&&H!==void 0)Math.abs(U.clientY-H)>20&&m(!0);else if(n!==void 0&&e!==void 0&&I){let D1=I.getBoundingClientRect().width/I.offsetWidth,et=(U.clientX-e)/D1,B1=p1[n],h1=qn(B1,et,_,F);if(V?.(B1,h1,n,h1+((v1=B1.growOffset)!=null?v1:0)),T1.current=et,H1?.first()===n)for(let e1 of H1){if(e1===n)continue;let u1=p1[e1],M1=qn(u1,T1.current,_,F);V?.(u1,M1,e1,M1+((D=u1.growOffset)!=null?D:0))}}},[l,d,p,H,n,e,p1,_,F,V,H1,W]),x1=It.useCallback((U,v1)=>{if(p===void 0||w===void 0)return R(U,v1);let[D,I]=U;return I===w?I=p:(I>w&&(I-=1),I>=p&&(I+=1)),R([D,I],v1)},[p,w,R]),f1=It.useCallback(U=>{a1?.(U),U.defaultPrevented()||X1()},[X1,a1]);return It.createElement(Zb,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:x1,isResizing:n!==void 0,onHeaderMenuClick:Bt,isDragging:v,onItemHovered:P1,onDragStart:f1,onMouseDown:W1,allowResize:L1,onMouseUp:Y,dragAndDropState:N,onMouseMoveRaw:s1,ref:b})},tE=Jb;function aE(t){let a=(0,zr.useRef)(null),[e,r]=(0,zr.useState)({width:t?.[0],height:t?.[1]});return(0,zr.useLayoutEffect)(()=>{let n=l=>{for(let o of l){let{width:h,height:c}=o&&o.contentRect||{};r(v=>v.width===h&&v.height===c?v:{width:h,height:c})}},i=new window.ResizeObserver(n);return a.current&&i.observe(a.current,void 0),()=>{i.disconnect()}},[a.current]),{ref:a,...e}}var eE=()=>t=>t.isSafari?"scroll":"auto",rE=L0("div")({name:"ScrollRegionStyle",class:"s1jz82f8",vars:{"s1jz82f8-0":[eE()]}});function C8(t){t.stopPropagation()}function nE(t){let[a,e]=lt.useState(!1),r=lt.useRef(0);return W0("touchstart",lt.useCallback(()=>{window.clearTimeout(r.current),e(!0)},[]),window,!0,!1),W0("touchend",lt.useCallback(n=>{n.touches.length===0&&(r.current=window.setTimeout(()=>e(!1),t))},[t]),window,!0,!1),a}var iE=t=>{var a,e,r,n;let{children:i,clientHeight:l,scrollHeight:o,scrollWidth:h,update:c,draggable:v,className:g,preventDiagonalScrolling:d=!1,paddingBottom:u=0,paddingRight:p=0,rightElement:z,rightElementProps:w,scrollRef:s,scrollToEnd:f,initialSize:m,minimap:H}=t,x=[],y=(a=w?.sticky)!=null?a:!1,R=(e=w?.fill)!=null?e:!1,L=lt.useRef(0),V=lt.useRef(0),C=lt.useRef(null),k=window.devicePixelRatio;lt.useEffect(()=>{let W1=C.current;W1===null||f!==!0||(W1.scrollLeft=W1.scrollWidth-W1.clientWidth)},[f]);let b=lt.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),F=lt.useRef(null),_=nE(200),[j,i1]=lt.useState(!0),Z=lt.useRef(0);lt.useEffect(()=>{if(!j||_||b.current.lockDirection===void 0)return;let W1=C.current;if(W1===null)return;let[Bt,T1]=b.current.lockDirection;Bt!==void 0?W1.scrollLeft=Bt:T1!==void 0&&(W1.scrollTop=T1),b.current.lockDirection=void 0},[_,j]);let d1=lt.useCallback(()=>{var W1,Bt,T1,X1;let Y=C.current;if(Y===null)return;let N=Y.scrollTop,s1=Y.scrollLeft,x1=b.current.scrollTop,f1=b.current.scrollLeft,U=s1-f1,v1=N-x1;_&&U!==0&&v1!==0&&(Math.abs(U)>3||Math.abs(v1)>3)&&d&&b.current.lockDirection===void 0&&(b.current.lockDirection=Math.abs(U)0&&(Math.abs(C1)>2e3||I===0||I===D1)&&o>Y.scrollHeight+5){let et=I/D1,B1=(o-Y.clientHeight)*et;L.current=B1-I}D!==void 0&&(window.clearTimeout(Z.current),i1(!1),Z.current=window.setTimeout(()=>i1(!0),200)),c({x:s1,y:I+L.current,width:Y.clientWidth-p,height:Y.clientHeight-u,paddingRight:(X1=(T1=F.current)==null?void 0:T1.clientWidth)!=null?X1:0})},[u,p,o,c,d,_]),O=lt.useRef(d1);O.current=d1;let a1=lt.useRef(),W=lt.useRef(!1);lt.useEffect(()=>{W.current?d1():W.current=!0},[d1,u,p]);let L1=lt.useCallback(W1=>{C.current=W1,s!==void 0&&(s.current=W1)},[s]),p1=0,o1=0;for(x.push(lt.createElement("div",{key:p1++,style:{width:h,height:0}}));o1O.current(),0),a1.current={width:P1,height:K1}),(P1??0)===0||(K1??0)===0?lt.createElement("div",{ref:H1}):lt.createElement("div",{ref:H1},lt.createElement(rE,{isSafari:Tz.value},H,lt.createElement("div",{className:"dvn-underlay"},i),lt.createElement("div",{ref:L1,style:a1.current,draggable:v,onDragStart:W1=>{v||(W1.stopPropagation(),W1.preventDefault())},className:"dvn-scroller "+(g??""),onScroll:d1},lt.createElement("div",{className:"dvn-scroll-inner"+(z===void 0?" hidden":"")},lt.createElement("div",{className:"dvn-stack"},x),z!==void 0&<.createElement(lt.Fragment,null,!R&<.createElement("div",{className:"dvn-spacer"}),lt.createElement("div",{ref:F,onMouseDown:C8,onMouseUp:C8,onMouseMove:C8,style:{height:K1,maxHeight:l-Math.ceil(k%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:p,flexGrow:R?1:void 0,right:y?p??0:void 0,pointerEvents:"auto"}},z))))))},lE=L0("div")({name:"MinimapStyle",class:"m15w2ly5"}),oE=t=>{var a,e,r;let{columns:n,rows:i,rowHeight:l,headerHeight:o,groupHeaderHeight:h,enableGroups:c,freezeColumns:v,experimental:g,clientSize:d,className:u,onVisibleRegionChanged:p,scrollToEnd:z,scrollRef:w,preventDiagonalScrolling:s,rightElement:f,rightElementProps:m,overscrollX:H,overscrollY:x,showMinimap:y=!1,initialSize:R,smoothScrollX:L=!1,smoothScrollY:V=!1,isDraggable:C}=t,{paddingRight:k,paddingBottom:b}=g??{},[F,_]=d,j=d0.useRef(),i1=d0.useRef(),Z=d0.useRef(),d1=d0.useRef(),O=d0.useMemo(()=>{let f1=Math.max(0,H??0);for(let U of n)f1+=U.width;return f1},[n,H]),a1=c?o+h:o;if(typeof l=="number")a1+=i*l;else for(let f1=0;f1{var f1,U,v1;if(W.current===void 0)return;let D={...W.current},I=0,C1=D.x<0?-D.x:0,D1=0,et=0;D.x=D.x<0?0:D.x;let B1=0;for(let Q1=0;Q1=St+Q1.width)I+=Q1.width,et++,D1++;else if(D.x>St)I+=Q1.width,L?C1+=St-D.x:et++,D1++;else if(D.x+D.width>St)I+=Q1.width,D1++;else break}let h1=0,e1=0,u1=0;if(typeof l=="number")V?(e1=Math.floor(D.y/l),h1=e1*l-D.y):e1=Math.ceil(D.y/l),u1=Math.ceil(D.height/l)+e1,h1<0&&u1++;else{let Q1=0;for(let St=0;St=Q1+jt)Q1+=jt,e1++,u1++;else if(D.y>Ut)Q1+=jt,V?h1+=Ut-D.y:e1++,u1++;else if(D.y+D.height>jt/2+Q1)Q1+=jt,u1++;else break}}let M1={x:et,y:e1,width:D1-et,height:u1-e1},I1=j.current;(I1===void 0||I1.y!==M1.y||I1.x!==M1.x||I1.height!==M1.height||I1.width!==M1.width||i1.current!==C1||Z.current!==h1||D.width!==((f1=d1.current)==null?void 0:f1[0])||D.height!==((U=d1.current)==null?void 0:U[1]))&&(p?.({x:et,y:e1,width:D1-et,height:u1-e1},D.width,D.height,(v1=D.paddingRight)!=null?v1:0,C1,h1),j.current=M1,i1.current=C1,Z.current=h1,d1.current=[D.width,D.height])},[n,l,i,p,v,L,V]),p1=d0.useCallback(f1=>{W.current=f1,L1()},[L1]);d0.useEffect(()=>{L1()},[L1]);let o1=(a=w?.current)!=null?a:void 0,H1=(0,Pz.default)(O/a1,2/3,1.5),P1=200,K1=H1>1?P1:Math.ceil(P1*H1),W1=H1>1?Math.ceil(P1/H1):P1,Bt=K1/O,T1=W1/a1,X1=Math.min(F*Math.max(Bt,.01),K1),Y=Math.min(_*Math.max(T1,.01),W1),N=((e=o1?.scrollLeft)!=null?e:0)/(O-F)*(K1-X1),s1=((r=o1?.scrollTop)!=null?r:0)/(a1-_)*(W1-Y),x1=d0.useMemo(()=>{if(!y||X1===0||Y===0)return;let f1=U=>{if(o1===void 0)return;let v1=U.currentTarget.getBoundingClientRect(),D=U.clientX-v1.x-X1/2,I=U.clientY-v1.y-Y/2,C1=(O-o1.clientWidth)*(D/(K1-X1)),D1=(a1-o1.clientHeight)*(I/(W1-Y));o1.scrollTo({left:C1,top:D1,behavior:U.type==="mousemove"?"auto":"smooth"})};return d0.createElement(lE,{style:{width:K1,height:W1},"data-testid":"minimap-container",onMouseMove:U=>{U.buttons===1&&f1(U)},onClick:f1},d0.createElement("div",{className:"header"}),d0.createElement("div",{className:"locationMarker",onDragStart:U=>U.preventDefault(),style:{left:N,top:s1,width:X1,height:Y,borderRadius:Math.min(X1,Y*.2,9)}}))},[W1,a1,N,o1,y,s1,Y,X1,K1,O]);return d0.createElement(iE,{scrollRef:w,minimap:x1,className:u,preventDiagonalScrolling:s,draggable:C===!0||typeof C=="string",scrollWidth:O+(k??0),scrollHeight:a1+(b??0),clientHeight:_,rightElement:f,paddingBottom:b,paddingRight:k,rightElementProps:m,update:p1,initialSize:R,scrollToEnd:z},d0.createElement(tE,{eventTargetRef:w,width:F,height:_,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},hE=oE,cE=()=>t=>t.showSearch?0:400,vE=L0("div")({name:"SearchWrapper",class:"sxep88s",vars:{"sxep88s-0":[cE(),"px"]}}),gE=q1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},q1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),dE=q1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},q1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),sE=q1.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},q1.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),uE=10,fE=t=>{let{canvasRef:a,cellYOffset:e,rows:r,columns:n,searchInputRef:i,searchValue:l,searchResults:o,onSearchValueChange:h,getCellsForSelection:c,onSearchResultsChanged:v,showSearch:g=!1,onSearchClose:d}=t,[u]=q1.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,z]=q1.useState(""),w=l??p,s=q1.useCallback(O=>{z(O),h?.(O)},[h]),[f,m]=q1.useState(),H=q1.useRef(f);H.current=f,q1.useEffect(()=>{o!==void 0&&(o.length>0?m(O=>{var a1;return{rowsSearched:r,results:o.length,selectedIndex:(a1=O?.selectedIndex)!=null?a1:-1}}):m(void 0))},[r,o]);let x=q1.useRef(new AbortController),y=q1.useRef(),[R,L]=q1.useState([]),V=o??R,C=q1.useCallback(()=>{y.current!==void 0&&(window.cancelAnimationFrame(y.current),y.current=void 0,x.current.abort())},[]),k=q1.useRef(e);k.current=e;let b=q1.useCallback(O=>{let a1=new RegExp(O.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i"),W=k.current,L1=Math.min(10,r),p1=0;m(void 0),L([]);let o1=[],H1=async()=>{var P1,K1;if(c===void 0)return;let W1=performance.now(),Bt=r-p1,T1=c({x:0,y:W,width:n.length,height:Math.min(L1,Bt,r-W)},x.current.signal);typeof T1=="function"&&(T1=await T1());let X1=!1;for(let[U,v1]of T1.entries())for(let[D,I]of v1.entries()){let C1;switch(I.kind){case n1.Text:case n1.Number:C1=I.displayData;break;case n1.Uri:case n1.Markdown:C1=I.data;break;case n1.Boolean:C1=typeof I.data=="boolean"?I.data.toString():void 0;break;case n1.Image:case n1.Bubble:C1=I.data.join("\u{1F433}");break;case n1.Custom:C1=I.copyData;break}C1!==void 0&&a1.test(C1)&&(o1.push([D,U+W]),X1=!0)}let Y=performance.now();X1&&L([...o1]),p1+=T1.length,i2(p1<=r);let N=(K1=(P1=H.current)==null?void 0:P1.selectedIndex)!=null?K1:-1;m({results:o1.length,rowsSearched:p1,selectedIndex:N}),v?.(o1,N),W+L1>=r?W=0:W+=L1;let s1=Y-W1,x1=Math.max(s1,1),f1=uE/x1;L1=Math.ceil(L1*f1),p1{var O;d?.(),m(void 0),L([]),v?.([],-1),C(),(O=a?.current)==null||O.focus()},[C,a,d,v]),_=q1.useCallback(O=>{s(O.target.value),o===void 0&&(O.target.value===""?(m(void 0),L([]),C()):b(O.target.value))},[b,C,s,o]);q1.useEffect(()=>{g&&i.current!==null&&(s(""),i.current.focus({preventScroll:!0}))},[g,i,s]);let j=q1.useCallback(O=>{var a1;if((a1=O?.stopPropagation)==null||a1.call(O),f===void 0)return;let W=(f.selectedIndex+1)%f.results;m({...f,selectedIndex:W}),v?.(V,W)},[f,v,V]),i1=q1.useCallback(O=>{var a1;if((a1=O?.stopPropagation)==null||a1.call(O),f===void 0)return;let W=(f.selectedIndex-1)%f.results;W<0&&(W+=f.results),m({...f,selectedIndex:W}),v?.(V,W)},[v,V,f]),Z=q1.useCallback(O=>{(O.ctrlKey||O.metaKey)&&O.nativeEvent.code==="KeyF"||O.key==="Escape"?(F(),O.stopPropagation(),O.preventDefault()):O.key==="Enter"&&(O.shiftKey?i1():j())},[F,j,i1]);q1.useEffect(()=>()=>{C()},[C]);let d1=q1.useMemo(()=>{var O,a1,W;let L1;f!==void 0&&(L1=f.results>=1e3?"over 1000":`${f.results} result${f.results!==1?"s":""}`,f.selectedIndex>=0&&(L1=`${f.selectedIndex+1} of ${L1}`));let p1=P1=>{P1.stopPropagation()},H1={width:`${Math.floor(((O=f?.rowsSearched)!=null?O:0)/r*100)}%`};return q1.createElement(vE,{showSearch:g,onMouseDown:p1,onMouseMove:p1,onMouseUp:p1,onClick:p1},q1.createElement("div",{className:"search-bar-inner"},q1.createElement("input",{id:u,"aria-hidden":!g,"data-testid":"search-input",ref:i,onChange:_,value:w,tabIndex:g?void 0:-1,onKeyDownCapture:Z}),q1.createElement("button",{"aria-label":"Previous Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:i1,disabled:((a1=f?.results)!=null?a1:0)===0},gE),q1.createElement("button",{"aria-label":"Next Result","aria-hidden":!g,tabIndex:g?void 0:-1,onClick:j,disabled:((W=f?.results)!=null?W:0)===0},dE),d!==void 0&&q1.createElement("button",{"aria-label":"Close Search","aria-hidden":!g,"data-testid":"search-close-button",tabIndex:g?void 0:-1,onClick:F},sE)),f!==void 0?q1.createElement(q1.Fragment,null,q1.createElement("div",{className:"search-status"},q1.createElement("div",{"data-testid":"search-result-area"},L1)),q1.createElement("div",{className:"search-progress",style:H1})):q1.createElement("div",{className:"search-status"},q1.createElement("label",{htmlFor:u},"Type to search")))},[F,j,i1,_,d,Z,r,f,w,g,u,i]);return q1.createElement(q1.Fragment,null,q1.createElement(hE,{prelightCells:V,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,showMinimap:t.showMinimap,theme:t.theme,trailingRowType:t.trailingRowType,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,drawCustomCell:t.drawCustomCell,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,scrollToEnd:t.scrollToEnd}),d1)},pE=fE,zE=()=>t=>Math.max(16,t.targetHeight-10),mE=L0("input")({name:"RenameInput",class:"r1kzy40b",vars:{"r1kzy40b-0":[zE(),"px"]}}),ME=t=>{let{bounds:a,group:e,onClose:r,canvasBounds:n,onFinish:i}=t,[l,o]=_5.default.useState(e);return _5.default.createElement(rz,{style:{position:"absolute",left:a.x-n.left+1,top:a.y-n.top,width:a.width-2,height:a.height},className:"c1sqdbw3",onClickOutside:r},_5.default.createElement(mE,{targetHeight:a.height,"data-testid":"group-rename-input",value:l,onBlur:r,onFocus:h=>h.target.setSelectionRange(0,l.length),onChange:h=>o(h.target.value),onKeyDown:h=>{h.key==="Enter"?i(l):h.key==="Escape"&&r()},autoFocus:!0}))},E8=150;function HE(t,a,e,r){var n,i;let l=r(a);return(i=(n=l?.measure)==null?void 0:n.call(l,t,a,e))!=null?i:E8}function Iz(t,a,e,r,n,i,l,o,h){let c=[];if(n!==void 0&&c.push(...n.map(d=>d[r]).map(d=>HE(t,d,a,h))),c.length>5&&o){let d=c.reduce((u,p)=>u+p)/c.length;c=c.filter(u=>u{if(typeof window>"u")return[null,null];let f=document.createElement("canvas");return f.style.display="none",f.style.opacity="0",f.style.position="fixed",[f,f.getContext("2d",{alpha:!1})]},[]);l2.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d?.remove()}),[d]);let p=l2.useRef({}),z=l2.useRef(),[w,s]=l2.useState();return l2.useLayoutEffect(()=>{let f=v.current;if(f===void 0||t.every(B5))return;let m=Math.max(1,10-Math.floor(t.length/1e4)),H=0;m1&&(m--,H=1);let x={x:0,y:0,width:t.length,height:Math.min(c.current,m)},y={x:0,y:c.current-1,width:t.length,height:1};(async()=>{let L=f(x,h.signal),V=H>0?f(y,h.signal):void 0,C;typeof L=="object"?C=L:C=await bp(L),V!==void 0&&(typeof V=="object"?C=[...C,...V]:C=[...C,...await bp(V)]),z.current=t,s(C)})()},[h.signal,t]),l2.useMemo(()=>{var f;let H=(()=>t.every(B5)?t:u===null?t.map(L=>B5(L)?L:{...L,width:E8}):(u.font=`${g.current.baseFontStyle} ${g.current.fontFamily}`,t.map((L,V)=>{if(B5(L))return L;if(p.current[L.id]!==void 0)return{...L,width:p.current[L.id]};if(w===void 0||z.current!==t||L.id===void 0)return{...L,width:E8};let C=Iz(u,l,L,V,w,n,i,!0,o);return p.current[L.id]=C.width,C})))(),x=0,y=0,R=[];for(let[L,V]of H.entries())x+=V.width,V.grow!==void 0&&V.grow>0&&(y+=V.grow,R.push(L));if(x0){let L=[...H],V=r-x,C=V;for(let k=0;k1&&t.startsWith("_")){if(Number.parseInt(t.slice(1))!==a.keyCode)return!1}else if(t!==a.key)return!1;return!0}function T0(t,a){if(t.length===0)return!1;let e=!1,r=!1,n=!1,i=!1,l=t.split("+"),o=l.pop();if(!wE(o,a))return!1;for(let h of l)switch(h){case"ctrl":e=!0;break;case"shift":r=!0;break;case"alt":n=!0;break;case"meta":i=!0;break;case"primary":E5.value?i=!0:e=!0;break}return a.altKey===n&&a.ctrlKey===e&&a.shiftKey===r&&a.metaKey===i}function LE(t,a,e,r,n,i){let l=T5.default.useCallback((c,v,g,d)=>{var u,p;(i==="cell"||i==="multi-cell")&&c!==void 0&&(c={...c,range:{x:c.cell[0],y:c.cell[1],width:1,height:1}});let z=e==="mixed"&&(g||d==="drag"),w=r==="mixed"&&z,s=n==="mixed"&&z,f={current:c===void 0?void 0:{...c,rangeStack:d==="drag"?(p=(u=t.current)==null?void 0:u.rangeStack)!=null?p:[]:[]},columns:w?t.columns:mt.empty(),rows:s?t.rows:mt.empty()};g&&(i==="multi-rect"||i==="multi-cell")&&f.current!==void 0&&t.current!==void 0&&(f={...f,current:{...f.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),a(f,v)},[r,t,e,i,n,a]),o=T5.default.useCallback((c,v,g)=>{c=c??t.rows,v!==void 0&&(c=c.add(v));let d;if(n==="exclusive"&&c.length>0)d={current:void 0,columns:mt.empty(),rows:c};else{let u=g&&e==="mixed",p=g&&r==="mixed";d={current:u?t.current:void 0,columns:p?t.columns:mt.empty(),rows:c}}a(d,!1)},[r,t,e,n,a]),h=T5.default.useCallback((c,v,g)=>{c=c??t.columns,v!==void 0&&(c=c.add(v));let d;if(r==="exclusive"&&c.length>0)d={current:void 0,rows:mt.empty(),columns:c};else{let u=g&&e==="mixed",p=g&&n==="mixed";d={current:u?t.current:void 0,rows:p?t.rows:mt.empty(),columns:c}}a(d,!1)},[r,t,e,n,a]);return[l,o,h]}function VE(t,a,e,r,n){let i=_8.useCallback(c=>{var v;if(t===!0){let g=[];for(let d=c.y;d=n?u.push({kind:n1.Loading,allowOverlay:!1}):u.push(a([p,d]));g.push(u)}return g}return(v=t?.(c,r.signal))!=null?v:[]},[r.signal,a,t,n]),l=t!==void 0?i:void 0,o=_8.useCallback(c=>{if(l===void 0)return[];let v={...c,x:c.x-e};if(v.x<0){v.x=0,v.width--;let g=l(v,r.signal);return typeof g=="function"?async()=>(await g()).map(d=>[{kind:n1.Loading,allowOverlay:!1},...d]):g.map(d=>[{kind:n1.Loading,allowOverlay:!1},...d])}return l(v,r.signal)},[r.signal,l,e]);return[t!==void 0?o:void 0,l]}function RE(t,a,e,r,n){var i,l;let o=t;if(r==="allowPartial"||t.current===void 0)return t;if(a!==void 0){let h=!1;do{if(t?.current===void 0)break;let c=(i=t.current)==null?void 0:i.range,v=[];if(c.width>2){let u=a({x:c.x,y:c.y,width:1,height:c.height},n.signal);if(typeof u=="function")return o;v.push(...u);let p=a({x:c.x+c.width-1,y:c.y,width:1,height:c.height},n.signal);if(typeof p=="function")return o;v.push(...p)}else{let u=a({x:c.x,y:c.y,width:c.width,height:c.height},n.signal);if(typeof u=="function")return o;v.push(...u)}let g=c.x-e,d=c.x+c.width-1-e;for(let u of v)for(let p of u)p.span!==void 0&&(g=Math.min(p.span[0],g),d=Math.max(p.span[1],d));g===c.x-e&&d===c.x+c.width-1-e?h=!0:t={current:{cell:(l=t.current.cell)!=null?l:[0,0],range:{x:g+e,y:c.y,width:d-g+1,height:c.height},rangeStack:t.current.rangeStack},columns:t.columns,rows:t.rows}}while(!h)}return t}function Wp(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function yE(t){var a;(function(o){o[o.None=0]="None",o[o.inString=1]="inString",o[o.inStringPostQuote=2]="inStringPostQuote"})(a||(a={}));let e=[],r=[],n=0,i=0;t=t.replace(/\r\n/g,`
`);let l=0;for(let o of t){switch(i){case 0:o===" "||o===`
`?(r.push(t.slice(n,l)),n=l+1,o===`
`&&(e.push(r),r=[])):o==='"'&&(i=1);break;case 1:o==='"'&&(i=2);break;case 2:o==='"'?i=1:((o===" "||o===`
`)&&(r.push(Wp(t.slice(n,l))),n=l+1,o===`
-`&&(e.push(r),r=[])),i=0);break}l++}return n0;){let l=r.pop();if(l===void 0)break;l instanceof HTMLTableElement||l.nodeName==="TBODY"?r.push(...[...l.children].reverse()):l instanceof HTMLTableRowElement?(i!==void 0&&n.push(i),i=[],r.push(...[...l.children].reverse())):l instanceof HTMLTableCellElement&&i?.push((e=(a=l.innerText)!=null?a:l.textContent)!=null?e:"")}return i!==void 0&&n.push(i),n}function He(t){return/[\t\n",]/.test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}var CE=t=>{switch(t){case!0:return"TRUE";case!1:return"FALSE";case I8:return"INDETERMINATE";case Qn:return"";default:sr(t,`A boolean was formated with invalid type: ${typeof t}`)}};function Oz(t,a,e,r){var n,i;let l=r[a];if(t.span!==void 0&&t.span[0]!==l)return"";if(t.copyData!==void 0)return He(t.copyData);switch(t.kind){case l1.Text:case l1.Number:return He(e?(i=(n=t.data)==null?void 0:n.toString())!=null?i:"":t.displayData);case l1.Markdown:case l1.RowID:case l1.Uri:return He(t.data);case l1.Image:case l1.Bubble:return t.data.length===0?"":t.data.reduce((o,h)=>`${He(o)},${He(h)}`);case l1.Boolean:return CE(t.data);case l1.Loading:return e?"":"#LOADING";case l1.Protected:return e?"":"************";case l1.Drilldown:return t.data.length===0?"":t.data.map(o=>o.text).reduce((o,h)=>`${He(o)},${He(h)}`);case l1.Custom:return He(t.copyData);default:sr(t,`A cell was passed with an invalid kind: ${t.kind}`)}}function BE(t,a){return t.map(e=>e.map((r,n)=>Oz(r,n,!1,a)).join(" ")).join(`
-`)}function qp(t,a,e){var r,n,i,l;let o=BE(t,a);if(((r=window.navigator.clipboard)==null?void 0:r.write)!==void 0||e!==void 0){let h=document.createElement("tbody");for(let c of t){let v=document.createElement("tr");for(let[g,d]of c.entries()){let u=document.createElement("td");if(d.kind===l1.Uri){let p=document.createElement("a");p.href=d.data,p.innerText=d.data,u.append(p)}else u.innerText=Oz(d,g,!0,a);v.append(u)}h.append(v)}if(((n=window.navigator.clipboard)==null?void 0:n.write)!==void 0)window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([``],{type:"text/html"})})]);else if(e!==void 0&&e?.clipboardData!==null)try{e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",``)}catch{(i=window.navigator.clipboard)==null||i.writeText(o)}}else(l=window.navigator.clipboard)==null||l.writeText(o);e?.preventDefault()}function Gp(t){return typeof t=="string"?t:`${t}px`}var SE=()=>t=>t.innerWidth,AE=()=>t=>t.innerHeight,FE=L0("div")({name:"Wrapper",class:"wzg2m5k",vars:{"wzg2m5k-0":[SE()],"wzg2m5k-1":[AE()]}}),kE=t=>{let{inWidth:a,inHeight:e,children:r,...n}=t;return Dz.createElement(FE,{innerHeight:Gp(e),innerWidth:Gp(a),...n},r)};function Nz(t){return t!==!0}var Kp=20,bE={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:"false"},kind:l1.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>{var a;return Xk(t,t.cell.data,S8(t.cell),(a=t.cell.maxSize)!=null?a:Kp)},onDelete:t=>({...t,data:!1}),onClick:t=>{var a,e;let{cell:r,posX:n,posY:i,bounds:l,theme:o}=t,{width:h,height:c,x:v,y:g}=l,d=(a=r.maxSize)!=null?a:Kp,u=Math.floor(l.y+c/2),p=Mz(d,c,o.cellVerticalPadding),z=mz((e=r.contentAlign)!=null?e:"center",v,h,o.cellHorizontalPadding,p),w=zz(z,u,p),s=Hz(v+n,g+i,w);if(S8(r)&&s)return{...r,data:Nz(r.data)}},onPaste:(t,a)=>{let e=Qn;return t.toLowerCase()==="true"?e=!0:t.toLowerCase()==="false"?e=!1:t.toLowerCase()==="indeterminate"&&(e=I8),e===a.data?void 0:{...a,data:e}}},EE=2,_E=1300;function TE(t,a){let e=T8.default.useRef(0),[r,n]=t??[0,0];T8.default.useEffect(()=>{if(r===0&&n===0){e.current=0;return}let i=0,l=h=>{var c;if(i===0)i=h;else{let v=h-i;e.current=Math.min(1,e.current+v/_E);let g=e.current**1.618*v*EE;(c=a.current)==null||c.scrollBy(r*g,n*g),i=h}o=window.requestAnimationFrame(l)},o=window.requestAnimationFrame(l);return()=>window.cancelAnimationFrame(o)},[a,r,n])}var PE=L0("div")({name:"BubblesOverlayEditorStyle",class:"b1bqsp5z"}),IE=t=>{let{bubbles:a}=t;return P5.createElement(PE,null,a.map((e,r)=>P5.createElement("div",{key:r,className:"boe-bubble"},e)),P5.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},OE=IE,DE={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:l1.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n).width+r+20,0)+2*e.cellHorizontalPadding-4,draw:t=>Yk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return $z.createElement(OE,{bubbles:a.data})},onPaste:()=>{}},NE=L0("div")({name:"DrilldownOverlayEditorStyle",class:"df2kt4a"}),$E=t=>{let{drilldowns:a}=t;return Xn.createElement(NE,null,a.map((e,r)=>Xn.createElement("div",{key:r,className:"doe-bubble"},e.img!==void 0&&Xn.createElement("img",{src:e.img}),Xn.createElement("div",null,e.text))))},UE=$E,WE={getAccessibilityString:t=>t.data.map(a=>a.text).join(", "),kind:l1.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n.text).width+r+20+(n.img!==void 0?18:0),0)+2*e.cellHorizontalPadding-4,draw:t=>Zk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return Uz.createElement(UE,{drilldowns:a.data})},onPaste:()=>{}},jE=L0("div")({name:"ImageOverlayEditorStyle",class:"i1eozt10"}),qE=t=>{let{urls:a,canWrite:e,onEditClick:r,renderImage:n}=t,i=a.filter(o=>o!=="");if(i.length===0)return null;let l=i.length>1;return n4.createElement(jE,{"data-testid":"GDG-default-image-overlay-editor"},n4.createElement(jz.Carousel,{showArrows:l,showThumbs:!1,swipeable:l,emulateTouch:l,infiniteLoop:l},i.map(o=>{var h;let c=(h=n?.(o))!=null?h:n4.createElement("img",{draggable:!1,src:o});return n4.createElement("div",{className:"centering-container",key:o},c)})),e&&r&&n4.createElement("button",{className:"edit-icon",onClick:r},n4.createElement(D8,null)))},GE={getAccessibilityString:t=>t.data.join(", "),kind:l1.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>{var a;return Jk(t,(a=t.cell.displayData)!=null?a:t.cell.data,t.cell.rounding,t.cell.contentAlign)},measure:(t,a)=>a.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{let{value:a,onFinishedEditing:e,imageEditorOverride:r}=t;return Wz.createElement(r??qE,{urls:a.data,canWrite:a.allowAdd,onCancel:e,onChange:i=>{e({...a,data:[i]})}})},onPaste:(t,a)=>{t=t.trim();let r=t.split(",").map(n=>{try{return new URL(n),n}catch{return}}).filter(n=>n!==void 0);if(!(r.length===a.data.length&&r.every((n,i)=>n===a.data[i])))return{...a,data:r}}},KE={getAccessibilityString:()=>"",kind:l1.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:()=>{},onPaste:()=>{}},XE=L0("div")({name:"MarkdownContainer",class:"mlbeo71"}),YE=class extends P8.default.PureComponent{constructor(){super(...arguments),this.targetElement=null,this.containerRefHook=t=>{this.targetElement=t,this.renderMarkdownIntoDiv()}}renderMarkdownIntoDiv(){let{targetElement:t,props:a}=this;if(t===null)return;let{contents:e,createNode:r}=a,n=j1(e),i=document.createRange();i.selectNodeContents(t),i.deleteContents();let l=r?.(n);if(l===void 0){let h=document.createElement("template");h.innerHTML=n,l=h.content}t.append(l);let o=t.getElementsByTagName("a");for(let h of o)h.target="_blank",h.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),P8.default.createElement(XE,{ref:this.containerRefHook})}},QE=L0("textarea")({name:"InputBox",class:"ijuk0po"}),ZE=L0("div")({name:"ShadowBox",class:"saq3p5l"}),JE=L0("div")({name:"GrowingEntryStyle",class:"gf8vzix"}),Xp=0,N5=t=>{let{placeholder:a,value:e,onKeyDown:r,highlight:n,altNewline:i,validatedSelection:l,...o}=t,{onChange:h,className:c}=o,v=h2.useRef(null),g=e??"";i2(h!==void 0,"GrowingEntry must be a controlled input area");let[d]=h2.useState(()=>"input-box-"+(Xp=(Xp+1)%1e7));h2.useEffect(()=>{let p=v.current;if(p===null||p.disabled)return;let z=g.toString().length;p.focus(),p.setSelectionRange(n?0:z,z)},[]),h2.useLayoutEffect(()=>{var p;if(l!==void 0){let z=typeof l=="number"?[l,null]:l;(p=v.current)==null||p.setSelectionRange(z[0],z[1])}},[l]);let u=h2.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&i===!0||r?.(p)},[i,r]);return h2.createElement(JE,{className:"gdg-growing-entry"},h2.createElement(ZE,{className:c},g+`
-`),h2.createElement(QE,{...o,className:(c??"")+" gdg-input",id:d,ref:v,onKeyDown:u,value:g,placeholder:a,dir:"auto"}))},t_=()=>t=>t.targetWidth,Yp=L0("div")({name:"MarkdownOverlayEditorStyle",class:"mdwzdl1",vars:{"mdwzdl1-0":[t_(),"px"]}}),a_=t=>{let{value:a,onChange:e,forceEditMode:r,createNode:n,targetRect:i,onFinish:l,validatedSelection:o}=t,h=a.data,c=a.readonly===!0,[v,g]=R0.useState(h===""||r),d=R0.useCallback(()=>{g(p=>!p)},[]),u=h?"ml-6":"";return v?R0.createElement(Yp,{targetWidth:i.width-20},R0.createElement(N5,{autoFocus:!0,highlight:!1,validatedSelection:o,value:h,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:e}),R0.createElement("div",{className:`edit-icon checkmark-hover ${u}`,onClick:()=>l(a)},R0.createElement(Bk,null))):R0.createElement(Yp,{targetWidth:i.width},R0.createElement(YE,{contents:h,createNode:n}),!c&&R0.createElement(R0.Fragment,null,R0.createElement("div",{className:"spacer"}),R0.createElement("div",{className:`edit-icon edit-hover ${u}`,onClick:d},R0.createElement(D8,null))),R0.createElement("textarea",{className:"md-edit-textarea gdg-input",autoFocus:!0}))},e_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:l1.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Jn,measure:(t,a,e)=>{let r=a.data.split(`
-`)[0];return t.measureText(r).width+2*e.cellHorizontalPadding},draw:t=>ti(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{let{onChange:a,value:e,target:r,onFinishedEditing:n,markdownDivCreateNode:i,forceEditMode:l,validatedSelection:o}=t;return qz.createElement(a_,{onFinish:n,targetRect:r,value:e,validatedSelection:o,onChange:h=>a({...e,data:h.target.value}),forceEditMode:l,createNode:i})},onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},r_={getAccessibilityString:t=>t.row.toString(),kind:o2.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:jk,measure:()=>44,draw:t=>Gk(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle),onClick:t=>{let{bounds:a,cell:e,posX:r,posY:n}=t,{width:i,height:l}=a,o=e.drawHandle?7+(i-7)/2:i/2,h=l/2;if(Math.abs(r-o)<=10&&Math.abs(n-h)<=10)return{...e,checked:!e.checked}},onPaste:()=>{}},n_={getAccessibilityString:()=>"",kind:o2.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>Wk(t,t.cell.hint,t.cell.icon),onPaste:()=>{}},i_=o4.lazy(async()=>await Promise.resolve().then(()=>(Ap(),Sp))),l_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:l1.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Jn,draw:t=>ti(t,t.cell.displayData,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.displayData).width+16,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return o4.createElement(o4.Suspense,{fallback:null},o4.createElement(i_,{highlight:a,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:n,onChange:i=>{var l;return e({...r,data:Number.isNaN((l=i.floatValue)!=null?l:0)?0:i.floatValue})}}))},onPaste:(t,a)=>{let e=Number.parseFloat(t);if(!(Number.isNaN(e)||a.data===e))return{...a,data:e}}},o_={getAccessibilityString:()=>"",measure:()=>108,kind:l1.Protected,needsHover:!1,needsHoverPosition:!1,draw:Kk,onPaste:()=>{}},h_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:l1.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,a)=>Jn(t,a,t.theme.textLight),draw:t=>ti(t,t.cell.data,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.data).width+16,provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return Gz.default.createElement(N5,{highlight:a,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:n,onChange:i=>e({...r,data:i.target.value})})},onPaste:()=>{}},c_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:l1.Text,needsHover:!1,needsHoverPosition:!1,drawPrep:Jn,useLabel:!0,draw:t=>(ti(t,t.cell.displayData,t.cell.contentAlign,t.cell.allowWrapping,t.hyperWrapping),!0),measure:(t,a,e)=>{let r=a.displayData.split(`
-`).slice(0,a.allowWrapping===!0?void 0:1);return Math.max(...r.map(n=>t.measureText(n).width+2*e.cellHorizontalPadding))},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:a=>{let{isHighlighted:e,onChange:r,value:n,validatedSelection:i}=a;return Kz.createElement(N5,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:e,autoFocus:n.readonly!==!0,disabled:n.readonly===!0,altNewline:!0,value:n.data,validatedSelection:i,onChange:l=>r({...n,data:l.target.value})})}}),onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},v_=L0("div")({name:"UriOverlayEditorStyle",class:"uf0sjo8"}),g_=t=>{let{uri:a,onChange:e,forceEditMode:r,readonly:n,validatedSelection:i,preview:l}=t,[o,h]=ea.useState(a===""||r),c=ea.useCallback(()=>{h(!0)},[]);return o?ea.createElement(N5,{validatedSelection:i,highlight:!0,autoFocus:!0,value:a,onChange:e}):ea.createElement(v_,null,ea.createElement("a",{className:"link-area",href:a,target:"_blank",rel:"noopener noreferrer"},l),!n&&ea.createElement("div",{className:"edit-icon",onClick:c},ea.createElement(D8,null)),ea.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},d_=g_,s_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:l1.Uri,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Jn,draw:t=>ti(t,t.cell.data,t.cell.contentAlign),measure:(t,a,e)=>t.measureText(a.data).width+e.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{var a;let{onChange:e,value:r,forceEditMode:n,validatedSelection:i}=t;return Xz.createElement(d_,{forceEditMode:n,uri:r.data,preview:(a=r.displayData)!=null?a:r.data,validatedSelection:i,readonly:r.readonly===!0,onChange:l=>e({...r,data:l.target.value})})},onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},u_={[o2.Marker]:r_,[o2.NewRow]:n_,[l1.Boolean]:bE,[l1.Bubble]:DE,[l1.Drilldown]:WE,[l1.Image]:GE,[l1.Loading]:KE,[l1.Markdown]:e_,[l1.Number]:l_,[l1.Protected]:o_,[l1.RowID]:h_,[l1.Text]:c_,[l1.Uri]:s_},f_=0;function p_(t){return(0,tz.default)((0,B8.default)((0,B8.default)(t).filter(a=>a.span!==void 0).map(a=>{var e,r,n,i;return(0,i4.default)(((r=(e=a.span)==null?void 0:e[0])!=null?r:0)+1,((i=(n=a.span)==null?void 0:n[1])!=null?i:0)+1)})))}function A5(t,a){return t===void 0||a===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+a,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+a},rangeStack:t.current.rangeStack.map(e=>({...e,x:e.x+a}))},rows:t.rows,columns:t.columns.offset(a)}}var Qp={selectAll:!0,selectRow:!0,selectColumn:!0,downFill:!1,rightFill:!1,pageUp:!1,pageDown:!1,clear:!0,copy:!0,paste:!0,search:!1,first:!0,last:!0},Zp={kind:l1.Loading,allowOverlay:!1},F5={columns:mt.empty(),rows:mt.empty(),current:void 0},z_=(t,a)=>{var e,r,n,i,l;let[o,h]=$.useState(F5),[c,v]=$.useState(),g=$.useRef(null),d=$.useRef(null),[u,p]=$.useState(),z=$.useRef(null),w=$.useRef(),{rowMarkers:s="none",rowMarkerWidth:f,imageEditorOverride:m,getRowThemeOverride:H,markdownDivCreateNode:x,width:y,height:R,columns:L,rows:V,getCellContent:C,onCellClicked:k,onCellActivated:b,onFinishedEditing:F,coercePasteValue:_,drawHeader:j,onHeaderClicked:n1,spanRangeBehavior:Z="default",onGroupHeaderClicked:d1,onCellContextMenu:O,className:a1,onHeaderContextMenu:W,getCellsForSelection:L1,onGroupHeaderContextMenu:p1,onGroupHeaderRenamed:o1,onCellEdited:H1,onCellsEdited:P1,onSearchResultsChanged:K1,searchResults:W1,onSearchValueChange:Bt,searchValue:T1,onKeyDown:X1,onKeyUp:Y,keybindings:N,onRowAppended:s1,onColumnMoved:x1,validateCell:f1,highlightRegions:U,drawCell:v1,rangeSelect:D="rect",columnSelect:I="multi",rowSelect:C1="multi",rangeSelectionBlending:D1="exclusive",columnSelectionBlending:et="exclusive",rowSelectionBlending:B1="exclusive",onDelete:c1,onDragStart:e1,onMouseMove:u1,onPaste:M1,copyHeaders:I1=!1,freezeColumns:Q1=0,rowSelectionMode:St="auto",rowMarkerStartIndex:jt=1,rowMarkerTheme:Ut,onHeaderMenuClick:Et,getGroupDetails:ot,onSearchClose:J1,onItemHovered:Jt,onSelectionCleared:Mt,showSearch:C0,onVisibleRegionChanged:Z0,gridSelection:B0,onGridSelectionChange:t0,minColumnWidth:Ma=50,maxColumnWidth:dt=500,maxColumnAutoWidth:At,provideEditor:h0,trailingRowOptions:wt,scrollOffsetX:Ft,scrollOffsetY:qt,verticalBorder:c2,onDragOverCell:v2,onDrop:$a,onColumnResize:O2,onColumnResizeEnd:j0,onColumnResizeStart:g2,customRenderers:D2,fillHandle:ri,drawFocusRing:u0,experimental:Ht,fixedShadowX:m0,fixedShadowY:j5,headerIcons:ia,imageWindowLoader:ni,initialSize:xr,isDraggable:Se,onDragLeave:Ae,onRowMoved:la,overscrollX:Ha,overscrollY:oa,preventDiagonalScrolling:xa,rightElement:q5,rightElementProps:ii,showMinimap:G5,smoothScrollX:li,smoothScrollY:c4,scrollToEnd:Fe,scaleToRem:oi=!1,rowHeight:wr=34,headerHeight:ke=36,groupHeaderHeight:v4=ke,theme:d2,isOutsideClick:J8}=t,wa=Math.max(Ma,20),Ua=Math.max(dt,wa),hi=Math.max(At??Ua,wa),La=$.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]).fontSize,ha=$.useMemo(()=>Number.parseFloat(La),[La]),[M0,Va,g4,Lr,vi,K5]=$.useMemo(()=>{var M,A,E;if(!oi||ha===16)return[wr,ke,v4,d2,Ha,oa];let T=ha/16,J=wr,K=kp();return[typeof J=="number"?J*T:X=>Math.ceil(J(X)*T),Math.ceil(ke*T),Math.ceil(v4*T),{...d2,headerIconSize:((M=d2?.headerIconSize)!=null?M:K.headerIconSize)*T,cellHorizontalPadding:((A=d2?.cellHorizontalPadding)!=null?A:K.cellHorizontalPadding)*T,cellVerticalPadding:((E=d2?.cellVerticalPadding)!=null?E:K.cellVerticalPadding)*T},Math.ceil((Ha??0)*T),Math.ceil((oa??0)*T)]},[v4,ke,Ha,oa,ha,wr,oi,d2]),Lt=$.useMemo(()=>N===void 0?Qp:{...Qp,...N},[N]),Wa=f??(V>1e4?48:V>1e3?44:V>100?36:32),s2=s!=="none",P=s2?1:0,H0=s1!==void 0,V2=wt?.sticky===!0,[X5,gi]=$.useState(!1),Y5=C0??X5,Q5=$.useCallback(()=>{J1!==void 0?J1():gi(!1)},[J1]),d4=$.useMemo(()=>B0===void 0?void 0:A5(B0,P),[B0,P]),q=d4??o,R2=$.useRef(new AbortController);$.useEffect(()=>()=>{R2?.current.abort()},[]);let[P0,Z5]=VE(L1,C,P,R2.current,V),di=$.useCallback((M,A,E)=>{if(f1===void 0)return!0;let T=[M[0]-P,M[1]];return f1?.(T,A,E)},[P,f1]),Ra=$.useRef(B0),J0=$.useCallback((M,A)=>{A&&(M=RE(M,P0,P,Z,R2.current)),t0!==void 0?(Ra.current=A5(M,-P),t0(Ra.current)):h(M)},[t0,P0,P,Z]),ya=jn(O2,$.useCallback((M,A,E,T)=>{O2?.(L[E-P],A,E-P,T)},[O2,P,L])),J5=jn(j0,$.useCallback((M,A,E,T)=>{j0?.(L[E-P],A,E-P,T)},[j0,P,L])),Vr=jn(g2,$.useCallback((M,A,E,T)=>{g2?.(L[E-P],A,E-P,T)},[g2,P,L])),s4=jn(j,$.useCallback(M=>{var A;return(A=j?.({...M,columnIndex:M.columnIndex-P}))!=null?A:!1},[j,P])),Rr=$.useCallback(M=>{if(c1!==void 0){let A=c1(A5(M,-P));return typeof A=="boolean"?A:A5(A,P)}return!0},[c1,P]),[c0,S0,v0]=LE(q,J0,D1,et,B1,D),S=$.useMemo(()=>({...kp(),...Lr}),[Lr]),[G,b1]=$.useState([10,10,0]),z1=$.useCallback(M=>M.kind!==l1.Custom?u_[M.kind]:D2?.find(A=>A.isMatch(M)),[D2]),E1=xE(L,V,Z5,G[0]-(P===0?0:Wa)-G[2],wa,hi,S,z1,R2.current),h1=$.useMemo(()=>E1.some(M=>M.group!==void 0),[E1]),$1=h1?Va+g4:Va,st=q.rows.length,S1=s==="none"?"":st===0?vz:st===V?cz:vk,_1=$.useMemo(()=>s==="none"?E1:[{title:S1,width:Wa,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Ut},...E1],[E1,Wa,s,S1,Ut]),[a0,tt]=$.useMemo(()=>[qt!==void 0&&typeof M0=="number"?Math.floor(qt/M0):0,qt!==void 0&&typeof M0=="number"?-(qt%M0):0],[qt,M0]),ut=$.useRef({height:1,width:1,x:0,y:0}),ht=$.useMemo(()=>{var M,A;return{x:ut.current.x,y:a0,width:(M=ut.current.width)!=null?M:1,height:(A=ut.current.height)!=null?A:1,ty:tt}},[tt,a0]),xt=$.useRef(!1),[_t,Ca,y2]=bk(ht),C2=((e=_t.height)!=null?e:1)>1;$.useLayoutEffect(()=>{if(qt!==void 0&&z.current!==null&&C2){if(z.current.scrollTop===qt)return;z.current.scrollTop=qt,z.current.scrollTop!==qt&&y2(),xt.current=!0}},[qt,C2,y2]);let N2=((r=_t.width)!=null?r:1)>1;$.useLayoutEffect(()=>{if(Ft!==void 0&&z.current!==null&&N2){if(z.current.scrollLeft===Ft)return;z.current.scrollLeft=Ft,z.current.scrollLeft!==Ft&&y2(),xt.current=!0}},[Ft,N2,y2]);let B2=_t.x+P,u2=_t.y,G1=$.useRef(null),Gt=$.useCallback(M=>{var A;M===!0?(A=G1.current)==null||A.focus():window.requestAnimationFrame(()=>{var E;(E=G1.current)==null||E.focus()})},[]),n0=H0?V+1:V,A0=$.useCallback(M=>{let A=P===0?M:M.map(T=>({...T,location:[T.location[0]-P,T.location[1]]})),E=P1?.(A);if(E!==!0)for(let T of A)H1?.(T.location,T.value);return E},[H1,P1,P]),Vm=$.useMemo(()=>{if(U!==void 0)return P===0?U:U.map(M=>{let A=_1.length-M.range.x-P;if(!(A<=0))return{color:M.color,range:{...M.range,x:M.range.x+P,width:Math.min(A,M.range.width)},style:M.style}}).filter(M=>M!==void 0)},[U,_1.length,P]),t6=$.useRef(_1);t6.current=_1;let F0=$.useCallback(([M,A],E=!1)=>{var T,J,K,X,i1,t1,m1,y1,N1,Y1;let w1=H0&&A===n0-1;if(M===0&&s2)return w1?Zp:{kind:o2.Marker,allowOverlay:!1,checked:q?.rows.hasIndex(A)===!0,markerKind:s==="clickable-number"?"number":s,row:jt+A,drawHandle:la!==void 0,cursor:s==="clickable-number"?"pointer":void 0};if(w1){let ct=M===P&&(T=wt?.hint)!=null?T:"",k1=t6.current[M];if(((J=k1?.trailingRowOptions)==null?void 0:J.disabled)===!0)return Zp;{let rt=(X=(K=k1?.trailingRowOptions)==null?void 0:K.hint)!=null?X:ct,gt=(t1=(i1=k1?.trailingRowOptions)==null?void 0:i1.addIcon)!=null?t1:wt?.addIcon;return{kind:o2.NewRow,hint:rt,allowOverlay:!1,icon:gt}}}else{let at=M-P;if(E||Ht?.strict===!0){let k1=ut.current,rt=k1.x>at||at>k1.x+k1.width||k1.y>A||A>k1.y+k1.height,gt=at===((y1=(m1=k1.extras)==null?void 0:m1.selected)==null?void 0:y1[0])&&A===((N1=k1.extras)==null?void 0:N1.selected[1]),Vt=((Y1=k1.extras)==null?void 0:Y1.freezeRegion)===void 0||k1.extras.freezeRegion.x>at||at>k1.extras.freezeRegion.x+k1.extras.freezeRegion.width||k1.extras.freezeRegion.y>A||A>k1.extras.freezeRegion.y+k1.extras.freezeRegion.height;if(rt&&!gt&&Vt)return{kind:l1.Loading,allowOverlay:!1}}let ct=C([at,A]);return P!==0&&ct.span!==void 0&&(ct={...ct,span:[ct.span[0]+P,ct.span[1]+P]}),ct}},[H0,n0,s2,q?.rows,la,s,P,wt?.hint,wt?.addIcon,Ht?.strict,C,jt]),to=$.useCallback(M=>{var A,E;let T=(A=ot?.(M))!=null?A:{name:M};return o1!==void 0&&M!==""&&(T={icon:T.icon,name:T.name,overrideTheme:T.overrideTheme,actions:[...(E=T.actions)!=null?E:[],{title:"Rename",icon:"renameIcon",onClick:J=>ro({group:T.name,bounds:J.bounds})}]}),T},[ot,o1]),si=$.useCallback(M=>{var A;let[E,T]=M.cell,J=_1[E],K=J?.group!==void 0?(A=to(J.group))==null?void 0:A.overrideTheme:void 0,X=J?.themeOverride,i1=H?.(T);v({...M,theme:{...S,...K,...X,...i1,...M.content.themeOverride}})},[H,_1,to,S]),yr=$.useCallback((M,A,E)=>{var T;if(q.current===void 0)return;let[J,K]=q.current.cell,X=F0([J,K]);if(X.kind!==l1.Boolean&&X.allowOverlay){let i1=X;if(E!==void 0)switch(i1.kind){case l1.Number:{let t1=hk(()=>E==="-"?-0:Number.parseFloat(E),0);i1={...i1,data:Number.isNaN(t1)?0:t1};break}case l1.Text:case l1.Markdown:case l1.Uri:i1={...i1,data:E};break}si({target:M,content:i1,initialValue:E,cell:[J,K],highlight:E===void 0,forceEditMode:E!==void 0})}else X.kind===l1.Boolean&&A&&X.readonly!==!0&&(A0([{location:q.current.cell,value:{...X,data:Nz(X.data)}}]),(T=G1.current)==null||T.damage([{cell:q.current.cell}]))},[F0,q,A0,si]),a6=$.useCallback((M,A)=>{var E;let T=(E=G1.current)==null?void 0:E.getBounds(M,A);if(T===void 0||z.current===null)return;let J=F0([M,A]);!J.allowOverlay||si({target:T,content:J,initialValue:void 0,highlight:!0,cell:[M,A],forceEditMode:!0})},[F0,si]),Kt=$.useCallback((M,A,E="both",T=0,J=0,K=void 0)=>{var X;if(z.current!==null){let i1=G1.current,t1=d.current,m1=typeof M!="number"?M.unit==="cell"?M.amount:void 0:M,y1=typeof A!="number"?A.unit==="cell"?A.amount:void 0:A,N1=typeof M!="number"&&M.unit==="px"?M.amount:void 0,Y1=typeof A!="number"&&A.unit==="px"?A.amount:void 0;if(i1!==null&&t1!==null){let w1={x:0,y:0,width:0,height:0},A1=0,at=0;if((m1!==void 0||y1!==void 0)&&(w1=(X=i1.getBounds((m1??0)+P,y1??0))!=null?X:w1,w1.width===0||w1.height===0))return;let ct=t1.getBoundingClientRect(),k1=ct.width/t1.offsetWidth;if(N1!==void 0&&(w1={...w1,x:N1-ct.left-z.current.scrollLeft,width:1}),Y1!==void 0&&(w1={...w1,y:Y1+ct.top-z.current.scrollTop,height:1}),w1!==void 0){let rt={x:w1.x-T,y:w1.y-J,width:w1.width+2*T,height:w1.height+2*J},gt=0;for(let zt=0;ztrt.x?A1=rt.x-kt:i0rt.y?at=rt.y-Rt:ft{var E;let T=_1[M];if(((E=T?.trailingRowOptions)==null?void 0:E.disabled)===!0)return;let J=s1?.(),K,X=!0;J!==void 0&&(K=await J,K==="top"&&(X=!1),typeof K=="number"&&(X=!1));let i1=0,t1=()=>{if(n6.current<=V){i1<500&&window.setTimeout(t1,i1),i1=50+i1*2;return}let m1=typeof K=="number"?K:X?V:0;Kt(M-P,m1),c0({cell:[M,m1],range:{x:M,y:m1,width:1,height:1}},!1,!1,"edit");let y1=r6.current([M-P,m1]);y1.allowOverlay&&gr(y1)&&y1.readonly!==!0&&A&&window.setTimeout(()=>{e6.current(M,m1)},0)};t1()},[_1,s1,P,V,Kt,c0]),ui=$.useCallback(M=>{var A,E,T;let J=(T=(E=(A=E1[M])==null?void 0:A.trailingRowOptions)==null?void 0:E.targetColumn)!=null?T:wt?.targetColumn;if(typeof J=="number")return J+(s2?1:0);if(typeof J=="object"){let K=L.indexOf(J);if(K>=0)return K+(s2?1:0)}},[E1,L,s2,wt?.targetColumn]),ja=$.useRef(),f4=$.useRef(),Cr=$.useCallback((M,A)=>{var E;let[T,J]=A;return{...S,...(E=_1[T])==null?void 0:E.themeOverride,...H?.(J),...M.themeOverride}},[H,_1,S]),Br=$.useCallback(M=>{var A,E,T,J;let K=E5.value?M.metaKey:M.ctrlKey,X=K&&C1==="multi",i1=K&&I==="multi",[t1,m1]=M.location,y1=q.columns,N1=q.rows,[Y1,w1]=(E=(A=q.current)==null?void 0:A.cell)!=null?E:[];if(M.kind==="cell"){if(f4.current=void 0,be.current=[t1,m1],t1===0&&s2){if(H0===!0&&m1===V||s==="number"||C1==="none")return;let A1=F0(M.location);if(A1.kind!==o2.Marker)return;if(la!==void 0){let k1=z1(A1);i2(k1?.kind===o2.Marker);let rt=(T=k1?.onClick)==null?void 0:T.call(k1,{...M,cell:A1,posX:M.localEventX,posY:M.localEventY,bounds:M.bounds,theme:Cr(A1,M.location),preventDefault:()=>{}});if(rt===void 0||rt.checked===A1.checked)return}v(void 0),Gt();let at=N1.hasIndex(m1),ct=ja.current;if(C1==="multi"&&(M.shiftKey||M.isLongTouch===!0)&&ct!==void 0&&N1.hasIndex(ct)){let k1=[Math.min(ct,m1),Math.max(ct,m1)+1];X||St==="multi"?S0(void 0,k1,!0):S0(mt.fromSingleSelection(k1),void 0,X)}else X||M.isTouch||St==="multi"?at?S0(N1.remove(m1),void 0,!0):(S0(void 0,m1,!0),ja.current=m1):at&&N1.length===1?S0(mt.empty(),void 0,K):(S0(mt.fromSingleSelection(m1),void 0,K),ja.current=m1)}else if(t1>=P&&H0&&m1===V){let A1=ui(t1);u4(A1??t1)}else if(Y1!==t1||w1!==m1){let A1=F0(M.location),at=z1(A1);if(at?.onSelect!==void 0){let rt=!1;if(at.onSelect({...M,cell:A1,posX:M.localEventX,posY:M.localEventY,bounds:M.bounds,preventDefault:()=>rt=!0,theme:Cr(A1,M.location)}),rt)return}let ct=V2&&m1===V,k1=V2&&q!==void 0&&((J=q.current)==null?void 0:J.cell[1])===V;if((M.shiftKey||M.isLongTouch===!0)&&Y1!==void 0&&w1!==void 0&&q.current!==void 0&&!k1){if(ct)return;let rt=Math.min(t1,Y1),gt=Math.max(t1,Y1),Vt=Math.min(m1,w1),kt=Math.max(m1,w1);c0({...q.current,range:{x:rt,y:Vt,width:gt-rt+1,height:kt-Vt+1}},!0,K,"click"),ja.current=void 0,Gt()}else c0({cell:[t1,m1],range:{x:t1,y:m1,width:1,height:1}},!0,K,"click"),ja.current=void 0,v(void 0),Gt()}}else if(M.kind==="header")if(be.current=[t1,m1],v(void 0),s2&&t1===0)ja.current=void 0,f4.current=void 0,C1==="multi"&&(N1.length!==V?S0(mt.fromSingleSelection([0,V]),void 0,K):S0(mt.empty(),void 0,K),Gt());else{let A1=f4.current;if(I==="multi"&&(M.shiftKey||M.isLongTouch===!0)&&A1!==void 0&&y1.hasIndex(A1)){let at=[Math.min(A1,t1),Math.max(A1,t1)+1];i1?v0(void 0,at,K):v0(mt.fromSingleSelection(at),void 0,K)}else i1?(y1.hasIndex(t1)?v0(y1.remove(t1),void 0,K):v0(void 0,t1,K),f4.current=t1):I!=="none"&&(v0(mt.fromSingleSelection(t1),void 0,K),f4.current=t1);ja.current=void 0,Gt()}else M.kind===w2?be.current=[t1,m1]:M.kind===O5&&(J0(F5,!1),v(void 0),Gt(),Mt?.(),ja.current=void 0,f4.current=void 0)},[u4,I,Gt,z1,ui,F0,q,s2,V2,Mt,la,P,s,C1,St,V,c0,J0,v0,S0,H0,Cr]),ao=$.useRef(!1),be=$.useRef(),i6=$.useRef(_t),f2=$.useRef(),Rm=$.useCallback(M=>{var A,E;if(p4.current=!1,i6.current=ut.current,M.button!==0&&M.button!==1){f2.current=void 0;return}let T=performance.now(),J=T-((E=(A=f2.current)==null?void 0:A.time)!=null?E:-1e3)<250;f2.current={wasDoubleClick:J,button:M.button,time:T,location:M.location},M?.kind==="header"&&(ao.current=!0);let K=M.kind==="cell"&&M.isFillHandle;!K&&M.kind!=="cell"&&M.isEdge||(p({previousSelection:q,fillHandle:K}),be.current=void 0,!M.isTouch&&M.button===0?Br(M):!M.isTouch&&M.button===1&&(be.current=M.location))},[q,Br]),[eo,ro]=$.useState(),l6=$.useCallback(M=>{if(M.kind!==w2||I!=="multi")return;let A=E5.value?M.metaKey:M.ctrlKey,[E]=M.location,T=q.columns;if(E=P&&Zn(J.group,_1[i1].group);i1--)K--;for(let i1=E+1;i1<_1.length&&Zn(J.group,_1[i1].group);i1++)X++;if(Gt(),A)if(T.hasAll([K,X+1])){let i1=T;for(let t1=K;t1<=X;t1++)i1=i1.remove(t1);v0(i1,void 0,A)}else v0(void 0,[K,X+1],A);else v0(mt.fromSingleSelection([K,X+1]),void 0,A)},[I,Gt,q.columns,_1,P,v0]),fi=$.useCallback(M=>{var A;if(q.current===void 0)return;let E=[],T=q.current.range;for(let J=0;J({cell:J.location})))},[F0,q,A0]),p4=$.useRef(!1),pi=$.useCallback(async(M,A=!1)=>{var E;if((((E=f2.current)==null?void 0:E.wasDoubleClick)===!0||A)&&P0!==void 0&&ya!==void 0){let T=ut.current.y,J=ut.current.height,K=P0({x:M,y:T,width:1,height:Math.min(J,V-T)},R2.current.signal);typeof K!="object"&&(K=await K());let X=E1[M-P],t1=document.createElement("canvas").getContext("2d",{alpha:!1});if(t1!==null){t1.font=`${S.baseFontStyle} ${S.fontFamily}`;let m1=Iz(t1,S,X,0,K,wa,Ua,!1,z1);ya?.(X,m1.width,M,m1.width)}}},[E1,P0,Ua,S,wa,ya,P,V,z1]),[ym,o6]=$.useState(),Cm=$.useCallback((M,A)=>{var E,T,J;let K=u;if(p(void 0),o6(void 0),ao.current=!1,A)return;if(K?.fillHandle===!0&&q.current!==void 0){fi(q.current.cell[1]!==q.current.range.y);return}let[X,i1]=M.location,[t1,m1]=(E=be.current)!=null?E:[],y1=()=>{p4.current=!0},N1=w1=>{var A1,at,ct;if((w1.isTouch||t1===X&&m1===i1)&&k?.([X-P,i1],{...w1,preventDefault:y1}),w1.button===1)return!p4.current;if(!p4.current){let k1=F0(M.location),rt=z1(k1);if(rt!==void 0&&rt.onClick!==void 0){let gt=rt.onClick({...w1,cell:k1,posX:w1.localEventX,posY:w1.localEventY,bounds:w1.bounds,theme:Cr(k1,M.location),preventDefault:y1});gt!==void 0&&!we(gt)&&Da(gt)&&(A0([{location:w1.location,value:gt}]),(A1=G1.current)==null||A1.damage([{cell:w1.location}]))}if(!p4.current&&((ct=(at=K?.previousSelection)==null?void 0:at.current)==null?void 0:ct.cell)!==void 0&&q.current!==void 0){let[gt,Vt]=q.current.cell,[kt,i0]=K.previousSelection.current.cell;if(X===gt&&X===kt&&i1===Vt&&i1===i0)return b?.([X-P,i1]),yr(w1.bounds,!1),!0}}return!1},Y1=M.location[0]-P;if(M.isTouch){let w1=ut.current,A1=i6.current;if(w1.x!==A1.x||w1.y!==A1.y)return;if(M.isLongTouch===!0){if(M.kind==="cell"&&((T=q?.current)==null?void 0:T.cell[0])===X&&((J=q?.current)==null?void 0:J.cell[1])===i1){O?.([Y1,M.location[1]],{...M,preventDefault:y1});return}else if(M.kind==="header"&&q.columns.hasIndex(X)){W?.(Y1,{...M,preventDefault:y1});return}else if(M.kind===w2){if(Y1<0)return;p1?.(Y1,{...M,preventDefault:y1});return}}M.kind==="cell"?N1(M)||Br(M):M.kind===w2?d1?.(Y1,{...M,preventDefault:y1}):(M.kind===xe&&n1?.(Y1,{...M,preventDefault:y1}),Br(M));return}if(M.kind==="header"){if(Y1<0)return;M.isEdge?pi(X):M.button===0&&X===t1&&i1===m1&&n1?.(Y1,{...M,preventDefault:y1})}if(M.kind===w2){if(Y1<0)return;M.button===0&&X===t1&&i1===m1&&(d1?.(Y1,{...M,preventDefault:y1}),p4.current||l6(M))}M.kind==="cell"&&(M.button===0||M.button===1)&&N1(M),be.current=void 0},[u,P,q,k,fi,F0,z1,Cr,A0,b,yr,O,W,p1,Br,d1,pi,n1,l6]),Bm=$.useCallback(M=>{let A={...M,location:[M.location[0]-P,M.location[1]]};u1?.(A),o6(E=>{var T,J;return ao.current?[M.scrollEdge[0],0]:M.scrollEdge[0]===E?.[0]&&M.scrollEdge[1]===E[1]?E:u===void 0||((J=(T=f2.current)==null?void 0:T.location[0])!=null?J:0){Et?.(M-P,A)},[Et,P]),Ba=(n=q?.current)==null?void 0:n.cell,Am=$.useCallback((M,A,E,T,J,K)=>{xt.current=!1;let X=Ba;X!==void 0&&(X=[X[0]-P,X[1]]);let i1={x:M.x-P,y:M.y,width:M.width,height:H0&&M.y+M.height>=V?M.height-1:M.height,tx:J,ty:K,extras:{selected:X,freezeRegion:Q1===0?void 0:{x:0,y:M.y,width:Q1,height:M.height}}};ut.current=i1,Ca(i1),b1([A,E,T]),Z0?.(i1,i1.tx,i1.ty,i1.extras)},[Ba,P,H0,V,Q1,Ca,Z0]),Fm=jn(x1,$.useCallback((M,A)=>{x1?.(M-P,A-P),I!=="none"&&v0(mt.fromSingleSelection(A),void 0,!0)},[I,x1,P,v0])),no=$.useRef(!1),km=$.useCallback(M=>{if(M.location[0]===0&&P>0){M.preventDefault();return}e1?.({...M,location:[M.location[0]-P,M.location[1]]}),M.defaultPrevented()||(no.current=!0),p(void 0)},[e1,P]),bm=$.useCallback(()=>{no.current=!1},[]),Em=$.useCallback(M=>{var A,E;if(!(((A=f2?.current)==null?void 0:A.button)!==void 0&&f2.current.button>=1)){if(u!==void 0&&((E=f2.current)==null?void 0:E.location[0])===0&&M.location[0]===0&&P===1&&C1==="multi"&&u.previousSelection&&!u.previousSelection.rows.hasIndex(f2.current.location[1])&&q.rows.hasIndex(f2.current.location[1])){let T=Math.min(f2.current.location[1],M.location[1]),J=Math.max(f2.current.location[1],M.location[1])+1;S0(mt.fromSingleSelection([T,J]),void 0,!1)}if(u!==void 0&&q.current!==void 0&&!no.current&&(D==="rect"||D==="multi-rect")){let[T,J]=q.current.cell,[K,X]=M.location;if(X<0&&(X=ut.current.y),V2&&J===V)return;if(V2&&X===V)if(M.kind===O5)X--;else return;K=Math.max(K,P);let m1=K-T,y1=X-J,N1={x:m1>=0?T:K,y:y1>=0?J:X,width:Math.abs(m1)+1,height:Math.abs(y1)+1};c0({...q.current,range:N1},!0,!1,"drag")}Jt?.({...M,location:[M.location[0]-P,M.location[1]]})}},[u,P,C1,q,D,Jt,S0,V2,V,c0]),Ee=$.useCallback(M=>{if(q.current===void 0)return;let[A,E]=M,[T,J]=q.current.cell,K=q.current.range,X=K.x,i1=K.x+K.width,t1=K.y,m1=K.y+K.height;if(E!==0)switch(E){case 2:{m1=V,t1=J,Kt(0,m1,"vertical");break}case-2:{t1=0,m1=J+1,Kt(0,t1,"vertical");break}case 1:{t1J+1?(m1--,Kt(0,m1,"vertical")):(t1=Math.max(0,t1-1),Kt(0,t1,"vertical"));break}default:sr(E)}if(A!==0)if(A===2)i1=_1.length,X=T,Kt(i1-1-P,0,"horizontal");else if(A===-2)X=P,i1=T+1,Kt(X-P,0,"horizontal");else{let y1=[];if(P0!==void 0){let N1=P0({x:X,y:t1,width:i1-X-P,height:m1-t1},R2.current.signal);typeof N1=="object"&&(y1=p_(N1))}if(A===1){let N1=!1;if(X0){let Y1=(0,i4.default)(X+1,T+1).find(w1=>!y1.includes(w1-P));Y1!==void 0&&(X=Y1,N1=!0)}else X++,N1=!0;N1&&Kt(X,0,"horizontal")}N1||(i1=Math.min(_1.length,i1+1),Kt(i1-1-P,0,"horizontal"))}else if(A===-1){let N1=!1;if(i1>T+1){if(y1.length>0){let Y1=(0,i4.default)(i1-1,T,-1).find(w1=>!y1.includes(w1-P));Y1!==void 0&&(i1=Y1,N1=!0)}else i1--,N1=!0;N1&&Kt(i1-P,0,"horizontal")}N1||(X=Math.max(P,X-1),Kt(X-P,0,"horizontal"))}else sr(A)}c0({cell:q.current.cell,range:{x:X,y:t1,width:i1-X,height:m1-t1}},!0,!1,"keyboard-select")},[P0,q,_1.length,P,V,Kt,c0]),qa=$.useCallback((M,A,E,T)=>{let J=n0-(E?0:1);if(M=(0,Gn.default)(M,P,E1.length-1+P),A=(0,Gn.default)(A,0,J),M===Ba?.[0]&&A===Ba?.[1])return!1;if(T&&q.current!==void 0){let K=[...q.current.rangeStack];(q.current.range.width>1||q.current.range.height>1)&&K.push(q.current.range),J0({...q,current:{cell:[M,A],range:{x:M,y:A,width:1,height:1},rangeStack:K}},!0)}else c0({cell:[M,A],range:{x:M,y:A,width:1,height:1}},!0,!1,"keyboard-nav");return w.current!==void 0&&w.current[0]===M&&w.current[1]===A&&(w.current=void 0),Kt(M-P,A),!0},[n0,P,E1.length,Ba,q,Kt,J0,c0]),_m=$.useCallback((M,A)=>{c?.cell!==void 0&&M!==void 0&&Da(M)&&(A0([{location:c.cell,value:M}]),window.requestAnimationFrame(()=>{var J;(J=G1.current)==null||J.damage([{cell:c.cell}])})),Gt(!0),v(void 0);let[E,T]=A;if(q.current!==void 0&&(E!==0||T!==0)){let J=q.current.cell[1]===n0-1&&M!==void 0;qa((0,Gn.default)(q.current.cell[0]+E,0,_1.length-1),(0,Gn.default)(q.current.cell[1]+T,0,n0-1),J,!1)}F?.(M,A)},[c?.cell,Gt,q,F,A0,n0,qa,_1.length]),io=$.useMemo(()=>`gdg-overlay-${f_++}`,[]),Sr=$.useCallback(M=>{(async()=>{var E,T,J,K,X;let i1=!1;if(X1!==void 0&&X1({...M,cancel:()=>{i1=!0}}),i1)return;let t1=()=>{M.stopPropagation(),M.preventDefault()},m1=c!==void 0,{altKey:y1,shiftKey:N1,metaKey:Y1,ctrlKey:w1,key:A1,bounds:at}=M,ct=E5.value,k1=ct?Y1:w1,rt=A1==="Delete"||ct&&A1==="Backspace",gt=ut.current,Vt=q.columns,kt=q.rows;if(A1==="Escape"){m1?v(void 0):Lt.clear&&(J0(F5,!1),Mt?.());return}else if(T0("primary+a",M)&&Lt.selectAll){if(!m1)J0({columns:mt.empty(),rows:mt.empty(),current:{cell:(T=(E=q.current)==null?void 0:E.cell)!=null?T:[P,0],range:{x:P,y:0,width:L.length,height:V},rangeStack:[]}},!1);else{let zt=document.getElementById(io);if(zt!==null){let f0=window.getSelection(),k0=document.createRange();k0.selectNodeContents(zt),f0?.removeAllRanges(),f0?.addRange(k0)}}t1();return}else T0("primary+f",M)&&Lt.search&&(t1(),(J=g?.current)==null||J.focus({preventScroll:!0}),gi(!0));function i0(zt){var f0,k0,Ar,z4;Gt();let _e=[];for(let Te=zt.x;Te({cell:Te.location})))}if(rt){let zt=(K=Rr?.(q))!=null?K:!0;if(t1(),zt!==!1){let f0=zt===!0?q:zt;if(f0.current!==void 0){i0(f0.current.range);for(let k0 of f0.current.rangeStack)i0(k0)}for(let k0 of f0.rows)i0({x:P,y:k0,width:_1.length-P,height:1});for(let k0 of f0.columns)i0({x:k0,y:0,width:1,height:V})}return}if(q.current===void 0)return;let[Rt,ft]=q.current.cell,q0=!1;if(Lt.selectColumn&&T0("ctrl+ ",M)&&I!=="none")Vt.hasIndex(Rt)?v0(Vt.remove(Rt),void 0,!0):I==="single"?v0(mt.fromSingleSelection(Rt),void 0,!0):v0(void 0,Rt,!0);else if(Lt.selectRow&&T0("shift+ ",M)&&C1!=="none")kt.hasIndex(ft)?S0(kt.remove(ft),void 0,!0):C1==="single"?S0(mt.fromSingleSelection(ft),void 0,!0):S0(void 0,ft,!0);else if((T0("Enter",M)||T0(" ",M)||T0("shift+Enter",M))&&at!==void 0)m1?(v(void 0),T0("Enter",M)?ft++:T0("shift+Enter",M)&&ft--):ft===V&&H0?window.setTimeout(()=>{let zt=ui(Rt);u4(zt??Rt)},0):(b?.([Rt-P,ft]),yr(at,!0),t1());else if(Lt.downFill&&T0("primary+_68",M)&&q.current.range.height>1)fi(!1),t1();else if(Lt.rightFill&&T0("primary+_82",M)&&q.current.range.width>1){let zt=[],f0=q.current.range;for(let k0=0;k0({cell:k0.location}))),t1()}else if(Lt.pageDown&&T0("PageDown",M))ft+=Math.max(1,ut.current.height-4),t1();else if(Lt.pageUp&&T0("PageUp",M))ft-=Math.max(1,ut.current.height-4),t1();else if(Lt.first&&T0("primary+Home",M))v(void 0),ft=0,Rt=0;else if(Lt.last&&T0("primary+End",M))v(void 0),ft=Number.MAX_SAFE_INTEGER,Rt=Number.MAX_SAFE_INTEGER;else if(Lt.first&&T0("primary+shift+Home",M))v(void 0),Ee([-2,-2]);else if(Lt.last&&T0("primary+shift+End",M))v(void 0),Ee([2,2]);else if(A1==="ArrowDown"){if(w1&&y1)return;v(void 0),N1&&(D==="rect"||D==="multi-rect")?Ee([0,k1&&!y1?2:1]):(y1&&!k1&&(q0=!0),k1&&!y1?ft=V-1:ft+=1)}else if(A1==="ArrowUp"||A1==="Home"){let zt=A1==="Home"||k1;v(void 0),N1&&(D==="rect"||D==="multi-rect")?Ee([0,zt&&!y1?-2:-1]):(y1&&!zt&&(q0=!0),ft+=zt&&!y1?Number.MIN_SAFE_INTEGER:-1)}else if(A1==="ArrowRight"||A1==="End"){let zt=A1==="End"||k1;v(void 0),N1&&(D==="rect"||D==="multi-rect")?Ee([zt&&!y1?2:1,0]):(y1&&!zt&&(q0=!0),Rt+=zt&&!y1?Number.MAX_SAFE_INTEGER:1)}else if(A1==="ArrowLeft")v(void 0),N1&&(D==="rect"||D==="multi-rect")?Ee([k1&&!y1?-2:-1,0]):(y1&&!k1&&(q0=!0),Rt+=k1&&!y1?Number.MIN_SAFE_INTEGER:-1);else if(A1==="Tab")v(void 0),N1?Rt--:Rt++;else if(!Y1&&!w1&&q.current!==void 0&&A1.length===1&&/[ -~]/g.test(A1)&&at!==void 0&&gr(C([Rt-P,Math.max(0,ft-1)]))){if((!V2||ft!==V)&&(gt.y>ft||ft>gt.y+gt.height||gt.x>Rt||Rt>gt.x+gt.width))return;yr(at,!0,A1),t1()}qa(Rt,ft,!1,q0)&&t1()})()},[X1,c,q,Lt.selectAll,Lt.search,Lt.selectColumn,Lt.selectRow,Lt.downFill,Lt.rightFill,Lt.pageDown,Lt.pageUp,Lt.first,Lt.last,Lt.clear,I,C1,C,P,qa,J0,Mt,L.length,V,io,Gt,A0,z1,Rr,_1.length,v0,S0,H0,ui,u4,b,yr,fi,F0,Ee,D,V2]),Tm=$.useCallback((M,A)=>{let E=M.location[0]-P;if(M.kind==="header"&&W?.(E,{...M,preventDefault:A}),M.kind===w2){if(E<0)return;p1?.(E,{...M,preventDefault:A})}if(M.kind==="cell"){let[T,J]=M.location;O?.([E,J],{...M,preventDefault:A}),ck(q,M.location)||qa(T,J,!1,!1)}},[q,O,p1,W,P,qa]),lo=$.useCallback(async M=>{var A,E,T,J,K,X,i1;if(!Lt.paste)return;function t1(w1,A1,at){var ct,k1;if(!we(w1)&&gr(w1)&&w1.readonly!==!0){let rt=_?.(at,w1);if(rt!==void 0&&Da(rt))return rt.kind!==w1.kind&&console.warn("Coercion should not change cell kind."),{location:A1,value:rt};let gt=z1(w1);if(gt===void 0)return;if(gt.kind===l1.Custom){i2(w1.kind===l1.Custom);let Vt=(ct=gt.onPaste)==null?void 0:ct.call(gt,at,w1.data);return Vt===void 0?void 0:{location:A1,value:{...w1,data:Vt}}}else{let Vt=(k1=gt.onPaste)==null?void 0:k1.call(gt,at,w1);return Vt===void 0?void 0:(i2(Vt.kind===w1.kind),{location:A1,value:Vt})}}}let m1=q.columns,y1=q.rows,N1=((A=z.current)==null?void 0:A.contains(document.activeElement))===!0||((E=d.current)==null?void 0:E.contains(document.activeElement))===!0,Y1=(T=q.current)==null?void 0:T.cell;if(Y1===void 0&&m1.length===1&&(Y1=[(J=m1.first())!=null?J:0,0]),Y1===void 0&&y1.length===1&&(Y1=[P,(K=y1.first())!=null?K:0]),N1&&Y1!==void 0){let w1,A1,at="text/plain",ct="text/html";if(navigator.clipboard.read!==void 0){let Vt=await navigator.clipboard.read();for(let kt of Vt){if(kt.types.includes(ct)){let Rt=await(await kt.getType(ct)).text(),ft=document.createElement("html");ft.innerHTML=Rt;let q0=ft.querySelector("table");if(q0!==null){w1=jp(q0);break}}kt.types.includes(at)&&(A1=await(await kt.getType(at)).text())}}else if(navigator.clipboard.readText!==void 0)A1=await navigator.clipboard.readText();else if(M!==void 0&&M?.clipboardData!==null){if(M.clipboardData.types.includes(ct)){let Vt=M.clipboardData.getData(ct),kt=document.createElement("html");kt.innerHTML=Vt;let i0=kt.querySelector("table");i0!==null&&(w1=jp(i0))}w1===void 0&&M.clipboardData.types.includes(at)&&(A1=M.clipboardData.getData(at))}else return;let[k1,rt]=Y1,gt=[];do{if(M1===void 0){let Vt=F0(Y1),kt=t1(Vt,Y1,(X=A1??w1?.map(i0=>i0.join(" ")).join(" "))!=null?X:"");kt!==void 0&>.push(kt);break}if(w1===void 0){if(A1===void 0)return;w1=yE(A1)}if(M1===!1||typeof M1=="function"&&M1?.([Y1[0]-P,Y1[1]],w1)!==!0)return;for(let[Vt,kt]of w1.entries()){if(Vt+rt>=V)break;for(let[i0,Rt]of kt.entries()){let ft=[i0+k1,Vt+rt],q0=F0(ft),Ga=t1(q0,ft,Rt);Ga!==void 0&>.push(Ga)}}}while(!1);A0(gt),(i1=G1.current)==null||i1.damage(gt.map(Vt=>({cell:Vt.location})))}},[_,z1,F0,q,Lt.paste,A0,M1,P,V]);W0("paste",lo,window,!1,!0);let oo=$.useCallback(async(M,A)=>{var E,T;if(!Lt.copy)return;let J=A===!0||((E=z.current)==null?void 0:E.contains(document.activeElement))===!0||((T=d.current)==null?void 0:T.contains(document.activeElement))===!0,K=q.columns,X=q.rows,i1=(t1,m1)=>{if(!I1)qp(t1,m1,M);else{let y1=m1.map(N1=>({kind:l1.Text,data:L[N1].title,displayData:L[N1].title,allowOverlay:!1}));qp([y1,...t1],m1,M)}};if(J&&P0!==void 0){if(q.current!==void 0){let t1=P0(q.current.range,R2.current.signal);typeof t1!="object"&&(t1=await t1()),i1(t1,(0,i4.default)(q.current.range.x-P,q.current.range.x+q.current.range.width-P))}else if(X!==void 0&&X.length>0){let m1=[...X].map(y1=>{let N1=P0({x:P,y:y1,width:L.length,height:1},R2.current.signal);return typeof N1=="object"?N1[0]:N1().then(Y1=>Y1[0])});if(m1.some(y1=>y1 instanceof Promise)){let y1=await Promise.all(m1);i1(y1,(0,i4.default)(L.length))}else i1(m1,(0,i4.default)(L.length))}else if(K.length>0){let t1=[],m1=[];for(let y1 of K){let N1=P0({x:y1,y:0,width:1,height:V},R2.current.signal);typeof N1!="object"&&(N1=await N1()),t1.push(N1),m1.push(y1-P)}if(t1.length===1)i1(t1[0],m1);else{let y1=t1.reduce((N1,Y1)=>N1.map((w1,A1)=>[...w1,...Y1[A1]]));i1(y1,m1)}}}},[L,P0,q,Lt.copy,P,V,I1]);W0("copy",oo,window,!1,!1);let Pm=$.useCallback((M,A)=>{if(K1!==void 0){P!==0&&(M=M.map(J=>[J[0]-P,J[1]])),K1(M,A);return}if(M.length===0||A===-1)return;let[E,T]=M[A];w.current!==void 0&&w.current[0]===E&&w.current[1]===T||(w.current=[E,T],qa(E,T,!1,!1))},[K1,P,qa]),[zi,mi]=(l=(i=B0?.current)==null?void 0:i.cell)!=null?l:[],h6=$.useRef(Kt);h6.current=Kt,$.useLayoutEffect(()=>{var M,A,E,T;!xt.current&&zi!==void 0&&mi!==void 0&&(zi!==((A=(M=Ra.current)==null?void 0:M.current)==null?void 0:A.cell[0])||mi!==((T=(E=Ra.current)==null?void 0:E.current)==null?void 0:T.cell[1]))&&h6.current(zi,mi),xt.current=!1},[zi,mi]);let c6=q.current!==void 0&&(q.current.cell[0]>=_1.length||q.current.cell[1]>=n0);$.useLayoutEffect(()=>{c6&&J0(F5,!1)},[c6,J0]);let Im=$.useMemo(()=>H0===!0&&wt?.tint===!0?mt.fromSingleSelection(n0-1):mt.empty(),[n0,H0,wt?.tint]),Om=$.useCallback(M=>{var A;return typeof c2=="boolean"?c2:(A=c2?.(M-P))!=null?A:!0},[P,c2]),Dm=$.useMemo(()=>{if(eo===void 0||d.current===null)return null;let{bounds:M,group:A}=eo,E=d.current.getBoundingClientRect();return $.createElement(ME,{bounds:M,group:A,canvasBounds:E,onClose:()=>ro(void 0),onFinish:T=>{ro(void 0),o1?.(A,T)}})},[o1,eo]),Nm=Math.min(_1.length,Q1+(s2?1:0));$.useImperativeHandle(a,()=>({appendRow:(M,A)=>u4(M+P,A),updateCells:M=>{var A;return P!==0&&(M=M.map(E=>({cell:[E.cell[0]+P,E.cell[1]]}))),(A=G1.current)==null?void 0:A.damage(M)},getBounds:(M,A)=>{var E;return(E=G1.current)==null?void 0:E.getBounds(M+P,A)},focus:()=>{var M;return(M=G1.current)==null?void 0:M.focus()},emit:async M=>{switch(M){case"delete":Sr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":Sr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":Sr({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await oo(void 0,!0);break;case"paste":await lo();break}},scrollTo:Kt,remeasureColumns:M=>{for(let A of M)pi(A+P,!0)}}),[u4,pi,oo,Sr,lo,P,Kt]);let[v6,g6]=Ba??[],$m=$.useCallback(M=>{let[A,E]=M;if(E===-1){I!=="none"&&(v0(mt.fromSingleSelection(A),void 0,!1),Gt());return}v6===A&&g6===E||(c0({cell:M,range:{x:A,y:E,width:1,height:1}},!0,!1,"keyboard-nav"),Kt(A,E))},[I,Gt,Kt,v6,g6,c0,v0]),[Um,Wm]=$.useState(!1),d6=$.useRef((0,az.default)(M=>{Wm(M)},5)),jm=$.useCallback(()=>{d6.current(!0),q.current===void 0&&q.columns.length===0&&q.rows.length===0&&u===void 0&&c0({cell:[P,u2],range:{x:P,y:u2,width:1,height:1}},!0,!1,"keyboard-select")},[u2,q,u,P,c0]),qm=$.useCallback(()=>{d6.current(!1)},[]),[Gm,Km]=$.useMemo(()=>{var M;let A,E=(M=Ht?.scrollbarWidthOverride)!=null?M:kk(),T=V+(H0?1:0);if(typeof M0=="number")A=$1+T*M0;else{let K=0,X=Math.min(T,10);for(let i1=0;i1X.width+K,0)+E;return[`${Math.min(1e5,J)}px`,`${Math.min(1e5,A)}px`]},[_1,Ht?.scrollbarWidthOverride,M0,V,H0,$1]);return $.createElement(oz.Provider,{value:S},$.createElement(kE,{style:iz(S),className:a1,inWidth:y??Gm,inHeight:R??Km},$.createElement(pE,{fillHandle:ri,drawFocusRing:u0,experimental:Ht,fixedShadowX:m0,fixedShadowY:j5,getRowThemeOverride:H,headerIcons:ia,imageWindowLoader:ni,initialSize:xr,isDraggable:Se,onDragLeave:Ae,onRowMoved:la,overscrollX:vi,overscrollY:K5,preventDiagonalScrolling:xa,rightElement:q5,rightElementProps:ii,showMinimap:G5,smoothScrollX:li,smoothScrollY:c4,className:a1,enableGroups:h1,onCanvasFocused:jm,onCanvasBlur:qm,canvasRef:d,onContextMenu:Tm,theme:S,cellXOffset:B2,cellYOffset:u2,accessibilityHeight:_t.height,onDragEnd:bm,columns:_1,drawCustomCell:v1,drawHeader:s4,disabledRows:Im,freezeColumns:Nm,lockColumns:P,firstColAccessible:P===0,getCellContent:F0,minColumnWidth:wa,maxColumnWidth:Ua,searchInputRef:g,showSearch:Y5,onSearchClose:Q5,highlightRegions:Vm,getCellsForSelection:P0,getGroupDetails:to,headerHeight:Va,isFocused:Um,groupHeaderHeight:h1?g4:0,trailingRowType:H0?wt?.sticky===!0?"sticky":"appended":"none",onColumnResize:ya,onColumnResizeEnd:J5,onColumnResizeStart:Vr,onCellFocused:$m,onColumnMoved:Fm,onDragStart:km,onHeaderMenuClick:Sm,onItemHovered:Em,isFilling:u?.fillHandle===!0,onMouseMove:Bm,onKeyDown:Sr,onKeyUp:Y,onMouseDown:Rm,onMouseUp:Cm,onDragOverCell:v2,onDrop:$a,onSearchResultsChanged:Pm,onVisibleRegionChanged:Am,clientSize:[G[0],G[1]],rowHeight:M0,searchResults:W1,searchValue:T1,onSearchValueChange:Bt,rows:n0,scrollRef:z,selection:q,translateX:_t.tx,translateY:_t.ty,verticalBorder:Om,gridRef:G1,getCellRenderer:z1,scrollToEnd:Fe}),Dm,c!==void 0&&$.createElement(Lk,{...c,validateCell:di,id:io,getCellRenderer:z1,className:Ht?.isSubGrid===!0?"click-outside-ignore":void 0,provideEditor:h0,imageEditorOverride:m,onFinishEditing:_m,markdownDivCreateNode:x,isOutsideClick:J8})))},Yz=$.forwardRef(z_);var mr=F1(U1());var j8=F1(U1()),q8={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},G8=j8.default.createContext&&j8.default.createContext(q8);var Ce=function(){return Ce=Object.assign||function(t){for(var a,e=1,r=arguments.length;et.length)&&(a=t.length);for(var e=0,r=new Array(a);e=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
+`&&(e.push(r),r=[])),i=0);break}l++}return n0;){let l=r.pop();if(l===void 0)break;l instanceof HTMLTableElement||l.nodeName==="TBODY"?r.push(...[...l.children].reverse()):l instanceof HTMLTableRowElement?(i!==void 0&&n.push(i),i=[],r.push(...[...l.children].reverse())):l instanceof HTMLTableCellElement&&i?.push((e=(a=l.innerText)!=null?a:l.textContent)!=null?e:"")}return i!==void 0&&n.push(i),n}function xe(t){return/[\t\n",]/.test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}var CE=t=>{switch(t){case!0:return"TRUE";case!1:return"FALSE";case I8:return"INDETERMINATE";case Qn:return"";default:sr(t,`A boolean was formated with invalid type: ${typeof t}`)}};function Oz(t,a,e,r){var n,i;let l=r[a];if(t.span!==void 0&&t.span[0]!==l)return"";if(t.copyData!==void 0)return xe(t.copyData);switch(t.kind){case n1.Text:case n1.Number:return xe(e?(i=(n=t.data)==null?void 0:n.toString())!=null?i:"":t.displayData);case n1.Markdown:case n1.RowID:case n1.Uri:return xe(t.data);case n1.Image:case n1.Bubble:return t.data.length===0?"":t.data.reduce((o,h)=>`${xe(o)},${xe(h)}`);case n1.Boolean:return CE(t.data);case n1.Loading:return e?"":"#LOADING";case n1.Protected:return e?"":"************";case n1.Drilldown:return t.data.length===0?"":t.data.map(o=>o.text).reduce((o,h)=>`${xe(o)},${xe(h)}`);case n1.Custom:return xe(t.copyData);default:sr(t,`A cell was passed with an invalid kind: ${t.kind}`)}}function BE(t,a){return t.map(e=>e.map((r,n)=>Oz(r,n,!1,a)).join(" ")).join(`
+`)}function qp(t,a,e){var r,n,i,l;let o=BE(t,a);if(((r=window.navigator.clipboard)==null?void 0:r.write)!==void 0||e!==void 0){let h=document.createElement("tbody");for(let c of t){let v=document.createElement("tr");for(let[g,d]of c.entries()){let u=document.createElement("td");if(d.kind===n1.Uri){let p=document.createElement("a");p.href=d.data,p.innerText=d.data,u.append(p)}else u.innerText=Oz(d,g,!0,a);v.append(u)}h.append(v)}if(((n=window.navigator.clipboard)==null?void 0:n.write)!==void 0)window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([``],{type:"text/html"})})]);else if(e!==void 0&&e?.clipboardData!==null)try{e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",``)}catch{(i=window.navigator.clipboard)==null||i.writeText(o)}}else(l=window.navigator.clipboard)==null||l.writeText(o);e?.preventDefault()}function Gp(t){return typeof t=="string"?t:`${t}px`}var SE=()=>t=>t.innerWidth,AE=()=>t=>t.innerHeight,FE=L0("div")({name:"Wrapper",class:"wzg2m5k",vars:{"wzg2m5k-0":[SE()],"wzg2m5k-1":[AE()]}}),kE=t=>{let{inWidth:a,inHeight:e,children:r,...n}=t;return Dz.createElement(FE,{innerHeight:Gp(e),innerWidth:Gp(a),...n},r)};function Nz(t){return t!==!0}var Kp=20,bE={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:"false"},kind:n1.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>{var a;return Xk(t,t.cell.data,S8(t.cell),(a=t.cell.maxSize)!=null?a:Kp)},onDelete:t=>({...t,data:!1}),onClick:t=>{var a,e;let{cell:r,posX:n,posY:i,bounds:l,theme:o}=t,{width:h,height:c,x:v,y:g}=l,d=(a=r.maxSize)!=null?a:Kp,u=Math.floor(l.y+c/2),p=Mz(d,c,o.cellVerticalPadding),z=mz((e=r.contentAlign)!=null?e:"center",v,h,o.cellHorizontalPadding,p),w=zz(z,u,p),s=Hz(v+n,g+i,w);if(S8(r)&&s)return{...r,data:Nz(r.data)}},onPaste:(t,a)=>{let e=Qn;return t.toLowerCase()==="true"?e=!0:t.toLowerCase()==="false"?e=!1:t.toLowerCase()==="indeterminate"&&(e=I8),e===a.data?void 0:{...a,data:e}}},EE=2,_E=1300;function TE(t,a){let e=T8.default.useRef(0),[r,n]=t??[0,0];T8.default.useEffect(()=>{if(r===0&&n===0){e.current=0;return}let i=0,l=h=>{var c;if(i===0)i=h;else{let v=h-i;e.current=Math.min(1,e.current+v/_E);let g=e.current**1.618*v*EE;(c=a.current)==null||c.scrollBy(r*g,n*g),i=h}o=window.requestAnimationFrame(l)},o=window.requestAnimationFrame(l);return()=>window.cancelAnimationFrame(o)},[a,r,n])}var PE=L0("div")({name:"BubblesOverlayEditorStyle",class:"b1bqsp5z"}),IE=t=>{let{bubbles:a}=t;return P5.createElement(PE,null,a.map((e,r)=>P5.createElement("div",{key:r,className:"boe-bubble"},e)),P5.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},OE=IE,DE={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:n1.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n).width+r+20,0)+2*e.cellHorizontalPadding-4,draw:t=>Yk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return $z.createElement(OE,{bubbles:a.data})},onPaste:()=>{}},NE=L0("div")({name:"DrilldownOverlayEditorStyle",class:"df2kt4a"}),$E=t=>{let{drilldowns:a}=t;return Xn.createElement(NE,null,a.map((e,r)=>Xn.createElement("div",{key:r,className:"doe-bubble"},e.img!==void 0&&Xn.createElement("img",{src:e.img}),Xn.createElement("div",null,e.text))))},UE=$E,WE={getAccessibilityString:t=>t.data.map(a=>a.text).join(", "),kind:n1.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,a,e)=>a.data.reduce((r,n)=>t.measureText(n.text).width+r+20+(n.img!==void 0?18:0),0)+2*e.cellHorizontalPadding-4,draw:t=>Zk(t,t.cell.data),provideEditor:()=>t=>{let{value:a}=t;return Uz.createElement(UE,{drilldowns:a.data})},onPaste:()=>{}},jE=L0("div")({name:"ImageOverlayEditorStyle",class:"i1eozt10"}),qE=t=>{let{urls:a,canWrite:e,onEditClick:r,renderImage:n}=t,i=a.filter(o=>o!=="");if(i.length===0)return null;let l=i.length>1;return n4.createElement(jE,{"data-testid":"GDG-default-image-overlay-editor"},n4.createElement(jz.Carousel,{showArrows:l,showThumbs:!1,swipeable:l,emulateTouch:l,infiniteLoop:l},i.map(o=>{var h;let c=(h=n?.(o))!=null?h:n4.createElement("img",{draggable:!1,src:o});return n4.createElement("div",{className:"centering-container",key:o},c)})),e&&r&&n4.createElement("button",{className:"edit-icon",onClick:r},n4.createElement(D8,null)))},GE={getAccessibilityString:t=>t.data.join(", "),kind:n1.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>{var a;return Jk(t,(a=t.cell.displayData)!=null?a:t.cell.data,t.cell.rounding,t.cell.contentAlign)},measure:(t,a)=>a.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{let{value:a,onFinishedEditing:e,imageEditorOverride:r}=t;return Wz.createElement(r??qE,{urls:a.data,canWrite:a.allowAdd,onCancel:e,onChange:i=>{e({...a,data:[i]})}})},onPaste:(t,a)=>{t=t.trim();let r=t.split(",").map(n=>{try{return new URL(n),n}catch{return}}).filter(n=>n!==void 0);if(!(r.length===a.data.length&&r.every((n,i)=>n===a.data[i])))return{...a,data:r}}},KE={getAccessibilityString:()=>"",kind:n1.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:()=>{},onPaste:()=>{}},XE=L0("div")({name:"MarkdownContainer",class:"mlbeo71"}),YE=class extends P8.default.PureComponent{constructor(){super(...arguments),this.targetElement=null,this.containerRefHook=t=>{this.targetElement=t,this.renderMarkdownIntoDiv()}}renderMarkdownIntoDiv(){let{targetElement:t,props:a}=this;if(t===null)return;let{contents:e,createNode:r}=a,n=j1(e),i=document.createRange();i.selectNodeContents(t),i.deleteContents();let l=r?.(n);if(l===void 0){let h=document.createElement("template");h.innerHTML=n,l=h.content}t.append(l);let o=t.getElementsByTagName("a");for(let h of o)h.target="_blank",h.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),P8.default.createElement(XE,{ref:this.containerRefHook})}},QE=L0("textarea")({name:"InputBox",class:"ijuk0po"}),ZE=L0("div")({name:"ShadowBox",class:"saq3p5l"}),JE=L0("div")({name:"GrowingEntryStyle",class:"gf8vzix"}),Xp=0,N5=t=>{let{placeholder:a,value:e,onKeyDown:r,highlight:n,altNewline:i,validatedSelection:l,...o}=t,{onChange:h,className:c}=o,v=h2.useRef(null),g=e??"";i2(h!==void 0,"GrowingEntry must be a controlled input area");let[d]=h2.useState(()=>"input-box-"+(Xp=(Xp+1)%1e7));h2.useEffect(()=>{let p=v.current;if(p===null||p.disabled)return;let z=g.toString().length;p.focus(),p.setSelectionRange(n?0:z,z)},[]),h2.useLayoutEffect(()=>{var p;if(l!==void 0){let z=typeof l=="number"?[l,null]:l;(p=v.current)==null||p.setSelectionRange(z[0],z[1])}},[l]);let u=h2.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&i===!0||r?.(p)},[i,r]);return h2.createElement(JE,{className:"gdg-growing-entry"},h2.createElement(ZE,{className:c},g+`
+`),h2.createElement(QE,{...o,className:(c??"")+" gdg-input",id:d,ref:v,onKeyDown:u,value:g,placeholder:a,dir:"auto"}))},t_=()=>t=>t.targetWidth,Yp=L0("div")({name:"MarkdownOverlayEditorStyle",class:"mdwzdl1",vars:{"mdwzdl1-0":[t_(),"px"]}}),a_=t=>{let{value:a,onChange:e,forceEditMode:r,createNode:n,targetRect:i,onFinish:l,validatedSelection:o}=t,h=a.data,c=a.readonly===!0,[v,g]=R0.useState(h===""||r),d=R0.useCallback(()=>{g(p=>!p)},[]),u=h?"ml-6":"";return v?R0.createElement(Yp,{targetWidth:i.width-20},R0.createElement(N5,{autoFocus:!0,highlight:!1,validatedSelection:o,value:h,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:e}),R0.createElement("div",{className:`edit-icon checkmark-hover ${u}`,onClick:()=>l(a)},R0.createElement(Bk,null))):R0.createElement(Yp,{targetWidth:i.width},R0.createElement(YE,{contents:h,createNode:n}),!c&&R0.createElement(R0.Fragment,null,R0.createElement("div",{className:"spacer"}),R0.createElement("div",{className:`edit-icon edit-hover ${u}`,onClick:d},R0.createElement(D8,null))),R0.createElement("textarea",{className:"md-edit-textarea gdg-input",autoFocus:!0}))},e_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:n1.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Jn,measure:(t,a,e)=>{let r=a.data.split(`
+`)[0];return t.measureText(r).width+2*e.cellHorizontalPadding},draw:t=>ti(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{let{onChange:a,value:e,target:r,onFinishedEditing:n,markdownDivCreateNode:i,forceEditMode:l,validatedSelection:o}=t;return qz.createElement(a_,{onFinish:n,targetRect:r,value:e,validatedSelection:o,onChange:h=>a({...e,data:h.target.value}),forceEditMode:l,createNode:i})},onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},r_={getAccessibilityString:t=>t.row.toString(),kind:o2.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:jk,measure:()=>44,draw:t=>Gk(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle),onClick:t=>{let{bounds:a,cell:e,posX:r,posY:n}=t,{width:i,height:l}=a,o=e.drawHandle?7+(i-7)/2:i/2,h=l/2;if(Math.abs(r-o)<=10&&Math.abs(n-h)<=10)return{...e,checked:!e.checked}},onPaste:()=>{}},n_={getAccessibilityString:()=>"",kind:o2.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>Wk(t,t.cell.hint,t.cell.icon),onPaste:()=>{}},i_=o4.lazy(async()=>await Promise.resolve().then(()=>(Ap(),Sp))),l_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:n1.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Jn,draw:t=>ti(t,t.cell.displayData,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.displayData).width+16,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return o4.createElement(o4.Suspense,{fallback:null},o4.createElement(i_,{highlight:a,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:n,onChange:i=>{var l;return e({...r,data:Number.isNaN((l=i.floatValue)!=null?l:0)?0:i.floatValue})}}))},onPaste:(t,a)=>{let e=Number.parseFloat(t);if(!(Number.isNaN(e)||a.data===e))return{...a,data:e}}},o_={getAccessibilityString:()=>"",measure:()=>108,kind:n1.Protected,needsHover:!1,needsHoverPosition:!1,draw:Kk,onPaste:()=>{}},h_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:n1.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,a)=>Jn(t,a,t.theme.textLight),draw:t=>ti(t,t.cell.data,t.cell.contentAlign),measure:(t,a)=>t.measureText(a.data).width+16,provideEditor:()=>t=>{let{isHighlighted:a,onChange:e,value:r,validatedSelection:n}=t;return Gz.default.createElement(N5,{highlight:a,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:n,onChange:i=>e({...r,data:i.target.value})})},onPaste:()=>{}},c_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:n1.Text,needsHover:!1,needsHoverPosition:!1,drawPrep:Jn,useLabel:!0,draw:t=>(ti(t,t.cell.displayData,t.cell.contentAlign,t.cell.allowWrapping,t.hyperWrapping),!0),measure:(t,a,e)=>{let r=a.displayData.split(`
+`).slice(0,a.allowWrapping===!0?void 0:1);return Math.max(...r.map(n=>t.measureText(n).width+2*e.cellHorizontalPadding))},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:a=>{let{isHighlighted:e,onChange:r,value:n,validatedSelection:i}=a;return Kz.createElement(N5,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:e,autoFocus:n.readonly!==!0,disabled:n.readonly===!0,altNewline:!0,value:n.data,validatedSelection:i,onChange:l=>r({...n,data:l.target.value})})}}),onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},v_=L0("div")({name:"UriOverlayEditorStyle",class:"uf0sjo8"}),g_=t=>{let{uri:a,onChange:e,forceEditMode:r,readonly:n,validatedSelection:i,preview:l}=t,[o,h]=ea.useState(a===""||r),c=ea.useCallback(()=>{h(!0)},[]);return o?ea.createElement(N5,{validatedSelection:i,highlight:!0,autoFocus:!0,value:a,onChange:e}):ea.createElement(v_,null,ea.createElement("a",{className:"link-area",href:a,target:"_blank",rel:"noopener noreferrer"},l),!n&&ea.createElement("div",{className:"edit-icon",onClick:c},ea.createElement(D8,null)),ea.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},d_=g_,s_={getAccessibilityString:t=>{var a,e;return(e=(a=t.data)==null?void 0:a.toString())!=null?e:""},kind:n1.Uri,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Jn,draw:t=>ti(t,t.cell.data,t.cell.contentAlign),measure:(t,a,e)=>t.measureText(a.data).width+e.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{var a;let{onChange:e,value:r,forceEditMode:n,validatedSelection:i}=t;return Xz.createElement(d_,{forceEditMode:n,uri:r.data,preview:(a=r.displayData)!=null?a:r.data,validatedSelection:i,readonly:r.readonly===!0,onChange:l=>e({...r,data:l.target.value})})},onPaste:(t,a)=>t===a.data?void 0:{...a,data:t}},u_={[o2.Marker]:r_,[o2.NewRow]:n_,[n1.Boolean]:bE,[n1.Bubble]:DE,[n1.Drilldown]:WE,[n1.Image]:GE,[n1.Loading]:KE,[n1.Markdown]:e_,[n1.Number]:l_,[n1.Protected]:o_,[n1.RowID]:h_,[n1.Text]:c_,[n1.Uri]:s_},f_=0;function p_(t){return(0,tz.default)((0,B8.default)((0,B8.default)(t).filter(a=>a.span!==void 0).map(a=>{var e,r,n,i;return(0,i4.default)(((r=(e=a.span)==null?void 0:e[0])!=null?r:0)+1,((i=(n=a.span)==null?void 0:n[1])!=null?i:0)+1)})))}function A5(t,a){return t===void 0||a===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+a,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+a},rangeStack:t.current.rangeStack.map(e=>({...e,x:e.x+a}))},rows:t.rows,columns:t.columns.offset(a)}}var Qp={selectAll:!0,selectRow:!0,selectColumn:!0,downFill:!1,rightFill:!1,pageUp:!1,pageDown:!1,clear:!0,copy:!0,paste:!0,search:!1,first:!0,last:!0},Zp={kind:n1.Loading,allowOverlay:!1},F5={columns:mt.empty(),rows:mt.empty(),current:void 0},z_=(t,a)=>{var e,r,n,i,l;let[o,h]=$.useState(F5),[c,v]=$.useState(),g=$.useRef(null),d=$.useRef(null),[u,p]=$.useState(),z=$.useRef(null),w=$.useRef(),{rowMarkers:s="none",rowMarkerWidth:f,imageEditorOverride:m,getRowThemeOverride:H,markdownDivCreateNode:x,width:y,height:R,columns:L,rows:V,getCellContent:C,onCellClicked:k,onCellActivated:b,onFinishedEditing:F,coercePasteValue:_,drawHeader:j,onHeaderClicked:i1,spanRangeBehavior:Z="default",onGroupHeaderClicked:d1,onCellContextMenu:O,className:a1,onHeaderContextMenu:W,getCellsForSelection:L1,onGroupHeaderContextMenu:p1,onGroupHeaderRenamed:o1,onCellEdited:H1,onCellsEdited:P1,onSearchResultsChanged:K1,searchResults:W1,onSearchValueChange:Bt,searchValue:T1,onKeyDown:X1,onKeyUp:Y,keybindings:N,onRowAppended:s1,onColumnMoved:x1,validateCell:f1,highlightRegions:U,drawCell:v1,rangeSelect:D="rect",columnSelect:I="multi",rowSelect:C1="multi",rangeSelectionBlending:D1="exclusive",columnSelectionBlending:et="exclusive",rowSelectionBlending:B1="exclusive",onDelete:h1,onDragStart:e1,onMouseMove:u1,onPaste:M1,copyHeaders:I1=!1,freezeColumns:Q1=0,rowSelectionMode:St="auto",rowMarkerStartIndex:jt=1,rowMarkerTheme:Ut,onHeaderMenuClick:Et,getGroupDetails:ot,onSearchClose:J1,onItemHovered:Jt,onSelectionCleared:Mt,showSearch:C0,onVisibleRegionChanged:Z0,gridSelection:B0,onGridSelectionChange:t0,minColumnWidth:Ma=50,maxColumnWidth:dt=500,maxColumnAutoWidth:At,provideEditor:h0,trailingRowOptions:wt,scrollOffsetX:Ft,scrollOffsetY:qt,verticalBorder:c2,onDragOverCell:v2,onDrop:Ua,onColumnResize:O2,onColumnResizeEnd:j0,onColumnResizeStart:g2,customRenderers:D2,fillHandle:ri,drawFocusRing:u0,experimental:Ht,fixedShadowX:m0,fixedShadowY:j5,headerIcons:ia,imageWindowLoader:ni,initialSize:xr,isDraggable:Se,onDragLeave:Ae,onRowMoved:la,overscrollX:Ha,overscrollY:oa,preventDiagonalScrolling:xa,rightElement:q5,rightElementProps:ii,showMinimap:G5,smoothScrollX:li,smoothScrollY:c4,scrollToEnd:Fe,scaleToRem:oi=!1,rowHeight:wr=34,headerHeight:ke=36,groupHeaderHeight:v4=ke,theme:d2,isOutsideClick:J8}=t,wa=Math.max(Ma,20),Wa=Math.max(dt,wa),hi=Math.max(At??Wa,wa),La=$.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]).fontSize,ha=$.useMemo(()=>Number.parseFloat(La),[La]),[M0,Va,g4,Lr,vi,K5]=$.useMemo(()=>{var M,A,E;if(!oi||ha===16)return[wr,ke,v4,d2,Ha,oa];let T=ha/16,J=wr,K=kp();return[typeof J=="number"?J*T:X=>Math.ceil(J(X)*T),Math.ceil(ke*T),Math.ceil(v4*T),{...d2,headerIconSize:((M=d2?.headerIconSize)!=null?M:K.headerIconSize)*T,cellHorizontalPadding:((A=d2?.cellHorizontalPadding)!=null?A:K.cellHorizontalPadding)*T,cellVerticalPadding:((E=d2?.cellVerticalPadding)!=null?E:K.cellVerticalPadding)*T},Math.ceil((Ha??0)*T),Math.ceil((oa??0)*T)]},[v4,ke,Ha,oa,ha,wr,oi,d2]),Lt=$.useMemo(()=>N===void 0?Qp:{...Qp,...N},[N]),ja=f??(V>1e4?48:V>1e3?44:V>100?36:32),s2=s!=="none",P=s2?1:0,H0=s1!==void 0,V2=wt?.sticky===!0,[X5,gi]=$.useState(!1),Y5=C0??X5,Q5=$.useCallback(()=>{J1!==void 0?J1():gi(!1)},[J1]),d4=$.useMemo(()=>B0===void 0?void 0:A5(B0,P),[B0,P]),q=d4??o,R2=$.useRef(new AbortController);$.useEffect(()=>()=>{R2?.current.abort()},[]);let[P0,Z5]=VE(L1,C,P,R2.current,V),di=$.useCallback((M,A,E)=>{if(f1===void 0)return!0;let T=[M[0]-P,M[1]];return f1?.(T,A,E)},[P,f1]),Ra=$.useRef(B0),J0=$.useCallback((M,A)=>{A&&(M=RE(M,P0,P,Z,R2.current)),t0!==void 0?(Ra.current=A5(M,-P),t0(Ra.current)):h(M)},[t0,P0,P,Z]),ya=jn(O2,$.useCallback((M,A,E,T)=>{O2?.(L[E-P],A,E-P,T)},[O2,P,L])),J5=jn(j0,$.useCallback((M,A,E,T)=>{j0?.(L[E-P],A,E-P,T)},[j0,P,L])),Vr=jn(g2,$.useCallback((M,A,E,T)=>{g2?.(L[E-P],A,E-P,T)},[g2,P,L])),s4=jn(j,$.useCallback(M=>{var A;return(A=j?.({...M,columnIndex:M.columnIndex-P}))!=null?A:!1},[j,P])),Rr=$.useCallback(M=>{if(h1!==void 0){let A=h1(A5(M,-P));return typeof A=="boolean"?A:A5(A,P)}return!0},[h1,P]),[c0,S0,v0]=LE(q,J0,D1,et,B1,D),S=$.useMemo(()=>({...kp(),...Lr}),[Lr]),[G,b1]=$.useState([10,10,0]),z1=$.useCallback(M=>M.kind!==n1.Custom?u_[M.kind]:D2?.find(A=>A.isMatch(M)),[D2]),E1=xE(L,V,Z5,G[0]-(P===0?0:ja)-G[2],wa,hi,S,z1,R2.current),c1=$.useMemo(()=>E1.some(M=>M.group!==void 0),[E1]),$1=c1?Va+g4:Va,st=q.rows.length,S1=s==="none"?"":st===0?vz:st===V?cz:vk,_1=$.useMemo(()=>s==="none"?E1:[{title:S1,width:ja,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Ut},...E1],[E1,ja,s,S1,Ut]),[a0,tt]=$.useMemo(()=>[qt!==void 0&&typeof M0=="number"?Math.floor(qt/M0):0,qt!==void 0&&typeof M0=="number"?-(qt%M0):0],[qt,M0]),ut=$.useRef({height:1,width:1,x:0,y:0}),ht=$.useMemo(()=>{var M,A;return{x:ut.current.x,y:a0,width:(M=ut.current.width)!=null?M:1,height:(A=ut.current.height)!=null?A:1,ty:tt}},[tt,a0]),xt=$.useRef(!1),[_t,Ca,y2]=bk(ht),C2=((e=_t.height)!=null?e:1)>1;$.useLayoutEffect(()=>{if(qt!==void 0&&z.current!==null&&C2){if(z.current.scrollTop===qt)return;z.current.scrollTop=qt,z.current.scrollTop!==qt&&y2(),xt.current=!0}},[qt,C2,y2]);let N2=((r=_t.width)!=null?r:1)>1;$.useLayoutEffect(()=>{if(Ft!==void 0&&z.current!==null&&N2){if(z.current.scrollLeft===Ft)return;z.current.scrollLeft=Ft,z.current.scrollLeft!==Ft&&y2(),xt.current=!0}},[Ft,N2,y2]);let B2=_t.x+P,u2=_t.y,G1=$.useRef(null),Gt=$.useCallback(M=>{var A;M===!0?(A=G1.current)==null||A.focus():window.requestAnimationFrame(()=>{var E;(E=G1.current)==null||E.focus()})},[]),n0=H0?V+1:V,A0=$.useCallback(M=>{let A=P===0?M:M.map(T=>({...T,location:[T.location[0]-P,T.location[1]]})),E=P1?.(A);if(E!==!0)for(let T of A)H1?.(T.location,T.value);return E},[H1,P1,P]),Vm=$.useMemo(()=>{if(U!==void 0)return P===0?U:U.map(M=>{let A=_1.length-M.range.x-P;if(!(A<=0))return{color:M.color,range:{...M.range,x:M.range.x+P,width:Math.min(A,M.range.width)},style:M.style}}).filter(M=>M!==void 0)},[U,_1.length,P]),t6=$.useRef(_1);t6.current=_1;let F0=$.useCallback(([M,A],E=!1)=>{var T,J,K,X,l1,t1,m1,y1,N1,Y1;let w1=H0&&A===n0-1;if(M===0&&s2)return w1?Zp:{kind:o2.Marker,allowOverlay:!1,checked:q?.rows.hasIndex(A)===!0,markerKind:s==="clickable-number"?"number":s,row:jt+A,drawHandle:la!==void 0,cursor:s==="clickable-number"?"pointer":void 0};if(w1){let ct=M===P&&(T=wt?.hint)!=null?T:"",k1=t6.current[M];if(((J=k1?.trailingRowOptions)==null?void 0:J.disabled)===!0)return Zp;{let rt=(X=(K=k1?.trailingRowOptions)==null?void 0:K.hint)!=null?X:ct,gt=(t1=(l1=k1?.trailingRowOptions)==null?void 0:l1.addIcon)!=null?t1:wt?.addIcon;return{kind:o2.NewRow,hint:rt,allowOverlay:!1,icon:gt}}}else{let at=M-P;if(E||Ht?.strict===!0){let k1=ut.current,rt=k1.x>at||at>k1.x+k1.width||k1.y>A||A>k1.y+k1.height,gt=at===((y1=(m1=k1.extras)==null?void 0:m1.selected)==null?void 0:y1[0])&&A===((N1=k1.extras)==null?void 0:N1.selected[1]),Vt=((Y1=k1.extras)==null?void 0:Y1.freezeRegion)===void 0||k1.extras.freezeRegion.x>at||at>k1.extras.freezeRegion.x+k1.extras.freezeRegion.width||k1.extras.freezeRegion.y>A||A>k1.extras.freezeRegion.y+k1.extras.freezeRegion.height;if(rt&&!gt&&Vt)return{kind:n1.Loading,allowOverlay:!1}}let ct=C([at,A]);return P!==0&&ct.span!==void 0&&(ct={...ct,span:[ct.span[0]+P,ct.span[1]+P]}),ct}},[H0,n0,s2,q?.rows,la,s,P,wt?.hint,wt?.addIcon,Ht?.strict,C,jt]),to=$.useCallback(M=>{var A,E;let T=(A=ot?.(M))!=null?A:{name:M};return o1!==void 0&&M!==""&&(T={icon:T.icon,name:T.name,overrideTheme:T.overrideTheme,actions:[...(E=T.actions)!=null?E:[],{title:"Rename",icon:"renameIcon",onClick:J=>ro({group:T.name,bounds:J.bounds})}]}),T},[ot,o1]),si=$.useCallback(M=>{var A;let[E,T]=M.cell,J=_1[E],K=J?.group!==void 0?(A=to(J.group))==null?void 0:A.overrideTheme:void 0,X=J?.themeOverride,l1=H?.(T);v({...M,theme:{...S,...K,...X,...l1,...M.content.themeOverride}})},[H,_1,to,S]),yr=$.useCallback((M,A,E)=>{var T;if(q.current===void 0)return;let[J,K]=q.current.cell,X=F0([J,K]);if(X.kind!==n1.Boolean&&X.allowOverlay){let l1=X;if(E!==void 0)switch(l1.kind){case n1.Number:{let t1=hk(()=>E==="-"?-0:Number.parseFloat(E),0);l1={...l1,data:Number.isNaN(t1)?0:t1};break}case n1.Text:case n1.Markdown:case n1.Uri:l1={...l1,data:E};break}si({target:M,content:l1,initialValue:E,cell:[J,K],highlight:E===void 0,forceEditMode:E!==void 0})}else X.kind===n1.Boolean&&A&&X.readonly!==!0&&(A0([{location:q.current.cell,value:{...X,data:Nz(X.data)}}]),(T=G1.current)==null||T.damage([{cell:q.current.cell}]))},[F0,q,A0,si]),a6=$.useCallback((M,A)=>{var E;let T=(E=G1.current)==null?void 0:E.getBounds(M,A);if(T===void 0||z.current===null)return;let J=F0([M,A]);!J.allowOverlay||si({target:T,content:J,initialValue:void 0,highlight:!0,cell:[M,A],forceEditMode:!0})},[F0,si]),Kt=$.useCallback((M,A,E="both",T=0,J=0,K=void 0)=>{var X;if(z.current!==null){let l1=G1.current,t1=d.current,m1=typeof M!="number"?M.unit==="cell"?M.amount:void 0:M,y1=typeof A!="number"?A.unit==="cell"?A.amount:void 0:A,N1=typeof M!="number"&&M.unit==="px"?M.amount:void 0,Y1=typeof A!="number"&&A.unit==="px"?A.amount:void 0;if(l1!==null&&t1!==null){let w1={x:0,y:0,width:0,height:0},A1=0,at=0;if((m1!==void 0||y1!==void 0)&&(w1=(X=l1.getBounds((m1??0)+P,y1??0))!=null?X:w1,w1.width===0||w1.height===0))return;let ct=t1.getBoundingClientRect(),k1=ct.width/t1.offsetWidth;if(N1!==void 0&&(w1={...w1,x:N1-ct.left-z.current.scrollLeft,width:1}),Y1!==void 0&&(w1={...w1,y:Y1+ct.top-z.current.scrollTop,height:1}),w1!==void 0){let rt={x:w1.x-T,y:w1.y-J,width:w1.width+2*T,height:w1.height+2*J},gt=0;for(let zt=0;ztrt.x?A1=rt.x-kt:i0rt.y?at=rt.y-Rt:ft{var E;let T=_1[M];if(((E=T?.trailingRowOptions)==null?void 0:E.disabled)===!0)return;let J=s1?.(),K,X=!0;J!==void 0&&(K=await J,K==="top"&&(X=!1),typeof K=="number"&&(X=!1));let l1=0,t1=()=>{if(n6.current<=V){l1<500&&window.setTimeout(t1,l1),l1=50+l1*2;return}let m1=typeof K=="number"?K:X?V:0;Kt(M-P,m1),c0({cell:[M,m1],range:{x:M,y:m1,width:1,height:1}},!1,!1,"edit");let y1=r6.current([M-P,m1]);y1.allowOverlay&&gr(y1)&&y1.readonly!==!0&&A&&window.setTimeout(()=>{e6.current(M,m1)},0)};t1()},[_1,s1,P,V,Kt,c0]),ui=$.useCallback(M=>{var A,E,T;let J=(T=(E=(A=E1[M])==null?void 0:A.trailingRowOptions)==null?void 0:E.targetColumn)!=null?T:wt?.targetColumn;if(typeof J=="number")return J+(s2?1:0);if(typeof J=="object"){let K=L.indexOf(J);if(K>=0)return K+(s2?1:0)}},[E1,L,s2,wt?.targetColumn]),qa=$.useRef(),f4=$.useRef(),Cr=$.useCallback((M,A)=>{var E;let[T,J]=A;return{...S,...(E=_1[T])==null?void 0:E.themeOverride,...H?.(J),...M.themeOverride}},[H,_1,S]),Br=$.useCallback(M=>{var A,E,T,J;let K=E5.value?M.metaKey:M.ctrlKey,X=K&&C1==="multi",l1=K&&I==="multi",[t1,m1]=M.location,y1=q.columns,N1=q.rows,[Y1,w1]=(E=(A=q.current)==null?void 0:A.cell)!=null?E:[];if(M.kind==="cell"){if(f4.current=void 0,be.current=[t1,m1],t1===0&&s2){if(H0===!0&&m1===V||s==="number"||C1==="none")return;let A1=F0(M.location);if(A1.kind!==o2.Marker)return;if(la!==void 0){let k1=z1(A1);i2(k1?.kind===o2.Marker);let rt=(T=k1?.onClick)==null?void 0:T.call(k1,{...M,cell:A1,posX:M.localEventX,posY:M.localEventY,bounds:M.bounds,theme:Cr(A1,M.location),preventDefault:()=>{}});if(rt===void 0||rt.checked===A1.checked)return}v(void 0),Gt();let at=N1.hasIndex(m1),ct=qa.current;if(C1==="multi"&&(M.shiftKey||M.isLongTouch===!0)&&ct!==void 0&&N1.hasIndex(ct)){let k1=[Math.min(ct,m1),Math.max(ct,m1)+1];X||St==="multi"?S0(void 0,k1,!0):S0(mt.fromSingleSelection(k1),void 0,X)}else X||M.isTouch||St==="multi"?at?S0(N1.remove(m1),void 0,!0):(S0(void 0,m1,!0),qa.current=m1):at&&N1.length===1?S0(mt.empty(),void 0,K):(S0(mt.fromSingleSelection(m1),void 0,K),qa.current=m1)}else if(t1>=P&&H0&&m1===V){let A1=ui(t1);u4(A1??t1)}else if(Y1!==t1||w1!==m1){let A1=F0(M.location),at=z1(A1);if(at?.onSelect!==void 0){let rt=!1;if(at.onSelect({...M,cell:A1,posX:M.localEventX,posY:M.localEventY,bounds:M.bounds,preventDefault:()=>rt=!0,theme:Cr(A1,M.location)}),rt)return}let ct=V2&&m1===V,k1=V2&&q!==void 0&&((J=q.current)==null?void 0:J.cell[1])===V;if((M.shiftKey||M.isLongTouch===!0)&&Y1!==void 0&&w1!==void 0&&q.current!==void 0&&!k1){if(ct)return;let rt=Math.min(t1,Y1),gt=Math.max(t1,Y1),Vt=Math.min(m1,w1),kt=Math.max(m1,w1);c0({...q.current,range:{x:rt,y:Vt,width:gt-rt+1,height:kt-Vt+1}},!0,K,"click"),qa.current=void 0,Gt()}else c0({cell:[t1,m1],range:{x:t1,y:m1,width:1,height:1}},!0,K,"click"),qa.current=void 0,v(void 0),Gt()}}else if(M.kind==="header")if(be.current=[t1,m1],v(void 0),s2&&t1===0)qa.current=void 0,f4.current=void 0,C1==="multi"&&(N1.length!==V?S0(mt.fromSingleSelection([0,V]),void 0,K):S0(mt.empty(),void 0,K),Gt());else{let A1=f4.current;if(I==="multi"&&(M.shiftKey||M.isLongTouch===!0)&&A1!==void 0&&y1.hasIndex(A1)){let at=[Math.min(A1,t1),Math.max(A1,t1)+1];l1?v0(void 0,at,K):v0(mt.fromSingleSelection(at),void 0,K)}else l1?(y1.hasIndex(t1)?v0(y1.remove(t1),void 0,K):v0(void 0,t1,K),f4.current=t1):I!=="none"&&(v0(mt.fromSingleSelection(t1),void 0,K),f4.current=t1);qa.current=void 0,Gt()}else M.kind===w2?be.current=[t1,m1]:M.kind===O5&&(J0(F5,!1),v(void 0),Gt(),Mt?.(),qa.current=void 0,f4.current=void 0)},[u4,I,Gt,z1,ui,F0,q,s2,V2,Mt,la,P,s,C1,St,V,c0,J0,v0,S0,H0,Cr]),ao=$.useRef(!1),be=$.useRef(),i6=$.useRef(_t),f2=$.useRef(),Rm=$.useCallback(M=>{var A,E;if(p4.current=!1,i6.current=ut.current,M.button!==0&&M.button!==1){f2.current=void 0;return}let T=performance.now(),J=T-((E=(A=f2.current)==null?void 0:A.time)!=null?E:-1e3)<250;f2.current={wasDoubleClick:J,button:M.button,time:T,location:M.location},M?.kind==="header"&&(ao.current=!0);let K=M.kind==="cell"&&M.isFillHandle;!K&&M.kind!=="cell"&&M.isEdge||(p({previousSelection:q,fillHandle:K}),be.current=void 0,!M.isTouch&&M.button===0?Br(M):!M.isTouch&&M.button===1&&(be.current=M.location))},[q,Br]),[eo,ro]=$.useState(),l6=$.useCallback(M=>{if(M.kind!==w2||I!=="multi")return;let A=E5.value?M.metaKey:M.ctrlKey,[E]=M.location,T=q.columns;if(E