-
Notifications
You must be signed in to change notification settings - Fork 0
/
669.ee610178.iframe.bundle.js
1 lines (1 loc) · 82.2 KB
/
669.ee610178.iframe.bundle.js
1
"use strict";(self.webpackChunkstorybook=self.webpackChunkstorybook||[]).push([[669],{"../../packages/common-react/src/hooks/useCallbackRef.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__,c:()=>useCallbackRef});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/react/index.js");const useCallbackRef=(callback,deps)=>{const cbCurrent=(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(((...args)=>callback?.(...args)),deps),refCB=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();refCB.current=cbCurrent;const stableCB=(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(((...args)=>refCB.current?.(...args)),[]);if(refCB.current)return stableCB},__WEBPACK_DEFAULT_EXPORT__=useCallbackRef},"../../packages/common-react/src/utils/ReactUtils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Uu:()=>toPrettyKeyCode,th:()=>detectIt,zJ:()=>boundPixel});var _sheetxl_common__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../packages/common/src/utils/CommonUtils.ts"),detect_it__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/detect-it/dist/detect-it.esm.js");new Set(["INPUT","TEXTAREA","SELECT"]);function detectIt(){return detect_it__WEBPACK_IMPORTED_MODULE_0__}function boundPixel(pixel,_increase=!1){return pixel}const toPrettyKeyCode=key=>"BracketLeft"===key?"[":"BracketRight"===key?"]":_sheetxl_common__WEBPACK_IMPORTED_MODULE_1__.ie(key)},"../../packages/common/src/types/Primitives.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{CF:()=>CartesianDirection,CH:()=>EMPTY_TOP_LEFT,Gp:()=>EMPTY_BOUNDS,V4:()=>EMPTY_RECT,tb:()=>AnchorLocation,z5:()=>MimeType});let CartesianDirection=function(CartesianDirection){return CartesianDirection.Up="up",CartesianDirection.Down="down",CartesianDirection.Left="left",CartesianDirection.Right="right",CartesianDirection}({}),AnchorLocation=function(AnchorLocation){return AnchorLocation.TopLeft="tl",AnchorLocation.Top="t",AnchorLocation.TopRight="tr",AnchorLocation.Left="l",AnchorLocation.Center="c",AnchorLocation.Right="r",AnchorLocation.BottomLeft="bl",AnchorLocation.Bottom="b",AnchorLocation.BottomRight="br",AnchorLocation}({});const EMPTY_TOP_LEFT=Object.freeze({left:0,top:0}),EMPTY_RECT=Object.freeze({left:0,top:0,bottom:0,right:0}),EMPTY_BOUNDS=Object.freeze({x:0,y:0,width:0,height:0});let MimeType=function(MimeType){return MimeType.html="text/html",MimeType.csv="text/csv",MimeType.plain="text/plain",MimeType}({})},"../../packages/grid/src/BaseGrid.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{oV:()=>BaseGrid,Ay:()=>src_BaseGrid});var react=__webpack_require__("../../node_modules/react/index.js"),tiny_invariant=__webpack_require__("../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js"),clsx=__webpack_require__("../../node_modules/clsx/dist/clsx.mjs"),Primitives=__webpack_require__("../../packages/common/src/types/Primitives.ts"),CommonUtils=__webpack_require__("../../packages/common/src/utils/CommonUtils.ts"),useCallbackRef=__webpack_require__("../../packages/common-react/src/hooks/useCallbackRef.ts"),ReactUtils=__webpack_require__("../../packages/common-react/src/utils/ReactUtils.ts"),helpers=__webpack_require__("../../packages/grid/src/utils/helpers.ts"),RangeUtils=__webpack_require__("../../packages/grid/src/utils/RangeUtils.ts"),ItemType=function(ItemType){return ItemType.row="row",ItemType.column="column",ItemType}(ItemType||{});const getItemMetadata=({itemType,index,itemSize,instanceProps,scale=1})=>{let itemMetadataMap,lastMeasuredIndex,recalcIndices;"column"===itemType?(itemMetadataMap=instanceProps.columnMetadataMap,lastMeasuredIndex=instanceProps.lastMeasuredColumnIndex,recalcIndices=instanceProps.recalcColumnIndices):(itemMetadataMap=instanceProps.rowMetadataMap,lastMeasuredIndex=instanceProps.lastMeasuredRowIndex,recalcIndices=instanceProps.recalcRowIndices);const recalcWithinBoundsOnly=recalcIndices.length>0;if(index>lastMeasuredIndex){let offset=0;if(lastMeasuredIndex>=0){const itemMetadata=itemMetadataMap[lastMeasuredIndex];offset=itemMetadata.offset+itemMetadata.size}for(let i=lastMeasuredIndex+1;i<=index;i++){let size=recalcWithinBoundsOnly?recalcIndices.includes(i)?itemSize(i)*scale:itemMetadataMap[i]?.size||itemSize(i)*scale:itemSize(i)*scale;itemMetadataMap[i]={offset,size},offset+=size}"column"===itemType?instanceProps.lastMeasuredColumnIndex=index:instanceProps.lastMeasuredRowIndex=index}return itemMetadataMap[index],itemMetadataMap[index]},findNearestItem=({itemType,itemSize,itemCount,instanceProps,offset,scale})=>{let itemMetadataMap,lastMeasuredIndex;"column"===itemType?(itemMetadataMap=instanceProps.columnMetadataMap,lastMeasuredIndex=instanceProps.lastMeasuredColumnIndex):(itemMetadataMap=instanceProps.rowMetadataMap,lastMeasuredIndex=instanceProps.lastMeasuredRowIndex);let retValue=0;return retValue=(lastMeasuredIndex>0?itemMetadataMap[lastMeasuredIndex].offset:0)>=offset?findNearestItemBinarySearch({itemType,itemSize,instanceProps,high:lastMeasuredIndex,low:0,itemCount,offset,scale}):findNearestItemExponentialSearch({itemType,itemSize,itemCount,instanceProps,index:Math.max(0,lastMeasuredIndex),offset,scale}),retValue=Math.min(retValue,itemCount),retValue},findNearestItemBinarySearch=({itemType,itemSize,instanceProps,high,low,offset,scale})=>{for(;low<=high;){const middle=low+Math.floor((high-low)/2),currentOffset=getItemMetadata({itemType,itemSize,index:middle,instanceProps,scale}).offset;if(currentOffset===offset)return middle;currentOffset<offset?low=middle+1:currentOffset>offset&&(high=middle-1)}return low>0?low-1:0},findNearestItemExponentialSearch=({itemType,itemSize,itemCount,instanceProps,index,offset,scale})=>{let interval=1;for(;index<itemCount&&getItemMetadata({itemType,itemSize,index,instanceProps,scale}).offset<offset;)index+=interval,interval*=2;return findNearestItemBinarySearch({itemType,itemSize,instanceProps,itemCount,high:Math.min(index,itemCount-1),low:Math.floor(index/2),offset,scale})},useCellLayout=props=>{const{rowCount,columnCount,defaultRowHeight,getRowHeight:propGetRowHeight,defaultColumnWidth,getColumnWidth:propGetColumnWidth}=props||{},instanceProps=(0,react.useRef)({columnMetadataMap:{},rowMetadataMap:{},lastMeasuredColumnIndex:-1,lastMeasuredRowIndex:-1,recalcColumnIndices:[],recalcRowIndices:[]}),getRowIndex=(0,useCallbackRef.c)((offset=>findNearestItem({itemType:ItemType.row,itemCount:rowCount,itemSize:propGetRowHeight??(()=>defaultRowHeight??20),instanceProps:instanceProps.current,offset})),[rowCount,propGetRowHeight,defaultRowHeight]),getRowOffset=(0,useCallbackRef.c)((index=>-1===index?0:getItemMetadata({itemType:ItemType.row,index,itemSize:propGetRowHeight??(()=>defaultRowHeight??20),instanceProps:instanceProps.current}).offset),[propGetRowHeight,defaultRowHeight]),getRowHeight=(0,useCallbackRef.c)((index=>getItemMetadata({itemType:ItemType.row,index,itemSize:propGetRowHeight??(()=>defaultRowHeight??20),instanceProps:instanceProps.current}).size),[propGetRowHeight,defaultRowHeight]),getColIndex=(0,useCallbackRef.c)((offset=>findNearestItem({itemType:ItemType.column,itemCount:columnCount,itemSize:propGetColumnWidth??(()=>defaultColumnWidth??75),instanceProps:instanceProps.current,offset})),[columnCount,propGetColumnWidth,defaultColumnWidth]),getColOffset=(0,useCallbackRef.c)((index=>-1===index?0:getItemMetadata({itemType:ItemType.column,index,itemSize:propGetColumnWidth??(()=>defaultColumnWidth??75),instanceProps:instanceProps.current}).offset),[propGetColumnWidth,defaultColumnWidth]),getColWidth=(0,useCallbackRef.c)((index=>getItemMetadata({itemType:ItemType.column,index,itemSize:propGetColumnWidth??(()=>defaultColumnWidth??75),instanceProps:instanceProps.current}).size),[propGetColumnWidth,defaultColumnWidth]),[_,_forceRender]=(0,react.useReducer)((s=>s+1),0),createCellLayout=()=>({getRowOffset,getColOffset,getRowIndex,getColIndex}),[state,setState]=(0,react.useState)((()=>props?createCellLayout():null));return(0,react.useEffect)((()=>{setState(props?createCellLayout():null)}),[_,rowCount,columnCount,defaultColumnWidth,defaultRowHeight,getRowHeight,getColWidth]),state};var SVG=__webpack_require__("../../packages/grid/src/SVG.tsx"),injectStylesIntoStyleTag=__webpack_require__("../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("../../node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("../../node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("../../node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("../../node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),Grid_module=__webpack_require__("../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!../../packages/grid/src/Grid.module.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(Grid_module.A,options);const src_Grid_module=Grid_module.A&&Grid_module.A.locals?Grid_module.A.locals:void 0;var jsx_runtime=__webpack_require__("../../node_modules/react/jsx-runtime.js");const ZERO_TOP_LEFT=Object.freeze({top:0,left:0}),BOTTOM_RIGHT_INSET=Object.freeze({bottom:-4,right:-4}),ANCHOR_PANE_Z_ORDER=[Primitives.tb.TopLeft,Primitives.tb.Top,Primitives.tb.Left,Primitives.tb.Center],EMPTY_CACHE_KEY={},BaseGrid=(0,react.memo)((0,react.forwardRef)(((props,refForwarded)=>{const{width:propWidth,height:propHeight,rowCount=1,columnCount=1,defaultRowHeight,defaultColumnWidth,getRowHeight,getColumnWidth,cellLayout:propCellLayout,onViewportScroll:propOnViewportScroll,onImmediateScroll:propOnImmediateScroll,showGridLines:propShowGridLines=!0,gridLineColor="rgb(224, 224, 224)",gridLineRowsProps,gridLineColumnsProps,clipCells=!0,cursor,freezeLeft:propFreezeLeft=0,freezeTop:propFreezeTop=0,freezeLeftProps,freezeTopProps,cellRenderer:propCellRenderer,mergedRanges=CommonUtils.Ml,onViewportChange:propOnViewportChange,onFirstRender:propOnFirstRender,overlays,overlaysProps,allowOverlaysOverflow=!1,stageProps,stageWrapper=null,hiddenRowsAt:propHiddenRowsAt,hiddenColumnsAt:propHiddenColumnsAt,hiddenCellAt:propHiddenCellAt,getVisibleCells:propGetVisibleCells,zoom=1,enableMouseWheel=!0,onWheelScroll:propOnWheelScroll,scrollPoint:propScrollPoint=ZERO_TOP_LEFT,style:propStyle={},...rest}=props;(0,tiny_invariant.A)(propCellRenderer,"No cellRenderer specified. This is probably not what you wanted"),(0,tiny_invariant.A)(!props?.children,"Grid does not support children elements");const onImmediateScroll=(0,useCallbackRef.c)(propOnImmediateScroll,[propOnImmediateScroll]),onViewportChange=(0,useCallbackRef.c)(propOnViewportChange,[propOnViewportChange]),onViewportScroll=(0,useCallbackRef.c)(propOnViewportScroll,[propOnViewportScroll]),onWheelScroll=(0,useCallbackRef.c)(propOnWheelScroll,[propOnWheelScroll]),onFirstRender=(0,useCallbackRef.c)(propOnFirstRender,[propOnFirstRender]),refStage=(0,react.useRef)(null),refOverlays=(0,react.useRef)(null),refScrollContainer=(0,react.useRef)(null),refWheelDelta=(0,react.useRef)(null),[_,forceRender]=(0,react.useReducer)((s=>s+1),0),[scrollState,setScrollState]=(0,react.useState)({left:propScrollPoint?.left??0,top:propScrollPoint?.top??0,horizontalScrollDirection:null,verticalScrollDirection:null}),refScrollPointInFlight=(0,react.useRef)(null),refScrollState=(0,react.useRef)(scrollState),{top:scrollTop,left:scrollLeft,verticalScrollDirection:_verticalScrollDirection,horizontalScrollDirection:_horizontalScrollDirection}=scrollState,refIsMounted=(0,react.useRef)(!1),cellLayoutAuto=useCellLayout({rowCount,columnCount,defaultRowHeight,defaultColumnWidth,getRowHeight,getColumnWidth}),refLastRenderedCellsCache=(0,react.useRef)(null),baseLayout=(0,react.useMemo)((()=>{const base=propCellLayout||cellLayoutAuto;return refLastRenderedCellsCache.current=null,{getColOffset:index=>base.getColOffset(index)*zoom,getColIndex:offset=>base.getColIndex(offset/zoom),getRowOffset:index=>base.getRowOffset(index)*zoom,getRowIndex:offset=>base.getRowIndex(offset/zoom)}}),[cellLayoutAuto,propCellLayout,zoom]),createTranslatedCellLayout=(base,scrollPoint,point)=>{const x=(scrollPoint?.left??0)+(point?.x??0),y=(scrollPoint?.top??0)+(point?.y??0);return{getColOffset:index=>base.getColOffset(index)-x,getColIndex:offset=>base.getColIndex(offset+x),getRowOffset:index=>base.getRowOffset(index)-y,getRowIndex:offset=>base.getRowIndex(offset+y)}},hiddenRowsAtAuto=(0,react.useCallback)(((index,forward=!1)=>(0,helpers.V8)(index,forward,baseLayout.getRowOffset,forward?rowCount:0)),[rowCount,baseLayout?.getRowOffset]),hiddenRowsAt=(0,useCallbackRef.c)(propHiddenRowsAt??hiddenRowsAtAuto,[propHiddenRowsAt]),hiddenColumnsAtAuto=(0,react.useCallback)(((index,forward=!1)=>(0,helpers.V8)(index,forward,baseLayout.getColOffset,forward?columnCount:0)),[columnCount,baseLayout?.getColOffset]),hiddenColumnsAt=(0,useCallbackRef.c)(propHiddenColumnsAt??hiddenColumnsAtAuto,[propHiddenColumnsAt]),containerWidth=(0,react.useMemo)((()=>Math.min(propWidth??800,baseLayout.getColOffset(columnCount))),[baseLayout.getColOffset,columnCount,propWidth]),containerHeight=(0,react.useMemo)((()=>Math.min(propHeight??600,baseLayout.getRowOffset(rowCount))),[baseLayout.getRowOffset,rowCount,propHeight]),focusContainer=(0,react.useCallback)((options=>{CommonUtils.Sw&&setTimeout((()=>{refStage.current?.focus({preventScroll:!0,...options})}),0)}),[]),containsContainer=(0,react.useCallback)((element=>refStage.current?.contains(element)||refOverlays.current?.contains(element)),[]);(0,react.useEffect)((()=>{refIsMounted.current&&(refScrollPointInFlight.current&&refScrollPointInFlight.current.left!==refScrollState.current?.left&&refScrollPointInFlight.current.top!==refScrollState.current?.top||(refScrollPointInFlight.current=null,onViewportScroll?.({left:scrollLeft,top:scrollTop})))}),[scrollLeft,scrollTop]);const getScrollPosition=(0,useCallbackRef.c)((()=>({top:scrollTop,left:scrollLeft})),[scrollTop,scrollLeft]),mergedRangeMap=(0,react.useMemo)((()=>{if(mergedRanges&&"function"==typeof mergedRanges)return null;const mergedRangeMap=new Map;for(let i=0;i<mergedRanges.length;i++){const merged=mergedRanges[i];for(const cell of(0,helpers.Bi)(merged))mergedRangeMap.set(cell,merged)}return mergedRangeMap}),[mergedRanges]),getCoordsAsRange=(0,useCallbackRef.c)((coords=>{const{rowIndex,colIndex}=coords;if(mergedRanges&&"function"==typeof mergedRanges){const coordsAsRange={rowStart:rowIndex,colStart:colIndex,rowEnd:rowIndex,colEnd:colIndex},merges=mergedRanges(coordsAsRange);return merges&&merges.length>0?merges[0]:coordsAsRange}return mergedRangeMap&&mergedRangeMap.has((0,helpers.A)(rowIndex,colIndex))?mergedRangeMap.get((0,helpers.A)(rowIndex,colIndex)):{rowStart:rowIndex,colStart:colIndex,rowEnd:rowIndex,colEnd:colIndex}}),[mergedRangeMap,mergedRanges]),rowDims=(0,react.useMemo)((()=>{const retValue=[];let freezeTop=0,freezeScrollTop=0;"number"==typeof propFreezeTop?freezeTop=propFreezeTop:(freezeTop=propFreezeTop.index??0,freezeScrollTop=(propFreezeTop.scrollOffset??0)*zoom);const frozenStartFrom=freezeScrollTop,frozenStartTo=baseLayout.getRowOffset(freezeTop),freezeStartDistance=frozenStartTo-frozenStartFrom;if(freezeTop>0){const freezeLayout=createTranslatedCellLayout(baseLayout,{top:freezeScrollTop+baseLayout.getRowOffset(0)}),startIndexFrozen=baseLayout.getRowIndex(frozenStartFrom),stopIndexFrozen=baseLayout.getRowIndex(frozenStartTo-1);let _visibleFrozenHeaders;retValue[1]={minIndex:startIndexFrozen,maxIndex:stopIndexFrozen,minCoord:0,maxCoord:freezeTop-1,minBounds:0,maxBounds:freezeStartDistance,visibleIndices:()=>_visibleFrozenHeaders||(_visibleFrozenHeaders=Object.freeze((0,helpers.j0)(hiddenRowsAt,startIndexFrozen,stopIndexFrozen)),_visibleFrozenHeaders),layout:freezeLayout,maxVirtualBounds:frozenStartTo,scrollOffset:freezeScrollTop,freezeOffset:freezeScrollTop}}const maxBounds=Math.max(0,containerHeight-freezeStartDistance),relativeLayout=createTranslatedCellLayout(baseLayout,{top:scrollTop+freezeStartDistance}),startIndex=relativeLayout.getRowIndex(0),stopIndex=relativeLayout.getRowIndex(maxBounds);let _visibleHeaders;return retValue[0]={minIndex:startIndex,maxIndex:stopIndex,minCoord:freezeTop,maxCoord:rowCount-1,minBounds:freezeStartDistance,maxBounds,visibleIndices:()=>_visibleHeaders||(_visibleHeaders=Object.freeze((0,helpers.j0)(hiddenRowsAt,startIndex,stopIndex)),_visibleHeaders),layout:relativeLayout,maxVirtualBounds:baseLayout.getRowOffset(rowCount),scrollOffset:scrollTop,freezeOffset:(freezeTop>0?baseLayout.getRowOffset(freezeTop):0)-freezeScrollTop},retValue}),[baseLayout.getRowIndex,baseLayout.getRowOffset,hiddenRowsAt,containerHeight,rowCount,propFreezeTop,scrollTop,zoom]),columnDims=(0,react.useMemo)((()=>{const retValue=[];let freezeLeft=0,freezeScrollLeft=0;"number"==typeof propFreezeLeft?freezeLeft=propFreezeLeft:(freezeLeft=propFreezeLeft.index??0,freezeScrollLeft=(propFreezeLeft.scrollOffset??0)*zoom);const frozenStartFrom=freezeScrollLeft,frozenStartTo=baseLayout.getColOffset(freezeLeft),freezeStartDistance=frozenStartTo-frozenStartFrom;if(freezeLeft>0){const freezeLayout=createTranslatedCellLayout(baseLayout,{left:freezeScrollLeft+baseLayout.getColOffset(0)}),startIndexFrozen=baseLayout.getColIndex(frozenStartFrom),stopIndexFrozen=baseLayout.getColIndex(frozenStartTo-1);let _visibleFrozenHeaders;retValue[1]={minIndex:startIndexFrozen,maxIndex:stopIndexFrozen,minCoord:0,maxCoord:freezeLeft-1,minBounds:0,maxBounds:freezeStartDistance,visibleIndices:()=>_visibleFrozenHeaders||(_visibleFrozenHeaders=Object.freeze((0,helpers.j0)(hiddenColumnsAt,startIndexFrozen,stopIndexFrozen)),_visibleFrozenHeaders),layout:freezeLayout,maxVirtualBounds:frozenStartTo,scrollOffset:freezeScrollLeft,freezeOffset:freezeScrollLeft}}const maxBounds=Math.max(0,containerWidth-freezeStartDistance),relativeLayout=createTranslatedCellLayout(baseLayout,{left:scrollLeft+freezeStartDistance}),startIndex=relativeLayout.getColIndex(0),stopIndex=relativeLayout.getColIndex(maxBounds);let _visibleHeaders;return retValue[0]={minIndex:startIndex,maxIndex:stopIndex,minCoord:freezeLeft,maxCoord:columnCount-1,minBounds:freezeStartDistance,maxBounds,visibleIndices:()=>_visibleHeaders||(_visibleHeaders=Object.freeze((0,helpers.j0)(hiddenColumnsAt,startIndex,stopIndex)),_visibleHeaders),layout:relativeLayout,maxVirtualBounds:baseLayout.getColOffset(columnCount),scrollOffset:scrollLeft,freezeOffset:(freezeLeft>0?baseLayout.getColOffset(freezeLeft):0)-freezeScrollLeft},retValue}),[baseLayout.getColIndex,baseLayout.getColOffset,hiddenColumnsAt,containerWidth,columnCount,propFreezeLeft,scrollLeft,zoom]),refLastOverlayRenderCache=(0,react.useRef)({}),refListenersOnViewChangeOnce=(0,react.useRef)([]),viewLayouts=(0,react.useMemo)((()=>{let allViews={};const createGridOverlayView=(columnIndex,rowIndex,anchor,scrollOrientationOptions,insets)=>{const scrollOrientation={vertical:scrollOrientationOptions?.vertical||!1,horizontal:scrollOrientationOptions?.horizontal||!1};if(columnIndex>=columnDims.length||rowIndex>=rowDims.length)return null;const cellRange={rowStart:rowDims[rowIndex].minIndex,colStart:columnDims[columnIndex].minIndex,rowEnd:rowDims[rowIndex].maxIndex,colEnd:columnDims[columnIndex].maxIndex};if(cellRange.rowStart>cellRange.rowEnd||cellRange.colStart>cellRange.colEnd)return null;const cellLayout={getColIndex:offset=>columnDims[columnIndex].layout.getColIndex(offset),getColOffset:index=>columnDims[columnIndex].layout.getColOffset(index),getRowIndex:offset=>rowDims[rowIndex].layout.getRowIndex(offset),getRowOffset:index=>rowDims[rowIndex].layout.getRowOffset(index)},viewInsets=Object.freeze({left:insets?.left??0,top:insets?.top??0,right:insets?.right??0,bottom:insets?.bottom??0}),viewBounds=Object.freeze({x:columnDims[columnIndex].minBounds,y:rowDims[rowIndex].minBounds,width:columnDims[columnIndex].maxBounds,height:rowDims[rowIndex].maxBounds}),_getCellRangeBounds=(range,adjustment)=>(0,RangeUtils.fL)(cellLayout,range??cellRange,adjustment),totalSize={width:columnDims[columnIndex].maxVirtualBounds,height:rowDims[rowIndex].maxVirtualBounds},scrollTopLeft={left:columnDims[columnIndex].scrollOffset,top:rowDims[rowIndex].scrollOffset},freezeTopLeft={left:columnDims[columnIndex].freezeOffset,top:rowDims[rowIndex].freezeOffset},viewportSize={width:containerWidth,height:containerHeight};let _colOffsets=null,_rowOffsets=null;const topLeft_top=(freezeTopLeft.top+(scrollOrientationOptions.vertical?scrollTopLeft.top:0))/zoom,topLeft_left=(freezeTopLeft.left+(scrollOrientationOptions.horizontal?scrollTopLeft.left:0))/zoom;return{visibleCellRange:cellRange,clipBounds:(rect,insets)=>{let insetAsBounds,insetAsNumber=0;return insets&&"number"!=typeof insets?insetAsBounds=insets:(insetAsBounds=_getCellRangeBounds(cellRange),insetAsNumber=insets),(0,helpers._9)(rect??{x:0,y:0,width:viewBounds.width,height:viewBounds.height},insetAsBounds,insetAsNumber)},toViewBounds:bounds=>0===topLeft_left&&0===topLeft_top&&1===zoom?bounds:{x:(bounds.x-topLeft_left)*zoom,y:(bounds.y-topLeft_top)*zoom,width:bounds.width*zoom,height:bounds.height*zoom},toAbsoluteBounds:bounds=>0===topLeft_left&&0===topLeft_top&&1===zoom?bounds:{x:(bounds.x+topLeft_left)/zoom,y:(bounds.y+topLeft_top)/zoom,width:bounds.width/zoom,height:bounds.height/zoom},getRelativePointFromOffset:(x,y)=>{const absolute=getRelativePointFromOffset(x,y);return{x:absolute.x-viewBounds.x,y:absolute.y-viewBounds.y}},cellLayout,getCoordsAsRange,getVisibleColumns:()=>columnDims[columnIndex].visibleIndices(),getVisibleRows:()=>rowDims[rowIndex].visibleIndices(),getVisibleColumnOffsets:()=>(_colOffsets||(_colOffsets=(0,helpers.kr)(columnDims[columnIndex].layout,!0,columnDims[columnIndex].visibleIndices(),cellRange.colStart,cellRange.colEnd)),_colOffsets),getVisibleRowOffsets:()=>(_rowOffsets||(_rowOffsets=(0,helpers.kr)(rowDims[rowIndex].layout,!1,rowDims[rowIndex].visibleIndices(),cellRange.rowStart,cellRange.rowEnd)),_rowOffsets),getTotalCellRange:()=>({colStart:columnDims[columnIndex].minCoord,colEnd:columnDims[columnIndex].maxCoord,rowStart:rowDims[rowIndex].minCoord,rowEnd:rowDims[rowIndex].maxCoord}),getCellRangeBounds:_getCellRangeBounds,scrollCellIntoView:(coords,options)=>scrollCellIntoView(coords,options,anchor),getCellCoordsFromOffset:(x,y,actualCell=!1)=>{const relative=getRelativePointFromOffset(x,y);if(!relative)return null;const colIndex=cellLayout.getColIndex(relative.x-viewBounds.x),coords={rowIndex:cellLayout.getRowIndex(relative.y-viewBounds.y),colIndex};if(actualCell)return coords;const range=getCoordsAsRange(coords);return{rowIndex:range.rowStart,colIndex:range.colStart}},zoom,anchor,bounds:viewBounds,insets:viewInsets,totalSize,viewportSize,scrollTopLeft,freezeTopLeft,scrollOrientation,allViews:()=>allViews}};let view=allViews[Primitives.tb.Center]=createGridOverlayView(0,0,Primitives.tb.Center,{horizontal:!0,vertical:!0},BOTTOM_RIGHT_INSET);return view&&(allViews[Primitives.tb.Center]=view),view=createGridOverlayView(0,1,Primitives.tb.Top,{horizontal:!0}),view&&(allViews[Primitives.tb.Top]=view),view=createGridOverlayView(1,0,Primitives.tb.Left,{vertical:!0}),view&&(allViews[Primitives.tb.Left]=view),view=createGridOverlayView(1,1,Primitives.tb.TopLeft,{}),view&&(allViews[Primitives.tb.TopLeft]=view),refLastOverlayRenderCache.current=null,allViews=Object.freeze(allViews)}),[rowDims,columnDims]),viewKeys=Object.keys(viewLayouts),totalWidth=columnDims[0]?.maxVirtualBounds??0,totalHeight=rowDims[0]?.maxVirtualBounds??0,frozenBoundaries=(0,react.useMemo)((()=>({left:columnDims[1]?columnDims[1].layout.getColOffset(columnDims[1].maxIndex+1):0,top:rowDims[1]?rowDims[1].layout.getRowOffset(rowDims[1].maxIndex+1):0})),[viewLayouts]);(0,react.useEffect)((()=>{if(refListenersOnViewChangeOnce.current.length>0){for(let i=0;i<refListenersOnViewChangeOnce.current.length;i++)refListenersOnViewChangeOnce.current[i]();refListenersOnViewChangeOnce.current=[]}}),[viewLayouts]);const getDimensions=(0,useCallbackRef.c)((()=>({containerWidth,containerHeight,totalWidth,totalHeight})),[containerWidth,containerHeight,baseLayout]);(0,react.useEffect)((()=>{!refScrollPointInFlight.current&&refIsMounted.current&&onViewportChange({top:scrollTop,left:scrollLeft,width:containerWidth,height:containerHeight,totalWidth,totalHeight})}),[containerWidth,containerHeight,scrollTop,scrollLeft,totalWidth,totalHeight]),(0,react.useEffect)((()=>(enableMouseWheel&&refScrollContainer.current?.addEventListener("wheel",handleWheel,{passive:!1}),refIsMounted.current=!0,refScrollPointInFlight.current=null,()=>{refScrollContainer.current?.removeEventListener("wheel",handleWheel)})),[enableMouseWheel]);const getRelativePointFromOffset=(0,react.useCallback)(((left,top)=>{(0,tiny_invariant.A)("number"==typeof left&&"number"==typeof top,"Top and left should be a number.");const rect=refStage.current?.getBoundingClientRect();return rect?{x:left-rect.x,y:top-rect.y}:{x:left,y:top}}),[]),getViewFromLocation=(0,useCallbackRef.c)((anchor=>viewLayouts[anchor]||null),[viewLayouts]),getViewFromOffset=(0,useCallbackRef.c)(((left,top)=>{if(1===Object.keys(viewLayouts).length)return viewLayouts[Primitives.tb.Center];const pos=getRelativePointFromOffset(left,top);if(!pos)return null;const{x,y}=pos;let view=null;const viewKeys=ANCHOR_PANE_Z_ORDER;for(let k=0;!view&&k<viewKeys.length;k++){const viewCheck=viewLayouts[viewKeys[k]];viewCheck&&(0,helpers.B7)(x,y,viewCheck.bounds)&&(view=viewCheck)}return view||(view=viewLayouts[Primitives.tb.Center]),view}),[viewLayouts,getCoordsAsRange]),getViewport=(0,useCallbackRef.c)((()=>viewLayouts[Primitives.tb.Center].visibleCellRange),[viewLayouts[Primitives.tb.Center]]),refResetIsScrollingTimeoutID=(0,react.useRef)(null),resetIsScrollingDebounced=(0,react.useCallback)((()=>{null!==refResetIsScrollingTimeoutID.current&&CommonUtils.yV(refResetIsScrollingTimeoutID.current),refResetIsScrollingTimeoutID.current=CommonUtils.Vq(resetIsScrolling,150)}),[]),resetIsScrolling=(0,react.useCallback)((()=>{refResetIsScrollingTimeoutID.current=null,setScrollState((prev=>{const newScrollState={...prev,verticalScrollDirection:null,horizontalScrollDirection:null};return refScrollState.current=newScrollState,newScrollState}))}),[]),scrollTo=(0,useCallbackRef.c)((options=>{const scrollLeft=options?.left??options?.[0],scrollTop=options?.top??options?.[1],newLeft=void 0!==scrollLeft?Math.min(totalWidth-containerWidth,Math.max(columnDims?.[1]?.scrollOffset??0,scrollLeft)):refScrollState.current.left,newTop=void 0!==scrollTop?Math.min(totalHeight-containerHeight,Math.max(rowDims?.[1]?.scrollOffset??0,scrollTop)):refScrollState.current.top;if(refScrollState.current.left===newLeft&&refScrollState.current.top===newTop)return;let newHorizontalScrollDirection=null,newVerticalScrollDirection=null;refScrollState.current.left>newLeft?newHorizontalScrollDirection=Primitives.CF.Left:refScrollState.current.left<newLeft&&(newHorizontalScrollDirection=Primitives.CF.Right),refScrollState.current.top>newTop?newVerticalScrollDirection=Primitives.CF.Up:refScrollState.current.top<newTop&&(newVerticalScrollDirection=Primitives.CF.Down),CommonUtils.G2((()=>{setScrollState((prev=>{const newScrollState={...prev,left:newLeft,top:newTop,horizontalScrollDirection:newHorizontalScrollDirection,verticalScrollDirection:newVerticalScrollDirection};return refScrollState.current=newScrollState,newScrollState}))}),17)(),refScrollPointInFlight.current?.top===newTop&&refScrollPointInFlight.current?.left===newLeft||(refScrollPointInFlight.current={left:newLeft,top:newTop},onImmediateScroll({left:newLeft,top:newTop}),onViewportChange({left:newLeft,top:newTop,width:containerWidth,height:containerHeight,totalWidth,totalHeight})),resetIsScrollingDebounced()}),[totalWidth,totalHeight,rowDims,columnDims]);(0,react.useEffect)((()=>{refScrollPointInFlight.current||scrollTo({left:scrollLeft,top:scrollTop})}),[totalWidth,containerWidth,totalHeight,containerHeight]),(0,react.useLayoutEffect)((()=>{refScrollPointInFlight.current={left:propScrollPoint?.left,top:propScrollPoint?.top},scrollTo(refScrollPointInFlight.current)}),[propScrollPoint?.left,propScrollPoint?.top]);const scrollBy=(0,useCallbackRef.c)((options=>{const scrollLeft=options?.left??options?.[0],scrollTop=options?.top??options?.[1],behavior=options?.behavior??"auto",optionsScrollTo={left:refScrollState.current.left+(scrollLeft??0),top:refScrollState.current.top+(scrollTop??0)};behavior&&(optionsScrollTo.behavior=behavior),scrollTo(optionsScrollTo)}),[totalWidth,containerWidth,totalHeight,containerHeight]),getViewFromCoords=(0,react.useCallback)((coords=>{let view=null;if(Object.keys(viewLayouts).length>1){const viewKeys=ANCHOR_PANE_Z_ORDER;for(let k=0;!view&&k<viewKeys.length;k++){const viewCheck=viewLayouts[viewKeys[k]];viewCheck&&(0,RangeUtils.LX)(coords,viewCheck.visibleCellRange)&&(view=viewCheck)}}return view||(view=viewLayouts[Primitives.tb.Center]),view}),[viewLayouts]),scrollCellIntoView=(0,useCallbackRef.c)(((coords,options={inline:"nearest",block:"nearest"},anchor=null)=>{const completedCoords={rowIndex:0,colIndex:0,...coords};let view=null;if(null!==anchor){if(view=viewLayouts[anchor],null===view)return new Promise(((resolve,reject)=>{reject("Invalid view")}))}else view=getViewFromCoords(completedCoords);const asRange=getCoordsAsRange(completedCoords),x=view.cellLayout.getColOffset(asRange.colStart),y=view.cellLayout.getRowOffset(asRange.rowStart),right=view.cellLayout.getColOffset(asRange.colEnd+1),bottom=view.cellLayout.getRowOffset(asRange.rowEnd+1),scrollToPoint={...(0,helpers.Js)({x:x+view.scrollTopLeft.left,y:y+view.scrollTopLeft.top,width:right-x,height:bottom-y},{left:view.scrollTopLeft.left,top:view.scrollTopLeft.top,width:view.bounds.width,height:view.bounds.height,totalWidth:view.totalSize.width,totalHeight:view.totalSize.height},options)};return scrollToPoint.left>scrollLeft?scrollToPoint.left+=20:scrollToPoint.left<scrollLeft&&(scrollToPoint.left-=0),scrollToPoint.top>scrollTop?scrollToPoint.top+=20:scrollToPoint.top<scrollTop&&(scrollToPoint.top-=0),view.scrollOrientation.horizontal&&void 0!==coords.colIndex||delete scrollToPoint.left,view.scrollOrientation.vertical&&void 0!==coords.rowIndex||delete scrollToPoint.top,new Promise(((resolve,reject)=>{try{scrollTo(scrollToPoint),resolve(scrollToPoint)}catch(error){reject(error)}}))}),[totalWidth,totalHeight,viewLayouts]),handleWheel=(0,useCallbackRef.c)((event=>{const isScrollingHorizontally=event.shiftKey;event.preventDefault();const{deltaX,deltaY,deltaMode}=event;if(refWheelDelta.current)return;let retIntercept=onWheelScroll?.(event);if(!1===retIntercept)return;let dx=isScrollingHorizontally?deltaY:deltaX,dy=deltaY;const isHorizontal=isScrollingHorizontally||Math.abs(dx)>Math.abs(dy);1===deltaMode&&(dy*=0),refWheelDelta.current=window.requestAnimationFrame((()=>{refWheelDelta.current=null,scrollBy(isHorizontal?{left:dx}:{top:dy})}))}),[totalWidth,containerWidth,totalHeight,containerHeight,onWheelScroll]),invalidate=(0,react.useCallback)(((_coords=null)=>{refLastRenderedCellsCache.current=null,refLastOverlayRenderCache.current=null,forceRender()}),[]);(0,react.useLayoutEffect)((()=>{invalidate()}),[propCellRenderer]);const attributes=(0,react.useMemo)((()=>({stage:refStage.current,focus:focusContainer,contains:containsContainer,invalidate,scrollTo,scrollBy,scrollCellIntoView,getScrollPosition,getDimensions,getViewport,handleWheel,rowCount,columnCount,cellLayout:baseLayout,getCoordsAsRange,getRelativePointFromOffset,getViewFromOffset,getViewFromCoords,getViewFromLocation,onViewChangeOnce:callback=>{refListenersOnViewChangeOnce.current.push(callback)}})),[rowCount,columnCount,viewLayouts]),elementGrid=(0,react.useMemo)((()=>{if(!refScrollContainer.current)return;const keys=Object.keys(attributes);for(let k=0;k<keys.length;k++)refScrollContainer.current[keys[k]]=attributes[keys[k]];return refScrollContainer.current}),[attributes,refScrollContainer.current]);(0,react.useImperativeHandle)(refForwarded,(()=>elementGrid),[elementGrid]);const setupCellsRender=(view,cellContainers,rangesH,rangesV,mergedCellRenderMap,renderedReadCache,renderedWriteCache)=>{if(!view)return;const visibleColumns=view.getVisibleColumns(),visibleRows=view.getVisibleRows();if(0===visibleColumns.length||0===visibleRows.length)return;let visibleCells=null;if(propGetVisibleCells)visibleCells=propGetVisibleCells(view);else{visibleCells=[];for(let r=0;r<visibleRows.length;r++)for(let c=0;c<visibleColumns.length;c++){const coords={rowIndex:visibleRows[r],colIndex:visibleColumns[c]};if(propHiddenCellAt?.(coords))continue;const cell={coords,range:getCoordsAsRange(coords)};visibleCells.push(cell)}}const colOffsets=view.getVisibleColumnOffsets(),rowOffsets=view.getVisibleRowOffsets(),topLeft_left=view.scrollTopLeft.left+view.freezeTopLeft.left,topLeft_top=view.scrollTopLeft.top+view.freezeTopLeft.top,colIndexStart=Math.trunc(topLeft_left/3e3),rowIndexStart=Math.trunc(topLeft_top/3e3),segments={},renderCell=(view,coords,range,bounds,value)=>{const cellKey=`view:${view.anchor}:cell:${(0,helpers.A)(coords.rowIndex,coords.colIndex)}`,x=bounds.x,y=bounds.y,colIndex=Math.trunc((topLeft_left+x)/3e3)-colIndexStart,rowIndex=Math.trunc((topLeft_top+y)/3e3)-rowIndexStart;segments[rowIndex]||(segments[rowIndex]={});let segment=segments[rowIndex][colIndex];segment||(segment=segments[rowIndex][colIndex]=[]);let renderedCell=renderedReadCache?.get(cellKey);if(!renderedCell){const left=(topLeft_left+x)%3e3,top=(topLeft_top+y)%3e3;renderedCell=propCellRenderer({key:cellKey,bounds,zoom,range,view,value,style:{left:ReactUtils.zJ(left),top:ReactUtils.zJ(top),width:ReactUtils.zJ(bounds.width,!0),height:ReactUtils.zJ(bounds.height,!0)}})}renderedWriteCache?.set(cellKey,renderedCell),segment.push(renderedCell)};visibleCells.sort(((a,b)=>{let aRange=a?.range?a.range:(0,RangeUtils.ug)(a.coords),bRange=b?.range?b.range:(0,RangeUtils.ug)(b.coords);return-1*(0,helpers.Qx)(aRange,bRange)}));for(let cellOffset=0;visibleCells&&cellOffset<visibleCells.length;cellOffset++){const cell=visibleCells[cellOffset],coords=cell?.coords??cell;if(!coords)continue;const asRange=cell?.range??{rowStart:coords.rowIndex,colStart:coords.colIndex,rowEnd:coords.rowIndex,colEnd:coords.colIndex};if(!(0,RangeUtils.IP)(asRange,view.visibleCellRange)&&!(0,RangeUtils.mT)(asRange,view.visibleCellRange))continue;const isSpanned=asRange&&!(0,RangeUtils.di)(asRange);if(!isSpanned&&propHiddenCellAt?.(coords))continue;const rowIndex=coords.rowIndex,colIndex=coords.colIndex,rowOffs=rowOffsets[rowIndex],colOffs=colOffsets[colIndex];let bounds=null;rowOffs&&colOffs&&(bounds={x:colOffs.offset,y:rowOffs.offset,width:colOffs.size,height:rowOffs.size});const cellId=(0,helpers.A)(asRange.rowStart,asRange.colStart);if(isSpanned){if(mergedCellRenderMap.has(cellId))continue;mergedCellRenderMap.add(cellId),asRange.rowEnd-asRange.rowStart>0&&rangesH.push(asRange),asRange.colEnd-asRange.colStart>0&&rangesV.push(asRange)}if(isSpanned&&(bounds=(0,RangeUtils.fL)(view.cellLayout,asRange)),!bounds){console.warn("no bounds for cell",cellId);continue}const value=cell?.value;renderCell(view,coords,asRange,bounds,value)}const leftSegment=topLeft_left%3e3,topSegment=topLeft_top%3e3,segmentRKeys=Object.keys(segments);for(let r=0;r<segmentRKeys.length;r++){const segmentR=segments[segmentRKeys[r]];if(!segmentR)continue;const segmentCKeys=Object.keys(segmentR);for(let c=0;c<segmentCKeys.length;c++){const segmentC=segmentR[segmentCKeys[c]];if(!segmentC)continue;const rI=parseInt(segmentRKeys[r]),cI=parseInt(segmentCKeys[c]),rA=rI+rowIndexStart,cA=cI+colIndexStart,key=`view:${view.anchor}:segment:${cA}:${rA}`;cellContainers.push((0,jsx_runtime.jsx)("div",{className:"cell-container",style:{transform:`translate(${ReactUtils.zJ(3e3*cI-leftSegment,!0)}px, ${ReactUtils.zJ(3e3*rI-topSegment,!0)}px)`},children:segmentC},key))}}},renderedCells=(0,react.useMemo)((()=>{const renderReadCache=refLastRenderedCellsCache.current,renderWriteCache=new Map,retValue={},viewKeys=Object.keys(viewLayouts);for(let k=0;k<viewKeys.length;k++){const anchor=viewKeys[k],rangesH=[],rangesV=[],cells=[];setupCellsRender(viewLayouts[anchor],cells,rangesH,rangesV,new Set,renderReadCache,renderWriteCache),retValue[anchor]={cells,rangesH,rangesV}}return refLastRenderedCellsCache.current=renderWriteCache,retValue}),[_,rowCount,columnCount,rowDims,columnDims,propShowGridLines,propStyle,clipCells,mergedRangeMap,propHiddenCellAt,propGetVisibleCells,getCoordsAsRange]),setupGridlineRenderer=(overlayView,isHorizontal,gridLines,ranges)=>{if(overlayView)if(isHorizontal){const uid=`view:${overlayView.anchor}:hl:`,visibleIndices=overlayView.getVisibleRows();if(!visibleIndices||0===visibleIndices.length)return;const start=0,end=overlayView.bounds.width;let rangesCurrent=[];const sortRanges=ranges.sort(helpers.Qx);for(let rowOffset=0;rowOffset<visibleIndices.length&&visibleIndices[rowOffset]<=overlayView.visibleCellRange.rowEnd;rowOffset++){const rowIndex=visibleIndices[rowOffset];if(rowIndex<overlayView.visibleCellRange.rowStart)continue;let addedRange=!1;for(;sortRanges.length>0&&sortRanges[0].rowStart<=rowIndex;){const range=sortRanges.shift();range.rowEnd>rowIndex&&(rangesCurrent.push(range),addedRange=!0)}addedRange&&(rangesCurrent=rangesCurrent.sort(helpers._M));const y=overlayView.cellLayout.getRowOffset(rowIndex+1);let nextX=start;for(let i=0;i<rangesCurrent.length+1;i++){let x1=nextX,x2=end;const range=rangesCurrent[i];i<rangesCurrent.length&&(x2=Math.min(end,overlayView.cellLayout.getColOffset(range.colStart)),nextX=Math.min(end,overlayView.cellLayout.getColOffset(range.colEnd+1))),gridLines.push((0,react.createElement)("path",{d:`M ${ReactUtils.zJ(x1)} ${ReactUtils.zJ(y)} L ${ReactUtils.zJ(x2)} ${ReactUtils.zJ(y)}`,stroke:gridLineColor,strokeWidth:1,vectorEffect:"non-scaling-stroke",...gridLineRowsProps,key:uid+rowIndex+":"+i}))}for(let i=rangesCurrent.length-1;i>=0;i--)rangesCurrent[i].rowEnd<=visibleIndices[rowOffset+1]&&rangesCurrent.splice(i,1)}}else{const uid=`view:${overlayView.anchor}:vl:`,visibleIndices=overlayView.getVisibleColumns();if(!visibleIndices||0===visibleIndices.length)return;const start=0,end=overlayView.bounds.height;let rangesCurrent=[];const sortRanges=ranges.sort(helpers._M);for(let columnOffset=0;columnOffset<visibleIndices.length&&visibleIndices[columnOffset]<=overlayView.visibleCellRange.colEnd;columnOffset++){const colIndex=visibleIndices[columnOffset];if(colIndex<overlayView.visibleCellRange.colStart)continue;let addedRange=!1;for(;sortRanges.length>0&&sortRanges[0].colStart<=colIndex;){const range=sortRanges.shift();range.colEnd>colIndex&&(rangesCurrent.push(range),addedRange=!0)}addedRange&&(rangesCurrent=rangesCurrent.sort(helpers.Qx));const x=overlayView.cellLayout.getColOffset(colIndex+1);let nextY=start;for(let i=0;i<rangesCurrent.length+1;i++){let y1=nextY,y2=end;const range=rangesCurrent[i];i<rangesCurrent.length&&(y2=Math.min(end,overlayView.cellLayout.getRowOffset(range.rowStart)),nextY=Math.min(end,overlayView.cellLayout.getRowOffset(range.rowEnd+1))),gridLines.push((0,jsx_runtime.jsx)("path",{d:`M ${ReactUtils.zJ(x)} ${ReactUtils.zJ(y1)} L ${ReactUtils.zJ(x)} ${ReactUtils.zJ(y2)}`,stroke:gridLineColor,strokeWidth:1,vectorEffect:"non-scaling-stroke",...gridLineColumnsProps},uid+colIndex+":"+i))}for(let i=rangesCurrent.length-1;i>=0;i--)rangesCurrent[i].colEnd<=visibleIndices[columnOffset+1]&&rangesCurrent.splice(i,1)}}},setupGridlinesRenderer=isHorizontal=>{if(!renderedCells)return;const retValue={};for(let k=0;k<viewKeys.length;k++){const anchor=viewKeys[k],view=viewLayouts[anchor],gridLines=[];setupGridlineRenderer(view,isHorizontal,gridLines,isHorizontal?renderedCells[anchor].rangesH:renderedCells[anchor].rangesV);const bounds=view.getCellRangeBounds();retValue[anchor]=(0,jsx_runtime.jsx)("svg",{width:`${bounds.width}`,height:`${bounds.height}`,viewBox:`0 0 ${bounds.width} ${bounds.height}`,preserveAspectRatio:"none",shapeRendering:"crispEdges",style:{position:"absolute"},children:gridLines})}return retValue},renderedGridLinesHorizontal=(0,react.useMemo)((()=>!0===propShowGridLines||!0===propShowGridLines?.horizontal?setupGridlinesRenderer(!0):null),[_,propShowGridLines,rowDims,propFreezeTop,propFreezeLeft,gridLineColor,gridLineRowsProps,rowCount,columnCount,containerWidth,totalWidth,renderedCells]),renderedGridLinesVertical=(0,react.useMemo)((()=>!0===propShowGridLines||!0===propShowGridLines?.vertical?setupGridlinesRenderer(!1):null),[_,propShowGridLines,columnDims,propFreezeTop,propFreezeLeft,gridLineColor,gridLineColumnsProps,rowCount,columnCount,containerHeight,totalHeight,renderedCells]),frozenLeftDivider=(0,react.useMemo)((()=>0===frozenBoundaries.left?null:(0,jsx_runtime.jsx)(SVG.L,{linePoints:[0,0,0,containerHeight+1],bounds:{x:frozenBoundaries.left,y:0,width:1,height:containerHeight+1},...freezeLeftProps})),[_,frozenBoundaries.left,containerHeight,freezeLeftProps]),frozenTopDivider=(0,react.useMemo)((()=>0===frozenBoundaries.top?null:(0,jsx_runtime.jsx)(SVG.L,{linePoints:[0,0,containerWidth+1,0],bounds:{x:0,y:frozenBoundaries.top,width:containerWidth+1,height:1},...freezeTopProps})),[_,frozenBoundaries.top,containerWidth,freezeTopProps]),stageChildren=(0,react.useMemo)((()=>{const views=[],renderView=anchor=>{if(anchor&&viewLayouts[anchor])return(0,jsx_runtime.jsxs)("div",{style:{position:"absolute",pointerEvents:"none",left:viewLayouts[anchor].bounds.x,top:viewLayouts[anchor].bounds.y,width:viewLayouts[anchor].bounds.width,height:viewLayouts[anchor].bounds.height,clip:`rect(0, ${viewLayouts[anchor].bounds.width+1}px, ${viewLayouts[anchor].bounds.height+1}px, 0)`},className:`view view-${anchor}`,children:[renderedGridLinesHorizontal?.[anchor],renderedGridLinesVertical?.[anchor],renderedCells?.[anchor].cells]},`view:${anchor}`)};for(let k=0;k<viewKeys.length;k++)views.push(renderView(viewKeys[k]));return(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:views})}),[viewLayouts,renderedGridLinesHorizontal,renderedGridLinesVertical,renderedCells]),renderedOverlays=(0,react.useMemo)((()=>{if(!refForwarded||!overlays||0===overlays.length)return;const renderOverlays=(readCache,writeCache,currentView,overlays)=>{const renderedOverlays=[];for(let i=0;i<overlays.length;i++){const overlayRender=overlays[i];let rendered=readCache?.get(overlayRender);rendered!==EMPTY_CACHE_KEY&&(rendered=overlayRender(currentView)??EMPTY_CACHE_KEY),writeCache.set(overlayRender,rendered),rendered&&rendered!==EMPTY_CACHE_KEY&&renderedOverlays.push(rendered)}return renderedOverlays},renderView=(readCache,writeCache,currentView)=>{if(currentView)return(0,jsx_runtime.jsx)("div",{className:(0,clsx.A)(src_Grid_module.view),style:{position:"absolute",left:currentView.bounds.x-currentView.insets.left,top:currentView.bounds.y-currentView.insets.top,width:currentView.bounds.width-(currentView.insets.left+currentView.insets.right),height:currentView.bounds.height-(currentView.insets.top+currentView.insets.bottom),clipPath:allowOverlaysOverflow?"inset(-2px)":"inset(0px)"},children:renderOverlays(readCache,writeCache,currentView,overlays)},`view:${currentView.anchor}`)},renderReadCache=refLastOverlayRenderCache.current,renderWriteCache={},renderedViews=[],viewKeys=Object.keys(viewLayouts);for(let k=0;k<viewKeys.length;k++){const anchor=viewKeys[k],readCache=renderReadCache?.[anchor],writeCache=renderWriteCache[anchor]=new Map;renderedViews.push(renderView(readCache,writeCache,viewLayouts[anchor]))}return refLastOverlayRenderCache.current=renderWriteCache,(0,jsx_runtime.jsx)("div",{style:{pointerEvents:"none",position:"absolute",top:"0px",left:"0px",width:containerWidth,height:containerHeight},children:renderedViews})}),[_,viewLayouts,allowOverlaysOverflow,overlays]),stage=(0,react.useMemo)((()=>{const{style:stageStyle,...stageRest}=stageProps??{};return(0,jsx_runtime.jsx)("div",{style:{width:containerWidth,height:containerHeight,...stageStyle},className:"sheetxl-stage",tabIndex:0,ref:refStage,...stageRest,...rest,children:stageWrapper?stageWrapper(stageChildren):stageChildren})}),[containerWidth,containerHeight,stageChildren,stageProps,stageWrapper]),refFirstRender=(0,react.useRef)(!1);return(0,react.useEffect)((()=>{!refFirstRender.current&&renderedCells&&(refFirstRender.current=!0,onFirstRender?.(elementGrid))}),[renderedCells]),(0,jsx_runtime.jsxs)("div",{className:(0,clsx.A)("sheetxl-grid",src_Grid_module["sheetxl-grid"]),style:{overflow:"visible",cursor,maxWidth:containerWidth,maxHeight:containerHeight,width:containerWidth,height:containerHeight,...propStyle},ref:refScrollContainer,children:[stage,(0,jsx_runtime.jsxs)("div",{className:(0,clsx.A)("sheetxl-overlays"),ref:refOverlays,...overlaysProps,children:[renderedOverlays,frozenLeftDivider,frozenTopDivider]})]})}))),src_BaseGrid=BaseGrid;try{BaseGrid.displayName="BaseGrid",BaseGrid.__docgenInfo={description:"Data grid component for rendering cells onto a virtual panel.\nThis component coordinates between CellLayout and CellRenderer.\nThis component expects a width and height to be passed to it.\n\n* To support dynamic width/height based on div sizing wrap this is",displayName:"BaseGrid",props:{width:{defaultValue:null,description:"Width of the grid container",name:"width",required:!1,type:{name:"number"}},height:{defaultValue:null,description:"Height of the grid container",name:"height",required:!1,type:{name:"number"}},columnCount:{defaultValue:null,description:"Number of columns in the grid",name:"columnCount",required:!0,type:{name:"number"}},rowCount:{defaultValue:null,description:"Number of rows in the grid",name:"rowCount",required:!0,type:{name:"number"}},defaultColumnWidth:{defaultValue:null,description:"Passed through to\n@see useCellLayoutHook. If cellLayout property is provided this is ignored",name:"defaultColumnWidth",required:!1,type:{name:"number"}},defaultRowHeight:{defaultValue:null,description:"Passed through to\n@see useCellLayoutHook. If cellLayout property is provided this is ignored",name:"defaultRowHeight",required:!1,type:{name:"number"}},getRowHeight:{defaultValue:null,description:"Passed through to\n@see useCellLayoutHook. If cellLayout property is provided this is ignored",name:"getRowHeight",required:!1,type:{name:"ItemSizer"}},getColumnWidth:{defaultValue:null,description:"Passed through to\n@see useCellLayoutHook. If cellLayout property is provided this is ignored",name:"getColumnWidth",required:!1,type:{name:"ItemSizer"}},cellLayout:{defaultValue:null,description:"",name:"cellLayout",required:!1,type:{name:"CellLayout"}},onViewportScroll:{defaultValue:null,description:"Called on scroll, subject to debouncing. Used for programmatic changes. Called even on load",name:"onViewportScroll",required:!1,type:{name:"(scrollPoint: Partial<TopLeft>) => void"}},onImmediateScroll:{defaultValue:null,description:"Called immediately on scroll. Used for programmatic changes. Called even on load",name:"onImmediateScroll",required:!1,type:{name:"(scrollPoint: Partial<TopLeft>) => void"}},onViewportChange:{defaultValue:null,description:"Fired when the view port changes.\nThis is in pixel coordinates and is slightly different than viewable cells because off screen location range could change",name:"onViewportChange",required:!1,type:{name:"(viewport: ScrollableViewport) => void"}},enableMouseWheel:{defaultValue:null,description:"Enable dragging active cell and selections",name:"enableMouseWheel",required:!1,type:{name:"boolean"}},onWheelScroll:{defaultValue:null,description:"When wheel mouse is called. If return false then wheelMouse will not be processed",name:"onWheelScroll",required:!1,type:{name:"(event: WheelEvent) => boolean | void"}},scrollPoint:{defaultValue:null,description:"The location of the top left scroll corner",name:"scrollPoint",required:!1,type:{name:"Partial<TopLeft>"}},mergedRanges:{defaultValue:null,description:"Is either an array of merged cells or a CellRangeLookup",name:"mergedRanges",required:!1,type:{name:"CellRangeCoords[] | CellRangeLookup"}},freezeLeft:{defaultValue:null,description:"Number of frozen left",name:"freezeLeft",required:!1,type:{name:"number | FrozenEdge"}},freezeTop:{defaultValue:null,description:"Number of frozen top",name:"freezeTop",required:!1,type:{name:"number | FrozenEdge"}},freezeLeftProps:{defaultValue:null,description:"Allow for customization of freezeTopDivider",name:"freezeLeftProps",required:!1,type:{name:"Partial<LineProps>"}},freezeTopProps:{defaultValue:null,description:"Allow for customization of freezeTopDivider",name:"freezeTopProps",required:!1,type:{name:"Partial<LineProps>"}},onFirstRender:{defaultValue:null,description:"Call only once when the renders for the first time.",name:"onFirstRender",required:!1,type:{name:"(grid: GridElement) => void"}},cellRenderer:{defaultValue:null,description:"Return the actual element to render\n@remarks There can be many cells so care should be taken\nto ensure these are as performant as possible. By default\nthe pointerEvents are set to none. To enable interaction this should be\noverwritten.",name:"cellRenderer",required:!1,type:{name:"(props: CellRendererProps<any>) => ReactNode"}},cellInsets:{defaultValue:null,description:"Allow for cells to be inset. This is a way to account for borders. By default this is 1, 1, 1,x",name:"cellInsets",required:!1,type:{name:"Rectangle"}},overlays:{defaultValue:null,description:"Render elements for the view. This will be called whenever the viewport changes",name:"overlays",required:!1,type:{name:"((view: GridOverlayView) => ReactNode)[]"}},overlaysProps:{defaultValue:null,description:"Props called to overlays",name:"overlaysProps",required:!1,type:{name:"HTMLAttributes<HTMLDivElement>"}},allowOverlaysOverflow:{defaultValue:null,description:"Overlays are generally clipped to fit in the viewport but\nthis allows for the properties to be overridden.",name:"allowOverlaysOverflow",required:!1,type:{name:"boolean"}},stageWrapper:{defaultValue:null,description:"Allows users to Wrap stage children in Top level Context",name:"stageWrapper",required:!1,type:{name:"(children: ReactNode) => ReactNode"}},stageProps:{defaultValue:null,description:"Props that can be injected to stage",name:"stageProps",required:!1,type:{name:"HTMLAttributes<HTMLDivElement>"}},showGridLines:{defaultValue:null,description:"Show grid lines.\nUseful for spreadsheets\nNOTE - should we just allow gridline renderers to be null?",name:"showGridLines",required:!1,type:{name:"boolean | DirectionOptions"}},gridLineColor:{defaultValue:null,description:"Customize grid line color\n@remarks This is overwritten by gridlinePropsVertical and gridlinePropsHorizontal",name:"gridLineColor",required:!1,type:{name:"string"}},gridLineRowsProps:{defaultValue:null,description:"Gridline props for rows",name:"gridLineRowsProps",required:!1,type:{name:"SVGProps<SVGPathElement>"}},gridLineColumnsProps:{defaultValue:null,description:"Gridline props for columns",name:"gridLineColumnsProps",required:!1,type:{name:"SVGProps<SVGPathElement>"}},hiddenRowsAt:{defaultValue:null,description:"Will skip rendering for this row and the adjacent rows in the given direction.",name:"hiddenRowsAt",required:!1,type:{name:"(rowIndex: number, forward: boolean) => number"}},hiddenColumnsAt:{defaultValue:null,description:"Will skip rendering for this columns and the adjacent columns in the given direction.",name:"hiddenColumnsAt",required:!1,type:{name:"(colIndex: number, forward: boolean) => number"}},hiddenCellAt:{defaultValue:null,description:"This will skip rendering.\nNote - This is superseded by hiddenRowsAt and hiddenColumnsAt.\nThis is typically used for cells that have nothing to render",name:"hiddenCellAt",required:!1,type:{name:"(coords: CellCoords) => boolean"}},getVisibleCells:{defaultValue:null,description:"Allows for optimization of rendering.\nThis will allow for quick skipping of cells that have nothing to render.\nIf this is not specified then all cells within the visible range will be\niterated and if hiddenCellAt does not return false a then cell renderer will be\ncalled.\n@param cellRange\n@returns either a CellCoord that should be rendered or an object with a coord and value. Note - the value is passed to the cell renderer",name:"getVisibleCells",required:!1,type:{name:"(view: GridOverlayView) => (CellCoords | { coords: CellCoords; value?: any; range?: CellRangeCoords; })[]"}},zoom:{defaultValue:null,description:"Zoom. 1 means no zoom\n@defaultValue 1 or none.",name:"zoom",required:!1,type:{name:"number"}},cursor:{defaultValue:null,description:"Cursor used for grid",name:"cursor",required:!1,type:{name:"string"}},clipCells:{defaultValue:null,description:"Clip overflow of cells unless explicitly provided",name:"clipCells",required:!1,type:{name:"boolean"}},ref:{defaultValue:null,description:"",name:"ref",required:!1,type:{name:"Ref<GridElement>"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/grid/src/BaseGrid.tsx#BaseGrid"]={docgenInfo:BaseGrid.__docgenInfo,name:"BaseGrid",path:"../../packages/grid/src/BaseGrid.tsx#BaseGrid"})}catch(__react_docgen_typescript_loader_error){}},"../../packages/grid/src/SVG.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{$:()=>SVGRect,L:()=>SVGLine});__webpack_require__("../../node_modules/react/index.js");var _sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../packages/common-react/src/utils/ReactUtils.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/react/jsx-runtime.js");const svgRectPath=(rect,close=!0)=>`M ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.left)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.top)} L ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.right,!0)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.top)} L ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.right,!0)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.bottom,!0)} L ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.left)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.bottom,!0)} L ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.left)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(rect.top)} ${close?"Z":""}`,SVGLine=props=>{const{linePoints,bounds,pathProps,style:propStyle,...rest}=props;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{width:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.width,!0)}`,height:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.height,!0)}`,viewBox:`0 0 ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.width,!0)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.height,!0)}`,style:{position:"absolute",left:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.x)}px`,top:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.y)}px`,width:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.width,!0)}px`,height:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(bounds.height,!0)}px`,pointerEvents:"none",transitionTimingFunction:"linear",transitionDelay:"0",transitionProperty:"left, top, width, height",willChange:"left, top, width, height, stroke-dashoffset",...propStyle},...rest,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:`M ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(linePoints[0])} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(linePoints[1])} L ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(linePoints[2])} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(linePoints[3])}`,fill:"none",vectorEffect:"non-scaling-stroke",stroke:"black",...pathProps})})};SVGLine.displayName="SVGLine";const SVGRect=props=>{const{x=0,y=0,width=0,height=0,fill,stroke,strokeWidth=0,strokeDasharray,strokeDashoffset,clipPath,pathBounds,pathProps,style:propStyle,...rest}=props,nY=y,nX=x,nWidth=width,nHeight=height;let fills=null;if(fill){let path=svgRectPath({top:0,left:0,bottom:nHeight,right:nWidth});pathBounds&&(path=path+" "+svgRectPath({top:pathBounds.y-nY,left:pathBounds.x-nX,bottom:pathBounds.height+pathBounds.y-nY,right:pathBounds.width+pathBounds.x-nX})),fills=[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:path,fill,stroke:"none",fillRule:"evenodd"},"fill")]}return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{width:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(width,!0)}`,height:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(height,!0)}`,viewBox:`0 0 ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(width,!0)} ${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(height,!0)}`,preserveAspectRatio:"none",style:{position:"absolute",left:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(x)}px`,top:`${_sheetxl_common_react__WEBPACK_IMPORTED_MODULE_2__.zJ(y)}px`,pointerEvents:"none",transitionDuration:"0ms",transitionTimingFunction:"linear",transitionDelay:"0",transitionProperty:"left, top, width, height",willChange:"left, top, width, height, stroke-dashoffset",boxShadow:"rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px",overflow:"visible",...propStyle},...rest,children:[fills,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:svgRectPath({top:0,left:0,right:nWidth,bottom:nHeight}),fill:"none",strokeDasharray,strokeDashoffset,stroke,vectorEffect:"non-scaling-stroke",strokeWidth,...pathProps})]})};try{SVGLine.displayName="SVGLine",SVGLine.__docgenInfo={description:"",displayName:"SVGLine",props:{linePoints:{defaultValue:null,description:"",name:"linePoints",required:!0,type:{name:"number[]"}},bounds:{defaultValue:null,description:"",name:"bounds",required:!0,type:{name:"Bounds"}},pathProps:{defaultValue:null,description:"",name:"pathProps",required:!1,type:{name:"SVGProps<SVGPathElement>"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/grid/src/SVG.tsx#SVGLine"]={docgenInfo:SVGLine.__docgenInfo,name:"SVGLine",path:"../../packages/grid/src/SVG.tsx#SVGLine"})}catch(__react_docgen_typescript_loader_error){}try{SVGRect.displayName="SVGRect",SVGRect.__docgenInfo={description:"",displayName:"SVGRect",props:{pathBounds:{defaultValue:null,description:"",name:"pathBounds",required:!1,type:{name:"Bounds"}},pathProps:{defaultValue:null,description:"",name:"pathProps",required:!1,type:{name:"SVGProps<SVGPathElement>"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/grid/src/SVG.tsx#SVGRect"]={docgenInfo:SVGRect.__docgenInfo,name:"SVGRect",path:"../../packages/grid/src/SVG.tsx#SVGRect"})}catch(__react_docgen_typescript_loader_error){}},"../../packages/grid/src/utils/RangeUtils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{GR:()=>isCoordsInRanges,IP:()=>isRangesIntersect,LX:()=>isCoordsWithinRange,di:()=>isSingleCell,fL:()=>getCellRangeBounds,hC:()=>isEqualRanges,im:()=>intersectRanges,kF:()=>extendRangeToUnionRanges,mT:()=>isRangeWithinRange,rv:()=>isEqualCoords,tN:()=>isEqualRangesArrays,ug:()=>rangeFromCoords});const isEqualCoords=(a,b)=>a===b||!(a&&!b||b&&!a)&&(a.rowIndex===b.rowIndex&&a.colIndex===b.colIndex),isEqualRanges=(a,b)=>a===b||!(!a||!b)&&(a.rowEnd===b.rowEnd&&a.rowStart===b.rowStart&&a.colStart===b.colStart&&a.colEnd===b.colEnd),isEqualRangesArrays=(a,b)=>{if(a===b)return!0;if(!a||!b)return!1;if(a.length!==b.length)return!1;for(let i=0;i<a.length;i++)if(!isEqualRanges(a[i],b[i]))return!1;return!0},isSingleCell=coords=>!!coords&&(coords.rowEnd===coords.rowStart&&coords.colStart===coords.colEnd),isCoordsWithinRange=(coords,range)=>!(coords.rowIndex<range.rowStart||coords.rowIndex>range.rowEnd)&&!(coords.colIndex<range.colStart||coords.colIndex>range.colEnd),isCoordsInRanges=(coords,ranges)=>{const cellAsRange={rowStart:coords.rowIndex,colStart:coords.colIndex,rowEnd:coords.rowIndex,colEnd:coords.colIndex};for(let i=ranges.length-1;i>=0;i--)if(isRangesIntersect(cellAsRange,ranges[i]))return i;return-1},isRangesIntersect=(range1,range2)=>!(range1.colStart>range2.colEnd||range2.colStart>range1.colEnd)&&!(range1.rowStart>range2.rowEnd||range2.rowStart>range1.rowEnd),isRangeWithinRange=(range1,range2)=>range1.rowStart>=range2.rowStart&&range1.rowEnd<=range2.rowEnd&&range1.colStart>=range2.colStart&&range1.colEnd<=range2.colEnd,rangeFromCoords=coords=>coords?{rowStart:coords.rowIndex??0,colStart:coords.colIndex??0,rowEnd:coords.rowIndex??0,colEnd:coords.colIndex??0}:null,getCellRangeBounds=(cellLayout,range,adjustment)=>{const x=cellLayout.getColOffset(range.colStart)+(adjustment?.left??0),y=cellLayout.getRowOffset(range.rowStart)+(adjustment?.top??0);return{x,y,width:cellLayout.getColOffset(range.colEnd+1)+(adjustment?.right??0)-(adjustment?.left??0)-x,height:cellLayout.getRowOffset(range.rowEnd+1)+(adjustment?.bottom??0)-(adjustment?.top??0)-y}},extendRangeToIntersectingRanges=(range,rangesLookup)=>{const extendedRange={...range};let rangeArray;if("function"==typeof rangesLookup)rangeArray=rangesLookup(range);else{if(!rangesLookup)return extendedRange;rangeArray=rangesLookup}for(const merged of rangeArray)isRangesIntersect(extendedRange,merged)&&(extendedRange.rowStart=Math.min(extendedRange.rowStart,merged.rowStart),extendedRange.colStart=Math.min(extendedRange.colStart,merged.colStart),extendedRange.rowEnd=Math.max(extendedRange.rowEnd,merged.rowEnd),extendedRange.colEnd=Math.max(extendedRange.colEnd,merged.colEnd));return extendedRange},extendRangeToUnionRanges=(range,rangesLookup)=>{let lastRange=range,currentRange=null;for(;!isEqualRanges(lastRange,currentRange);)currentRange=lastRange,lastRange=extendRangeToIntersectingRanges(currentRange,rangesLookup);return lastRange},intersectRanges=(a,b)=>a?b?a.rowStart>b.rowEnd||a.rowEnd<b.rowStart||a.colStart>b.colEnd||a.colEnd<b.colStart?null:{rowStart:Math.max(a.rowStart,b.rowStart),colStart:Math.max(a.colStart,b.colStart),rowEnd:Math.min(a.rowEnd,b.rowEnd),colEnd:Math.min(a.colEnd,b.colEnd)}:{...a}:{...b}},"../../packages/grid/src/utils/helpers.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>cellIdentifier,Ah:()=>isAllSelect,B7:()=>isPointWithinBounds,Bi:()=>getBoundedCells,D8:()=>isEqualGridSelection,Js:()=>virtualScrollToBounds,MP:()=>findNextCellInDataRegion,Qx:()=>RowFirstSorter,V8:()=>calcHiddenAt,_9:()=>clipBounds,_M:()=>ColumnFirstSorter,hp:()=>traverseHiddenHeaders,j0:()=>getVisibleHeaders,kr:()=>createViewOffsets,lA:()=>extendFillRangeToMergedCells,lh:()=>getFillDirectionAmount,xN:()=>convertToVisibleRanges,yl:()=>findNextCellWithinSelection});var _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../packages/common/src/types/Primitives.ts"),_RangeUtils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../packages/grid/src/utils/RangeUtils.ts");const traverseHiddenHeaders=(hiddenAt,index,direction)=>{if(!hiddenAt)return index;let newIndex=index;const forward=direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right||direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down;for(;;){const hiddenCount=hiddenAt(newIndex,forward);if(0===hiddenCount)return newIndex;forward?newIndex+=hiddenCount:newIndex-=hiddenCount}},getVisibleHeaders=(hiddenAt,startIndex,stopIndex)=>{const visibleHeaders=[];let currentIndex=startIndex;for(;currentIndex<=stopIndex;){const hiddenCount=Math.max(0,hiddenAt(currentIndex,!0));0===hiddenCount?(visibleHeaders.push(currentIndex),currentIndex++):currentIndex+=hiddenCount}return visibleHeaders},findNextCellContentful=(activeCoords,isContentful,hiddenHeadersAt,direction,next,limit)=>{if(!isContentful)return limit;let{rowIndex,colIndex}=activeCoords;switch(direction){case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down:{rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(rowIndex+1,limit),direction);let hasContent=isContentful({rowIndex,colIndex});for(;!hasContent&&rowIndex<limit;)rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(++rowIndex,limit),direction),hasContent=isContentful({rowIndex,colIndex});return rowIndex}case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up:{rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(rowIndex-1,limit),direction);let hasContent=isContentful({rowIndex,colIndex});for(;!hasContent&&rowIndex>limit;)rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(--rowIndex,limit),direction),hasContent=isContentful({rowIndex,colIndex});return rowIndex}case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right:{colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(colIndex+1,limit),direction);let hasContent=isContentful({rowIndex,colIndex});for(;!hasContent&&colIndex<limit;)colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(++colIndex,limit),direction),hasContent=isContentful({rowIndex,colIndex});return colIndex}case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left:{colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(colIndex-1,limit),direction);let hasContent=isContentful({rowIndex,colIndex});for(;!hasContent&&colIndex>limit;)colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(--colIndex,limit),direction),hasContent=isContentful({rowIndex,colIndex});return colIndex}default:return limit}},findNextCellNonContentful=(activeCoords,isContentfulCell=(()=>!0),hiddenHeadersAt,direction,next,limit)=>{let{rowIndex,colIndex}=activeCoords;switch(direction){case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down:{rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(rowIndex+1,limit),direction);let hasContent=isContentfulCell?.({rowIndex,colIndex});for(;hasContent&&rowIndex<limit;)rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(++rowIndex,limit),direction),hasContent=isContentfulCell?.({rowIndex,colIndex});return isContentfulCell?.({rowIndex,colIndex})?rowIndex:rowIndex-1}case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up:{rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(rowIndex-1,limit),direction);let hasContent=isContentfulCell?.({rowIndex,colIndex});for(;hasContent&&rowIndex>limit;)rowIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(--rowIndex,limit),direction),hasContent=isContentfulCell?.({rowIndex,colIndex});return isContentfulCell?.({rowIndex,colIndex})?rowIndex:rowIndex+1}case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right:{colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(colIndex+1,limit),direction);let hasContent=isContentfulCell?.({rowIndex,colIndex});for(;hasContent&&colIndex<limit;)colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.min(++colIndex,limit),direction),hasContent=isContentfulCell?.({rowIndex,colIndex});return isContentfulCell?.({rowIndex,colIndex})?colIndex:colIndex-1}case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left:{colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(colIndex-1,limit),direction);let hasContent=isContentfulCell?.({rowIndex,colIndex});for(;hasContent&&colIndex>limit;)colIndex=traverseHiddenHeaders(hiddenHeadersAt,Math.max(--colIndex,limit),direction),hasContent=isContentfulCell?.({rowIndex,colIndex});return isContentfulCell?.({rowIndex,colIndex})?colIndex:colIndex+1}default:return null}},findNextCellInDataRegion=(activeCoords,isContentfulCell,hiddenHeadersAt,direction,first,limit)=>{if(!isContentfulCell)return limit;let nextCell,{rowIndex,colIndex}=activeCoords;direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down?nextCell={rowIndex:rowIndex+1,colIndex}:direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up?nextCell={rowIndex:rowIndex-1,colIndex}:direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right?nextCell={rowIndex,colIndex:colIndex+1}:direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left&&(nextCell={rowIndex,colIndex:colIndex-1});const isCurrentCellContentful=isContentfulCell(activeCoords),isNextCellContentful=isContentfulCell(nextCell);var cur,next;return(next=isNextCellContentful,!(cur=isCurrentCellContentful)&&!next||!cur&&next||cur&&!next?findNextCellContentful:findNextCellNonContentful)(activeCoords,isContentfulCell,hiddenHeadersAt,direction,!1,limit)??limit},isAllSelect=(ranges,top,left,bottom,right)=>{for(let i=0;i<ranges.length;i++){let range=ranges[i];if(range.rowStart===top&&range.colStart===left&&range.rowEnd===bottom&&range.colEnd===right)return!0}return!1},isEqualGridSelection=(a,b)=>a===b||!(!a||!b)&&(a.activeRangeIndex===b.activeRangeIndex&&(!!(0,_RangeUtils__WEBPACK_IMPORTED_MODULE_1__.rv)(a.activeCoords,b.activeCoords)&&(0,_RangeUtils__WEBPACK_IMPORTED_MODULE_1__.tN)(a.ranges,b.ranges))),getBoundedCells=coords=>{const cells=new Set;if(!coords)return cells;const{rowStart,rowEnd,colStart,colEnd}=coords;for(let r=rowStart;r<=rowEnd;r++)for(let c=colStart;c<=colEnd;c++)cells.add(cellIdentifier(r,c));return cells},cellIdentifier=(rowIndex,colIndex)=>`${rowIndex}:${colIndex}`,scrollViewportAxis=(align,elementStart,elementEnd,viewportStart,viewportEnd,totalSize)=>{if(elementEnd-elementStart>=viewportEnd-viewportStart)return viewportStart;let offset=viewportStart;if("nearest"===align&&(viewportStart-elementStart>0?align="start":elementEnd-viewportEnd>0&&(align="end")),"start"===align)offset=elementStart;else if("end"===align)offset=elementEnd-(viewportEnd-viewportStart);else if("center"===align){offset=elementStart+(elementEnd-elementStart)/2-(viewportEnd-viewportStart)/2}return Math.max(0,Math.min(offset,totalSize-(viewportEnd-viewportStart)))},virtualScrollToBounds=(elementBounds,viewport,options=!0)=>{options=!0===options?{block:"start",inline:"end"}:!1===options?{block:"end",inline:"end"}:{block:"end",inline:"end",...options};return{left:scrollViewportAxis(options.inline,elementBounds.x,elementBounds.x+elementBounds.width,viewport.left,viewport.left+viewport.width,viewport.totalWidth),top:scrollViewportAxis(options.block,elementBounds.y,elementBounds.y+elementBounds.height,viewport.top,viewport.top+viewport.height,viewport.totalHeight)}},convertToVisibleRanges=(gridSelection,_getCoordsAsRange,_hiddenRowsAt,_hiddenColumnsAt)=>(console.log("todo: implement convertToVisibleRanges"),gridSelection),findNextCellWithinSelection=(gridSelection,direction=_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right,getCoordsAsRange,hiddenRowsAt,hiddenColumnsAt,originalSelection=null)=>{if(originalSelection&&isEqualGridSelection(originalSelection,gridSelection))return gridSelection;const range=gridSelection.ranges[gridSelection.activeRangeIndex];if(!(0,_RangeUtils__WEBPACK_IMPORTED_MODULE_1__.IP)({rowStart:gridSelection.activeCoords.rowIndex,colStart:gridSelection.activeCoords.colIndex,rowEnd:gridSelection.activeCoords.rowIndex,colEnd:gridSelection.activeCoords.colIndex},range))return gridSelection;let nextActiveCoords={...gridSelection.activeCoords},nextActiveRangeIndex=gridSelection.activeRangeIndex;switch(direction){case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right:nextActiveCoords.colIndex=traverseHiddenHeaders(hiddenColumnsAt,nextActiveCoords.colIndex+1,direction);break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left:nextActiveCoords.colIndex=traverseHiddenHeaders(hiddenColumnsAt,nextActiveCoords.colIndex-1,direction);break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down:nextActiveCoords.rowIndex=traverseHiddenHeaders(hiddenRowsAt,nextActiveCoords.rowIndex+1,direction);break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up:nextActiveCoords.rowIndex=traverseHiddenHeaders(hiddenRowsAt,nextActiveCoords.rowIndex-1,direction)}const traverseRanges=forward=>{if(forward){nextActiveRangeIndex=gridSelection.activeRangeIndex>=gridSelection.ranges.length-1?0:gridSelection.activeRangeIndex+1;const range=gridSelection.ranges[nextActiveRangeIndex];nextActiveCoords={colIndex:range.colStart,rowIndex:range.rowStart}}else{nextActiveRangeIndex=gridSelection.activeRangeIndex<=0?gridSelection.ranges.length-1:gridSelection.activeRangeIndex-1;const range=gridSelection.ranges[nextActiveRangeIndex];nextActiveCoords={colIndex:range.colEnd,rowIndex:range.rowEnd}}};if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right&&nextActiveCoords.colIndex>range.colEnd&&nextActiveCoords.rowIndex===range.rowEnd)traverseRanges(!0);else if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left&&nextActiveCoords.colIndex<range.colStart&&nextActiveCoords.rowIndex===range.rowStart)traverseRanges(!1);else if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down&&nextActiveCoords.colIndex===range.colEnd&&nextActiveCoords.rowIndex>range.rowEnd)traverseRanges(!0);else if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up&&nextActiveCoords.colIndex===range.colStart&&nextActiveCoords.rowIndex<range.rowStart)traverseRanges(!1);else{let rowIndex=nextActiveCoords.rowIndex,colIndex=nextActiveCoords.colIndex;switch(direction){case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right:colIndex>range.colEnd&&(rowIndex=traverseHiddenHeaders(hiddenRowsAt,rowIndex+1,direction),colIndex=range.colStart,rowIndex>range.rowEnd&&(rowIndex=range.rowStart));break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left:colIndex<range.colStart&&(rowIndex=traverseHiddenHeaders(hiddenRowsAt,rowIndex-1,direction),colIndex=range.colEnd,rowIndex<range.rowStart&&(rowIndex=range.rowEnd));break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down:rowIndex>range.rowEnd&&(colIndex=traverseHiddenHeaders(hiddenColumnsAt,colIndex+1,direction),rowIndex=range.rowStart,colIndex>range.colEnd&&(colIndex=range.colStart));break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up:rowIndex<range.rowStart&&(colIndex=traverseHiddenHeaders(hiddenColumnsAt,colIndex-1,direction),rowIndex=range.rowEnd,colIndex<range.colStart&&(colIndex=range.colEnd))}nextActiveCoords={rowIndex,colIndex}}let nextCoordsRange=getCoordsAsRange(nextActiveCoords);if(!(0,_RangeUtils__WEBPACK_IMPORTED_MODULE_1__.mT)(nextCoordsRange,range)){const intersectedRange=(0,_RangeUtils__WEBPACK_IMPORTED_MODULE_1__.im)(nextCoordsRange,range);intersectedRange&&(nextCoordsRange=intersectedRange)}let nextVisibleRange={rowStart:traverseHiddenHeaders(hiddenRowsAt,nextCoordsRange.rowStart,_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down),colStart:traverseHiddenHeaders(hiddenColumnsAt,nextCoordsRange.colStart,_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right),rowEnd:traverseHiddenHeaders(hiddenRowsAt,nextCoordsRange.rowEnd,_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up),colEnd:traverseHiddenHeaders(hiddenColumnsAt,nextCoordsRange.colEnd,_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left)};if(nextVisibleRange.rowStart!==nextActiveCoords.rowIndex||nextVisibleRange.colStart!==nextActiveCoords.colIndex){switch(direction){case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right:gridSelection.ranges[nextActiveRangeIndex].colStart===nextVisibleRange.colStart&&gridSelection.ranges[nextActiveRangeIndex].colEnd===nextVisibleRange.colEnd&&(nextActiveCoords.rowIndex=nextVisibleRange.rowEnd),nextActiveCoords.colIndex=nextVisibleRange.colEnd;break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left:gridSelection.ranges[nextActiveRangeIndex].colStart===nextVisibleRange.colStart&&gridSelection.ranges[nextActiveRangeIndex].colEnd===nextVisibleRange.colEnd&&(nextActiveCoords.rowIndex=nextVisibleRange.rowStart),nextActiveCoords.rowIndex===nextVisibleRange.rowStart?nextActiveCoords.colIndex=nextVisibleRange.colStart+1:nextActiveCoords.colIndex=nextVisibleRange.colStart;break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down:gridSelection.ranges[nextActiveRangeIndex].rowStart===nextVisibleRange.rowStart&&gridSelection.ranges[nextActiveRangeIndex].rowEnd===nextVisibleRange.rowEnd&&(nextActiveCoords.colIndex=nextVisibleRange.colEnd),nextActiveCoords.rowIndex=nextVisibleRange.rowEnd;break;case _sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up:gridSelection.ranges[nextActiveRangeIndex].rowStart===nextVisibleRange.rowStart&&gridSelection.ranges[nextActiveRangeIndex].rowEnd===nextVisibleRange.rowEnd&&(nextActiveCoords.colIndex=nextVisibleRange.colStart),nextActiveCoords.colIndex===nextVisibleRange.colStart?nextActiveCoords.rowIndex=nextVisibleRange.rowStart+1:nextActiveCoords.rowIndex=nextVisibleRange.rowStart}return originalSelection&&console.warn("call recursive > 1"),findNextCellWithinSelection({activeCoords:nextActiveCoords,ranges:gridSelection.ranges,activeRangeIndex:nextActiveRangeIndex},direction,getCoordsAsRange,hiddenRowsAt,hiddenColumnsAt,originalSelection??gridSelection)}return{ranges:gridSelection.ranges,activeCoords:nextActiveCoords,activeRangeIndex:nextActiveRangeIndex}},getFillDirectionAmount=(template,fill)=>{let direction,amount=0;return fill.colStart<template.colStart?(direction=_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left,amount=template.colStart-fill.colStart):fill.colEnd>template.colEnd?(direction=_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right,amount=fill.colEnd-template.colEnd):fill.rowStart<template.rowStart?(direction=_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up,amount=template.rowStart-fill.rowStart):fill.rowEnd>template.rowEnd&&(direction=_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down,amount=fill.rowEnd-template.rowEnd),{direction,amount}},extendFillRangeToMergedCells=(template,rangeExtended,mergedRanges,bounds,direction,amount)=>{const rangeExtendMerged={...rangeExtended};let mergeCellArray;if("function"==typeof mergedRanges)mergeCellArray=mergedRanges(template);else{if(!mergedRanges)return rangeExtendMerged;mergeCellArray=mergedRanges}if(0===mergeCellArray.length)return rangeExtendMerged;if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Left){const distance=template.colEnd+1-template.colStart;rangeExtendMerged.colStart=template.colStart-Math.ceil(amount/distance)*distance,rangeExtendMerged.colStart<bounds.left&&(rangeExtendMerged.colStart=rangeExtendMerged.colStart+Math.ceil((bounds.left-rangeExtendMerged.colStart)/distance)*distance)}else if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Right){const distance=template.colEnd+1-template.colStart;rangeExtendMerged.colEnd=template.colEnd+Math.ceil(amount/distance)*distance,rangeExtendMerged.colEnd>bounds.right&&(rangeExtendMerged.colEnd=rangeExtendMerged.colEnd-Math.ceil((bounds.right-rangeExtendMerged.colEnd)/distance)*distance)}else if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Up){const distance=template.rowEnd+1-template.rowStart;rangeExtendMerged.rowStart=template.rowStart-Math.ceil(amount/distance)*distance,rangeExtendMerged.rowStart<bounds.top&&(rangeExtendMerged.rowStart=rangeExtendMerged.rowStart+Math.ceil((bounds.top-rangeExtendMerged.rowStart)/distance)*distance)}else if(direction===_sheetxl_common__WEBPACK_IMPORTED_MODULE_0__.CF.Down){const distanced=template.rowEnd+1-template.rowStart;rangeExtendMerged.rowEnd=template.rowEnd+Math.ceil(amount/distanced)*distanced,rangeExtendMerged.rowEnd>bounds.bottom&&(rangeExtendMerged.rowEnd=rangeExtendMerged.rowEnd-Math.ceil((bounds.bottom-rangeExtendMerged.rowEnd)/distanced)*distanced)}return rangeExtendMerged},calcHiddenAt=(index,forward=!0,sizer,limit)=>{if(!sizer)return 0;let shift=forward?1:-1,currentOffset=sizer(forward?index:index+1),nextOffset=sizer(forward?index+1:index),nextIndex=index+(forward?2:-1),count=0;for(;(nextOffset-currentOffset)*shift<=0;){if(forward&&nextIndex-1>limit+1||!forward&&nextIndex+1<limit)return count;currentOffset=nextOffset,nextOffset=sizer(nextIndex),nextIndex+=shift,count++}return count},clipBounds=(bounds,limitBounds,insets=0)=>{if(bounds.x>limitBounds.width||bounds.y>limitBounds.height)return null;const boundsRect={left:bounds.x,top:bounds.y,bottom:bounds.height+bounds.y,right:bounds.width+bounds.x},limitedBoundsRect={left:limitBounds.x+insets,top:limitBounds.y+insets,bottom:limitBounds.height-2*insets+limitBounds.y,right:limitBounds.width-2*insets+limitBounds.x},retRect={left:Math.max(boundsRect.left,limitedBoundsRect.left),top:Math.max(boundsRect.top,limitedBoundsRect.top),bottom:Math.min(boundsRect.bottom,limitedBoundsRect.bottom),right:Math.min(boundsRect.right,limitedBoundsRect.right)},retBounds={x:retRect.left,y:retRect.top,width:retRect.right-retRect.left,height:retRect.bottom-retRect.top};return retBounds.height<0||retBounds.width<0?null:retBounds},isPointWithinBounds=(x,y,bounds)=>!!bounds&&(!(x<bounds.x||x>bounds.x+bounds.width)&&!(y<bounds.y||y>bounds.y+bounds.height)),createViewOffsets=(layout,isCol,indices,start,end)=>{const offsets={};let lastIndex=null,lastOffset=null;for(let i=0;i<=indices.length&&indices[i]<=end;i++){const index=indices[i];if(index<start)continue;const currentOff=lastIndex===index?lastOffset:isCol?layout.getColOffset(index):layout.getRowOffset(index),nextOff=isCol?layout.getColOffset(index+1):layout.getRowOffset(index+1);lastIndex=index+1,lastOffset=nextOff,offsets[index]=Object.freeze({offset:currentOff,size:nextOff-currentOff,spanIndex:i})}return Object.freeze(offsets)},ColumnFirstSorter=(a,b)=>a.colStart===b.colStart?a.rowStart-b.rowStart:a.colStart-b.colStart,RowFirstSorter=(a,b)=>a.rowStart===b.rowStart?a.colStart-b.colStart:a.rowStart-b.rowStart},"../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!../../packages/grid/src/Grid.module.css":(module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/css-loader/dist/runtime/noSourceMaps.js"),_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__),_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/css-loader/dist/runtime/api.js"),___CSS_LOADER_EXPORT___=__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__)()(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default());___CSS_LOADER_EXPORT___.push([module.id,"\n/**\n * CSS files with the .module.css suffix will be treated as CSS modules\n * and scoped locally.\n */\n\n.BwjpKEtq8A7_YlVRk_8u {\n position: relative;\n box-sizing: border-box;\n user-select: none;\n}\n\n.BwjpKEtq8A7_YlVRk_8u * {\n box-sizing: border-box !important;\n}\n\n.BwjpKEtq8A7_YlVRk_8u *:focus {\n outline: none;\n}\n\n/*\n.sheetxl-grid :global(.view) > * {\n pointer-events: auto;\n}\n*/\n\n.BwjpKEtq8A7_YlVRk_8u .cell-container {\n position: absolute;\n overflow: visible;\n /* overflow: hidden; */\n /* This is supposed to make rendering faster but instead it is making it blurry */\n /* will-change: transform; */\n}\n\n.BwjpKEtq8A7_YlVRk_8u .cell-container > * {\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n position: absolute;\n}",""]),___CSS_LOADER_EXPORT___.locals={"sheetxl-grid":"BwjpKEtq8A7_YlVRk_8u"};const __WEBPACK_DEFAULT_EXPORT__=___CSS_LOADER_EXPORT___}}]);