@hpcc-js/dgrid2 2.3.6 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +491 -478
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +491 -478
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +6 -6
- package/src/__package__.ts +2 -2
- package/src/reactTable.tsx +1 -1
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
package/dist/index.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__assign","assign","t","s","i","n","arguments","length","apply","this","__decorate","decorators","target","key","desc","c","r","getOwnPropertyDescriptor","Reflect","decorate","defineProperty","__metadata","metadataKey","metadataValue","metadata","__spreadArray","to","from","pack","ar","l","slice","concat","options","vnodeId","rerenderQueue","prevDebounce","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","ref","normalizedProps","defaultProps","undefined","createVNode","original","vnode","__k","__","__b","__e","__d","__c","__h","constructor","__v","Fragment","Component","context","getDomSibling","childIndex","indexOf","sibling","updateParentDomPointers","child","base","enqueueRender","push","process","debounceRendering","setTimeout","queue","__r","sort","a","some","component","commitQueue","oldVNode","oldDom","parentDom","__P","diff","ownerSVGElement","commitRoot","diffChildren","renderResult","newParentVNode","oldParentVNode","globalContext","isSvg","excessDomChildren","isHydrating","j","childVNode","newDom","firstChildDom","refs","oldChildren","oldChildrenLength","isArray","reorderChildren","placeChild","unmount","applyRef","tmp","toChildArray","out","nextDom","sibDom","outer","appendChild","nextSibling","insertBefore","setStyle","style","value","setProperty","test","dom","name","oldValue","useCapture","o","cssText","replace","toLowerCase","addEventListener","eventProxyCapture","eventProxy","removeEventListener","e","removeAttribute","setAttribute","event","newVNode","isNew","oldProps","oldState","snapshot","clearProcessingException","newProps","provider","componentContext","renderHook","count","newType","contextType","__E","render","doRender","sub","state","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","forEach","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","diffElementNodes","diffed","root","cb","oldHtml","newHtml","nodeType","localName","document","createTextNode","createElementNS","is","data","childNodes","dangerouslySetInnerHTML","attributes","__html","innerHTML","diffProps","hydrate","checked","current","parentVNode","skipRemove","componentWillUnmount","replaceNode","firstChild","createContext","defaultValue","contextId","Consumer","contextValue","Provider","subs","ctx","_props","old","splice","error","errorInfo","ctor","handled","getDerivedStateFromError","setState","componentDidCatch","update","callback","forceUpdate","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","EMPTY","oldBeforeDiff","oldBeforeRender","oldAfterDiff","oldCommit","oldBeforeUnmount","getHookState","index","hooks","__H","__V","useState","initialState","useReducer","reducer","init","hookState","_reducer","invokeOrReturn","action","currentValue","__N","nextValue","_hasScuFromHooks","prevScu","stateHooks","filter","x","every","shouldUpdate","hookItem","useEffect","args","argsChanged","_pendingArgs","useLayoutEffect","useRef","initialValue","useMemo","factory","useCallback","useContext","flushAfterPaintEffects","shift","invokeCleanup","invokeEffect","__m","requestAnimationFrame","afterNextFrame","hasErrored","HAS_RAF","raf","done","clearTimeout","timeout","cancelAnimationFrame","hook","comp","cleanup","oldArgs","newArgs","arg","f","shallowDiffers","PureComponent","memo","comparer","nextProps","updateRef","Memoed","displayName","isReactComponent","isPureReactComponent","oldDiffHook","__f","REACT_FORWARD_SYMBOL","Symbol","for","forwardRef","fn","Forwarded","clone","$$typeof","mapFn","oldCatchError","then","oldUnmount","detachedClone","detachedParent","effect","map","removeOriginal","originalParent","Suspense","__u","_suspenders","suspended","__a","SuspenseList","_next","_map","__R","promise","suspendingVNode","suspendingComponent","resolve","resolved","onResolved","onSuspensionComplete","suspendedVNode","__O","pop","wasHydrating","detachedComponent","fallback","list","delete","revealOrder","size","delegated","get","unsuspend","wrappedUnsuspend","Map","reverse","set","_this","REACT_ELEMENT_TYPE","CAMEL_PROPS","IS_DOM","onChangeInputType","configurable","v","writable","oldEventHook","empty","isPropagationStopped","cancelBubble","isDefaultPrevented","defaultPrevented","persist","nativeEvent","classNameDescriptor","class","oldVNodeHook","nonCustomElement","multiple","selected","className","enumerable","clsx","__self","__source","styleInject","css","insertAt","head","getElementsByTagName","styleSheet","rowClassname","rowSelectedClassname","CheckboxFormatter","onChange","_jsxs","checkboxLabel","disabled","checkboxLabelDisabled","_jsx","checkboxInput","handleChange","shiftKey","checkbox","window","useOriginalLayoutEffect","useFocusRef","isSelected","_ref$current","focus","preventScroll","tabIndex","DataGridDefaultComponentsContext","DataGridDefaultComponentsProvider","useDefaultComponents","SelectCellFormatter","isCellSelected","ariaLabel","ariaLabelledBy","checkboxFormatter","ValueFormatter","_Fragment","row","column","ToggleGroupFormatter","groupKey","isExpanded","toggleGroup","groupCellContent","onKeyDown","viewBox","width","height","caret","RowSelectionContext","RowSelectionProvider","RowSelectionChangeContext","RowSelectionChangeProvider","useRowSelection","rowSelectionContext","rowSelectionChangeContext","Error","SELECT_COLUMN_KEY","SelectColumn","minWidth","maxWidth","resizable","sortable","frozen","headerRenderer","allRowsSelected","onAllRowsSelectionChange","formatter","isRowSelected","onRowSelectionChange","isShiftClick","groupFormatter","getColSpan","lastFrozenColumnIndex","colSpan","Number","isInteger","idx","nonInputKeys","Set","isCtrlKeyHeldDown","ctrlKey","metaKey","onEditorNavigation","HTMLInputElement","HTMLTextAreaElement","HTMLSelectElement","matches","isSelectedCellEditable","selectedPosition","columns","rows","isGroupRow","rowIdx","isCellEditable","editor","rowGroup","editable","getSelectedCellColSpan","summaryRows","getRowStyle","getCellStyle","gridColumnStart","gridColumnEnd","insetInlineStart","getCellClassname","extraClasses","isLastFrozenColumn","min","max","round","floor","sign","abs","ceil","Math","assertIsValidKeyGetter","keyGetter","clampColumnWidth","getSpecifiedWidth","columnWidths","viewportWidth","has","parseInt","handleDevicePixelRatio","devicePixelRatio","useLatestFunc","useRovingCellRef","isChildFocused","setIsChildFocused","cell","contains","activeElement","onFocus","currentTarget","useViewportRows","rawRows","rowHeight","clientHeight","scrollTop","groupBy","rowGrouper","expandedGroupIds","enableVirtualization","groupedRows","rowsCount","groupRows","groupByKey","remainingGroupByKeys","startRowIndex","groupRowsCount","groups","childRows","entries","childGroups","childRowsCount","allGroupRows","flattenedRows","expandGroup","parentId","level","arr","keys","posInSet","_expandedGroupIds$has","id","groupRow","setSize","add","totalRowHeight","gridTemplateRows","getRowTop","getRowHeight","findRowIdx","offset","rowPositions","currentRowHeight","position","top","validateRowIdx","start","end","middle","currentOffset","rowOverscanStartIdx","rowOverscanEndIdx","overscanThreshold","rowVisibleStartIdx","rowVisibleEndIdx","HeaderRenderer","sortDirection","priority","onSort","SortableHeaderCell","SortIcon","sortIcon","headerSortCell","onClick","handleClick","handleKeyDown","preventDefault","headerSortName","HeaderCell","onColumnResize","sortColumns","onSortColumnsChange","selectCell","shouldFocusGrid","direction","_column$headerRendere","_column$maxWidth","isRtl","sortIndex","findIndex","columnKey","sortColumn","ariaSort","headerCellClass","cellResizable","DefaultHeaderRenderer","role","handleFocus","onDoubleClick","right","left","getBoundingClientRect","clientX","onPointerDown","pointerType","buttons","pointerId","onPointerMove","setPointerCapture","onLostPointerCapture","ctrlClick","sortDescendingFirst","nextSort","nextSortColumn","nextSortColumns","HeaderRow","selectedCellIdx","cells","headerRow","HeaderRow$1","Cell","isCopied","isDraggedOver","dragHandle","onRowClick","onRowDoubleClick","onRowChange","cellClass","cellCopied","cellDraggedOver","selectCellWrapper","openEditor","_column$editorOptions","editorOptions","editOnClick","onContextMenu","Cell$1","Row","gridRowStart","copiedCellIdx","draggedOverCellIdx","viewportColumns","selectedCellEditor","selectedCellDragHandle","rowClass","setDraggedOverRowIdx","onMouseEnter","handleRowChange","newRow","handleDragEnter","Row$1","GroupCell","groupColumnIndex","toggleGroupWrapper","isLevelMatching","cursor","GroupCell$1","GroupedRow","selectGroup","GroupRowRenderer","SummaryCell","summaryFormatter","SummaryFormatter","summaryCellClass","SummaryCell$1","SummaryRow","bottom","ariaRowIndex","summaryRow","SummaryRow$1","EditCell","closeEditor","scrollToCell","_column$editorOptions4","_column$editorOptions5","frameRequestRef","commitOnOutsideClick","commitOnOutsideMouseDown","onClose","cancelFrameRequest","commitChanges","onWindowCaptureMouseDown","capture","renderFormatter","stopPropagation","_column$editorOptions2","_column$editorOptions3","onNavigation","onMouseDownCapture","DragHandle","latestDraggedOverRowIdx","onRowsChange","onFill","setDragging","updateRows","startRowIdx","endRowIdx","sourceRow","updatedRows","indexes","updatedRow","targetRow","cellDragHandle","onMouseDown","handleMouseDown","onMouseOver","onMouseUp","overRowIdx","handleDragEnd","handleDoubleClick","arrow","initialPosition","mode","DataGrid","rawColumns","rowKeyGetter","headerRowHeight","rawHeaderRowHeight","summaryRowHeight","rawSummaryRowHeight","selectedRows","onSelectedRowsChange","defaultColumnOptions","rawGroupBy","onExpandedGroupIdsChange","onScroll","onCopy","onPaste","cellNavigationMode","rawCellNavigationMode","components","ariaDescribedBy","testId","_ref","_components$rowRender","_ref2","_components$sortIcon","_ref3","_components$checkboxF","_components$noRowsFal","_summaryRows$length","defaultComponents","RowRenderer","rowRenderer","noRowsFallback","setScrollTop","scrollLeft","setScrollLeft","setColumnWidths","setSelectedPosition","copiedCell","setCopiedCell","isDragging","draggedOverRowIdx","setOverRowIdx","autoResizeColumn","setAutoResizeColumn","prevSelectedPosition","lastSelectedRowIdx","rowRef","gridRef","gridWidth","gridHeight","inlineSize","setInlineSize","blockSize","setBlockSize","ResizeObserver","clientWidth","offsetWidth","offsetHeight","initialHeight","resizeObserver","contentBoxSize","observe","disconnect","useGridDimensions","summaryRowsCount","isSelectable","isHeaderRowSelected","leftKey","rightKey","defaultGridComponents","colSpanColumns","colOverscanStartIdx","colOverscanEndIdx","layoutCssVars","columnMetrics","totalFrozenColumnWidth","_defaultColumnOptions","_defaultColumnOptions2","_defaultColumnOptions3","_defaultColumnOptions4","defaultWidth","defaultMinWidth","defaultMaxWidth","defaultFormatter","defaultSortable","defaultResizable","rawColumn","_rawGroupBy$includes","_rawColumn$width","_rawColumn$minWidth","_rawColumn$maxWidth","_rawColumn$sortable","_rawColumn$resizable","_rawColumn$formatter","includes","aKey","frozenA","bKey","frozenB","templateColumns","allocatedWidth","unassignedColumnsCount","columnMetric","gridTemplateColumns","viewportLeft","viewportRight","lastColIdx","firstUnfrozenColumnIdx","colVisibleStartIdx","colVisibleEndIdx","useCalculatedColumns","startIdx","updateStartIdx","colIdx","useViewportColumns","hasGroups","minColIdx","maxColIdx","minRowIdx","maxRowIdx","selectedCellIsWithinSelectionBounds","isCellWithinSelectionBounds","selectedCellIsWithinViewportBounds","isCellWithinViewportBounds","selectRowLatest","selectRow","selectAllRowsLatest","selectAllRows","newSelectedRows","rowKey","handleFormatterRowChangeLatest","updateRow","selectViewportCellLatest","enableEditor","selectGroupLatest","selectHeaderCellLatest","selectSummaryCellLatest","toggleGroupLatest","isSamePosition","columnElement","querySelector","newColumnWidths","createHandle","useImperativeHandle","element","scrollToColumn","scrollToRow","scrollTo","behavior","handleColumnResize","childRow","previousRowIdx","step","expandedGroupId","newExpandedGroupIds","Element","isCellEvent","closest","isRowEvent","keyCode","cKey","vKey","getRawRowIdx","sourceColumnKey","handleCopy","updatedTargetRow","targetColumnKey","handlePaste","isRowIdxWithinViewportBounds","navigate","atLastCellInRow","atFirstCellInRow","atLastRow","atFirstRow","canExitGrid","commitEditorChanges","nextPosition","parentRowIdx","parentRow","nextRowY","getNextPosition","currentPosition","currentIdx","isCellWithinBounds","nextIdx","nextRowIdx","setColSpan","moveRight","columnsCount","isBeforeFirstColumn","getNextSelectedCellPosition","handleCellInput","onCellKeyDown","isDefaultCellInput","originalRow","rawRowIdx","isColIdxWithinSelectionBounds","isCellAtRightBoundary","rowTop","getDraggedOverCellIdx","currentRowIdx","getDragHandle","getCellEditor","getRowViewportColumns","selectedColumn","templateRows","isGroupRowFocused","newSizes","split","join","getLayoutCssVars","dir","handleScroll","rowElements","selectedIdx","selectedRowIdx","viewportRowIdx","isRowOutsideViewport","rowColumns","isGroupRowSelected","cr","_selectedRows$has","headerRowsCount","getViewportRows","summaryRowIdx","isSummaryRowSelected","p1","p2","DataGrid$1","copyAndSort","items","attribute","descending","EmptyRowsRenderer","_a","React.createElement","textAlign","gridColumn","message","ReactTable","widget","table","_b","React.useMemo","dataChecksum","multiSelect","columnTypes","columnPatterns","columnFormats","_c","React.useState","listColumns","setListColumns","_d","setSortColumn","_e","setRows","_f","setSelectedRows","React.useEffect","__hpcc_pattern","__hpcc_format","timeParse","timeFormat","format","React.useCallback","futureSortColumn","sorted","isSortedDescending","onRowClickCallback","retVal","val","toString","noDataMessage","darkMode","Table","_super","TypeError","String","create","__extends","columnType","columnPattern","pattern","columnFormat","_prevRow","JSON","stringify","click","_prevColumn","enter","domNode","_div","append","parent","textContent","preactRender","exit","container","unmountComponentAtNode","remove","col","sel","publish","HTMLWidget","_class"],"sources":["../src/__package__.ts","../../../node_modules/tslib/tslib.es6.js","../../../node_modules/preact/src/util.js","../../../node_modules/preact/src/options.js","../../../node_modules/preact/src/create-element.js","../../../node_modules/preact/src/component.js","../../../node_modules/preact/src/create-context.js","../../../node_modules/preact/src/constants.js","../../../node_modules/preact/src/diff/children.js","../../../node_modules/preact/src/diff/props.js","../../../node_modules/preact/src/diff/index.js","../../../node_modules/preact/src/render.js","../../../node_modules/preact/src/diff/catch-error.js","../../../node_modules/preact/hooks/src/index.js","../../../node_modules/preact/compat/src/util.js","../../../node_modules/preact/compat/src/PureComponent.js","../../../node_modules/preact/compat/src/memo.js","../../../node_modules/preact/compat/src/forwardRef.js","../../../node_modules/preact/compat/src/Children.js","../../../node_modules/preact/compat/src/suspense.js","../../../node_modules/preact/compat/src/suspense-list.js","../../../node_modules/preact/compat/src/render.js","../../../node_modules/clsx/dist/clsx.m.js","../../../node_modules/preact/jsx-runtime/src/index.js","../node_modules/react-data-grid/node_modules/style-inject/dist/style-inject.es.js","../node_modules/react-data-grid/src/style/row.ts","../node_modules/react-data-grid/src/formatters/CheckboxFormatter.tsx","../node_modules/react-data-grid/src/hooks/useLayoutEffect.ts","../node_modules/react-data-grid/src/hooks/useFocusRef.ts","../node_modules/react-data-grid/src/DataGridDefaultComponentsProvider.ts","../node_modules/react-data-grid/src/formatters/SelectCellFormatter.tsx","../node_modules/react-data-grid/src/formatters/ValueFormatter.tsx","../node_modules/react-data-grid/src/formatters/ToggleGroupFormatter.tsx","../node_modules/react-data-grid/src/hooks/useRowSelection.ts","../node_modules/react-data-grid/src/Columns.tsx","../node_modules/react-data-grid/src/utils/colSpanUtils.ts","../node_modules/react-data-grid/src/utils/keyboardUtils.ts","../node_modules/react-data-grid/src/utils/selectedCellUtils.ts","../node_modules/react-data-grid/src/utils/styleUtils.ts","../node_modules/react-data-grid/src/style/cell.ts","../node_modules/react-data-grid/src/utils/index.ts","../node_modules/react-data-grid/src/hooks/useCalculatedColumns.ts","../node_modules/react-data-grid/src/hooks/useGridDimensions.ts","../node_modules/react-data-grid/src/hooks/useLatestFunc.ts","../node_modules/react-data-grid/src/hooks/useRovingCellRef.ts","../node_modules/react-data-grid/src/hooks/useViewportRows.ts","../node_modules/react-data-grid/src/HeaderRenderer.tsx","../node_modules/react-data-grid/src/HeaderCell.tsx","../node_modules/react-data-grid/src/HeaderRow.tsx","../node_modules/react-data-grid/src/Cell.tsx","../node_modules/react-data-grid/src/Row.tsx","../node_modules/react-data-grid/src/GroupCell.tsx","../node_modules/react-data-grid/src/GroupRow.tsx","../node_modules/react-data-grid/src/SummaryCell.tsx","../node_modules/react-data-grid/src/SummaryRow.tsx","../node_modules/react-data-grid/src/EditCell.tsx","../node_modules/react-data-grid/src/DragHandle.tsx","../node_modules/react-data-grid/src/SortIcon.tsx","../node_modules/react-data-grid/src/DataGrid.tsx","../node_modules/react-data-grid/src/hooks/useViewportColumns.ts","../node_modules/react-data-grid/src/style/core.ts","../src/reactTable.tsx","../src/hooks.ts","../../../node_modules/style-inject/dist/style-inject.es.js","../src/table.ts","../../../node_modules/preact/compat/src/index.js"],"sourcesContent":["export const PKG_NAME = \"@hpcc-js/dgrid2\";\nexport const PKG_VERSION = \"2.3.6\";\nexport const BUILD_VERSION = \"2.104.13\";\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","import { EMPTY_ARR } from \"./constants\";\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-ignore We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n","import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n","import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is import('./internal').VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor === undefined;\n","import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nComponent.prototype.setState = function(update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.prototype.forceUpdate = function(callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || setTimeout)(process);\n\t}\n}\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet queue;\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\n\t\trerenderQueue = [];\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\tqueue.some(c => {\n\t\t\tif (c._dirty) renderComponent(c);\n\t\t});\n\t}\n}\n\nprocess._rerenderCount = 0;\n","import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tsubs.some(enqueueRender);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\n}\n","export const EMPTY_OBJ = {};\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\n\t\tchildVNode = renderResult[i];\n\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t} else if (Array.isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = <div />\n\t\t\t// <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : null,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(parentDom, vnode, vnode, c, vnode._dom, oldDom);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (Array.isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j<oldChildrenLength; j+=2` is an alternative to `j++<oldChildrenLength/2`\n\t\t\tfor (\n\t\t\t\tlet sibDom = oldDom, j = 0;\n\t\t\t\t(sibDom = sibDom.nextSibling) && j < oldChildren.length;\n\t\t\t\tj += 2\n\t\t\t) {\n\t\t\t\tif (sibDom == newDom) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tparentDom.insertBefore(newDom, oldDom);\n\t\t\tnextDom = oldDom;\n\t\t}\n\t}\n\n\t// If we have pre-calculated the nextDOM node, use it. Else calculate it now\n\t// Strictly check for `undefined` here cuz `null` is a valid value of `nextDom`.\n\t// See more detail in create-element.js:createVNode\n\tif (nextDom !== undefined) {\n\t\toldDom = nextDom;\n\t} else {\n\t\toldDom = newDom.nextSibling;\n\t}\n\n\treturn oldDom;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport options from '../options';\n\n/**\n * Diff the old and new properties of a VNode and apply changes to the DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to apply\n * changes to\n * @param {object} newProps The new props\n * @param {object} oldProps The old props\n * @param {boolean} isSvg Whether or not this node is an SVG node\n * @param {boolean} hydrate Whether or not we are in hydration mode\n */\nexport function diffProps(dom, newProps, oldProps, isSvg, hydrate) {\n\tlet i;\n\n\tfor (i in oldProps) {\n\t\tif (i !== 'children' && i !== 'key' && !(i in newProps)) {\n\t\t\tsetProperty(dom, i, null, oldProps[i], isSvg);\n\t\t}\n\t}\n\n\tfor (i in newProps) {\n\t\tif (\n\t\t\t(!hydrate || typeof newProps[i] == 'function') &&\n\t\t\ti !== 'children' &&\n\t\t\ti !== 'key' &&\n\t\t\ti !== 'value' &&\n\t\t\ti !== 'checked' &&\n\t\t\toldProps[i] !== newProps[i]\n\t\t) {\n\t\t\tsetProperty(dom, i, newProps[i], oldProps[i], isSvg);\n\t\t}\n\t}\n}\n\nfunction setStyle(style, key, value) {\n\tif (key[0] === '-') {\n\t\tstyle.setProperty(key, value);\n\t} else if (value == null) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, isSvg) {\n\tlet useCapture;\n\n\to: if (name === 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] !== oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] === 'o' && name[1] === 'n') {\n\t\tuseCapture = name !== (name = name.replace(/Capture$/, ''));\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (name.toLowerCase() in dom) name = name.toLowerCase().slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\t\tdom.addEventListener(name, handler, useCapture);\n\t\t\t}\n\t\t} else {\n\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\tdom.removeEventListener(name, handler, useCapture);\n\t\t}\n\t} else if (name !== 'dangerouslySetInnerHTML') {\n\t\tif (isSvg) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname !== 'href' &&\n\t\t\tname !== 'list' &&\n\t\t\tname !== 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname !== 'tabIndex' &&\n\t\t\tname !== 'download' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// ARIA-attributes have a different notion of boolean values.\n\t\t// The value `false` is different from the attribute not\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\n\t\t// ARIA-attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost us too many bytes. On top of\n\t\t// that other VDOM frameworks also always stringify `false`.\n\n\t\tif (typeof value === 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != null && (value !== false || name.indexOf('-') != -1)) {\n\t\t\tdom.setAttribute(name, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n","import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, setProperty } from './props';\nimport { assign, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original === oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\tc.props = newProps;\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\n\t\t\t\t\tc._vnode = newVNode;\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._vnode = newVNode;\n\t\t\tc._parentDom = parentDom;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._hydrating = null;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\n\t\t}\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tArray.isArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// (as above, don't diff props during hydration)\n\t\tif (!isHydrating) {\n\t\t\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType === 'option' && i !== oldProps.value))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'value', i, oldProps.value, false);\n\t\t\t}\n\t\t\tif (\n\t\t\t\t'checked' in newProps &&\n\t\t\t\t(i = newProps.checked) !== undefined &&\n\t\t\t\ti !== dom.checked\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'checked', i, oldProps.checked, false);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} ref\n * @param {any} value\n * @param {import('../internal').VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') ref(value);\n\t\telse ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {import('../internal').VNode} vnode The virtual node to unmount\n * @param {import('../internal').VNode} parentVNode The parent of the VNode that\n * initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current === vnode._dom) {\n\t\t\tapplyRef(r, null, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != null) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = null;\n\t\tvnode._component = undefined;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(\n\t\t\t\t\tr[i],\n\t\t\t\t\tparentVNode,\n\t\t\t\t\tskipRemove || typeof vnode.type !== 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove && vnode._dom != null) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\t// Must be set to `undefined` to properly clean up `_nextDom`\n\t// for which `null` is a valid value. See comment in `create-element.js`\n\tvnode._parent = vnode._dom = vnode._nextDom = undefined;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { EMPTY_OBJ } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode === 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? null\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = (\n\t\t(!isHydrating && replaceNode) ||\n\t\tparentDom\n\t)._children = createElement(Fragment, null, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.ownerSVGElement !== undefined,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t? null\n\t\t\t: parentDom.firstChild\n\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t: null,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t? oldVNode._dom\n\t\t\t: parentDom.firstChild,\n\t\tisHydrating\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n","/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw\n * the error that was caught (except for unmounting when this parameter\n * is the highest parent that was being unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component, ctor, handled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != null) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != null) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n","import { options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\nlet EMPTY = [];\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\n\nconst RAF_TIMEOUT = 100;\nlet prevRaf;\n\noptions._diff = vnode => {\n\tif (\n\t\ttypeof vnode.type === 'function' &&\n\t\t!vnode._mask &&\n\t\t// Ignore root Fragment node\n\t\tvnode._parent !== null\n\t) {\n\t\tvnode._mask =\n\t\t\t(vnode._parent && vnode._parent._mask ? vnode._parent._mask : '') +\n\t\t\t(vnode._parent && vnode._parent._children\n\t\t\t\t? vnode._parent._children.indexOf(vnode)\n\t\t\t\t: 0);\n\t} else if (!vnode._mask) {\n\t\tvnode._mask =\n\t\t\tvnode._parent && vnode._parent._mask ? vnode._parent._mask : '';\n\t}\n\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.forEach(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingValue = EMPTY;\n\t\t\t\thookItem._nextValue = hookItem._pendingArgs = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.forEach(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\tif (hookItem._pendingValue !== EMPTY) {\n\t\t\t\thookItem._value = hookItem._pendingValue;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t\thookItem._pendingValue = EMPTY;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({ _pendingValue: EMPTY });\n\t}\n\treturn hooks._list[index];\n}\n\n/**\n * @param {import('./index').StateUpdater<any>} [initialState]\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @param {import('./index').Reducer<any, any>} reducer\n * @param {import('./index').StateUpdater<any>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ any, (state: any) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tconst prevScu = currentComponent.shouldComponentUpdate;\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\tcurrentComponent.shouldComponentUpdate = function(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\tconst stateHooks = hookState._component.__hooks._list.filter(\n\t\t\t\t\tx => x._component\n\t\t\t\t);\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x => !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = false;\n\t\t\t\tstateHooks.forEach(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn shouldUpdate || hookState._component.props !== p\n\t\t\t\t\t? prevScu\n\t\t\t\t\t\t? prevScu.call(this, p, s, c)\n\t\t\t\t\t\t: true\n\t\t\t\t\t: false;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {any[]} args\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tref(createHandle());\n\t\t\t\treturn () => ref(null);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @param {() => any} factory\n * @param {any[]} args\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._pendingValue = factory();\n\t\tstate._pendingArgs = args;\n\t\tstate._factory = factory;\n\t\treturn state._pendingValue;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {any[]} args\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\n\t}\n}\n\n/**\n * @param {(error: any, errorInfo: import('preact').ErrorInfo) => void} cb\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) => {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\nfunction hash(s) {\n\tlet h = 0,\n\t\ti = s.length;\n\twhile (i > 0) {\n\t\th = ((h << 5) - h + s.charCodeAt(--i)) | 0;\n\t}\n\treturn h;\n}\n\nexport function useId() {\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\tstate._value = 'P' + hash(currentComponent._vnode._mask) + currentIndex;\n\t}\n\n\treturn state._value;\n}\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom || !component.__hooks) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {any[]} oldArgs\n * @param {any[]} newArgs\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n","/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Check if two objects have a different shape\n * @param {object} a\n * @param {object} b\n * @returns {boolean}\n */\nexport function shallowDiffers(a, b) {\n\tfor (let i in a) if (i !== '__source' && !(i in b)) return true;\n\tfor (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;\n\treturn false;\n}\n\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n","import { Component } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Component class with a predefined `shouldComponentUpdate` implementation\n */\nexport function PureComponent(p) {\n\tthis.props = p;\n}\nPureComponent.prototype = new Component();\n// Some third-party libraries check if this property is present\nPureComponent.prototype.isPureReactComponent = true;\nPureComponent.prototype.shouldComponentUpdate = function(props, state) {\n\treturn shallowDiffers(this.props, props) || shallowDiffers(this.state, state);\n};\n","import { createElement } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Memoize a component, so that it only updates when the props actually have\n * changed. This was previously known as `React.pure`.\n * @param {import('./internal').FunctionComponent} c functional component\n * @param {(prev: object, next: object) => boolean} [comparer] Custom equality function\n * @returns {import('./internal').FunctionComponent}\n */\nexport function memo(c, comparer) {\n\tfunction shouldUpdate(nextProps) {\n\t\tlet ref = this.props.ref;\n\t\tlet updateRef = ref == nextProps.ref;\n\t\tif (!updateRef && ref) {\n\t\t\tref.call ? ref(null) : (ref.current = null);\n\t\t}\n\n\t\tif (!comparer) {\n\t\t\treturn shallowDiffers(this.props, nextProps);\n\t\t}\n\n\t\treturn !comparer(this.props, nextProps) || !updateRef;\n\t}\n\n\tfunction Memoed(props) {\n\t\tthis.shouldComponentUpdate = shouldUpdate;\n\t\treturn createElement(c, props);\n\t}\n\tMemoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';\n\tMemoed.prototype.isReactComponent = true;\n\tMemoed._forwarded = true;\n\treturn Memoed;\n}\n","import { options } from 'preact';\nimport { assign } from './util';\n\nlet oldDiffHook = options._diff;\noptions._diff = vnode => {\n\tif (vnode.type && vnode.type._forwarded && vnode.ref) {\n\t\tvnode.props.ref = vnode.ref;\n\t\tvnode.ref = null;\n\t}\n\tif (oldDiffHook) oldDiffHook(vnode);\n};\n\nexport const REACT_FORWARD_SYMBOL =\n\t(typeof Symbol != 'undefined' &&\n\t\tSymbol.for &&\n\t\tSymbol.for('react.forward_ref')) ||\n\t0xf47;\n\n/**\n * Pass ref down to a child. This is mainly used in libraries with HOCs that\n * wrap components. Using `forwardRef` there is an easy way to get a reference\n * of the wrapped component instead of one of the wrapper itself.\n * @param {import('./index').ForwardFn} fn\n * @returns {import('./internal').FunctionComponent}\n */\nexport function forwardRef(fn) {\n\tfunction Forwarded(props) {\n\t\tlet clone = assign({}, props);\n\t\tdelete clone.ref;\n\t\treturn fn(clone, props.ref || null);\n\t}\n\n\t// mobx-react checks for this being present\n\tForwarded.$$typeof = REACT_FORWARD_SYMBOL;\n\t// mobx-react heavily relies on implementation details.\n\t// It expects an object here with a `render` property,\n\t// and prototype.render will fail. Without this\n\t// mobx-react throws.\n\tForwarded.render = Forwarded;\n\n\tForwarded.prototype.isReactComponent = Forwarded._forwarded = true;\n\tForwarded.displayName = 'ForwardRef(' + (fn.displayName || fn.name) + ')';\n\treturn Forwarded;\n}\n","import { toChildArray } from 'preact';\n\nconst mapFn = (children, fn) => {\n\tif (children == null) return null;\n\treturn toChildArray(toChildArray(children).map(fn));\n};\n\n// This API is completely unnecessary for Preact, so it's basically passthrough.\nexport const Children = {\n\tmap: mapFn,\n\tforEach: mapFn,\n\tcount(children) {\n\t\treturn children ? toChildArray(children).length : 0;\n\t},\n\tonly(children) {\n\t\tconst normalized = toChildArray(children);\n\t\tif (normalized.length !== 1) throw 'Children.only';\n\t\treturn normalized[0];\n\t},\n\ttoArray: toChildArray\n};\n","import { Component, createElement, options, Fragment } from 'preact';\nimport { assign } from './util';\n\nconst oldCatchError = options._catchError;\noptions._catchError = function(error, newVNode, oldVNode, errorInfo) {\n\tif (error.then) {\n\t\t/** @type {import('./internal').Component} */\n\t\tlet component;\n\t\tlet vnode = newVNode;\n\n\t\tfor (; (vnode = vnode._parent); ) {\n\t\t\tif ((component = vnode._component) && component._childDidSuspend) {\n\t\t\t\tif (newVNode._dom == null) {\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t}\n\t\t\t\t// Don't call oldCatchError if we found a Suspense\n\t\t\t\treturn component._childDidSuspend(error, newVNode);\n\t\t\t}\n\t\t}\n\t}\n\toldCatchError(error, newVNode, oldVNode, errorInfo);\n};\n\nconst oldUnmount = options.unmount;\noptions.unmount = function(vnode) {\n\t/** @type {import('./internal').Component} */\n\tconst component = vnode._component;\n\tif (component && component._onResolve) {\n\t\tcomponent._onResolve();\n\t}\n\n\t// if the component is still hydrating\n\t// most likely it is because the component is suspended\n\t// we set the vnode.type as `null` so that it is not a typeof function\n\t// so the unmount will remove the vnode._dom\n\tif (component && vnode._hydrating === true) {\n\t\tvnode.type = null;\n\t}\n\n\tif (oldUnmount) oldUnmount(vnode);\n};\n\nfunction detachedClone(vnode, detachedParent, parentDom) {\n\tif (vnode) {\n\t\tif (vnode._component && vnode._component.__hooks) {\n\t\t\tvnode._component.__hooks._list.forEach(effect => {\n\t\t\t\tif (typeof effect._cleanup == 'function') effect._cleanup();\n\t\t\t});\n\n\t\t\tvnode._component.__hooks = null;\n\t\t}\n\n\t\tvnode = assign({}, vnode);\n\t\tif (vnode._component != null) {\n\t\t\tif (vnode._component._parentDom === parentDom) {\n\t\t\t\tvnode._component._parentDom = detachedParent;\n\t\t\t}\n\t\t\tvnode._component = null;\n\t\t}\n\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tdetachedClone(child, detachedParent, parentDom)\n\t\t\t);\n\t}\n\n\treturn vnode;\n}\n\nfunction removeOriginal(vnode, detachedParent, originalParent) {\n\tif (vnode) {\n\t\tvnode._original = null;\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tremoveOriginal(child, detachedParent, originalParent)\n\t\t\t);\n\n\t\tif (vnode._component) {\n\t\t\tif (vnode._component._parentDom === detachedParent) {\n\t\t\t\tif (vnode._dom) {\n\t\t\t\t\toriginalParent.insertBefore(vnode._dom, vnode._nextDom);\n\t\t\t\t}\n\t\t\t\tvnode._component._force = true;\n\t\t\t\tvnode._component._parentDom = originalParent;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn vnode;\n}\n\n// having custom inheritance instead of a class here saves a lot of bytes\nexport function Suspense() {\n\t// we do not call super here to golf some bytes...\n\tthis._pendingSuspensionCount = 0;\n\tthis._suspenders = null;\n\tthis._detachOnNextRender = null;\n}\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspense.prototype = new Component();\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {Promise} promise The thrown promise\n * @param {import('./internal').VNode<any, any>} suspendingVNode The suspending component\n */\nSuspense.prototype._childDidSuspend = function(promise, suspendingVNode) {\n\tconst suspendingComponent = suspendingVNode._component;\n\n\t/** @type {import('./internal').SuspenseComponent} */\n\tconst c = this;\n\n\tif (c._suspenders == null) {\n\t\tc._suspenders = [];\n\t}\n\tc._suspenders.push(suspendingComponent);\n\n\tconst resolve = suspended(c._vnode);\n\n\tlet resolved = false;\n\tconst onResolved = () => {\n\t\tif (resolved) return;\n\n\t\tresolved = true;\n\t\tsuspendingComponent._onResolve = null;\n\n\t\tif (resolve) {\n\t\t\tresolve(onSuspensionComplete);\n\t\t} else {\n\t\t\tonSuspensionComplete();\n\t\t}\n\t};\n\n\tsuspendingComponent._onResolve = onResolved;\n\n\tconst onSuspensionComplete = () => {\n\t\tif (!--c._pendingSuspensionCount) {\n\t\t\t// If the suspension was during hydration we don't need to restore the\n\t\t\t// suspended children into the _children array\n\t\t\tif (c.state._suspended) {\n\t\t\t\tconst suspendedVNode = c.state._suspended;\n\t\t\t\tc._vnode._children[0] = removeOriginal(\n\t\t\t\t\tsuspendedVNode,\n\t\t\t\t\tsuspendedVNode._component._parentDom,\n\t\t\t\t\tsuspendedVNode._component._originalParentDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tc.setState({ _suspended: (c._detachOnNextRender = null) });\n\n\t\t\tlet suspended;\n\t\t\twhile ((suspended = c._suspenders.pop())) {\n\t\t\t\tsuspended.forceUpdate();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * We do not set `suspended: true` during hydration because we want the actual markup\n\t * to remain on screen and hydrate it when the suspense actually gets resolved.\n\t * While in non-hydration cases the usual fallback -> component flow would occour.\n\t */\n\tconst wasHydrating = suspendingVNode._hydrating === true;\n\tif (!c._pendingSuspensionCount++ && !wasHydrating) {\n\t\tc.setState({ _suspended: (c._detachOnNextRender = c._vnode._children[0]) });\n\t}\n\tpromise.then(onResolved, onResolved);\n};\n\nSuspense.prototype.componentWillUnmount = function() {\n\tthis._suspenders = [];\n};\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {import('./internal').SuspenseComponent[\"props\"]} props\n * @param {import('./internal').SuspenseState} state\n */\nSuspense.prototype.render = function(props, state) {\n\tif (this._detachOnNextRender) {\n\t\t// When the Suspense's _vnode was created by a call to createVNode\n\t\t// (i.e. due to a setState further up in the tree)\n\t\t// it's _children prop is null, in this case we \"forget\" about the parked vnodes to detach\n\t\tif (this._vnode._children) {\n\t\t\tconst detachedParent = document.createElement('div');\n\t\t\tconst detachedComponent = this._vnode._children[0]._component;\n\t\t\tthis._vnode._children[0] = detachedClone(\n\t\t\t\tthis._detachOnNextRender,\n\t\t\t\tdetachedParent,\n\t\t\t\t(detachedComponent._originalParentDom = detachedComponent._parentDom)\n\t\t\t);\n\t\t}\n\n\t\tthis._detachOnNextRender = null;\n\t}\n\n\t// Wrap fallback tree in a VNode that prevents itself from being marked as aborting mid-hydration:\n\t/** @type {import('./internal').VNode} */\n\tconst fallback =\n\t\tstate._suspended && createElement(Fragment, null, props.fallback);\n\tif (fallback) fallback._hydrating = null;\n\n\treturn [\n\t\tcreateElement(Fragment, null, state._suspended ? null : props.children),\n\t\tfallback\n\t];\n};\n\n/**\n * Checks and calls the parent component's _suspended method, passing in the\n * suspended vnode. This is a way for a parent (e.g. SuspenseList) to get notified\n * that one of its children/descendants suspended.\n *\n * The parent MAY return a callback. The callback will get called when the\n * suspension resolves, notifying the parent of the fact.\n * Moreover, the callback gets function `unsuspend` as a parameter. The resolved\n * child descendant will not actually get unsuspended until `unsuspend` gets called.\n * This is a way for the parent to delay unsuspending.\n *\n * If the parent does not return a callback then the resolved vnode\n * gets unsuspended immediately when it resolves.\n *\n * @param {import('./internal').VNode} vnode\n * @returns {((unsuspend: () => void) => void)?}\n */\nexport function suspended(vnode) {\n\t/** @type {import('./internal').Component} */\n\tlet component = vnode._parent._component;\n\treturn component && component._suspended && component._suspended(vnode);\n}\n\nexport function lazy(loader) {\n\tlet prom;\n\tlet component;\n\tlet error;\n\n\tfunction Lazy(props) {\n\t\tif (!prom) {\n\t\t\tprom = loader();\n\t\t\tprom.then(\n\t\t\t\texports => {\n\t\t\t\t\tcomponent = exports.default || exports;\n\t\t\t\t},\n\t\t\t\te => {\n\t\t\t\t\terror = e;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!component) {\n\t\t\tthrow prom;\n\t\t}\n\n\t\treturn createElement(component, props);\n\t}\n\n\tLazy.displayName = 'Lazy';\n\tLazy._forwarded = true;\n\treturn Lazy;\n}\n","import { Component, toChildArray } from 'preact';\nimport { suspended } from './suspense.js';\n\n// Indexes to linked list nodes (nodes are stored as arrays to save bytes).\nconst SUSPENDED_COUNT = 0;\nconst RESOLVED_COUNT = 1;\nconst NEXT_NODE = 2;\n\n// Having custom inheritance instead of a class here saves a lot of bytes.\nexport function SuspenseList() {\n\tthis._next = null;\n\tthis._map = null;\n}\n\n// Mark one of child's earlier suspensions as resolved.\n// Some pending callbacks may become callable due to this\n// (e.g. the last suspended descendant gets resolved when\n// revealOrder === 'together'). Process those callbacks as well.\nconst resolve = (list, child, node) => {\n\tif (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {\n\t\t// The number a child (or any of its descendants) has been suspended\n\t\t// matches the number of times it's been resolved. Therefore we\n\t\t// mark the child as completely resolved by deleting it from ._map.\n\t\t// This is used to figure out when *all* children have been completely\n\t\t// resolved when revealOrder is 'together'.\n\t\tlist._map.delete(child);\n\t}\n\n\t// If revealOrder is falsy then we can do an early exit, as the\n\t// callbacks won't get queued in the node anyway.\n\t// If revealOrder is 'together' then also do an early exit\n\t// if all suspended descendants have not yet been resolved.\n\tif (\n\t\t!list.props.revealOrder ||\n\t\t(list.props.revealOrder[0] === 't' && list._map.size)\n\t) {\n\t\treturn;\n\t}\n\n\t// Walk the currently suspended children in order, calling their\n\t// stored callbacks on the way. Stop if we encounter a child that\n\t// has not been completely resolved yet.\n\tnode = list._next;\n\twhile (node) {\n\t\twhile (node.length > 3) {\n\t\t\tnode.pop()();\n\t\t}\n\t\tif (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {\n\t\t\tbreak;\n\t\t}\n\t\tlist._next = node = node[NEXT_NODE];\n\t}\n};\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspenseList.prototype = new Component();\n\nSuspenseList.prototype._suspended = function(child) {\n\tconst list = this;\n\tconst delegated = suspended(list._vnode);\n\n\tlet node = list._map.get(child);\n\tnode[SUSPENDED_COUNT]++;\n\n\treturn unsuspend => {\n\t\tconst wrappedUnsuspend = () => {\n\t\t\tif (!list.props.revealOrder) {\n\t\t\t\t// Special case the undefined (falsy) revealOrder, as there\n\t\t\t\t// is no need to coordinate a specific order or unsuspends.\n\t\t\t\tunsuspend();\n\t\t\t} else {\n\t\t\t\tnode.push(unsuspend);\n\t\t\t\tresolve(list, child, node);\n\t\t\t}\n\t\t};\n\t\tif (delegated) {\n\t\t\tdelegated(wrappedUnsuspend);\n\t\t} else {\n\t\t\twrappedUnsuspend();\n\t\t}\n\t};\n};\n\nSuspenseList.prototype.render = function(props) {\n\tthis._next = null;\n\tthis._map = new Map();\n\n\tconst children = toChildArray(props.children);\n\tif (props.revealOrder && props.revealOrder[0] === 'b') {\n\t\t// If order === 'backwards' (or, well, anything starting with a 'b')\n\t\t// then flip the child list around so that the last child will be\n\t\t// the first in the linked list.\n\t\tchildren.reverse();\n\t}\n\t// Build the linked list. Iterate through the children in reverse order\n\t// so that `_next` points to the first linked list node to be resolved.\n\tfor (let i = children.length; i--; ) {\n\t\t// Create a new linked list node as an array of form:\n\t\t// \t[suspended_count, resolved_count, next_node]\n\t\t// where suspended_count and resolved_count are numeric counters for\n\t\t// keeping track how many times a node has been suspended and resolved.\n\t\t//\n\t\t// Note that suspended_count starts from 1 instead of 0, so we can block\n\t\t// processing callbacks until componentDidMount has been called. In a sense\n\t\t// node is suspended at least until componentDidMount gets called!\n\t\t//\n\t\t// Pending callbacks are added to the end of the node:\n\t\t// \t[suspended_count, resolved_count, next_node, callback_0, callback_1, ...]\n\t\tthis._map.set(children[i], (this._next = [1, 0, this._next]));\n\t}\n\treturn props.children;\n};\n\nSuspenseList.prototype.componentDidUpdate = SuspenseList.prototype.componentDidMount = function() {\n\t// Iterate through all children after mounting for two reasons:\n\t// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases\n\t// each node[RELEASED_COUNT] by 1, therefore balancing the counters.\n\t// The nodes can now be completely consumed from the linked list.\n\t// 2. Handle nodes that might have gotten resolved between render and\n\t// componentDidMount.\n\tthis._map.forEach((node, child) => {\n\t\tresolve(this, child, node);\n\t});\n};\n","import {\n\trender as preactRender,\n\thydrate as preactHydrate,\n\toptions,\n\ttoChildArray,\n\tComponent\n} from 'preact';\n\nexport const REACT_ELEMENT_TYPE =\n\t(typeof Symbol != 'undefined' && Symbol.for && Symbol.for('react.element')) ||\n\t0xeac7;\n\nconst CAMEL_PROPS = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;\n\nconst IS_DOM = typeof document !== 'undefined';\n\n// Input types for which onchange should not be converted to oninput.\n// type=\"file|checkbox|radio\", plus \"range\" in IE11.\n// (IE11 doesn't support Symbol, which we use here to turn `rad` into `ra` which matches \"range\")\nconst onChangeInputType = type =>\n\t(typeof Symbol != 'undefined' && typeof Symbol() == 'symbol'\n\t\t? /fil|che|rad/i\n\t\t: /fil|che|ra/i\n\t).test(type);\n\n// Some libraries like `react-virtualized` explicitly check for this.\nComponent.prototype.isReactComponent = {};\n\n// `UNSAFE_*` lifecycle hooks\n// Preact only ever invokes the unprefixed methods.\n// Here we provide a base \"fallback\" implementation that calls any defined UNSAFE_ prefixed method.\n// - If a component defines its own `componentDidMount()` (including via defineProperty), use that.\n// - If a component defines `UNSAFE_componentDidMount()`, `componentDidMount` is the alias getter/setter.\n// - If anything assigns to an `UNSAFE_*` property, the assignment is forwarded to the unprefixed property.\n// See https://github.com/preactjs/preact/issues/1941\n[\n\t'componentWillMount',\n\t'componentWillReceiveProps',\n\t'componentWillUpdate'\n].forEach(key => {\n\tObject.defineProperty(Component.prototype, key, {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn this['UNSAFE_' + key];\n\t\t},\n\t\tset(v) {\n\t\t\tObject.defineProperty(this, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: v\n\t\t\t});\n\t\t}\n\t});\n});\n\n/**\n * Proxy render() since React returns a Component reference.\n * @param {import('./internal').VNode} vnode VNode tree to render\n * @param {import('./internal').PreactElement} parent DOM node to render vnode tree into\n * @param {() => void} [callback] Optional callback that will be called after rendering\n * @returns {import('./internal').Component | null} The root component reference or null\n */\nexport function render(vnode, parent, callback) {\n\t// React destroys any existing DOM nodes, see #1727\n\t// ...but only on the first render, see #1828\n\tif (parent._children == null) {\n\t\tparent.textContent = '';\n\t}\n\n\tpreactRender(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nexport function hydrate(vnode, parent, callback) {\n\tpreactHydrate(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nlet oldEventHook = options.event;\noptions.event = e => {\n\tif (oldEventHook) e = oldEventHook(e);\n\te.persist = empty;\n\te.isPropagationStopped = isPropagationStopped;\n\te.isDefaultPrevented = isDefaultPrevented;\n\treturn (e.nativeEvent = e);\n};\n\nfunction empty() {}\n\nfunction isPropagationStopped() {\n\treturn this.cancelBubble;\n}\n\nfunction isDefaultPrevented() {\n\treturn this.defaultPrevented;\n}\n\nlet classNameDescriptor = {\n\tconfigurable: true,\n\tget() {\n\t\treturn this.class;\n\t}\n};\n\nlet oldVNodeHook = options.vnode;\noptions.vnode = vnode => {\n\tlet type = vnode.type;\n\tlet props = vnode.props;\n\tlet normalizedProps = props;\n\n\t// only normalize props on Element nodes\n\tif (typeof type === 'string') {\n\t\tconst nonCustomElement = type.indexOf('-') === -1;\n\t\tnormalizedProps = {};\n\n\t\tfor (let i in props) {\n\t\t\tlet value = props[i];\n\n\t\t\tif (IS_DOM && i === 'children' && type === 'noscript') {\n\t\t\t\t// Emulate React's behavior of not rendering the contents of noscript tags on the client.\n\t\t\t\tcontinue;\n\t\t\t} else if (i === 'value' && 'defaultValue' in props && value == null) {\n\t\t\t\t// Skip applying value if it is null/undefined and we already set\n\t\t\t\t// a default value\n\t\t\t\tcontinue;\n\t\t\t} else if (\n\t\t\t\ti === 'defaultValue' &&\n\t\t\t\t'value' in props &&\n\t\t\t\tprops.value == null\n\t\t\t) {\n\t\t\t\t// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.\n\t\t\t\t// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.\n\t\t\t\ti = 'value';\n\t\t\t} else if (i === 'download' && value === true) {\n\t\t\t\t// Calling `setAttribute` with a truthy value will lead to it being\n\t\t\t\t// passed as a stringified value, e.g. `download=\"true\"`. React\n\t\t\t\t// converts it to an empty string instead, otherwise the attribute\n\t\t\t\t// value will be used as the file name and the file will be called\n\t\t\t\t// \"true\" upon downloading it.\n\t\t\t\tvalue = '';\n\t\t\t} else if (/ondoubleclick/i.test(i)) {\n\t\t\t\ti = 'ondblclick';\n\t\t\t} else if (\n\t\t\t\t/^onchange(textarea|input)/i.test(i + type) &&\n\t\t\t\t!onChangeInputType(props.type)\n\t\t\t) {\n\t\t\t\ti = 'oninput';\n\t\t\t} else if (/^onfocus$/i.test(i)) {\n\t\t\t\ti = 'onfocusin';\n\t\t\t} else if (/^onblur$/i.test(i)) {\n\t\t\t\ti = 'onfocusout';\n\t\t\t} else if (/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)) {\n\t\t\t\ti = i.toLowerCase();\n\t\t\t} else if (nonCustomElement && CAMEL_PROPS.test(i)) {\n\t\t\t\ti = i.replace(/[A-Z0-9]/g, '-$&').toLowerCase();\n\t\t\t} else if (value === null) {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\n\t\t\t// Add support for onInput and onChange, see #3561\n\t\t\t// if we have an oninput prop already change it to oninputCapture\n\t\t\tif (/^oninput$/i.test(i)) {\n\t\t\t\ti = i.toLowerCase();\n\t\t\t\tif (normalizedProps[i]) {\n\t\t\t\t\ti = 'oninputCapture';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnormalizedProps[i] = value;\n\t\t}\n\n\t\t// Add support for array select values: <select multiple value={[]} />\n\t\tif (\n\t\t\ttype == 'select' &&\n\t\t\tnormalizedProps.multiple &&\n\t\t\tArray.isArray(normalizedProps.value)\n\t\t) {\n\t\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t\t});\n\t\t}\n\n\t\t// Adding support for defaultValue in select tag\n\t\tif (type == 'select' && normalizedProps.defaultValue != null) {\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tif (normalizedProps.multiple) {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t\t} else {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tvnode.props = normalizedProps;\n\n\t\tif (props.class != props.className) {\n\t\t\tclassNameDescriptor.enumerable = 'className' in props;\n\t\t\tif (props.className != null) normalizedProps.class = props.className;\n\t\t\tObject.defineProperty(normalizedProps, 'className', classNameDescriptor);\n\t\t}\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function(vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection. So far\n// only `react-relay` makes use of it. It uses it to read the\n// context value.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t}\n\t\t}\n\t}\n};\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f);else for(t in e)e[t]&&(n&&(n+=\" \"),n+=t);return n}export function clsx(){for(var e,t,f=0,n=\"\";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__self]\n * @param {string} [__source]\n */\nfunction createVNode(type, props, key, __self, __source) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import { css } from '@linaria/core';\n\nexport const row = css`\n display: contents;\n line-height: var(--rdg-row-height);\n background-color: var(--rdg-background-color);\n\n &:hover {\n background-color: var(--rdg-row-hover-background-color);\n }\n\n &[aria-selected='true'] {\n background-color: var(--rdg-row-selected-background-color);\n\n &:hover {\n background-color: var(--row-selected-hover-background-color);\n }\n }\n`;\n\nexport const rowClassname = `rdg-row ${row}`;\n\nexport const rowSelected = css`\n outline: 2px solid var(--rdg-selection-color);\n outline-offset: -2px;\n`;\n\nexport const rowSelectedClassname = `rdg-row-selected`;\n\nexport const rowSelectedWithFrozenCell = css`\n &::before {\n content: '';\n display: inline-block;\n height: 100%;\n position: sticky;\n inset-inline-start: 0;\n border-inline-start: 2px solid var(--rdg-selection-color);\n }\n`;\n","import { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport type { CheckboxFormatterProps } from '../types';\n\nconst checkboxLabel = css`\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n inset: 0;\n margin-inline-end: 1px; /* align checkbox in row group cell */\n`;\n\nconst checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;\n\nconst checkboxInput = css`\n all: unset;\n`;\n\nconst checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;\n\nconst checkbox = css`\n content: '';\n inline-size: 20px;\n block-size: 20px;\n border: 2px solid var(--rdg-border-color);\n background-color: var(--rdg-background-color);\n .${checkboxInput}:checked + & {\n background-color: var(--rdg-checkbox-color);\n outline: 4px solid var(--rdg-background-color);\n outline-offset: -6px;\n }\n .${checkboxInput}:focus + & {\n border-color: var(--rdg-checkbox-focus-color);\n }\n`;\n\nconst checkboxClassname = `rdg-checkbox ${checkbox}`;\n\nconst checkboxLabelDisabled = css`\n cursor: default;\n .${checkbox} {\n border-color: var(--rdg-checkbox-disabled-border-color);\n background-color: var(--rdg-checkbox-disabled-background-color);\n }\n`;\n\nconst checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;\n\nexport const CheckboxFormatter = forwardRef<HTMLInputElement, CheckboxFormatterProps>(\n function CheckboxFormatter({ onChange, ...props }: CheckboxFormatterProps, ref) {\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n onChange(e.target.checked, (e.nativeEvent as MouseEvent).shiftKey);\n }\n\n return (\n <label\n className={clsx(checkboxLabelClassname, {\n [checkboxLabelDisabledClassname]: props.disabled\n })}\n >\n <input\n type=\"checkbox\"\n ref={ref}\n {...props}\n className={checkboxInputClassname}\n onChange={handleChange}\n />\n <div className={checkboxClassname} />\n </label>\n );\n }\n);\n","// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport { useEffect, useLayoutEffect as useOriginalLayoutEffect } from 'react';\n\n// Silence silly warning\n// https://reactjs.org/link/uselayouteffect-ssr\nexport const useLayoutEffect = typeof window === 'undefined' ? useEffect : useOriginalLayoutEffect;\n","import { useRef } from 'react';\nimport { useLayoutEffect } from './useLayoutEffect';\n\nexport function useFocusRef<T extends HTMLOrSVGElement>(isSelected: boolean) {\n const ref = useRef<T>(null);\n\n useLayoutEffect(() => {\n if (!isSelected) return;\n ref.current?.focus({ preventScroll: true });\n }, [isSelected]);\n\n return {\n ref,\n tabIndex: isSelected ? 0 : -1\n };\n}\n","import { createContext, useContext } from 'react';\n\nimport type { Components, Maybe } from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst DataGridDefaultComponentsContext = createContext<Maybe<Components<any, any>>>(undefined);\n\nexport const DataGridDefaultComponentsProvider = DataGridDefaultComponentsContext.Provider;\n\nexport function useDefaultComponents<R, SR>(): Maybe<Components<R, SR>> {\n return useContext(DataGridDefaultComponentsContext);\n}\n","import { useFocusRef } from '../hooks/useFocusRef';\nimport { useDefaultComponents } from '../DataGridDefaultComponentsProvider';\nimport type { CheckboxFormatterProps } from '../types';\n\ntype SharedInputProps = Pick<CheckboxFormatterProps, 'disabled' | 'aria-label' | 'aria-labelledby'>;\n\ninterface SelectCellFormatterProps extends SharedInputProps {\n isCellSelected: boolean;\n value: boolean;\n onChange: (value: boolean, isShiftClick: boolean) => void;\n}\n\nexport function SelectCellFormatter({\n value,\n isCellSelected,\n disabled,\n onChange,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n}: SelectCellFormatterProps) {\n const { ref, tabIndex } = useFocusRef<HTMLInputElement>(isCellSelected);\n const Formatter = useDefaultComponents()!.checkboxFormatter!;\n\n return (\n <Formatter\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n ref={ref}\n tabIndex={tabIndex}\n disabled={disabled}\n checked={value}\n onChange={onChange}\n />\n );\n}\n","import type { FormatterProps } from '../types';\n\nexport function ValueFormatter<R, SR>(props: FormatterProps<R, SR>) {\n try {\n return <>{props.row[props.column.key as keyof R]}</>;\n } catch {\n return null;\n }\n}\n","import { css } from '@linaria/core';\nimport type { GroupFormatterProps } from '../types';\nimport { useFocusRef } from '../hooks/useFocusRef';\n\nconst groupCellContent = css`\n outline: none;\n`;\n\nconst groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;\n\nconst caret = css`\n margin-inline-start: 4px;\n stroke: currentColor;\n stroke-width: 1.5px;\n fill: transparent;\n vertical-align: middle;\n\n > path {\n transition: d 0.1s;\n }\n`;\n\nconst caretClassname = `rdg-caret ${caret}`;\n\nexport function ToggleGroupFormatter<R, SR>({\n groupKey,\n isExpanded,\n isCellSelected,\n toggleGroup\n}: GroupFormatterProps<R, SR>) {\n const { ref, tabIndex } = useFocusRef<HTMLSpanElement>(isCellSelected);\n\n function handleKeyDown({ key }: React.KeyboardEvent<HTMLSpanElement>) {\n if (key === 'Enter') {\n toggleGroup();\n }\n }\n\n const d = isExpanded ? 'M1 1 L 7 7 L 13 1' : 'M1 7 L 7 1 L 13 7';\n\n return (\n <span\n ref={ref}\n className={groupCellContentClassname}\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n >\n {groupKey}\n <svg viewBox=\"0 0 14 8\" width=\"14\" height=\"8\" className={caretClassname} aria-hidden>\n <path d={d} />\n </svg>\n </span>\n );\n}\n","import { createContext, useContext } from 'react';\nimport type { SelectRowEvent } from '../types';\n\nconst RowSelectionContext = createContext<boolean | undefined>(undefined);\n\nexport const RowSelectionProvider = RowSelectionContext.Provider;\n\nconst RowSelectionChangeContext = createContext<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((selectRowEvent: SelectRowEvent<any>) => void) | undefined\n>(undefined);\n\nexport const RowSelectionChangeProvider = RowSelectionChangeContext.Provider;\n\nexport function useRowSelection<R>(): [boolean, (selectRowEvent: SelectRowEvent<R>) => void] {\n const rowSelectionContext = useContext(RowSelectionContext);\n const rowSelectionChangeContext = useContext(RowSelectionChangeContext);\n\n if (rowSelectionContext === undefined || rowSelectionChangeContext === undefined) {\n throw new Error('useRowSelection must be used within DataGrid cells');\n }\n\n return [rowSelectionContext, rowSelectionChangeContext];\n}\n","import { SelectCellFormatter } from './formatters';\nimport { useRowSelection } from './hooks/useRowSelection';\nimport type { Column, FormatterProps, GroupFormatterProps } from './types';\n\nexport const SELECT_COLUMN_KEY = 'select-row';\n\nfunction SelectFormatter(props: FormatterProps<unknown>) {\n const [isRowSelected, onRowSelectionChange] = useRowSelection();\n\n return (\n <SelectCellFormatter\n aria-label=\"Select\"\n isCellSelected={props.isCellSelected}\n value={isRowSelected}\n onChange={(checked, isShiftClick) => {\n onRowSelectionChange({ row: props.row, checked, isShiftClick });\n }}\n />\n );\n}\n\nfunction SelectGroupFormatter(props: GroupFormatterProps<unknown>) {\n const [isRowSelected, onRowSelectionChange] = useRowSelection();\n\n return (\n <SelectCellFormatter\n aria-label=\"Select Group\"\n isCellSelected={props.isCellSelected}\n value={isRowSelected}\n onChange={(checked) => {\n onRowSelectionChange({ row: props.row, checked, isShiftClick: false });\n }}\n />\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const SelectColumn: Column<any, any> = {\n key: SELECT_COLUMN_KEY,\n name: '',\n width: 35,\n minWidth: 35,\n maxWidth: 35,\n resizable: false,\n sortable: false,\n frozen: true,\n headerRenderer(props) {\n return (\n <SelectCellFormatter\n aria-label=\"Select All\"\n isCellSelected={props.isCellSelected}\n value={props.allRowsSelected}\n onChange={props.onAllRowsSelectionChange}\n />\n );\n },\n formatter: SelectFormatter,\n groupFormatter: SelectGroupFormatter\n};\n","import type { CalculatedColumn, ColSpanArgs } from '../types';\n\nexport function getColSpan<R, SR>(\n column: CalculatedColumn<R, SR>,\n lastFrozenColumnIndex: number,\n args: ColSpanArgs<R, SR>\n): number | undefined {\n const colSpan = typeof column.colSpan === 'function' ? column.colSpan(args) : 1;\n if (\n Number.isInteger(colSpan) &&\n colSpan! > 1 &&\n // ignore colSpan if it spans over both frozen and regular columns\n (!column.frozen || column.idx + colSpan! - 1 <= lastFrozenColumnIndex)\n ) {\n return colSpan!;\n }\n return undefined;\n}\n","// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values\nconst nonInputKeys = new Set([\n // Special keys\n 'Unidentified',\n // Modifier keys\n 'Alt',\n 'AltGraph',\n 'CapsLock',\n 'Control',\n 'Fn',\n 'FnLock',\n 'Meta',\n 'NumLock',\n 'ScrollLock',\n 'Shift',\n // Whitespace keys\n 'Tab',\n // Navigation keys\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'End',\n 'Home',\n 'PageDown',\n 'PageUp',\n // Editing\n 'Insert',\n // UI keys\n 'ContextMenu',\n 'Escape',\n 'Pause',\n 'Play',\n // Device keys\n 'PrintScreen',\n // Function keys\n 'F1',\n // 'F2', /!\\ specifically allowed, do not edit\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'F10',\n 'F11',\n 'F12'\n]);\n\nexport function isCtrlKeyHeldDown(e: React.KeyboardEvent): boolean {\n return (e.ctrlKey || e.metaKey) && e.key !== 'Control';\n}\n\nexport function isDefaultCellInput(event: React.KeyboardEvent<HTMLDivElement>): boolean {\n return !nonInputKeys.has(event.key);\n}\n\n/**\n * By default, the following navigation keys are enabled while an editor is open, under specific conditions:\n * - Tab:\n * - The editor must be an <input>, a <textarea>, or a <select> element.\n * - The editor element must be the only immediate child of the editor container/a label.\n */\nexport function onEditorNavigation({ key, target }: React.KeyboardEvent<HTMLDivElement>): boolean {\n if (\n key === 'Tab' &&\n (target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement)\n ) {\n return target.matches(\n '.rdg-editor-container > :only-child, .rdg-editor-container > label:only-child > :only-child'\n );\n }\n return false;\n}\n","import type { CalculatedColumn, Position, GroupRow, CellNavigationMode, Maybe } from '../types';\nimport { getColSpan } from './colSpanUtils';\n\ninterface IsSelectedCellEditableOpts<R, SR> {\n selectedPosition: Position;\n columns: readonly CalculatedColumn<R, SR>[];\n rows: readonly (R | GroupRow<R>)[];\n isGroupRow: (row: R | GroupRow<R>) => row is GroupRow<R>;\n}\n\nexport function isSelectedCellEditable<R, SR>({\n selectedPosition,\n columns,\n rows,\n isGroupRow\n}: IsSelectedCellEditableOpts<R, SR>): boolean {\n const column = columns[selectedPosition.idx];\n const row = rows[selectedPosition.rowIdx];\n return !isGroupRow(row) && isCellEditable(column, row);\n}\n\nexport function isCellEditable<R, SR>(column: CalculatedColumn<R, SR>, row: R): boolean {\n return (\n column.editor != null &&\n !column.rowGroup &&\n (typeof column.editable === 'function' ? column.editable(row) : column.editable) !== false\n );\n}\n\ninterface GetNextSelectedCellPositionOpts<R, SR> {\n cellNavigationMode: CellNavigationMode;\n columns: readonly CalculatedColumn<R, SR>[];\n colSpanColumns: readonly CalculatedColumn<R, SR>[];\n rows: readonly (R | GroupRow<R>)[];\n summaryRows: Maybe<readonly SR[]>;\n minRowIdx: number;\n maxRowIdx: number;\n currentPosition: Position;\n nextPosition: Position;\n lastFrozenColumnIndex: number;\n isCellWithinBounds: (position: Position) => boolean;\n isGroupRow: (row: R | GroupRow<R>) => row is GroupRow<R>;\n}\n\nexport function getSelectedCellColSpan<R, SR>({\n rows,\n summaryRows,\n rowIdx,\n lastFrozenColumnIndex,\n column,\n isGroupRow\n}: Pick<\n GetNextSelectedCellPositionOpts<R, SR>,\n 'rows' | 'summaryRows' | 'isGroupRow' | 'lastFrozenColumnIndex'\n> & {\n rowIdx: number;\n column: CalculatedColumn<R, SR>;\n}) {\n if (rowIdx === -1) {\n return getColSpan(column, lastFrozenColumnIndex, { type: 'HEADER' });\n }\n\n if (rowIdx >= 0 && rowIdx < rows.length) {\n const row = rows[rowIdx];\n if (!isGroupRow(row)) {\n return getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row });\n }\n return undefined;\n }\n\n if (summaryRows) {\n return getColSpan(column, lastFrozenColumnIndex, {\n type: 'SUMMARY',\n row: summaryRows[rowIdx - rows.length]\n });\n }\n\n return undefined;\n}\n\nexport function getNextSelectedCellPosition<R, SR>({\n cellNavigationMode,\n columns,\n colSpanColumns,\n rows,\n summaryRows,\n minRowIdx,\n maxRowIdx,\n currentPosition: { idx: currentIdx },\n nextPosition,\n lastFrozenColumnIndex,\n isCellWithinBounds,\n isGroupRow\n}: GetNextSelectedCellPositionOpts<R, SR>): Position {\n let { idx: nextIdx, rowIdx: nextRowIdx } = nextPosition;\n\n const setColSpan = (moveRight: boolean) => {\n if (nextRowIdx >= 0 && nextRowIdx < rows.length) {\n const row = rows[nextRowIdx];\n if (isGroupRow(row)) return;\n }\n // If a cell within the colspan range is selected then move to the\n // previous or the next cell depending on the navigation direction\n for (const column of colSpanColumns) {\n const colIdx = column.idx;\n if (colIdx > nextIdx) break;\n const colSpan = getSelectedCellColSpan({\n rows,\n summaryRows,\n rowIdx: nextRowIdx,\n lastFrozenColumnIndex,\n column,\n isGroupRow\n });\n\n if (colSpan && nextIdx > colIdx && nextIdx < colSpan + colIdx) {\n nextIdx = colIdx + (moveRight ? colSpan : 0);\n break;\n }\n }\n };\n\n if (isCellWithinBounds(nextPosition)) {\n setColSpan(nextIdx - currentIdx > 0);\n }\n\n if (cellNavigationMode !== 'NONE') {\n const columnsCount = columns.length;\n const isAfterLastColumn = nextIdx === columnsCount;\n const isBeforeFirstColumn = nextIdx === -1;\n\n if (isAfterLastColumn) {\n if (cellNavigationMode === 'CHANGE_ROW') {\n const isLastRow = nextRowIdx === maxRowIdx;\n if (!isLastRow) {\n nextIdx = 0;\n nextRowIdx += 1;\n }\n } else {\n nextIdx = 0;\n }\n } else if (isBeforeFirstColumn) {\n if (cellNavigationMode === 'CHANGE_ROW') {\n const isFirstRow = nextRowIdx === minRowIdx;\n if (!isFirstRow) {\n nextRowIdx -= 1;\n nextIdx = columnsCount - 1;\n }\n } else {\n nextIdx = columnsCount - 1;\n }\n setColSpan(false);\n }\n }\n\n return { idx: nextIdx, rowIdx: nextRowIdx };\n}\n\ninterface CanExitGridOpts {\n cellNavigationMode: CellNavigationMode;\n maxColIdx: number;\n minRowIdx: number;\n maxRowIdx: number;\n selectedPosition: Position;\n shiftKey: boolean;\n}\n\nexport function canExitGrid({\n cellNavigationMode,\n maxColIdx,\n minRowIdx,\n maxRowIdx,\n selectedPosition: { rowIdx, idx },\n shiftKey\n}: CanExitGridOpts): boolean {\n // When the cellNavigationMode is 'none' or 'changeRow', you can exit the grid if you're at the first or last cell of the grid\n // When the cellNavigationMode is 'loopOverRow', there is no logical exit point so you can't exit the grid\n if (cellNavigationMode === 'NONE' || cellNavigationMode === 'CHANGE_ROW') {\n const atLastCellInRow = idx === maxColIdx;\n const atFirstCellInRow = idx === 0;\n const atLastRow = rowIdx === maxRowIdx;\n const atFirstRow = rowIdx === minRowIdx;\n\n return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;\n }\n\n return false;\n}\n","import type { CSSProperties } from 'react';\nimport clsx from 'clsx';\n\nimport type { CalculatedColumn } from '../types';\nimport { cellClassname, cellFrozenClassname, cellFrozenLastClassname } from '../style';\n\nexport function getRowStyle(rowIdx: number, height?: number): CSSProperties {\n if (height !== undefined) {\n return {\n '--rdg-grid-row-start': rowIdx,\n '--rdg-row-height': `${height}px`\n } as unknown as CSSProperties;\n }\n return { '--rdg-grid-row-start': rowIdx } as unknown as CSSProperties;\n}\n\nexport function getCellStyle<R, SR>(\n column: CalculatedColumn<R, SR>,\n colSpan?: number\n): React.CSSProperties {\n return {\n gridColumnStart: column.idx + 1,\n gridColumnEnd: colSpan !== undefined ? `span ${colSpan}` : undefined,\n insetInlineStart: column.frozen ? `var(--rdg-frozen-left-${column.idx})` : undefined\n };\n}\n\nexport function getCellClassname<R, SR>(\n column: CalculatedColumn<R, SR>,\n ...extraClasses: Parameters<typeof clsx>\n): string {\n return clsx(\n cellClassname,\n {\n [cellFrozenClassname]: column.frozen,\n [cellFrozenLastClassname]: column.isLastFrozenColumn\n },\n ...extraClasses\n );\n}\n","import { css } from '@linaria/core';\n\nexport const cell = css`\n contain: strict;\n contain: size layout style paint;\n padding-block: 0;\n padding-inline: 8px;\n border-inline-end: 1px solid var(--rdg-border-color);\n border-block-end: 1px solid var(--rdg-border-color);\n grid-row-start: var(--rdg-grid-row-start);\n background-color: inherit;\n\n white-space: nowrap;\n overflow: hidden;\n overflow: clip;\n text-overflow: ellipsis;\n outline: none;\n\n &[aria-selected='true'] {\n outline: 2px solid var(--rdg-selection-color);\n outline-offset: -2px;\n }\n`;\n\nexport const cellClassname = `rdg-cell ${cell}`;\n\n// max-content does not calculate width when contain is set to style or size\nexport const cellAutoResizeClassname = css`\n .${cell} {\n contain: content;\n }\n`;\n\nexport const cellFrozen = css`\n position: sticky;\n /* Should have a higher value than 0 to show up above unfrozen cells */\n z-index: 1;\n`;\n\nexport const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;\n\nexport const cellFrozenLast = css`\n box-shadow: calc(2px * var(--rdg-sign)) 0 5px -2px rgba(136, 136, 136, 0.3);\n`;\n\nexport const cellFrozenLastClassname = `rdg-cell-frozen-last ${cellFrozenLast}`;\n","import type { CalculatedColumn } from '../types';\n\nexport * from './colSpanUtils';\nexport * from './domUtils';\nexport * from './keyboardUtils';\nexport * from './selectedCellUtils';\nexport * from './styleUtils';\n\nexport const { min, max, round, floor, sign, abs, ceil } = Math;\n\nexport function assertIsValidKeyGetter<R, K extends React.Key>(\n keyGetter: unknown\n): asserts keyGetter is (row: R) => K {\n if (typeof keyGetter !== 'function') {\n throw new Error('Please specify the rowKeyGetter prop to use selection');\n }\n}\n\nexport function clampColumnWidth<R, SR>(\n width: number,\n { minWidth, maxWidth }: CalculatedColumn<R, SR>\n): number {\n width = max(width, minWidth);\n\n // ignore maxWidth if it less than minWidth\n if (typeof maxWidth === 'number' && maxWidth > minWidth) {\n return min(width, maxWidth);\n }\n\n return width;\n}\n","import { useMemo } from 'react';\n\nimport type { CalculatedColumn, Column, Maybe } from '../types';\nimport type { DataGridProps } from '../DataGrid';\nimport { ValueFormatter, ToggleGroupFormatter } from '../formatters';\nimport { SELECT_COLUMN_KEY } from '../Columns';\nimport { clampColumnWidth, floor, max, min, round } from '../utils';\n\ntype Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\ninterface ColumnMetric {\n width: number;\n left: number;\n}\n\ninterface CalculatedColumnsArgs<R, SR> extends Pick<DataGridProps<R, SR>, 'defaultColumnOptions'> {\n rawColumns: readonly Column<R, SR>[];\n rawGroupBy: Maybe<readonly string[]>;\n viewportWidth: number;\n scrollLeft: number;\n columnWidths: ReadonlyMap<string, number>;\n enableVirtualization: boolean;\n}\n\nexport function useCalculatedColumns<R, SR>({\n rawColumns,\n columnWidths,\n viewportWidth,\n scrollLeft,\n defaultColumnOptions,\n rawGroupBy,\n enableVirtualization\n}: CalculatedColumnsArgs<R, SR>) {\n const defaultWidth = defaultColumnOptions?.width;\n const defaultMinWidth = defaultColumnOptions?.minWidth ?? 80;\n const defaultMaxWidth = defaultColumnOptions?.maxWidth;\n const defaultFormatter = defaultColumnOptions?.formatter ?? ValueFormatter;\n const defaultSortable = defaultColumnOptions?.sortable ?? false;\n const defaultResizable = defaultColumnOptions?.resizable ?? false;\n\n const { columns, colSpanColumns, lastFrozenColumnIndex, groupBy } = useMemo((): {\n columns: readonly CalculatedColumn<R, SR>[];\n colSpanColumns: readonly CalculatedColumn<R, SR>[];\n lastFrozenColumnIndex: number;\n groupBy: readonly string[];\n } => {\n // Filter rawGroupBy and ignore keys that do not match the columns prop\n const groupBy: string[] = [];\n let lastFrozenColumnIndex = -1;\n\n const columns = rawColumns.map((rawColumn) => {\n const rowGroup = rawGroupBy?.includes(rawColumn.key) ?? false;\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const frozen = rowGroup || rawColumn.frozen || false;\n\n const column: Mutable<CalculatedColumn<R, SR>> = {\n ...rawColumn,\n idx: 0,\n frozen,\n isLastFrozenColumn: false,\n rowGroup,\n width: rawColumn.width ?? defaultWidth,\n minWidth: rawColumn.minWidth ?? defaultMinWidth,\n maxWidth: rawColumn.maxWidth ?? defaultMaxWidth,\n sortable: rawColumn.sortable ?? defaultSortable,\n resizable: rawColumn.resizable ?? defaultResizable,\n formatter: rawColumn.formatter ?? defaultFormatter\n };\n\n if (rowGroup) {\n column.groupFormatter ??= ToggleGroupFormatter;\n }\n\n if (frozen) {\n lastFrozenColumnIndex++;\n }\n\n return column;\n });\n\n columns.sort(({ key: aKey, frozen: frozenA }, { key: bKey, frozen: frozenB }) => {\n // Sort select column first:\n if (aKey === SELECT_COLUMN_KEY) return -1;\n if (bKey === SELECT_COLUMN_KEY) return 1;\n\n // Sort grouped columns second, following the groupBy order:\n if (rawGroupBy?.includes(aKey)) {\n if (rawGroupBy.includes(bKey)) {\n return rawGroupBy.indexOf(aKey) - rawGroupBy.indexOf(bKey);\n }\n return -1;\n }\n if (rawGroupBy?.includes(bKey)) return 1;\n\n // Sort frozen columns third:\n if (frozenA) {\n if (frozenB) return 0;\n return -1;\n }\n if (frozenB) return 1;\n\n // Sort other columns last:\n return 0;\n });\n\n const colSpanColumns: CalculatedColumn<R, SR>[] = [];\n columns.forEach((column, idx) => {\n column.idx = idx;\n\n if (column.rowGroup) {\n groupBy.push(column.key);\n }\n\n if (column.colSpan != null) {\n colSpanColumns.push(column);\n }\n });\n\n if (lastFrozenColumnIndex !== -1) {\n columns[lastFrozenColumnIndex].isLastFrozenColumn = true;\n }\n\n return {\n columns,\n colSpanColumns,\n lastFrozenColumnIndex,\n groupBy\n };\n }, [\n rawColumns,\n defaultWidth,\n defaultMinWidth,\n defaultMaxWidth,\n defaultFormatter,\n defaultResizable,\n defaultSortable,\n rawGroupBy\n ]);\n\n const { layoutCssVars, totalFrozenColumnWidth, columnMetrics } = useMemo((): {\n layoutCssVars: Readonly<Record<string, string>>;\n totalFrozenColumnWidth: number;\n columnMetrics: ReadonlyMap<CalculatedColumn<R, SR>, ColumnMetric>;\n } => {\n const columnMetrics = new Map<CalculatedColumn<R, SR>, ColumnMetric>();\n let left = 0;\n let totalFrozenColumnWidth = 0;\n let templateColumns = '';\n let allocatedWidth = 0;\n let unassignedColumnsCount = 0;\n\n for (const column of columns) {\n let width = getSpecifiedWidth(column, columnWidths, viewportWidth);\n\n if (width === undefined) {\n unassignedColumnsCount++;\n } else {\n width = clampColumnWidth(width, column);\n allocatedWidth += width;\n columnMetrics.set(column, { width, left: 0 });\n }\n }\n\n for (const column of columns) {\n let width: number;\n if (columnMetrics.has(column)) {\n const columnMetric = columnMetrics.get(column)!;\n columnMetric.left = left;\n ({ width } = columnMetric);\n } else {\n // avoid decimals as subpixel positioning can lead to cell borders not being displayed\n const unallocatedWidth = viewportWidth - allocatedWidth;\n const unallocatedColumnWidth = round(unallocatedWidth / unassignedColumnsCount);\n width = clampColumnWidth(unallocatedColumnWidth, column);\n allocatedWidth += width;\n unassignedColumnsCount--;\n columnMetrics.set(column, { width, left });\n }\n left += width;\n templateColumns += `${width}px `;\n }\n\n if (lastFrozenColumnIndex !== -1) {\n const columnMetric = columnMetrics.get(columns[lastFrozenColumnIndex])!;\n totalFrozenColumnWidth = columnMetric.left + columnMetric.width;\n }\n\n const layoutCssVars: Record<string, string> = {\n gridTemplateColumns: templateColumns\n };\n\n for (let i = 0; i <= lastFrozenColumnIndex; i++) {\n const column = columns[i];\n layoutCssVars[`--rdg-frozen-left-${column.idx}`] = `${columnMetrics.get(column)!.left}px`;\n }\n\n return { layoutCssVars, totalFrozenColumnWidth, columnMetrics };\n }, [columnWidths, columns, viewportWidth, lastFrozenColumnIndex]);\n\n const [colOverscanStartIdx, colOverscanEndIdx] = useMemo((): [number, number] => {\n if (!enableVirtualization) {\n return [0, columns.length - 1];\n }\n // get the viewport's left side and right side positions for non-frozen columns\n const viewportLeft = scrollLeft + totalFrozenColumnWidth;\n const viewportRight = scrollLeft + viewportWidth;\n // get first and last non-frozen column indexes\n const lastColIdx = columns.length - 1;\n const firstUnfrozenColumnIdx = min(lastFrozenColumnIndex + 1, lastColIdx);\n\n // skip rendering non-frozen columns if the frozen columns cover the entire viewport\n if (viewportLeft >= viewportRight) {\n return [firstUnfrozenColumnIdx, firstUnfrozenColumnIdx];\n }\n\n // get the first visible non-frozen column index\n let colVisibleStartIdx = firstUnfrozenColumnIdx;\n while (colVisibleStartIdx < lastColIdx) {\n const { left, width } = columnMetrics.get(columns[colVisibleStartIdx])!;\n // if the right side of the columnn is beyond the left side of the available viewport,\n // then it is the first column that's at least partially visible\n if (left + width > viewportLeft) {\n break;\n }\n colVisibleStartIdx++;\n }\n\n // get the last visible non-frozen column index\n let colVisibleEndIdx = colVisibleStartIdx;\n while (colVisibleEndIdx < lastColIdx) {\n const { left, width } = columnMetrics.get(columns[colVisibleEndIdx])!;\n // if the right side of the column is beyond or equal to the right side of the available viewport,\n // then it the last column that's at least partially visible, as the previous column's right side is not beyond the viewport.\n if (left + width >= viewportRight) {\n break;\n }\n colVisibleEndIdx++;\n }\n\n const colOverscanStartIdx = max(firstUnfrozenColumnIdx, colVisibleStartIdx - 1);\n const colOverscanEndIdx = min(lastColIdx, colVisibleEndIdx + 1);\n\n return [colOverscanStartIdx, colOverscanEndIdx];\n }, [\n columnMetrics,\n columns,\n lastFrozenColumnIndex,\n scrollLeft,\n totalFrozenColumnWidth,\n viewportWidth,\n enableVirtualization\n ]);\n\n return {\n columns,\n colSpanColumns,\n colOverscanStartIdx,\n colOverscanEndIdx,\n layoutCssVars,\n columnMetrics,\n lastFrozenColumnIndex,\n totalFrozenColumnWidth,\n groupBy\n };\n}\n\nfunction getSpecifiedWidth<R, SR>(\n { key, width }: Column<R, SR>,\n columnWidths: ReadonlyMap<string, number>,\n viewportWidth: number\n): number | undefined {\n if (columnWidths.has(key)) {\n // Use the resized width if available\n return columnWidths.get(key);\n }\n\n if (typeof width === 'number') {\n return width;\n }\n if (typeof width === 'string' && /^\\d+%$/.test(width)) {\n return floor((viewportWidth * parseInt(width, 10)) / 100);\n }\n return undefined;\n}\n","import { useRef, useState } from 'react';\nimport { useLayoutEffect } from './useLayoutEffect';\n\nimport { ceil } from '../utils';\n\nexport function useGridDimensions(): [\n ref: React.RefObject<HTMLDivElement>,\n width: number,\n height: number\n] {\n const gridRef = useRef<HTMLDivElement>(null);\n const [inlineSize, setInlineSize] = useState(1);\n const [blockSize, setBlockSize] = useState(1);\n\n useLayoutEffect(() => {\n const { ResizeObserver } = window;\n\n // don't break in Node.js (SSR), jest/jsdom, and browsers that don't support ResizeObserver\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (ResizeObserver == null) return;\n\n const { clientWidth, clientHeight, offsetWidth, offsetHeight } = gridRef.current!;\n const { width, height } = gridRef.current!.getBoundingClientRect();\n const initialWidth = width - offsetWidth + clientWidth;\n const initialHeight = height - offsetHeight + clientHeight;\n\n setInlineSize(handleDevicePixelRatio(initialWidth));\n setBlockSize(initialHeight);\n\n const resizeObserver = new ResizeObserver((entries) => {\n const size = entries[0].contentBoxSize[0];\n setInlineSize(handleDevicePixelRatio(size.inlineSize));\n setBlockSize(size.blockSize);\n });\n resizeObserver.observe(gridRef.current!);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n return [gridRef, inlineSize, blockSize];\n}\n\n// TODO: remove once fixed upstream\n// we reduce width by 1px here to avoid layout issues in Chrome\n// https://bugs.chromium.org/p/chromium/issues/detail?id=1206298\nfunction handleDevicePixelRatio(size: number) {\n return size - (devicePixelRatio === 1 ? 0 : ceil(devicePixelRatio));\n}\n","import { useRef, useEffect, useCallback } from 'react';\n\n// https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useLatestFunc<T extends (...args: any[]) => any>(fn: T) {\n const ref = useRef(fn);\n\n useEffect(() => {\n ref.current = fn;\n });\n\n return useCallback((...args: Parameters<T>) => {\n ref.current(...args);\n }, []);\n}\n","import { useCallback, useState } from 'react';\n\n// https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_roving_tabindex\nexport function useRovingCellRef(isSelected: boolean) {\n // https://www.w3.org/TR/wai-aria-practices-1.1/#gridNav_focus\n const [isChildFocused, setIsChildFocused] = useState(false);\n\n if (isChildFocused && !isSelected) {\n setIsChildFocused(false);\n }\n\n const ref = useCallback((cell: HTMLDivElement | null) => {\n if (cell === null || cell.contains(document.activeElement)) return;\n\n cell.focus({ preventScroll: true });\n }, []);\n\n function onFocus(event: React.FocusEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) {\n setIsChildFocused(true);\n }\n }\n\n const isFocused = isSelected && !isChildFocused;\n\n return {\n ref: isSelected ? ref : undefined,\n tabIndex: isFocused ? 0 : -1,\n onFocus: isSelected ? onFocus : undefined\n };\n}\n","import { useMemo } from 'react';\nimport { floor, max, min } from '../utils';\nimport type { GroupRow, Maybe, RowHeightArgs } from '../types';\n\ntype GroupByDictionary<TRow> = Record<\n string,\n {\n readonly childRows: readonly TRow[];\n readonly childGroups: readonly TRow[] | Readonly<GroupByDictionary<TRow>>;\n readonly startRowIndex: number;\n }\n>;\n\ninterface ViewportRowsArgs<R> {\n rawRows: readonly R[];\n rowHeight: number | ((args: RowHeightArgs<R>) => number);\n clientHeight: number;\n scrollTop: number;\n groupBy: readonly string[];\n rowGrouper: Maybe<(rows: readonly R[], columnKey: string) => Record<string, readonly R[]>>;\n expandedGroupIds: Maybe<ReadonlySet<unknown>>;\n enableVirtualization: boolean;\n}\n\n// TODO: https://github.com/microsoft/TypeScript/issues/41808\nfunction isReadonlyArray(arr: unknown): arr is readonly unknown[] {\n return Array.isArray(arr);\n}\n\nexport function useViewportRows<R>({\n rawRows,\n rowHeight,\n clientHeight,\n scrollTop,\n groupBy,\n rowGrouper,\n expandedGroupIds,\n enableVirtualization\n}: ViewportRowsArgs<R>) {\n const [groupedRows, rowsCount] = useMemo(() => {\n if (groupBy.length === 0 || rowGrouper == null) return [undefined, rawRows.length];\n\n const groupRows = (\n rows: readonly R[],\n [groupByKey, ...remainingGroupByKeys]: readonly string[],\n startRowIndex: number\n ): [Readonly<GroupByDictionary<R>>, number] => {\n let groupRowsCount = 0;\n const groups: GroupByDictionary<R> = {};\n for (const [key, childRows] of Object.entries(rowGrouper(rows, groupByKey))) {\n // Recursively group each parent group\n const [childGroups, childRowsCount] =\n remainingGroupByKeys.length === 0\n ? [childRows, childRows.length]\n : groupRows(childRows, remainingGroupByKeys, startRowIndex + groupRowsCount + 1); // 1 for parent row\n groups[key] = { childRows, childGroups, startRowIndex: startRowIndex + groupRowsCount };\n groupRowsCount += childRowsCount + 1; // 1 for parent row\n }\n\n return [groups, groupRowsCount];\n };\n\n return groupRows(rawRows, groupBy, 0);\n }, [groupBy, rowGrouper, rawRows]);\n\n const [rows, isGroupRow] = useMemo((): [\n ReadonlyArray<R | GroupRow<R>>,\n (row: R | GroupRow<R>) => row is GroupRow<R>\n ] => {\n const allGroupRows = new Set<unknown>();\n if (!groupedRows) return [rawRows, isGroupRow];\n\n const flattenedRows: Array<R | GroupRow<R>> = [];\n const expandGroup = (\n rows: GroupByDictionary<R> | readonly R[],\n parentId: string | undefined,\n level: number\n ): void => {\n if (isReadonlyArray(rows)) {\n flattenedRows.push(...rows);\n return;\n }\n Object.keys(rows).forEach((groupKey, posInSet, keys) => {\n // TODO: should users have control over the generated key?\n const id = parentId !== undefined ? `${parentId}__${groupKey}` : groupKey;\n const isExpanded = expandedGroupIds?.has(id) ?? false;\n const { childRows, childGroups, startRowIndex } = rows[groupKey];\n\n const groupRow: GroupRow<R> = {\n id,\n parentId,\n groupKey,\n isExpanded,\n childRows,\n level,\n posInSet,\n startRowIndex,\n setSize: keys.length\n };\n flattenedRows.push(groupRow);\n allGroupRows.add(groupRow);\n\n if (isExpanded) {\n expandGroup(childGroups, id, level + 1);\n }\n });\n };\n\n expandGroup(groupedRows, undefined, 0);\n return [flattenedRows, isGroupRow];\n\n function isGroupRow(row: R | GroupRow<R>): row is GroupRow<R> {\n return allGroupRows.has(row);\n }\n }, [expandedGroupIds, groupedRows, rawRows]);\n\n const { totalRowHeight, gridTemplateRows, getRowTop, getRowHeight, findRowIdx } = useMemo(() => {\n if (typeof rowHeight === 'number') {\n return {\n totalRowHeight: rowHeight * rows.length,\n gridTemplateRows: ` repeat(${rows.length}, ${rowHeight}px)`,\n getRowTop: (rowIdx: number) => rowIdx * rowHeight,\n getRowHeight: () => rowHeight,\n findRowIdx: (offset: number) => floor(offset / rowHeight)\n };\n }\n\n let totalRowHeight = 0;\n let gridTemplateRows = ' ';\n // Calcule the height of all the rows upfront. This can cause performance issues\n // and we can consider using a similar approach as react-window\n // https://github.com/bvaughn/react-window/blob/b0a470cc264e9100afcaa1b78ed59d88f7914ad4/src/VariableSizeList.js#L68\n const rowPositions = rows.map((row: R | GroupRow<R>) => {\n const currentRowHeight = isGroupRow(row)\n ? rowHeight({ type: 'GROUP', row })\n : rowHeight({ type: 'ROW', row });\n const position = { top: totalRowHeight, height: currentRowHeight };\n gridTemplateRows += `${currentRowHeight}px `;\n totalRowHeight += currentRowHeight;\n return position;\n });\n\n const validateRowIdx = (rowIdx: number) => {\n return max(0, min(rows.length - 1, rowIdx));\n };\n\n return {\n totalRowHeight,\n gridTemplateRows,\n getRowTop: (rowIdx: number) => rowPositions[validateRowIdx(rowIdx)].top,\n getRowHeight: (rowIdx: number) => rowPositions[validateRowIdx(rowIdx)].height,\n findRowIdx(offset: number) {\n let start = 0;\n let end = rowPositions.length - 1;\n while (start <= end) {\n const middle = start + floor((end - start) / 2);\n const currentOffset = rowPositions[middle].top;\n\n if (currentOffset === offset) return middle;\n\n if (currentOffset < offset) {\n start = middle + 1;\n } else if (currentOffset > offset) {\n end = middle - 1;\n }\n\n if (start > end) return end;\n }\n return 0;\n }\n };\n }, [isGroupRow, rowHeight, rows]);\n\n let rowOverscanStartIdx = 0;\n let rowOverscanEndIdx = rows.length - 1;\n\n if (enableVirtualization) {\n const overscanThreshold = 4;\n const rowVisibleStartIdx = findRowIdx(scrollTop);\n const rowVisibleEndIdx = findRowIdx(scrollTop + clientHeight);\n rowOverscanStartIdx = max(0, rowVisibleStartIdx - overscanThreshold);\n rowOverscanEndIdx = min(rows.length - 1, rowVisibleEndIdx + overscanThreshold);\n }\n\n return {\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n rowsCount,\n totalRowHeight,\n gridTemplateRows,\n isGroupRow,\n getRowTop,\n getRowHeight,\n findRowIdx\n };\n}\n","import { css } from '@linaria/core';\n\nimport { useFocusRef } from './hooks';\nimport type { HeaderRendererProps } from './types';\nimport { useDefaultComponents } from './DataGridDefaultComponentsProvider';\n\nconst headerSortCell = css`\n cursor: pointer;\n display: flex;\n\n &:focus {\n outline: none;\n }\n`;\n\nconst headerSortCellClassname = `rdg-header-sort-cell ${headerSortCell}`;\n\nconst headerSortName = css`\n flex-grow: 1;\n overflow: hidden;\n overflow: clip;\n text-overflow: ellipsis;\n`;\n\nconst headerSortNameClassname = `rdg-header-sort-name ${headerSortName}`;\n\nexport default function HeaderRenderer<R, SR>({\n column,\n sortDirection,\n priority,\n onSort,\n isCellSelected\n}: HeaderRendererProps<R, SR>) {\n if (!column.sortable) return <>{column.name}</>;\n\n return (\n <SortableHeaderCell\n onSort={onSort}\n sortDirection={sortDirection}\n priority={priority}\n isCellSelected={isCellSelected}\n >\n {column.name}\n </SortableHeaderCell>\n );\n}\n\ntype SharedHeaderCellProps<R, SR> = Pick<\n HeaderRendererProps<R, SR>,\n 'sortDirection' | 'onSort' | 'priority' | 'isCellSelected'\n>;\n\ninterface SortableHeaderCellProps<R, SR> extends SharedHeaderCellProps<R, SR> {\n children: React.ReactNode;\n}\n\nfunction SortableHeaderCell<R, SR>({\n onSort,\n sortDirection,\n priority,\n children,\n isCellSelected\n}: SortableHeaderCellProps<R, SR>) {\n const SortIcon = useDefaultComponents<R, SR>()!.sortIcon!;\n const { ref, tabIndex } = useFocusRef<HTMLSpanElement>(isCellSelected);\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLSpanElement>) {\n if (event.key === ' ' || event.key === 'Enter') {\n // stop propagation to prevent scrolling\n event.preventDefault();\n onSort(event.ctrlKey || event.metaKey);\n }\n }\n\n function handleClick(event: React.MouseEvent<HTMLSpanElement>) {\n onSort(event.ctrlKey || event.metaKey);\n }\n\n return (\n <span\n ref={ref}\n tabIndex={tabIndex}\n className={headerSortCellClassname}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <span className={headerSortNameClassname}>{children}</span>\n <span>\n <SortIcon sortDirection={sortDirection} />\n {priority}\n </span>\n </span>\n );\n}\n","import { css } from '@linaria/core';\n\nimport type { CalculatedColumn, SortColumn } from './types';\nimport type { HeaderRowProps } from './HeaderRow';\nimport DefaultHeaderRenderer from './HeaderRenderer';\nimport { getCellStyle, getCellClassname, clampColumnWidth } from './utils';\nimport { useRovingCellRef } from './hooks';\n\nconst cellResizable = css`\n touch-action: none;\n\n &::after {\n content: '';\n cursor: col-resize;\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n inset-block-end: 0;\n inline-size: 10px;\n }\n`;\n\nconst cellResizableClassname = `rdg-cell-resizable ${cellResizable}`;\n\ntype SharedHeaderRowProps<R, SR> = Pick<\n HeaderRowProps<R, SR, React.Key>,\n | 'sortColumns'\n | 'onSortColumnsChange'\n | 'allRowsSelected'\n | 'onAllRowsSelectionChange'\n | 'selectCell'\n | 'onColumnResize'\n | 'shouldFocusGrid'\n | 'direction'\n>;\n\nexport interface HeaderCellProps<R, SR> extends SharedHeaderRowProps<R, SR> {\n column: CalculatedColumn<R, SR>;\n colSpan: number | undefined;\n isCellSelected: boolean;\n}\n\nexport default function HeaderCell<R, SR>({\n column,\n colSpan,\n isCellSelected,\n onColumnResize,\n allRowsSelected,\n onAllRowsSelectionChange,\n sortColumns,\n onSortColumnsChange,\n selectCell,\n shouldFocusGrid,\n direction\n}: HeaderCellProps<R, SR>) {\n const isRtl = direction === 'rtl';\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n const sortIndex = sortColumns?.findIndex((sort) => sort.columnKey === column.key);\n const sortColumn =\n sortIndex !== undefined && sortIndex > -1 ? sortColumns![sortIndex] : undefined;\n const sortDirection = sortColumn?.direction;\n const priority = sortColumn !== undefined && sortColumns!.length > 1 ? sortIndex! + 1 : undefined;\n const ariaSort =\n sortDirection && !priority ? (sortDirection === 'ASC' ? 'ascending' : 'descending') : undefined;\n\n const className = getCellClassname(column, column.headerCellClass, {\n [cellResizableClassname]: column.resizable\n });\n\n const HeaderRenderer = column.headerRenderer ?? DefaultHeaderRenderer;\n\n function onPointerDown(event: React.PointerEvent<HTMLDivElement>) {\n if (event.pointerType === 'mouse' && event.buttons !== 1) {\n return;\n }\n\n const { currentTarget, pointerId } = event;\n const { right, left } = currentTarget.getBoundingClientRect();\n const offset = isRtl ? event.clientX - left : right - event.clientX;\n\n if (offset > 11) {\n // +1px to account for the border size\n return;\n }\n\n function onPointerMove(event: PointerEvent) {\n const { right, left } = currentTarget.getBoundingClientRect();\n const width = isRtl ? right + offset - event.clientX : event.clientX + offset - left;\n if (width > 0) {\n onColumnResize(column, clampColumnWidth(width, column));\n }\n }\n\n function onLostPointerCapture() {\n currentTarget.removeEventListener('pointermove', onPointerMove);\n currentTarget.removeEventListener('lostpointercapture', onLostPointerCapture);\n }\n\n currentTarget.setPointerCapture(pointerId);\n currentTarget.addEventListener('pointermove', onPointerMove);\n currentTarget.addEventListener('lostpointercapture', onLostPointerCapture);\n }\n\n function onSort(ctrlClick: boolean) {\n if (onSortColumnsChange == null) return;\n const { sortDescendingFirst } = column;\n if (sortColumn === undefined) {\n // not currently sorted\n const nextSort: SortColumn = {\n columnKey: column.key,\n direction: sortDescendingFirst ? 'DESC' : 'ASC'\n };\n onSortColumnsChange(sortColumns && ctrlClick ? [...sortColumns, nextSort] : [nextSort]);\n } else {\n let nextSortColumn: SortColumn | undefined;\n if (\n (sortDescendingFirst && sortDirection === 'DESC') ||\n (!sortDescendingFirst && sortDirection === 'ASC')\n ) {\n nextSortColumn = {\n columnKey: column.key,\n direction: sortDirection === 'ASC' ? 'DESC' : 'ASC'\n };\n }\n if (ctrlClick) {\n const nextSortColumns = [...sortColumns!];\n if (nextSortColumn) {\n // swap direction\n nextSortColumns[sortIndex!] = nextSortColumn;\n } else {\n // remove sort\n nextSortColumns.splice(sortIndex!, 1);\n }\n onSortColumnsChange(nextSortColumns);\n } else {\n onSortColumnsChange(nextSortColumn ? [nextSortColumn] : []);\n }\n }\n }\n\n function onClick() {\n selectCell(column.idx);\n }\n\n function onDoubleClick(event: React.MouseEvent<HTMLDivElement>) {\n const { right, left } = event.currentTarget.getBoundingClientRect();\n const offset = isRtl ? event.clientX - left : right - event.clientX;\n\n if (offset > 11) {\n // +1px to account for the border size\n return;\n }\n\n onColumnResize(column, 'auto');\n }\n\n function handleFocus(event: React.FocusEvent<HTMLDivElement>) {\n onFocus?.(event);\n if (shouldFocusGrid) {\n // Select the first header cell if there is no selected cell\n selectCell(0);\n }\n }\n\n return (\n <div\n role=\"columnheader\"\n aria-colindex={column.idx + 1}\n aria-selected={isCellSelected}\n aria-sort={ariaSort}\n aria-colspan={colSpan}\n ref={ref}\n // set the tabIndex to 0 when there is no selected cell so grid can receive focus\n tabIndex={shouldFocusGrid ? 0 : tabIndex}\n className={className}\n style={{\n ...getCellStyle(column, colSpan),\n minWidth: column.minWidth,\n maxWidth: column.maxWidth ?? undefined\n }}\n onFocus={handleFocus}\n onClick={onClick}\n onDoubleClick={column.resizable ? onDoubleClick : undefined}\n onPointerDown={column.resizable ? onPointerDown : undefined}\n >\n <HeaderRenderer\n column={column}\n sortDirection={sortDirection}\n priority={priority}\n onSort={onSort}\n allRowsSelected={allRowsSelected}\n onAllRowsSelectionChange={onAllRowsSelectionChange}\n isCellSelected={isCellSelected}\n />\n </div>\n );\n}\n","import { memo } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport HeaderCell from './HeaderCell';\nimport type { CalculatedColumn, Direction } from './types';\nimport { getColSpan, getRowStyle } from './utils';\nimport type { DataGridProps } from './DataGrid';\nimport { cell, cellFrozen, rowSelectedClassname } from './style';\n\ntype SharedDataGridProps<R, SR, K extends React.Key> = Pick<\n DataGridProps<R, SR, K>,\n 'sortColumns' | 'onSortColumnsChange'\n>;\n\nexport interface HeaderRowProps<R, SR, K extends React.Key> extends SharedDataGridProps<R, SR, K> {\n columns: readonly CalculatedColumn<R, SR>[];\n allRowsSelected: boolean;\n onAllRowsSelectionChange: (checked: boolean) => void;\n onColumnResize: (column: CalculatedColumn<R, SR>, width: number | 'auto') => void;\n selectCell: (columnIdx: number) => void;\n lastFrozenColumnIndex: number;\n selectedCellIdx: number | undefined;\n shouldFocusGrid: boolean;\n direction: Direction;\n}\n\nconst headerRow = css`\n display: contents;\n line-height: var(--rdg-header-row-height);\n background-color: var(--rdg-header-background-color);\n font-weight: bold;\n\n > .${cell} {\n /* Should have a higher value than 1 to show up above frozen cells */\n z-index: 2;\n position: sticky;\n inset-block-start: 0;\n }\n\n > .${cellFrozen} {\n z-index: 3;\n }\n`;\n\nconst headerRowClassname = `rdg-header-row ${headerRow}`;\n\nfunction HeaderRow<R, SR, K extends React.Key>({\n columns,\n allRowsSelected,\n onAllRowsSelectionChange,\n onColumnResize,\n sortColumns,\n onSortColumnsChange,\n lastFrozenColumnIndex,\n selectedCellIdx,\n selectCell,\n shouldFocusGrid,\n direction\n}: HeaderRowProps<R, SR, K>) {\n const cells = [];\n for (let index = 0; index < columns.length; index++) {\n const column = columns[index];\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'HEADER' });\n if (colSpan !== undefined) {\n index += colSpan - 1;\n }\n\n cells.push(\n <HeaderCell<R, SR>\n key={column.key}\n column={column}\n colSpan={colSpan}\n isCellSelected={selectedCellIdx === column.idx}\n onColumnResize={onColumnResize}\n allRowsSelected={allRowsSelected}\n onAllRowsSelectionChange={onAllRowsSelectionChange}\n onSortColumnsChange={onSortColumnsChange}\n sortColumns={sortColumns}\n selectCell={selectCell}\n shouldFocusGrid={shouldFocusGrid && index === 0}\n direction={direction}\n />\n );\n }\n\n return (\n <div\n role=\"row\"\n aria-rowindex={1} // aria-rowindex is 1 based\n className={clsx(headerRowClassname, {\n [rowSelectedClassname]: selectedCellIdx === -1\n })}\n style={getRowStyle(1)}\n >\n {cells}\n </div>\n );\n}\n\nexport default memo(HeaderRow) as <R, SR, K extends React.Key>(\n props: HeaderRowProps<R, SR, K>\n) => JSX.Element;\n","import { memo } from 'react';\nimport { css } from '@linaria/core';\n\nimport { getCellStyle, getCellClassname, isCellEditable } from './utils';\nimport type { CellRendererProps } from './types';\nimport { useRovingCellRef } from './hooks';\n\nconst cellCopied = css`\n background-color: #ccccff;\n`;\n\nconst cellCopiedClassname = `rdg-cell-copied ${cellCopied}`;\n\nconst cellDraggedOver = css`\n background-color: #ccccff;\n\n &.${cellCopied} {\n background-color: #9999ff;\n }\n`;\n\nconst cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;\n\nfunction Cell<R, SR>({\n column,\n colSpan,\n isCellSelected,\n isCopied,\n isDraggedOver,\n row,\n dragHandle,\n onRowClick,\n onRowDoubleClick,\n onRowChange,\n selectCell,\n ...props\n}: CellRendererProps<R, SR>) {\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n\n const { cellClass } = column;\n const className = getCellClassname(\n column,\n {\n [cellCopiedClassname]: isCopied,\n [cellDraggedOverClassname]: isDraggedOver\n },\n typeof cellClass === 'function' ? cellClass(row) : cellClass\n );\n\n function selectCellWrapper(openEditor?: boolean | null) {\n selectCell(row, column, openEditor);\n }\n\n function handleClick() {\n selectCellWrapper(column.editorOptions?.editOnClick);\n onRowClick?.(row, column);\n }\n\n function handleContextMenu() {\n selectCellWrapper();\n }\n\n function handleDoubleClick() {\n selectCellWrapper(true);\n onRowDoubleClick?.(row, column);\n }\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1} // aria-colindex is 1-based\n aria-selected={isCellSelected}\n aria-colspan={colSpan}\n aria-readonly={!isCellEditable(column, row) || undefined}\n ref={ref}\n tabIndex={tabIndex}\n className={className}\n style={getCellStyle(column, colSpan)}\n onClick={handleClick}\n onDoubleClick={handleDoubleClick}\n onContextMenu={handleContextMenu}\n onFocus={onFocus}\n {...props}\n >\n {!column.rowGroup && (\n <>\n <column.formatter\n column={column}\n row={row}\n isCellSelected={isCellSelected}\n onRowChange={onRowChange}\n />\n {dragHandle}\n </>\n )}\n </div>\n );\n}\n\nexport default memo(Cell) as <R, SR>(props: CellRendererProps<R, SR>) => JSX.Element;\n","import { memo, forwardRef } from 'react';\nimport type { RefAttributes } from 'react';\nimport clsx from 'clsx';\n\nimport Cell from './Cell';\nimport { RowSelectionProvider, useLatestFunc } from './hooks';\nimport { getColSpan, getRowStyle } from './utils';\nimport { rowClassname, rowSelectedClassname } from './style';\nimport type { RowRendererProps } from './types';\n\nfunction Row<R, SR>(\n {\n className,\n rowIdx,\n gridRowStart,\n height,\n selectedCellIdx,\n isRowSelected,\n copiedCellIdx,\n draggedOverCellIdx,\n lastFrozenColumnIndex,\n row,\n viewportColumns,\n selectedCellEditor,\n selectedCellDragHandle,\n onRowClick,\n onRowDoubleClick,\n rowClass,\n setDraggedOverRowIdx,\n onMouseEnter,\n onRowChange,\n selectCell,\n ...props\n }: RowRendererProps<R, SR>,\n ref: React.Ref<HTMLDivElement>\n) {\n const handleRowChange = useLatestFunc((newRow: R) => {\n onRowChange(rowIdx, newRow);\n });\n\n function handleDragEnter(event: React.MouseEvent<HTMLDivElement>) {\n setDraggedOverRowIdx?.(rowIdx);\n onMouseEnter?.(event);\n }\n\n className = clsx(\n rowClassname,\n `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`,\n {\n [rowSelectedClassname]: selectedCellIdx === -1\n },\n rowClass?.(row),\n className\n );\n\n const cells = [];\n\n for (let index = 0; index < viewportColumns.length; index++) {\n const column = viewportColumns[index];\n const { idx } = column;\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row });\n if (colSpan !== undefined) {\n index += colSpan - 1;\n }\n\n const isCellSelected = selectedCellIdx === idx;\n\n if (isCellSelected && selectedCellEditor) {\n cells.push(selectedCellEditor);\n } else {\n cells.push(\n <Cell\n key={column.key}\n column={column}\n colSpan={colSpan}\n row={row}\n isCopied={copiedCellIdx === idx}\n isDraggedOver={draggedOverCellIdx === idx}\n isCellSelected={isCellSelected}\n dragHandle={isCellSelected ? selectedCellDragHandle : undefined}\n onRowClick={onRowClick}\n onRowDoubleClick={onRowDoubleClick}\n onRowChange={handleRowChange}\n selectCell={selectCell}\n />\n );\n }\n }\n\n return (\n <RowSelectionProvider value={isRowSelected}>\n <div\n role=\"row\"\n ref={ref}\n className={className}\n onMouseEnter={handleDragEnter}\n style={getRowStyle(gridRowStart, height)}\n {...props}\n >\n {cells}\n </div>\n </RowSelectionProvider>\n );\n}\n\nexport default memo(forwardRef(Row)) as <R, SR>(\n props: RowRendererProps<R, SR> & RefAttributes<HTMLDivElement>\n) => JSX.Element;\n","import { memo } from 'react';\n\nimport { getCellStyle, getCellClassname } from './utils';\nimport type { CalculatedColumn, GroupRow } from './types';\nimport type { GroupRowRendererProps } from './GroupRow';\nimport { useRovingCellRef } from './hooks';\n\ntype SharedGroupRowRendererProps<R, SR> = Pick<\n GroupRowRendererProps<R, SR>,\n 'id' | 'groupKey' | 'childRows' | 'isExpanded' | 'toggleGroup'\n>;\n\ninterface GroupCellProps<R, SR> extends SharedGroupRowRendererProps<R, SR> {\n column: CalculatedColumn<R, SR>;\n row: GroupRow<R>;\n isCellSelected: boolean;\n groupColumnIndex: number;\n}\n\nfunction GroupCell<R, SR>({\n id,\n groupKey,\n childRows,\n isExpanded,\n isCellSelected,\n column,\n row,\n groupColumnIndex,\n toggleGroup: toggleGroupWrapper\n}: GroupCellProps<R, SR>) {\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n\n function toggleGroup() {\n toggleGroupWrapper(id);\n }\n\n // Only make the cell clickable if the group level matches\n const isLevelMatching = column.rowGroup && groupColumnIndex === column.idx;\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1}\n aria-selected={isCellSelected}\n ref={ref}\n tabIndex={tabIndex}\n key={column.key}\n className={getCellClassname(column)}\n style={{\n ...getCellStyle(column),\n cursor: isLevelMatching ? 'pointer' : 'default'\n }}\n onClick={isLevelMatching ? toggleGroup : undefined}\n onFocus={onFocus}\n >\n {(!column.rowGroup || groupColumnIndex === column.idx) && column.groupFormatter && (\n <column.groupFormatter\n groupKey={groupKey}\n childRows={childRows}\n column={column}\n row={row}\n isExpanded={isExpanded}\n isCellSelected={isCellSelected}\n toggleGroup={toggleGroup}\n />\n )}\n </div>\n );\n}\n\nexport default memo(GroupCell) as <R, SR>(props: GroupCellProps<R, SR>) => JSX.Element;\n","import { memo } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport { cell, cellFrozenLast, rowClassname, rowSelectedClassname } from './style';\nimport { SELECT_COLUMN_KEY } from './Columns';\nimport GroupCell from './GroupCell';\nimport type { CalculatedColumn, GroupRow, Omit } from './types';\nimport { RowSelectionProvider } from './hooks';\nimport { getRowStyle } from './utils';\n\nexport interface GroupRowRendererProps<R, SR>\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'children'> {\n id: string;\n groupKey: unknown;\n viewportColumns: readonly CalculatedColumn<R, SR>[];\n childRows: readonly R[];\n rowIdx: number;\n row: GroupRow<R>;\n gridRowStart: number;\n height: number;\n level: number;\n selectedCellIdx: number | undefined;\n isExpanded: boolean;\n isRowSelected: boolean;\n selectGroup: (rowIdx: number) => void;\n toggleGroup: (expandedGroupId: unknown) => void;\n}\n\nconst groupRow = css`\n &:not([aria-selected='true']) {\n background-color: var(--rdg-header-background-color);\n }\n\n > .${cell}:not(:last-child):not(.${cellFrozenLast}) {\n border-inline-end: none;\n }\n`;\n\nconst groupRowClassname = `rdg-group-row ${groupRow}`;\n\nfunction GroupedRow<R, SR>({\n id,\n groupKey,\n viewportColumns,\n childRows,\n rowIdx,\n row,\n gridRowStart,\n height,\n level,\n isExpanded,\n selectedCellIdx,\n isRowSelected,\n selectGroup,\n toggleGroup,\n ...props\n}: GroupRowRendererProps<R, SR>) {\n // Select is always the first column\n const idx = viewportColumns[0].key === SELECT_COLUMN_KEY ? level + 1 : level;\n\n function handleSelectGroup() {\n selectGroup(rowIdx);\n }\n\n return (\n <RowSelectionProvider value={isRowSelected}>\n <div\n role=\"row\"\n aria-level={level}\n aria-expanded={isExpanded}\n className={clsx(\n rowClassname,\n groupRowClassname,\n `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`,\n {\n [rowSelectedClassname]: selectedCellIdx === -1\n }\n )}\n onClick={handleSelectGroup}\n style={getRowStyle(gridRowStart, height)}\n {...props}\n >\n {viewportColumns.map((column) => (\n <GroupCell\n key={column.key}\n id={id}\n groupKey={groupKey}\n childRows={childRows}\n isExpanded={isExpanded}\n isCellSelected={selectedCellIdx === column.idx}\n column={column}\n row={row}\n groupColumnIndex={idx}\n toggleGroup={toggleGroup}\n />\n ))}\n </div>\n </RowSelectionProvider>\n );\n}\n\nexport default memo(GroupedRow) as <R, SR>(props: GroupRowRendererProps<R, SR>) => JSX.Element;\n","import { memo } from 'react';\nimport { css } from '@linaria/core';\n\nimport { getCellStyle, getCellClassname } from './utils';\nimport type { CalculatedColumn, CellRendererProps } from './types';\nimport { useRovingCellRef } from './hooks';\n\nexport const summaryCellClassname = css`\n inset-block-start: var(--rdg-summary-row-top);\n inset-block-end: var(--rdg-summary-row-bottom);\n`;\n\ninterface SharedCellRendererProps<R, SR>\n extends Pick<CellRendererProps<R, SR>, 'column' | 'colSpan' | 'isCellSelected'> {\n selectCell: (row: SR, column: CalculatedColumn<R, SR>) => void;\n}\n\ninterface SummaryCellProps<R, SR> extends SharedCellRendererProps<R, SR> {\n row: SR;\n}\n\nfunction SummaryCell<R, SR>({\n column,\n colSpan,\n row,\n isCellSelected,\n selectCell\n}: SummaryCellProps<R, SR>) {\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n const { summaryFormatter: SummaryFormatter, summaryCellClass } = column;\n const className = getCellClassname(\n column,\n summaryCellClassname,\n typeof summaryCellClass === 'function' ? summaryCellClass(row) : summaryCellClass\n );\n\n function onClick() {\n selectCell(row, column);\n }\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1}\n aria-colspan={colSpan}\n aria-selected={isCellSelected}\n ref={ref}\n tabIndex={tabIndex}\n className={className}\n style={getCellStyle(column, colSpan)}\n onClick={onClick}\n onFocus={onFocus}\n >\n {SummaryFormatter && (\n <SummaryFormatter column={column} row={row} isCellSelected={isCellSelected} />\n )}\n </div>\n );\n}\n\nexport default memo(SummaryCell) as <R, SR>(props: SummaryCellProps<R, SR>) => JSX.Element;\n","import { memo } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport { cell, row, rowClassname, rowSelectedClassname } from './style';\nimport { getColSpan, getRowStyle } from './utils';\nimport SummaryCell from './SummaryCell';\nimport type { CalculatedColumn, RowRendererProps } from './types';\n\ntype SharedRowRendererProps<R, SR> = Pick<\n RowRendererProps<R, SR>,\n 'viewportColumns' | 'rowIdx' | 'gridRowStart'\n>;\n\ninterface SummaryRowProps<R, SR> extends SharedRowRendererProps<R, SR> {\n 'aria-rowindex': number;\n row: SR;\n top: number | undefined;\n bottom: number | undefined;\n lastFrozenColumnIndex: number;\n selectedCellIdx: number | undefined;\n selectCell: (row: SR, column: CalculatedColumn<R, SR>) => void;\n}\n\nconst summaryRow = css`\n &.${row} {\n line-height: var(--rdg-summary-row-height);\n > .${cell} {\n position: sticky;\n }\n }\n`;\n\nconst summaryRowBorderClassname = css`\n & > .${cell} {\n border-block-start: 2px solid var(--rdg-summary-border-color);\n }\n`;\n\nconst summaryRowClassname = `rdg-summary-row ${summaryRow}`;\n\nfunction SummaryRow<R, SR>({\n rowIdx,\n gridRowStart,\n row,\n viewportColumns,\n top,\n bottom,\n lastFrozenColumnIndex,\n selectedCellIdx,\n selectCell,\n 'aria-rowindex': ariaRowIndex\n}: SummaryRowProps<R, SR>) {\n const cells = [];\n for (let index = 0; index < viewportColumns.length; index++) {\n const column = viewportColumns[index];\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'SUMMARY', row });\n if (colSpan !== undefined) {\n index += colSpan - 1;\n }\n\n const isCellSelected = selectedCellIdx === column.idx;\n\n cells.push(\n <SummaryCell<R, SR>\n key={column.key}\n column={column}\n colSpan={colSpan}\n row={row}\n isCellSelected={isCellSelected}\n selectCell={selectCell}\n />\n );\n }\n\n return (\n <div\n role=\"row\"\n aria-rowindex={ariaRowIndex}\n className={clsx(\n rowClassname,\n `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`,\n summaryRowClassname,\n {\n [summaryRowBorderClassname]: rowIdx === 0,\n [rowSelectedClassname]: selectedCellIdx === -1\n }\n )}\n style={\n {\n ...getRowStyle(gridRowStart),\n '--rdg-summary-row-top': top !== undefined ? `${top}px` : undefined,\n '--rdg-summary-row-bottom': bottom !== undefined ? `${bottom}px` : undefined\n } as unknown as React.CSSProperties\n }\n >\n {cells}\n </div>\n );\n}\n\nexport default memo(SummaryRow) as <R, SR>(props: SummaryRowProps<R, SR>) => JSX.Element;\n","import { useEffect, useRef } from 'react';\nimport { css } from '@linaria/core';\n\nimport { useLatestFunc } from './hooks';\nimport { getCellStyle, getCellClassname, onEditorNavigation } from './utils';\nimport type { CellRendererProps, EditorProps, Omit } from './types';\n\n/*\n * To check for outside `mousedown` events, we listen to all `mousedown` events at their birth,\n * i.e. on the window during the capture phase, and at their death, i.e. on the window during the bubble phase.\n *\n * We schedule a check at the birth of the event, cancel the check when the event reaches the \"inside\" container,\n * and trigger the \"outside\" callback when the event bubbles back up to the window.\n *\n * The event can be `stopPropagation()`ed halfway through, so they may not always bubble back up to the window,\n * so an alternative check must be used. The check must happen after the event can reach the \"inside\" container,\n * and not before it run to completion. `requestAnimationFrame` is the best way we know how to achieve this.\n * Usually we want click event handlers from parent components to access the latest commited values,\n * so `mousedown` is used instead of `click`.\n *\n * We must also rely on React's event capturing/bubbling to handle elements rendered in a portal.\n */\n\nconst cellEditing = css`\n &.rdg-cell {\n padding: 0;\n }\n`;\n\ntype SharedCellRendererProps<R, SR> = Pick<CellRendererProps<R, SR>, 'colSpan'>;\n\ninterface EditCellProps<R, SR>\n extends Omit<EditorProps<R, SR>, 'onClose'>,\n SharedCellRendererProps<R, SR> {\n closeEditor: () => void;\n scrollToCell: () => void;\n}\n\nexport default function EditCell<R, SR>({\n column,\n colSpan,\n row,\n onRowChange,\n closeEditor,\n scrollToCell\n}: EditCellProps<R, SR>) {\n const frameRequestRef = useRef<number | undefined>();\n const commitOnOutsideClick = column.editorOptions?.commitOnOutsideClick !== false;\n\n // We need to prevent the `useEffect` from cleaning up between re-renders,\n // as `onWindowCaptureMouseDown` might otherwise miss valid mousedown events.\n // To that end we instead access the latest props via useLatestFunc.\n const commitOnOutsideMouseDown = useLatestFunc(() => {\n onClose(true);\n });\n\n useEffect(() => {\n if (!commitOnOutsideClick) return;\n\n function onWindowCaptureMouseDown() {\n frameRequestRef.current = requestAnimationFrame(commitOnOutsideMouseDown);\n }\n\n addEventListener('mousedown', onWindowCaptureMouseDown, { capture: true });\n\n return () => {\n removeEventListener('mousedown', onWindowCaptureMouseDown, { capture: true });\n cancelFrameRequest();\n };\n }, [commitOnOutsideClick, commitOnOutsideMouseDown]);\n\n function cancelFrameRequest() {\n cancelAnimationFrame(frameRequestRef.current!);\n }\n\n function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (event.key === 'Escape') {\n event.stopPropagation();\n // Discard changes\n onClose();\n } else if (event.key === 'Enter') {\n event.stopPropagation();\n onClose(true);\n scrollToCell();\n } else {\n const onNavigation = column.editorOptions?.onNavigation ?? onEditorNavigation;\n if (!onNavigation(event)) {\n event.stopPropagation();\n }\n }\n }\n\n function onClose(commitChanges?: boolean) {\n if (commitChanges) {\n onRowChange(row, true);\n } else {\n closeEditor();\n }\n }\n\n const { cellClass } = column;\n const className = getCellClassname(\n column,\n 'rdg-editor-container',\n !column.editorOptions?.renderFormatter && cellEditing,\n typeof cellClass === 'function' ? cellClass(row) : cellClass\n );\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1} // aria-colindex is 1-based\n aria-colspan={colSpan}\n aria-selected\n className={className}\n style={getCellStyle(column, colSpan)}\n onKeyDown={onKeyDown}\n onMouseDownCapture={commitOnOutsideClick ? cancelFrameRequest : undefined}\n >\n {column.editor != null && (\n <>\n <column.editor column={column} row={row} onRowChange={onRowChange} onClose={onClose} />\n {column.editorOptions?.renderFormatter && (\n <column.formatter column={column} row={row} isCellSelected onRowChange={onRowChange} />\n )}\n </>\n )}\n </div>\n );\n}\n","import { css } from '@linaria/core';\n\nimport type { CalculatedColumn, FillEvent, Position } from './types';\nimport type { DataGridProps, SelectCellState } from './DataGrid';\n\nconst cellDragHandle = css`\n cursor: move;\n position: absolute;\n inset-inline-end: 0;\n inset-block-end: 0;\n inline-size: 8px;\n block-size: 8px;\n background-color: var(--rdg-selection-color);\n\n &:hover {\n inline-size: 16px;\n block-size: 16px;\n border: 2px solid var(--rdg-selection-color);\n background-color: var(--rdg-background-color);\n }\n`;\n\nconst cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;\n\ninterface Props<R, SR> extends Pick<DataGridProps<R, SR>, 'rows' | 'onRowsChange'> {\n columns: readonly CalculatedColumn<R, SR>[];\n selectedPosition: SelectCellState;\n latestDraggedOverRowIdx: React.MutableRefObject<number | undefined>;\n isCellEditable: (position: Position) => boolean;\n onFill: (event: FillEvent<R>) => R;\n setDragging: (isDragging: boolean) => void;\n setDraggedOverRowIdx: (overRowIdx: number | undefined) => void;\n}\n\nexport default function DragHandle<R, SR>({\n rows,\n columns,\n selectedPosition,\n latestDraggedOverRowIdx,\n isCellEditable,\n onRowsChange,\n onFill,\n setDragging,\n setDraggedOverRowIdx\n}: Props<R, SR>) {\n function handleMouseDown(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (event.buttons !== 1) return;\n setDragging(true);\n window.addEventListener('mouseover', onMouseOver);\n window.addEventListener('mouseup', onMouseUp);\n\n function onMouseOver(event: MouseEvent) {\n // Trigger onMouseup in edge cases where we release the mouse button but `mouseup` isn't triggered,\n // for example when releasing the mouse button outside the iframe the grid is rendered in.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n if (event.buttons !== 1) onMouseUp();\n }\n\n function onMouseUp() {\n window.removeEventListener('mouseover', onMouseOver);\n window.removeEventListener('mouseup', onMouseUp);\n setDragging(false);\n handleDragEnd();\n }\n }\n\n function handleDragEnd() {\n const overRowIdx = latestDraggedOverRowIdx.current;\n if (overRowIdx === undefined) return;\n\n const { rowIdx } = selectedPosition;\n const startRowIndex = rowIdx < overRowIdx ? rowIdx + 1 : overRowIdx;\n const endRowIndex = rowIdx < overRowIdx ? overRowIdx + 1 : rowIdx;\n updateRows(startRowIndex, endRowIndex);\n setDraggedOverRowIdx(undefined);\n }\n\n function handleDoubleClick(event: React.MouseEvent<HTMLDivElement>) {\n event.stopPropagation();\n updateRows(selectedPosition.rowIdx + 1, rows.length);\n }\n\n function updateRows(startRowIdx: number, endRowIdx: number) {\n const { idx, rowIdx } = selectedPosition;\n const column = columns[idx];\n const sourceRow = rows[rowIdx];\n const updatedRows = [...rows];\n const indexes: number[] = [];\n for (let i = startRowIdx; i < endRowIdx; i++) {\n if (isCellEditable({ rowIdx: i, idx })) {\n const updatedRow = onFill({ columnKey: column.key, sourceRow, targetRow: rows[i] });\n if (updatedRow !== rows[i]) {\n updatedRows[i] = updatedRow;\n indexes.push(i);\n }\n }\n }\n\n if (indexes.length > 0) {\n onRowsChange?.(updatedRows, { indexes, column });\n }\n }\n\n return (\n <div\n className={cellDragHandleClassname}\n onMouseDown={handleMouseDown}\n onDoubleClick={handleDoubleClick}\n />\n );\n}\n","import { css } from '@linaria/core';\nimport type { SortIconProps } from './types';\n\nconst arrow = css`\n fill: currentColor;\n\n > path {\n transition: d 0.1s;\n }\n`;\n\nconst arrowClassname = `rdg-sort-arrow ${arrow}`;\n\nexport default function SortIcon({ sortDirection }: SortIconProps) {\n return sortDirection !== undefined ? (\n <svg viewBox=\"0 0 12 8\" width=\"12\" height=\"8\" className={arrowClassname} aria-hidden>\n <path d={sortDirection === 'ASC' ? 'M0 8 6 0 12 8' : 'M0 0 6 8 12 0'} />\n </svg>\n ) : null;\n}\n","import { forwardRef, useState, useRef, useImperativeHandle, useCallback, useMemo } from 'react';\nimport type { Key, RefAttributes } from 'react';\nimport clsx from 'clsx';\n\nimport {\n rootClassname,\n viewportDraggingClassname,\n focusSinkClassname,\n cellAutoResizeClassname,\n rowSelected,\n rowSelectedWithFrozenCell\n} from './style';\nimport {\n useLayoutEffect,\n useGridDimensions,\n useCalculatedColumns,\n useViewportColumns,\n useViewportRows,\n useLatestFunc,\n RowSelectionChangeProvider\n} from './hooks';\nimport HeaderRow from './HeaderRow';\nimport Row from './Row';\nimport GroupRowRenderer from './GroupRow';\nimport SummaryRow from './SummaryRow';\nimport EditCell from './EditCell';\nimport DragHandle from './DragHandle';\nimport SortIcon from './SortIcon';\nimport { CheckboxFormatter } from './formatters';\nimport {\n DataGridDefaultComponentsProvider,\n useDefaultComponents\n} from './DataGridDefaultComponentsProvider';\nimport {\n assertIsValidKeyGetter,\n getNextSelectedCellPosition,\n isSelectedCellEditable,\n canExitGrid,\n isCtrlKeyHeldDown,\n isDefaultCellInput,\n getColSpan,\n sign,\n abs,\n getSelectedCellColSpan\n} from './utils';\n\nimport type {\n CalculatedColumn,\n Column,\n Position,\n RowsChangeData,\n SelectRowEvent,\n FillEvent,\n CopyEvent,\n PasteEvent,\n CellNavigationMode,\n SortColumn,\n RowHeightArgs,\n Maybe,\n Components,\n Direction\n} from './types';\n\nexport interface SelectCellState extends Position {\n readonly mode: 'SELECT';\n}\n\ninterface EditCellState<R> extends Position {\n readonly mode: 'EDIT';\n readonly row: R;\n readonly originalRow: R;\n}\n\ntype DefaultColumnOptions<R, SR> = Pick<\n Column<R, SR>,\n 'formatter' | 'width' | 'minWidth' | 'maxWidth' | 'resizable' | 'sortable'\n>;\n\nconst initialPosition: SelectCellState = {\n idx: -1,\n rowIdx: -2,\n mode: 'SELECT'\n};\n\nexport interface DataGridHandle {\n element: HTMLDivElement | null;\n scrollToColumn: (colIdx: number) => void;\n scrollToRow: (rowIdx: number) => void;\n selectCell: (position: Position, enableEditor?: Maybe<boolean>) => void;\n}\n\ntype SharedDivProps = Pick<\n React.HTMLAttributes<HTMLDivElement>,\n 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'className' | 'style'\n>;\n\nexport interface DataGridProps<R, SR = unknown, K extends Key = Key> extends SharedDivProps {\n /**\n * Grid and data Props\n */\n /** An array of objects representing each column on the grid */\n columns: readonly Column<R, SR>[];\n /** A function called for each rendered row that should return a plain key/value pair object */\n rows: readonly R[];\n /**\n * Rows to be pinned at the bottom of the rows view for summary, the vertical scroll bar will not scroll these rows.\n * Bottom horizontal scroll bar can move the row left / right. Or a customized row renderer can be used to disabled the scrolling support.\n */\n summaryRows?: Maybe<readonly SR[]>;\n /** The getter should return a unique key for each row */\n rowKeyGetter?: Maybe<(row: R) => K>;\n onRowsChange?: Maybe<(rows: R[], data: RowsChangeData<R, SR>) => void>;\n\n /**\n * Dimensions props\n */\n /**\n * The height of each row in pixels\n * @default 35\n */\n rowHeight?: Maybe<number | ((args: RowHeightArgs<R>) => number)>;\n /**\n * The height of the header row in pixels\n * @default 35\n */\n headerRowHeight?: Maybe<number>;\n /**\n * The height of each summary row in pixels\n * @default 35\n */\n summaryRowHeight?: Maybe<number>;\n\n /**\n * Feature props\n */\n /** Set of selected row keys */\n selectedRows?: Maybe<ReadonlySet<K>>;\n /** Function called whenever row selection is changed */\n onSelectedRowsChange?: Maybe<(selectedRows: Set<K>) => void>;\n /** Used for multi column sorting */\n sortColumns?: Maybe<readonly SortColumn[]>;\n onSortColumnsChange?: Maybe<(sortColumns: SortColumn[]) => void>;\n defaultColumnOptions?: Maybe<DefaultColumnOptions<R, SR>>;\n groupBy?: Maybe<readonly string[]>;\n rowGrouper?: Maybe<(rows: readonly R[], columnKey: string) => Record<string, readonly R[]>>;\n expandedGroupIds?: Maybe<ReadonlySet<unknown>>;\n onExpandedGroupIdsChange?: Maybe<(expandedGroupIds: Set<unknown>) => void>;\n onFill?: Maybe<(event: FillEvent<R>) => R>;\n onCopy?: Maybe<(event: CopyEvent<R>) => void>;\n onPaste?: Maybe<(event: PasteEvent<R>) => R>;\n\n /**\n * Event props\n */\n /** Function called whenever a row is clicked */\n onRowClick?: Maybe<(row: R, column: CalculatedColumn<R, SR>) => void>;\n /** Function called whenever a row is double clicked */\n onRowDoubleClick?: Maybe<(row: R, column: CalculatedColumn<R, SR>) => void>;\n /** Called when the grid is scrolled */\n onScroll?: Maybe<(event: React.UIEvent<HTMLDivElement>) => void>;\n /** Called when a column is resized */\n onColumnResize?: Maybe<(idx: number, width: number) => void>;\n\n /**\n * Toggles and modes\n */\n /** @default 'NONE' */\n cellNavigationMode?: Maybe<CellNavigationMode>;\n /** @default true */\n enableVirtualization?: Maybe<boolean>;\n\n /**\n * Miscellaneous\n */\n components?: Maybe<Components<R, SR>>;\n rowClass?: Maybe<(row: R) => Maybe<string>>;\n direction?: Maybe<Direction>;\n 'data-testid'?: Maybe<string>;\n}\n\n/**\n * Main API Component to render a data grid of rows and columns\n *\n * @example\n *\n * <DataGrid columns={columns} rows={rows} />\n */\nfunction DataGrid<R, SR, K extends Key>(\n {\n // Grid and data Props\n columns: rawColumns,\n rows: rawRows,\n summaryRows,\n rowKeyGetter,\n onRowsChange,\n // Dimensions props\n rowHeight,\n headerRowHeight: rawHeaderRowHeight,\n summaryRowHeight: rawSummaryRowHeight,\n // Feature props\n selectedRows,\n onSelectedRowsChange,\n sortColumns,\n onSortColumnsChange,\n defaultColumnOptions,\n groupBy: rawGroupBy,\n rowGrouper,\n expandedGroupIds,\n onExpandedGroupIdsChange,\n // Event props\n onRowClick,\n onRowDoubleClick,\n onScroll,\n onColumnResize,\n onFill,\n onCopy,\n onPaste,\n // Toggles and modes\n cellNavigationMode: rawCellNavigationMode,\n enableVirtualization,\n // Miscellaneous\n components,\n className,\n style,\n rowClass,\n direction,\n // ARIA\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'data-testid': testId\n }: DataGridProps<R, SR, K>,\n ref: React.Ref<DataGridHandle>\n) {\n /**\n * defaults\n */\n const defaultComponents = useDefaultComponents<R, SR>();\n rowHeight ??= 35;\n const headerRowHeight = rawHeaderRowHeight ?? (typeof rowHeight === 'number' ? rowHeight : 35);\n const summaryRowHeight = rawSummaryRowHeight ?? (typeof rowHeight === 'number' ? rowHeight : 35);\n const RowRenderer = components?.rowRenderer ?? defaultComponents?.rowRenderer ?? Row;\n const sortIcon = components?.sortIcon ?? defaultComponents?.sortIcon ?? SortIcon;\n const checkboxFormatter =\n components?.checkboxFormatter ?? defaultComponents?.checkboxFormatter ?? CheckboxFormatter;\n const noRowsFallback = components?.noRowsFallback ?? defaultComponents?.noRowsFallback;\n const cellNavigationMode = rawCellNavigationMode ?? 'NONE';\n enableVirtualization ??= true;\n direction ??= 'ltr';\n\n /**\n * states\n */\n const [scrollTop, setScrollTop] = useState(0);\n const [scrollLeft, setScrollLeft] = useState(0);\n const [columnWidths, setColumnWidths] = useState<ReadonlyMap<string, number>>(() => new Map());\n const [selectedPosition, setSelectedPosition] = useState<SelectCellState | EditCellState<R>>(\n initialPosition\n );\n const [copiedCell, setCopiedCell] = useState<{ row: R; columnKey: string } | null>(null);\n const [isDragging, setDragging] = useState(false);\n const [draggedOverRowIdx, setOverRowIdx] = useState<number | undefined>(undefined);\n const [autoResizeColumn, setAutoResizeColumn] = useState<CalculatedColumn<R, SR> | null>(null);\n\n /**\n * refs\n */\n const prevSelectedPosition = useRef(selectedPosition);\n const latestDraggedOverRowIdx = useRef(draggedOverRowIdx);\n const lastSelectedRowIdx = useRef(-1);\n const rowRef = useRef<HTMLDivElement>(null);\n\n /**\n * computed values\n */\n const [gridRef, gridWidth, gridHeight] = useGridDimensions();\n const headerRowsCount = 1;\n const summaryRowsCount = summaryRows?.length ?? 0;\n const clientHeight = gridHeight - headerRowHeight - summaryRowsCount * summaryRowHeight;\n const isSelectable = selectedRows != null && onSelectedRowsChange != null;\n const isHeaderRowSelected = selectedPosition.rowIdx === -1;\n const isRtl = direction === 'rtl';\n const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';\n const rightKey = isRtl ? 'ArrowLeft' : 'ArrowRight';\n\n const defaultGridComponents = useMemo(\n () => ({\n sortIcon,\n checkboxFormatter\n }),\n [sortIcon, checkboxFormatter]\n );\n\n const allRowsSelected = useMemo((): boolean => {\n // no rows to select = explicitely unchecked\n const { length } = rawRows;\n return (\n length !== 0 &&\n selectedRows != null &&\n rowKeyGetter != null &&\n selectedRows.size >= length &&\n rawRows.every((row) => selectedRows.has(rowKeyGetter(row)))\n );\n }, [rawRows, selectedRows, rowKeyGetter]);\n\n const {\n columns,\n colSpanColumns,\n colOverscanStartIdx,\n colOverscanEndIdx,\n layoutCssVars,\n columnMetrics,\n lastFrozenColumnIndex,\n totalFrozenColumnWidth,\n groupBy\n } = useCalculatedColumns({\n rawColumns,\n columnWidths,\n scrollLeft,\n viewportWidth: gridWidth,\n defaultColumnOptions,\n rawGroupBy: rowGrouper ? rawGroupBy : undefined,\n enableVirtualization\n });\n\n const {\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n rowsCount,\n totalRowHeight,\n gridTemplateRows,\n isGroupRow,\n getRowTop,\n getRowHeight,\n findRowIdx\n } = useViewportRows({\n rawRows,\n groupBy,\n rowGrouper,\n rowHeight,\n clientHeight,\n scrollTop,\n expandedGroupIds,\n enableVirtualization\n });\n\n const viewportColumns = useViewportColumns({\n columns,\n colSpanColumns,\n colOverscanStartIdx,\n colOverscanEndIdx,\n lastFrozenColumnIndex,\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n summaryRows,\n isGroupRow\n });\n\n const hasGroups = groupBy.length > 0 && typeof rowGrouper === 'function';\n const minColIdx = hasGroups ? -1 : 0;\n const maxColIdx = columns.length - 1;\n const minRowIdx = -1; // change it to 0?\n const maxRowIdx = headerRowsCount + rows.length + summaryRowsCount - 2;\n const selectedCellIsWithinSelectionBounds = isCellWithinSelectionBounds(selectedPosition);\n const selectedCellIsWithinViewportBounds = isCellWithinViewportBounds(selectedPosition);\n\n /**\n * The identity of the wrapper function is stable so it won't break memoization\n */\n const selectRowLatest = useLatestFunc(selectRow);\n const selectAllRowsLatest = useLatestFunc(selectAllRows);\n const handleFormatterRowChangeLatest = useLatestFunc(updateRow);\n const selectViewportCellLatest = useLatestFunc(\n (row: R, column: CalculatedColumn<R, SR>, enableEditor: Maybe<boolean>) => {\n const rowIdx = rows.indexOf(row);\n selectCell({ rowIdx, idx: column.idx }, enableEditor);\n }\n );\n const selectGroupLatest = useLatestFunc((rowIdx: number) => {\n selectCell({ rowIdx, idx: -1 });\n });\n const selectHeaderCellLatest = useLatestFunc((idx: number) => {\n selectCell({ rowIdx: -1, idx });\n });\n const selectSummaryCellLatest = useLatestFunc(\n (summaryRow: SR, column: CalculatedColumn<R, SR>) => {\n const rowIdx = summaryRows!.indexOf(summaryRow) + headerRowsCount + rows.length - 1;\n selectCell({ rowIdx, idx: column.idx });\n }\n );\n const toggleGroupLatest = useLatestFunc(toggleGroup);\n\n /**\n * effects\n */\n useLayoutEffect(() => {\n if (\n !selectedCellIsWithinSelectionBounds ||\n isSamePosition(selectedPosition, prevSelectedPosition.current)\n ) {\n prevSelectedPosition.current = selectedPosition;\n return;\n }\n\n prevSelectedPosition.current = selectedPosition;\n scrollToCell(selectedPosition);\n\n if (selectedPosition.idx === -1) {\n rowRef.current!.focus({ preventScroll: true });\n }\n });\n\n useLayoutEffect(() => {\n if (autoResizeColumn === null) return;\n const columnElement = gridRef.current!.querySelector(\n `[aria-colindex=\"${autoResizeColumn.idx + 1}\"]`\n )!;\n const { width } = columnElement.getBoundingClientRect();\n setColumnWidths((columnWidths) => {\n const newColumnWidths = new Map(columnWidths);\n newColumnWidths.set(autoResizeColumn.key, width);\n return newColumnWidths;\n });\n setAutoResizeColumn(null);\n onColumnResize?.(autoResizeColumn.idx, width);\n }, [autoResizeColumn, gridRef, onColumnResize]);\n\n useImperativeHandle(ref, () => ({\n element: gridRef.current,\n scrollToColumn(idx: number) {\n scrollToCell({ idx });\n },\n scrollToRow(rowIdx: number) {\n const { current } = gridRef;\n if (!current) return;\n current.scrollTo({\n top: getRowTop(rowIdx),\n behavior: 'smooth'\n });\n },\n selectCell\n }));\n\n /**\n * callbacks\n */\n const handleColumnResize = useCallback(\n (column: CalculatedColumn<R, SR>, width: number | 'auto') => {\n if (width === 'auto') {\n setAutoResizeColumn(column);\n return;\n }\n setColumnWidths((columnWidths) => {\n const newColumnWidths = new Map(columnWidths);\n newColumnWidths.set(column.key, width);\n return newColumnWidths;\n });\n\n onColumnResize?.(column.idx, width);\n },\n [onColumnResize]\n );\n\n const setDraggedOverRowIdx = useCallback((rowIdx?: number) => {\n setOverRowIdx(rowIdx);\n latestDraggedOverRowIdx.current = rowIdx;\n }, []);\n\n /**\n * event handlers\n */\n function selectRow({ row, checked, isShiftClick }: SelectRowEvent<R>) {\n if (!onSelectedRowsChange) return;\n\n assertIsValidKeyGetter<R, K>(rowKeyGetter);\n const newSelectedRows = new Set(selectedRows);\n if (isGroupRow(row)) {\n for (const childRow of row.childRows) {\n const rowKey = rowKeyGetter(childRow);\n if (checked) {\n newSelectedRows.add(rowKey);\n } else {\n newSelectedRows.delete(rowKey);\n }\n }\n onSelectedRowsChange(newSelectedRows);\n return;\n }\n\n const rowKey = rowKeyGetter(row);\n if (checked) {\n newSelectedRows.add(rowKey);\n const previousRowIdx = lastSelectedRowIdx.current;\n const rowIdx = rows.indexOf(row);\n lastSelectedRowIdx.current = rowIdx;\n if (isShiftClick && previousRowIdx !== -1 && previousRowIdx !== rowIdx) {\n const step = sign(rowIdx - previousRowIdx);\n for (let i = previousRowIdx + step; i !== rowIdx; i += step) {\n const row = rows[i];\n if (isGroupRow(row)) continue;\n newSelectedRows.add(rowKeyGetter(row));\n }\n }\n } else {\n newSelectedRows.delete(rowKey);\n lastSelectedRowIdx.current = -1;\n }\n\n onSelectedRowsChange(newSelectedRows);\n }\n\n function selectAllRows(checked: boolean) {\n if (!onSelectedRowsChange) return;\n\n assertIsValidKeyGetter<R, K>(rowKeyGetter);\n const newSelectedRows = new Set(selectedRows);\n\n for (const row of rawRows) {\n const rowKey = rowKeyGetter(row);\n if (checked) {\n newSelectedRows.add(rowKey);\n } else {\n newSelectedRows.delete(rowKey);\n }\n }\n\n onSelectedRowsChange(newSelectedRows);\n }\n\n function toggleGroup(expandedGroupId: unknown) {\n if (!onExpandedGroupIdsChange) return;\n const newExpandedGroupIds = new Set(expandedGroupIds);\n if (newExpandedGroupIds.has(expandedGroupId)) {\n newExpandedGroupIds.delete(expandedGroupId);\n } else {\n newExpandedGroupIds.add(expandedGroupId);\n }\n onExpandedGroupIdsChange(newExpandedGroupIds);\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (!(event.target instanceof Element)) return;\n const isCellEvent = event.target.closest('.rdg-cell') !== null;\n const isRowEvent = hasGroups && event.target === rowRef.current;\n if (!isCellEvent && !isRowEvent) return;\n\n const { key, keyCode } = event;\n const { rowIdx } = selectedPosition;\n\n if (\n selectedCellIsWithinViewportBounds &&\n (onPaste != null || onCopy != null) &&\n isCtrlKeyHeldDown(event) &&\n !isGroupRow(rows[rowIdx]) &&\n selectedPosition.mode === 'SELECT'\n ) {\n // event.key may differ by keyboard input language, so we use event.keyCode instead\n // event.nativeEvent.code cannot be used either as it would break copy/paste for the DVORAK layout\n const cKey = 67;\n const vKey = 86;\n if (keyCode === cKey) {\n handleCopy();\n return;\n }\n if (keyCode === vKey) {\n handlePaste();\n return;\n }\n }\n\n if (isRowIdxWithinViewportBounds(rowIdx)) {\n const row = rows[rowIdx];\n\n if (\n isGroupRow(row) &&\n selectedPosition.idx === -1 &&\n // Collapse the current group row if it is focused and is in expanded state\n ((key === leftKey && row.isExpanded) ||\n // Expand the current group row if it is focused and is in collapsed state\n (key === rightKey && !row.isExpanded))\n ) {\n event.preventDefault(); // Prevents scrolling\n toggleGroup(row.id);\n return;\n }\n }\n\n switch (event.key) {\n case 'Escape':\n setCopiedCell(null);\n return;\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Tab':\n case 'Home':\n case 'End':\n case 'PageUp':\n case 'PageDown':\n navigate(event);\n break;\n default:\n handleCellInput(event);\n break;\n }\n }\n\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n const { scrollTop, scrollLeft } = event.currentTarget;\n setScrollTop(scrollTop);\n // scrollLeft is nagative when direction is rtl\n setScrollLeft(abs(scrollLeft));\n onScroll?.(event);\n }\n\n function getRawRowIdx(rowIdx: number) {\n return hasGroups ? rawRows.indexOf(rows[rowIdx] as R) : rowIdx;\n }\n\n function updateRow(rowIdx: number, row: R) {\n if (typeof onRowsChange !== 'function') return;\n const rawRowIdx = getRawRowIdx(rowIdx);\n if (row === rawRows[rawRowIdx]) return;\n const updatedRows = [...rawRows];\n updatedRows[rawRowIdx] = row;\n onRowsChange(updatedRows, {\n indexes: [rawRowIdx],\n column: columns[selectedPosition.idx]\n });\n }\n\n function commitEditorChanges() {\n if (selectedPosition.mode !== 'EDIT') return;\n updateRow(selectedPosition.rowIdx, selectedPosition.row);\n }\n\n function handleCopy() {\n const { idx, rowIdx } = selectedPosition;\n const sourceRow = rawRows[getRawRowIdx(rowIdx)];\n const sourceColumnKey = columns[idx].key;\n setCopiedCell({ row: sourceRow, columnKey: sourceColumnKey });\n onCopy?.({ sourceRow, sourceColumnKey });\n }\n\n function handlePaste() {\n if (!onPaste || !onRowsChange || copiedCell === null || !isCellEditable(selectedPosition)) {\n return;\n }\n\n const { idx, rowIdx } = selectedPosition;\n const targetRow = rawRows[getRawRowIdx(rowIdx)];\n\n const updatedTargetRow = onPaste({\n sourceRow: copiedCell.row,\n sourceColumnKey: copiedCell.columnKey,\n targetRow,\n targetColumnKey: columns[idx].key\n });\n\n updateRow(rowIdx, updatedTargetRow);\n }\n\n function handleCellInput(event: React.KeyboardEvent<HTMLDivElement>) {\n if (!selectedCellIsWithinViewportBounds) return;\n const row = rows[selectedPosition.rowIdx];\n if (isGroupRow(row)) return;\n const { key, shiftKey } = event;\n\n // Select the row on Shift + Space\n if (isSelectable && shiftKey && key === ' ') {\n assertIsValidKeyGetter<R, K>(rowKeyGetter);\n const rowKey = rowKeyGetter(row);\n selectRow({ row, checked: !selectedRows.has(rowKey), isShiftClick: false });\n // do not scroll\n event.preventDefault();\n return;\n }\n\n const column = columns[selectedPosition.idx];\n column.editorOptions?.onCellKeyDown?.(event);\n if (event.isDefaultPrevented()) return;\n\n if (isCellEditable(selectedPosition) && isDefaultCellInput(event)) {\n setSelectedPosition(({ idx, rowIdx }) => ({\n idx,\n rowIdx,\n mode: 'EDIT',\n row,\n originalRow: row\n }));\n }\n }\n\n /**\n * utils\n */\n function isColIdxWithinSelectionBounds(idx: number) {\n return idx >= minColIdx && idx <= maxColIdx;\n }\n\n function isRowIdxWithinViewportBounds(rowIdx: number) {\n return rowIdx >= 0 && rowIdx < rows.length;\n }\n\n function isCellWithinSelectionBounds({ idx, rowIdx }: Position): boolean {\n return rowIdx >= minRowIdx && rowIdx <= maxRowIdx && isColIdxWithinSelectionBounds(idx);\n }\n\n function isCellWithinViewportBounds({ idx, rowIdx }: Position): boolean {\n return isRowIdxWithinViewportBounds(rowIdx) && isColIdxWithinSelectionBounds(idx);\n }\n\n function isCellEditable(position: Position): boolean {\n return (\n isCellWithinViewportBounds(position) &&\n isSelectedCellEditable({ columns, rows, selectedPosition: position, isGroupRow })\n );\n }\n\n function selectCell(position: Position, enableEditor?: Maybe<boolean>): void {\n if (!isCellWithinSelectionBounds(position)) return;\n commitEditorChanges();\n\n if (enableEditor && isCellEditable(position)) {\n const row = rows[position.rowIdx] as R;\n setSelectedPosition({ ...position, mode: 'EDIT', row, originalRow: row });\n } else if (isSamePosition(selectedPosition, position)) {\n // Avoid re-renders if the selected cell state is the same\n // TODO: replace with a #record? https://github.com/microsoft/TypeScript/issues/39831\n scrollToCell(position);\n } else {\n setSelectedPosition({ ...position, mode: 'SELECT' });\n }\n }\n\n function scrollToCell({ idx, rowIdx }: Partial<Position>): void {\n const { current } = gridRef;\n if (!current) return;\n\n if (typeof idx === 'number' && idx > lastFrozenColumnIndex) {\n rowIdx ??= selectedPosition.rowIdx;\n if (!isCellWithinSelectionBounds({ rowIdx, idx })) return;\n const { clientWidth } = current;\n const column = columns[idx];\n const { left, width } = columnMetrics.get(column)!;\n let right = left + width;\n\n const colSpan = getSelectedCellColSpan({\n rows,\n summaryRows,\n rowIdx,\n lastFrozenColumnIndex,\n column,\n isGroupRow\n });\n\n if (colSpan !== undefined) {\n const { left, width } = columnMetrics.get(columns[column.idx + colSpan - 1])!;\n right = left + width;\n }\n\n const isCellAtLeftBoundary = left < scrollLeft + totalFrozenColumnWidth;\n const isCellAtRightBoundary = right > clientWidth + scrollLeft;\n const sign = isRtl ? -1 : 1;\n if (isCellAtLeftBoundary) {\n current.scrollLeft = (left - totalFrozenColumnWidth) * sign;\n } else if (isCellAtRightBoundary) {\n current.scrollLeft = (right - clientWidth) * sign;\n }\n }\n\n if (typeof rowIdx === 'number' && isRowIdxWithinViewportBounds(rowIdx)) {\n const rowTop = getRowTop(rowIdx);\n const rowHeight = getRowHeight(rowIdx);\n if (rowTop < scrollTop) {\n // at top boundary, scroll to the row's top\n current.scrollTop = rowTop;\n } else if (rowTop + rowHeight > scrollTop + clientHeight) {\n // at bottom boundary, scroll the next row's top to the bottom of the viewport\n current.scrollTop = rowTop + rowHeight - clientHeight;\n }\n }\n }\n\n function getNextPosition(key: string, ctrlKey: boolean, shiftKey: boolean): Position {\n const { idx, rowIdx } = selectedPosition;\n const row = rows[rowIdx];\n const isRowSelected = selectedCellIsWithinSelectionBounds && idx === -1;\n\n // If a group row is focused, and it is collapsed, move to the parent group row (if there is one).\n if (key === leftKey && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) {\n let parentRowIdx = -1;\n for (let i = selectedPosition.rowIdx - 1; i >= 0; i--) {\n const parentRow = rows[i];\n if (isGroupRow(parentRow) && parentRow.id === row.parentId) {\n parentRowIdx = i;\n break;\n }\n }\n if (parentRowIdx !== -1) {\n return { idx, rowIdx: parentRowIdx };\n }\n }\n\n switch (key) {\n case 'ArrowUp':\n return { idx, rowIdx: rowIdx - 1 };\n case 'ArrowDown':\n return { idx, rowIdx: rowIdx + 1 };\n case leftKey:\n return { idx: idx - 1, rowIdx };\n case rightKey:\n return { idx: idx + 1, rowIdx };\n case 'Tab':\n return { idx: idx + (shiftKey ? -1 : 1), rowIdx };\n case 'Home':\n // If row is selected then move focus to the first row\n if (isRowSelected) return { idx, rowIdx: 0 };\n return { idx: 0, rowIdx: ctrlKey ? minRowIdx : rowIdx };\n case 'End':\n // If row is selected then move focus to the last row.\n if (isRowSelected) return { idx, rowIdx: rows.length - 1 };\n return { idx: maxColIdx, rowIdx: ctrlKey ? maxRowIdx : rowIdx };\n case 'PageUp': {\n if (selectedPosition.rowIdx === minRowIdx) return selectedPosition;\n const nextRowY = getRowTop(rowIdx) + getRowHeight(rowIdx) - clientHeight;\n return { idx, rowIdx: nextRowY > 0 ? findRowIdx(nextRowY) : 0 };\n }\n case 'PageDown': {\n if (selectedPosition.rowIdx >= rows.length) return selectedPosition;\n const nextRowY = getRowTop(rowIdx) + clientHeight;\n return { idx, rowIdx: nextRowY < totalRowHeight ? findRowIdx(nextRowY) : rows.length - 1 };\n }\n default:\n return selectedPosition;\n }\n }\n\n function navigate(event: React.KeyboardEvent<HTMLDivElement>) {\n const { key, shiftKey } = event;\n let mode = cellNavigationMode;\n if (key === 'Tab') {\n if (\n canExitGrid({\n shiftKey,\n cellNavigationMode,\n maxColIdx,\n minRowIdx,\n maxRowIdx,\n selectedPosition\n })\n ) {\n commitEditorChanges();\n // Allow focus to leave the grid so the next control in the tab order can be focused\n return;\n }\n\n mode = cellNavigationMode === 'NONE' ? 'CHANGE_ROW' : cellNavigationMode;\n }\n\n // Do not allow focus to leave\n event.preventDefault();\n\n const ctrlKey = isCtrlKeyHeldDown(event);\n const nextPosition = getNextPosition(key, ctrlKey, shiftKey);\n if (isSamePosition(selectedPosition, nextPosition)) return;\n\n const nextSelectedCellPosition = getNextSelectedCellPosition({\n columns,\n colSpanColumns,\n rows,\n summaryRows,\n minRowIdx,\n maxRowIdx,\n lastFrozenColumnIndex,\n cellNavigationMode: mode,\n currentPosition: selectedPosition,\n nextPosition,\n isCellWithinBounds: isCellWithinSelectionBounds,\n isGroupRow\n });\n\n selectCell(nextSelectedCellPosition);\n }\n\n function getDraggedOverCellIdx(currentRowIdx: number): number | undefined {\n if (draggedOverRowIdx === undefined) return;\n const { rowIdx } = selectedPosition;\n\n const isDraggedOver =\n rowIdx < draggedOverRowIdx\n ? rowIdx < currentRowIdx && currentRowIdx <= draggedOverRowIdx\n : rowIdx > currentRowIdx && currentRowIdx >= draggedOverRowIdx;\n\n return isDraggedOver ? selectedPosition.idx : undefined;\n }\n\n function getLayoutCssVars() {\n if (autoResizeColumn === null) return layoutCssVars;\n const { gridTemplateColumns } = layoutCssVars;\n const newSizes = gridTemplateColumns.split(' ');\n newSizes[autoResizeColumn.idx] = 'max-content';\n return {\n ...layoutCssVars,\n gridTemplateColumns: newSizes.join(' ')\n };\n }\n\n function getDragHandle(rowIdx: number) {\n if (\n selectedPosition.rowIdx !== rowIdx ||\n selectedPosition.mode === 'EDIT' ||\n hasGroups || // drag fill is not supported when grouping is enabled\n onFill == null\n ) {\n return;\n }\n\n return (\n <DragHandle\n rows={rawRows}\n columns={columns}\n selectedPosition={selectedPosition}\n isCellEditable={isCellEditable}\n latestDraggedOverRowIdx={latestDraggedOverRowIdx}\n onRowsChange={onRowsChange}\n onFill={onFill}\n setDragging={setDragging}\n setDraggedOverRowIdx={setDraggedOverRowIdx}\n />\n );\n }\n\n function getCellEditor(rowIdx: number) {\n if (selectedPosition.rowIdx !== rowIdx || selectedPosition.mode === 'SELECT') return;\n\n const { idx, row } = selectedPosition;\n const column = columns[idx];\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row });\n\n const closeEditor = () => {\n setSelectedPosition(({ idx, rowIdx }) => ({ idx, rowIdx, mode: 'SELECT' }));\n };\n\n const onRowChange = (row: R, commitChanges?: boolean) => {\n if (commitChanges) {\n updateRow(selectedPosition.rowIdx, row);\n closeEditor();\n } else {\n setSelectedPosition((position) => ({ ...position, row }));\n }\n };\n\n if (rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) {\n // Discard changes if rows are updated from outside\n closeEditor();\n }\n\n return (\n <EditCell\n key={column.key}\n column={column}\n colSpan={colSpan}\n row={row}\n onRowChange={onRowChange}\n closeEditor={closeEditor}\n scrollToCell={() => {\n scrollToCell(selectedPosition);\n }}\n />\n );\n }\n\n function getRowViewportColumns(rowIdx: number) {\n const selectedColumn = columns[selectedPosition.idx];\n if (\n // idx can be -1 if grouping is enabled\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n selectedColumn !== undefined &&\n selectedPosition.rowIdx === rowIdx &&\n !viewportColumns.includes(selectedColumn)\n ) {\n // Add the selected column to viewport columns if the cell is not within the viewport\n return selectedPosition.idx > colOverscanEndIdx\n ? [...viewportColumns, selectedColumn]\n : [\n ...viewportColumns.slice(0, lastFrozenColumnIndex + 1),\n selectedColumn,\n ...viewportColumns.slice(lastFrozenColumnIndex + 1)\n ];\n }\n return viewportColumns;\n }\n\n function getViewportRows() {\n const rowElements = [];\n let startRowIndex = 0;\n\n const { idx: selectedIdx, rowIdx: selectedRowIdx } = selectedPosition;\n const startRowIdx =\n selectedCellIsWithinViewportBounds && selectedRowIdx < rowOverscanStartIdx\n ? rowOverscanStartIdx - 1\n : rowOverscanStartIdx;\n const endRowIdx =\n selectedCellIsWithinViewportBounds && selectedRowIdx > rowOverscanEndIdx\n ? rowOverscanEndIdx + 1\n : rowOverscanEndIdx;\n\n for (let viewportRowIdx = startRowIdx; viewportRowIdx <= endRowIdx; viewportRowIdx++) {\n const isRowOutsideViewport =\n viewportRowIdx === rowOverscanStartIdx - 1 || viewportRowIdx === rowOverscanEndIdx + 1;\n const rowIdx = isRowOutsideViewport ? selectedRowIdx : viewportRowIdx;\n\n let rowColumns = viewportColumns;\n const selectedColumn = columns[selectedIdx];\n // selectedIdx can be -1 if grouping is enabled\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (selectedColumn !== undefined) {\n if (isRowOutsideViewport) {\n // if the row is outside the viewport then only render the selected cell\n rowColumns = [selectedColumn];\n } else {\n // if the row is within the viewport and cell is not, add the selected column to viewport columns\n rowColumns = getRowViewportColumns(rowIdx);\n }\n }\n\n const row = rows[rowIdx];\n const gridRowStart = headerRowsCount + rowIdx + 1;\n if (isGroupRow(row)) {\n ({ startRowIndex } = row);\n const isGroupRowSelected =\n isSelectable && row.childRows.every((cr) => selectedRows.has(rowKeyGetter!(cr)));\n rowElements.push(\n <GroupRowRenderer\n aria-level={row.level + 1} // aria-level is 1-based\n aria-setsize={row.setSize}\n aria-posinset={row.posInSet + 1} // aria-posinset is 1-based\n aria-rowindex={headerRowsCount + startRowIndex + 1} // aria-rowindex is 1 based\n aria-selected={isSelectable ? isGroupRowSelected : undefined}\n key={row.id}\n id={row.id}\n groupKey={row.groupKey}\n viewportColumns={rowColumns}\n childRows={row.childRows}\n rowIdx={rowIdx}\n row={row}\n gridRowStart={gridRowStart}\n height={getRowHeight(rowIdx)}\n level={row.level}\n isExpanded={row.isExpanded}\n selectedCellIdx={selectedRowIdx === rowIdx ? selectedIdx : undefined}\n isRowSelected={isGroupRowSelected}\n selectGroup={selectGroupLatest}\n toggleGroup={toggleGroupLatest}\n />\n );\n continue;\n }\n\n startRowIndex++;\n let key;\n let isRowSelected = false;\n if (typeof rowKeyGetter === 'function') {\n key = rowKeyGetter(row);\n isRowSelected = selectedRows?.has(key) ?? false;\n } else {\n key = hasGroups ? startRowIndex : rowIdx;\n }\n\n rowElements.push(\n <RowRenderer\n aria-rowindex={headerRowsCount + (hasGroups ? startRowIndex : rowIdx) + 1} // aria-rowindex is 1 based\n aria-selected={isSelectable ? isRowSelected : undefined}\n key={key}\n rowIdx={rowIdx}\n row={row}\n viewportColumns={rowColumns}\n isRowSelected={isRowSelected}\n onRowClick={onRowClick}\n onRowDoubleClick={onRowDoubleClick}\n rowClass={rowClass}\n gridRowStart={gridRowStart}\n height={getRowHeight(rowIdx)}\n copiedCellIdx={\n copiedCell !== null && copiedCell.row === row\n ? columns.findIndex((c) => c.key === copiedCell.columnKey)\n : undefined\n }\n selectedCellIdx={selectedRowIdx === rowIdx ? selectedIdx : undefined}\n draggedOverCellIdx={getDraggedOverCellIdx(rowIdx)}\n setDraggedOverRowIdx={isDragging ? setDraggedOverRowIdx : undefined}\n lastFrozenColumnIndex={lastFrozenColumnIndex}\n onRowChange={handleFormatterRowChangeLatest}\n selectCell={selectViewportCellLatest}\n selectedCellDragHandle={getDragHandle(rowIdx)}\n selectedCellEditor={getCellEditor(rowIdx)}\n />\n );\n }\n\n return rowElements;\n }\n\n // Reset the positions if the current values are no longer valid. This can happen if a column or row is removed\n if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) {\n setSelectedPosition(initialPosition);\n setDraggedOverRowIdx(undefined);\n }\n\n let templateRows = `${headerRowHeight}px`;\n if (rows.length > 0) {\n templateRows += gridTemplateRows;\n }\n if (summaryRowsCount > 0) {\n templateRows += ` repeat(${summaryRowsCount}, ${summaryRowHeight}px)`;\n }\n\n const isGroupRowFocused = selectedPosition.idx === -1 && selectedPosition.rowIdx !== -2;\n\n return (\n <div\n role={hasGroups ? 'treegrid' : 'grid'}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-multiselectable={isSelectable ? true : undefined}\n aria-colcount={columns.length}\n aria-rowcount={headerRowsCount + rowsCount + summaryRowsCount}\n className={clsx(\n rootClassname,\n {\n [viewportDraggingClassname]: isDragging,\n [cellAutoResizeClassname]: autoResizeColumn !== null\n },\n className\n )}\n style={\n {\n ...style,\n gridTemplateRows: templateRows,\n '--rdg-header-row-height': `${headerRowHeight}px`,\n '--rdg-summary-row-height': `${summaryRowHeight}px`,\n '--rdg-sign': isRtl ? -1 : 1,\n ...getLayoutCssVars()\n } as unknown as React.CSSProperties\n }\n dir={direction}\n ref={gridRef}\n onScroll={handleScroll}\n onKeyDown={handleKeyDown}\n data-testid={testId}\n >\n {/* extra div is needed for row navigation in a treegrid */}\n {hasGroups && (\n <div\n ref={rowRef}\n tabIndex={isGroupRowFocused ? 0 : -1}\n className={clsx(focusSinkClassname, {\n [rowSelected]: isGroupRowFocused,\n [rowSelectedWithFrozenCell]: isGroupRowFocused && lastFrozenColumnIndex !== -1\n })}\n style={{\n gridRowStart: selectedPosition.rowIdx + 2\n }}\n onKeyDown={handleKeyDown}\n />\n )}\n <DataGridDefaultComponentsProvider value={defaultGridComponents}>\n <HeaderRow\n columns={getRowViewportColumns(-1)}\n onColumnResize={handleColumnResize}\n allRowsSelected={allRowsSelected}\n onAllRowsSelectionChange={selectAllRowsLatest}\n sortColumns={sortColumns}\n onSortColumnsChange={onSortColumnsChange}\n lastFrozenColumnIndex={lastFrozenColumnIndex}\n selectedCellIdx={isHeaderRowSelected ? selectedPosition.idx : undefined}\n selectCell={selectHeaderCellLatest}\n shouldFocusGrid={!selectedCellIsWithinSelectionBounds}\n direction={direction}\n />\n {rows.length === 0 && noRowsFallback ? (\n noRowsFallback\n ) : (\n <>\n <RowSelectionChangeProvider value={selectRowLatest}>\n {getViewportRows()}\n </RowSelectionChangeProvider>\n {summaryRows?.map((row, rowIdx) => {\n const gridRowStart = headerRowsCount + rows.length + rowIdx + 1;\n const summaryRowIdx = headerRowsCount + rows.length + rowIdx - 1;\n const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;\n const top =\n clientHeight > totalRowHeight\n ? gridHeight - summaryRowHeight * (summaryRows.length - rowIdx)\n : undefined;\n const bottom =\n top === undefined\n ? summaryRowHeight * (summaryRows.length - 1 - rowIdx)\n : undefined;\n\n return (\n <SummaryRow\n aria-rowindex={headerRowsCount + rowsCount + rowIdx + 1}\n key={rowIdx}\n rowIdx={rowIdx}\n gridRowStart={gridRowStart}\n row={row}\n top={top}\n bottom={bottom}\n viewportColumns={getRowViewportColumns(summaryRowIdx)}\n lastFrozenColumnIndex={lastFrozenColumnIndex}\n selectedCellIdx={isSummaryRowSelected ? selectedPosition.idx : undefined}\n selectCell={selectSummaryCellLatest}\n />\n );\n })}\n </>\n )}\n </DataGridDefaultComponentsProvider>\n </div>\n );\n}\n\nfunction isSamePosition(p1: Position, p2: Position) {\n return p1.idx === p2.idx && p1.rowIdx === p2.rowIdx;\n}\n\nexport default forwardRef(DataGrid) as <R, SR = unknown, K extends Key = Key>(\n props: DataGridProps<R, SR, K> & RefAttributes<DataGridHandle>\n) => JSX.Element;\n","import { useMemo } from 'react';\n\nimport { getColSpan } from '../utils';\nimport type { CalculatedColumn, GroupRow, Maybe } from '../types';\n\ninterface ViewportColumnsArgs<R, SR> {\n columns: readonly CalculatedColumn<R, SR>[];\n colSpanColumns: readonly CalculatedColumn<R, SR>[];\n rows: readonly (R | GroupRow<R>)[];\n summaryRows: Maybe<readonly SR[]>;\n colOverscanStartIdx: number;\n colOverscanEndIdx: number;\n lastFrozenColumnIndex: number;\n rowOverscanStartIdx: number;\n rowOverscanEndIdx: number;\n isGroupRow: (row: R | GroupRow<R>) => row is GroupRow<R>;\n}\n\nexport function useViewportColumns<R, SR>({\n columns,\n colSpanColumns,\n rows,\n summaryRows,\n colOverscanStartIdx,\n colOverscanEndIdx,\n lastFrozenColumnIndex,\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n isGroupRow\n}: ViewportColumnsArgs<R, SR>) {\n // find the column that spans over a column within the visible columns range and adjust colOverscanStartIdx\n const startIdx = useMemo(() => {\n if (colOverscanStartIdx === 0) return 0;\n\n let startIdx = colOverscanStartIdx;\n\n const updateStartIdx = (colIdx: number, colSpan: number | undefined) => {\n if (colSpan !== undefined && colIdx + colSpan > colOverscanStartIdx) {\n startIdx = colIdx;\n return true;\n }\n return false;\n };\n\n for (const column of colSpanColumns) {\n // check header row\n const colIdx = column.idx;\n if (colIdx >= startIdx) break;\n if (updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, { type: 'HEADER' }))) {\n break;\n }\n\n // check viewport rows\n for (let rowIdx = rowOverscanStartIdx; rowIdx <= rowOverscanEndIdx; rowIdx++) {\n const row = rows[rowIdx];\n if (isGroupRow(row)) continue;\n if (\n updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row }))\n ) {\n break;\n }\n }\n\n // check summary rows\n if (summaryRows != null) {\n for (const row of summaryRows) {\n if (\n updateStartIdx(\n colIdx,\n getColSpan(column, lastFrozenColumnIndex, { type: 'SUMMARY', row })\n )\n ) {\n break;\n }\n }\n }\n }\n\n return startIdx;\n }, [\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n summaryRows,\n colOverscanStartIdx,\n lastFrozenColumnIndex,\n colSpanColumns,\n isGroupRow\n ]);\n\n return useMemo((): readonly CalculatedColumn<R, SR>[] => {\n const viewportColumns: CalculatedColumn<R, SR>[] = [];\n for (let colIdx = 0; colIdx <= colOverscanEndIdx; colIdx++) {\n const column = columns[colIdx];\n\n if (colIdx < startIdx && !column.frozen) continue;\n viewportColumns.push(column);\n }\n\n return viewportColumns;\n }, [startIdx, colOverscanEndIdx, columns]);\n}\n","import { css } from '@linaria/core';\nimport { row } from './row';\n\nconst lightTheme = `\n --rdg-color: #000;\n --rdg-border-color: #ddd;\n --rdg-summary-border-color: #aaa;\n --rdg-background-color: hsl(0deg 0% 100%);\n --rdg-header-background-color: hsl(0deg 0% 97.5%);\n --rdg-row-hover-background-color: hsl(0deg 0% 96%);\n --rdg-row-selected-background-color: hsl(207deg 76% 92%);\n --row-selected-hover-background-color: hsl(207deg 76% 88%);\n\n --rdg-checkbox-color: hsl(207deg 100% 29%);\n --rdg-checkbox-focus-color: hsl(207deg 100% 69%);\n --rdg-checkbox-disabled-border-color: #ccc;\n --rdg-checkbox-disabled-background-color: #ddd;\n`;\n\nconst darkTheme = `\n --rdg-color: #ddd;\n --rdg-border-color: #444;\n --rdg-summary-border-color: #555;\n --rdg-background-color: hsl(0deg 0% 13%);\n --rdg-header-background-color: hsl(0deg 0% 10.5%);\n --rdg-row-hover-background-color: hsl(0deg 0% 9%);\n --rdg-row-selected-background-color: hsl(207deg 76% 42%);\n --row-selected-hover-background-color: hsl(207deg 76% 38%);\n\n --rdg-checkbox-color: hsl(207deg 100% 79%);\n --rdg-checkbox-focus-color: hsl(207deg 100% 89%);\n --rdg-checkbox-disabled-border-color: #000;\n --rdg-checkbox-disabled-background-color: #333;\n`;\n\nconst root = css`\n ${lightTheme}\n --rdg-selection-color: #66afe9;\n --rdg-font-size: 14px;\n\n display: grid;\n\n color-scheme: var(--rdg-color-scheme, light dark);\n\n /* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */\n /* We set a stacking context so internal elements don't render on top of external components. */\n contain: strict;\n contain: size layout style paint;\n content-visibility: auto;\n block-size: 350px;\n border: 1px solid var(--rdg-border-color);\n box-sizing: border-box;\n overflow: auto;\n user-select: none;\n background-color: var(--rdg-background-color);\n color: var(--rdg-color);\n font-size: var(--rdg-font-size);\n\n /* set stacking context in safari */\n @supports not (contain: strict) {\n position: relative;\n z-index: 0;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n\n /* needed on Firefox */\n &::before {\n content: '';\n grid-column: 1/-1;\n grid-row: 1/-1;\n }\n\n &.rdg-dark {\n --rdg-color-scheme: dark;\n ${darkTheme}\n }\n\n &.rdg-light {\n --rdg-color-scheme: light;\n }\n\n @media (prefers-color-scheme: dark) {\n &:not(.rdg-light) {\n ${darkTheme}\n }\n }\n`;\n\nexport const rootClassname = `rdg ${root}`;\n\nconst viewportDragging = css`\n &.${row} {\n cursor: move;\n }\n`;\n\nexport const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;\n\nexport const focusSinkClassname = css`\n grid-column: 1/-1;\n pointer-events: none;\n /* Should have a higher value than 3 to show up above header row */\n z-index: 4;\n`;\n","import * as React from \"react\";\nimport DataGrid, { Column, SelectColumn, SortColumn } from \"react-data-grid\";\nimport { format, timeFormat, timeParse } from \"@hpcc-js/common\";\nimport { useData } from \"./hooks\";\nimport type { Table } from \"./table\";\n\nexport type QuerySortItem = { attribute: string, descending: boolean };\nfunction copyAndSort<T>(items: T[], attribute: string, descending?: boolean): T[] {\n const key = attribute as keyof T;\n return [...items].sort((a: T, b: T) => {\n if (a[key] < b[key]) {\n return descending ? 1 : -1;\n } else if (a[key] > b[key]) {\n return descending ? -1 : 1;\n }\n return 0;\n });\n}\n\ninterface EmptyRowsRendererProps {\n message: string\n}\n\nconst EmptyRowsRenderer: React.FunctionComponent<EmptyRowsRendererProps> = ({\n message\n}) => {\n\n return <div style={{ textAlign: \"center\", gridColumn: \"1/-1\" }} >\n {message}\n <span>\n --- * --- * ---\n </span>\n </div>;\n};\n\ninterface ColumnEx<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {\n __hpcc_pattern?: ReturnType<typeof timeParse>;\n __hpcc_format?: ReturnType<typeof format> | ReturnType<typeof timeFormat>;\n}\n\nexport interface ReactTableProps {\n table: Table;\n sort?: QuerySortItem,\n}\n\nexport const ReactTable: React.FunctionComponent<ReactTableProps> = ({\n table,\n sort\n}) => {\n const [columns, data] = useData(table);\n const multiSelect = table.multiSelect();\n const columnTypes = table.columnTypes();\n const columnPatterns = table.columnPatterns();\n const columnFormats = table.columnFormats();\n\n const [listColumns, setListColumns] = React.useState<ColumnEx<any[]>[]>([]);\n const [sortColumn, setSortColumn] = React.useState<SortColumn>();\n const [rows, setRows] = React.useState<any[]>([]);\n const [selectedRows, setSelectedRows] = React.useState<ReadonlySet<number>>(new Set());\n\n // Columns ---\n React.useEffect(() => {\n setListColumns([\n ...multiSelect ? [SelectColumn] : [],\n ...columns.map((column): ColumnEx<any[]> => {\n const type = columnTypes[column] ?? \"string\";\n let formatter;\n let __hpcc_pattern;\n let __hpcc_format;\n switch (type) {\n case \"time\":\n __hpcc_pattern = columnPatterns[column] !== undefined ? timeParse(columnPatterns[column]) : undefined;\n __hpcc_format = columnFormats[column] !== undefined ? timeFormat(columnFormats[column]) : undefined;\n break;\n case \"number\":\n formatter = (props) => {\n return <div style={{ textAlign: \"right\" }}>{props.row[props.column.key]}</div>;\n };\n // eslint-disable-next-line no-fallthrough\n default:\n __hpcc_format = columnFormats[column] !== undefined ? format(columnFormats[column]) : undefined;\n }\n return {\n key: column,\n name: column,\n resizable: true,\n sortable: true,\n minWidth: 80,\n formatter,\n __hpcc_pattern,\n __hpcc_format\n };\n })\n ]);\n }, [columnFormats, columnPatterns, columnTypes, columns, multiSelect]);\n\n const onSortColumnsChange = React.useCallback((sortColumns: SortColumn[]) => {\n const futureSortColumn = sortColumns.slice(-1)[0];\n const sorted = futureSortColumn !== undefined;\n const isSortedDescending: boolean = futureSortColumn?.direction === \"DESC\";\n setSortColumn(futureSortColumn);\n setRows(copyAndSort(rows, sorted ? futureSortColumn.columnKey : \"key\", sorted ? isSortedDescending : false));\n }, [rows]);\n\n const rowKeyGetter = React.useCallback((row: any) => {\n return row.key;\n }, []);\n\n const onSelectedRowsChange = React.useCallback((selectedRows: Set<any>) => {\n setSelectedRows(selectedRows);\n }, []);\n\n const onRowClick = React.useCallback((row, column) => {\n table.onRowClickCallback(row, column.key);\n }, [table]);\n\n // Rows ---\n React.useEffect(() => {\n let items = data.map((row, index) => {\n const retVal = {\n key: index\n };\n listColumns.forEach((column, index) => {\n let val = row[index] as string;\n if (column.__hpcc_pattern && column.__hpcc_format) {\n val = column.__hpcc_format(column.__hpcc_pattern(val));\n } else if (column.__hpcc_pattern) {\n val = column.__hpcc_pattern(val).toString();\n } else if (column.__hpcc_format) {\n val = column.__hpcc_format(val as any);\n }\n retVal[column.key] = val;\n });\n return retVal;\n });\n if (sort?.attribute) {\n items = copyAndSort(items, sort.attribute, sort.descending);\n }\n setRows(items);\n }, [listColumns, data, sort]);\n\n return <DataGrid\n columns={listColumns}\n headerRowHeight={24}\n rows={rows}\n rowKeyGetter={rowKeyGetter}\n rowHeight={20}\n components={{ noRowsFallback: <EmptyRowsRenderer message={table.noDataMessage()} /> }}\n className={table.darkMode() ? \"rdg-dark\" : \"rdg-light\"}\n sortColumns={sortColumn ? [sortColumn] : []}\n onSortColumnsChange={onSortColumnsChange}\n selectedRows={selectedRows}\n onSelectedRowsChange={multiSelect ? onSelectedRowsChange : undefined}\n onRowClick={multiSelect ? undefined : onRowClick}\n aria-describedby={\"\"}\n aria-label={\"\"}\n aria-labelledby={\"\"}\n style={{ height: \"100%\" }}\n />;\n};\n\n","import { Widget } from \"@hpcc-js/common\";\nimport * as React from \"react\";\n\nexport function useData(widget: Widget): [string[], Array<string | number>[]] {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const columns: string[] = React.useMemo(() => widget.columns(), [widget, widget.dataChecksum()]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const data: Array<string | number>[] = React.useMemo(() => widget.data(), [widget, widget.dataChecksum()]);\n\n return [columns, data];\n}\n\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import * as React from \"react\";\nimport { HTMLWidget, publish } from \"@hpcc-js/common\";\nimport { render, unmountComponentAtNode } from \"react-dom\";\nimport { ReactTable } from \"./reactTable\";\n\nimport \"../src/table.css\";\n\nexport type ColumnType = \"boolean\" | \"number\" | \"string\" | \"time\";\n\nexport class Table extends HTMLWidget {\n\n protected _div;\n\n constructor() {\n super();\n }\n\n @publish(\"...empty...\", \"string\", \"No Data Message\")\n noDataMessage: publish<this, string>;\n @publish(false, \"boolean\", \"Dark Mode\")\n darkMode: publish<this, boolean>;\n @publish(false, \"boolean\", \"Multiple Selection\")\n multiSelect: publish<this, boolean>;\n @publish({}, \"object\", \"Column Types (\\\"boolean\\\" | \\\"number\\\" | \\\"string\\\" | \\\"time\\\"\")\n columnTypes: publish<this, { [column: string]: ColumnType }>;\n @publish({}, \"object\", \"Column Patterns\")\n columnPatterns: publish<this, { [column: string]: string }>;\n @publish({}, \"object\", \"Column Formats\")\n columnFormats: publish<this, { [column: string]: string }>;\n\n columnType(column: string): ColumnType;\n columnType(column: string, type: ColumnType): this;\n columnType(column: string, type?: ColumnType): ColumnType | this {\n if (arguments.length === 1) return this.columnTypes()[column];\n this.columnTypes({ ...this.columnTypes(), [column]: type });\n return this;\n }\n\n columnPattern(column: string): string;\n columnPattern(column: string, pattern: string): this;\n columnPattern(column: string, pattern?: string): string | this {\n if (arguments.length === 1) return this.columnPatterns()[column];\n this.columnPatterns({ ...this.columnPatterns(), [column]: pattern });\n return this;\n }\n\n columnFormat(column: string): string;\n columnFormat(column: string, format: string): this;\n columnFormat(column: string, format?: string): string | this {\n if (arguments.length === 1) return this.columnFormats()[column];\n this.columnFormats({ ...this.columnFormats(), [column]: format });\n return this;\n }\n\n private _prevRow;\n private _prevColumn;\n onRowClickCallback(row, column) {\n if (this._prevRow && JSON.stringify(this._prevRow) !== JSON.stringify(row)) {\n this.click(this._prevRow, this._prevColumn ?? \"\", false);\n }\n if (row) {\n this.click(row, column, true);\n }\n this._prevRow = row;\n this._prevColumn = column;\n }\n\n enter(domNode, element) {\n super.enter(domNode, element);\n this._div = element\n .append(\"div\")\n ;\n }\n\n update(domNode, element) {\n super.update(domNode, element);\n this._div.style(\"width\", this.width() + \"px\");\n this._div.style(\"height\", this.height() + \"px\");\n render(React.createElement(ReactTable, { table: this }), this._div.node());\n }\n\n exit(domNode, element) {\n unmountComponentAtNode(this._div.node());\n this._div.remove();\n super.exit(domNode, element);\n }\n\n // Events ---\n click(row, col, sel) {\n }\n}\nTable.prototype._class += \" dgrid2_Table\";\n","import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '17.0.2'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender. It's\n * implmented here as a no-op.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional arugment that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => callback(arg);\n\n/**\n * Strict Mode is not implemented in Preact, so we provide a stand-in for it\n * that just renders its children without imposing any restrictions.\n */\nconst StrictMode = Fragment;\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (_instance._value !== getSnapshot()) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (_instance._value !== _instance._getSnapshot()) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (_instance._value !== _instance._getSnapshot()) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n"],"mappings":"8TAAO,ICgBHA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OA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,C2CKOiG,CAAO2xB,EAAoBI,GAAY,CAAEE,MAAOt7B,OAASA,KAAKy+B,KAAKv8B,O,EAGvEs7B,EAAAp+B,UAAA0/B,KAAA,SAAKN,EAASnJ,ICTlB,SAAgC0J,KAC3BA,EAAqBh8B,KACxB87B,EAAa,KAAME,EAIpB,CDIOC,CAAuBh/B,KAAKy+B,KAAKv8B,QACjClC,KAAKy+B,KAAKQ,SACVxB,EAAAr+B,UAAM0/B,KAAKx/B,KAAAU,KAAAw+B,EAASnJ,E,EAIxBmI,EAAAp+B,UAAAi/B,MAAA,SAAM5kB,EAAKylB,EAAKC,G,EAvEhBl/B,EAAA,CAACm/B,UAAQ,cAAe,SAAU,mB,2BACG5B,EAAAp+B,UAAA,wBACrCa,EAAA,CAACm/B,WAAQ,EAAO,UAAW,a,2BACM5B,EAAAp+B,UAAA,mBACjCa,EAAA,CAACm/B,WAAQ,EAAO,UAAW,sB,2BACS5B,EAAAp+B,UAAA,sBACpCa,EAAA,CAACm/B,UAAQ,GAAI,SAAU,0D,2BACsC5B,EAAAp+B,UAAA,sBAC7Da,EAAA,CAACm/B,UAAQ,GAAI,SAAU,mB,2BACqC5B,EAAAp+B,UAAA,yBAC5Da,EAAA,CAACm/B,UAAQ,GAAI,SAAU,kB,2BACoC5B,EAAAp+B,UAAA,wBA8D9Do+B,C,CAjFD,CAA2B6B,cAkF3B7B,GAAMp+B,UAAUkgC,QAAU,gB,gBhEzFG,W,WAFL,kB,cACG,Q"}
|
|
1
|
+
{"version":3,"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__assign","assign","t","s","i","n","arguments","length","apply","this","__decorate","decorators","target","key","desc","c","r","getOwnPropertyDescriptor","Reflect","decorate","defineProperty","__metadata","metadataKey","metadataValue","metadata","__spreadArray","to","from","pack","ar","l","slice","concat","options","vnodeId","rerenderQueue","prevDebounce","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","ref","normalizedProps","defaultProps","undefined","createVNode","original","vnode","__k","__","__b","__e","__d","__c","__h","constructor","__v","Fragment","Component","context","getDomSibling","childIndex","indexOf","sibling","updateParentDomPointers","child","base","enqueueRender","push","process","debounceRendering","setTimeout","queue","__r","sort","a","some","component","commitQueue","oldVNode","oldDom","parentDom","__P","diff","ownerSVGElement","commitRoot","diffChildren","renderResult","newParentVNode","oldParentVNode","globalContext","isSvg","excessDomChildren","isHydrating","j","childVNode","newDom","firstChildDom","refs","oldChildren","oldChildrenLength","isArray","reorderChildren","placeChild","unmount","applyRef","tmp","toChildArray","out","nextDom","sibDom","outer","appendChild","nextSibling","insertBefore","setStyle","style","value","setProperty","test","dom","name","oldValue","useCapture","o","cssText","replace","toLowerCase","addEventListener","eventProxyCapture","eventProxy","removeEventListener","e","removeAttribute","setAttribute","event","newVNode","isNew","oldProps","oldState","snapshot","clearProcessingException","newProps","provider","componentContext","renderHook","count","newType","contextType","__E","render","doRender","sub","state","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","forEach","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","diffElementNodes","diffed","root","cb","oldHtml","newHtml","nodeType","localName","document","createTextNode","createElementNS","is","data","childNodes","dangerouslySetInnerHTML","attributes","__html","innerHTML","diffProps","hydrate","checked","current","parentVNode","skipRemove","componentWillUnmount","replaceNode","firstChild","createContext","defaultValue","contextId","Consumer","contextValue","Provider","subs","ctx","_props","old","splice","error","errorInfo","ctor","handled","getDerivedStateFromError","setState","componentDidCatch","update","callback","forceUpdate","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","EMPTY","oldBeforeDiff","oldBeforeRender","oldAfterDiff","oldCommit","oldBeforeUnmount","getHookState","index","hooks","__H","__V","useState","initialState","useReducer","reducer","init","hookState","_reducer","invokeOrReturn","action","currentValue","__N","nextValue","_hasScuFromHooks","prevScu","stateHooks","filter","x","every","shouldUpdate","hookItem","useEffect","args","argsChanged","_pendingArgs","useLayoutEffect","useRef","initialValue","useMemo","factory","useCallback","useContext","flushAfterPaintEffects","shift","invokeCleanup","invokeEffect","__m","requestAnimationFrame","afterNextFrame","hasErrored","HAS_RAF","raf","done","clearTimeout","timeout","cancelAnimationFrame","hook","comp","cleanup","oldArgs","newArgs","arg","f","shallowDiffers","PureComponent","memo","comparer","nextProps","updateRef","Memoed","displayName","isReactComponent","isPureReactComponent","oldDiffHook","__f","REACT_FORWARD_SYMBOL","Symbol","for","forwardRef","fn","Forwarded","clone","$$typeof","mapFn","oldCatchError","then","oldUnmount","detachedClone","detachedParent","effect","map","removeOriginal","originalParent","Suspense","__u","_suspenders","suspended","__a","SuspenseList","_next","_map","__R","promise","suspendingVNode","suspendingComponent","resolve","resolved","onResolved","onSuspensionComplete","suspendedVNode","__O","pop","wasHydrating","detachedComponent","fallback","list","delete","revealOrder","size","delegated","get","unsuspend","wrappedUnsuspend","Map","reverse","set","_this","REACT_ELEMENT_TYPE","CAMEL_PROPS","IS_DOM","onChangeInputType","configurable","v","writable","oldEventHook","empty","isPropagationStopped","cancelBubble","isDefaultPrevented","defaultPrevented","persist","nativeEvent","classNameDescriptor","class","oldVNodeHook","nonCustomElement","multiple","selected","className","enumerable","clsx","__self","__source","rowClassname","rowSelectedClassname","checkboxFormatter","onChange","_jsxs","checkboxLabel","disabled","checkboxLabelDisabled","_jsx","checkboxInput","shiftKey","checkbox","window","useOriginalLayoutEffect","useFocusRef","isSelected","focus","preventScroll","tabIndex","DataGridDefaultComponentsContext","DataGridDefaultComponentsProvider","useDefaultComponents","SelectCellFormatter","isCellSelected","ariaLabel","ariaLabelledBy","_Fragment","valueFormatter","row","column","toggleGroupFormatter","ToggleGroup","groupKey","isExpanded","toggleGroup","groupCellContent","onKeyDown","viewBox","width","height","caret","RowSelectionContext","RowSelectionProvider","RowSelectionChangeContext","RowSelectionChangeProvider","useRowSelection","rowSelectionContext","rowSelectionChangeContext","Error","SELECT_COLUMN_KEY","SelectFormatter","isRowSelected","onRowSelectionChange","isShiftClick","SelectGroupFormatter","SelectColumn","minWidth","maxWidth","resizable","sortable","frozen","headerRenderer","allRowsSelected","onAllRowsSelectionChange","formatter","groupFormatter","getColSpan","lastFrozenColumnIndex","colSpan","Number","isInteger","idx","scrollIntoView","element","inline","block","nonInputKeys","Set","isCtrlKeyHeldDown","ctrlKey","metaKey","onEditorNavigation","HTMLInputElement","HTMLTextAreaElement","HTMLSelectElement","matches","renderMeasuringCells","viewportColumns","gridColumnStart","isSelectedCellEditable","selectedPosition","columns","rows","isGroupRow","rowIdx","isCellEditable","editor","rowGroup","editable","getSelectedCellColSpan","topSummaryRows","bottomSummaryRows","topSummaryRowsCount","minRowIdx","getRowStyle","getCellStyle","gridColumnEnd","insetInlineStart","getCellClassname","extraClasses","isLastFrozenColumn","min","max","round","floor","sign","abs","Math","assertIsValidKeyGetter","keyGetter","clampColumnWidth","useLatestFunc","callbackFn","useRovingCellRef","isChildFocused","setIsChildFocused","cell","contains","activeElement","onFocus","currentTarget","useViewportRows","rawRows","rowHeight","clientHeight","scrollTop","groupBy","rowGrouper","expandedGroupIds","enableVirtualization","groupedRows","rowsCount","groupRows","groupByKey","remainingGroupByKeys","startRowIndex","groupRowsCount","groups","childRows","entries","childGroups","childRowsCount","allGroupRows","flattenedRows","expandGroup","parentId","level","arr","keys","posInSet","id","has","groupRow","setSize","add","totalRowHeight","gridTemplateRows","getRowTop","getRowHeight","findRowIdx","offset","rowPositions","currentRowHeight","position","top","validateRowIdx","start","end","middle","currentOffset","rowOverscanStartIdx","rowOverscanEndIdx","overscanThreshold","rowVisibleStartIdx","rowVisibleEndIdx","sortDirection","priority","onSort","SortableHeaderCell","sortStatus","headerSortCell","onClick","preventDefault","headerSortName","HeaderCell","onColumnResize","sortColumns","onSortColumnsChange","selectCell","shouldFocusGrid","direction","isRtl","sortIndex","findIndex","columnKey","sortColumn","ariaSort","headerCellClass","cellResizable","defaultHeaderRenderer","role","onDoubleClick","right","left","getBoundingClientRect","clientX","onPointerDown","pointerType","buttons","pointerId","onPointerMove","setPointerCapture","onLostPointerCapture","ctrlClick","sortDescendingFirst","nextSort","nextSortColumn","nextSortColumns","HeaderRow","selectedCellIdx","cells","headerRow","HeaderRow$1","Cell","isCopied","isDraggedOver","dragHandle","onRowClick","onRowDoubleClick","onRowChange","cellClass","cellCopied","cellDraggedOver","selectCellWrapper","openEditor","editorOptions","editOnClick","onContextMenu","newRow","Cell$1","Row","gridRowStart","copiedCellIdx","draggedOverCellIdx","selectedCellEditor","selectedCellDragHandle","rowClass","setDraggedOverRowIdx","onMouseEnter","handleRowChange","RowComponent","defaultRowRenderer","GroupCell","groupColumnIndex","toggleGroupWrapper","isLevelMatching","cursor","GroupCell$1","GroupedRow","selectGroup","GroupRowRenderer","SummaryCell","summaryCellClass","summaryFormatter","SummaryCell$1","SummaryRow","bottom","lastTopRowIdx","ariaRowIndex","summaryRow","topSummaryRow","SummaryRow$1","EditCell","closeEditor","frameRequestRef","commitOnOutsideClick","commitOnOutsideMouseDown","onClose","cancelFrameRequest","commitChanges","onWindowCaptureMouseDown","capture","renderFormatter","stopPropagation","onNavigation","onMouseDownCapture","DragHandle","latestDraggedOverRowIdx","onRowsChange","onFill","setDragging","updateRows","startRowIdx","endRowIdx","sourceRow","updatedRows","indexes","updatedRow","targetRow","cellDragHandle","onMouseDown","onMouseOver","onMouseUp","overRowIdx","handleDragEnd","sortIcon","sortPriority","arrow","initialPosition","mode","DataGrid","rawColumns","rowKeyGetter","rawRowHeight","headerRowHeight","rawHeaderRowHeight","summaryRowHeight","rawSummaryRowHeight","selectedRows","onSelectedRowsChange","defaultColumnOptions","rawGroupBy","onExpandedGroupIdsChange","onScroll","onCopy","onPaste","cellNavigationMode","rawCellNavigationMode","rawEnableVirtualization","renderers","rawDirection","ariaDescribedBy","testId","defaultComponents","rowRenderer","defaultSortStatus","defaultCheckboxFormatter","noRowsFallback","setScrollTop","scrollLeft","setScrollLeft","columnWidths","setColumnWidths","setSelectedPosition","copiedCell","setCopiedCell","isDragging","draggedOverRowIdx","setOverRowIdx","prevSelectedPosition","lastSelectedRowIdx","rowRef","gridRef","gridWidth","gridHeight","isWidthInitialized","inlineSize","setInlineSize","blockSize","setBlockSize","setWidthInitialized","ResizeObserver","clientWidth","offsetWidth","offsetHeight","initialHeight","resizeObserver","contentBoxSize","observe","disconnect","useGridDimensions","bottomSummaryRowsCount","summaryRowsCount","isSelectable","leftKey","rightKey","defaultGridComponents","colSpanColumns","colOverscanStartIdx","colOverscanEndIdx","templateColumns","layoutCssVars","columnMetrics","totalFrozenColumnWidth","viewportWidth","defaultWidth","defaultMinWidth","defaultMaxWidth","defaultFormatter","defaultSortable","defaultResizable","rawColumn","includes","aKey","frozenA","bKey","frozenB","columnMetric","gridTemplateColumns","join","viewportLeft","viewportRight","lastColIdx","firstUnfrozenColumnIdx","colVisibleStartIdx","colVisibleEndIdx","useCalculatedColumns","flexWidthViewportColumns","startIdx","updateStartIdx","colIdx","useViewportColumns","hasGroups","minColIdx","maxColIdx","maxRowIdx","selectedCellIsWithinSelectionBounds","isCellWithinSelectionBounds","selectedCellIsWithinViewportBounds","isCellWithinViewportBounds","handleColumnResizeLatest","newTemplateColumns","measuredWidth","querySelector","measuredWidthPx","newColumnWidths","onSortColumnsChangeLatest","onRowClickLatest","onRowDoubleClickLatest","selectRowLatest","selectRow","selectAllRowsLatest","newSelectedRows","rowKey","handleFormatterRowChangeLatest","updateRow","selectViewportCellLatest","enableEditor","selectGroupLatest","selectHeaderCellLatest","selectTopSummaryCellLatest","selectBottomSummaryCellLatest","toggleGroupLatest","isSamePosition","grid","measuringCell","createHandle","useImperativeHandle","scrollToColumn","scrollToRow","scrollTo","behavior","childRow","previousRowIdx","step","expandedGroupId","newExpandedGroupIds","handleKeyDown","Element","isCellEvent","closest","isRowEvent","keyCode","vKey","getRawRowIdx","sourceColumnKey","handleCopy","targetColumn","updatedTargetRow","targetColumnKey","handlePaste","isRowIdxWithinViewportBounds","atLastCellInRow","atFirstCellInRow","atLastRow","atFirstRow","canExitGrid","commitEditorChanges","nextPosition","parentRowIdx","parentRow","nextRowY","getNextPosition","currentPosition","currentIdx","isCellWithinBounds","nextIdx","nextRowIdx","setColSpan","moveRight","columnsCount","isBeforeFirstColumn","getNextSelectedCellPosition","navigate","onCellKeyDown","isDefaultCellInput","originalRow","handleCellInput","rawRowIdx","isColIdxWithinSelectionBounds","isCellAtRightBoundary","getDraggedOverCellIdx","currentRowIdx","getDragHandle","getCellEditor","getRowViewportColumns","selectedColumn","templateRows","isGroupRowFocused","scrollPaddingInlineStart","scrollPaddingBlock","getLayoutCssVars","dir","flushSync","summaryRowIdx","isSummaryRowSelected","rowElements","selectedIdx","selectedRowIdx","viewportRowIdx","isRowOutsideViewport","rowColumns","isGroupRowSelected","cr","getViewportRows","p1","p2","DataGrid$1","copyAndSort","items","attribute","descending","EmptyRowsRenderer","_a","React.createElement","textAlign","gridColumn","message","ReactTable","widget","table","_b","React.useMemo","dataChecksum","multiSelect","columnTypes","columnPatterns","columnFormats","_c","React.useState","listColumns","setListColumns","_d","setSortColumn","_e","setRows","_f","setSelectedRows","React.useEffect","__hpcc_pattern","__hpcc_format","timeParse","timeFormat","format","React.useCallback","futureSortColumn","sorted","isSortedDescending","onRowClickCallback","retVal","val","toString","noDataMessage","darkMode","css","insertAt","head","getElementsByTagName","styleSheet","Table","_super","TypeError","String","create","__extends","columnType","columnPattern","pattern","columnFormat","_prevRow","JSON","stringify","click","_prevColumn","enter","domNode","_div","append","parent","textContent","preactRender","exit","container","unmountComponentAtNode","remove","col","sel","publish","HTMLWidget","_class"],"sources":["../src/__package__.ts","../node_modules/tslib/tslib.es6.js","../../../node_modules/preact/src/util.js","../../../node_modules/preact/src/options.js","../../../node_modules/preact/src/create-element.js","../../../node_modules/preact/src/component.js","../../../node_modules/preact/src/create-context.js","../../../node_modules/preact/src/constants.js","../../../node_modules/preact/src/diff/children.js","../../../node_modules/preact/src/diff/props.js","../../../node_modules/preact/src/diff/index.js","../../../node_modules/preact/src/render.js","../../../node_modules/preact/src/diff/catch-error.js","../../../node_modules/preact/hooks/src/index.js","../../../node_modules/preact/compat/src/util.js","../../../node_modules/preact/compat/src/PureComponent.js","../../../node_modules/preact/compat/src/memo.js","../../../node_modules/preact/compat/src/forwardRef.js","../../../node_modules/preact/compat/src/Children.js","../../../node_modules/preact/compat/src/suspense.js","../../../node_modules/preact/compat/src/suspense-list.js","../../../node_modules/preact/compat/src/render.js","../../../node_modules/clsx/dist/clsx.m.js","../../../node_modules/preact/jsx-runtime/src/index.js","../node_modules/react-data-grid/src/style/cell.ts","../node_modules/react-data-grid/src/style/row.ts","../node_modules/react-data-grid/src/formatters/checkboxFormatter.tsx","../node_modules/react-data-grid/src/hooks/useLayoutEffect.ts","../node_modules/react-data-grid/src/hooks/useFocusRef.ts","../node_modules/react-data-grid/src/DataGridDefaultComponentsProvider.ts","../node_modules/react-data-grid/src/formatters/SelectCellFormatter.tsx","../node_modules/react-data-grid/src/formatters/valueFormatter.tsx","../node_modules/react-data-grid/src/formatters/toggleGroupFormatter.tsx","../node_modules/react-data-grid/src/hooks/useRowSelection.ts","../node_modules/react-data-grid/src/Columns.tsx","../node_modules/react-data-grid/src/utils/colSpanUtils.ts","../node_modules/react-data-grid/src/utils/domUtils.ts","../node_modules/react-data-grid/src/utils/keyboardUtils.ts","../node_modules/react-data-grid/src/utils/renderMeasuringCells.tsx","../node_modules/react-data-grid/src/utils/selectedCellUtils.ts","../node_modules/react-data-grid/src/utils/styleUtils.ts","../node_modules/react-data-grid/src/utils/index.ts","../node_modules/react-data-grid/src/hooks/useLatestFunc.ts","../node_modules/react-data-grid/src/hooks/useRovingCellRef.ts","../node_modules/react-data-grid/src/hooks/useViewportRows.ts","../node_modules/react-data-grid/src/headerRenderer.tsx","../node_modules/react-data-grid/src/HeaderCell.tsx","../node_modules/react-data-grid/src/HeaderRow.tsx","../node_modules/react-data-grid/src/Cell.tsx","../node_modules/react-data-grid/src/Row.tsx","../node_modules/react-data-grid/src/GroupCell.tsx","../node_modules/react-data-grid/src/GroupRow.tsx","../node_modules/react-data-grid/src/SummaryCell.tsx","../node_modules/react-data-grid/src/SummaryRow.tsx","../node_modules/react-data-grid/src/EditCell.tsx","../node_modules/react-data-grid/src/DragHandle.tsx","../node_modules/react-data-grid/src/sortStatus.tsx","../node_modules/react-data-grid/src/DataGrid.tsx","../node_modules/react-data-grid/src/hooks/useGridDimensions.ts","../node_modules/react-data-grid/src/hooks/useCalculatedColumns.ts","../node_modules/react-data-grid/src/hooks/useViewportColumns.ts","../node_modules/react-data-grid/src/style/core.ts","../../../node_modules/preact/compat/src/index.js","../src/reactTable.tsx","../src/hooks.ts","../../../node_modules/style-inject/dist/style-inject.es.js","../src/table.ts"],"sourcesContent":["export const PKG_NAME = \"@hpcc-js/dgrid2\";\nexport const PKG_VERSION = \"2.3.7\";\nexport const BUILD_VERSION = \"2.104.14\";\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","import { EMPTY_ARR } from \"./constants\";\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-ignore We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n","import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n","import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is import('./internal').VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor === undefined;\n","import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nComponent.prototype.setState = function(update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.prototype.forceUpdate = function(callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || setTimeout)(process);\n\t}\n}\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet queue;\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\n\t\trerenderQueue = [];\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\tqueue.some(c => {\n\t\t\tif (c._dirty) renderComponent(c);\n\t\t});\n\t}\n}\n\nprocess._rerenderCount = 0;\n","import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tsubs.some(enqueueRender);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\n}\n","export const EMPTY_OBJ = {};\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\n\t\tchildVNode = renderResult[i];\n\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t} else if (Array.isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = <div />\n\t\t\t// <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : null,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(parentDom, vnode, vnode, c, vnode._dom, oldDom);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (Array.isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j<oldChildrenLength; j+=2` is an alternative to `j++<oldChildrenLength/2`\n\t\t\tfor (\n\t\t\t\tlet sibDom = oldDom, j = 0;\n\t\t\t\t(sibDom = sibDom.nextSibling) && j < oldChildren.length;\n\t\t\t\tj += 2\n\t\t\t) {\n\t\t\t\tif (sibDom == newDom) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tparentDom.insertBefore(newDom, oldDom);\n\t\t\tnextDom = oldDom;\n\t\t}\n\t}\n\n\t// If we have pre-calculated the nextDOM node, use it. Else calculate it now\n\t// Strictly check for `undefined` here cuz `null` is a valid value of `nextDom`.\n\t// See more detail in create-element.js:createVNode\n\tif (nextDom !== undefined) {\n\t\toldDom = nextDom;\n\t} else {\n\t\toldDom = newDom.nextSibling;\n\t}\n\n\treturn oldDom;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport options from '../options';\n\n/**\n * Diff the old and new properties of a VNode and apply changes to the DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to apply\n * changes to\n * @param {object} newProps The new props\n * @param {object} oldProps The old props\n * @param {boolean} isSvg Whether or not this node is an SVG node\n * @param {boolean} hydrate Whether or not we are in hydration mode\n */\nexport function diffProps(dom, newProps, oldProps, isSvg, hydrate) {\n\tlet i;\n\n\tfor (i in oldProps) {\n\t\tif (i !== 'children' && i !== 'key' && !(i in newProps)) {\n\t\t\tsetProperty(dom, i, null, oldProps[i], isSvg);\n\t\t}\n\t}\n\n\tfor (i in newProps) {\n\t\tif (\n\t\t\t(!hydrate || typeof newProps[i] == 'function') &&\n\t\t\ti !== 'children' &&\n\t\t\ti !== 'key' &&\n\t\t\ti !== 'value' &&\n\t\t\ti !== 'checked' &&\n\t\t\toldProps[i] !== newProps[i]\n\t\t) {\n\t\t\tsetProperty(dom, i, newProps[i], oldProps[i], isSvg);\n\t\t}\n\t}\n}\n\nfunction setStyle(style, key, value) {\n\tif (key[0] === '-') {\n\t\tstyle.setProperty(key, value);\n\t} else if (value == null) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, isSvg) {\n\tlet useCapture;\n\n\to: if (name === 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] !== oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] === 'o' && name[1] === 'n') {\n\t\tuseCapture = name !== (name = name.replace(/Capture$/, ''));\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (name.toLowerCase() in dom) name = name.toLowerCase().slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\t\tdom.addEventListener(name, handler, useCapture);\n\t\t\t}\n\t\t} else {\n\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\tdom.removeEventListener(name, handler, useCapture);\n\t\t}\n\t} else if (name !== 'dangerouslySetInnerHTML') {\n\t\tif (isSvg) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname !== 'href' &&\n\t\t\tname !== 'list' &&\n\t\t\tname !== 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname !== 'tabIndex' &&\n\t\t\tname !== 'download' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// ARIA-attributes have a different notion of boolean values.\n\t\t// The value `false` is different from the attribute not\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\n\t\t// ARIA-attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost us too many bytes. On top of\n\t\t// that other VDOM frameworks also always stringify `false`.\n\n\t\tif (typeof value === 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != null && (value !== false || name.indexOf('-') != -1)) {\n\t\t\tdom.setAttribute(name, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n","import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, setProperty } from './props';\nimport { assign, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array<import('../internal').PreactElement>} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original === oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\tc.props = newProps;\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\n\t\t\t\t\tc._vnode = newVNode;\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._vnode = newVNode;\n\t\t\tc._parentDom = parentDom;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._hydrating = null;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array<import('../internal').Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\n\t\t}\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tArray.isArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// (as above, don't diff props during hydration)\n\t\tif (!isHydrating) {\n\t\t\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType === 'option' && i !== oldProps.value))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'value', i, oldProps.value, false);\n\t\t\t}\n\t\t\tif (\n\t\t\t\t'checked' in newProps &&\n\t\t\t\t(i = newProps.checked) !== undefined &&\n\t\t\t\ti !== dom.checked\n\t\t\t) {\n\t\t\t\tsetProperty(dom, 'checked', i, oldProps.checked, false);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} ref\n * @param {any} value\n * @param {import('../internal').VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') ref(value);\n\t\telse ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {import('../internal').VNode} vnode The virtual node to unmount\n * @param {import('../internal').VNode} parentVNode The parent of the VNode that\n * initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current === vnode._dom) {\n\t\t\tapplyRef(r, null, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != null) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = null;\n\t\tvnode._component = undefined;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(\n\t\t\t\t\tr[i],\n\t\t\t\t\tparentVNode,\n\t\t\t\t\tskipRemove || typeof vnode.type !== 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove && vnode._dom != null) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\t// Must be set to `undefined` to properly clean up `_nextDom`\n\t// for which `null` is a valid value. See comment in `create-element.js`\n\tvnode._parent = vnode._dom = vnode._nextDom = undefined;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { EMPTY_OBJ } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode === 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? null\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = (\n\t\t(!isHydrating && replaceNode) ||\n\t\tparentDom\n\t)._children = createElement(Fragment, null, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.ownerSVGElement !== undefined,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t? null\n\t\t\t: parentDom.firstChild\n\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t: null,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t? oldVNode._dom\n\t\t\t: parentDom.firstChild,\n\t\tisHydrating\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to\n * update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n","/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw\n * the error that was caught (except for unmounting when this parameter\n * is the highest parent that was being unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component, ctor, handled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != null) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != null) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n","import { options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\nlet EMPTY = [];\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\n\nconst RAF_TIMEOUT = 100;\nlet prevRaf;\n\noptions._diff = vnode => {\n\tif (\n\t\ttypeof vnode.type === 'function' &&\n\t\t!vnode._mask &&\n\t\t// Ignore root Fragment node\n\t\tvnode._parent !== null\n\t) {\n\t\tvnode._mask =\n\t\t\t(vnode._parent && vnode._parent._mask ? vnode._parent._mask : '') +\n\t\t\t(vnode._parent && vnode._parent._children\n\t\t\t\t? vnode._parent._children.indexOf(vnode)\n\t\t\t\t: 0);\n\t} else if (!vnode._mask) {\n\t\tvnode._mask =\n\t\t\tvnode._parent && vnode._parent._mask ? vnode._parent._mask : '';\n\t}\n\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.forEach(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingValue = EMPTY;\n\t\t\t\thookItem._nextValue = hookItem._pendingArgs = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.forEach(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\tif (hookItem._pendingValue !== EMPTY) {\n\t\t\t\thookItem._value = hookItem._pendingValue;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t\thookItem._pendingValue = EMPTY;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({ _pendingValue: EMPTY });\n\t}\n\treturn hooks._list[index];\n}\n\n/**\n * @param {import('./index').StateUpdater<any>} [initialState]\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @param {import('./index').Reducer<any, any>} reducer\n * @param {import('./index').StateUpdater<any>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ any, (state: any) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tconst prevScu = currentComponent.shouldComponentUpdate;\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\tcurrentComponent.shouldComponentUpdate = function(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\tconst stateHooks = hookState._component.__hooks._list.filter(\n\t\t\t\t\tx => x._component\n\t\t\t\t);\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x => !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = false;\n\t\t\t\tstateHooks.forEach(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn shouldUpdate || hookState._component.props !== p\n\t\t\t\t\t? prevScu\n\t\t\t\t\t\t? prevScu.call(this, p, s, c)\n\t\t\t\t\t\t: true\n\t\t\t\t\t: false;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {any[]} args\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tref(createHandle());\n\t\t\t\treturn () => ref(null);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @param {() => any} factory\n * @param {any[]} args\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._pendingValue = factory();\n\t\tstate._pendingArgs = args;\n\t\tstate._factory = factory;\n\t\treturn state._pendingValue;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {any[]} args\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\n\t}\n}\n\n/**\n * @param {(error: any, errorInfo: import('preact').ErrorInfo) => void} cb\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) => {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\nfunction hash(s) {\n\tlet h = 0,\n\t\ti = s.length;\n\twhile (i > 0) {\n\t\th = ((h << 5) - h + s.charCodeAt(--i)) | 0;\n\t}\n\treturn h;\n}\n\nexport function useId() {\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\tstate._value = 'P' + hash(currentComponent._vnode._mask) + currentIndex;\n\t}\n\n\treturn state._value;\n}\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom || !component.__hooks) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {any[]} oldArgs\n * @param {any[]} newArgs\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n","/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Check if two objects have a different shape\n * @param {object} a\n * @param {object} b\n * @returns {boolean}\n */\nexport function shallowDiffers(a, b) {\n\tfor (let i in a) if (i !== '__source' && !(i in b)) return true;\n\tfor (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;\n\treturn false;\n}\n\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n","import { Component } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Component class with a predefined `shouldComponentUpdate` implementation\n */\nexport function PureComponent(p) {\n\tthis.props = p;\n}\nPureComponent.prototype = new Component();\n// Some third-party libraries check if this property is present\nPureComponent.prototype.isPureReactComponent = true;\nPureComponent.prototype.shouldComponentUpdate = function(props, state) {\n\treturn shallowDiffers(this.props, props) || shallowDiffers(this.state, state);\n};\n","import { createElement } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Memoize a component, so that it only updates when the props actually have\n * changed. This was previously known as `React.pure`.\n * @param {import('./internal').FunctionComponent} c functional component\n * @param {(prev: object, next: object) => boolean} [comparer] Custom equality function\n * @returns {import('./internal').FunctionComponent}\n */\nexport function memo(c, comparer) {\n\tfunction shouldUpdate(nextProps) {\n\t\tlet ref = this.props.ref;\n\t\tlet updateRef = ref == nextProps.ref;\n\t\tif (!updateRef && ref) {\n\t\t\tref.call ? ref(null) : (ref.current = null);\n\t\t}\n\n\t\tif (!comparer) {\n\t\t\treturn shallowDiffers(this.props, nextProps);\n\t\t}\n\n\t\treturn !comparer(this.props, nextProps) || !updateRef;\n\t}\n\n\tfunction Memoed(props) {\n\t\tthis.shouldComponentUpdate = shouldUpdate;\n\t\treturn createElement(c, props);\n\t}\n\tMemoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';\n\tMemoed.prototype.isReactComponent = true;\n\tMemoed._forwarded = true;\n\treturn Memoed;\n}\n","import { options } from 'preact';\nimport { assign } from './util';\n\nlet oldDiffHook = options._diff;\noptions._diff = vnode => {\n\tif (vnode.type && vnode.type._forwarded && vnode.ref) {\n\t\tvnode.props.ref = vnode.ref;\n\t\tvnode.ref = null;\n\t}\n\tif (oldDiffHook) oldDiffHook(vnode);\n};\n\nexport const REACT_FORWARD_SYMBOL =\n\t(typeof Symbol != 'undefined' &&\n\t\tSymbol.for &&\n\t\tSymbol.for('react.forward_ref')) ||\n\t0xf47;\n\n/**\n * Pass ref down to a child. This is mainly used in libraries with HOCs that\n * wrap components. Using `forwardRef` there is an easy way to get a reference\n * of the wrapped component instead of one of the wrapper itself.\n * @param {import('./index').ForwardFn} fn\n * @returns {import('./internal').FunctionComponent}\n */\nexport function forwardRef(fn) {\n\tfunction Forwarded(props) {\n\t\tlet clone = assign({}, props);\n\t\tdelete clone.ref;\n\t\treturn fn(clone, props.ref || null);\n\t}\n\n\t// mobx-react checks for this being present\n\tForwarded.$$typeof = REACT_FORWARD_SYMBOL;\n\t// mobx-react heavily relies on implementation details.\n\t// It expects an object here with a `render` property,\n\t// and prototype.render will fail. Without this\n\t// mobx-react throws.\n\tForwarded.render = Forwarded;\n\n\tForwarded.prototype.isReactComponent = Forwarded._forwarded = true;\n\tForwarded.displayName = 'ForwardRef(' + (fn.displayName || fn.name) + ')';\n\treturn Forwarded;\n}\n","import { toChildArray } from 'preact';\n\nconst mapFn = (children, fn) => {\n\tif (children == null) return null;\n\treturn toChildArray(toChildArray(children).map(fn));\n};\n\n// This API is completely unnecessary for Preact, so it's basically passthrough.\nexport const Children = {\n\tmap: mapFn,\n\tforEach: mapFn,\n\tcount(children) {\n\t\treturn children ? toChildArray(children).length : 0;\n\t},\n\tonly(children) {\n\t\tconst normalized = toChildArray(children);\n\t\tif (normalized.length !== 1) throw 'Children.only';\n\t\treturn normalized[0];\n\t},\n\ttoArray: toChildArray\n};\n","import { Component, createElement, options, Fragment } from 'preact';\nimport { assign } from './util';\n\nconst oldCatchError = options._catchError;\noptions._catchError = function(error, newVNode, oldVNode, errorInfo) {\n\tif (error.then) {\n\t\t/** @type {import('./internal').Component} */\n\t\tlet component;\n\t\tlet vnode = newVNode;\n\n\t\tfor (; (vnode = vnode._parent); ) {\n\t\t\tif ((component = vnode._component) && component._childDidSuspend) {\n\t\t\t\tif (newVNode._dom == null) {\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t}\n\t\t\t\t// Don't call oldCatchError if we found a Suspense\n\t\t\t\treturn component._childDidSuspend(error, newVNode);\n\t\t\t}\n\t\t}\n\t}\n\toldCatchError(error, newVNode, oldVNode, errorInfo);\n};\n\nconst oldUnmount = options.unmount;\noptions.unmount = function(vnode) {\n\t/** @type {import('./internal').Component} */\n\tconst component = vnode._component;\n\tif (component && component._onResolve) {\n\t\tcomponent._onResolve();\n\t}\n\n\t// if the component is still hydrating\n\t// most likely it is because the component is suspended\n\t// we set the vnode.type as `null` so that it is not a typeof function\n\t// so the unmount will remove the vnode._dom\n\tif (component && vnode._hydrating === true) {\n\t\tvnode.type = null;\n\t}\n\n\tif (oldUnmount) oldUnmount(vnode);\n};\n\nfunction detachedClone(vnode, detachedParent, parentDom) {\n\tif (vnode) {\n\t\tif (vnode._component && vnode._component.__hooks) {\n\t\t\tvnode._component.__hooks._list.forEach(effect => {\n\t\t\t\tif (typeof effect._cleanup == 'function') effect._cleanup();\n\t\t\t});\n\n\t\t\tvnode._component.__hooks = null;\n\t\t}\n\n\t\tvnode = assign({}, vnode);\n\t\tif (vnode._component != null) {\n\t\t\tif (vnode._component._parentDom === parentDom) {\n\t\t\t\tvnode._component._parentDom = detachedParent;\n\t\t\t}\n\t\t\tvnode._component = null;\n\t\t}\n\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tdetachedClone(child, detachedParent, parentDom)\n\t\t\t);\n\t}\n\n\treturn vnode;\n}\n\nfunction removeOriginal(vnode, detachedParent, originalParent) {\n\tif (vnode) {\n\t\tvnode._original = null;\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tremoveOriginal(child, detachedParent, originalParent)\n\t\t\t);\n\n\t\tif (vnode._component) {\n\t\t\tif (vnode._component._parentDom === detachedParent) {\n\t\t\t\tif (vnode._dom) {\n\t\t\t\t\toriginalParent.insertBefore(vnode._dom, vnode._nextDom);\n\t\t\t\t}\n\t\t\t\tvnode._component._force = true;\n\t\t\t\tvnode._component._parentDom = originalParent;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn vnode;\n}\n\n// having custom inheritance instead of a class here saves a lot of bytes\nexport function Suspense() {\n\t// we do not call super here to golf some bytes...\n\tthis._pendingSuspensionCount = 0;\n\tthis._suspenders = null;\n\tthis._detachOnNextRender = null;\n}\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspense.prototype = new Component();\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {Promise} promise The thrown promise\n * @param {import('./internal').VNode<any, any>} suspendingVNode The suspending component\n */\nSuspense.prototype._childDidSuspend = function(promise, suspendingVNode) {\n\tconst suspendingComponent = suspendingVNode._component;\n\n\t/** @type {import('./internal').SuspenseComponent} */\n\tconst c = this;\n\n\tif (c._suspenders == null) {\n\t\tc._suspenders = [];\n\t}\n\tc._suspenders.push(suspendingComponent);\n\n\tconst resolve = suspended(c._vnode);\n\n\tlet resolved = false;\n\tconst onResolved = () => {\n\t\tif (resolved) return;\n\n\t\tresolved = true;\n\t\tsuspendingComponent._onResolve = null;\n\n\t\tif (resolve) {\n\t\t\tresolve(onSuspensionComplete);\n\t\t} else {\n\t\t\tonSuspensionComplete();\n\t\t}\n\t};\n\n\tsuspendingComponent._onResolve = onResolved;\n\n\tconst onSuspensionComplete = () => {\n\t\tif (!--c._pendingSuspensionCount) {\n\t\t\t// If the suspension was during hydration we don't need to restore the\n\t\t\t// suspended children into the _children array\n\t\t\tif (c.state._suspended) {\n\t\t\t\tconst suspendedVNode = c.state._suspended;\n\t\t\t\tc._vnode._children[0] = removeOriginal(\n\t\t\t\t\tsuspendedVNode,\n\t\t\t\t\tsuspendedVNode._component._parentDom,\n\t\t\t\t\tsuspendedVNode._component._originalParentDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tc.setState({ _suspended: (c._detachOnNextRender = null) });\n\n\t\t\tlet suspended;\n\t\t\twhile ((suspended = c._suspenders.pop())) {\n\t\t\t\tsuspended.forceUpdate();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * We do not set `suspended: true` during hydration because we want the actual markup\n\t * to remain on screen and hydrate it when the suspense actually gets resolved.\n\t * While in non-hydration cases the usual fallback -> component flow would occour.\n\t */\n\tconst wasHydrating = suspendingVNode._hydrating === true;\n\tif (!c._pendingSuspensionCount++ && !wasHydrating) {\n\t\tc.setState({ _suspended: (c._detachOnNextRender = c._vnode._children[0]) });\n\t}\n\tpromise.then(onResolved, onResolved);\n};\n\nSuspense.prototype.componentWillUnmount = function() {\n\tthis._suspenders = [];\n};\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {import('./internal').SuspenseComponent[\"props\"]} props\n * @param {import('./internal').SuspenseState} state\n */\nSuspense.prototype.render = function(props, state) {\n\tif (this._detachOnNextRender) {\n\t\t// When the Suspense's _vnode was created by a call to createVNode\n\t\t// (i.e. due to a setState further up in the tree)\n\t\t// it's _children prop is null, in this case we \"forget\" about the parked vnodes to detach\n\t\tif (this._vnode._children) {\n\t\t\tconst detachedParent = document.createElement('div');\n\t\t\tconst detachedComponent = this._vnode._children[0]._component;\n\t\t\tthis._vnode._children[0] = detachedClone(\n\t\t\t\tthis._detachOnNextRender,\n\t\t\t\tdetachedParent,\n\t\t\t\t(detachedComponent._originalParentDom = detachedComponent._parentDom)\n\t\t\t);\n\t\t}\n\n\t\tthis._detachOnNextRender = null;\n\t}\n\n\t// Wrap fallback tree in a VNode that prevents itself from being marked as aborting mid-hydration:\n\t/** @type {import('./internal').VNode} */\n\tconst fallback =\n\t\tstate._suspended && createElement(Fragment, null, props.fallback);\n\tif (fallback) fallback._hydrating = null;\n\n\treturn [\n\t\tcreateElement(Fragment, null, state._suspended ? null : props.children),\n\t\tfallback\n\t];\n};\n\n/**\n * Checks and calls the parent component's _suspended method, passing in the\n * suspended vnode. This is a way for a parent (e.g. SuspenseList) to get notified\n * that one of its children/descendants suspended.\n *\n * The parent MAY return a callback. The callback will get called when the\n * suspension resolves, notifying the parent of the fact.\n * Moreover, the callback gets function `unsuspend` as a parameter. The resolved\n * child descendant will not actually get unsuspended until `unsuspend` gets called.\n * This is a way for the parent to delay unsuspending.\n *\n * If the parent does not return a callback then the resolved vnode\n * gets unsuspended immediately when it resolves.\n *\n * @param {import('./internal').VNode} vnode\n * @returns {((unsuspend: () => void) => void)?}\n */\nexport function suspended(vnode) {\n\t/** @type {import('./internal').Component} */\n\tlet component = vnode._parent._component;\n\treturn component && component._suspended && component._suspended(vnode);\n}\n\nexport function lazy(loader) {\n\tlet prom;\n\tlet component;\n\tlet error;\n\n\tfunction Lazy(props) {\n\t\tif (!prom) {\n\t\t\tprom = loader();\n\t\t\tprom.then(\n\t\t\t\texports => {\n\t\t\t\t\tcomponent = exports.default || exports;\n\t\t\t\t},\n\t\t\t\te => {\n\t\t\t\t\terror = e;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!component) {\n\t\t\tthrow prom;\n\t\t}\n\n\t\treturn createElement(component, props);\n\t}\n\n\tLazy.displayName = 'Lazy';\n\tLazy._forwarded = true;\n\treturn Lazy;\n}\n","import { Component, toChildArray } from 'preact';\nimport { suspended } from './suspense.js';\n\n// Indexes to linked list nodes (nodes are stored as arrays to save bytes).\nconst SUSPENDED_COUNT = 0;\nconst RESOLVED_COUNT = 1;\nconst NEXT_NODE = 2;\n\n// Having custom inheritance instead of a class here saves a lot of bytes.\nexport function SuspenseList() {\n\tthis._next = null;\n\tthis._map = null;\n}\n\n// Mark one of child's earlier suspensions as resolved.\n// Some pending callbacks may become callable due to this\n// (e.g. the last suspended descendant gets resolved when\n// revealOrder === 'together'). Process those callbacks as well.\nconst resolve = (list, child, node) => {\n\tif (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {\n\t\t// The number a child (or any of its descendants) has been suspended\n\t\t// matches the number of times it's been resolved. Therefore we\n\t\t// mark the child as completely resolved by deleting it from ._map.\n\t\t// This is used to figure out when *all* children have been completely\n\t\t// resolved when revealOrder is 'together'.\n\t\tlist._map.delete(child);\n\t}\n\n\t// If revealOrder is falsy then we can do an early exit, as the\n\t// callbacks won't get queued in the node anyway.\n\t// If revealOrder is 'together' then also do an early exit\n\t// if all suspended descendants have not yet been resolved.\n\tif (\n\t\t!list.props.revealOrder ||\n\t\t(list.props.revealOrder[0] === 't' && list._map.size)\n\t) {\n\t\treturn;\n\t}\n\n\t// Walk the currently suspended children in order, calling their\n\t// stored callbacks on the way. Stop if we encounter a child that\n\t// has not been completely resolved yet.\n\tnode = list._next;\n\twhile (node) {\n\t\twhile (node.length > 3) {\n\t\t\tnode.pop()();\n\t\t}\n\t\tif (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {\n\t\t\tbreak;\n\t\t}\n\t\tlist._next = node = node[NEXT_NODE];\n\t}\n};\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspenseList.prototype = new Component();\n\nSuspenseList.prototype._suspended = function(child) {\n\tconst list = this;\n\tconst delegated = suspended(list._vnode);\n\n\tlet node = list._map.get(child);\n\tnode[SUSPENDED_COUNT]++;\n\n\treturn unsuspend => {\n\t\tconst wrappedUnsuspend = () => {\n\t\t\tif (!list.props.revealOrder) {\n\t\t\t\t// Special case the undefined (falsy) revealOrder, as there\n\t\t\t\t// is no need to coordinate a specific order or unsuspends.\n\t\t\t\tunsuspend();\n\t\t\t} else {\n\t\t\t\tnode.push(unsuspend);\n\t\t\t\tresolve(list, child, node);\n\t\t\t}\n\t\t};\n\t\tif (delegated) {\n\t\t\tdelegated(wrappedUnsuspend);\n\t\t} else {\n\t\t\twrappedUnsuspend();\n\t\t}\n\t};\n};\n\nSuspenseList.prototype.render = function(props) {\n\tthis._next = null;\n\tthis._map = new Map();\n\n\tconst children = toChildArray(props.children);\n\tif (props.revealOrder && props.revealOrder[0] === 'b') {\n\t\t// If order === 'backwards' (or, well, anything starting with a 'b')\n\t\t// then flip the child list around so that the last child will be\n\t\t// the first in the linked list.\n\t\tchildren.reverse();\n\t}\n\t// Build the linked list. Iterate through the children in reverse order\n\t// so that `_next` points to the first linked list node to be resolved.\n\tfor (let i = children.length; i--; ) {\n\t\t// Create a new linked list node as an array of form:\n\t\t// \t[suspended_count, resolved_count, next_node]\n\t\t// where suspended_count and resolved_count are numeric counters for\n\t\t// keeping track how many times a node has been suspended and resolved.\n\t\t//\n\t\t// Note that suspended_count starts from 1 instead of 0, so we can block\n\t\t// processing callbacks until componentDidMount has been called. In a sense\n\t\t// node is suspended at least until componentDidMount gets called!\n\t\t//\n\t\t// Pending callbacks are added to the end of the node:\n\t\t// \t[suspended_count, resolved_count, next_node, callback_0, callback_1, ...]\n\t\tthis._map.set(children[i], (this._next = [1, 0, this._next]));\n\t}\n\treturn props.children;\n};\n\nSuspenseList.prototype.componentDidUpdate = SuspenseList.prototype.componentDidMount = function() {\n\t// Iterate through all children after mounting for two reasons:\n\t// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases\n\t// each node[RELEASED_COUNT] by 1, therefore balancing the counters.\n\t// The nodes can now be completely consumed from the linked list.\n\t// 2. Handle nodes that might have gotten resolved between render and\n\t// componentDidMount.\n\tthis._map.forEach((node, child) => {\n\t\tresolve(this, child, node);\n\t});\n};\n","import {\n\trender as preactRender,\n\thydrate as preactHydrate,\n\toptions,\n\ttoChildArray,\n\tComponent\n} from 'preact';\n\nexport const REACT_ELEMENT_TYPE =\n\t(typeof Symbol != 'undefined' && Symbol.for && Symbol.for('react.element')) ||\n\t0xeac7;\n\nconst CAMEL_PROPS = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;\n\nconst IS_DOM = typeof document !== 'undefined';\n\n// Input types for which onchange should not be converted to oninput.\n// type=\"file|checkbox|radio\", plus \"range\" in IE11.\n// (IE11 doesn't support Symbol, which we use here to turn `rad` into `ra` which matches \"range\")\nconst onChangeInputType = type =>\n\t(typeof Symbol != 'undefined' && typeof Symbol() == 'symbol'\n\t\t? /fil|che|rad/i\n\t\t: /fil|che|ra/i\n\t).test(type);\n\n// Some libraries like `react-virtualized` explicitly check for this.\nComponent.prototype.isReactComponent = {};\n\n// `UNSAFE_*` lifecycle hooks\n// Preact only ever invokes the unprefixed methods.\n// Here we provide a base \"fallback\" implementation that calls any defined UNSAFE_ prefixed method.\n// - If a component defines its own `componentDidMount()` (including via defineProperty), use that.\n// - If a component defines `UNSAFE_componentDidMount()`, `componentDidMount` is the alias getter/setter.\n// - If anything assigns to an `UNSAFE_*` property, the assignment is forwarded to the unprefixed property.\n// See https://github.com/preactjs/preact/issues/1941\n[\n\t'componentWillMount',\n\t'componentWillReceiveProps',\n\t'componentWillUpdate'\n].forEach(key => {\n\tObject.defineProperty(Component.prototype, key, {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn this['UNSAFE_' + key];\n\t\t},\n\t\tset(v) {\n\t\t\tObject.defineProperty(this, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: v\n\t\t\t});\n\t\t}\n\t});\n});\n\n/**\n * Proxy render() since React returns a Component reference.\n * @param {import('./internal').VNode} vnode VNode tree to render\n * @param {import('./internal').PreactElement} parent DOM node to render vnode tree into\n * @param {() => void} [callback] Optional callback that will be called after rendering\n * @returns {import('./internal').Component | null} The root component reference or null\n */\nexport function render(vnode, parent, callback) {\n\t// React destroys any existing DOM nodes, see #1727\n\t// ...but only on the first render, see #1828\n\tif (parent._children == null) {\n\t\tparent.textContent = '';\n\t}\n\n\tpreactRender(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nexport function hydrate(vnode, parent, callback) {\n\tpreactHydrate(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nlet oldEventHook = options.event;\noptions.event = e => {\n\tif (oldEventHook) e = oldEventHook(e);\n\te.persist = empty;\n\te.isPropagationStopped = isPropagationStopped;\n\te.isDefaultPrevented = isDefaultPrevented;\n\treturn (e.nativeEvent = e);\n};\n\nfunction empty() {}\n\nfunction isPropagationStopped() {\n\treturn this.cancelBubble;\n}\n\nfunction isDefaultPrevented() {\n\treturn this.defaultPrevented;\n}\n\nlet classNameDescriptor = {\n\tconfigurable: true,\n\tget() {\n\t\treturn this.class;\n\t}\n};\n\nlet oldVNodeHook = options.vnode;\noptions.vnode = vnode => {\n\tlet type = vnode.type;\n\tlet props = vnode.props;\n\tlet normalizedProps = props;\n\n\t// only normalize props on Element nodes\n\tif (typeof type === 'string') {\n\t\tconst nonCustomElement = type.indexOf('-') === -1;\n\t\tnormalizedProps = {};\n\n\t\tfor (let i in props) {\n\t\t\tlet value = props[i];\n\n\t\t\tif (IS_DOM && i === 'children' && type === 'noscript') {\n\t\t\t\t// Emulate React's behavior of not rendering the contents of noscript tags on the client.\n\t\t\t\tcontinue;\n\t\t\t} else if (i === 'value' && 'defaultValue' in props && value == null) {\n\t\t\t\t// Skip applying value if it is null/undefined and we already set\n\t\t\t\t// a default value\n\t\t\t\tcontinue;\n\t\t\t} else if (\n\t\t\t\ti === 'defaultValue' &&\n\t\t\t\t'value' in props &&\n\t\t\t\tprops.value == null\n\t\t\t) {\n\t\t\t\t// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.\n\t\t\t\t// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.\n\t\t\t\ti = 'value';\n\t\t\t} else if (i === 'download' && value === true) {\n\t\t\t\t// Calling `setAttribute` with a truthy value will lead to it being\n\t\t\t\t// passed as a stringified value, e.g. `download=\"true\"`. React\n\t\t\t\t// converts it to an empty string instead, otherwise the attribute\n\t\t\t\t// value will be used as the file name and the file will be called\n\t\t\t\t// \"true\" upon downloading it.\n\t\t\t\tvalue = '';\n\t\t\t} else if (/ondoubleclick/i.test(i)) {\n\t\t\t\ti = 'ondblclick';\n\t\t\t} else if (\n\t\t\t\t/^onchange(textarea|input)/i.test(i + type) &&\n\t\t\t\t!onChangeInputType(props.type)\n\t\t\t) {\n\t\t\t\ti = 'oninput';\n\t\t\t} else if (/^onfocus$/i.test(i)) {\n\t\t\t\ti = 'onfocusin';\n\t\t\t} else if (/^onblur$/i.test(i)) {\n\t\t\t\ti = 'onfocusout';\n\t\t\t} else if (/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)) {\n\t\t\t\ti = i.toLowerCase();\n\t\t\t} else if (nonCustomElement && CAMEL_PROPS.test(i)) {\n\t\t\t\ti = i.replace(/[A-Z0-9]/g, '-$&').toLowerCase();\n\t\t\t} else if (value === null) {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\n\t\t\t// Add support for onInput and onChange, see #3561\n\t\t\t// if we have an oninput prop already change it to oninputCapture\n\t\t\tif (/^oninput$/i.test(i)) {\n\t\t\t\ti = i.toLowerCase();\n\t\t\t\tif (normalizedProps[i]) {\n\t\t\t\t\ti = 'oninputCapture';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnormalizedProps[i] = value;\n\t\t}\n\n\t\t// Add support for array select values: <select multiple value={[]} />\n\t\tif (\n\t\t\ttype == 'select' &&\n\t\t\tnormalizedProps.multiple &&\n\t\t\tArray.isArray(normalizedProps.value)\n\t\t) {\n\t\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t\t});\n\t\t}\n\n\t\t// Adding support for defaultValue in select tag\n\t\tif (type == 'select' && normalizedProps.defaultValue != null) {\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tif (normalizedProps.multiple) {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t\t} else {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tvnode.props = normalizedProps;\n\n\t\tif (props.class != props.className) {\n\t\t\tclassNameDescriptor.enumerable = 'className' in props;\n\t\t\tif (props.className != null) normalizedProps.class = props.className;\n\t\t\tObject.defineProperty(normalizedProps, 'className', classNameDescriptor);\n\t\t}\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function(vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection. So far\n// only `react-relay` makes use of it. It uses it to read the\n// context value.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t}\n\t\t}\n\t}\n};\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f);else for(t in e)e[t]&&(n&&(n+=\" \"),n+=t);return n}export function clsx(){for(var e,t,f=0,n=\"\";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__self]\n * @param {string} [__source]\n */\nfunction createVNode(type, props, key, __self, __source) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n","import { css } from '@linaria/core';\n\nexport const cell = css`\n @layer rdg.Cell {\n /* max-content does not work with size containment\n * dynamically switching between different containment styles incurs a heavy relayout penalty\n * Chromium bug: at odd zoom levels or subpixel positioning, layout/paint containment can make cell borders disappear\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1326946\n */\n contain: style;\n position: relative; /* needed for absolute positioning to work */\n padding-block: 0;\n padding-inline: 8px;\n border-inline-end: 1px solid var(--rdg-border-color);\n border-block-end: 1px solid var(--rdg-border-color);\n grid-row-start: var(--rdg-grid-row-start);\n background-color: inherit;\n\n white-space: nowrap;\n overflow: hidden;\n overflow: clip;\n text-overflow: ellipsis;\n outline: none;\n\n &[aria-selected='true'] {\n outline: 2px solid var(--rdg-selection-color);\n outline-offset: -2px;\n }\n }\n`;\n\nexport const cellClassname = `rdg-cell ${cell}`;\n\nexport const cellFrozen = css`\n @layer rdg.Cell {\n position: sticky;\n /* Should have a higher value than 0 to show up above unfrozen cells */\n z-index: 1;\n }\n`;\n\nexport const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;\n\nexport const cellFrozenLast = css`\n @layer rdg.Cell {\n box-shadow: calc(2px * var(--rdg-sign)) 0 5px -2px rgba(136, 136, 136, 0.3);\n }\n`;\n\nexport const cellFrozenLastClassname = `rdg-cell-frozen-last ${cellFrozenLast}`;\n","import { css } from '@linaria/core';\n\nexport const row = css`\n @layer rdg.Row {\n display: contents;\n line-height: var(--rdg-row-height);\n background-color: var(--rdg-background-color);\n\n &:hover {\n background-color: var(--rdg-row-hover-background-color);\n }\n\n &[aria-selected='true'] {\n background-color: var(--rdg-row-selected-background-color);\n\n &:hover {\n background-color: var(--rdg-row-selected-hover-background-color);\n }\n }\n }\n`;\n\nexport const rowClassname = `rdg-row ${row}`;\n\nexport const rowSelected = css`\n @layer rdg.FocusSink {\n outline: 2px solid var(--rdg-selection-color);\n outline-offset: -2px;\n }\n`;\n\nexport const rowSelectedClassname = `rdg-row-selected`;\n\nexport const rowSelectedWithFrozenCell = css`\n @layer rdg.FocusSink {\n &::before {\n content: '';\n display: inline-block;\n height: 100%;\n position: sticky;\n inset-inline-start: 0;\n border-inline-start: 2px solid var(--rdg-selection-color);\n }\n }\n`;\n","import clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport type { CheckboxFormatterProps } from '../types';\n\nconst checkboxLabel = css`\n @layer rdg.CheckboxLabel {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n inset: 0;\n margin-inline-end: 1px; /* align checkbox in row group cell */\n }\n`;\n\nconst checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;\n\nconst checkboxInput = css`\n @layer rdg.CheckboxInput {\n all: unset;\n }\n`;\n\nconst checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;\n\nconst checkbox = css`\n @layer rdg.CheckboxIcon {\n content: '';\n inline-size: 20px;\n block-size: 20px;\n border: 2px solid var(--rdg-border-color);\n background-color: var(--rdg-background-color);\n\n .${checkboxInput}:checked + & {\n background-color: var(--rdg-checkbox-color);\n outline: 4px solid var(--rdg-background-color);\n outline-offset: -6px;\n }\n\n .${checkboxInput}:focus + & {\n border-color: var(--rdg-checkbox-focus-color);\n }\n }\n`;\n\nconst checkboxClassname = `rdg-checkbox ${checkbox}`;\n\nconst checkboxLabelDisabled = css`\n @layer rdg.CheckboxLabel {\n cursor: default;\n\n .${checkbox} {\n border-color: var(--rdg-checkbox-disabled-border-color);\n background-color: var(--rdg-checkbox-disabled-background-color);\n }\n }\n`;\n\nconst checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;\n\nexport function checkboxFormatter(\n { onChange, ...props }: CheckboxFormatterProps,\n ref: React.RefObject<HTMLInputElement>\n) {\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n onChange(e.target.checked, (e.nativeEvent as MouseEvent).shiftKey);\n }\n\n return (\n <label\n className={clsx(checkboxLabelClassname, {\n [checkboxLabelDisabledClassname]: props.disabled\n })}\n >\n <input\n type=\"checkbox\"\n ref={ref}\n {...props}\n className={checkboxInputClassname}\n onChange={handleChange}\n />\n <div className={checkboxClassname} />\n </label>\n );\n}\n","// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport { useEffect, useLayoutEffect as useOriginalLayoutEffect } from 'react';\n\n// Silence silly warning\n// https://reactjs.org/link/uselayouteffect-ssr\nexport const useLayoutEffect = typeof window === 'undefined' ? useEffect : useOriginalLayoutEffect;\n","import { useRef } from 'react';\nimport { useLayoutEffect } from './useLayoutEffect';\n\nexport function useFocusRef<T extends HTMLOrSVGElement>(isSelected: boolean) {\n const ref = useRef<T>(null);\n\n useLayoutEffect(() => {\n if (!isSelected) return;\n ref.current?.focus({ preventScroll: true });\n }, [isSelected]);\n\n return {\n ref,\n tabIndex: isSelected ? 0 : -1\n };\n}\n","import { createContext, useContext } from 'react';\n\nimport type { Renderers, Maybe } from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst DataGridDefaultComponentsContext = createContext<Maybe<Renderers<any, any>>>(undefined);\n\nexport const DataGridDefaultComponentsProvider = DataGridDefaultComponentsContext.Provider;\n\nexport function useDefaultComponents<R, SR>(): Maybe<Renderers<R, SR>> {\n return useContext(DataGridDefaultComponentsContext);\n}\n","import { useFocusRef } from '../hooks/useFocusRef';\nimport { useDefaultComponents } from '../DataGridDefaultComponentsProvider';\nimport type { CheckboxFormatterProps } from '../types';\n\ntype SharedInputProps = Pick<CheckboxFormatterProps, 'disabled' | 'aria-label' | 'aria-labelledby'>;\n\ninterface SelectCellFormatterProps extends SharedInputProps {\n isCellSelected: boolean;\n value: boolean;\n onChange: (value: boolean, isShiftClick: boolean) => void;\n}\n\nexport function SelectCellFormatter({\n value,\n isCellSelected,\n disabled,\n onChange,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n}: SelectCellFormatterProps) {\n const { ref, tabIndex } = useFocusRef<HTMLInputElement>(isCellSelected);\n const checkboxFormatter = useDefaultComponents()!.checkboxFormatter!;\n\n return (\n <>\n {checkboxFormatter(\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n tabIndex,\n disabled,\n checked: value,\n onChange\n },\n ref\n )}\n </>\n );\n}\n","import type { FormatterProps } from '../types';\n\nexport function valueFormatter<R, SR>(props: FormatterProps<R, SR>) {\n try {\n return <>{props.row[props.column.key as keyof R]}</>;\n } catch {\n return null;\n }\n}\n","import { css } from '@linaria/core';\nimport type { GroupFormatterProps } from '../types';\nimport { useFocusRef } from '../hooks/useFocusRef';\n\nconst groupCellContent = css`\n @layer rdg.GroupCellContent {\n outline: none;\n }\n`;\n\nconst groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;\n\nconst caret = css`\n @layer rdg.GroupCellCaret {\n margin-inline-start: 4px;\n stroke: currentColor;\n stroke-width: 1.5px;\n fill: transparent;\n vertical-align: middle;\n\n > path {\n transition: d 0.1s;\n }\n }\n`;\n\nconst caretClassname = `rdg-caret ${caret}`;\n\nexport function toggleGroupFormatter<R, SR>(props: GroupFormatterProps<R, SR>) {\n return <ToggleGroup {...props} />;\n}\n\nexport function ToggleGroup<R, SR>({\n groupKey,\n isExpanded,\n isCellSelected,\n toggleGroup\n}: GroupFormatterProps<R, SR>) {\n const { ref, tabIndex } = useFocusRef<HTMLSpanElement>(isCellSelected);\n\n function handleKeyDown({ key }: React.KeyboardEvent<HTMLSpanElement>) {\n if (key === 'Enter') {\n toggleGroup();\n }\n }\n\n const d = isExpanded ? 'M1 1 L 7 7 L 13 1' : 'M1 7 L 7 1 L 13 7';\n\n return (\n <span\n ref={ref}\n className={groupCellContentClassname}\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n >\n {groupKey as string}\n <svg viewBox=\"0 0 14 8\" width=\"14\" height=\"8\" className={caretClassname} aria-hidden>\n <path d={d} />\n </svg>\n </span>\n );\n}\n","import { createContext, useContext } from 'react';\nimport type { SelectRowEvent } from '../types';\n\nconst RowSelectionContext = createContext<boolean | undefined>(undefined);\n\nexport const RowSelectionProvider = RowSelectionContext.Provider;\n\nconst RowSelectionChangeContext = createContext<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((selectRowEvent: SelectRowEvent<any>) => void) | undefined\n>(undefined);\n\nexport const RowSelectionChangeProvider = RowSelectionChangeContext.Provider;\n\nexport function useRowSelection<R>(): [boolean, (selectRowEvent: SelectRowEvent<R>) => void] {\n const rowSelectionContext = useContext(RowSelectionContext);\n const rowSelectionChangeContext = useContext(RowSelectionChangeContext);\n\n if (rowSelectionContext === undefined || rowSelectionChangeContext === undefined) {\n throw new Error('useRowSelection must be used within DataGrid cells');\n }\n\n return [rowSelectionContext, rowSelectionChangeContext];\n}\n","import { SelectCellFormatter } from './formatters';\nimport { useRowSelection } from './hooks/useRowSelection';\nimport type { Column, FormatterProps, GroupFormatterProps } from './types';\n\nexport const SELECT_COLUMN_KEY = 'select-row';\n\nfunction SelectFormatter(props: FormatterProps<unknown>) {\n const [isRowSelected, onRowSelectionChange] = useRowSelection();\n\n return (\n <SelectCellFormatter\n aria-label=\"Select\"\n isCellSelected={props.isCellSelected}\n value={isRowSelected}\n onChange={(checked, isShiftClick) => {\n onRowSelectionChange({ row: props.row, checked, isShiftClick });\n }}\n />\n );\n}\n\nfunction SelectGroupFormatter(props: GroupFormatterProps<unknown>) {\n const [isRowSelected, onRowSelectionChange] = useRowSelection();\n\n return (\n <SelectCellFormatter\n aria-label=\"Select Group\"\n isCellSelected={props.isCellSelected}\n value={isRowSelected}\n onChange={(checked) => {\n onRowSelectionChange({ row: props.row, checked, isShiftClick: false });\n }}\n />\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const SelectColumn: Column<any, any> = {\n key: SELECT_COLUMN_KEY,\n name: '',\n width: 35,\n minWidth: 35,\n maxWidth: 35,\n resizable: false,\n sortable: false,\n frozen: true,\n headerRenderer(props) {\n return (\n <SelectCellFormatter\n aria-label=\"Select All\"\n isCellSelected={props.isCellSelected}\n value={props.allRowsSelected}\n onChange={props.onAllRowsSelectionChange}\n />\n );\n },\n formatter(props) {\n return <SelectFormatter {...props} />;\n },\n groupFormatter(props) {\n return <SelectGroupFormatter {...props} />;\n }\n};\n","import type { CalculatedColumn, ColSpanArgs } from '../types';\n\nexport function getColSpan<R, SR>(\n column: CalculatedColumn<R, SR>,\n lastFrozenColumnIndex: number,\n args: ColSpanArgs<R, SR>\n): number | undefined {\n const colSpan = typeof column.colSpan === 'function' ? column.colSpan(args) : 1;\n if (\n Number.isInteger(colSpan) &&\n colSpan! > 1 &&\n // ignore colSpan if it spans over both frozen and regular columns\n (!column.frozen || column.idx + colSpan! - 1 <= lastFrozenColumnIndex)\n ) {\n return colSpan!;\n }\n return undefined;\n}\n","import type { Maybe } from '../types';\n\nexport function stopPropagation(event: React.SyntheticEvent) {\n event.stopPropagation();\n}\n\nexport function scrollIntoView(element: Maybe<HTMLDivElement>) {\n element?.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n}\n","// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values\nconst nonInputKeys = new Set([\n // Special keys\n 'Unidentified',\n // Modifier keys\n 'Alt',\n 'AltGraph',\n 'CapsLock',\n 'Control',\n 'Fn',\n 'FnLock',\n 'Meta',\n 'NumLock',\n 'ScrollLock',\n 'Shift',\n // Whitespace keys\n 'Tab',\n // Navigation keys\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'End',\n 'Home',\n 'PageDown',\n 'PageUp',\n // Editing\n 'Insert',\n // UI keys\n 'ContextMenu',\n 'Escape',\n 'Pause',\n 'Play',\n // Device keys\n 'PrintScreen',\n // Function keys\n 'F1',\n // 'F2', /!\\ specifically allowed, do not edit\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'F10',\n 'F11',\n 'F12'\n]);\n\nexport function isCtrlKeyHeldDown(e: React.KeyboardEvent): boolean {\n return (e.ctrlKey || e.metaKey) && e.key !== 'Control';\n}\n\nexport function isDefaultCellInput(event: React.KeyboardEvent<HTMLDivElement>): boolean {\n return !nonInputKeys.has(event.key);\n}\n\n/**\n * By default, the following navigation keys are enabled while an editor is open, under specific conditions:\n * - Tab:\n * - The editor must be an <input>, a <textarea>, or a <select> element.\n * - The editor element must be the only immediate child of the editor container/a label.\n */\nexport function onEditorNavigation({ key, target }: React.KeyboardEvent<HTMLDivElement>): boolean {\n if (\n key === 'Tab' &&\n (target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement)\n ) {\n return target.matches(\n '.rdg-editor-container > :only-child, .rdg-editor-container > label:only-child > :only-child'\n );\n }\n return false;\n}\n","import { css } from '@linaria/core';\nimport type { CalculatedColumn } from '../types';\n\nconst measuringCellClassname = css`\n @layer rdg.MeasuringCell {\n contain: strict;\n grid-row: 1;\n visibility: hidden;\n }\n`;\n\nexport function renderMeasuringCells<R, SR>(viewportColumns: readonly CalculatedColumn<R, SR>[]) {\n return (\n <>\n {viewportColumns.map(({ key, idx, minWidth, maxWidth }) => (\n <div\n key={key}\n className={measuringCellClassname}\n style={{ gridColumnStart: idx + 1, minWidth, maxWidth }}\n data-measuring-cell-key={key}\n />\n ))}\n </>\n );\n}\n","import type { CalculatedColumn, Position, GroupRow, CellNavigationMode, Maybe } from '../types';\nimport { getColSpan } from './colSpanUtils';\n\ninterface IsSelectedCellEditableOpts<R, SR> {\n selectedPosition: Position;\n columns: readonly CalculatedColumn<R, SR>[];\n rows: readonly (R | GroupRow<R>)[];\n isGroupRow: (row: R | GroupRow<R>) => row is GroupRow<R>;\n}\n\nexport function isSelectedCellEditable<R, SR>({\n selectedPosition,\n columns,\n rows,\n isGroupRow\n}: IsSelectedCellEditableOpts<R, SR>): boolean {\n const column = columns[selectedPosition.idx];\n const row = rows[selectedPosition.rowIdx];\n return !isGroupRow(row) && isCellEditable(column, row);\n}\n\nexport function isCellEditable<R, SR>(column: CalculatedColumn<R, SR>, row: R): boolean {\n return (\n column.editor != null &&\n !column.rowGroup &&\n (typeof column.editable === 'function' ? column.editable(row) : column.editable) !== false\n );\n}\n\ninterface GetNextSelectedCellPositionOpts<R, SR> {\n cellNavigationMode: CellNavigationMode;\n columns: readonly CalculatedColumn<R, SR>[];\n colSpanColumns: readonly CalculatedColumn<R, SR>[];\n rows: readonly (R | GroupRow<R>)[];\n topSummaryRows: Maybe<readonly SR[]>;\n bottomSummaryRows: Maybe<readonly SR[]>;\n minRowIdx: number;\n maxRowIdx: number;\n currentPosition: Position;\n nextPosition: Position;\n lastFrozenColumnIndex: number;\n isCellWithinBounds: (position: Position) => boolean;\n isGroupRow: (row: R | GroupRow<R>) => row is GroupRow<R>;\n}\n\nexport function getSelectedCellColSpan<R, SR>({\n rows,\n topSummaryRows,\n bottomSummaryRows,\n rowIdx,\n lastFrozenColumnIndex,\n column,\n isGroupRow\n}: Pick<\n GetNextSelectedCellPositionOpts<R, SR>,\n 'rows' | 'topSummaryRows' | 'bottomSummaryRows' | 'isGroupRow' | 'lastFrozenColumnIndex'\n> & {\n rowIdx: number;\n column: CalculatedColumn<R, SR>;\n}) {\n const topSummaryRowsCount = topSummaryRows?.length ?? 0;\n const minRowIdx = -1 - topSummaryRowsCount;\n if (rowIdx === minRowIdx) {\n return getColSpan(column, lastFrozenColumnIndex, { type: 'HEADER' });\n }\n\n if (topSummaryRows && rowIdx > minRowIdx && rowIdx <= topSummaryRowsCount + minRowIdx) {\n return getColSpan(column, lastFrozenColumnIndex, {\n type: 'SUMMARY',\n row: topSummaryRows[rowIdx + topSummaryRowsCount]\n });\n }\n\n if (rowIdx >= 0 && rowIdx < rows.length) {\n const row = rows[rowIdx];\n if (!isGroupRow(row)) {\n return getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row });\n }\n return undefined;\n }\n\n if (bottomSummaryRows) {\n return getColSpan(column, lastFrozenColumnIndex, {\n type: 'SUMMARY',\n row: bottomSummaryRows[rowIdx - rows.length]\n });\n }\n\n return undefined;\n}\n\nexport function getNextSelectedCellPosition<R, SR>({\n cellNavigationMode,\n columns,\n colSpanColumns,\n rows,\n topSummaryRows,\n bottomSummaryRows,\n minRowIdx,\n maxRowIdx,\n currentPosition: { idx: currentIdx },\n nextPosition,\n lastFrozenColumnIndex,\n isCellWithinBounds,\n isGroupRow\n}: GetNextSelectedCellPositionOpts<R, SR>): Position {\n let { idx: nextIdx, rowIdx: nextRowIdx } = nextPosition;\n\n const setColSpan = (moveRight: boolean) => {\n if (nextRowIdx >= 0 && nextRowIdx < rows.length) {\n const row = rows[nextRowIdx];\n if (isGroupRow(row)) return;\n }\n // If a cell within the colspan range is selected then move to the\n // previous or the next cell depending on the navigation direction\n for (const column of colSpanColumns) {\n const colIdx = column.idx;\n if (colIdx > nextIdx) break;\n const colSpan = getSelectedCellColSpan({\n rows,\n topSummaryRows,\n bottomSummaryRows,\n rowIdx: nextRowIdx,\n lastFrozenColumnIndex,\n column,\n isGroupRow\n });\n\n if (colSpan && nextIdx > colIdx && nextIdx < colSpan + colIdx) {\n nextIdx = colIdx + (moveRight ? colSpan : 0);\n break;\n }\n }\n };\n\n if (isCellWithinBounds(nextPosition)) {\n setColSpan(nextIdx - currentIdx > 0);\n }\n\n if (cellNavigationMode !== 'NONE') {\n const columnsCount = columns.length;\n const isAfterLastColumn = nextIdx === columnsCount;\n const isBeforeFirstColumn = nextIdx === -1;\n\n if (isAfterLastColumn) {\n if (cellNavigationMode === 'CHANGE_ROW') {\n const isLastRow = nextRowIdx === maxRowIdx;\n if (!isLastRow) {\n nextIdx = 0;\n nextRowIdx += 1;\n }\n } else {\n nextIdx = 0;\n }\n } else if (isBeforeFirstColumn) {\n if (cellNavigationMode === 'CHANGE_ROW') {\n const isFirstRow = nextRowIdx === minRowIdx;\n if (!isFirstRow) {\n nextRowIdx -= 1;\n nextIdx = columnsCount - 1;\n }\n } else {\n nextIdx = columnsCount - 1;\n }\n setColSpan(false);\n }\n }\n\n return { idx: nextIdx, rowIdx: nextRowIdx };\n}\n\ninterface CanExitGridOpts {\n cellNavigationMode: CellNavigationMode;\n maxColIdx: number;\n minRowIdx: number;\n maxRowIdx: number;\n selectedPosition: Position;\n shiftKey: boolean;\n}\n\nexport function canExitGrid({\n cellNavigationMode,\n maxColIdx,\n minRowIdx,\n maxRowIdx,\n selectedPosition: { rowIdx, idx },\n shiftKey\n}: CanExitGridOpts): boolean {\n // When the cellNavigationMode is 'none' or 'changeRow', you can exit the grid if you're at the first or last cell of the grid\n // When the cellNavigationMode is 'loopOverRow', there is no logical exit point so you can't exit the grid\n if (cellNavigationMode === 'NONE' || cellNavigationMode === 'CHANGE_ROW') {\n const atLastCellInRow = idx === maxColIdx;\n const atFirstCellInRow = idx === 0;\n const atLastRow = rowIdx === maxRowIdx;\n const atFirstRow = rowIdx === minRowIdx;\n\n return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;\n }\n\n return false;\n}\n","import type { CSSProperties } from 'react';\nimport clsx from 'clsx';\n\nimport type { CalculatedColumn } from '../types';\nimport { cellClassname, cellFrozenClassname, cellFrozenLastClassname } from '../style';\n\nexport function getRowStyle(rowIdx: number, height?: number): CSSProperties {\n if (height !== undefined) {\n return {\n '--rdg-grid-row-start': rowIdx,\n '--rdg-row-height': `${height}px`\n } as unknown as CSSProperties;\n }\n return { '--rdg-grid-row-start': rowIdx } as unknown as CSSProperties;\n}\n\nexport function getCellStyle<R, SR>(\n column: CalculatedColumn<R, SR>,\n colSpan?: number\n): React.CSSProperties {\n return {\n gridColumnStart: column.idx + 1,\n gridColumnEnd: colSpan !== undefined ? `span ${colSpan}` : undefined,\n insetInlineStart: column.frozen ? `var(--rdg-frozen-left-${column.idx})` : undefined\n };\n}\n\nexport function getCellClassname<R, SR>(\n column: CalculatedColumn<R, SR>,\n ...extraClasses: Parameters<typeof clsx>\n): string {\n return clsx(\n cellClassname,\n {\n [cellFrozenClassname]: column.frozen,\n [cellFrozenLastClassname]: column.isLastFrozenColumn\n },\n ...extraClasses\n );\n}\n","import type { CalculatedColumn } from '../types';\n\nexport * from './colSpanUtils';\nexport * from './domUtils';\nexport * from './keyboardUtils';\nexport * from './renderMeasuringCells';\nexport * from './selectedCellUtils';\nexport * from './styleUtils';\n\nexport const { min, max, round, floor, sign, abs } = Math;\n\nexport function assertIsValidKeyGetter<R, K extends React.Key>(\n keyGetter: unknown\n): asserts keyGetter is (row: R) => K {\n if (typeof keyGetter !== 'function') {\n throw new Error('Please specify the rowKeyGetter prop to use selection');\n }\n}\n\nexport function clampColumnWidth<R, SR>(\n width: number,\n { minWidth, maxWidth }: CalculatedColumn<R, SR>\n): number {\n width = max(width, minWidth);\n\n // ignore maxWidth if it less than minWidth\n if (typeof maxWidth === 'number' && maxWidth >= minWidth) {\n return min(width, maxWidth);\n }\n\n return width;\n}\n","import { useRef, useEffect, useCallback } from 'react';\nimport type { Maybe } from '../types';\n\n// https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useLatestFunc<T extends Maybe<(...args: any[]) => any>>(fn: T): T {\n const ref = useRef(fn);\n\n useEffect(() => {\n ref.current = fn;\n });\n\n const callbackFn = useCallback((...args: Parameters<NonNullable<T>>) => {\n ref.current!(...args);\n }, []);\n\n // @ts-expect-error\n return fn ? callbackFn : fn;\n}\n","import { useCallback, useState } from 'react';\nimport { scrollIntoView } from '../utils';\n\n// https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_roving_tabindex\nexport function useRovingCellRef(isSelected: boolean) {\n // https://www.w3.org/TR/wai-aria-practices-1.1/#gridNav_focus\n const [isChildFocused, setIsChildFocused] = useState(false);\n\n if (isChildFocused && !isSelected) {\n setIsChildFocused(false);\n }\n\n const ref = useCallback((cell: HTMLDivElement | null) => {\n if (cell === null) return;\n scrollIntoView(cell);\n if (cell.contains(document.activeElement)) return;\n cell.focus({ preventScroll: true });\n }, []);\n\n function onFocus(event: React.FocusEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) {\n setIsChildFocused(true);\n }\n }\n\n const isFocused = isSelected && !isChildFocused;\n\n return {\n ref: isSelected ? ref : undefined,\n tabIndex: isFocused ? 0 : -1,\n onFocus: isSelected ? onFocus : undefined\n };\n}\n","import { useMemo } from 'react';\nimport { floor, max, min } from '../utils';\nimport type { GroupRow, Maybe, RowHeightArgs } from '../types';\n\ntype GroupByDictionary<TRow> = Record<\n string,\n {\n readonly childRows: readonly TRow[];\n readonly childGroups: readonly TRow[] | Readonly<GroupByDictionary<TRow>>;\n readonly startRowIndex: number;\n }\n>;\n\ninterface ViewportRowsArgs<R> {\n rawRows: readonly R[];\n rowHeight: number | ((args: RowHeightArgs<R>) => number);\n clientHeight: number;\n scrollTop: number;\n groupBy: readonly string[];\n rowGrouper: Maybe<(rows: readonly R[], columnKey: string) => Record<string, readonly R[]>>;\n expandedGroupIds: Maybe<ReadonlySet<unknown>>;\n enableVirtualization: boolean;\n}\n\n// TODO: https://github.com/microsoft/TypeScript/issues/41808\nfunction isReadonlyArray(arr: unknown): arr is readonly unknown[] {\n return Array.isArray(arr);\n}\n\nexport function useViewportRows<R>({\n rawRows,\n rowHeight,\n clientHeight,\n scrollTop,\n groupBy,\n rowGrouper,\n expandedGroupIds,\n enableVirtualization\n}: ViewportRowsArgs<R>) {\n const [groupedRows, rowsCount] = useMemo(() => {\n if (groupBy.length === 0 || rowGrouper == null) return [undefined, rawRows.length];\n\n const groupRows = (\n rows: readonly R[],\n [groupByKey, ...remainingGroupByKeys]: readonly string[],\n startRowIndex: number\n ): [Readonly<GroupByDictionary<R>>, number] => {\n let groupRowsCount = 0;\n const groups: GroupByDictionary<R> = {};\n for (const [key, childRows] of Object.entries(rowGrouper(rows, groupByKey))) {\n // Recursively group each parent group\n const [childGroups, childRowsCount] =\n remainingGroupByKeys.length === 0\n ? [childRows, childRows.length]\n : groupRows(childRows, remainingGroupByKeys, startRowIndex + groupRowsCount + 1); // 1 for parent row\n groups[key] = { childRows, childGroups, startRowIndex: startRowIndex + groupRowsCount };\n groupRowsCount += childRowsCount + 1; // 1 for parent row\n }\n\n return [groups, groupRowsCount];\n };\n\n return groupRows(rawRows, groupBy, 0);\n }, [groupBy, rowGrouper, rawRows]);\n\n const [rows, isGroupRow] = useMemo((): [\n ReadonlyArray<R | GroupRow<R>>,\n (row: R | GroupRow<R>) => row is GroupRow<R>\n ] => {\n const allGroupRows = new Set<unknown>();\n if (!groupedRows) return [rawRows, isGroupRow];\n\n const flattenedRows: Array<R | GroupRow<R>> = [];\n const expandGroup = (\n rows: GroupByDictionary<R> | readonly R[],\n parentId: string | undefined,\n level: number\n ): void => {\n if (isReadonlyArray(rows)) {\n flattenedRows.push(...rows);\n return;\n }\n Object.keys(rows).forEach((groupKey, posInSet, keys) => {\n // TODO: should users have control over the generated key?\n const id = parentId !== undefined ? `${parentId}__${groupKey}` : groupKey;\n const isExpanded = expandedGroupIds?.has(id) ?? false;\n const { childRows, childGroups, startRowIndex } = rows[groupKey];\n\n const groupRow: GroupRow<R> = {\n id,\n parentId,\n groupKey,\n isExpanded,\n childRows,\n level,\n posInSet,\n startRowIndex,\n setSize: keys.length\n };\n flattenedRows.push(groupRow);\n allGroupRows.add(groupRow);\n\n if (isExpanded) {\n expandGroup(childGroups, id, level + 1);\n }\n });\n };\n\n expandGroup(groupedRows, undefined, 0);\n return [flattenedRows, isGroupRow];\n\n function isGroupRow(row: R | GroupRow<R>): row is GroupRow<R> {\n return allGroupRows.has(row);\n }\n }, [expandedGroupIds, groupedRows, rawRows]);\n\n const { totalRowHeight, gridTemplateRows, getRowTop, getRowHeight, findRowIdx } = useMemo(() => {\n if (typeof rowHeight === 'number') {\n return {\n totalRowHeight: rowHeight * rows.length,\n gridTemplateRows: ` repeat(${rows.length}, ${rowHeight}px)`,\n getRowTop: (rowIdx: number) => rowIdx * rowHeight,\n getRowHeight: () => rowHeight,\n findRowIdx: (offset: number) => floor(offset / rowHeight)\n };\n }\n\n let totalRowHeight = 0;\n let gridTemplateRows = ' ';\n // Calcule the height of all the rows upfront. This can cause performance issues\n // and we can consider using a similar approach as react-window\n // https://github.com/bvaughn/react-window/blob/b0a470cc264e9100afcaa1b78ed59d88f7914ad4/src/VariableSizeList.js#L68\n const rowPositions = rows.map((row: R | GroupRow<R>) => {\n const currentRowHeight = isGroupRow(row)\n ? rowHeight({ type: 'GROUP', row })\n : rowHeight({ type: 'ROW', row });\n const position = { top: totalRowHeight, height: currentRowHeight };\n gridTemplateRows += `${currentRowHeight}px `;\n totalRowHeight += currentRowHeight;\n return position;\n });\n\n const validateRowIdx = (rowIdx: number) => {\n return max(0, min(rows.length - 1, rowIdx));\n };\n\n return {\n totalRowHeight,\n gridTemplateRows,\n getRowTop: (rowIdx: number) => rowPositions[validateRowIdx(rowIdx)].top,\n getRowHeight: (rowIdx: number) => rowPositions[validateRowIdx(rowIdx)].height,\n findRowIdx(offset: number) {\n let start = 0;\n let end = rowPositions.length - 1;\n while (start <= end) {\n const middle = start + floor((end - start) / 2);\n const currentOffset = rowPositions[middle].top;\n\n if (currentOffset === offset) return middle;\n\n if (currentOffset < offset) {\n start = middle + 1;\n } else if (currentOffset > offset) {\n end = middle - 1;\n }\n\n if (start > end) return end;\n }\n return 0;\n }\n };\n }, [isGroupRow, rowHeight, rows]);\n\n let rowOverscanStartIdx = 0;\n let rowOverscanEndIdx = rows.length - 1;\n\n if (enableVirtualization) {\n const overscanThreshold = 4;\n const rowVisibleStartIdx = findRowIdx(scrollTop);\n const rowVisibleEndIdx = findRowIdx(scrollTop + clientHeight);\n rowOverscanStartIdx = max(0, rowVisibleStartIdx - overscanThreshold);\n rowOverscanEndIdx = min(rows.length - 1, rowVisibleEndIdx + overscanThreshold);\n }\n\n return {\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n rowsCount,\n totalRowHeight,\n gridTemplateRows,\n isGroupRow,\n getRowTop,\n getRowHeight,\n findRowIdx\n };\n}\n","import { css } from '@linaria/core';\n\nimport { useFocusRef } from './hooks';\nimport type { HeaderRendererProps } from './types';\nimport { useDefaultComponents } from './DataGridDefaultComponentsProvider';\n\nconst headerSortCell = css`\n @layer rdg.SortableHeaderCell {\n cursor: pointer;\n display: flex;\n\n &:focus {\n outline: none;\n }\n }\n`;\n\nconst headerSortCellClassname = `rdg-header-sort-cell ${headerSortCell}`;\n\nconst headerSortName = css`\n @layer rdg.SortableHeaderCellName {\n flex-grow: 1;\n overflow: hidden;\n overflow: clip;\n text-overflow: ellipsis;\n }\n`;\n\nconst headerSortNameClassname = `rdg-header-sort-name ${headerSortName}`;\n\nexport default function headerRenderer<R, SR>({\n column,\n sortDirection,\n priority,\n onSort,\n isCellSelected\n}: HeaderRendererProps<R, SR>) {\n if (!column.sortable) return <>{column.name}</>;\n\n return (\n <SortableHeaderCell\n onSort={onSort}\n sortDirection={sortDirection}\n priority={priority}\n isCellSelected={isCellSelected}\n >\n {column.name}\n </SortableHeaderCell>\n );\n}\n\ntype SharedHeaderCellProps<R, SR> = Pick<\n HeaderRendererProps<R, SR>,\n 'sortDirection' | 'onSort' | 'priority' | 'isCellSelected'\n>;\n\ninterface SortableHeaderCellProps<R, SR> extends SharedHeaderCellProps<R, SR> {\n children: React.ReactNode;\n}\n\nfunction SortableHeaderCell<R, SR>({\n onSort,\n sortDirection,\n priority,\n children,\n isCellSelected\n}: SortableHeaderCellProps<R, SR>) {\n const sortStatus = useDefaultComponents<R, SR>()!.sortStatus!;\n const { ref, tabIndex } = useFocusRef<HTMLSpanElement>(isCellSelected);\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLSpanElement>) {\n if (event.key === ' ' || event.key === 'Enter') {\n // stop propagation to prevent scrolling\n event.preventDefault();\n onSort(event.ctrlKey || event.metaKey);\n }\n }\n\n function handleClick(event: React.MouseEvent<HTMLSpanElement>) {\n onSort(event.ctrlKey || event.metaKey);\n }\n\n return (\n <span\n ref={ref}\n tabIndex={tabIndex}\n className={headerSortCellClassname}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <span className={headerSortNameClassname}>{children}</span>\n <span>{sortStatus({ sortDirection, priority })}</span>\n </span>\n );\n}\n","import { css } from '@linaria/core';\n\nimport type { CalculatedColumn, SortColumn } from './types';\nimport type { HeaderRowProps } from './HeaderRow';\nimport defaultHeaderRenderer from './headerRenderer';\nimport { getCellStyle, getCellClassname } from './utils';\nimport { useRovingCellRef } from './hooks';\n\nconst cellResizable = css`\n @layer rdg.HeaderCell {\n touch-action: none;\n\n &::after {\n content: '';\n cursor: col-resize;\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n inset-block-end: 0;\n inline-size: 10px;\n }\n }\n`;\n\nconst cellResizableClassname = `rdg-cell-resizable ${cellResizable}`;\n\ntype SharedHeaderRowProps<R, SR> = Pick<\n HeaderRowProps<R, SR, React.Key>,\n | 'sortColumns'\n | 'onSortColumnsChange'\n | 'allRowsSelected'\n | 'onAllRowsSelectionChange'\n | 'selectCell'\n | 'onColumnResize'\n | 'shouldFocusGrid'\n | 'direction'\n>;\n\nexport interface HeaderCellProps<R, SR> extends SharedHeaderRowProps<R, SR> {\n column: CalculatedColumn<R, SR>;\n colSpan: number | undefined;\n isCellSelected: boolean;\n}\n\nexport default function HeaderCell<R, SR>({\n column,\n colSpan,\n isCellSelected,\n onColumnResize,\n allRowsSelected,\n onAllRowsSelectionChange,\n sortColumns,\n onSortColumnsChange,\n selectCell,\n shouldFocusGrid,\n direction\n}: HeaderCellProps<R, SR>) {\n const isRtl = direction === 'rtl';\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n const sortIndex = sortColumns?.findIndex((sort) => sort.columnKey === column.key);\n const sortColumn =\n sortIndex !== undefined && sortIndex > -1 ? sortColumns![sortIndex] : undefined;\n const sortDirection = sortColumn?.direction;\n const priority = sortColumn !== undefined && sortColumns!.length > 1 ? sortIndex! + 1 : undefined;\n const ariaSort =\n sortDirection && !priority ? (sortDirection === 'ASC' ? 'ascending' : 'descending') : undefined;\n\n const className = getCellClassname(column, column.headerCellClass, {\n [cellResizableClassname]: column.resizable\n });\n\n const headerRenderer = column.headerRenderer ?? defaultHeaderRenderer;\n\n function onPointerDown(event: React.PointerEvent<HTMLDivElement>) {\n if (event.pointerType === 'mouse' && event.buttons !== 1) {\n return;\n }\n\n const { currentTarget, pointerId } = event;\n const { right, left } = currentTarget.getBoundingClientRect();\n const offset = isRtl ? event.clientX - left : right - event.clientX;\n\n if (offset > 11) {\n // +1px to account for the border size\n return;\n }\n\n function onPointerMove(event: PointerEvent) {\n // prevents text selection in Chrome, which fixes scrolling the grid while dragging, and fixes re-size on an autosized column\n event.preventDefault();\n const { right, left } = currentTarget.getBoundingClientRect();\n const width = isRtl ? right + offset - event.clientX : event.clientX + offset - left;\n if (width > 0) {\n onColumnResize(column, width);\n }\n }\n\n function onLostPointerCapture() {\n currentTarget.removeEventListener('pointermove', onPointerMove);\n currentTarget.removeEventListener('lostpointercapture', onLostPointerCapture);\n }\n\n currentTarget.setPointerCapture(pointerId);\n currentTarget.addEventListener('pointermove', onPointerMove);\n currentTarget.addEventListener('lostpointercapture', onLostPointerCapture);\n }\n\n function onSort(ctrlClick: boolean) {\n if (onSortColumnsChange == null) return;\n const { sortDescendingFirst } = column;\n if (sortColumn === undefined) {\n // not currently sorted\n const nextSort: SortColumn = {\n columnKey: column.key,\n direction: sortDescendingFirst ? 'DESC' : 'ASC'\n };\n onSortColumnsChange(sortColumns && ctrlClick ? [...sortColumns, nextSort] : [nextSort]);\n } else {\n let nextSortColumn: SortColumn | undefined;\n if (\n (sortDescendingFirst && sortDirection === 'DESC') ||\n (!sortDescendingFirst && sortDirection === 'ASC')\n ) {\n nextSortColumn = {\n columnKey: column.key,\n direction: sortDirection === 'ASC' ? 'DESC' : 'ASC'\n };\n }\n if (ctrlClick) {\n const nextSortColumns = [...sortColumns!];\n if (nextSortColumn) {\n // swap direction\n nextSortColumns[sortIndex!] = nextSortColumn;\n } else {\n // remove sort\n nextSortColumns.splice(sortIndex!, 1);\n }\n onSortColumnsChange(nextSortColumns);\n } else {\n onSortColumnsChange(nextSortColumn ? [nextSortColumn] : []);\n }\n }\n }\n\n function onClick() {\n selectCell(column.idx);\n }\n\n function onDoubleClick(event: React.MouseEvent<HTMLDivElement>) {\n const { right, left } = event.currentTarget.getBoundingClientRect();\n const offset = isRtl ? event.clientX - left : right - event.clientX;\n\n if (offset > 11) {\n // +1px to account for the border size\n return;\n }\n\n onColumnResize(column, 'max-content');\n }\n\n function handleFocus(event: React.FocusEvent<HTMLDivElement>) {\n onFocus?.(event);\n if (shouldFocusGrid) {\n // Select the first header cell if there is no selected cell\n selectCell(0);\n }\n }\n\n return (\n <div\n role=\"columnheader\"\n aria-colindex={column.idx + 1}\n aria-selected={isCellSelected}\n aria-sort={ariaSort}\n aria-colspan={colSpan}\n ref={ref}\n // set the tabIndex to 0 when there is no selected cell so grid can receive focus\n tabIndex={shouldFocusGrid ? 0 : tabIndex}\n className={className}\n style={getCellStyle(column, colSpan)}\n onFocus={handleFocus}\n onClick={onClick}\n onDoubleClick={column.resizable ? onDoubleClick : undefined}\n onPointerDown={column.resizable ? onPointerDown : undefined}\n >\n {headerRenderer({\n column,\n sortDirection,\n priority,\n onSort,\n allRowsSelected,\n onAllRowsSelectionChange,\n isCellSelected\n })}\n </div>\n );\n}\n","import { memo } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport HeaderCell from './HeaderCell';\nimport type { CalculatedColumn, Direction } from './types';\nimport { getColSpan, getRowStyle } from './utils';\nimport type { DataGridProps } from './DataGrid';\nimport { cell, cellFrozen, rowSelectedClassname } from './style';\n\ntype SharedDataGridProps<R, SR, K extends React.Key> = Pick<\n DataGridProps<R, SR, K>,\n 'sortColumns' | 'onSortColumnsChange'\n>;\n\nexport interface HeaderRowProps<R, SR, K extends React.Key> extends SharedDataGridProps<R, SR, K> {\n columns: readonly CalculatedColumn<R, SR>[];\n allRowsSelected: boolean;\n onAllRowsSelectionChange: (checked: boolean) => void;\n onColumnResize: (column: CalculatedColumn<R, SR>, width: number | 'max-content') => void;\n selectCell: (columnIdx: number) => void;\n lastFrozenColumnIndex: number;\n selectedCellIdx: number | undefined;\n shouldFocusGrid: boolean;\n direction: Direction;\n}\n\nconst headerRow = css`\n @layer rdg.HeaderRow {\n display: contents;\n line-height: var(--rdg-header-row-height);\n background-color: var(--rdg-header-background-color);\n font-weight: bold;\n\n & > .${cell} {\n /* Should have a higher value than 0 to show up above regular cells */\n z-index: 1;\n position: sticky;\n inset-block-start: 0;\n }\n\n & > .${cellFrozen} {\n z-index: 2;\n }\n }\n`;\n\nconst headerRowClassname = `rdg-header-row ${headerRow}`;\n\nfunction HeaderRow<R, SR, K extends React.Key>({\n columns,\n allRowsSelected,\n onAllRowsSelectionChange,\n onColumnResize,\n sortColumns,\n onSortColumnsChange,\n lastFrozenColumnIndex,\n selectedCellIdx,\n selectCell,\n shouldFocusGrid,\n direction\n}: HeaderRowProps<R, SR, K>) {\n const cells = [];\n for (let index = 0; index < columns.length; index++) {\n const column = columns[index];\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'HEADER' });\n if (colSpan !== undefined) {\n index += colSpan - 1;\n }\n\n cells.push(\n <HeaderCell<R, SR>\n key={column.key}\n column={column}\n colSpan={colSpan}\n isCellSelected={selectedCellIdx === column.idx}\n onColumnResize={onColumnResize}\n allRowsSelected={allRowsSelected}\n onAllRowsSelectionChange={onAllRowsSelectionChange}\n onSortColumnsChange={onSortColumnsChange}\n sortColumns={sortColumns}\n selectCell={selectCell}\n shouldFocusGrid={shouldFocusGrid && index === 0}\n direction={direction}\n />\n );\n }\n\n return (\n <div\n role=\"row\"\n aria-rowindex={1} // aria-rowindex is 1 based\n className={clsx(headerRowClassname, {\n [rowSelectedClassname]: selectedCellIdx === -1\n })}\n style={getRowStyle(1)}\n >\n {cells}\n </div>\n );\n}\n\nexport default memo(HeaderRow) as <R, SR, K extends React.Key>(\n props: HeaderRowProps<R, SR, K>\n) => JSX.Element;\n","import { memo } from 'react';\nimport { css } from '@linaria/core';\n\nimport { getCellStyle, getCellClassname, isCellEditable } from './utils';\nimport type { CellRendererProps } from './types';\nimport { useRovingCellRef } from './hooks';\n\nconst cellCopied = css`\n @layer rdg.Cell {\n background-color: #ccccff;\n }\n`;\n\nconst cellCopiedClassname = `rdg-cell-copied ${cellCopied}`;\n\nconst cellDraggedOver = css`\n @layer rdg.Cell {\n background-color: #ccccff;\n\n &.${cellCopied} {\n background-color: #9999ff;\n }\n }\n`;\n\nconst cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;\n\nfunction Cell<R, SR>({\n column,\n colSpan,\n isCellSelected,\n isCopied,\n isDraggedOver,\n row,\n dragHandle,\n onRowClick,\n onRowDoubleClick,\n onRowChange,\n selectCell,\n ...props\n}: CellRendererProps<R, SR>) {\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n\n const { cellClass } = column;\n const className = getCellClassname(\n column,\n {\n [cellCopiedClassname]: isCopied,\n [cellDraggedOverClassname]: isDraggedOver\n },\n typeof cellClass === 'function' ? cellClass(row) : cellClass\n );\n\n function selectCellWrapper(openEditor?: boolean | null) {\n selectCell(row, column, openEditor);\n }\n\n function handleClick() {\n selectCellWrapper(column.editorOptions?.editOnClick);\n onRowClick?.(row, column);\n }\n\n function handleContextMenu() {\n selectCellWrapper();\n }\n\n function handleDoubleClick() {\n selectCellWrapper(true);\n onRowDoubleClick?.(row, column);\n }\n\n function handleRowChange(newRow: R) {\n onRowChange(column, newRow);\n }\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1} // aria-colindex is 1-based\n aria-selected={isCellSelected}\n aria-colspan={colSpan}\n aria-readonly={!isCellEditable(column, row) || undefined}\n ref={ref}\n tabIndex={tabIndex}\n className={className}\n style={getCellStyle(column, colSpan)}\n onClick={handleClick}\n onDoubleClick={handleDoubleClick}\n onContextMenu={handleContextMenu}\n onFocus={onFocus}\n {...props}\n >\n {!column.rowGroup && (\n <>\n {column.formatter({\n column,\n row,\n isCellSelected,\n onRowChange: handleRowChange\n })}\n {dragHandle}\n </>\n )}\n </div>\n );\n}\n\nexport default memo(Cell) as <R, SR>(props: CellRendererProps<R, SR>) => JSX.Element;\n","import { memo, forwardRef } from 'react';\nimport type { RefAttributes } from 'react';\nimport clsx from 'clsx';\n\nimport Cell from './Cell';\nimport { RowSelectionProvider, useLatestFunc } from './hooks';\nimport { getColSpan, getRowStyle } from './utils';\nimport { rowClassname, rowSelectedClassname } from './style';\nimport type { CalculatedColumn, RowRendererProps } from './types';\n\nfunction Row<R, SR>(\n {\n className,\n rowIdx,\n gridRowStart,\n height,\n selectedCellIdx,\n isRowSelected,\n copiedCellIdx,\n draggedOverCellIdx,\n lastFrozenColumnIndex,\n row,\n viewportColumns,\n selectedCellEditor,\n selectedCellDragHandle,\n onRowClick,\n onRowDoubleClick,\n rowClass,\n setDraggedOverRowIdx,\n onMouseEnter,\n onRowChange,\n selectCell,\n ...props\n }: RowRendererProps<R, SR>,\n ref: React.Ref<HTMLDivElement>\n) {\n const handleRowChange = useLatestFunc((column: CalculatedColumn<R, SR>, newRow: R) => {\n onRowChange(column, rowIdx, newRow);\n });\n\n function handleDragEnter(event: React.MouseEvent<HTMLDivElement>) {\n setDraggedOverRowIdx?.(rowIdx);\n onMouseEnter?.(event);\n }\n\n className = clsx(\n rowClassname,\n `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`,\n {\n [rowSelectedClassname]: selectedCellIdx === -1\n },\n rowClass?.(row),\n className\n );\n\n const cells = [];\n\n for (let index = 0; index < viewportColumns.length; index++) {\n const column = viewportColumns[index];\n const { idx } = column;\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row });\n if (colSpan !== undefined) {\n index += colSpan - 1;\n }\n\n const isCellSelected = selectedCellIdx === idx;\n\n if (isCellSelected && selectedCellEditor) {\n cells.push(selectedCellEditor);\n } else {\n cells.push(\n <Cell\n key={column.key}\n column={column}\n colSpan={colSpan}\n row={row}\n isCopied={copiedCellIdx === idx}\n isDraggedOver={draggedOverCellIdx === idx}\n isCellSelected={isCellSelected}\n dragHandle={isCellSelected ? selectedCellDragHandle : undefined}\n onRowClick={onRowClick}\n onRowDoubleClick={onRowDoubleClick}\n onRowChange={handleRowChange}\n selectCell={selectCell}\n />\n );\n }\n }\n\n return (\n <RowSelectionProvider value={isRowSelected}>\n <div\n role=\"row\"\n ref={ref}\n className={className}\n onMouseEnter={handleDragEnter}\n style={getRowStyle(gridRowStart, height)}\n {...props}\n >\n {cells}\n </div>\n </RowSelectionProvider>\n );\n}\n\nconst RowComponent = memo(forwardRef(Row)) as <R, SR>(\n props: RowRendererProps<R, SR> & RefAttributes<HTMLDivElement>\n) => JSX.Element;\n\nexport default RowComponent;\n\nexport function defaultRowRenderer<R, SR>(key: React.Key, props: RowRendererProps<R, SR>) {\n return <RowComponent key={key} {...props} />;\n}\n","import { memo } from 'react';\n\nimport { getCellStyle, getCellClassname } from './utils';\nimport type { CalculatedColumn, GroupRow } from './types';\nimport type { GroupRowRendererProps } from './GroupRow';\nimport { useRovingCellRef } from './hooks';\n\ntype SharedGroupRowRendererProps<R, SR> = Pick<\n GroupRowRendererProps<R, SR>,\n 'id' | 'groupKey' | 'childRows' | 'isExpanded' | 'toggleGroup'\n>;\n\ninterface GroupCellProps<R, SR> extends SharedGroupRowRendererProps<R, SR> {\n column: CalculatedColumn<R, SR>;\n row: GroupRow<R>;\n isCellSelected: boolean;\n groupColumnIndex: number;\n}\n\nfunction GroupCell<R, SR>({\n id,\n groupKey,\n childRows,\n isExpanded,\n isCellSelected,\n column,\n row,\n groupColumnIndex,\n toggleGroup: toggleGroupWrapper\n}: GroupCellProps<R, SR>) {\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n\n function toggleGroup() {\n toggleGroupWrapper(id);\n }\n\n // Only make the cell clickable if the group level matches\n const isLevelMatching = column.rowGroup && groupColumnIndex === column.idx;\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1}\n aria-selected={isCellSelected}\n ref={ref}\n tabIndex={tabIndex}\n key={column.key}\n className={getCellClassname(column)}\n style={{\n ...getCellStyle(column),\n cursor: isLevelMatching ? 'pointer' : 'default'\n }}\n onClick={isLevelMatching ? toggleGroup : undefined}\n onFocus={onFocus}\n >\n {(!column.rowGroup || groupColumnIndex === column.idx) &&\n column.groupFormatter?.({\n groupKey,\n childRows,\n column,\n row,\n isExpanded,\n isCellSelected,\n toggleGroup\n })}\n </div>\n );\n}\n\nexport default memo(GroupCell) as <R, SR>(props: GroupCellProps<R, SR>) => JSX.Element;\n","import { memo } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport { cell, cellFrozenLast, rowClassname, rowSelectedClassname } from './style';\nimport { SELECT_COLUMN_KEY } from './Columns';\nimport GroupCell from './GroupCell';\nimport type { CalculatedColumn, GroupRow, Omit } from './types';\nimport { RowSelectionProvider } from './hooks';\nimport { getRowStyle } from './utils';\n\nexport interface GroupRowRendererProps<R, SR>\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'children'> {\n id: string;\n groupKey: unknown;\n viewportColumns: readonly CalculatedColumn<R, SR>[];\n childRows: readonly R[];\n rowIdx: number;\n row: GroupRow<R>;\n gridRowStart: number;\n height: number;\n level: number;\n selectedCellIdx: number | undefined;\n isExpanded: boolean;\n isRowSelected: boolean;\n selectGroup: (rowIdx: number) => void;\n toggleGroup: (expandedGroupId: unknown) => void;\n}\n\nconst groupRow = css`\n @layer rdg.GroupedRow {\n &:not([aria-selected='true']) {\n background-color: var(--rdg-header-background-color);\n }\n\n > .${cell}:not(:last-child):not(.${cellFrozenLast}) {\n border-inline-end: none;\n }\n }\n`;\n\nconst groupRowClassname = `rdg-group-row ${groupRow}`;\n\nfunction GroupedRow<R, SR>({\n id,\n groupKey,\n viewportColumns,\n childRows,\n rowIdx,\n row,\n gridRowStart,\n height,\n level,\n isExpanded,\n selectedCellIdx,\n isRowSelected,\n selectGroup,\n toggleGroup,\n ...props\n}: GroupRowRendererProps<R, SR>) {\n // Select is always the first column\n const idx = viewportColumns[0].key === SELECT_COLUMN_KEY ? level + 1 : level;\n\n function handleSelectGroup() {\n selectGroup(rowIdx);\n }\n\n return (\n <RowSelectionProvider value={isRowSelected}>\n <div\n role=\"row\"\n aria-level={level}\n aria-expanded={isExpanded}\n className={clsx(\n rowClassname,\n groupRowClassname,\n `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`,\n {\n [rowSelectedClassname]: selectedCellIdx === -1\n }\n )}\n onClick={handleSelectGroup}\n style={getRowStyle(gridRowStart, height)}\n {...props}\n >\n {viewportColumns.map((column) => (\n <GroupCell\n key={column.key}\n id={id}\n groupKey={groupKey}\n childRows={childRows}\n isExpanded={isExpanded}\n isCellSelected={selectedCellIdx === column.idx}\n column={column}\n row={row}\n groupColumnIndex={idx}\n toggleGroup={toggleGroup}\n />\n ))}\n </div>\n </RowSelectionProvider>\n );\n}\n\nexport default memo(GroupedRow) as <R, SR>(props: GroupRowRendererProps<R, SR>) => JSX.Element;\n","import { memo } from 'react';\nimport { css } from '@linaria/core';\n\nimport { getCellStyle, getCellClassname } from './utils';\nimport type { CalculatedColumn, CellRendererProps } from './types';\nimport { useRovingCellRef } from './hooks';\n\nexport const summaryCellClassname = css`\n @layer rdg.SummaryCell {\n inset-block-start: var(--rdg-summary-row-top);\n inset-block-end: var(--rdg-summary-row-bottom);\n }\n`;\n\ninterface SharedCellRendererProps<R, SR>\n extends Pick<CellRendererProps<R, SR>, 'column' | 'colSpan' | 'isCellSelected'> {\n selectCell: (row: SR, column: CalculatedColumn<R, SR>) => void;\n}\n\ninterface SummaryCellProps<R, SR> extends SharedCellRendererProps<R, SR> {\n row: SR;\n}\n\nfunction SummaryCell<R, SR>({\n column,\n colSpan,\n row,\n isCellSelected,\n selectCell\n}: SummaryCellProps<R, SR>) {\n const { ref, tabIndex, onFocus } = useRovingCellRef(isCellSelected);\n const { summaryCellClass } = column;\n const className = getCellClassname(\n column,\n summaryCellClassname,\n typeof summaryCellClass === 'function' ? summaryCellClass(row) : summaryCellClass\n );\n\n function onClick() {\n selectCell(row, column);\n }\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1}\n aria-colspan={colSpan}\n aria-selected={isCellSelected}\n ref={ref}\n tabIndex={tabIndex}\n className={className}\n style={getCellStyle(column, colSpan)}\n onClick={onClick}\n onFocus={onFocus}\n >\n {column.summaryFormatter?.({ column, row, isCellSelected })}\n </div>\n );\n}\n\nexport default memo(SummaryCell) as <R, SR>(props: SummaryCellProps<R, SR>) => JSX.Element;\n","import { memo } from 'react';\nimport clsx from 'clsx';\nimport { css } from '@linaria/core';\n\nimport { cell, cellFrozen } from './style/cell';\nimport { rowClassname, rowSelectedClassname } from './style';\nimport { getColSpan, getRowStyle } from './utils';\nimport SummaryCell from './SummaryCell';\nimport type { CalculatedColumn, RowRendererProps } from './types';\n\ntype SharedRowRendererProps<R, SR> = Pick<\n RowRendererProps<R, SR>,\n 'viewportColumns' | 'rowIdx' | 'gridRowStart'\n>;\n\ninterface SummaryRowProps<R, SR> extends SharedRowRendererProps<R, SR> {\n 'aria-rowindex': number;\n row: SR;\n top: number | undefined;\n bottom: number | undefined;\n lastFrozenColumnIndex: number;\n selectedCellIdx: number | undefined;\n lastTopRowIdx: number | undefined;\n selectCell: (row: SR, column: CalculatedColumn<R, SR>) => void;\n}\n\nconst summaryRow = css`\n @layer rdg.SummaryRow {\n line-height: var(--rdg-summary-row-height);\n\n > .${cell} {\n position: sticky;\n }\n }\n`;\n\nconst topSummaryRow = css`\n @layer rdg.SummaryRow {\n > .${cell} {\n z-index: 1;\n }\n\n > .${cellFrozen} {\n z-index: 2;\n }\n }\n`;\n\nconst topSummaryRowBorderClassname = css`\n @layer rdg.SummaryRow {\n > .${cell} {\n border-block-end: 2px solid var(--rdg-summary-border-color);\n }\n }\n`;\n\nconst bottomSummaryRowBorderClassname = css`\n @layer rdg.SummaryRow {\n > .${cell} {\n border-block-start: 2px solid var(--rdg-summary-border-color);\n }\n }\n`;\n\nconst summaryRowClassname = `rdg-summary-row ${summaryRow}`;\n\nconst topSummaryRowClassname = `rdg-top-summary-row ${topSummaryRow}`;\n\nfunction SummaryRow<R, SR>({\n rowIdx,\n gridRowStart,\n row,\n viewportColumns,\n top,\n bottom,\n lastFrozenColumnIndex,\n selectedCellIdx,\n lastTopRowIdx,\n selectCell,\n 'aria-rowindex': ariaRowIndex\n}: SummaryRowProps<R, SR>) {\n const cells = [];\n for (let index = 0; index < viewportColumns.length; index++) {\n const column = viewportColumns[index];\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'SUMMARY', row });\n if (colSpan !== undefined) {\n index += colSpan - 1;\n }\n\n const isCellSelected = selectedCellIdx === column.idx;\n\n cells.push(\n <SummaryCell<R, SR>\n key={column.key}\n column={column}\n colSpan={colSpan}\n row={row}\n isCellSelected={isCellSelected}\n selectCell={selectCell}\n />\n );\n }\n\n const isTop = lastTopRowIdx !== undefined;\n\n return (\n <div\n role=\"row\"\n aria-rowindex={ariaRowIndex}\n className={clsx(\n rowClassname,\n `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`,\n summaryRowClassname,\n {\n [rowSelectedClassname]: selectedCellIdx === -1,\n [topSummaryRowClassname]: isTop,\n [topSummaryRowBorderClassname]: isTop && lastTopRowIdx === rowIdx,\n [bottomSummaryRowBorderClassname]: !isTop && rowIdx === 0,\n 'rdg-bottom-summary-row': !isTop\n }\n )}\n style={\n {\n ...getRowStyle(gridRowStart),\n '--rdg-summary-row-top': top !== undefined ? `${top}px` : undefined,\n '--rdg-summary-row-bottom': bottom !== undefined ? `${bottom}px` : undefined\n } as unknown as React.CSSProperties\n }\n >\n {cells}\n </div>\n );\n}\n\nexport default memo(SummaryRow) as <R, SR>(props: SummaryRowProps<R, SR>) => JSX.Element;\n","import { useEffect, useRef } from 'react';\nimport { css } from '@linaria/core';\n\nimport { useLatestFunc } from './hooks';\nimport { getCellStyle, getCellClassname, onEditorNavigation } from './utils';\nimport type { CellRendererProps, EditorProps, Omit } from './types';\n\n/*\n * To check for outside `mousedown` events, we listen to all `mousedown` events at their birth,\n * i.e. on the window during the capture phase, and at their death, i.e. on the window during the bubble phase.\n *\n * We schedule a check at the birth of the event, cancel the check when the event reaches the \"inside\" container,\n * and trigger the \"outside\" callback when the event bubbles back up to the window.\n *\n * The event can be `stopPropagation()`ed halfway through, so they may not always bubble back up to the window,\n * so an alternative check must be used. The check must happen after the event can reach the \"inside\" container,\n * and not before it run to completion. `requestAnimationFrame` is the best way we know how to achieve this.\n * Usually we want click event handlers from parent components to access the latest commited values,\n * so `mousedown` is used instead of `click`.\n *\n * We must also rely on React's event capturing/bubbling to handle elements rendered in a portal.\n */\n\nconst cellEditing = css`\n @layer rdg.EditCell {\n padding: 0;\n }\n`;\n\ntype SharedCellRendererProps<R, SR> = Pick<CellRendererProps<R, SR>, 'colSpan'>;\n\ninterface EditCellProps<R, SR>\n extends Omit<EditorProps<R, SR>, 'onClose'>,\n SharedCellRendererProps<R, SR> {\n closeEditor: () => void;\n}\n\nexport default function EditCell<R, SR>({\n column,\n colSpan,\n row,\n onRowChange,\n closeEditor\n}: EditCellProps<R, SR>) {\n const frameRequestRef = useRef<number | undefined>();\n const commitOnOutsideClick = column.editorOptions?.commitOnOutsideClick !== false;\n\n // We need to prevent the `useEffect` from cleaning up between re-renders,\n // as `onWindowCaptureMouseDown` might otherwise miss valid mousedown events.\n // To that end we instead access the latest props via useLatestFunc.\n const commitOnOutsideMouseDown = useLatestFunc(() => {\n onClose(true);\n });\n\n useEffect(() => {\n if (!commitOnOutsideClick) return;\n\n function onWindowCaptureMouseDown() {\n frameRequestRef.current = requestAnimationFrame(commitOnOutsideMouseDown);\n }\n\n addEventListener('mousedown', onWindowCaptureMouseDown, { capture: true });\n\n return () => {\n removeEventListener('mousedown', onWindowCaptureMouseDown, { capture: true });\n cancelFrameRequest();\n };\n }, [commitOnOutsideClick, commitOnOutsideMouseDown]);\n\n function cancelFrameRequest() {\n cancelAnimationFrame(frameRequestRef.current!);\n }\n\n function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (event.key === 'Escape') {\n event.stopPropagation();\n // Discard changes\n onClose();\n } else if (event.key === 'Enter') {\n event.stopPropagation();\n onClose(true);\n } else {\n const onNavigation = column.editorOptions?.onNavigation ?? onEditorNavigation;\n if (!onNavigation(event)) {\n event.stopPropagation();\n }\n }\n }\n\n function onClose(commitChanges?: boolean) {\n if (commitChanges) {\n onRowChange(row, true);\n } else {\n closeEditor();\n }\n }\n\n const { cellClass } = column;\n const className = getCellClassname(\n column,\n 'rdg-editor-container',\n !column.editorOptions?.renderFormatter && cellEditing,\n typeof cellClass === 'function' ? cellClass(row) : cellClass\n );\n\n return (\n <div\n role=\"gridcell\"\n aria-colindex={column.idx + 1} // aria-colindex is 1-based\n aria-colspan={colSpan}\n aria-selected\n className={className}\n style={getCellStyle(column, colSpan)}\n onKeyDown={onKeyDown}\n onMouseDownCapture={commitOnOutsideClick ? cancelFrameRequest : undefined}\n >\n {column.editor != null && (\n <>\n {column.editor({\n column,\n row,\n onRowChange,\n onClose\n })}\n {column.editorOptions?.renderFormatter &&\n column.formatter({ column, row, isCellSelected: true, onRowChange })}\n </>\n )}\n </div>\n );\n}\n","import { css } from '@linaria/core';\n\nimport type { CalculatedColumn, FillEvent, Position } from './types';\nimport type { DataGridProps, SelectCellState } from './DataGrid';\n\nconst cellDragHandle = css`\n @layer rdg.DragHandle {\n cursor: move;\n position: absolute;\n inset-inline-end: 0;\n inset-block-end: 0;\n inline-size: 8px;\n block-size: 8px;\n background-color: var(--rdg-selection-color);\n\n &:hover {\n inline-size: 16px;\n block-size: 16px;\n border: 2px solid var(--rdg-selection-color);\n background-color: var(--rdg-background-color);\n }\n }\n`;\n\nconst cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;\n\ninterface Props<R, SR> extends Pick<DataGridProps<R, SR>, 'rows' | 'onRowsChange'> {\n columns: readonly CalculatedColumn<R, SR>[];\n selectedPosition: SelectCellState;\n latestDraggedOverRowIdx: React.MutableRefObject<number | undefined>;\n isCellEditable: (position: Position) => boolean;\n onFill: (event: FillEvent<R>) => R;\n setDragging: (isDragging: boolean) => void;\n setDraggedOverRowIdx: (overRowIdx: number | undefined) => void;\n}\n\nexport default function DragHandle<R, SR>({\n rows,\n columns,\n selectedPosition,\n latestDraggedOverRowIdx,\n isCellEditable,\n onRowsChange,\n onFill,\n setDragging,\n setDraggedOverRowIdx\n}: Props<R, SR>) {\n function handleMouseDown(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (event.buttons !== 1) return;\n setDragging(true);\n window.addEventListener('mouseover', onMouseOver);\n window.addEventListener('mouseup', onMouseUp);\n\n function onMouseOver(event: MouseEvent) {\n // Trigger onMouseup in edge cases where we release the mouse button but `mouseup` isn't triggered,\n // for example when releasing the mouse button outside the iframe the grid is rendered in.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n if (event.buttons !== 1) onMouseUp();\n }\n\n function onMouseUp() {\n window.removeEventListener('mouseover', onMouseOver);\n window.removeEventListener('mouseup', onMouseUp);\n setDragging(false);\n handleDragEnd();\n }\n }\n\n function handleDragEnd() {\n const overRowIdx = latestDraggedOverRowIdx.current;\n if (overRowIdx === undefined) return;\n\n const { rowIdx } = selectedPosition;\n const startRowIndex = rowIdx < overRowIdx ? rowIdx + 1 : overRowIdx;\n const endRowIndex = rowIdx < overRowIdx ? overRowIdx + 1 : rowIdx;\n updateRows(startRowIndex, endRowIndex);\n setDraggedOverRowIdx(undefined);\n }\n\n function handleDoubleClick(event: React.MouseEvent<HTMLDivElement>) {\n event.stopPropagation();\n updateRows(selectedPosition.rowIdx + 1, rows.length);\n }\n\n function updateRows(startRowIdx: number, endRowIdx: number) {\n const { idx, rowIdx } = selectedPosition;\n const column = columns[idx];\n const sourceRow = rows[rowIdx];\n const updatedRows = [...rows];\n const indexes: number[] = [];\n for (let i = startRowIdx; i < endRowIdx; i++) {\n if (isCellEditable({ rowIdx: i, idx })) {\n const updatedRow = onFill({ columnKey: column.key, sourceRow, targetRow: rows[i] });\n if (updatedRow !== rows[i]) {\n updatedRows[i] = updatedRow;\n indexes.push(i);\n }\n }\n }\n\n if (indexes.length > 0) {\n onRowsChange?.(updatedRows, { indexes, column });\n }\n }\n\n return (\n <div\n className={cellDragHandleClassname}\n onMouseDown={handleMouseDown}\n onDoubleClick={handleDoubleClick}\n />\n );\n}\n","import { css } from '@linaria/core';\nimport type { SortStatusProps, SortIconProps, SortPriorityProps } from './types';\n\nconst arrow = css`\n @layer rdg.SortIcon {\n fill: currentColor;\n\n > path {\n transition: d 0.1s;\n }\n }\n`;\n\nconst arrowClassname = `rdg-sort-arrow ${arrow}`;\n\nexport default function sortStatus({ sortDirection, priority }: SortStatusProps) {\n return (\n <>\n {sortIcon({ sortDirection })}\n {sortPriority({ priority })}\n </>\n );\n}\n\nexport function sortIcon({ sortDirection }: SortIconProps) {\n if (sortDirection === undefined) return null;\n\n return (\n <svg viewBox=\"0 0 12 8\" width=\"12\" height=\"8\" className={arrowClassname} aria-hidden>\n <path d={sortDirection === 'ASC' ? 'M0 8 6 0 12 8' : 'M0 0 6 8 12 0'} />\n </svg>\n );\n}\n\nexport function sortPriority({ priority }: SortPriorityProps) {\n return priority;\n}\n","import { forwardRef, useState, useRef, useImperativeHandle, useCallback, useMemo } from 'react';\nimport type { Key, RefAttributes } from 'react';\nimport { flushSync } from 'react-dom';\nimport clsx from 'clsx';\n\nimport {\n rootClassname,\n viewportDraggingClassname,\n focusSinkClassname,\n rowSelected,\n rowSelectedWithFrozenCell\n} from './style';\nimport {\n useLayoutEffect,\n useGridDimensions,\n useCalculatedColumns,\n useViewportColumns,\n useViewportRows,\n useLatestFunc,\n RowSelectionChangeProvider\n} from './hooks';\nimport HeaderRow from './HeaderRow';\nimport { defaultRowRenderer } from './Row';\nimport GroupRowRenderer from './GroupRow';\nimport SummaryRow from './SummaryRow';\nimport EditCell from './EditCell';\nimport DragHandle from './DragHandle';\nimport { default as defaultSortStatus } from './sortStatus';\nimport { checkboxFormatter as defaultCheckboxFormatter } from './formatters';\nimport {\n DataGridDefaultComponentsProvider,\n useDefaultComponents\n} from './DataGridDefaultComponentsProvider';\nimport {\n assertIsValidKeyGetter,\n getNextSelectedCellPosition,\n isSelectedCellEditable,\n canExitGrid,\n isCtrlKeyHeldDown,\n isDefaultCellInput,\n getColSpan,\n sign,\n abs,\n getSelectedCellColSpan,\n renderMeasuringCells,\n scrollIntoView\n} from './utils';\n\nimport type {\n CalculatedColumn,\n Column,\n Position,\n RowsChangeData,\n SelectRowEvent,\n FillEvent,\n CopyEvent,\n PasteEvent,\n CellNavigationMode,\n SortColumn,\n RowHeightArgs,\n Maybe,\n Renderers,\n Direction\n} from './types';\n\nexport interface SelectCellState extends Position {\n readonly mode: 'SELECT';\n}\n\ninterface EditCellState<R> extends Position {\n readonly mode: 'EDIT';\n readonly row: R;\n readonly originalRow: R;\n}\n\ntype DefaultColumnOptions<R, SR> = Pick<\n Column<R, SR>,\n 'formatter' | 'width' | 'minWidth' | 'maxWidth' | 'resizable' | 'sortable'\n>;\n\nconst initialPosition: SelectCellState = {\n idx: -1,\n rowIdx: -2,\n mode: 'SELECT'\n};\n\nexport interface DataGridHandle {\n element: HTMLDivElement | null;\n scrollToColumn: (colIdx: number) => void;\n scrollToRow: (rowIdx: number) => void;\n selectCell: (position: Position, enableEditor?: Maybe<boolean>) => void;\n}\n\ntype SharedDivProps = Pick<\n React.HTMLAttributes<HTMLDivElement>,\n 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'className' | 'style'\n>;\n\nexport interface DataGridProps<R, SR = unknown, K extends Key = Key> extends SharedDivProps {\n /**\n * Grid and data Props\n */\n /** An array of objects representing each column on the grid */\n columns: readonly Column<R, SR>[];\n /** A function called for each rendered row that should return a plain key/value pair object */\n rows: readonly R[];\n /**\n * Rows to be pinned at the top of the rows view for summary, the vertical scroll bar will not scroll these rows.\n */\n topSummaryRows?: Maybe<readonly SR[]>;\n /**\n * Rows to be pinned at the bottom of the rows view for summary, the vertical scroll bar will not scroll these rows.\n */\n bottomSummaryRows?: Maybe<readonly SR[]>;\n /** The getter should return a unique key for each row */\n rowKeyGetter?: Maybe<(row: R) => K>;\n onRowsChange?: Maybe<(rows: R[], data: RowsChangeData<R, SR>) => void>;\n\n /**\n * Dimensions props\n */\n /**\n * The height of each row in pixels\n * @default 35\n */\n rowHeight?: Maybe<number | ((args: RowHeightArgs<R>) => number)>;\n /**\n * The height of the header row in pixels\n * @default 35\n */\n headerRowHeight?: Maybe<number>;\n /**\n * The height of each summary row in pixels\n * @default 35\n */\n summaryRowHeight?: Maybe<number>;\n\n /**\n * Feature props\n */\n /** Set of selected row keys */\n selectedRows?: Maybe<ReadonlySet<K>>;\n /** Function called whenever row selection is changed */\n onSelectedRowsChange?: Maybe<(selectedRows: Set<K>) => void>;\n /** Used for multi column sorting */\n sortColumns?: Maybe<readonly SortColumn[]>;\n onSortColumnsChange?: Maybe<(sortColumns: SortColumn[]) => void>;\n defaultColumnOptions?: Maybe<DefaultColumnOptions<R, SR>>;\n groupBy?: Maybe<readonly string[]>;\n rowGrouper?: Maybe<(rows: readonly R[], columnKey: string) => Record<string, readonly R[]>>;\n expandedGroupIds?: Maybe<ReadonlySet<unknown>>;\n onExpandedGroupIdsChange?: Maybe<(expandedGroupIds: Set<unknown>) => void>;\n onFill?: Maybe<(event: FillEvent<R>) => R>;\n onCopy?: Maybe<(event: CopyEvent<R>) => void>;\n onPaste?: Maybe<(event: PasteEvent<R>) => R>;\n\n /**\n * Event props\n */\n /** Function called whenever a row is clicked */\n onRowClick?: Maybe<(row: R, column: CalculatedColumn<R, SR>) => void>;\n /** Function called whenever a row is double clicked */\n onRowDoubleClick?: Maybe<(row: R, column: CalculatedColumn<R, SR>) => void>;\n /** Called when the grid is scrolled */\n onScroll?: Maybe<(event: React.UIEvent<HTMLDivElement>) => void>;\n /** Called when a column is resized */\n onColumnResize?: Maybe<(idx: number, width: number) => void>;\n\n /**\n * Toggles and modes\n */\n /** @default 'NONE' */\n cellNavigationMode?: Maybe<CellNavigationMode>;\n /** @default true */\n enableVirtualization?: Maybe<boolean>;\n\n /**\n * Miscellaneous\n */\n renderers?: Maybe<Renderers<R, SR>>;\n rowClass?: Maybe<(row: R) => Maybe<string>>;\n /** @default 'ltr' */\n direction?: Maybe<Direction>;\n 'data-testid'?: Maybe<string>;\n}\n\n/**\n * Main API Component to render a data grid of rows and columns\n *\n * @example\n *\n * <DataGrid columns={columns} rows={rows} />\n */\nfunction DataGrid<R, SR, K extends Key>(\n props: DataGridProps<R, SR, K>,\n ref: React.Ref<DataGridHandle>\n) {\n const {\n // Grid and data Props\n columns: rawColumns,\n rows: rawRows,\n topSummaryRows,\n bottomSummaryRows,\n rowKeyGetter,\n onRowsChange,\n // Dimensions props\n rowHeight: rawRowHeight,\n headerRowHeight: rawHeaderRowHeight,\n summaryRowHeight: rawSummaryRowHeight,\n // Feature props\n selectedRows,\n onSelectedRowsChange,\n sortColumns,\n onSortColumnsChange,\n defaultColumnOptions,\n groupBy: rawGroupBy,\n rowGrouper,\n expandedGroupIds,\n onExpandedGroupIdsChange,\n // Event props\n onRowClick,\n onRowDoubleClick,\n onScroll,\n onColumnResize,\n onFill,\n onCopy,\n onPaste,\n // Toggles and modes\n cellNavigationMode: rawCellNavigationMode,\n enableVirtualization: rawEnableVirtualization,\n // Miscellaneous\n renderers,\n className,\n style,\n rowClass,\n direction: rawDirection,\n // ARIA\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'data-testid': testId\n } = props;\n\n /**\n * defaults\n */\n const defaultComponents = useDefaultComponents<R, SR>();\n const rowHeight = rawRowHeight ?? 35;\n const headerRowHeight = rawHeaderRowHeight ?? (typeof rowHeight === 'number' ? rowHeight : 35);\n const summaryRowHeight = rawSummaryRowHeight ?? (typeof rowHeight === 'number' ? rowHeight : 35);\n const rowRenderer =\n renderers?.rowRenderer ?? defaultComponents?.rowRenderer ?? defaultRowRenderer;\n const sortStatus = renderers?.sortStatus ?? defaultComponents?.sortStatus ?? defaultSortStatus;\n const checkboxFormatter =\n renderers?.checkboxFormatter ??\n defaultComponents?.checkboxFormatter ??\n defaultCheckboxFormatter;\n const noRowsFallback = renderers?.noRowsFallback ?? defaultComponents?.noRowsFallback;\n const cellNavigationMode = rawCellNavigationMode ?? 'NONE';\n const enableVirtualization = rawEnableVirtualization ?? true;\n const direction = rawDirection ?? 'ltr';\n\n /**\n * states\n */\n const [scrollTop, setScrollTop] = useState(0);\n const [scrollLeft, setScrollLeft] = useState(0);\n const [columnWidths, setColumnWidths] = useState((): ReadonlyMap<string, number> => new Map());\n const [selectedPosition, setSelectedPosition] = useState<SelectCellState | EditCellState<R>>(\n initialPosition\n );\n const [copiedCell, setCopiedCell] = useState<{ row: R; columnKey: string } | null>(null);\n const [isDragging, setDragging] = useState(false);\n const [draggedOverRowIdx, setOverRowIdx] = useState<number | undefined>(undefined);\n\n /**\n * refs\n */\n const prevSelectedPosition = useRef(selectedPosition);\n const latestDraggedOverRowIdx = useRef(draggedOverRowIdx);\n const lastSelectedRowIdx = useRef(-1);\n const rowRef = useRef<HTMLDivElement>(null);\n\n /**\n * computed values\n */\n const [gridRef, gridWidth, gridHeight, isWidthInitialized] = useGridDimensions();\n const headerRowsCount = 1;\n const topSummaryRowsCount = topSummaryRows?.length ?? 0;\n const bottomSummaryRowsCount = bottomSummaryRows?.length ?? 0;\n const summaryRowsCount = topSummaryRowsCount + bottomSummaryRowsCount;\n const clientHeight = gridHeight - headerRowHeight - summaryRowsCount * summaryRowHeight;\n const isSelectable = selectedRows != null && onSelectedRowsChange != null;\n const isRtl = direction === 'rtl';\n const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';\n const rightKey = isRtl ? 'ArrowLeft' : 'ArrowRight';\n\n const defaultGridComponents = useMemo(\n () => ({\n sortStatus,\n checkboxFormatter\n }),\n [sortStatus, checkboxFormatter]\n );\n\n const allRowsSelected = useMemo((): boolean => {\n // no rows to select = explicitely unchecked\n const { length } = rawRows;\n return (\n length !== 0 &&\n selectedRows != null &&\n rowKeyGetter != null &&\n selectedRows.size >= length &&\n rawRows.every((row) => selectedRows.has(rowKeyGetter(row)))\n );\n }, [rawRows, selectedRows, rowKeyGetter]);\n\n const {\n columns,\n colSpanColumns,\n colOverscanStartIdx,\n colOverscanEndIdx,\n templateColumns,\n layoutCssVars,\n columnMetrics,\n lastFrozenColumnIndex,\n totalFrozenColumnWidth,\n groupBy\n } = useCalculatedColumns({\n rawColumns,\n columnWidths,\n scrollLeft,\n viewportWidth: gridWidth,\n defaultColumnOptions,\n rawGroupBy: rowGrouper ? rawGroupBy : undefined,\n enableVirtualization\n });\n\n const {\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n rowsCount,\n totalRowHeight,\n gridTemplateRows,\n isGroupRow,\n getRowTop,\n getRowHeight,\n findRowIdx\n } = useViewportRows({\n rawRows,\n groupBy,\n rowGrouper,\n rowHeight,\n clientHeight,\n scrollTop,\n expandedGroupIds,\n enableVirtualization\n });\n\n const { viewportColumns, flexWidthViewportColumns } = useViewportColumns({\n columns,\n colSpanColumns,\n colOverscanStartIdx,\n colOverscanEndIdx,\n lastFrozenColumnIndex,\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n topSummaryRows,\n bottomSummaryRows,\n columnWidths,\n isGroupRow\n });\n\n const hasGroups = groupBy.length > 0 && typeof rowGrouper === 'function';\n const minColIdx = hasGroups ? -1 : 0;\n const maxColIdx = columns.length - 1;\n const minRowIdx = -1 - topSummaryRowsCount;\n const maxRowIdx = rows.length + bottomSummaryRowsCount - 1;\n const selectedCellIsWithinSelectionBounds = isCellWithinSelectionBounds(selectedPosition);\n const selectedCellIsWithinViewportBounds = isCellWithinViewportBounds(selectedPosition);\n\n /**\n * The identity of the wrapper function is stable so it won't break memoization\n */\n const handleColumnResizeLatest = useLatestFunc(handleColumnResize);\n const onSortColumnsChangeLatest = useLatestFunc(onSortColumnsChange);\n const onRowClickLatest = useLatestFunc(onRowClick);\n const onRowDoubleClickLatest = useLatestFunc(onRowDoubleClick);\n const selectRowLatest = useLatestFunc(selectRow);\n const selectAllRowsLatest = useLatestFunc(selectAllRows);\n const handleFormatterRowChangeLatest = useLatestFunc(updateRow);\n const selectViewportCellLatest = useLatestFunc(\n (row: R, column: CalculatedColumn<R, SR>, enableEditor: Maybe<boolean>) => {\n const rowIdx = rows.indexOf(row);\n selectCell({ rowIdx, idx: column.idx }, enableEditor);\n }\n );\n const selectGroupLatest = useLatestFunc((rowIdx: number) => {\n selectCell({ rowIdx, idx: -1 });\n });\n const selectHeaderCellLatest = useLatestFunc((idx: number) => {\n selectCell({ rowIdx: minRowIdx, idx });\n });\n const selectTopSummaryCellLatest = useLatestFunc(\n (summaryRow: SR, column: CalculatedColumn<R, SR>) => {\n const rowIdx = topSummaryRows!.indexOf(summaryRow);\n selectCell({ rowIdx: rowIdx + minRowIdx + 1, idx: column.idx });\n }\n );\n const selectBottomSummaryCellLatest = useLatestFunc(\n (summaryRow: SR, column: CalculatedColumn<R, SR>) => {\n const rowIdx = bottomSummaryRows!.indexOf(summaryRow) + rows.length;\n selectCell({ rowIdx, idx: column.idx });\n }\n );\n const toggleGroupLatest = useLatestFunc(toggleGroup);\n\n /**\n * effects\n */\n useLayoutEffect(() => {\n if (\n !selectedCellIsWithinSelectionBounds ||\n isSamePosition(selectedPosition, prevSelectedPosition.current)\n ) {\n prevSelectedPosition.current = selectedPosition;\n return;\n }\n\n prevSelectedPosition.current = selectedPosition;\n\n if (selectedPosition.idx === -1) {\n rowRef.current!.focus({ preventScroll: true });\n scrollIntoView(rowRef.current);\n }\n });\n\n useLayoutEffect(() => {\n if (!isWidthInitialized || flexWidthViewportColumns.length === 0) return;\n\n setColumnWidths((columnWidths) => {\n const newColumnWidths = new Map(columnWidths);\n const grid = gridRef.current!;\n\n for (const column of flexWidthViewportColumns) {\n const measuringCell = grid.querySelector(`[data-measuring-cell-key=\"${column.key}\"]`)!;\n // Set the actual width of the column after it is rendered\n const { width } = measuringCell.getBoundingClientRect();\n newColumnWidths.set(column.key, width);\n }\n\n return newColumnWidths;\n });\n }, [isWidthInitialized, flexWidthViewportColumns, gridRef]);\n\n useImperativeHandle(ref, () => ({\n element: gridRef.current,\n scrollToColumn,\n scrollToRow(rowIdx: number) {\n const { current } = gridRef;\n if (!current) return;\n current.scrollTo({\n top: getRowTop(rowIdx),\n behavior: 'smooth'\n });\n },\n selectCell\n }));\n\n /**\n * callbacks\n */\n const setDraggedOverRowIdx = useCallback((rowIdx?: number) => {\n setOverRowIdx(rowIdx);\n latestDraggedOverRowIdx.current = rowIdx;\n }, []);\n\n /**\n * event handlers\n */\n function handleColumnResize(column: CalculatedColumn<R, SR>, width: number | 'max-content') {\n const { style } = gridRef.current!;\n const newTemplateColumns = [...templateColumns];\n newTemplateColumns[column.idx] = width === 'max-content' ? width : `${width}px`;\n style.gridTemplateColumns = newTemplateColumns.join(' ');\n\n const measuringCell = gridRef.current!.querySelector(\n `[data-measuring-cell-key=\"${column.key}\"]`\n )!;\n const measuredWidth = measuringCell.getBoundingClientRect().width;\n const measuredWidthPx = `${measuredWidth}px`;\n\n // Immediately update `grid-template-columns` to prevent the column from jumping to its min/max allowed width.\n // Only measuring cells have the min/max width set for proper colSpan support,\n // which is why other cells may render at the previously set width, beyond the min/max.\n // An alternative for the above would be to use flushSync.\n // We also have to reset `max-content` so it doesn't remain stuck on `max-content`.\n if (newTemplateColumns[column.idx] !== measuredWidthPx) {\n newTemplateColumns[column.idx] = measuredWidthPx;\n style.gridTemplateColumns = newTemplateColumns.join(' ');\n }\n\n if (columnWidths.get(column.key) === measuredWidth) return;\n\n const newColumnWidths = new Map(columnWidths);\n newColumnWidths.set(column.key, measuredWidth);\n setColumnWidths(newColumnWidths);\n\n onColumnResize?.(column.idx, measuredWidth);\n }\n\n function selectRow({ row, checked, isShiftClick }: SelectRowEvent<R>) {\n if (!onSelectedRowsChange) return;\n\n assertIsValidKeyGetter<R, K>(rowKeyGetter);\n const newSelectedRows = new Set(selectedRows);\n if (isGroupRow(row)) {\n for (const childRow of row.childRows) {\n const rowKey = rowKeyGetter(childRow);\n if (checked) {\n newSelectedRows.add(rowKey);\n } else {\n newSelectedRows.delete(rowKey);\n }\n }\n onSelectedRowsChange(newSelectedRows);\n return;\n }\n\n const rowKey = rowKeyGetter(row);\n if (checked) {\n newSelectedRows.add(rowKey);\n const previousRowIdx = lastSelectedRowIdx.current;\n const rowIdx = rows.indexOf(row);\n lastSelectedRowIdx.current = rowIdx;\n if (isShiftClick && previousRowIdx !== -1 && previousRowIdx !== rowIdx) {\n const step = sign(rowIdx - previousRowIdx);\n for (let i = previousRowIdx + step; i !== rowIdx; i += step) {\n const row = rows[i];\n if (isGroupRow(row)) continue;\n newSelectedRows.add(rowKeyGetter(row));\n }\n }\n } else {\n newSelectedRows.delete(rowKey);\n lastSelectedRowIdx.current = -1;\n }\n\n onSelectedRowsChange(newSelectedRows);\n }\n\n function selectAllRows(checked: boolean) {\n if (!onSelectedRowsChange) return;\n\n assertIsValidKeyGetter<R, K>(rowKeyGetter);\n const newSelectedRows = new Set(selectedRows);\n\n for (const row of rawRows) {\n const rowKey = rowKeyGetter(row);\n if (checked) {\n newSelectedRows.add(rowKey);\n } else {\n newSelectedRows.delete(rowKey);\n }\n }\n\n onSelectedRowsChange(newSelectedRows);\n }\n\n function toggleGroup(expandedGroupId: unknown) {\n if (!onExpandedGroupIdsChange) return;\n const newExpandedGroupIds = new Set(expandedGroupIds);\n if (newExpandedGroupIds.has(expandedGroupId)) {\n newExpandedGroupIds.delete(expandedGroupId);\n } else {\n newExpandedGroupIds.add(expandedGroupId);\n }\n onExpandedGroupIdsChange(newExpandedGroupIds);\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (!(event.target instanceof Element)) return;\n const isCellEvent = event.target.closest('.rdg-cell') !== null;\n const isRowEvent = hasGroups && event.target === rowRef.current;\n if (!isCellEvent && !isRowEvent) return;\n\n const { key, keyCode } = event;\n const { rowIdx } = selectedPosition;\n\n if (\n selectedCellIsWithinViewportBounds &&\n (onPaste != null || onCopy != null) &&\n isCtrlKeyHeldDown(event) &&\n !isGroupRow(rows[rowIdx]) &&\n selectedPosition.mode === 'SELECT'\n ) {\n // event.key may differ by keyboard input language, so we use event.keyCode instead\n // event.nativeEvent.code cannot be used either as it would break copy/paste for the DVORAK layout\n const cKey = 67;\n const vKey = 86;\n if (keyCode === cKey) {\n handleCopy();\n return;\n }\n if (keyCode === vKey) {\n handlePaste();\n return;\n }\n }\n\n if (isRowIdxWithinViewportBounds(rowIdx)) {\n const row = rows[rowIdx];\n\n if (\n isGroupRow(row) &&\n selectedPosition.idx === -1 &&\n // Collapse the current group row if it is focused and is in expanded state\n ((key === leftKey && row.isExpanded) ||\n // Expand the current group row if it is focused and is in collapsed state\n (key === rightKey && !row.isExpanded))\n ) {\n event.preventDefault(); // Prevents scrolling\n toggleGroup(row.id);\n return;\n }\n }\n\n switch (event.key) {\n case 'Escape':\n setCopiedCell(null);\n return;\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Tab':\n case 'Home':\n case 'End':\n case 'PageUp':\n case 'PageDown':\n navigate(event);\n break;\n default:\n handleCellInput(event);\n break;\n }\n }\n\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n const { scrollTop, scrollLeft } = event.currentTarget;\n flushSync(() => {\n setScrollTop(scrollTop);\n // scrollLeft is nagative when direction is rtl\n setScrollLeft(abs(scrollLeft));\n });\n onScroll?.(event);\n }\n\n function getRawRowIdx(rowIdx: number) {\n return hasGroups ? rawRows.indexOf(rows[rowIdx] as R) : rowIdx;\n }\n\n function updateRow(column: CalculatedColumn<R, SR>, rowIdx: number, row: R) {\n if (typeof onRowsChange !== 'function') return;\n const rawRowIdx = getRawRowIdx(rowIdx);\n if (row === rawRows[rawRowIdx]) return;\n const updatedRows = [...rawRows];\n updatedRows[rawRowIdx] = row;\n onRowsChange(updatedRows, {\n indexes: [rawRowIdx],\n column\n });\n }\n\n function commitEditorChanges() {\n if (selectedPosition.mode !== 'EDIT') return;\n updateRow(columns[selectedPosition.idx], selectedPosition.rowIdx, selectedPosition.row);\n }\n\n function handleCopy() {\n const { idx, rowIdx } = selectedPosition;\n const sourceRow = rawRows[getRawRowIdx(rowIdx)];\n const sourceColumnKey = columns[idx].key;\n setCopiedCell({ row: sourceRow, columnKey: sourceColumnKey });\n onCopy?.({ sourceRow, sourceColumnKey });\n }\n\n function handlePaste() {\n if (!onPaste || !onRowsChange || copiedCell === null || !isCellEditable(selectedPosition)) {\n return;\n }\n\n const { idx, rowIdx } = selectedPosition;\n const targetColumn = columns[idx];\n const targetRow = rawRows[getRawRowIdx(rowIdx)];\n\n const updatedTargetRow = onPaste({\n sourceRow: copiedCell.row,\n sourceColumnKey: copiedCell.columnKey,\n targetRow,\n targetColumnKey: targetColumn.key\n });\n\n updateRow(targetColumn, rowIdx, updatedTargetRow);\n }\n\n function handleCellInput(event: React.KeyboardEvent<HTMLDivElement>) {\n if (!selectedCellIsWithinViewportBounds) return;\n const row = rows[selectedPosition.rowIdx];\n if (isGroupRow(row)) return;\n const { key, shiftKey } = event;\n\n // Select the row on Shift + Space\n if (isSelectable && shiftKey && key === ' ') {\n assertIsValidKeyGetter<R, K>(rowKeyGetter);\n const rowKey = rowKeyGetter(row);\n selectRow({ row, checked: !selectedRows.has(rowKey), isShiftClick: false });\n // do not scroll\n event.preventDefault();\n return;\n }\n\n const column = columns[selectedPosition.idx];\n column.editorOptions?.onCellKeyDown?.(event);\n if (event.isDefaultPrevented()) return;\n\n if (isCellEditable(selectedPosition) && isDefaultCellInput(event)) {\n setSelectedPosition(({ idx, rowIdx }) => ({\n idx,\n rowIdx,\n mode: 'EDIT',\n row,\n originalRow: row\n }));\n }\n }\n\n /**\n * utils\n */\n function isColIdxWithinSelectionBounds(idx: number) {\n return idx >= minColIdx && idx <= maxColIdx;\n }\n\n function isRowIdxWithinViewportBounds(rowIdx: number) {\n return rowIdx >= 0 && rowIdx < rows.length;\n }\n\n function isCellWithinSelectionBounds({ idx, rowIdx }: Position): boolean {\n return rowIdx >= minRowIdx && rowIdx <= maxRowIdx && isColIdxWithinSelectionBounds(idx);\n }\n\n function isCellWithinViewportBounds({ idx, rowIdx }: Position): boolean {\n return isRowIdxWithinViewportBounds(rowIdx) && isColIdxWithinSelectionBounds(idx);\n }\n\n function isCellEditable(position: Position): boolean {\n return (\n isCellWithinViewportBounds(position) &&\n isSelectedCellEditable({ columns, rows, selectedPosition: position, isGroupRow })\n );\n }\n\n function selectCell(position: Position, enableEditor?: Maybe<boolean>): void {\n if (!isCellWithinSelectionBounds(position)) return;\n commitEditorChanges();\n\n if (enableEditor && isCellEditable(position)) {\n const row = rows[position.rowIdx] as R;\n setSelectedPosition({ ...position, mode: 'EDIT', row, originalRow: row });\n } else if (isSamePosition(selectedPosition, position)) {\n // Avoid re-renders if the selected cell state is the same\n scrollIntoView(gridRef.current?.querySelector('[tabindex=\"0\"]'));\n } else {\n setSelectedPosition({ ...position, mode: 'SELECT' });\n }\n }\n\n function scrollToColumn(idx: number): void {\n const { current } = gridRef;\n if (!current) return;\n\n if (idx > lastFrozenColumnIndex) {\n const { rowIdx } = selectedPosition;\n if (!isCellWithinSelectionBounds({ rowIdx, idx })) return;\n const { clientWidth } = current;\n const column = columns[idx];\n const { left, width } = columnMetrics.get(column)!;\n let right = left + width;\n\n const colSpan = getSelectedCellColSpan({\n rows,\n topSummaryRows,\n bottomSummaryRows,\n rowIdx,\n lastFrozenColumnIndex,\n column,\n isGroupRow\n });\n\n if (colSpan !== undefined) {\n const { left, width } = columnMetrics.get(columns[column.idx + colSpan - 1])!;\n right = left + width;\n }\n\n const isCellAtLeftBoundary = left < scrollLeft + totalFrozenColumnWidth;\n const isCellAtRightBoundary = right > clientWidth + scrollLeft;\n const sign = isRtl ? -1 : 1;\n if (isCellAtLeftBoundary) {\n current.scrollLeft = (left - totalFrozenColumnWidth) * sign;\n } else if (isCellAtRightBoundary) {\n current.scrollLeft = (right - clientWidth) * sign;\n }\n }\n }\n\n function getNextPosition(key: string, ctrlKey: boolean, shiftKey: boolean): Position {\n const { idx, rowIdx } = selectedPosition;\n const row = rows[rowIdx];\n const isRowSelected = selectedCellIsWithinSelectionBounds && idx === -1;\n\n // If a group row is focused, and it is collapsed, move to the parent group row (if there is one).\n if (key === leftKey && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) {\n let parentRowIdx = -1;\n for (let i = selectedPosition.rowIdx - 1; i >= 0; i--) {\n const parentRow = rows[i];\n if (isGroupRow(parentRow) && parentRow.id === row.parentId) {\n parentRowIdx = i;\n break;\n }\n }\n if (parentRowIdx !== -1) {\n return { idx, rowIdx: parentRowIdx };\n }\n }\n\n switch (key) {\n case 'ArrowUp':\n return { idx, rowIdx: rowIdx - 1 };\n case 'ArrowDown':\n return { idx, rowIdx: rowIdx + 1 };\n case leftKey:\n return { idx: idx - 1, rowIdx };\n case rightKey:\n return { idx: idx + 1, rowIdx };\n case 'Tab':\n return { idx: idx + (shiftKey ? -1 : 1), rowIdx };\n case 'Home':\n // If row is selected then move focus to the first row\n if (isRowSelected) return { idx, rowIdx: 0 };\n return { idx: 0, rowIdx: ctrlKey ? minRowIdx : rowIdx };\n case 'End':\n // If row is selected then move focus to the last row.\n if (isRowSelected) return { idx, rowIdx: rows.length - 1 };\n return { idx: maxColIdx, rowIdx: ctrlKey ? maxRowIdx : rowIdx };\n case 'PageUp': {\n if (selectedPosition.rowIdx === minRowIdx) return selectedPosition;\n const nextRowY = getRowTop(rowIdx) + getRowHeight(rowIdx) - clientHeight;\n return { idx, rowIdx: nextRowY > 0 ? findRowIdx(nextRowY) : 0 };\n }\n case 'PageDown': {\n if (selectedPosition.rowIdx >= rows.length) return selectedPosition;\n const nextRowY = getRowTop(rowIdx) + clientHeight;\n return { idx, rowIdx: nextRowY < totalRowHeight ? findRowIdx(nextRowY) : rows.length - 1 };\n }\n default:\n return selectedPosition;\n }\n }\n\n function navigate(event: React.KeyboardEvent<HTMLDivElement>) {\n const { key, shiftKey } = event;\n let mode = cellNavigationMode;\n if (key === 'Tab') {\n if (\n canExitGrid({\n shiftKey,\n cellNavigationMode,\n maxColIdx,\n minRowIdx,\n maxRowIdx,\n selectedPosition\n })\n ) {\n commitEditorChanges();\n // Allow focus to leave the grid so the next control in the tab order can be focused\n return;\n }\n\n mode = cellNavigationMode === 'NONE' ? 'CHANGE_ROW' : cellNavigationMode;\n }\n\n // Do not allow focus to leave\n event.preventDefault();\n\n const ctrlKey = isCtrlKeyHeldDown(event);\n const nextPosition = getNextPosition(key, ctrlKey, shiftKey);\n if (isSamePosition(selectedPosition, nextPosition)) return;\n\n const nextSelectedCellPosition = getNextSelectedCellPosition({\n columns,\n colSpanColumns,\n rows,\n topSummaryRows,\n bottomSummaryRows,\n minRowIdx,\n maxRowIdx,\n lastFrozenColumnIndex,\n cellNavigationMode: mode,\n currentPosition: selectedPosition,\n nextPosition,\n isCellWithinBounds: isCellWithinSelectionBounds,\n isGroupRow\n });\n\n selectCell(nextSelectedCellPosition);\n }\n\n function getDraggedOverCellIdx(currentRowIdx: number): number | undefined {\n if (draggedOverRowIdx === undefined) return;\n const { rowIdx } = selectedPosition;\n\n const isDraggedOver =\n rowIdx < draggedOverRowIdx\n ? rowIdx < currentRowIdx && currentRowIdx <= draggedOverRowIdx\n : rowIdx > currentRowIdx && currentRowIdx >= draggedOverRowIdx;\n\n return isDraggedOver ? selectedPosition.idx : undefined;\n }\n\n function getLayoutCssVars() {\n if (flexWidthViewportColumns.length === 0) return layoutCssVars;\n const newTemplateColumns = [...templateColumns];\n for (const column of flexWidthViewportColumns) {\n newTemplateColumns[column.idx] = column.width as string;\n }\n\n return {\n ...layoutCssVars,\n gridTemplateColumns: newTemplateColumns.join(' ')\n };\n }\n\n function getDragHandle(rowIdx: number) {\n if (\n selectedPosition.rowIdx !== rowIdx ||\n selectedPosition.mode === 'EDIT' ||\n hasGroups || // drag fill is not supported when grouping is enabled\n onFill == null\n ) {\n return;\n }\n\n return (\n <DragHandle\n rows={rawRows}\n columns={columns}\n selectedPosition={selectedPosition}\n isCellEditable={isCellEditable}\n latestDraggedOverRowIdx={latestDraggedOverRowIdx}\n onRowsChange={onRowsChange}\n onFill={onFill}\n setDragging={setDragging}\n setDraggedOverRowIdx={setDraggedOverRowIdx}\n />\n );\n }\n\n function getCellEditor(rowIdx: number) {\n if (selectedPosition.rowIdx !== rowIdx || selectedPosition.mode === 'SELECT') return;\n\n const { idx, row } = selectedPosition;\n const column = columns[idx];\n const colSpan = getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row });\n\n const closeEditor = () => {\n setSelectedPosition(({ idx, rowIdx }) => ({ idx, rowIdx, mode: 'SELECT' }));\n };\n\n const onRowChange = (row: R, commitChanges?: boolean) => {\n if (commitChanges) {\n updateRow(column, selectedPosition.rowIdx, row);\n closeEditor();\n } else {\n setSelectedPosition((position) => ({ ...position, row }));\n }\n };\n\n if (rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) {\n // Discard changes if rows are updated from outside\n closeEditor();\n }\n\n return (\n <EditCell\n key={column.key}\n column={column}\n colSpan={colSpan}\n row={row}\n onRowChange={onRowChange}\n closeEditor={closeEditor}\n />\n );\n }\n\n function getRowViewportColumns(rowIdx: number) {\n const selectedColumn = columns[selectedPosition.idx];\n if (\n // idx can be -1 if grouping is enabled\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n selectedColumn !== undefined &&\n selectedPosition.rowIdx === rowIdx &&\n !viewportColumns.includes(selectedColumn)\n ) {\n // Add the selected column to viewport columns if the cell is not within the viewport\n return selectedPosition.idx > colOverscanEndIdx\n ? [...viewportColumns, selectedColumn]\n : [\n ...viewportColumns.slice(0, lastFrozenColumnIndex + 1),\n selectedColumn,\n ...viewportColumns.slice(lastFrozenColumnIndex + 1)\n ];\n }\n return viewportColumns;\n }\n\n function getViewportRows() {\n const rowElements: React.ReactNode[] = [];\n let startRowIndex = 0;\n\n const { idx: selectedIdx, rowIdx: selectedRowIdx } = selectedPosition;\n\n const startRowIdx =\n selectedCellIsWithinViewportBounds && selectedRowIdx < rowOverscanStartIdx\n ? rowOverscanStartIdx - 1\n : rowOverscanStartIdx;\n const endRowIdx =\n selectedCellIsWithinViewportBounds && selectedRowIdx > rowOverscanEndIdx\n ? rowOverscanEndIdx + 1\n : rowOverscanEndIdx;\n\n for (let viewportRowIdx = startRowIdx; viewportRowIdx <= endRowIdx; viewportRowIdx++) {\n const isRowOutsideViewport =\n viewportRowIdx === rowOverscanStartIdx - 1 || viewportRowIdx === rowOverscanEndIdx + 1;\n const rowIdx = isRowOutsideViewport ? selectedRowIdx : viewportRowIdx;\n\n let rowColumns = viewportColumns;\n const selectedColumn = columns[selectedIdx];\n // selectedIdx can be -1 if grouping is enabled\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (selectedColumn !== undefined) {\n if (isRowOutsideViewport) {\n // if the row is outside the viewport then only render the selected cell\n rowColumns = [selectedColumn];\n } else {\n // if the row is within the viewport and cell is not, add the selected column to viewport columns\n rowColumns = getRowViewportColumns(rowIdx);\n }\n }\n\n const row = rows[rowIdx];\n const gridRowStart = headerRowsCount + topSummaryRowsCount + rowIdx + 1;\n if (isGroupRow(row)) {\n ({ startRowIndex } = row);\n const isGroupRowSelected =\n isSelectable && row.childRows.every((cr) => selectedRows.has(rowKeyGetter!(cr)));\n rowElements.push(\n <GroupRowRenderer\n aria-level={row.level + 1} // aria-level is 1-based\n aria-setsize={row.setSize}\n aria-posinset={row.posInSet + 1} // aria-posinset is 1-based\n aria-rowindex={headerRowsCount + topSummaryRowsCount + startRowIndex + 1} // aria-rowindex is 1 based\n aria-selected={isSelectable ? isGroupRowSelected : undefined}\n key={row.id}\n id={row.id}\n groupKey={row.groupKey}\n viewportColumns={rowColumns}\n childRows={row.childRows}\n rowIdx={rowIdx}\n row={row}\n gridRowStart={gridRowStart}\n height={getRowHeight(rowIdx)}\n level={row.level}\n isExpanded={row.isExpanded}\n selectedCellIdx={selectedRowIdx === rowIdx ? selectedIdx : undefined}\n isRowSelected={isGroupRowSelected}\n selectGroup={selectGroupLatest}\n toggleGroup={toggleGroupLatest}\n />\n );\n continue;\n }\n\n startRowIndex++;\n let key;\n let isRowSelected = false;\n if (typeof rowKeyGetter === 'function') {\n key = rowKeyGetter(row);\n isRowSelected = selectedRows?.has(key) ?? false;\n } else {\n key = hasGroups ? startRowIndex : rowIdx;\n }\n\n rowElements.push(\n rowRenderer(key, {\n // aria-rowindex is 1 based\n 'aria-rowindex':\n headerRowsCount + topSummaryRowsCount + (hasGroups ? startRowIndex : rowIdx) + 1,\n 'aria-selected': isSelectable ? isRowSelected : undefined,\n rowIdx,\n row,\n viewportColumns: rowColumns,\n isRowSelected,\n onRowClick: onRowClickLatest,\n onRowDoubleClick: onRowDoubleClickLatest,\n rowClass,\n gridRowStart,\n height: getRowHeight(rowIdx),\n copiedCellIdx:\n copiedCell !== null && copiedCell.row === row\n ? columns.findIndex((c) => c.key === copiedCell.columnKey)\n : undefined,\n\n selectedCellIdx: selectedRowIdx === rowIdx ? selectedIdx : undefined,\n draggedOverCellIdx: getDraggedOverCellIdx(rowIdx),\n setDraggedOverRowIdx: isDragging ? setDraggedOverRowIdx : undefined,\n lastFrozenColumnIndex,\n onRowChange: handleFormatterRowChangeLatest,\n selectCell: selectViewportCellLatest,\n selectedCellDragHandle: getDragHandle(rowIdx),\n selectedCellEditor: getCellEditor(rowIdx)\n })\n );\n }\n\n return rowElements;\n }\n\n // Reset the positions if the current values are no longer valid. This can happen if a column or row is removed\n if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) {\n setSelectedPosition(initialPosition);\n setDraggedOverRowIdx(undefined);\n }\n\n let templateRows = `${headerRowHeight}px`;\n if (topSummaryRowsCount > 0) {\n templateRows += ` repeat(${topSummaryRowsCount}, ${summaryRowHeight}px)`;\n }\n if (rows.length > 0) {\n templateRows += gridTemplateRows;\n }\n if (bottomSummaryRowsCount > 0) {\n templateRows += ` repeat(${bottomSummaryRowsCount}, ${summaryRowHeight}px)`;\n }\n\n const isGroupRowFocused = selectedPosition.idx === -1 && selectedPosition.rowIdx !== -2;\n\n return (\n <div\n role={hasGroups ? 'treegrid' : 'grid'}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-multiselectable={isSelectable ? true : undefined}\n aria-colcount={columns.length}\n aria-rowcount={headerRowsCount + rowsCount + summaryRowsCount}\n className={clsx(\n rootClassname,\n {\n [viewportDraggingClassname]: isDragging\n },\n className\n )}\n style={\n {\n ...style,\n // set scrollPadding to correctly position non-sticky cells after scrolling\n scrollPaddingInlineStart:\n selectedPosition.idx > lastFrozenColumnIndex\n ? `${totalFrozenColumnWidth}px`\n : undefined,\n scrollPaddingBlock:\n selectedPosition.rowIdx >= 0 && selectedPosition.rowIdx < rows.length\n ? `${headerRowHeight + topSummaryRowsCount * summaryRowHeight}px ${\n bottomSummaryRowsCount * summaryRowHeight\n }px`\n : undefined,\n gridTemplateRows: templateRows,\n '--rdg-header-row-height': `${headerRowHeight}px`,\n '--rdg-summary-row-height': `${summaryRowHeight}px`,\n '--rdg-sign': isRtl ? -1 : 1,\n ...getLayoutCssVars()\n } as unknown as React.CSSProperties\n }\n dir={direction}\n ref={gridRef}\n onScroll={handleScroll}\n onKeyDown={handleKeyDown}\n data-testid={testId}\n >\n {/* extra div is needed for row navigation in a treegrid */}\n {hasGroups && (\n <div\n ref={rowRef}\n tabIndex={isGroupRowFocused ? 0 : -1}\n className={clsx(focusSinkClassname, {\n [rowSelected]: isGroupRowFocused,\n [rowSelectedWithFrozenCell]: isGroupRowFocused && lastFrozenColumnIndex !== -1\n })}\n style={{\n gridRowStart: selectedPosition.rowIdx + 2\n }}\n onKeyDown={handleKeyDown}\n />\n )}\n <DataGridDefaultComponentsProvider value={defaultGridComponents}>\n <HeaderRow\n columns={getRowViewportColumns(-1)}\n onColumnResize={handleColumnResizeLatest}\n allRowsSelected={allRowsSelected}\n onAllRowsSelectionChange={selectAllRowsLatest}\n sortColumns={sortColumns}\n onSortColumnsChange={onSortColumnsChangeLatest}\n lastFrozenColumnIndex={lastFrozenColumnIndex}\n selectedCellIdx={selectedPosition.rowIdx === minRowIdx ? selectedPosition.idx : undefined}\n selectCell={selectHeaderCellLatest}\n shouldFocusGrid={!selectedCellIsWithinSelectionBounds}\n direction={direction}\n />\n {rows.length === 0 && noRowsFallback ? (\n noRowsFallback\n ) : (\n <>\n {topSummaryRows?.map((row, rowIdx) => {\n const gridRowStart = headerRowsCount + rowIdx + 1;\n const summaryRowIdx = rowIdx + minRowIdx + 1;\n const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;\n const top = headerRowHeight + summaryRowHeight * rowIdx;\n\n return (\n <SummaryRow\n aria-rowindex={gridRowStart}\n key={rowIdx}\n rowIdx={rowIdx}\n gridRowStart={gridRowStart}\n row={row}\n top={top}\n bottom={undefined}\n lastTopRowIdx={topSummaryRowsCount - 1}\n viewportColumns={getRowViewportColumns(summaryRowIdx)}\n lastFrozenColumnIndex={lastFrozenColumnIndex}\n selectedCellIdx={isSummaryRowSelected ? selectedPosition.idx : undefined}\n selectCell={selectTopSummaryCellLatest}\n />\n );\n })}\n <RowSelectionChangeProvider value={selectRowLatest}>\n {getViewportRows()}\n </RowSelectionChangeProvider>\n {bottomSummaryRows?.map((row, rowIdx) => {\n const gridRowStart = headerRowsCount + topSummaryRowsCount + rows.length + rowIdx + 1;\n const summaryRowIdx = rows.length + rowIdx;\n const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;\n const top =\n clientHeight > totalRowHeight\n ? gridHeight - summaryRowHeight * (bottomSummaryRows.length - rowIdx)\n : undefined;\n const bottom =\n top === undefined\n ? summaryRowHeight * (bottomSummaryRows.length - 1 - rowIdx)\n : undefined;\n\n return (\n <SummaryRow\n aria-rowindex={headerRowsCount + topSummaryRowsCount + rowsCount + rowIdx + 1}\n key={rowIdx}\n rowIdx={rowIdx}\n gridRowStart={gridRowStart}\n row={row}\n top={top}\n bottom={bottom}\n lastTopRowIdx={undefined}\n viewportColumns={getRowViewportColumns(summaryRowIdx)}\n lastFrozenColumnIndex={lastFrozenColumnIndex}\n selectedCellIdx={isSummaryRowSelected ? selectedPosition.idx : undefined}\n selectCell={selectBottomSummaryCellLatest}\n />\n );\n })}\n </>\n )}\n\n {/* render empty cells that span only 1 column so we can safely measure column widths, regardless of colSpan */}\n {renderMeasuringCells(viewportColumns)}\n </DataGridDefaultComponentsProvider>\n </div>\n );\n}\n\nfunction isSamePosition(p1: Position, p2: Position) {\n return p1.idx === p2.idx && p1.rowIdx === p2.rowIdx;\n}\n\nexport default forwardRef(DataGrid) as <R, SR = unknown, K extends Key = Key>(\n props: DataGridProps<R, SR, K> & RefAttributes<DataGridHandle>\n) => JSX.Element;\n","import { useRef, useState } from 'react';\nimport { useLayoutEffect } from './useLayoutEffect';\n\nexport function useGridDimensions(): [\n ref: React.RefObject<HTMLDivElement>,\n width: number,\n height: number,\n isWidthInitialized: boolean\n] {\n const gridRef = useRef<HTMLDivElement>(null);\n const [inlineSize, setInlineSize] = useState(1);\n const [blockSize, setBlockSize] = useState(1);\n const [isWidthInitialized, setWidthInitialized] = useState(false);\n\n useLayoutEffect(() => {\n const { ResizeObserver } = window;\n\n // don't break in Node.js (SSR), jest/jsdom, and browsers that don't support ResizeObserver\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (ResizeObserver == null) return;\n\n const { clientWidth, clientHeight, offsetWidth, offsetHeight } = gridRef.current!;\n const { width, height } = gridRef.current!.getBoundingClientRect();\n const initialWidth = width - offsetWidth + clientWidth;\n const initialHeight = height - offsetHeight + clientHeight;\n\n setInlineSize(initialWidth);\n setBlockSize(initialHeight);\n setWidthInitialized(true);\n\n const resizeObserver = new ResizeObserver((entries) => {\n const size = entries[0].contentBoxSize[0];\n setInlineSize(size.inlineSize);\n setBlockSize(size.blockSize);\n });\n resizeObserver.observe(gridRef.current!);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n return [gridRef, inlineSize, blockSize, isWidthInitialized];\n}\n","import { useMemo } from 'react';\n\nimport type { CalculatedColumn, Column, Maybe } from '../types';\nimport type { DataGridProps } from '../DataGrid';\nimport { valueFormatter, toggleGroupFormatter } from '../formatters';\nimport { SELECT_COLUMN_KEY } from '../Columns';\nimport { clampColumnWidth, max, min } from '../utils';\n\ntype Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\ninterface ColumnMetric {\n width: number;\n left: number;\n}\n\nconst DEFAULT_COLUMN_WIDTH = 'auto';\nconst DEFAULT_COLUMN_MIN_WIDTH = 80;\n\ninterface CalculatedColumnsArgs<R, SR> extends Pick<DataGridProps<R, SR>, 'defaultColumnOptions'> {\n rawColumns: readonly Column<R, SR>[];\n rawGroupBy: Maybe<readonly string[]>;\n viewportWidth: number;\n scrollLeft: number;\n columnWidths: ReadonlyMap<string, number>;\n enableVirtualization: boolean;\n}\n\nexport function useCalculatedColumns<R, SR>({\n rawColumns,\n columnWidths,\n viewportWidth,\n scrollLeft,\n defaultColumnOptions,\n rawGroupBy,\n enableVirtualization\n}: CalculatedColumnsArgs<R, SR>) {\n const defaultWidth = defaultColumnOptions?.width ?? DEFAULT_COLUMN_WIDTH;\n const defaultMinWidth = defaultColumnOptions?.minWidth ?? DEFAULT_COLUMN_MIN_WIDTH;\n const defaultMaxWidth = defaultColumnOptions?.maxWidth ?? undefined;\n const defaultFormatter = defaultColumnOptions?.formatter ?? valueFormatter;\n const defaultSortable = defaultColumnOptions?.sortable ?? false;\n const defaultResizable = defaultColumnOptions?.resizable ?? false;\n\n const { columns, colSpanColumns, lastFrozenColumnIndex, groupBy } = useMemo((): {\n columns: readonly CalculatedColumn<R, SR>[];\n colSpanColumns: readonly CalculatedColumn<R, SR>[];\n lastFrozenColumnIndex: number;\n groupBy: readonly string[];\n } => {\n // Filter rawGroupBy and ignore keys that do not match the columns prop\n const groupBy: string[] = [];\n let lastFrozenColumnIndex = -1;\n\n const columns = rawColumns.map((rawColumn) => {\n const rowGroup = rawGroupBy?.includes(rawColumn.key) ?? false;\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const frozen = rowGroup || rawColumn.frozen || false;\n\n const column: Mutable<CalculatedColumn<R, SR>> = {\n ...rawColumn,\n idx: 0,\n frozen,\n isLastFrozenColumn: false,\n rowGroup,\n width: rawColumn.width ?? defaultWidth,\n minWidth: rawColumn.minWidth ?? defaultMinWidth,\n maxWidth: rawColumn.maxWidth ?? defaultMaxWidth,\n sortable: rawColumn.sortable ?? defaultSortable,\n resizable: rawColumn.resizable ?? defaultResizable,\n formatter: rawColumn.formatter ?? defaultFormatter\n };\n\n if (rowGroup) {\n column.groupFormatter ??= toggleGroupFormatter;\n }\n\n if (frozen) {\n lastFrozenColumnIndex++;\n }\n\n return column;\n });\n\n columns.sort(({ key: aKey, frozen: frozenA }, { key: bKey, frozen: frozenB }) => {\n // Sort select column first:\n if (aKey === SELECT_COLUMN_KEY) return -1;\n if (bKey === SELECT_COLUMN_KEY) return 1;\n\n // Sort grouped columns second, following the groupBy order:\n if (rawGroupBy?.includes(aKey)) {\n if (rawGroupBy.includes(bKey)) {\n return rawGroupBy.indexOf(aKey) - rawGroupBy.indexOf(bKey);\n }\n return -1;\n }\n if (rawGroupBy?.includes(bKey)) return 1;\n\n // Sort frozen columns third:\n if (frozenA) {\n if (frozenB) return 0;\n return -1;\n }\n if (frozenB) return 1;\n\n // Sort other columns last:\n return 0;\n });\n\n const colSpanColumns: CalculatedColumn<R, SR>[] = [];\n columns.forEach((column, idx) => {\n column.idx = idx;\n\n if (column.rowGroup) {\n groupBy.push(column.key);\n }\n\n if (column.colSpan != null) {\n colSpanColumns.push(column);\n }\n });\n\n if (lastFrozenColumnIndex !== -1) {\n columns[lastFrozenColumnIndex].isLastFrozenColumn = true;\n }\n\n return {\n columns,\n colSpanColumns,\n lastFrozenColumnIndex,\n groupBy\n };\n }, [\n rawColumns,\n defaultWidth,\n defaultMinWidth,\n defaultMaxWidth,\n defaultFormatter,\n defaultResizable,\n defaultSortable,\n rawGroupBy\n ]);\n\n const { templateColumns, layoutCssVars, totalFrozenColumnWidth, columnMetrics } = useMemo((): {\n templateColumns: readonly string[];\n layoutCssVars: Readonly<Record<string, string>>;\n totalFrozenColumnWidth: number;\n columnMetrics: ReadonlyMap<CalculatedColumn<R, SR>, ColumnMetric>;\n } => {\n const columnMetrics = new Map<CalculatedColumn<R, SR>, ColumnMetric>();\n let left = 0;\n let totalFrozenColumnWidth = 0;\n const templateColumns: string[] = [];\n\n for (const column of columns) {\n let width = columnWidths.get(column.key) ?? column.width;\n if (typeof width === 'number') {\n width = clampColumnWidth(width, column);\n } else {\n // This is a placeholder width so we can continue to use virtualization.\n // The actual value is set after the column is rendered\n width = column.minWidth;\n }\n templateColumns.push(`${width}px`);\n columnMetrics.set(column, { width, left });\n left += width;\n }\n\n if (lastFrozenColumnIndex !== -1) {\n const columnMetric = columnMetrics.get(columns[lastFrozenColumnIndex])!;\n totalFrozenColumnWidth = columnMetric.left + columnMetric.width;\n }\n\n const layoutCssVars: Record<string, string> = {\n gridTemplateColumns: templateColumns.join(' ')\n };\n\n for (let i = 0; i <= lastFrozenColumnIndex; i++) {\n const column = columns[i];\n layoutCssVars[`--rdg-frozen-left-${column.idx}`] = `${columnMetrics.get(column)!.left}px`;\n }\n\n return { templateColumns, layoutCssVars, totalFrozenColumnWidth, columnMetrics };\n }, [columnWidths, columns, lastFrozenColumnIndex]);\n\n const [colOverscanStartIdx, colOverscanEndIdx] = useMemo((): [number, number] => {\n if (!enableVirtualization) {\n return [0, columns.length - 1];\n }\n // get the viewport's left side and right side positions for non-frozen columns\n const viewportLeft = scrollLeft + totalFrozenColumnWidth;\n const viewportRight = scrollLeft + viewportWidth;\n // get first and last non-frozen column indexes\n const lastColIdx = columns.length - 1;\n const firstUnfrozenColumnIdx = min(lastFrozenColumnIndex + 1, lastColIdx);\n\n // skip rendering non-frozen columns if the frozen columns cover the entire viewport\n if (viewportLeft >= viewportRight) {\n return [firstUnfrozenColumnIdx, firstUnfrozenColumnIdx];\n }\n\n // get the first visible non-frozen column index\n let colVisibleStartIdx = firstUnfrozenColumnIdx;\n while (colVisibleStartIdx < lastColIdx) {\n const { left, width } = columnMetrics.get(columns[colVisibleStartIdx])!;\n // if the right side of the columnn is beyond the left side of the available viewport,\n // then it is the first column that's at least partially visible\n if (left + width > viewportLeft) {\n break;\n }\n colVisibleStartIdx++;\n }\n\n // get the last visible non-frozen column index\n let colVisibleEndIdx = colVisibleStartIdx;\n while (colVisibleEndIdx < lastColIdx) {\n const { left, width } = columnMetrics.get(columns[colVisibleEndIdx])!;\n // if the right side of the column is beyond or equal to the right side of the available viewport,\n // then it the last column that's at least partially visible, as the previous column's right side is not beyond the viewport.\n if (left + width >= viewportRight) {\n break;\n }\n colVisibleEndIdx++;\n }\n\n const colOverscanStartIdx = max(firstUnfrozenColumnIdx, colVisibleStartIdx - 1);\n const colOverscanEndIdx = min(lastColIdx, colVisibleEndIdx + 1);\n\n return [colOverscanStartIdx, colOverscanEndIdx];\n }, [\n columnMetrics,\n columns,\n lastFrozenColumnIndex,\n scrollLeft,\n totalFrozenColumnWidth,\n viewportWidth,\n enableVirtualization\n ]);\n\n return {\n columns,\n colSpanColumns,\n colOverscanStartIdx,\n colOverscanEndIdx,\n templateColumns,\n layoutCssVars,\n columnMetrics,\n lastFrozenColumnIndex,\n totalFrozenColumnWidth,\n groupBy\n };\n}\n","import { useMemo } from 'react';\n\nimport { getColSpan } from '../utils';\nimport type { CalculatedColumn, GroupRow, Maybe } from '../types';\n\ninterface ViewportColumnsArgs<R, SR> {\n columns: readonly CalculatedColumn<R, SR>[];\n colSpanColumns: readonly CalculatedColumn<R, SR>[];\n rows: readonly (R | GroupRow<R>)[];\n topSummaryRows: Maybe<readonly SR[]>;\n bottomSummaryRows: Maybe<readonly SR[]>;\n colOverscanStartIdx: number;\n colOverscanEndIdx: number;\n lastFrozenColumnIndex: number;\n rowOverscanStartIdx: number;\n rowOverscanEndIdx: number;\n columnWidths: ReadonlyMap<string, number>;\n isGroupRow: (row: R | GroupRow<R>) => row is GroupRow<R>;\n}\n\nexport function useViewportColumns<R, SR>({\n columns,\n colSpanColumns,\n rows,\n topSummaryRows,\n bottomSummaryRows,\n colOverscanStartIdx,\n colOverscanEndIdx,\n lastFrozenColumnIndex,\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n columnWidths,\n isGroupRow\n}: ViewportColumnsArgs<R, SR>) {\n // find the column that spans over a column within the visible columns range and adjust colOverscanStartIdx\n const startIdx = useMemo(() => {\n if (colOverscanStartIdx === 0) return 0;\n\n let startIdx = colOverscanStartIdx;\n\n const updateStartIdx = (colIdx: number, colSpan: number | undefined) => {\n if (colSpan !== undefined && colIdx + colSpan > colOverscanStartIdx) {\n startIdx = colIdx;\n return true;\n }\n return false;\n };\n\n for (const column of colSpanColumns) {\n // check header row\n const colIdx = column.idx;\n if (colIdx >= startIdx) break;\n if (updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, { type: 'HEADER' }))) {\n break;\n }\n\n // check viewport rows\n for (let rowIdx = rowOverscanStartIdx; rowIdx <= rowOverscanEndIdx; rowIdx++) {\n const row = rows[rowIdx];\n if (isGroupRow(row)) continue;\n if (\n updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, { type: 'ROW', row }))\n ) {\n break;\n }\n }\n\n // check summary rows\n if (topSummaryRows != null) {\n for (const row of topSummaryRows) {\n if (\n updateStartIdx(\n colIdx,\n getColSpan(column, lastFrozenColumnIndex, { type: 'SUMMARY', row })\n )\n ) {\n break;\n }\n }\n }\n\n if (bottomSummaryRows != null) {\n for (const row of bottomSummaryRows) {\n if (\n updateStartIdx(\n colIdx,\n getColSpan(column, lastFrozenColumnIndex, { type: 'SUMMARY', row })\n )\n ) {\n break;\n }\n }\n }\n }\n\n return startIdx;\n }, [\n rowOverscanStartIdx,\n rowOverscanEndIdx,\n rows,\n topSummaryRows,\n bottomSummaryRows,\n colOverscanStartIdx,\n lastFrozenColumnIndex,\n colSpanColumns,\n isGroupRow\n ]);\n\n const { viewportColumns, flexWidthViewportColumns } = useMemo((): {\n viewportColumns: readonly CalculatedColumn<R, SR>[];\n flexWidthViewportColumns: readonly CalculatedColumn<R, SR>[];\n } => {\n const viewportColumns: CalculatedColumn<R, SR>[] = [];\n const flexWidthViewportColumns: CalculatedColumn<R, SR>[] = [];\n for (let colIdx = 0; colIdx <= colOverscanEndIdx; colIdx++) {\n const column = columns[colIdx];\n\n if (colIdx < startIdx && !column.frozen) continue;\n viewportColumns.push(column);\n if (typeof column.width === 'string') {\n flexWidthViewportColumns.push(column);\n }\n }\n\n return { viewportColumns, flexWidthViewportColumns };\n }, [startIdx, colOverscanEndIdx, columns]);\n\n const unsizedFlexWidthViewportColumns = useMemo((): readonly CalculatedColumn<R, SR>[] => {\n return flexWidthViewportColumns.filter((column) => !columnWidths.has(column.key));\n }, [flexWidthViewportColumns, columnWidths]);\n\n return {\n viewportColumns,\n flexWidthViewportColumns: unsizedFlexWidthViewportColumns\n };\n}\n","import { css } from '@linaria/core';\nimport { row } from './row';\n\nconst lightTheme = `\n --rdg-color: #000;\n --rdg-border-color: #ddd;\n --rdg-summary-border-color: #aaa;\n --rdg-background-color: hsl(0deg 0% 100%);\n --rdg-header-background-color: hsl(0deg 0% 97.5%);\n --rdg-row-hover-background-color: hsl(0deg 0% 96%);\n --rdg-row-selected-background-color: hsl(207deg 76% 92%);\n --rdg-row-selected-hover-background-color: hsl(207deg 76% 88%);\n\n --rdg-checkbox-color: hsl(207deg 100% 29%);\n --rdg-checkbox-focus-color: hsl(207deg 100% 69%);\n --rdg-checkbox-disabled-border-color: #ccc;\n --rdg-checkbox-disabled-background-color: #ddd;\n`;\n\nconst darkTheme = `\n --rdg-color: #ddd;\n --rdg-border-color: #444;\n --rdg-summary-border-color: #555;\n --rdg-background-color: hsl(0deg 0% 13%);\n --rdg-header-background-color: hsl(0deg 0% 10.5%);\n --rdg-row-hover-background-color: hsl(0deg 0% 9%);\n --rdg-row-selected-background-color: hsl(207deg 76% 42%);\n --rdg-row-selected-hover-background-color: hsl(207deg 76% 38%);\n\n --rdg-checkbox-color: hsl(207deg 100% 79%);\n --rdg-checkbox-focus-color: hsl(207deg 100% 89%);\n --rdg-checkbox-disabled-border-color: #000;\n --rdg-checkbox-disabled-background-color: #333;\n`;\n\nconst root = css`\n @layer rdg {\n @layer Defaults,\n FocusSink,\n Cell,\n HeaderCell,\n SummaryCell,\n EditCell,\n Row,\n HeaderRow,\n SummaryRow,\n GroupedRow,\n Root;\n\n @layer Defaults {\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n }\n\n @layer Root {\n ${lightTheme}\n --rdg-selection-color: #66afe9;\n --rdg-font-size: 14px;\n\n display: grid;\n\n color-scheme: var(--rdg-color-scheme, light dark);\n\n /* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */\n /* We set a stacking context so internal elements don't render on top of external elements. */\n contain: strict;\n content-visibility: auto;\n block-size: 350px;\n border: 1px solid var(--rdg-border-color);\n box-sizing: border-box;\n overflow: auto;\n background-color: var(--rdg-background-color);\n color: var(--rdg-color);\n font-size: var(--rdg-font-size);\n\n /* needed on Firefox */\n &::before {\n content: '';\n grid-column: 1/-1;\n grid-row: 1/-1;\n }\n\n &.rdg-dark {\n --rdg-color-scheme: dark;\n ${darkTheme}\n }\n\n &.rdg-light {\n --rdg-color-scheme: light;\n }\n\n @media (prefers-color-scheme: dark) {\n &:not(.rdg-light) {\n ${darkTheme}\n }\n }\n }\n }\n`;\n\nexport const rootClassname = `rdg ${root}`;\n\nconst viewportDragging = css`\n @layer rdg.Root {\n user-select: none;\n\n & .${row} {\n cursor: move;\n }\n }\n`;\n\nexport const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;\n\nexport const focusSinkClassname = css`\n @layer rdg.FocusSink {\n grid-column: 1/-1;\n pointer-events: none;\n /* Should have a higher value than 2 to show up above header row */\n z-index: 3;\n }\n`;\n","import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '17.0.2'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender. It's\n * implmented here as a no-op.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional arugment that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => callback(arg);\n\n/**\n * Strict Mode is not implemented in Preact, so we provide a stand-in for it\n * that just renders its children without imposing any restrictions.\n */\nconst StrictMode = Fragment;\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (_instance._value !== getSnapshot()) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (_instance._value !== _instance._getSnapshot()) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (_instance._value !== _instance._getSnapshot()) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n","import * as React from \"react\";\nimport DataGrid, { Column, SelectColumn, SortColumn } from \"react-data-grid\";\nimport { format, timeFormat, timeParse } from \"@hpcc-js/common\";\nimport { useData } from \"./hooks\";\nimport type { Table } from \"./table\";\n\nexport type QuerySortItem = { attribute: string, descending: boolean };\nfunction copyAndSort<T>(items: T[], attribute: string, descending?: boolean): T[] {\n const key = attribute as keyof T;\n return [...items].sort((a: T, b: T) => {\n if (a[key] < b[key]) {\n return descending ? 1 : -1;\n } else if (a[key] > b[key]) {\n return descending ? -1 : 1;\n }\n return 0;\n });\n}\n\ninterface EmptyRowsRendererProps {\n message: string\n}\n\nconst EmptyRowsRenderer: React.FunctionComponent<EmptyRowsRendererProps> = ({\n message\n}) => {\n\n return <div style={{ textAlign: \"center\", gridColumn: \"1/-1\" }} >\n {message}\n <span>\n --- * --- * ---\n </span>\n </div>;\n};\n\ninterface ColumnEx<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {\n __hpcc_pattern?: ReturnType<typeof timeParse>;\n __hpcc_format?: ReturnType<typeof format> | ReturnType<typeof timeFormat>;\n}\n\nexport interface ReactTableProps {\n table: Table;\n sort?: QuerySortItem,\n}\n\nexport const ReactTable: React.FunctionComponent<ReactTableProps> = ({\n table,\n sort\n}) => {\n const [columns, data] = useData(table);\n const multiSelect = table.multiSelect();\n const columnTypes = table.columnTypes();\n const columnPatterns = table.columnPatterns();\n const columnFormats = table.columnFormats();\n\n const [listColumns, setListColumns] = React.useState<ColumnEx<any[]>[]>([]);\n const [sortColumn, setSortColumn] = React.useState<SortColumn>();\n const [rows, setRows] = React.useState<any[]>([]);\n const [selectedRows, setSelectedRows] = React.useState<ReadonlySet<number>>(new Set());\n\n // Columns ---\n React.useEffect(() => {\n setListColumns([\n ...multiSelect ? [SelectColumn] : [],\n ...columns.map((column): ColumnEx<any[]> => {\n const type = columnTypes[column] ?? \"string\";\n let formatter;\n let __hpcc_pattern;\n let __hpcc_format;\n switch (type) {\n case \"time\":\n __hpcc_pattern = columnPatterns[column] !== undefined ? timeParse(columnPatterns[column]) : undefined;\n __hpcc_format = columnFormats[column] !== undefined ? timeFormat(columnFormats[column]) : undefined;\n break;\n case \"number\":\n formatter = (props) => {\n return <div style={{ textAlign: \"right\" }}>{props.row[props.column.key]}</div>;\n };\n // eslint-disable-next-line no-fallthrough\n default:\n __hpcc_format = columnFormats[column] !== undefined ? format(columnFormats[column]) : undefined;\n }\n return {\n key: column,\n name: column,\n resizable: true,\n sortable: true,\n minWidth: 80,\n formatter,\n __hpcc_pattern,\n __hpcc_format\n };\n })\n ]);\n }, [columnFormats, columnPatterns, columnTypes, columns, multiSelect]);\n\n const onSortColumnsChange = React.useCallback((sortColumns: SortColumn[]) => {\n const futureSortColumn = sortColumns.slice(-1)[0];\n const sorted = futureSortColumn !== undefined;\n const isSortedDescending: boolean = futureSortColumn?.direction === \"DESC\";\n setSortColumn(futureSortColumn);\n setRows(copyAndSort(rows, sorted ? futureSortColumn.columnKey : \"key\", sorted ? isSortedDescending : false));\n }, [rows]);\n\n const rowKeyGetter = React.useCallback((row: any) => {\n return row.key;\n }, []);\n\n const onSelectedRowsChange = React.useCallback((selectedRows: Set<any>) => {\n setSelectedRows(selectedRows);\n }, []);\n\n const onRowClick = React.useCallback((row, column) => {\n table.onRowClickCallback(row, column.key);\n }, [table]);\n\n // Rows ---\n React.useEffect(() => {\n let items = data.map((row, index) => {\n const retVal = {\n key: index\n };\n listColumns.forEach((column, index) => {\n let val = row[index] as string;\n if (column.__hpcc_pattern && column.__hpcc_format) {\n val = column.__hpcc_format(column.__hpcc_pattern(val));\n } else if (column.__hpcc_pattern) {\n val = column.__hpcc_pattern(val).toString();\n } else if (column.__hpcc_format) {\n val = column.__hpcc_format(val as any);\n }\n retVal[column.key] = val;\n });\n return retVal;\n });\n if (sort?.attribute) {\n items = copyAndSort(items, sort.attribute, sort.descending);\n }\n setRows(items);\n }, [listColumns, data, sort]);\n\n return <DataGrid\n columns={listColumns}\n headerRowHeight={24}\n rows={rows}\n rowKeyGetter={rowKeyGetter}\n rowHeight={20}\n renderers={{ noRowsFallback: <EmptyRowsRenderer message={table.noDataMessage()} /> }}\n className={table.darkMode() ? \"rdg-dark\" : \"rdg-light\"}\n sortColumns={sortColumn ? [sortColumn] : []}\n onSortColumnsChange={onSortColumnsChange}\n selectedRows={selectedRows}\n onSelectedRowsChange={multiSelect ? onSelectedRowsChange : undefined}\n onRowClick={multiSelect ? undefined : onRowClick}\n aria-describedby={\"\"}\n aria-label={\"\"}\n aria-labelledby={\"\"}\n style={{ height: \"100%\" }}\n />;\n};\n\n","import { Widget } from \"@hpcc-js/common\";\nimport * as React from \"react\";\n\nexport function useData(widget: Widget): [string[], Array<string | number>[]] {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const columns: string[] = React.useMemo(() => widget.columns(), [widget, widget.dataChecksum()]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const data: Array<string | number>[] = React.useMemo(() => widget.data(), [widget, widget.dataChecksum()]);\n\n return [columns, data];\n}\n\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import * as React from \"react\";\nimport { HTMLWidget, publish } from \"@hpcc-js/common\";\nimport { render, unmountComponentAtNode } from \"react-dom\";\nimport { ReactTable } from \"./reactTable\";\n\nimport \"../src/table.css\";\n\nexport type ColumnType = \"boolean\" | \"number\" | \"string\" | \"time\";\n\nexport class Table extends HTMLWidget {\n\n protected _div;\n\n constructor() {\n super();\n }\n\n @publish(\"...empty...\", \"string\", \"No Data Message\")\n noDataMessage: publish<this, string>;\n @publish(false, \"boolean\", \"Dark Mode\")\n darkMode: publish<this, boolean>;\n @publish(false, \"boolean\", \"Multiple Selection\")\n multiSelect: publish<this, boolean>;\n @publish({}, \"object\", \"Column Types (\\\"boolean\\\" | \\\"number\\\" | \\\"string\\\" | \\\"time\\\"\")\n columnTypes: publish<this, { [column: string]: ColumnType }>;\n @publish({}, \"object\", \"Column Patterns\")\n columnPatterns: publish<this, { [column: string]: string }>;\n @publish({}, \"object\", \"Column Formats\")\n columnFormats: publish<this, { [column: string]: string }>;\n\n columnType(column: string): ColumnType;\n columnType(column: string, type: ColumnType): this;\n columnType(column: string, type?: ColumnType): ColumnType | this {\n if (arguments.length === 1) return this.columnTypes()[column];\n this.columnTypes({ ...this.columnTypes(), [column]: type });\n return this;\n }\n\n columnPattern(column: string): string;\n columnPattern(column: string, pattern: string): this;\n columnPattern(column: string, pattern?: string): string | this {\n if (arguments.length === 1) return this.columnPatterns()[column];\n this.columnPatterns({ ...this.columnPatterns(), [column]: pattern });\n return this;\n }\n\n columnFormat(column: string): string;\n columnFormat(column: string, format: string): this;\n columnFormat(column: string, format?: string): string | this {\n if (arguments.length === 1) return this.columnFormats()[column];\n this.columnFormats({ ...this.columnFormats(), [column]: format });\n return this;\n }\n\n private _prevRow;\n private _prevColumn;\n onRowClickCallback(row, column) {\n if (this._prevRow && JSON.stringify(this._prevRow) !== JSON.stringify(row)) {\n this.click(this._prevRow, this._prevColumn ?? \"\", false);\n }\n if (row) {\n this.click(row, column, true);\n }\n this._prevRow = row;\n this._prevColumn = column;\n }\n\n enter(domNode, element) {\n super.enter(domNode, element);\n this._div = element\n .append(\"div\")\n ;\n }\n\n update(domNode, element) {\n super.update(domNode, element);\n this._div.style(\"width\", this.width() + \"px\");\n this._div.style(\"height\", this.height() + \"px\");\n render(React.createElement(ReactTable, { table: this }), this._div.node());\n }\n\n exit(domNode, element) {\n unmountComponentAtNode(this._div.node());\n this._div.remove();\n super.exit(domNode, element);\n }\n\n // Events ---\n click(row, col, sel) {\n }\n}\nTable.prototype._class += \" dgrid2_Table\";\n"],"mappings":"8TAAO,ICgBHA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,GAAG,EAC5FP,EAAcC,EAAGC,EAC5B,EAUO,IAAIS,EAAW,WAQlB,OAPAA,EAAWR,OAAOS,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIR,KADTO,EAAIG,UAAUF,GACOZ,OAAOK,UAAUC,eAAeC,KAAKI,EAAGP,KAAIM,EAAEN,GAAKO,EAAEP,IAE9E,OAAOM,CACf,EACWF,EAASQ,MAAMC,KAAMH,UAChC,EAcO,SAASI,EAAWC,EAAYC,EAAQC,EAAKC,GAChD,IAA2HxB,EAAvHyB,EAAIT,UAAUC,OAAQS,EAAID,EAAI,EAAIH,EAAkB,OAATE,EAAgBA,EAAOtB,OAAOyB,yBAAyBL,EAAQC,GAAOC,EACrH,GAAuB,iBAAZI,SAAoD,mBAArBA,QAAQC,SAAy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