@photon-ai/pho-ui 2.6.0 → 2.7.0
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/chunks/IconChevronDown-CZilB71T.js +11 -0
- package/dist/chunks/IconChevronDown-CZilB71T.js.map +1 -0
- package/dist/chunks/IconSearch-BKAHkLyX.js +14 -0
- package/dist/chunks/IconSearch-BKAHkLyX.js.map +1 -0
- package/dist/chunks/animated-height-CCO-Ocoz.js +48 -0
- package/dist/chunks/animated-height-CCO-Ocoz.js.map +1 -0
- package/dist/chunks/basic-page-DR5szOOs.js +1373 -0
- package/dist/chunks/basic-page-DR5szOOs.js.map +1 -0
- package/dist/chunks/{button-DNNs5RsT.js → button-CdqS_t5a.js} +62 -65
- package/dist/chunks/button-CdqS_t5a.js.map +1 -0
- package/dist/chunks/checkbox-Cdm08HWG.js +129 -0
- package/dist/chunks/checkbox-Cdm08HWG.js.map +1 -0
- package/dist/chunks/{choice-card-CunOnY9l.js → choice-card-BVNP1NB6.js} +2 -2
- package/dist/chunks/{choice-card-CunOnY9l.js.map → choice-card-BVNP1NB6.js.map} +1 -1
- package/dist/chunks/data-table-DwbPU0zt.js +2970 -0
- package/dist/chunks/data-table-DwbPU0zt.js.map +1 -0
- package/dist/chunks/{dialog-8SRNi_rv.js → dialog-BxKACOj5.js} +4 -4
- package/dist/chunks/{dialog-8SRNi_rv.js.map → dialog-BxKACOj5.js.map} +1 -1
- package/dist/chunks/{error-Crs-wqMC.js → error-D0yoFxCv.js} +2 -2
- package/dist/chunks/{error-Crs-wqMC.js.map → error-D0yoFxCv.js.map} +1 -1
- package/dist/chunks/is-react-component-DSnjtBmo.js +10 -0
- package/dist/chunks/is-react-component-DSnjtBmo.js.map +1 -0
- package/dist/chunks/link-provider-DXzDQ08N.js +24 -0
- package/dist/chunks/link-provider-DXzDQ08N.js.map +1 -0
- package/dist/chunks/rolldown-runtime-DG5F_Nuu.js +27 -0
- package/dist/chunks/{scroll-area-Bu7egArU.js → scroll-area-BO-9PMM7.js} +27 -26
- package/dist/chunks/scroll-area-BO-9PMM7.js.map +1 -0
- package/dist/chunks/sidebar-DVzZsCts.js +223 -0
- package/dist/chunks/sidebar-DVzZsCts.js.map +1 -0
- package/dist/chunks/skeleton-DwjSl4vC.js +18 -0
- package/dist/chunks/skeleton-DwjSl4vC.js.map +1 -0
- package/dist/chunks/{toast-DoXaRPIZ.js → toast-iSf6NuAS.js} +43 -45
- package/dist/chunks/toast-iSf6NuAS.js.map +1 -0
- package/dist/chunks/use-press-pulse-IbNstUT0.js +58 -0
- package/dist/chunks/use-press-pulse-IbNstUT0.js.map +1 -0
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox.js +4 -126
- package/dist/components/command.js +54 -57
- package/dist/components/command.js.map +1 -1
- package/dist/components/data-table.js +11 -0
- package/dist/components/dialog.js +1 -1
- package/dist/components/error.js +1 -1
- package/dist/components/phone-input.js +609 -616
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/select.js +35 -39
- package/dist/components/select.js.map +1 -1
- package/dist/components/skeleton.js +2 -15
- package/dist/components/toast.js +1 -1
- package/dist/index.js +94 -73
- package/dist/motion.js +89 -0
- package/dist/motion.js.map +1 -0
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/csp-provider.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/otp-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +3 -3
- package/dist/sections/basic-page.js +16 -14
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/data-table/data-table.d.ts +227 -0
- package/dist/src/components/data-table/index.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/motion/index.d.ts +149 -0
- package/dist/src/sections/basic-page/basic-page.d.ts +47 -7
- package/dist/src/sections/basic-page/index.d.ts +1 -0
- package/dist/utils.js +13 -12
- package/package.json +10 -1
- package/dist/chunks/animated-height-C2eQstGy.js +0 -51
- package/dist/chunks/animated-height-C2eQstGy.js.map +0 -1
- package/dist/chunks/basic-page-DsI1xo6p.js +0 -1295
- package/dist/chunks/basic-page-DsI1xo6p.js.map +0 -1
- package/dist/chunks/button-DNNs5RsT.js.map +0 -1
- package/dist/chunks/link-provider-9TFNyDqO.js +0 -28
- package/dist/chunks/link-provider-9TFNyDqO.js.map +0 -1
- package/dist/chunks/rolldown-runtime-wKSmTnsc.js +0 -22
- package/dist/chunks/scroll-area-Bu7egArU.js.map +0 -1
- package/dist/chunks/sidebar-DvB-G0BP.js +0 -231
- package/dist/chunks/sidebar-DvB-G0BP.js.map +0 -1
- package/dist/chunks/toast-DoXaRPIZ.js.map +0 -1
- package/dist/chunks/use-press-pulse-8iorQPsh.js +0 -62
- package/dist/chunks/use-press-pulse-8iorQPsh.js.map +0 -1
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/skeleton.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table-DwbPU0zt.js","names":["__iconNode","React","React","useSyncExternalStoreWithSelector"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronUp.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.mjs","../../../../node_modules/.pnpm/@tanstack+react-table@9.2.3_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-table/dist/FlexRender.js","../../../../node_modules/.pnpm/@tanstack+store@0.11.1/node_modules/@tanstack/store/dist/alien.js","../../../../node_modules/.pnpm/@tanstack+store@0.11.1/node_modules/@tanstack/store/dist/atom.js","../../../../node_modules/.pnpm/@tanstack+store@0.11.1/node_modules/@tanstack/store/dist/shallow.js","../../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/shim/index.js","../../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/shim/with-selector.js","../../../../node_modules/.pnpm/@tanstack+react-store@0.11.1_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-store/dist/useSelector.js","../../../../node_modules/.pnpm/@tanstack+react-table@9.2.3_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-table/dist/Subscribe.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/reactivity/coreReactivityFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/reactivity/renderPhaseReactivity.js","../../../../node_modules/.pnpm/@tanstack+react-table@9.2.3_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-table/dist/reactivity.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/cells/coreCellsFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/cells/coreCellsFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/headers/constructHeader.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-pinning/columnPinningFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-visibility/columnVisibilityFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/headers/buildHeaderGroups.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/columns/constructColumn.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-ordering/columnOrderingFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/columns/coreColumnsFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/columns/coreColumnsFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/headers/coreHeadersFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/headers/coreHeadersFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/rows/constructRow.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-sorting/sortFns.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/cell-selection/cellSelectionFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-expanding/rowExpandingFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-pagination/rowPaginationFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-sorting/rowSortingFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/row-models/createCoreRowModel.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/row-models/coreRowModelsFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/row-models/coreRowModelsFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/cells/constructCell.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/rows/coreRowsFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/rows/coreRowsFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/table/coreTablesFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/table/coreTablesFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/coreFeatures.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/helpers/columnHelper.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/helpers/tableFeatures.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/core/table/constructTable.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-filtering/columnFilteringFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-filtering/columnFilteringFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-filtering/filterFns.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/global-filtering/globalFilteringFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/global-filtering/globalFilteringFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-selection/rowSelectionFeature.utils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-selection/rowSelectionFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-sorting/rowSortingFeature.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-filtering/filterRowsUtils.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/column-filtering/createFilteredRowModel.js","../../../../node_modules/.pnpm/@tanstack+table-core@9.2.3/node_modules/@tanstack/table-core/dist/features/row-sorting/createSortedRowModel.js","../../../../node_modules/.pnpm/@tanstack+react-table@9.2.3_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-table/dist/useTable.js","../../src/components/data-table/data-table.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M6 15l6 -6l6 6\", \"key\": \"svg-0\" }]];\nconst IconChevronUp = createReactComponent(\"outline\", \"chevron-up\", \"ChevronUp\", __iconNode);\n\nexport { __iconNode, IconChevronUp as default };\n//# sourceMappingURL=IconChevronUp.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M8 9l4 -4l4 4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M16 15l-4 4l-4 -4\", \"key\": \"svg-1\" }]];\nconst IconSelector = createReactComponent(\"outline\", \"selector\", \"Selector\", __iconNode);\n\nexport { __iconNode, IconSelector as default };\n//# sourceMappingURL=IconSelector.mjs.map\n","import React from \"react\";\n\n//#region src/FlexRender.tsx\nfunction isReactComponent(component) {\n\treturn isClassComponent(component) || typeof component === \"function\" || isExoticComponent(component);\n}\nfunction isClassComponent(component) {\n\treturn typeof component === \"function\" && (() => {\n\t\tconst proto = Object.getPrototypeOf(component);\n\t\treturn proto.prototype && proto.prototype.isReactComponent;\n\t})();\n}\nfunction isExoticComponent(component) {\n\treturn typeof component === \"object\" && typeof component.$$typeof === \"symbol\" && [\"react.memo\", \"react.forward_ref\"].includes(component.$$typeof.description);\n}\n/**\n* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n* @example flexRender(cell.column.columnDef.cell, cell.getContext())\n*/\nfunction flexRender(Comp, props) {\n\tif (Comp === null || Comp === void 0) return null;\n\treturn isReactComponent(Comp) ? /* @__PURE__ */ React.createElement(Comp, props) : Comp;\n}\n/**\n* Simplified component wrapper of `flexRender`. Use this utility component to render headers, cells, or footers with custom markup.\n* Only one prop (`cell`, `header`, or `footer`) may be passed.\n* @example\n* ```tsx\n* <FlexRender cell={cell} />\n* <FlexRender header={header} />\n* <FlexRender footer={footer} />\n* ```\n*\n* This replaces calling `flexRender` directly like this:\n* ```tsx\n* flexRender(cell.column.columnDef.cell, cell.getContext())\n* flexRender(header.column.columnDef.header, header.getContext())\n* flexRender(footer.column.columnDef.footer, footer.getContext())\n* ```\n*/\nfunction FlexRender(props) {\n\tif (\"cell\" in props && props.cell) {\n\t\tconst cell = props.cell;\n\t\tconst def = cell.column.columnDef;\n\t\tconst groupingCell = cell;\n\t\tconst groupingDef = def;\n\t\tif (groupingCell.getIsAggregated?.()) return flexRender(groupingDef.aggregatedCell ?? def.cell, cell.getContext());\n\t\tif (groupingCell.getIsPlaceholder?.()) return null;\n\t\treturn flexRender(def.cell, cell.getContext());\n\t}\n\tif (\"header\" in props && props.header) return flexRender(props.header.column.columnDef.header, props.header.getContext());\n\tif (\"footer\" in props && props.footer) return flexRender(props.footer.column.columnDef.footer, props.footer.getContext());\n\treturn null;\n}\n\n//#endregion\nexport { FlexRender, flexRender };","//#region src/alien.ts\nconst NONE = 0;\nconst MUTABLE = 1;\nconst WATCHING = 2;\nconst RECURSED_CHECK = 4;\nconst RECURSED = 8;\nconst DIRTY = 16;\nconst PENDING = 32;\n/* @__NO_SIDE_EFFECTS__ */\nfunction createReactiveSystem({ update, notify, unwatched }) {\n\treturn {\n\t\tlink,\n\t\tunlink,\n\t\tpropagate,\n\t\tcheckDirty,\n\t\tshallowPropagate\n\t};\n\tfunction link(dep, sub, version) {\n\t\tconst prevDep = sub.depsTail;\n\t\tif (prevDep !== void 0 && prevDep.dep === dep) return;\n\t\tconst nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;\n\t\tif (nextDep !== void 0 && nextDep.dep === dep) {\n\t\t\tnextDep.version = version;\n\t\t\tsub.depsTail = nextDep;\n\t\t\treturn;\n\t\t}\n\t\tconst prevSub = dep.subsTail;\n\t\tif (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;\n\t\tconst newLink = sub.depsTail = dep.subsTail = {\n\t\t\tversion,\n\t\t\tdep,\n\t\t\tsub,\n\t\t\tprevDep,\n\t\t\tnextDep,\n\t\t\tprevSub,\n\t\t\tnextSub: void 0\n\t\t};\n\t\tif (nextDep !== void 0) nextDep.prevDep = newLink;\n\t\tif (prevDep !== void 0) prevDep.nextDep = newLink;\n\t\telse sub.deps = newLink;\n\t\tif (prevSub !== void 0) prevSub.nextSub = newLink;\n\t\telse dep.subs = newLink;\n\t}\n\tfunction unlink(link, sub = link.sub) {\n\t\tconst dep = link.dep;\n\t\tconst prevDep = link.prevDep;\n\t\tconst nextDep = link.nextDep;\n\t\tconst nextSub = link.nextSub;\n\t\tconst prevSub = link.prevSub;\n\t\tif (nextDep !== void 0) nextDep.prevDep = prevDep;\n\t\telse sub.depsTail = prevDep;\n\t\tif (prevDep !== void 0) prevDep.nextDep = nextDep;\n\t\telse sub.deps = nextDep;\n\t\tif (nextSub !== void 0) nextSub.prevSub = prevSub;\n\t\telse dep.subsTail = prevSub;\n\t\tif (prevSub !== void 0) prevSub.nextSub = nextSub;\n\t\telse if ((dep.subs = nextSub) === void 0) unwatched(dep);\n\t\treturn nextDep;\n\t}\n\tfunction propagate(link) {\n\t\tlet next = link.nextSub;\n\t\tlet stack;\n\t\ttop: do {\n\t\t\tconst sub = link.sub;\n\t\t\tlet flags = sub.flags;\n\t\t\tif (!(flags & 60)) sub.flags = flags | 32;\n\t\t\telse if (!(flags & (4 | 8))) flags = 0;\n\t\t\telse if (!(flags & 4)) sub.flags = flags & ~8 | 32;\n\t\t\telse if (!(flags & (16 | 32)) && isValidLink(link, sub)) {\n\t\t\t\tsub.flags = flags | (8 | 32);\n\t\t\t\tflags &= 1;\n\t\t\t} else flags = 0;\n\t\t\tif (flags & 2) notify(sub);\n\t\t\tif (flags & 1) {\n\t\t\t\tconst subSubs = sub.subs;\n\t\t\t\tif (subSubs !== void 0) {\n\t\t\t\t\tconst nextSub = (link = subSubs).nextSub;\n\t\t\t\t\tif (nextSub !== void 0) {\n\t\t\t\t\t\tstack = {\n\t\t\t\t\t\t\tvalue: next,\n\t\t\t\t\t\t\tprev: stack\n\t\t\t\t\t\t};\n\t\t\t\t\t\tnext = nextSub;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((link = next) !== void 0) {\n\t\t\t\tnext = link.nextSub;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\twhile (stack !== void 0) {\n\t\t\t\tlink = stack.value;\n\t\t\t\tstack = stack.prev;\n\t\t\t\tif (link !== void 0) {\n\t\t\t\t\tnext = link.nextSub;\n\t\t\t\t\tcontinue top;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t} while (true);\n\t}\n\tfunction checkDirty(link, sub) {\n\t\tlet stack;\n\t\tlet checkDepth = 0;\n\t\tlet dirty = false;\n\t\ttop: do {\n\t\t\tconst dep = link.dep;\n\t\t\tconst flags = dep.flags;\n\t\t\tif (sub.flags & 16) dirty = true;\n\t\t\telse if ((flags & (1 | 16)) === (1 | 16)) {\n\t\t\t\tif (update(dep)) {\n\t\t\t\t\tconst subs = dep.subs;\n\t\t\t\t\tif (subs.nextSub !== void 0) shallowPropagate(subs);\n\t\t\t\t\tdirty = true;\n\t\t\t\t}\n\t\t\t} else if ((flags & (1 | 32)) === (1 | 32)) {\n\t\t\t\tif (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {\n\t\t\t\t\tvalue: link,\n\t\t\t\t\tprev: stack\n\t\t\t\t};\n\t\t\t\tlink = dep.deps;\n\t\t\t\tsub = dep;\n\t\t\t\t++checkDepth;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!dirty) {\n\t\t\t\tconst nextDep = link.nextDep;\n\t\t\t\tif (nextDep !== void 0) {\n\t\t\t\t\tlink = nextDep;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (checkDepth--) {\n\t\t\t\tconst firstSub = sub.subs;\n\t\t\t\tconst hasMultipleSubs = firstSub.nextSub !== void 0;\n\t\t\t\tif (hasMultipleSubs) {\n\t\t\t\t\tlink = stack.value;\n\t\t\t\t\tstack = stack.prev;\n\t\t\t\t} else link = firstSub;\n\t\t\t\tif (dirty) {\n\t\t\t\t\tif (update(sub)) {\n\t\t\t\t\t\tif (hasMultipleSubs) shallowPropagate(firstSub);\n\t\t\t\t\t\tsub = link.sub;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tdirty = false;\n\t\t\t\t} else sub.flags &= ~32;\n\t\t\t\tsub = link.sub;\n\t\t\t\tconst nextDep = link.nextDep;\n\t\t\t\tif (nextDep !== void 0) {\n\t\t\t\t\tlink = nextDep;\n\t\t\t\t\tcontinue top;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn dirty;\n\t\t} while (true);\n\t}\n\tfunction shallowPropagate(link) {\n\t\tdo {\n\t\t\tconst sub = link.sub;\n\t\t\tconst flags = sub.flags;\n\t\t\tif ((flags & (32 | 16)) === 32) {\n\t\t\t\tsub.flags = flags | 16;\n\t\t\t\tif ((flags & (2 | 4)) === 2) notify(sub);\n\t\t\t}\n\t\t} while ((link = link.nextSub) !== void 0);\n\t}\n\tfunction isValidLink(checkLink, sub) {\n\t\tlet link = sub.depsTail;\n\t\twhile (link !== void 0) {\n\t\t\tif (link === checkLink) return true;\n\t\t\tlink = link.prevDep;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n//#endregion\nexport { createReactiveSystem };\n//# sourceMappingURL=alien.js.map","import { createReactiveSystem } from \"./alien.js\";\n\n//#region src/atom.ts\nfunction toObserver(nextHandler, errorHandler, completionHandler) {\n\tconst isObserver = typeof nextHandler === \"object\";\n\tconst self = isObserver ? nextHandler : void 0;\n\treturn {\n\t\tnext: (isObserver ? nextHandler.next : nextHandler)?.bind(self),\n\t\terror: (isObserver ? nextHandler.error : errorHandler)?.bind(self),\n\t\tcomplete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)\n\t};\n}\nconst queuedEffects = [];\nlet cycle = 0;\nconst { link, unlink, propagate, checkDirty, shallowPropagate } = /* @__PURE__ */ createReactiveSystem({\n\tupdate(atom) {\n\t\treturn atom._update();\n\t},\n\tnotify(effect) {\n\t\tqueuedEffects[queuedEffectsLength++] = effect;\n\t\teffect.flags &= ~2;\n\t},\n\tunwatched(atom) {\n\t\tif (atom.depsTail !== void 0) {\n\t\t\tatom.depsTail = void 0;\n\t\t\tatom.flags = 1 | 16;\n\t\t\tpurgeDeps(atom);\n\t\t}\n\t}\n});\nlet notifyIndex = 0;\nlet queuedEffectsLength = 0;\nlet activeSub;\nlet batchDepth = 0;\nfunction batch(fn) {\n\ttry {\n\t\t++batchDepth;\n\t\tfn();\n\t} finally {\n\t\tif (!--batchDepth) flush();\n\t}\n}\nfunction purgeDeps(sub) {\n\tconst depsTail = sub.depsTail;\n\tlet dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;\n\twhile (dep !== void 0) dep = unlink(dep, sub);\n}\nfunction flush() {\n\tif (batchDepth > 0) return;\n\twhile (notifyIndex < queuedEffectsLength) {\n\t\tconst effect = queuedEffects[notifyIndex];\n\t\tqueuedEffects[notifyIndex++] = void 0;\n\t\teffect.notify();\n\t}\n\tnotifyIndex = 0;\n\tqueuedEffectsLength = 0;\n}\nfunction createAsyncAtom(getValue, options) {\n\tconst ref = {};\n\tconst atom = createAtom(() => {\n\t\tgetValue().then((data) => {\n\t\t\tconst internalAtom = ref.current;\n\t\t\tif (internalAtom._update({\n\t\t\t\tstatus: \"done\",\n\t\t\t\tdata\n\t\t\t})) {\n\t\t\t\tconst subs = internalAtom.subs;\n\t\t\t\tif (subs !== void 0) {\n\t\t\t\t\tpropagate(subs);\n\t\t\t\t\tshallowPropagate(subs);\n\t\t\t\t\tflush();\n\t\t\t\t}\n\t\t\t}\n\t\t}, (error) => {\n\t\t\tconst internalAtom = ref.current;\n\t\t\tif (internalAtom._update({\n\t\t\t\tstatus: \"error\",\n\t\t\t\terror\n\t\t\t})) {\n\t\t\t\tconst subs = internalAtom.subs;\n\t\t\t\tif (subs !== void 0) {\n\t\t\t\t\tpropagate(subs);\n\t\t\t\t\tshallowPropagate(subs);\n\t\t\t\t\tflush();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn { status: \"pending\" };\n\t}, options);\n\tref.current = atom;\n\treturn atom;\n}\nfunction createAtom(valueOrFn, options) {\n\tconst isComputed = typeof valueOrFn === \"function\";\n\tconst getter = valueOrFn;\n\tconst atom = {\n\t\t_snapshot: isComputed ? void 0 : valueOrFn,\n\t\tsubs: void 0,\n\t\tsubsTail: void 0,\n\t\tdeps: void 0,\n\t\tdepsTail: void 0,\n\t\tflags: isComputed ? 0 : 1,\n\t\tget() {\n\t\t\tif (activeSub !== void 0) link(atom, activeSub, cycle);\n\t\t\treturn atom._snapshot;\n\t\t},\n\t\tsubscribe(observerOrFn) {\n\t\t\tconst obs = toObserver(observerOrFn);\n\t\t\tconst observed = { current: false };\n\t\t\tconst e = effect(() => {\n\t\t\t\tatom.get();\n\t\t\t\tif (!observed.current) observed.current = true;\n\t\t\t\telse obs.next?.(atom._snapshot);\n\t\t\t});\n\t\t\treturn { unsubscribe: () => {\n\t\t\t\te.stop();\n\t\t\t} };\n\t\t},\n\t\t_update(getValue) {\n\t\t\tconst prevSub = activeSub;\n\t\t\tconst compare = options?.compare ?? Object.is;\n\t\t\tif (isComputed) {\n\t\t\t\tactiveSub = atom;\n\t\t\t\t++cycle;\n\t\t\t\tatom.depsTail = void 0;\n\t\t\t} else if (getValue === void 0) return false;\n\t\t\tif (isComputed) atom.flags = 1 | 4;\n\t\t\ttry {\n\t\t\t\tconst oldValue = atom._snapshot;\n\t\t\t\tconst newValue = typeof getValue === \"function\" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;\n\t\t\t\tif (oldValue === void 0 || !compare(oldValue, newValue)) {\n\t\t\t\t\tatom._snapshot = newValue;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t} finally {\n\t\t\t\tactiveSub = prevSub;\n\t\t\t\tif (isComputed) atom.flags &= ~4;\n\t\t\t\tpurgeDeps(atom);\n\t\t\t}\n\t\t}\n\t};\n\tif (isComputed) {\n\t\tatom.flags = 1 | 16;\n\t\tatom.get = function() {\n\t\t\tconst flags = atom.flags;\n\t\t\tif (flags & 16 || flags & 32 && checkDirty(atom.deps, atom)) {\n\t\t\t\tif (atom._update()) {\n\t\t\t\t\tconst subs = atom.subs;\n\t\t\t\t\tif (subs !== void 0) shallowPropagate(subs);\n\t\t\t\t}\n\t\t\t} else if (flags & 32) atom.flags = flags & ~32;\n\t\t\tif (activeSub !== void 0) link(atom, activeSub, cycle);\n\t\t\treturn atom._snapshot;\n\t\t};\n\t} else atom.set = function(valueOrFn) {\n\t\tif (atom._update(valueOrFn)) {\n\t\t\tconst subs = atom.subs;\n\t\t\tif (subs !== void 0) {\n\t\t\t\tpropagate(subs);\n\t\t\t\tshallowPropagate(subs);\n\t\t\t\tflush();\n\t\t\t}\n\t\t}\n\t};\n\treturn atom;\n}\nfunction effect(fn) {\n\tconst run = () => {\n\t\tconst prevSub = activeSub;\n\t\tactiveSub = effectObj;\n\t\t++cycle;\n\t\teffectObj.depsTail = void 0;\n\t\teffectObj.flags = 2 | 4;\n\t\ttry {\n\t\t\treturn fn();\n\t\t} finally {\n\t\t\tactiveSub = prevSub;\n\t\t\teffectObj.flags &= ~4;\n\t\t\tpurgeDeps(effectObj);\n\t\t}\n\t};\n\tconst effectObj = {\n\t\tdeps: void 0,\n\t\tdepsTail: void 0,\n\t\tsubs: void 0,\n\t\tsubsTail: void 0,\n\t\tflags: 2 | 4,\n\t\tnotify() {\n\t\t\tconst flags = this.flags;\n\t\t\tif (flags & 16 || flags & 32 && checkDirty(this.deps, this)) run();\n\t\t\telse this.flags = 2;\n\t\t},\n\t\tstop() {\n\t\t\tthis.flags = 0;\n\t\t\tthis.depsTail = void 0;\n\t\t\tpurgeDeps(this);\n\t\t}\n\t};\n\trun();\n\treturn effectObj;\n}\n\n//#endregion\nexport { batch, createAsyncAtom, createAtom, flush, toObserver };\n//# sourceMappingURL=atom.js.map","//#region src/shallow.ts\nfunction shallow(objA, objB) {\n\tif (Object.is(objA, objB)) return true;\n\tif (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) return false;\n\tif (objA instanceof Map && objB instanceof Map) {\n\t\tif (objA.size !== objB.size) return false;\n\t\tfor (const [k, v] of objA) if (!objB.has(k) || !Object.is(v, objB.get(k))) return false;\n\t\treturn true;\n\t}\n\tif (objA instanceof Set && objB instanceof Set) {\n\t\tif (objA.size !== objB.size) return false;\n\t\tfor (const v of objA) if (!objB.has(v)) return false;\n\t\treturn true;\n\t}\n\tif (objA instanceof Date && objB instanceof Date) {\n\t\tif (objA.getTime() !== objB.getTime()) return false;\n\t\treturn true;\n\t}\n\tconst keysA = getOwnKeys(objA);\n\tif (keysA.length !== getOwnKeys(objB).length) return false;\n\tfor (let i = 0; i < keysA.length; i++) if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) return false;\n\treturn true;\n}\nfunction getOwnKeys(obj) {\n\treturn Object.keys(obj).concat(Object.getOwnPropertySymbols(obj));\n}\n\n//#endregion\nexport { shallow };\n//# sourceMappingURL=shallow.js.map","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n function useSyncExternalStore$2(subscribe, getSnapshot) {\n didWarnOld18Alpha ||\n void 0 === React.startTransition ||\n ((didWarnOld18Alpha = !0),\n console.error(\n \"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.\"\n ));\n var value = getSnapshot();\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n objectIs(value, cachedValue) ||\n (console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n ),\n (didWarnUncachedGetSnapshot = !0));\n }\n cachedValue = useState({\n inst: { value: value, getSnapshot: getSnapshot }\n });\n var inst = cachedValue[0].inst,\n forceUpdate = cachedValue[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n }\n function checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n }\n function useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue,\n didWarnOld18Alpha = !1,\n didWarnUncachedGetSnapshot = !1,\n shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\n exports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\n exports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n ) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot))\n return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import { useCallback } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\n\n//#region src/useSelector.ts\nfunction defaultCompare(a, b) {\n\treturn a === b;\n}\n/**\n* Selects a slice of state from an atom or store and subscribes the component\n* to that selection.\n*\n* This is the primary React read hook for TanStack Store. It works with any\n* source that exposes `get()` and `subscribe()`, including atoms, readonly\n* atoms, stores, and readonly stores.\n*\n* Omit the selector to subscribe to the whole value.\n*\n* @example\n* ```tsx\n* const count = useSelector(counterStore, (state) => state.count)\n* ```\n*\n* @example\n* ```tsx\n* const value = useSelector(countAtom)\n* ```\n*/\nfunction useSelector(source, selector = (s) => s, options) {\n\tconst compare = options?.compare ?? defaultCompare;\n\tconst subscribe = useCallback((handleStoreChange) => {\n\t\tconst { unsubscribe } = source.subscribe(handleStoreChange);\n\t\treturn unsubscribe;\n\t}, [source]);\n\tconst getSnapshot = useCallback(() => source.get(), [source]);\n\treturn useSyncExternalStoreWithSelector(subscribe, getSnapshot, getSnapshot, selector, compare);\n}\n\n//#endregion\nexport { useSelector };\n//# sourceMappingURL=useSelector.js.map","'use client';\n\nimport { shallow, useSelector } from \"@tanstack/react-store\";\n\n//#region src/Subscribe.ts\nfunction Subscribe(props) {\n\tconst selected = useSelector(props.source, props.selector, { compare: shallow });\n\treturn typeof props.children === \"function\" ? props.children(selected) : props.children;\n}\n\n//#endregion\nexport { Subscribe };","//#region src/core/reactivity/coreReactivityFeature.utils.ts\n/**\n* Bridges atom instances to the `Store`/`ReadonlyStore` API by exposing\n* a `state` getter backed by `atom.get()`, and wiring `setState` for\n* writable atoms.\n*\n* @example\n* ```ts\n* const store = atomToStore(atom)\n* ```\n*/\nfunction atomToStore(atom) {\n\tconst store = atom;\n\tObject.defineProperty(atom, \"state\", { get() {\n\t\treturn atom.get();\n\t} });\n\tif (\"set\" in atom) store.setState = atom.set.bind(atom);\n\treturn store;\n}\n\n//#endregion\nexport { atomToStore };","//#region src/core/reactivity/renderPhaseReactivity.ts\n/**\n* Creates reactivity bindings for render-phase adapters (React, Preact, Lit):\n* frameworks with plain, non-reactive options that are re-synchronized during\n* component render, where store notifications must not fire until the host\n* commits.\n*\n* Readonly atoms are exposed as live facades. `get()` re-evaluates the\n* resolver against the options of the render in progress — a normal computed\n* cannot know that plain `options.state` changed — and caches the result\n* through the configured comparator so external-store consumers (e.g. React's\n* `useSyncExternalStore`) see referentially stable snapshots. `subscribe()`\n* goes through a hidden computed that tracks the resolver's real atom\n* dependencies plus a commit version, so subscribers are invalidated by\n* actual reactive writes and by the adapter's post-commit publication.\n*\n* @example\n* ```ts\n* import { batch, createAtom } from '@tanstack/react-store'\n*\n* export const reactReactivity = () =>\n* renderPhaseReactivity({ createAtom, batch })\n* ```\n*/\nfunction renderPhaseReactivity(primitives) {\n\tconst { createAtom, batch } = primitives;\n\tconst commitAtom = createAtom(0);\n\treturn {\n\t\tcreateOptionsStore: false,\n\t\twrapExternalAtoms: false,\n\t\taddSubscription: () => {\n\t\t\tthrow new Error(\"Feature not supported in current reactivity implementation\");\n\t\t},\n\t\tunmount: () => {\n\t\t\tthrow new Error(\"Feature not supported in current reactivity implementation\");\n\t\t},\n\t\tschedule: primitives.schedule ?? ((fn) => queueMicrotask(fn)),\n\t\tbatch,\n\t\tuntrack: (fn) => fn(),\n\t\tcreateReadonlyAtom: (fn, atomOptions) => {\n\t\t\tconst compare = atomOptions?.compare ?? Object.is;\n\t\t\tlet hasSnapshot = false;\n\t\t\tlet snapshot;\n\t\t\tconst getSnapshot = () => {\n\t\t\t\tconst nextSnapshot = fn();\n\t\t\t\tif (!hasSnapshot || !compare(snapshot, nextSnapshot)) {\n\t\t\t\t\tsnapshot = nextSnapshot;\n\t\t\t\t\thasSnapshot = true;\n\t\t\t\t}\n\t\t\t\treturn snapshot;\n\t\t\t};\n\t\t\tconst reactiveAtom = createAtom(() => {\n\t\t\t\tcommitAtom.get();\n\t\t\t\treturn getSnapshot();\n\t\t\t}, { compare });\n\t\t\treturn {\n\t\t\t\tget: getSnapshot,\n\t\t\t\tsubscribe: reactiveAtom.subscribe.bind(reactiveAtom)\n\t\t\t};\n\t\t},\n\t\tcreateWritableAtom: (value, atomOptions) => {\n\t\t\treturn createAtom(value, { compare: atomOptions?.compare });\n\t\t},\n\t\tcommit: () => {\n\t\t\tcommitAtom.set((version) => version + 1);\n\t\t}\n\t};\n}\n/**\n* Creates a render-phase source with an explicit commit baseline.\n*\n* Render-phase adapters publish controlled state after the host framework\n* commits so isolated subscribers update, but the component that owns the\n* table already rendered that exact snapshot — forwarding the notification to\n* its root subscription would produce a redundant render. Unlike a last-read\n* filter, speculative reads do not change notification behavior: only\n* `markCommitted()` advances the baseline.\n*/\nfunction createRenderPhaseSource(source, compare = Object.is) {\n\tlet hasCommittedSnapshot = false;\n\tlet committedSnapshot;\n\treturn {\n\t\tget: source.get,\n\t\tmarkCommitted: (snapshot) => {\n\t\t\tcommittedSnapshot = snapshot;\n\t\t\thasCommittedSnapshot = true;\n\t\t},\n\t\tsubscribe: (listener) => source.subscribe((value) => {\n\t\t\tif (!hasCommittedSnapshot || !compare(committedSnapshot, value)) listener(value);\n\t\t})\n\t};\n}\n\n//#endregion\nexport { createRenderPhaseSource, renderPhaseReactivity };","import { batch, createAtom } from \"@tanstack/react-store\";\nimport { renderPhaseReactivity } from \"@tanstack/table-core/reactivity\";\n\n//#region src/reactivity.ts\n/**\n* Creates the table-core reactivity bindings used by the React adapter.\n*\n* React stores table state in TanStack Store atoms and leaves options as plain\n* resolved data because `useTable` synchronizes options during render. The\n* render-phase preset supplies the live readonly-atom facades and the `commit`\n* hook; the store primitives are passed in from `@tanstack/react-store` so all\n* atoms share one store instance with user-provided external atoms.\n*/\nfunction reactReactivity() {\n\treturn renderPhaseReactivity({\n\t\tcreateAtom,\n\t\tbatch\n\t});\n}\n\n//#endregion\nexport { reactReactivity };","//#region src/utils.ts\n/**\n* Applies a TanStack updater to a value.\n*\n* If the updater is a function it is called with the previous value; otherwise the updater value is returned directly.\n*/\nfunction functionalUpdate(updater, input) {\n\treturn typeof updater === \"function\" ? updater(input) : updater;\n}\n/**\n* Clones table state values while preserving non-plain objects.\n*\n* Plain objects and arrays are copied recursively so state updates can avoid mutating existing references.\n*/\nfunction cloneState(value) {\n\tif (Array.isArray(value)) return value.map(cloneState);\n\tif (value && typeof value === \"object\") {\n\t\tconst proto = Object.getPrototypeOf(value);\n\t\tif (proto !== Object.prototype && proto !== null) return value;\n\t\tconst copy = proto === null ? makeObjectMap() : {};\n\t\tconst keys = Object.keys(value);\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key = keys[i];\n\t\t\tObject.defineProperty(copy, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: cloneState(value[key]),\n\t\t\t\twritable: true\n\t\t\t});\n\t\t}\n\t\treturn copy;\n\t}\n\treturn value;\n}\n/**\n* Copies prototype-instance own properties without carrying over lazy memo\n* closures or the per-row cell cache, both of which are bound to the source\n* instance (cached cells reference the source row).\n*/\nfunction copyInstancePropertiesWithoutMemos(target, source) {\n\tconst keys = Object.keys(source);\n\tconst targetRecord = target;\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key = keys[i];\n\t\tif (!key.startsWith(\"_memo_\") && key !== \"_cellsCache\") targetRecord[key] = source[key];\n\t}\n\treturn target;\n}\n/**\n* Creates an object intended only for string-keyed dictionary lookups.\n*\n* The null prototype keeps user-controlled ids such as `__proto__` and\n* `hasOwnProperty` as plain data keys.\n*/\nfunction makeObjectMap() {\n\treturn Object.create(null);\n}\n/**\n* Checks whether an object owns a key, including null-prototype dictionaries.\n*/\nfunction hasOwn(obj, key) {\n\treturn Object.prototype.hasOwnProperty.call(obj, key);\n}\n/**\n* Creates a table state updater for a single state slice.\n*\n* The updater writes through the table base atom for the slice and supports both value and functional updater forms.\n*/\nfunction makeStateUpdater(key, instance) {\n\treturn (updater) => {\n\t\t(instance.options.atoms?.[key] ?? instance.baseAtoms[key]).set((old) => functionalUpdate(updater, old));\n\t};\n}\n/**\n* Checks whether a value is an array or a plain (or null-prototype) object.\n* Class instances, dates, and other exotic values compare by reference only,\n* mirroring the `cloneState` plain-object policy.\n*/\nfunction isPlainContainer(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (Array.isArray(value)) return true;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\n/**\n* Returns every enumerable own key, including symbols and non-index array\n* properties. Keeping key presence explicit distinguishes sparse array holes\n* from entries whose value is `undefined`.\n*/\nfunction getEnumerableOwnKeys(value) {\n\treturn Reflect.ownKeys(value).filter((key) => Object.prototype.propertyIsEnumerable.call(value, key));\n}\nconst MAX_STATE_COMPARE_DEPTH = 3;\n/**\n* Structurally compares two state slice values as deeply as stock feature\n* state can nest and no deeper.\n*\n* Three container levels cover flat maps and arrays, arrays of state objects,\n* array-valued filter values, and `columnResizing.columnSizingStart` tuples.\n* Deeper containers and non-plain values compare by reference. A `false`\n* result is always safe: the state update simply proceeds.\n*/\nfunction stateSlicesEqual(a, b) {\n\treturn stateSlicesEqualAtDepth(a, b, MAX_STATE_COMPARE_DEPTH);\n}\nfunction stateSlicesEqualAtDepth(a, b, depth) {\n\tif (Object.is(a, b)) return true;\n\tif (depth <= 0 || !isPlainContainer(a) || !isPlainContainer(b)) return false;\n\tif (Array.isArray(a) || Array.isArray(b)) {\n\t\tif (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\t}\n\tconst keysA = getEnumerableOwnKeys(a);\n\tconst keysB = getEnumerableOwnKeys(b);\n\tif (keysA.length !== keysB.length) return false;\n\tconst recordA = a;\n\tconst recordB = b;\n\tfor (let i = 0; i < keysA.length; i++) {\n\t\tconst key = keysA[i];\n\t\tif (!Object.prototype.propertyIsEnumerable.call(b, key)) return false;\n\t\tif (!stateSlicesEqualAtDepth(recordA[key], recordB[key], depth - 1)) return false;\n\t}\n\treturn true;\n}\n/**\n* Routes a state slice update through the slice's `on<State>Change` handler,\n* preserving the owner's current reference for structural no-ops.\n*\n* Equality is evaluated inside the updater received by the state owner, never\n* against the table's potentially stale controlled snapshot. This keeps\n* same-tick updates composable in queued host containers such as React state,\n* evaluates the original updater only when the owner applies it, and lets atom\n* owners suppress notifications by returning their existing reference.\n*\n* A user-provided change handler is still invoked for a no-op because only that\n* handler's state container can know its latest queued value. The guarded\n* updater returns that container's previous reference, preventing a state write\n* or render in state containers with identity bailout semantics.\n*\n* Hot-path slices that skip guarding entirely (selection maps that scale with\n* row count, pointer-frequency resize state) call their change handler\n* directly instead of routing through this util. Custom feature slices with a\n* cheaper or semantic-aware comparison can pass `isEqual` to override the\n* structural default.\n*/\nfunction setStateSlice(instance, key, updater, isEqual = stateSlicesEqual) {\n\tconst onChangeKey = `on${key.charAt(0).toUpperCase()}${key.slice(1)}Change`;\n\tconst onChange = instance.options[onChangeKey];\n\tif (!onChange) return;\n\tonChange((current) => {\n\t\tconst next = functionalUpdate(updater, current);\n\t\treturn isEqual(current, next) ? current : next;\n\t});\n}\n/**\n* Returns whether a value is a function.\n*/\nfunction isFunction(d) {\n\treturn d instanceof Function;\n}\n/**\n* Flattens a tree of nodes by recursively reading child nodes.\n*\n* The original nodes are preserved in depth-first order.\n*/\nfunction flattenBy(arr, getChildren) {\n\tconst flat = [];\n\tconst recurse = (subArr) => {\n\t\tsubArr.forEach((item) => {\n\t\t\tflat.push(item);\n\t\t\tconst children = getChildren(item);\n\t\t\tif (children.length) recurse(children);\n\t\t});\n\t};\n\trecurse(arr);\n\treturn flat;\n}\n/**\n* Creates a dependency-tracked memoized function for table internals.\n*\n* The memo recomputes only when its dependency tuple changes and can emit debug timing information.\n*/\nconst memo = ({ fn, memoDeps, onAfterCompare, onAfterUpdate, onBeforeCompare, onBeforeUpdate }) => {\n\tlet deps = [];\n\tlet result;\n\tconst memoizedFn = (depArgs) => {\n\t\tonBeforeCompare?.();\n\t\tconst newDeps = memoDeps?.(depArgs);\n\t\tlet depsChanged = !newDeps || newDeps.length !== deps?.length;\n\t\tif (!depsChanged && newDeps) {\n\t\t\tfor (let i = 0; i < newDeps.length; i++) if (newDeps[i] !== deps[i]) {\n\t\t\t\tdepsChanged = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tonAfterCompare?.(depsChanged);\n\t\tif (!depsChanged) return result;\n\t\tdeps = newDeps;\n\t\tonBeforeUpdate?.();\n\t\tresult = fn(...newDeps ?? []);\n\t\tonAfterUpdate?.(result);\n\t\treturn result;\n\t};\n\treturn memoizedFn;\n};\n/**\n* Wraps a callback so that its first invocation is skipped.\n*\n* Row-model `onAfterUpdate` hooks schedule auto-resets when their inputs\n* change. The initial computation of a row model is not a change, so state\n* resets must not fire for it — otherwise merely reading a row model on mount\n* would wipe initial or controlled state.\n*/\nfunction skipFirstRun(fn) {\n\tlet hasRun = false;\n\treturn () => {\n\t\tif (!hasRun) {\n\t\t\thasRun = true;\n\t\t\treturn;\n\t\t}\n\t\tfn();\n\t};\n}\nconst pad = (str, num) => {\n\tstr = String(str);\n\twhile (str.length < num) str = \" \" + str;\n\treturn str;\n};\n/**\n* Creates a table-aware memoized function.\n*\n* This wraps `memo` with table debug options and feature metadata so row models and derived APIs can share consistent diagnostics.\n*/\nfunction tableMemo({ feature, fnName, objectId, onAfterUpdate, table, ...memoOptions }) {\n\tlet startCalcTime;\n\tlet endCalcTime;\n\tlet runCount = 0;\n\tlet debug;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tconst { debugAll } = table.options;\n\t\tconst { parentName } = getFunctionNameInfo(fnName, \".\");\n\t\tconst debugByParent = table.options[`debug${(parentName != \"table\" ? parentName + \"s\" : parentName).replace(parentName, parentName.charAt(0).toUpperCase() + parentName.slice(1))}`];\n\t\tconst debugByFeature = feature ? table.options[`debug${feature.charAt(0).toUpperCase() + feature.slice(1)}`] : false;\n\t\tdebug = debugAll || debugByParent || debugByFeature;\n\t}\n\tfunction logTime(time, depsChanged) {\n\t\tconst runType = runCount === 0 ? \"(1st run)\" : depsChanged ? \"(rerun #\" + runCount + \")\" : \"(cache)\";\n\t\trunCount++;\n\t\tconsole.groupCollapsed(`%c⏱ ${pad(`${time.toFixed(1)} ms`, 12)} %c${runType}%c ${fnName}%c ${objectId ? `(${fnName.split(\".\")[0]}Id: ${objectId})` : \"\"}`, `font-size: .6rem; font-weight: bold; ${depsChanged ? `color: hsl(\n ${Math.max(0, Math.min(120 - Math.log10(time) * 60, 120))}deg 100% 31%);` : \"\"} `, `color: ${runCount < 2 ? \"#FF00FF\" : \"#FF1493\"}`, \"color: #666\", \"color: #87CEEB\");\n\t\tconsole.info({\n\t\t\tfeature,\n\t\t\tstate: table.store.state,\n\t\t\tdeps: memoOptions.memoDeps?.toString()\n\t\t});\n\t\tconsole.trace();\n\t\tconsole.groupEnd();\n\t}\n\tconst onAfterUpdateHandler = () => {\n\t\tif (!onAfterUpdate) return;\n\t\tconst { schedule, untrack } = table._reactivity;\n\t\tschedule(() => untrack(() => onAfterUpdate()));\n\t};\n\tconst debugOptions = process.env.NODE_ENV === \"development\" ? {\n\t\tonBeforeCompare: () => {},\n\t\tonAfterCompare: (depsChanged) => {},\n\t\tonBeforeUpdate: () => {\n\t\t\tif (debug) startCalcTime = performance.now();\n\t\t},\n\t\tonAfterUpdate: () => {\n\t\t\tif (debug) {\n\t\t\t\tendCalcTime = performance.now();\n\t\t\t\tlogTime(Math.round((endCalcTime - startCalcTime) * 100) / 100, true);\n\t\t\t}\n\t\t\tonAfterUpdateHandler();\n\t\t}\n\t} : { onAfterUpdate: () => {\n\t\tonAfterUpdateHandler();\n\t} };\n\treturn memo({\n\t\t...memoOptions,\n\t\t...debugOptions\n\t});\n}\n/**\n* Assumes that a function name is in the format of `parentName_fnKey` and returns the `fnKey` and `fnName` in the format of `parentName.fnKey`.\n*/\nfunction getFunctionNameInfo(staticFnName, splitBy = \"_\") {\n\tconst [parentName, fnKey] = staticFnName.split(splitBy);\n\treturn {\n\t\tfnKey,\n\t\tfnName: `${parentName}.${fnKey}`,\n\t\tparentName\n\t};\n}\n/**\n* Assigns Table API methods directly to the table instance.\n* Unlike row/cell/column/header, the table is a singleton so methods are assigned directly.\n*/\nfunction assignTableAPIs(feature, table, apis) {\n\tfor (const [staticFnName, { fn, memoDeps }] of Object.entries(apis)) {\n\t\tconst { fnKey, fnName } = getFunctionNameInfo(staticFnName);\n\t\ttable[fnKey] = memoDeps ? tableMemo({\n\t\t\tmemoDeps,\n\t\t\tfn,\n\t\t\tfnName,\n\t\t\ttable,\n\t\t\tfeature\n\t\t}) : fn;\n\t}\n}\n/**\n* Assigns API methods to a prototype object for memory-efficient method sharing.\n* All instances created with this prototype will share the same method references.\n*\n* For memoized methods, the memo state is lazily created and stored on each instance.\n* This provides the best of both worlds: shared method code + per-instance caching.\n*/\nfunction assignPrototypeAPIs(feature, prototype, table, apis) {\n\tfor (const [staticFnName, { fn, memoDeps }] of Object.entries(apis)) {\n\t\tconst { fnKey, fnName } = getFunctionNameInfo(staticFnName);\n\t\tif (memoDeps) {\n\t\t\tconst memoKey = `_memo_${fnKey}`;\n\t\t\tprototype[fnKey] = function(...args) {\n\t\t\t\tif (!this[memoKey]) {\n\t\t\t\t\tconst self = this;\n\t\t\t\t\tthis[memoKey] = tableMemo({\n\t\t\t\t\t\tmemoDeps: (depArgs) => memoDeps(self, depArgs),\n\t\t\t\t\t\tfn: (...deps) => fn(self, ...deps),\n\t\t\t\t\t\tfnName,\n\t\t\t\t\t\tobjectId: self.id,\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\tfeature\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn this[memoKey](...args);\n\t\t\t};\n\t\t} else prototype[fnKey] = function(...args) {\n\t\t\treturn fn(this, ...args);\n\t\t};\n\t}\n}\n/**\n* Looks to run the memoized function with the builder pattern on the object if it exists, otherwise fall back to the static method passed in.\n*/\nfunction callMemoOrStaticFn(obj, fnKey, staticFn, ...args) {\n\treturn obj[fnKey]?.(...args) ?? staticFn(obj, ...args);\n}\n\n//#endregion\nexport { assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, setStateSlice, skipFirstRun, stateSlicesEqual, tableMemo };","//#region src/core/cells/coreCellsFeature.utils.ts\n/**\n* Reads this cell's accessor value from its owning row and column.\n*\n* This is the standalone implementation behind `cell.getValue()`, useful when\n* importing static APIs instead of calling methods from the cell prototype.\n*\n* @example\n* ```ts\n* const value = cell_getValue(cell)\n* ```\n*/\nfunction cell_getValue(cell) {\n\treturn cell.row.getValue(cell.column.id);\n}\n/**\n* Reads the value that should be rendered for this cell.\n*\n* Nullish accessor values are replaced with `table.options.renderFallbackValue`,\n* matching the behavior of `cell.renderValue()`.\n*\n* @example\n* ```ts\n* const rendered = cell_renderValue(cell)\n* ```\n*/\nfunction cell_renderValue(cell) {\n\treturn cell.getValue() ?? cell.table.options.renderFallbackValue;\n}\n/**\n* Builds the render context passed to a column's `cell` template.\n*\n* The returned object includes stable references to the table, row, column, and\n* cell, plus bound `getValue` and `renderValue` helpers for render functions.\n*\n* @example\n* ```ts\n* const context = cell_getContext(cell)\n* ```\n*/\nfunction cell_getContext(cell) {\n\treturn {\n\t\ttable: cell.table,\n\t\tcolumn: cell.column,\n\t\trow: cell.row,\n\t\tcell,\n\t\tgetValue: () => cell.getValue(),\n\t\trenderValue: () => cell.renderValue()\n\t};\n}\n\n//#endregion\nexport { cell_getContext, cell_getValue, cell_renderValue };","import { assignPrototypeAPIs } from \"../../utils.js\";\nimport { cell_getContext, cell_getValue, cell_renderValue } from \"./coreCellsFeature.utils.js\";\n\n//#region src/core/cells/coreCellsFeature.ts\n/**\n* Core feature that adds cell value, render, and context APIs.\n*/\nconst coreCellsFeature = { assignCellPrototype: (prototype, table) => {\n\tassignPrototypeAPIs(\"coreCellsFeature\", prototype, table, {\n\t\tcell_getValue: { fn: (cell) => cell_getValue(cell) },\n\t\tcell_renderValue: { fn: (cell) => cell_renderValue(cell) },\n\t\tcell_getContext: {\n\t\t\tfn: (cell) => cell_getContext(cell),\n\t\t\tmemoDeps: (cell) => [cell]\n\t\t}\n\t});\n} };\n\n//#endregion\nexport { coreCellsFeature };","//#region src/core/headers/constructHeader.ts\n/**\n* Creates or retrieves the header prototype for a table.\n* The prototype is cached on the table and shared by all header instances.\n*/\nfunction getHeaderPrototype(table) {\n\tif (!table._headerPrototype) {\n\t\ttable._headerPrototype = { table };\n\t\tconst features = Object.values(table._features);\n\t\tfor (let i = 0; i < features.length; i++) features[i].assignHeaderPrototype?.(table._headerPrototype, table);\n\t}\n\treturn table._headerPrototype;\n}\n/**\n* Constructs a header instance from normalized table internals.\n*\n* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n*/\nfunction constructHeader(table, column, options) {\n\tconst headerPrototype = getHeaderPrototype(table);\n\tconst header = Object.create(headerPrototype);\n\theader.colSpan = 0;\n\theader.column = column;\n\theader.depth = options.depth;\n\theader.headerGroup = null;\n\theader.id = options.id ?? column.id;\n\theader.index = options.index;\n\theader.isPlaceholder = !!options.isPlaceholder;\n\theader.placeholderId = options.placeholderId;\n\theader.rowSpan = 0;\n\theader.subHeaders = [];\n\tconst initFns = table._headerInstanceInitFns;\n\tfor (let i = 0; i < initFns.length; i++) initFns[i](header);\n\treturn header;\n}\n\n//#endregion\nexport { constructHeader };","import { callMemoOrStaticFn, cloneState, setStateSlice } from \"../../utils.js\";\nimport { column_getIsVisible, row_getVisibleCells, row_getVisibleCellsByColumnId, table_getVisibleLeafColumns } from \"../column-visibility/columnVisibilityFeature.utils.js\";\nimport { buildHeaderGroups } from \"../../core/headers/buildHeaderGroups.js\";\n\n//#region src/features/column-pinning/columnPinningFeature.utils.ts\n/**\n* Creates the default column pinning state.\n*\n* Both pinning regions start empty. Reset APIs use this value when\n* `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const pinning = getDefaultColumnPinningState()\n* ```\n*/\nfunction getDefaultColumnPinningState() {\n\treturn {\n\t\tstart: [],\n\t\tend: []\n\t};\n}\n/**\n* Moves this column's leaf column ids into a pinning region.\n*\n* Pinning a group column pins all of its leaves. The leaf ids are first removed\n* from both regions, then appended to the requested `'start'` or `'end'`\n* region. Passing `false` unpins them back to the center.\n*\n* `start` and `end` are logical positions. In LTR languages/layouts, `start`\n* usually corresponds to left and `end` to right. In RTL languages/layouts,\n* `start` usually corresponds to right and `end` to left.\n*\n* @example\n* ```ts\n* column_pin(column, 'start')\n* ```\n*/\nfunction column_pin(column, position) {\n\tconst leafColumns = column.getLeafColumns();\n\tconst columnIds = [];\n\tfor (let i = 0; i < leafColumns.length; i++) {\n\t\tconst id = leafColumns[i].id;\n\t\tif (id) columnIds.push(id);\n\t}\n\ttable_setColumnPinning(column.table, (old) => {\n\t\tif (position === \"end\") return {\n\t\t\tstart: old.start.filter((d) => !columnIds.includes(d)),\n\t\t\tend: [...old.end.filter((d) => !columnIds.includes(d)), ...columnIds]\n\t\t};\n\t\tif (position === \"start\") return {\n\t\t\tstart: [...old.start.filter((d) => !columnIds.includes(d)), ...columnIds],\n\t\t\tend: old.end.filter((d) => !columnIds.includes(d))\n\t\t};\n\t\treturn {\n\t\t\tstart: old.start.filter((d) => !columnIds.includes(d)),\n\t\t\tend: old.end.filter((d) => !columnIds.includes(d))\n\t\t};\n\t});\n}\n/**\n* Checks whether this column or any of its leaf columns can be pinned.\n*\n* Column-level `enablePinning` and table `enableColumnPinning` both default to\n* `true`; at least one leaf column must allow pinning.\n*\n* @example\n* ```ts\n* const canPin = column_getCanPin(column)\n* ```\n*/\nfunction column_getCanPin(column) {\n\treturn column.getLeafColumns().some((leafColumn) => (leafColumn.columnDef.enablePinning ?? true) && (column.table.options.enableColumnPinning ?? true));\n}\n/**\n* Reads this column's current pinning region.\n*\n* Group columns report `'start'` or `'end'` when any leaf column is pinned in\n* that region. Unpinned columns return `false`.\n*\n* `start` and `end` are logical positions. In LTR languages/layouts, `start`\n* usually corresponds to left and `end` to right. In RTL languages/layouts,\n* `start` usually corresponds to right and `end` to left.\n*\n* @example\n* ```ts\n* const position = column_getIsPinned(column)\n* ```\n*/\nfunction column_getIsPinned(column) {\n\tconst leafColumns = column.getLeafColumns();\n\tconst { start, end } = column.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tfor (let i = 0; i < leafColumns.length; i++) if (start.includes(leafColumns[i].id)) return \"start\";\n\tfor (let i = 0; i < leafColumns.length; i++) if (end.includes(leafColumns[i].id)) return \"end\";\n\treturn false;\n}\n/**\n* Finds this column's index within its pinned region.\n*\n* Unpinned columns return `0`; pinned columns return their position in\n* `state.columnPinning.start` or `state.columnPinning.end`.\n*\n* @example\n* ```ts\n* const index = column_getPinnedIndex(column)\n* ```\n*/\nfunction column_getPinnedIndex(column) {\n\tconst position = column_getIsPinned(column);\n\treturn position ? column.table.atoms.columnPinning?.get()?.[position].indexOf(column.id) ?? -1 : 0;\n}\n/**\n* Collects visible cells whose columns are not pinned start or end.\n*\n* The result preserves the row's visible-cell order for center columns.\n*\n* @example\n* ```ts\n* const centerCells = row_getCenterVisibleCells(row)\n* ```\n*/\nfunction row_getCenterVisibleCells(row) {\n\tconst allCells = callMemoOrStaticFn(row, \"getVisibleCells\", row_getVisibleCells);\n\tconst { start, end } = row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tif (!start.length && !end.length) return allCells;\n\tconst startAndEnd = [...start, ...end];\n\treturn allCells.filter((d) => !startAndEnd.includes(d.column.id));\n}\n/**\n* Collects visible cells for columns pinned to the start region.\n*\n* Cells are returned in `state.columnPinning.start` order and are marked with\n* `cell.position = 'start'`.\n*\n* @example\n* ```ts\n* const startCells = row_getStartVisibleCells(row)\n* ```\n*/\nfunction row_getStartVisibleCells(row) {\n\tconst { start } = row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tif (!start.length) return [];\n\tconst allVisibleCells = callMemoOrStaticFn(row, \"getVisibleCellsByColumnId\", row_getVisibleCellsByColumnId);\n\tconst cells = [];\n\tfor (let i = 0; i < start.length; i++) {\n\t\tconst cell = allVisibleCells[start[i]];\n\t\tif (cell) {\n\t\t\tcell.position = \"start\";\n\t\t\tcells.push(cell);\n\t\t}\n\t}\n\treturn cells;\n}\n/**\n* Collects visible cells for columns pinned to the end region.\n*\n* Cells are returned in `state.columnPinning.end` order and are marked with\n* `cell.position = 'end'`.\n*\n* @example\n* ```ts\n* const endCells = row_getEndVisibleCells(row)\n* ```\n*/\nfunction row_getEndVisibleCells(row) {\n\tconst { end } = row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tif (!end.length) return [];\n\tconst allVisibleCells = callMemoOrStaticFn(row, \"getVisibleCellsByColumnId\", row_getVisibleCellsByColumnId);\n\tconst cells = [];\n\tfor (let i = 0; i < end.length; i++) {\n\t\tconst cell = allVisibleCells[end[i]];\n\t\tif (cell) {\n\t\t\tcell.position = \"end\";\n\t\t\tcells.push(cell);\n\t\t}\n\t}\n\treturn cells;\n}\n/**\n* Routes a column pinning updater through the table's pinning change handler.\n*\n* The updater may be a next `{ start, end }` state or a function of the\n* previous state, matching the instance `table.setColumnPinning` behavior.\n*\n* @example\n* ```ts\n* table_setColumnPinning(table, (old) => ({ ...old, start: ['select'] }))\n* ```\n*/\nfunction table_setColumnPinning(table, updater) {\n\tsetStateSlice(table, \"columnPinning\", updater);\n}\n/**\n* Resets `columnPinning` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.columnPinning` when it\n* exists. Passing `true` ignores initial state and resets to empty start/end\n* arrays.\n*\n* @example\n* ```ts\n* table_resetColumnPinning(table)\n* table_resetColumnPinning(table, true)\n* ```\n*/\nfunction table_resetColumnPinning(table, defaultState) {\n\ttable_setColumnPinning(table, defaultState ? getDefaultColumnPinningState() : cloneState(table.initialState.columnPinning ?? getDefaultColumnPinningState()));\n}\n/**\n* Checks whether any columns are pinned.\n*\n* Omit `position` to check both sides, or pass `'start'`/`'end'` to inspect a\n* single pinning region.\n*\n* @example\n* ```ts\n* const hasPinnedColumns = table_getIsSomeColumnsPinned(table)\n* ```\n*/\nfunction table_getIsSomeColumnsPinned(table, position) {\n\tconst pinningState = table.atoms.columnPinning?.get();\n\tif (!position) return Boolean(pinningState?.start.length || pinningState?.end.length);\n\treturn Boolean(pinningState?.[position].length);\n}\n/**\n* Builds header groups for visible columns pinned to the start region.\n*\n* The leaf columns are read in `state.columnPinning.start` order and then passed\n* through the same header-group builder as the unpinned table.\n*\n* @example\n* ```ts\n* const headerGroups = table_getStartHeaderGroups(table)\n* ```\n*/\nfunction table_getStartHeaderGroups(table) {\n\tconst allColumns = table.getAllColumns();\n\tconst leafColumnsById = table.getAllLeafColumnsById();\n\tconst { start } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tconst orderedLeafColumns = [];\n\tfor (let i = 0; i < start.length; i++) {\n\t\tconst column = leafColumnsById[start[i]];\n\t\tif (column && callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible)) orderedLeafColumns.push(column);\n\t}\n\treturn buildHeaderGroups(allColumns, orderedLeafColumns, table, \"start\");\n}\n/**\n* Builds header groups for visible columns pinned to the end region.\n*\n* The leaf columns are read in `state.columnPinning.end` order and then\n* passed through the same header-group builder as the unpinned table.\n*\n* @example\n* ```ts\n* const headerGroups = table_getEndHeaderGroups(table)\n* ```\n*/\nfunction table_getEndHeaderGroups(table) {\n\tconst allColumns = table.getAllColumns();\n\tconst leafColumnsById = table.getAllLeafColumnsById();\n\tconst { end } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tconst orderedLeafColumns = [];\n\tfor (let i = 0; i < end.length; i++) {\n\t\tconst column = leafColumnsById[end[i]];\n\t\tif (column && callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible)) orderedLeafColumns.push(column);\n\t}\n\treturn buildHeaderGroups(allColumns, orderedLeafColumns, table, \"end\");\n}\n/**\n* Builds header groups for visible columns that are not pinned.\n*\n* Start- and end-pinned column ids are removed from the visible leaf column\n* list before header groups are built for the center region.\n*\n* @example\n* ```ts\n* const headerGroups = table_getCenterHeaderGroups(table)\n* ```\n*/\nfunction table_getCenterHeaderGroups(table) {\n\tconst allColumns = table.getAllColumns();\n\tlet leafColumns = callMemoOrStaticFn(table, \"getVisibleLeafColumns\", table_getVisibleLeafColumns);\n\tconst { start, end } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tif (start.length || end.length) {\n\t\tconst startAndEnd = [...start, ...end];\n\t\tleafColumns = leafColumns.filter((column) => !startAndEnd.includes(column.id));\n\t}\n\treturn buildHeaderGroups(allColumns, leafColumns, table, \"center\");\n}\n/**\n* Builds footer groups for the start pinned region.\n*\n* Footer groups reuse the start header groups in reverse order.\n*\n* @example\n* ```ts\n* const footerGroups = table_getStartFooterGroups(table)\n* ```\n*/\nfunction table_getStartFooterGroups(table) {\n\treturn [...callMemoOrStaticFn(table, \"getStartHeaderGroups\", table_getStartHeaderGroups)].reverse();\n}\n/**\n* Builds footer groups for the end pinned region.\n*\n* Footer groups reuse the end header groups in reverse order.\n*\n* @example\n* ```ts\n* const footerGroups = table_getEndFooterGroups(table)\n* ```\n*/\nfunction table_getEndFooterGroups(table) {\n\treturn [...callMemoOrStaticFn(table, \"getEndHeaderGroups\", table_getEndHeaderGroups)].reverse();\n}\n/**\n* Builds footer groups for the center, unpinned region.\n*\n* Footer groups reuse the center header groups in reverse order.\n*\n* @example\n* ```ts\n* const footerGroups = table_getCenterFooterGroups(table)\n* ```\n*/\nfunction table_getCenterFooterGroups(table) {\n\treturn [...callMemoOrStaticFn(table, \"getCenterHeaderGroups\", table_getCenterHeaderGroups)].reverse();\n}\n/**\n* Flattens every header from the start pinned header groups.\n*\n* Parent headers and placeholder headers are included.\n*\n* @example\n* ```ts\n* const headers = table_getStartFlatHeaders(table)\n* ```\n*/\nfunction table_getStartFlatHeaders(table) {\n\tconst leftHeaderGroups = callMemoOrStaticFn(table, \"getStartHeaderGroups\", table_getStartHeaderGroups);\n\tconst result = [];\n\tfor (let i = 0; i < leftHeaderGroups.length; i++) {\n\t\tconst headers = leftHeaderGroups[i].headers;\n\t\tfor (let j = 0; j < headers.length; j++) result.push(headers[j]);\n\t}\n\treturn result;\n}\n/**\n* Flattens every header from the end pinned header groups.\n*\n* Parent headers and placeholder headers are included.\n*\n* @example\n* ```ts\n* const headers = table_getEndFlatHeaders(table)\n* ```\n*/\nfunction table_getEndFlatHeaders(table) {\n\tconst rightHeaderGroups = callMemoOrStaticFn(table, \"getEndHeaderGroups\", table_getEndHeaderGroups);\n\tconst result = [];\n\tfor (let i = 0; i < rightHeaderGroups.length; i++) {\n\t\tconst headers = rightHeaderGroups[i].headers;\n\t\tfor (let j = 0; j < headers.length; j++) result.push(headers[j]);\n\t}\n\treturn result;\n}\n/**\n* Flattens every header from the center header groups.\n*\n* Parent headers and placeholder headers are included.\n*\n* @example\n* ```ts\n* const headers = table_getCenterFlatHeaders(table)\n* ```\n*/\nfunction table_getCenterFlatHeaders(table) {\n\tconst centerHeaderGroups = callMemoOrStaticFn(table, \"getCenterHeaderGroups\", table_getCenterHeaderGroups);\n\tconst result = [];\n\tfor (let i = 0; i < centerHeaderGroups.length; i++) {\n\t\tconst headers = centerHeaderGroups[i].headers;\n\t\tfor (let j = 0; j < headers.length; j++) result.push(headers[j]);\n\t}\n\treturn result;\n}\n/**\n* Collects leaf headers for the start pinned region.\n*\n* Parent headers are filtered out from the start flat header list.\n*\n* @example\n* ```ts\n* const headers = table_getStartLeafHeaders(table)\n* ```\n*/\nfunction table_getStartLeafHeaders(table) {\n\treturn callMemoOrStaticFn(table, \"getStartFlatHeaders\", table_getStartFlatHeaders).filter((header) => !header.subHeaders.length);\n}\n/**\n* Collects leaf headers for the end pinned region.\n*\n* Parent headers are filtered out from the end flat header list.\n*\n* @example\n* ```ts\n* const headers = table_getEndLeafHeaders(table)\n* ```\n*/\nfunction table_getEndLeafHeaders(table) {\n\treturn callMemoOrStaticFn(table, \"getEndFlatHeaders\", table_getEndFlatHeaders).filter((header) => !header.subHeaders.length);\n}\n/**\n* Collects leaf headers for the center, unpinned region.\n*\n* Parent headers are filtered out from the center flat header list.\n*\n* @example\n* ```ts\n* const headers = table_getCenterLeafHeaders(table)\n* ```\n*/\nfunction table_getCenterLeafHeaders(table) {\n\treturn callMemoOrStaticFn(table, \"getCenterFlatHeaders\", table_getCenterFlatHeaders).filter((header) => !header.subHeaders.length);\n}\n/**\n* Resolves leaf columns pinned to the start region.\n*\n* The result follows `state.columnPinning.start` order and skips stale ids that\n* no longer correspond to a leaf column.\n*\n* @example\n* ```ts\n* const columns = table_getStartLeafColumns(table)\n* ```\n*/\nfunction table_getStartLeafColumns(table) {\n\tconst { start } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tconst leafColumnsById = table.getAllLeafColumnsById();\n\tconst result = [];\n\tfor (let i = 0; i < start.length; i++) {\n\t\tconst column = leafColumnsById[start[i]];\n\t\tif (column) result.push(column);\n\t}\n\treturn result;\n}\n/**\n* Resolves leaf columns pinned to the end region.\n*\n* The result follows `state.columnPinning.end` order and skips stale ids that\n* no longer correspond to a leaf column.\n*\n* @example\n* ```ts\n* const columns = table_getEndLeafColumns(table)\n* ```\n*/\nfunction table_getEndLeafColumns(table) {\n\tconst { end } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tconst leafColumnsById = table.getAllLeafColumnsById();\n\tconst result = [];\n\tfor (let i = 0; i < end.length; i++) {\n\t\tconst column = leafColumnsById[end[i]];\n\t\tif (column) result.push(column);\n\t}\n\treturn result;\n}\n/**\n* Resolves leaf columns that are not pinned to either logical side.\n*\n* Start- and end-pinned ids are removed from `table.getAllLeafColumns()`.\n*\n* @example\n* ```ts\n* const columns = table_getCenterLeafColumns(table)\n* ```\n*/\nfunction table_getCenterLeafColumns(table) {\n\tconst { start, end } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tif (!start.length && !end.length) return table.getAllLeafColumns();\n\tconst startAndEnd = [...start, ...end];\n\treturn table.getAllLeafColumns().filter((d) => !startAndEnd.includes(d.id));\n}\n/**\n* Resolves leaf columns for a requested pinning region.\n*\n* Pass `'start'`, `'center'`, or `'end'` for a partition, or pass `false` to\n* read all leaf columns without partitioning.\n*\n* @example\n* ```ts\n* const columns = table_getPinnedLeafColumns(table, 'center')\n* ```\n*/\nfunction table_getPinnedLeafColumns(table, position) {\n\treturn !position ? table.getAllLeafColumns() : position === \"start\" ? callMemoOrStaticFn(table, \"getStartLeafColumns\", table_getStartLeafColumns) : position === \"end\" ? callMemoOrStaticFn(table, \"getEndLeafColumns\", table_getEndLeafColumns) : callMemoOrStaticFn(table, \"getCenterLeafColumns\", table_getCenterLeafColumns);\n}\n/**\n* Resolves visible leaf columns pinned to the start region.\n*\n* Hidden pinned columns are filtered out after the start pin order is applied.\n*\n* @example\n* ```ts\n* const columns = table_getStartVisibleLeafColumns(table)\n* ```\n*/\nfunction table_getStartVisibleLeafColumns(table) {\n\treturn callMemoOrStaticFn(table, \"getStartLeafColumns\", table_getStartLeafColumns).filter((column) => callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Resolves visible leaf columns pinned to the end region.\n*\n* Hidden pinned columns are filtered out after the end pin order is applied.\n*\n* @example\n* ```ts\n* const columns = table_getEndVisibleLeafColumns(table)\n* ```\n*/\nfunction table_getEndVisibleLeafColumns(table) {\n\treturn callMemoOrStaticFn(table, \"getEndLeafColumns\", table_getEndLeafColumns).filter((column) => callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Resolves visible leaf columns that are not pinned.\n*\n* This is the center partition used by layouts that render pinned columns\n* separately from the scrollable middle region.\n*\n* @example\n* ```ts\n* const columns = table_getCenterVisibleLeafColumns(table)\n* ```\n*/\nfunction table_getCenterVisibleLeafColumns(table) {\n\treturn callMemoOrStaticFn(table, \"getCenterLeafColumns\", table_getCenterLeafColumns).filter((column) => callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Resolves visible leaf columns for a requested pinning region.\n*\n* Omit `position` to get all visible leaf columns, or pass `'start'`, `'center'`,\n* or `'end'` to get one partition.\n*\n* @example\n* ```ts\n* const columns = table_getPinnedVisibleLeafColumns(table, 'start')\n* ```\n*/\nfunction table_getPinnedVisibleLeafColumns(table, position) {\n\treturn !position ? callMemoOrStaticFn(table, \"getVisibleLeafColumns\", table_getVisibleLeafColumns) : position === \"start\" ? callMemoOrStaticFn(table, \"getStartVisibleLeafColumns\", table_getStartVisibleLeafColumns) : position === \"end\" ? callMemoOrStaticFn(table, \"getEndVisibleLeafColumns\", table_getEndVisibleLeafColumns) : callMemoOrStaticFn(table, \"getCenterVisibleLeafColumns\", table_getCenterVisibleLeafColumns);\n}\n\n//#endregion\nexport { column_getCanPin, column_getIsPinned, column_getPinnedIndex, column_pin, getDefaultColumnPinningState, row_getCenterVisibleCells, row_getEndVisibleCells, row_getStartVisibleCells, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterVisibleLeafColumns, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndVisibleLeafColumns, table_getIsSomeColumnsPinned, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartVisibleLeafColumns, table_resetColumnPinning, table_setColumnPinning };","import { callMemoOrStaticFn, cloneState, hasOwn, makeObjectMap, setStateSlice } from \"../../utils.js\";\nimport { getDefaultColumnPinningState } from \"../column-pinning/columnPinningFeature.utils.js\";\n\n//#region src/features/column-visibility/columnVisibilityFeature.utils.ts\n/**\n* Creates the default column visibility state.\n*\n* The feature default is an empty object, where missing column ids are treated\n* as visible. Reset APIs use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const visibility = getDefaultColumnVisibilityState()\n* ```\n*/\nfunction getDefaultColumnVisibilityState() {\n\treturn makeObjectMap();\n}\n/**\n* Updates this column's visibility when hiding is allowed.\n*\n* Passing `visible` stores that value. Omitting it flips the column's current\n* visibility state. Group columns update their hideable leaf columns because\n* visibility state is keyed by leaf column ids. Columns that cannot hide stay\n* unchanged.\n*\n* @example\n* ```ts\n* column_toggleVisibility(column)\n* ```\n*/\nfunction column_toggleVisibility(column, visible) {\n\tif (column_getCanHide(column)) table_setColumnVisibility(column.table, (old) => {\n\t\tconst next = Object.assign(makeObjectMap(), old);\n\t\tconst nextVisible = visible ?? !callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible);\n\t\tconst leafColumns = column.getLeafColumns();\n\t\tfor (let i = 0; i < leafColumns.length; i++) {\n\t\t\tconst leafColumn = leafColumns[i];\n\t\t\tif (column_getCanHide(leafColumn)) next[leafColumn.id] = nextVisible;\n\t\t}\n\t\treturn next;\n\t});\n}\n/**\n* Checks whether this column is visible.\n*\n* Leaf columns read `state.columnVisibility[column.id]`, where missing entries\n* default to visible. Parent columns are visible when at least one child column\n* is visible.\n*\n* @example\n* ```ts\n* const visible = column_getIsVisible(column)\n* ```\n*/\nfunction column_getIsVisible(column) {\n\tconst columnVisibility = column.table.atoms.columnVisibility?.get();\n\tif (!columnVisibility) return true;\n\tconst childColumns = column.columns;\n\tif (childColumns.length) return childColumns.some((childColumn) => callMemoOrStaticFn(childColumn, \"getIsVisible\", column_getIsVisible));\n\treturn (hasOwn(columnVisibility, column.id) ? columnVisibility[column.id] : void 0) ?? true;\n}\n/**\n* Checks whether this column is allowed to be hidden.\n*\n* Both `columnDef.enableHiding` and table `enableHiding` default to `true`.\n*\n* @example\n* ```ts\n* const canHide = column_getCanHide(column)\n* ```\n*/\nfunction column_getCanHide(column) {\n\treturn (column.columnDef.enableHiding ?? true) && (column.table.options.enableHiding ?? true);\n}\n/**\n* Creates a checkbox-style handler that writes this column's visibility.\n*\n* The handler reads `event.target.checked`, so it is intended for visibility\n* controls whose checked state means \"visible\".\n*\n* @example\n* ```ts\n* const onChange = column_getToggleVisibilityHandler(column)\n* ```\n*/\nfunction column_getToggleVisibilityHandler(column) {\n\treturn (e) => {\n\t\tcolumn_toggleVisibility(column, e.target.checked);\n\t};\n}\n/**\n* Collects the cells from this row whose columns are visible.\n*\n* When column pinning is active, the result is ordered as start-pinned cells,\n* center cells, then end-pinned cells.\n*\n* @example\n* ```ts\n* const visibleCells = row_getVisibleCells(row)\n* ```\n*/\nfunction row_getVisibleCells(row) {\n\tconst allCells = row.getAllCells();\n\tconst visibleCells = [];\n\tfor (let i = 0; i < allCells.length; i++) {\n\t\tconst cell = allCells[i];\n\t\tif (callMemoOrStaticFn(cell.column, \"getIsVisible\", column_getIsVisible)) visibleCells.push(cell);\n\t}\n\tconst { start, end } = row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tif (!start.length && !end.length) return visibleCells;\n\tconst visibleCellsByColumnId = callMemoOrStaticFn(row, \"getVisibleCellsByColumnId\", row_getVisibleCellsByColumnId);\n\tconst startCells = [];\n\tfor (let i = 0; i < start.length; i++) {\n\t\tconst cell = visibleCellsByColumnId[start[i]];\n\t\tif (cell) startCells.push(cell);\n\t}\n\tconst endCells = [];\n\tfor (let i = 0; i < end.length; i++) {\n\t\tconst cell = visibleCellsByColumnId[end[i]];\n\t\tif (cell) endCells.push(cell);\n\t}\n\tconst centerCells = [];\n\tfor (let i = 0; i < visibleCells.length; i++) {\n\t\tconst cell = visibleCells[i];\n\t\tconst id = cell.column.id;\n\t\tif (!start.includes(id) && !end.includes(id)) centerCells.push(cell);\n\t}\n\treturn [\n\t\t...startCells,\n\t\t...centerCells,\n\t\t...endCells\n\t];\n}\n/**\n* Builds a lookup map of this row's visible cells keyed by column id.\n*\n* Hidden columns are omitted from the map.\n*\n* @example\n* ```ts\n* const visibleCellsById = row_getVisibleCellsByColumnId(row)\n* ```\n*/\nfunction row_getVisibleCellsByColumnId(row) {\n\tconst result = makeObjectMap();\n\tconst allCells = row.getAllCells();\n\tfor (let i = 0; i < allCells.length; i++) {\n\t\tconst cell = allCells[i];\n\t\tif (callMemoOrStaticFn(cell.column, \"getIsVisible\", column_getIsVisible)) result[cell.column.id] = cell;\n\t}\n\treturn result;\n}\n/**\n* Filters the flat column list down to visible columns.\n*\n* Parent/group columns are included when `column_getIsVisible` considers them\n* visible.\n*\n* @example\n* ```ts\n* const columns = table_getVisibleFlatColumns(table)\n* ```\n*/\nfunction table_getVisibleFlatColumns(table) {\n\treturn table.getAllFlatColumns().filter((column) => callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Filters leaf columns down to those currently visible.\n*\n* This is the column list most row rendering code uses before pinning-specific\n* partitioning.\n*\n* @example\n* ```ts\n* const columns = table_getVisibleLeafColumns(table)\n* ```\n*/\nfunction table_getVisibleLeafColumns(table) {\n\treturn table.getAllLeafColumns().filter((column) => callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Routes a column visibility updater through the table's visibility change handler.\n*\n* The updater may be a next visibility map or a function of the previous map,\n* matching the instance `table.setColumnVisibility` behavior.\n*\n* @example\n* ```ts\n* table_setColumnVisibility(table, (old) => ({ ...old, age: false }))\n* ```\n*/\nfunction table_setColumnVisibility(table, updater) {\n\tsetStateSlice(table, \"columnVisibility\", updater);\n}\n/**\n* Resets `columnVisibility` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.columnVisibility` when\n* it exists. Passing `true` ignores initial state and resets to `{}`.\n*\n* @example\n* ```ts\n* table_resetColumnVisibility(table)\n* table_resetColumnVisibility(table, true)\n* ```\n*/\nfunction table_resetColumnVisibility(table, defaultState) {\n\ttable_setColumnVisibility(table, defaultState ? makeObjectMap() : Object.assign(makeObjectMap(), cloneState(table.initialState.columnVisibility ?? {})));\n}\n/**\n* Shows or hides every hideable leaf column.\n*\n* Columns that cannot hide stay visible when toggling all columns off.\n*\n* @example\n* ```ts\n* table_toggleAllColumnsVisible(table)\n* ```\n*/\nfunction table_toggleAllColumnsVisible(table, value) {\n\tvalue = value ?? !table_getIsAllColumnsVisible(table);\n\tconst visibility = makeObjectMap();\n\tconst leafColumns = table.getAllLeafColumns();\n\tfor (let i = 0; i < leafColumns.length; i++) {\n\t\tconst column = leafColumns[i];\n\t\tvisibility[column.id] = !value ? !column_getCanHide(column) : value;\n\t}\n\ttable_setColumnVisibility(table, visibility);\n}\n/**\n* Checks whether every leaf column is currently visible.\n*\n* Non-hideable columns are naturally visible because missing visibility entries\n* default to `true`.\n*\n* @example\n* ```ts\n* const allVisible = table_getIsAllColumnsVisible(table)\n* ```\n*/\nfunction table_getIsAllColumnsVisible(table) {\n\treturn !table.getAllLeafColumns().some((column) => !callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Checks whether at least one leaf column is currently visible.\n*\n* This is useful for tri-state \"show all columns\" controls.\n*\n* @example\n* ```ts\n* const someVisible = table_getIsSomeColumnsVisible(table)\n* ```\n*/\nfunction table_getIsSomeColumnsVisible(table) {\n\treturn table.getAllLeafColumns().some((column) => callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible));\n}\n/**\n* Creates a checkbox-style handler that shows or hides all columns.\n*\n* The handler reads `event.target.checked`, so it is intended for controls whose\n* checked state means \"all columns visible\".\n*\n* @example\n* ```ts\n* const onChange = table_getToggleAllColumnsVisibilityHandler(table)\n* ```\n*/\nfunction table_getToggleAllColumnsVisibilityHandler(table) {\n\treturn (e) => {\n\t\ttable_toggleAllColumnsVisible(table, e.target.checked);\n\t};\n}\n\n//#endregion\nexport { column_getCanHide, column_getIsVisible, column_getToggleVisibilityHandler, column_toggleVisibility, getDefaultColumnVisibilityState, row_getVisibleCells, row_getVisibleCellsByColumnId, table_getIsAllColumnsVisible, table_getIsSomeColumnsVisible, table_getToggleAllColumnsVisibilityHandler, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_resetColumnVisibility, table_setColumnVisibility, table_toggleAllColumnsVisible };","import { callMemoOrStaticFn } from \"../../utils.js\";\nimport { column_getIsVisible } from \"../../features/column-visibility/columnVisibilityFeature.utils.js\";\nimport { constructHeader } from \"./constructHeader.js\";\n\n//#region src/core/headers/buildHeaderGroups.ts\nfunction getMaxHeaderDepth(columns, depth = 1) {\n\tlet maxDepth = depth;\n\tfor (let i = 0; i < columns.length; i++) {\n\t\tconst column = columns[i];\n\t\tif (callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible) && column.columns.length) maxDepth = Math.max(maxDepth, getMaxHeaderDepth(column.columns, depth + 1));\n\t}\n\treturn maxDepth;\n}\nfunction formatHeaderGroupId(headerFamily, depth) {\n\treturn headerFamily ? `${headerFamily}_${depth}` : String(depth);\n}\nfunction formatHeaderId(headerFamily, depth, columnId, childHeaderId) {\n\tlet id = headerFamily ?? \"\";\n\tif (depth) id = id ? `${id}_${depth}` : String(depth);\n\tif (columnId) id = id ? `${id}_${columnId}` : columnId;\n\tif (childHeaderId) id = id ? `${id}_${childHeaderId}` : childHeaderId;\n\treturn id;\n}\nfunction countPendingHeadersForColumn(headers, column) {\n\tlet count = 0;\n\tfor (let i = 0; i < headers.length; i++) if (headers[i].column === column) count++;\n\treturn count;\n}\nfunction constructHeaderGroup(headersToGroup, depth, table, headerFamily, headerGroups, headerGroupInitFns) {\n\tconst headerGroup = {\n\t\tdepth,\n\t\tid: formatHeaderGroupId(headerFamily, depth),\n\t\theaders: []\n\t};\n\tconst pendingParentHeaders = [];\n\tfor (let i = 0; i < headersToGroup.length; i++) {\n\t\tif (!(i in headersToGroup)) continue;\n\t\tconst headerToGroup = headersToGroup[i];\n\t\tconst latestPendingParentHeader = pendingParentHeaders[pendingParentHeaders.length - 1];\n\t\tconst isLeafHeader = headerToGroup.column.depth === headerGroup.depth;\n\t\tlet column;\n\t\tlet isPlaceholder = false;\n\t\tif (isLeafHeader && headerToGroup.column.parent) column = headerToGroup.column.parent;\n\t\telse {\n\t\t\tcolumn = headerToGroup.column;\n\t\t\tisPlaceholder = true;\n\t\t}\n\t\tif (latestPendingParentHeader && latestPendingParentHeader.column === column) latestPendingParentHeader.subHeaders.push(headerToGroup);\n\t\telse {\n\t\t\tconst header = constructHeader(table, column, {\n\t\t\t\tid: formatHeaderId(headerFamily, depth, column.id, headerToGroup.id),\n\t\t\t\tisPlaceholder,\n\t\t\t\tplaceholderId: isPlaceholder ? String(countPendingHeadersForColumn(pendingParentHeaders, column)) : void 0,\n\t\t\t\tdepth,\n\t\t\t\tindex: pendingParentHeaders.length\n\t\t\t});\n\t\t\theader.subHeaders.push(headerToGroup);\n\t\t\tpendingParentHeaders.push(header);\n\t\t}\n\t\theaderGroup.headers.push(headerToGroup);\n\t\theaderToGroup.headerGroup = headerGroup;\n\t}\n\tfor (let i = 0; i < headerGroupInitFns.length; i++) headerGroupInitFns[i](headerGroup);\n\theaderGroups.push(headerGroup);\n\tif (depth > 0) constructHeaderGroup(pendingParentHeaders, depth - 1, table, headerFamily, headerGroups, headerGroupInitFns);\n}\nfunction updateHeaderSpans(headers) {\n\tfor (let i = 0; i < headers.length; i++) {\n\t\tconst header = headers[i];\n\t\tif (!callMemoOrStaticFn(header.column, \"getIsVisible\", column_getIsVisible)) continue;\n\t\tlet colSpan = 0;\n\t\tif (header.subHeaders.length) {\n\t\t\tupdateHeaderSpans(header.subHeaders);\n\t\t\tfor (let j = 0; j < header.subHeaders.length; j++) {\n\t\t\t\tconst child = header.subHeaders[j];\n\t\t\t\tif (!callMemoOrStaticFn(child.column, \"getIsVisible\", column_getIsVisible)) continue;\n\t\t\t\tcolSpan += child.colSpan;\n\t\t\t}\n\t\t} else colSpan = 1;\n\t\theader.colSpan = colSpan;\n\t\tif (header.isPlaceholder && header.subHeaders.length === 1 && header.subHeaders[0].column === header.column) {\n\t\t\tlet rowSpan = 1;\n\t\t\tlet chainChild = header.subHeaders[0];\n\t\t\twhile (chainChild) {\n\t\t\t\tchainChild.rowSpan = 0;\n\t\t\t\trowSpan++;\n\t\t\t\tchainChild = chainChild.subHeaders.length === 1 && chainChild.subHeaders[0].column === header.column ? chainChild.subHeaders[0] : void 0;\n\t\t\t}\n\t\t\theader.rowSpan = rowSpan;\n\t\t} else header.rowSpan = 1;\n\t}\n}\n/**\n* Builds the nested header group structure for a table.\n*\n* The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n*/\nfunction buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {\n\tconst maxDepth = getMaxHeaderDepth(allColumns);\n\tconst headerGroups = [];\n\tconst headerGroupInitFns = table._headerGroupInstanceInitFns;\n\tconst bottomHeaders = new Array(columnsToGroup.length);\n\tfor (let i = 0; i < columnsToGroup.length; i++) {\n\t\tif (!(i in columnsToGroup)) continue;\n\t\tbottomHeaders[i] = constructHeader(table, columnsToGroup[i], {\n\t\t\tdepth: maxDepth,\n\t\t\tindex: i\n\t\t});\n\t}\n\tconstructHeaderGroup(bottomHeaders, maxDepth - 1, table, headerFamily, headerGroups, headerGroupInitFns);\n\theaderGroups.reverse();\n\tupdateHeaderSpans(headerGroups[0]?.headers ?? []);\n\treturn headerGroups;\n}\n\n//#endregion\nexport { buildHeaderGroups };","//#region src/core/columns/constructColumn.ts\n/**\n* Creates or retrieves the column prototype for a table.\n* The prototype is cached on the table and shared by all column instances.\n*/\nfunction getColumnPrototype(table) {\n\tif (!table._columnPrototype) {\n\t\ttable._columnPrototype = { table };\n\t\tconst features = Object.values(table._features);\n\t\tfor (let i = 0; i < features.length; i++) features[i].assignColumnPrototype?.(table._columnPrototype, table);\n\t}\n\treturn table._columnPrototype;\n}\n/**\n* Constructs a column instance from normalized table internals.\n*\n* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n*/\nfunction constructColumn(table, columnDef, depth, parent) {\n\tconst resolvedColumnDef = {\n\t\t...table.getDefaultColumnDef(),\n\t\t...columnDef\n\t};\n\tconst accessorKey = resolvedColumnDef.accessorKey;\n\tconst accessorKeyString = accessorKey === void 0 ? void 0 : String(accessorKey);\n\tconst id = resolvedColumnDef.id ?? accessorKeyString?.replaceAll(\".\", \"_\") ?? (typeof resolvedColumnDef.header === \"string\" ? resolvedColumnDef.header : void 0);\n\tlet accessorFn;\n\tif (resolvedColumnDef.accessorFn) accessorFn = resolvedColumnDef.accessorFn;\n\telse if (accessorKey !== void 0) if (typeof accessorKey === \"string\" && accessorKey.includes(\".\")) {\n\t\tconst keys = accessorKey.split(\".\");\n\t\taccessorFn = (originalRow) => {\n\t\t\tlet result = originalRow;\n\t\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\t\tconst key = keys[i];\n\t\t\t\tresult = result?.[key];\n\t\t\t\tif (process.env.NODE_ENV === \"development\" && result === void 0) console.warn(`\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t} else accessorFn = (originalRow) => originalRow[resolvedColumnDef.accessorKey];\n\tif (!id) {\n\t\tif (process.env.NODE_ENV === \"development\") throw new Error(resolvedColumnDef.accessorFn ? `coreColumnsFeature require an id when using an accessorFn` : `coreColumnsFeature require an id when using a non-string header`);\n\t\tthrow new Error();\n\t}\n\tconst columnPrototype = getColumnPrototype(table);\n\tconst column = Object.create(columnPrototype);\n\tcolumn.accessorFn = accessorFn;\n\tcolumn.columnDef = resolvedColumnDef;\n\tcolumn.columns = [];\n\tcolumn.depth = depth;\n\tcolumn.id = `${String(id)}`;\n\tcolumn.parent = parent;\n\tconst initFns = table._columnInstanceInitFns;\n\tfor (let i = 0; i < initFns.length; i++) initFns[i](column);\n\treturn column;\n}\n\n//#endregion\nexport { constructColumn };","import { callMemoOrStaticFn, cloneState, makeObjectMap, setStateSlice } from \"../../utils.js\";\nimport { table_getPinnedVisibleLeafColumns } from \"../column-pinning/columnPinningFeature.utils.js\";\n\n//#region src/features/column-ordering/columnOrderingFeature.utils.ts\n/**\n* Creates the default column order state.\n*\n* The feature default is an empty array, meaning leaf columns keep their natural\n* definition order. Reset APIs use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const order = getDefaultColumnOrderState()\n* ```\n*/\nfunction getDefaultColumnOrderState() {\n\treturn [];\n}\n/**\n* Builds column-id to index records for each visible pinning region.\n*\n* All four regions are built in one pass so a single memo entry serves every\n* `column_getIndex` lookup without per-column scans.\n*\n* @example\n* ```ts\n* const indexes = table_getColumnIndexes(table)\n* ```\n*/\nfunction table_getColumnIndexes(table) {\n\tconst buildIndexes = (columns) => {\n\t\tconst indexes = makeObjectMap();\n\t\tfor (let i = 0; i < columns.length; i++) indexes[columns[i].id] = i;\n\t\treturn indexes;\n\t};\n\treturn {\n\t\tall: buildIndexes(table_getPinnedVisibleLeafColumns(table)),\n\t\tcenter: buildIndexes(table_getPinnedVisibleLeafColumns(table, \"center\")),\n\t\tstart: buildIndexes(table_getPinnedVisibleLeafColumns(table, \"start\")),\n\t\tend: buildIndexes(table_getPinnedVisibleLeafColumns(table, \"end\"))\n\t};\n}\n/**\n* Finds this column's index within a visible pinning region.\n*\n* Pass `'start'`, `'center'`, or `'end'` to search that region; omit the\n* position to search the full visible leaf column list.\n*\n* @example\n* ```ts\n* const index = column_getIndex(column, 'center')\n* ```\n*/\nfunction column_getIndex(column, position) {\n\treturn callMemoOrStaticFn(column.table, \"getColumnIndexes\", table_getColumnIndexes)[position === \"start\" ? \"start\" : position === \"end\" ? \"end\" : position === \"center\" ? \"center\" : \"all\"][column.id] ?? -1;\n}\n/**\n* Checks whether this column is the first visible column in a pinning region.\n*\n* The same `position` semantics as `column_getIndex` apply.\n*\n* @example\n* ```ts\n* const isFirst = column_getIsFirstColumn(column, 'start')\n* ```\n*/\nfunction column_getIsFirstColumn(column, position) {\n\treturn table_getPinnedVisibleLeafColumns(column.table, position)[0]?.id === column.id;\n}\n/**\n* Checks whether this column is the last visible column in a pinning region.\n*\n* The same `position` semantics as `column_getIndex` apply.\n*\n* @example\n* ```ts\n* const isLast = column_getIsLastColumn(column, 'end')\n* ```\n*/\nfunction column_getIsLastColumn(column, position) {\n\tconst columns = table_getPinnedVisibleLeafColumns(column.table, position);\n\treturn columns[columns.length - 1]?.id === column.id;\n}\n/**\n* Routes a column order updater through the table's column-order change handler.\n*\n* The updater may be a next ordered id array or a function of the previous\n* array, matching the instance `table.setColumnOrder` behavior.\n*\n* @example\n* ```ts\n* table_setColumnOrder(table, ['firstName', 'lastName', 'age'])\n* ```\n*/\nfunction table_setColumnOrder(table, updater) {\n\tsetStateSlice(table, \"columnOrder\", updater);\n}\n/**\n* Resets `columnOrder` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.columnOrder` when it\n* exists. Passing `true` ignores initial state and resets to `[]`.\n*\n* @example\n* ```ts\n* table_resetColumnOrder(table)\n* table_resetColumnOrder(table, true)\n* ```\n*/\nfunction table_resetColumnOrder(table, defaultState) {\n\ttable_setColumnOrder(table, defaultState ? [] : cloneState(table.initialState.columnOrder ?? []));\n}\n/**\n* Creates the ordering function used to arrange leaf columns.\n*\n* The returned function applies `state.columnOrder`, preserves unspecified\n* columns in their original order, then delegates to grouping rules.\n*\n* @example\n* ```ts\n* const orderColumnsForTable = table_getOrderColumnsFn(table)\n* ```\n*/\nfunction table_getOrderColumnsFn(table) {\n\tconst columnOrder = table.atoms.columnOrder?.get();\n\treturn (columns) => {\n\t\tlet orderedColumns = [];\n\t\tif (!columnOrder?.length) orderedColumns = columns;\n\t\telse {\n\t\t\tconst remaining = /* @__PURE__ */ new Map();\n\t\t\tfor (let i = 0; i < columns.length; i++) {\n\t\t\t\tconst column = columns[i];\n\t\t\t\tremaining.set(column.id, column);\n\t\t\t}\n\t\t\tfor (let i = 0; i < columnOrder.length; i++) {\n\t\t\t\tconst id = columnOrder[i];\n\t\t\t\tconst column = remaining.get(id);\n\t\t\t\tif (column) {\n\t\t\t\t\torderedColumns.push(column);\n\t\t\t\t\tremaining.delete(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (let i = 0; i < columns.length; i++) {\n\t\t\t\tconst column = columns[i];\n\t\t\t\tif (remaining.has(column.id)) orderedColumns.push(column);\n\t\t\t}\n\t\t}\n\t\treturn orderColumns(table, orderedColumns);\n\t};\n}\n/**\n* Applies grouped-column placement rules to an already ordered leaf-column list.\n*\n* `groupedColumnMode: 'remove'` drops grouped columns from the list.\n* `groupedColumnMode: 'reorder'` moves grouped columns to the front in grouping\n* state order.\n*\n* @example\n* ```ts\n* const orderedColumns = orderColumns(table, leafColumns)\n* ```\n*/\nfunction orderColumns(table, leafColumns) {\n\tconst grouping = table.atoms.grouping?.get() ?? [];\n\tconst { groupedColumnMode } = table.options;\n\tif (!grouping.length || !groupedColumnMode) return leafColumns;\n\tconst nonGroupingColumns = leafColumns.filter((col) => !grouping.includes(col.id));\n\tif (groupedColumnMode === \"remove\") return nonGroupingColumns;\n\tconst leafColumnsById = /* @__PURE__ */ new Map();\n\tfor (let i = 0; i < leafColumns.length; i++) {\n\t\tconst col = leafColumns[i];\n\t\tleafColumnsById.set(col.id, col);\n\t}\n\tconst groupingColumns = [];\n\tfor (let i = 0; i < grouping.length; i++) {\n\t\tconst col = leafColumnsById.get(grouping[i]);\n\t\tif (col) groupingColumns.push(col);\n\t}\n\treturn [...groupingColumns, ...nonGroupingColumns];\n}\n\n//#endregion\nexport { column_getIndex, column_getIsFirstColumn, column_getIsLastColumn, getDefaultColumnOrderState, orderColumns, table_getColumnIndexes, table_getOrderColumnsFn, table_resetColumnOrder, table_setColumnOrder };","import { callMemoOrStaticFn, makeObjectMap } from \"../../utils.js\";\nimport { table_getOrderColumnsFn } from \"../../features/column-ordering/columnOrderingFeature.utils.js\";\nimport { constructColumn } from \"./constructColumn.js\";\n\n//#region src/core/columns/coreColumnsFeature.utils.ts\n/**\n* Flattens this column and every descendant column into a single array.\n*\n* Group columns appear before their child columns, which matches the normalized\n* column hierarchy produced during table construction.\n*\n* @example\n* ```ts\n* const flatColumns = column_getFlatColumns(column)\n* ```\n*/\nfunction column_getFlatColumns(column) {\n\treturn [column, ...column.columns.flatMap((col) => col.getFlatColumns())];\n}\n/**\n* Collects the terminal leaf columns below this column.\n*\n* Group columns return their ordered descendants. Non-group columns return an\n* array containing only the column itself.\n*\n* @example\n* ```ts\n* const leafColumns = column_getLeafColumns(column)\n* ```\n*/\nfunction column_getLeafColumns(column) {\n\tif (column.columns.length) {\n\t\tconst leafColumns = column.columns.flatMap((col) => col.getLeafColumns());\n\t\treturn callMemoOrStaticFn(column.table, \"getOrderColumns\", table_getOrderColumnsFn)(leafColumns);\n\t}\n\treturn [column];\n}\n/**\n* Merges built-in, feature, and user default column definitions.\n*\n* Built-in defaults provide a header and fallback cell renderer, feature\n* defaults can add feature-specific column options, and\n* `options.defaultColumn` wins last.\n*\n* @example\n* ```ts\n* const defaultColumn = table_getDefaultColumnDef(table)\n* ```\n*/\nfunction table_getDefaultColumnDef(table) {\n\treturn {\n\t\theader: (props) => {\n\t\t\tconst resolvedColumnDef = props.header.column.columnDef;\n\t\t\tif (resolvedColumnDef.accessorKey) return resolvedColumnDef.accessorKey;\n\t\t\tif (resolvedColumnDef.accessorFn) return resolvedColumnDef.id;\n\t\t\treturn null;\n\t\t},\n\t\tcell: (props) => props.renderValue()?.toString?.() ?? null,\n\t\t...Object.values(table._features).reduce((obj, feature) => {\n\t\t\treturn Object.assign(obj, feature.getDefaultColumnDef?.());\n\t\t}, {}),\n\t\t...table.options.defaultColumn\n\t};\n}\nfunction constructColumns(table, columnDefs, parent, depth = 0) {\n\tconst columns = new Array(columnDefs.length);\n\tfor (let i = 0; i < columnDefs.length; i++) {\n\t\tif (!(i in columnDefs)) continue;\n\t\tconst columnDef = columnDefs[i];\n\t\tconst column = constructColumn(table, columnDef, depth, parent);\n\t\tconst groupingColumnDef = columnDef;\n\t\tcolumn.columns = groupingColumnDef.columns ? constructColumns(table, groupingColumnDef.columns, column, depth + 1) : [];\n\t\tcolumns[i] = column;\n\t}\n\treturn columns;\n}\n/**\n* Normalizes `options.columns` into the table's nested column tree.\n*\n* Each column definition is constructed with its parent and depth, and group\n* column children are recursively constructed.\n*\n* @example\n* ```ts\n* const columns = table_getAllColumns(table)\n* ```\n*/\nfunction table_getAllColumns(table) {\n\treturn constructColumns(table, table.options.columns);\n}\n/**\n* Flattens every table column, including group columns and leaf columns.\n*\n* Use this when parent/group columns must be included in addition to data leaf\n* columns.\n*\n* @example\n* ```ts\n* const flatColumns = table_getAllFlatColumns(table)\n* ```\n*/\nfunction table_getAllFlatColumns(table) {\n\treturn table.getAllColumns().flatMap((column) => column.getFlatColumns());\n}\n/**\n* Builds an id lookup for every flat column in the table.\n*\n* Group columns and leaf columns are included. Later columns with the same id\n* replace earlier entries.\n*\n* @example\n* ```ts\n* const columnsById = table_getAllFlatColumnsById(table)\n* ```\n*/\nfunction table_getAllFlatColumnsById(table) {\n\tconst result = makeObjectMap();\n\tconst flatColumns = table.getAllFlatColumns();\n\tfor (let i = 0; i < flatColumns.length; i++) {\n\t\tconst column = flatColumns[i];\n\t\tresult[column.id] = column;\n\t}\n\treturn result;\n}\n/**\n* Collects all terminal leaf columns in their current table order.\n*\n* Column ordering features can reorder the collected leaves before the result\n* is returned.\n*\n* @example\n* ```ts\n* const leafColumns = table_getAllLeafColumns(table)\n* ```\n*/\nfunction table_getAllLeafColumns(table) {\n\tconst leafColumns = table.getAllColumns().flatMap((c) => c.getLeafColumns());\n\treturn callMemoOrStaticFn(table, \"getOrderColumns\", table_getOrderColumnsFn)(leafColumns);\n}\n/**\n* Builds an id lookup for terminal leaf columns only.\n*\n* Parent/group columns are excluded, making this lookup appropriate for row\n* cells and feature state keyed by data columns.\n*\n* @example\n* ```ts\n* const leavesById = table_getAllLeafColumnsById(table)\n* ```\n*/\nfunction table_getAllLeafColumnsById(table) {\n\tconst result = makeObjectMap();\n\tconst leafColumns = table.getAllLeafColumns();\n\tfor (let i = 0; i < leafColumns.length; i++) {\n\t\tconst column = leafColumns[i];\n\t\tresult[column.id] = column;\n\t}\n\treturn result;\n}\n/**\n* Looks up a column by id from the flat column map.\n*\n* The lookup can return group columns or leaf columns. In development, a\n* missing id logs a warning to help catch stale column references.\n*\n* @example\n* ```ts\n* const column = table_getColumn(table, 'firstName')\n* ```\n*/\nfunction table_getColumn(table, columnId) {\n\tconst column = table.getAllFlatColumnsById()[columnId];\n\tif (process.env.NODE_ENV === \"development\" && !column) console.warn(`[Table] Column with id '${columnId}' does not exist.`);\n\treturn column;\n}\n\n//#endregion\nexport { column_getFlatColumns, column_getLeafColumns, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getColumn, table_getDefaultColumnDef };","import { assignPrototypeAPIs, assignTableAPIs } from \"../../utils.js\";\nimport { column_getFlatColumns, column_getLeafColumns, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getColumn, table_getDefaultColumnDef } from \"./coreColumnsFeature.utils.js\";\n\n//#region src/core/columns/coreColumnsFeature.ts\n/**\n* Core feature that builds the column tree and exposes table/column APIs.\n*/\nconst coreColumnsFeature = {\n\tassignColumnPrototype: (prototype, table) => {\n\t\tassignPrototypeAPIs(\"coreColumnsFeature\", prototype, table, {\n\t\t\tcolumn_getFlatColumns: {\n\t\t\t\tfn: (column) => column_getFlatColumns(column),\n\t\t\t\tmemoDeps: (column) => [column.table.options.columns]\n\t\t\t},\n\t\t\tcolumn_getLeafColumns: {\n\t\t\t\tfn: (column) => column_getLeafColumns(column),\n\t\t\t\tmemoDeps: (column) => [\n\t\t\t\t\tcolumn.table.atoms.columnOrder?.get(),\n\t\t\t\t\tcolumn.table.atoms.grouping?.get(),\n\t\t\t\t\tcolumn.table.options.columns,\n\t\t\t\t\tcolumn.table.options.groupedColumnMode\n\t\t\t\t]\n\t\t\t}\n\t\t});\n\t},\n\tconstructTableAPIs: (table) => {\n\t\tassignTableAPIs(\"coreColumnsFeature\", table, {\n\t\t\ttable_getDefaultColumnDef: {\n\t\t\t\tfn: () => table_getDefaultColumnDef(table),\n\t\t\t\tmemoDeps: () => [table.options.defaultColumn]\n\t\t\t},\n\t\t\ttable_getAllColumns: {\n\t\t\t\tfn: () => table_getAllColumns(table),\n\t\t\t\tmemoDeps: () => [table.options.columns]\n\t\t\t},\n\t\t\ttable_getAllFlatColumns: {\n\t\t\t\tfn: () => table_getAllFlatColumns(table),\n\t\t\t\tmemoDeps: () => [table.options.columns]\n\t\t\t},\n\t\t\ttable_getAllFlatColumnsById: {\n\t\t\t\tfn: () => table_getAllFlatColumnsById(table),\n\t\t\t\tmemoDeps: () => [table.options.columns]\n\t\t\t},\n\t\t\ttable_getAllLeafColumns: {\n\t\t\t\tfn: () => table_getAllLeafColumns(table),\n\t\t\t\tmemoDeps: () => [\n\t\t\t\t\ttable.atoms.columnOrder?.get(),\n\t\t\t\t\ttable.atoms.grouping?.get(),\n\t\t\t\t\ttable.options.columns,\n\t\t\t\t\ttable.options.groupedColumnMode\n\t\t\t\t]\n\t\t\t},\n\t\t\ttable_getAllLeafColumnsById: {\n\t\t\t\tfn: () => table_getAllLeafColumnsById(table),\n\t\t\t\tmemoDeps: () => [table.getAllLeafColumns()]\n\t\t\t},\n\t\t\ttable_getColumn: { fn: (columnId) => table_getColumn(table, columnId) }\n\t\t});\n\t}\n};\n\n//#endregion\nexport { coreColumnsFeature };","import { callMemoOrStaticFn } from \"../../utils.js\";\nimport { column_getIsVisible, table_getVisibleLeafColumns } from \"../../features/column-visibility/columnVisibilityFeature.utils.js\";\nimport { buildHeaderGroups } from \"./buildHeaderGroups.js\";\nimport { getDefaultColumnPinningState } from \"../../features/column-pinning/columnPinningFeature.utils.js\";\n\n//#region src/core/headers/coreHeadersFeature.utils.ts\nfunction collectLeafHeaders(header, leafHeaders) {\n\tfor (let i = 0; i < header.subHeaders.length; i++) collectLeafHeaders(header.subHeaders[i], leafHeaders);\n\tleafHeaders.push(header);\n}\n/**\n* Walks a header tree and collects all descendant leaf headers.\n*\n* The header itself is included after its descendants, matching the recursive\n* shape used by nested header groups.\n*\n* @example\n* ```ts\n* const leafHeaders = header_getLeafHeaders(header)\n* ```\n*/\nfunction header_getLeafHeaders(header) {\n\tconst leafHeaders = [];\n\tcollectLeafHeaders(header, leafHeaders);\n\treturn leafHeaders;\n}\n/**\n* Builds the render context passed to a column's `header` or `footer` template.\n*\n* The context contains the header, its column, and the owning table instance.\n*\n* @example\n* ```ts\n* const context = header_getContext(header)\n* ```\n*/\nfunction header_getContext(header) {\n\treturn {\n\t\tcolumn: header.column,\n\t\theader,\n\t\ttable: header.column.table\n\t};\n}\n/**\n* Builds visible header groups for the current column tree.\n*\n* Column visibility and pinning are applied before groups are built. When no\n* columns are pinned, the fast path skips pin partitioning.\n*\n* @example\n* ```ts\n* const headerGroups = table_getHeaderGroups(table)\n* ```\n*/\nfunction table_getHeaderGroups(table) {\n\tconst { start, end } = table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState();\n\tconst allColumns = table.getAllColumns();\n\tconst leafColumns = callMemoOrStaticFn(table, \"getVisibleLeafColumns\", table_getVisibleLeafColumns);\n\tif (!start.length && !end.length) return buildHeaderGroups(allColumns, leafColumns, table);\n\tconst leafColumnsById = table.getAllLeafColumnsById();\n\tconst leftColumns = [];\n\tfor (let i = 0; i < start.length; i++) {\n\t\tconst column = leafColumnsById[start[i]];\n\t\tif (column && callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible)) leftColumns.push(column);\n\t}\n\tconst rightColumns = [];\n\tfor (let i = 0; i < end.length; i++) {\n\t\tconst column = leafColumnsById[end[i]];\n\t\tif (column && callMemoOrStaticFn(column, \"getIsVisible\", column_getIsVisible)) rightColumns.push(column);\n\t}\n\tconst centerColumns = leafColumns.filter((column) => !start.includes(column.id) && !end.includes(column.id));\n\treturn buildHeaderGroups(allColumns, [\n\t\t...leftColumns,\n\t\t...centerColumns,\n\t\t...rightColumns\n\t], table);\n}\n/**\n* Builds footer groups by reversing the current header groups.\n*\n* Footer rendering uses the same header objects and grouping structure, but\n* renders them from leaf level back toward the root.\n*\n* @example\n* ```ts\n* const footerGroups = table_getFooterGroups(table)\n* ```\n*/\nfunction table_getFooterGroups(table) {\n\treturn [...table.getHeaderGroups()].reverse();\n}\n/**\n* Flattens every header from every header group into one array.\n*\n* The result includes parent headers and placeholder headers, in header-group\n* order from top to bottom.\n*\n* @example\n* ```ts\n* const flatHeaders = table_getFlatHeaders(table)\n* ```\n*/\nfunction table_getFlatHeaders(table) {\n\tconst headerGroups = table.getHeaderGroups();\n\tconst result = [];\n\tfor (let i = 0; i < headerGroups.length; i++) {\n\t\tconst headers = headerGroups[i].headers;\n\t\tfor (let j = 0; j < headers.length; j++) result.push(headers[j]);\n\t}\n\treturn result;\n}\n/**\n* Collects only the leaf headers from the current header tree.\n*\n* Parent/group headers are skipped, making the result suitable for rendering\n* one header per visible leaf column.\n*\n* @example\n* ```ts\n* const leafHeaders = table_getLeafHeaders(table)\n* ```\n*/\nfunction table_getLeafHeaders(table) {\n\tconst topHeaders = table.getHeaderGroups()[0]?.headers ?? [];\n\tconst result = [];\n\tfor (let i = 0; i < topHeaders.length; i++) {\n\t\tconst leafHeaders = topHeaders[i].getLeafHeaders();\n\t\tfor (let j = 0; j < leafHeaders.length; j++) result.push(leafHeaders[j]);\n\t}\n\treturn result;\n}\n\n//#endregion\nexport { header_getContext, header_getLeafHeaders, table_getFlatHeaders, table_getFooterGroups, table_getHeaderGroups, table_getLeafHeaders };","import { assignPrototypeAPIs, assignTableAPIs } from \"../../utils.js\";\nimport { header_getContext, header_getLeafHeaders, table_getFlatHeaders, table_getFooterGroups, table_getHeaderGroups, table_getLeafHeaders } from \"./coreHeadersFeature.utils.js\";\n\n//#region src/core/headers/coreHeadersFeature.ts\n/**\n* Core feature that builds header groups and exposes header context APIs.\n*/\nconst coreHeadersFeature = {\n\tassignHeaderPrototype: (prototype, table) => {\n\t\tassignPrototypeAPIs(\"coreHeadersFeature\", prototype, table, {\n\t\t\theader_getLeafHeaders: {\n\t\t\t\tfn: (header) => header_getLeafHeaders(header),\n\t\t\t\tmemoDeps: (header) => [header.column.table.options.columns]\n\t\t\t},\n\t\t\theader_getContext: {\n\t\t\t\tfn: (header) => header_getContext(header),\n\t\t\t\tmemoDeps: (header) => [header.column.table.options.columns]\n\t\t\t}\n\t\t});\n\t},\n\tconstructTableAPIs: (table) => {\n\t\tassignTableAPIs(\"coreHeadersFeature\", table, {\n\t\t\ttable_getHeaderGroups: {\n\t\t\t\tfn: () => table_getHeaderGroups(table),\n\t\t\t\tmemoDeps: () => [\n\t\t\t\t\ttable.options.columns,\n\t\t\t\t\ttable.atoms.columnOrder?.get(),\n\t\t\t\t\ttable.atoms.grouping?.get(),\n\t\t\t\t\ttable.atoms.columnPinning?.get(),\n\t\t\t\t\ttable.atoms.columnVisibility?.get(),\n\t\t\t\t\ttable.options.groupedColumnMode\n\t\t\t\t]\n\t\t\t},\n\t\t\ttable_getFooterGroups: {\n\t\t\t\tfn: () => table_getFooterGroups(table),\n\t\t\t\tmemoDeps: () => [table.getHeaderGroups()]\n\t\t\t},\n\t\t\ttable_getFlatHeaders: {\n\t\t\t\tfn: () => table_getFlatHeaders(table),\n\t\t\t\tmemoDeps: () => [table.getHeaderGroups()]\n\t\t\t},\n\t\t\ttable_getLeafHeaders: {\n\t\t\t\tfn: () => table_getLeafHeaders(table),\n\t\t\t\tmemoDeps: () => [table.getHeaderGroups()]\n\t\t\t}\n\t\t});\n\t}\n};\n\n//#endregion\nexport { coreHeadersFeature };","import { makeObjectMap } from \"../../utils.js\";\n\n//#region src/core/rows/constructRow.ts\n/**\n* Creates or retrieves the row prototype for a table.\n* The prototype is cached on the table and shared by all row instances.\n*/\nfunction getRowPrototype(table) {\n\tif (!table._rowPrototype) {\n\t\ttable._rowPrototype = { table };\n\t\tconst features = Object.values(table._features);\n\t\tfor (let i = 0; i < features.length; i++) features[i].assignRowPrototype?.(table._rowPrototype, table);\n\t}\n\treturn table._rowPrototype;\n}\n/**\n* Constructs a row instance from normalized table internals.\n*\n* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n*/\nconst constructRow = (table, id, original, rowIndex, depth, subRows, parentId) => {\n\tconst rowPrototype = getRowPrototype(table);\n\tconst row = Object.create(rowPrototype);\n\trow._displayIndexCache = -1;\n\trow._uniqueValuesCache = makeObjectMap();\n\trow._valuesCache = makeObjectMap();\n\trow.depth = depth;\n\trow.id = id;\n\trow.index = rowIndex;\n\trow.original = original;\n\trow.parentId = parentId;\n\trow.subRows = subRows ?? [];\n\tconst initFns = table._rowInstanceInitFns;\n\tfor (let i = 0; i < initFns.length; i++) initFns[i](row);\n\treturn row;\n};\n\n//#endregion\nexport { constructRow };","//#region src/features/row-sorting/sortFns.ts\n/**\n* Regular expression used to split mixed text and numeric chunks.\n*\n* The alphanumeric sort functions use these chunks for natural sorting of\n* strings like `item2` before `item10`.\n*/\nconst reSplitAlphaNumeric = /([0-9]+)/gm;\n/**\n* Builds a `SortFn` from a value-level comparator plus an optional\n* `resolveDataValue` normalizer.\n*\n* The `sort` comparator receives both rows' data values, each already passed\n* through `resolveDataValue` when one is defined. Keeping normalization in the\n* resolver means a variant of an existing sorting function only has to swap\n* the resolver, not re-implement the comparison.\n*\n* The definition is attached to the returned function, so a variant can be\n* created by spreading a built-in sorting function and overriding what\n* differs:\n*\n* ```ts\n* const stripDiacritics = (value: string) =>\n* value.normalize('NFD').replace(/\\p{Diacritic}/gu, '')\n*\n* const alphanumericIgnoreDiacritics = constructSortFn({\n* ...sortFn_alphanumeric,\n* resolveDataValue: (value) =>\n* stripDiacritics(sortFn_alphanumeric.resolveDataValue!(value)),\n* })\n* ```\n*/\nfunction constructSortFn(def) {\n\tconst sortFn = Object.assign((rowA, rowB, columnId) => {\n\t\tlet dataValueA = rowA.getValue(columnId);\n\t\tlet dataValueB = rowB.getValue(columnId);\n\t\tconst resolveDataValue = sortFn.resolveDataValue;\n\t\tif (resolveDataValue) {\n\t\t\tdataValueA = resolveDataValue(dataValueA);\n\t\t\tdataValueB = resolveDataValue(dataValueB);\n\t\t}\n\t\treturn sortFn.sort(dataValueA, dataValueB, rowA, rowB, columnId);\n\t}, def);\n\treturn sortFn;\n}\n/**\n* Sorts rows with the built-in alphanumeric strategy.\n*\n* This comparator returns ascending-order results; descending order is applied by the sorting row model.\n*/\nconst sortFn_alphanumeric = constructSortFn({\n\tresolveDataValue: (dataValue) => toString(dataValue).toLowerCase(),\n\tsort: (dataValueA, dataValueB) => compareAlphanumeric(dataValueA, dataValueB)\n});\n/**\n* Sorts rows with the built-in alphanumeric case sensitive strategy.\n*\n* This comparator returns ascending-order results; descending order is applied by the sorting row model.\n*/\nconst sortFn_alphanumericCaseSensitive = constructSortFn({\n\tresolveDataValue: (dataValue) => toString(dataValue),\n\tsort: (dataValueA, dataValueB) => compareAlphanumeric(dataValueA, dataValueB)\n});\n/**\n* Sorts rows with the built-in text strategy.\n*\n* This comparator returns ascending-order results; descending order is applied by the sorting row model.\n*/\nconst sortFn_text = constructSortFn({\n\tresolveDataValue: (dataValue) => toString(dataValue).toLowerCase(),\n\tsort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB)\n});\n/**\n* Sorts rows with the built-in text case sensitive strategy.\n*\n* This comparator returns ascending-order results; descending order is applied by the sorting row model.\n*/\nconst sortFn_textCaseSensitive = constructSortFn({\n\tresolveDataValue: (dataValue) => toString(dataValue),\n\tsort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB)\n});\n/**\n* Sorts rows with the built-in datetime strategy.\n*\n* This comparator returns ascending-order results; descending order is applied by the sorting row model.\n*/\nconst sortFn_datetime = constructSortFn({\n\tresolveDataValue: (dataValue) => toDateSortValue(dataValue),\n\tsort: (dataValueA, dataValueB) => dataValueA > dataValueB ? 1 : dataValueA < dataValueB ? -1 : 0\n});\n/**\n* Sorts rows with the built-in basic strategy.\n*\n* This comparator returns ascending-order results; descending order is applied by the sorting row model.\n*/\nconst sortFn_basic = constructSortFn({ sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB) });\nfunction compareBasic(a, b) {\n\treturn a === b ? 0 : a > b ? 1 : -1;\n}\nfunction toDateSortValue(value) {\n\treturn value instanceof Date ? value.getTime() : value;\n}\nfunction toString(a) {\n\tif (typeof a === \"number\") {\n\t\tif (isNaN(a) || a === Infinity || a === -Infinity) return \"\";\n\t\treturn String(a);\n\t}\n\tif (typeof a === \"string\") return a;\n\treturn \"\";\n}\nfunction compareAlphanumeric(aStr, bStr) {\n\tlet ai = 0;\n\tlet bi = 0;\n\tconst aLen = aStr.length;\n\tconst bLen = bStr.length;\n\twhile (ai < aLen && bi < bLen) {\n\t\tconst aIsNumeric = isDigit(aStr.charCodeAt(ai));\n\t\tconst bIsNumeric = isDigit(bStr.charCodeAt(bi));\n\t\tconst aEnd = findChunkEnd(aStr, ai, aIsNumeric);\n\t\tconst bEnd = findChunkEnd(bStr, bi, bIsNumeric);\n\t\tif (!aIsNumeric && !bIsNumeric) {\n\t\t\tconst stringComparison = compareStringChunks(aStr, ai, aEnd, bStr, bi, bEnd);\n\t\t\tif (stringComparison) return stringComparison;\n\t\t\tai = aEnd;\n\t\t\tbi = bEnd;\n\t\t\tcontinue;\n\t\t}\n\t\tif (aIsNumeric !== bIsNumeric) return aIsNumeric ? 1 : -1;\n\t\tconst numericComparison = compareNumericChunks(aStr, ai, aEnd, bStr, bi, bEnd);\n\t\tif (numericComparison) return numericComparison;\n\t\tai = aEnd;\n\t\tbi = bEnd;\n\t}\n\treturn countRemainingChunks(aStr, ai) - countRemainingChunks(bStr, bi);\n}\nfunction isDigit(charCode) {\n\treturn charCode >= 48 && charCode <= 57;\n}\nfunction findChunkEnd(str, start, isNumeric) {\n\tlet end = start + 1;\n\twhile (end < str.length && isDigit(str.charCodeAt(end)) === isNumeric) end++;\n\treturn end;\n}\nfunction compareStringChunks(aStr, aStart, aEnd, bStr, bStart, bEnd) {\n\tconst aLength = aEnd - aStart;\n\tconst bLength = bEnd - bStart;\n\tconst minLength = aLength < bLength ? aLength : bLength;\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst aCode = aStr.charCodeAt(aStart + i);\n\t\tconst bCode = bStr.charCodeAt(bStart + i);\n\t\tif (aCode > bCode) return 1;\n\t\tif (bCode > aCode) return -1;\n\t}\n\tif (aLength > bLength) return 1;\n\tif (bLength > aLength) return -1;\n\treturn 0;\n}\nfunction compareNumericChunks(aStr, aStart, aEnd, bStr, bStart, bEnd) {\n\tlet aSignificantStart = aStart;\n\twhile (aSignificantStart < aEnd && aStr.charCodeAt(aSignificantStart) === 48) aSignificantStart++;\n\tlet bSignificantStart = bStart;\n\twhile (bSignificantStart < bEnd && bStr.charCodeAt(bSignificantStart) === 48) bSignificantStart++;\n\tconst aSignificantLength = aEnd - aSignificantStart;\n\tconst bSignificantLength = bEnd - bSignificantStart;\n\tif (aSignificantLength === 0 && bSignificantLength === 0) return 0;\n\tif (aSignificantLength <= 15 && bSignificantLength <= 15) {\n\t\tconst an = parseSmallInt(aStr, aSignificantStart, aEnd);\n\t\tconst bn = parseSmallInt(bStr, bSignificantStart, bEnd);\n\t\tif (an > bn) return 1;\n\t\tif (bn > an) return -1;\n\t\treturn 0;\n\t}\n\tconst an = parseInt(aStr.slice(aStart, aEnd), 10);\n\tconst bn = parseInt(bStr.slice(bStart, bEnd), 10);\n\tif (an > bn) return 1;\n\tif (bn > an) return -1;\n\treturn 0;\n}\nfunction parseSmallInt(str, start, end) {\n\tlet result = 0;\n\tfor (let i = start; i < end; i++) result = result * 10 + str.charCodeAt(i) - 48;\n\treturn result;\n}\nfunction countRemainingChunks(str, start) {\n\tlet count = 0;\n\tlet index = start;\n\twhile (index < str.length) {\n\t\tcount++;\n\t\tindex = findChunkEnd(str, index, isDigit(str.charCodeAt(index)));\n\t}\n\treturn count;\n}\n/**\n* The built-in sorting function registry.\n*\n* Registering this full object opts out of tree-shaking: every built-in\n* sorting function ends up in your bundle. Prefer importing the `sortFn_*`\n* functions you actually use and registering just those in the `sortFns`\n* slot, or passing them directly to the `sortFn` column option.\n*\n* @deprecated Import individual `sortFn_*` functions instead for a smaller\n* bundle. This export still works and is not going away in v9, but built-in\n* name resolution (including `sortFn: 'auto'`) only finds functions you\n* register yourself.\n*/\nconst sortFns = {\n\talphanumeric: sortFn_alphanumeric,\n\talphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n\tbasic: sortFn_basic,\n\tdatetime: sortFn_datetime,\n\ttext: sortFn_text,\n\ttextCaseSensitive: sortFn_textCaseSensitive\n};\n\n//#endregion\nexport { constructSortFn, reSplitAlphaNumeric, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns };","import { callMemoOrStaticFn, cloneState, makeObjectMap, setStateSlice } from \"../../utils.js\";\nimport { table_getVisibleLeafColumns } from \"../column-visibility/columnVisibilityFeature.utils.js\";\nimport { applyCellSelectionBoundsOperations, expandCellSelectionBounds } from \"./cellSelectionGeometry.js\";\n\n//#region src/features/cell-selection/cellSelectionFeature.utils.ts\n/**\n* Creates the default cell selection state.\n*\n* The feature default is an empty selection. Reset APIs use this value when\n* `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const selection = getDefaultCellSelectionState()\n* ```\n*/\nfunction getDefaultCellSelectionState() {\n\treturn [];\n}\n/**\n* Routes a cell selection updater through the table's selection change handler.\n*\n* @example\n* ```ts\n* table_setCellSelection(table, (old) => old.slice(0, -1))\n* ```\n*/\nfunction table_setCellSelection(table, updater) {\n\ttable.options.onCellSelectionChange?.(updater);\n}\n/**\n* Resets `cellSelection` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.cellSelection` when it\n* exists. Passing `true` ignores initial state and resets to an empty selection.\n*\n* @example\n* ```ts\n* table_resetCellSelection(table, true)\n* ```\n*/\nfunction table_resetCellSelection(table, defaultState) {\n\tsetStateSlice(table, \"cellSelection\", defaultState ? getDefaultCellSelectionState() : cloneState(table.initialState.cellSelection) ?? getDefaultCellSelectionState());\n}\n/**\n* Schedules a cell selection reset after `data` changes.\n*\n* Ranges are stored as row and column ids, so without this a data swap would\n* leave a selection pointing at rows that no longer exist, or silently\n* re-select cells whenever new data reuses ids. The reset runs when\n* `autoResetAll` or `autoResetCellSelection` allows it, defaulting to on.\n*\n* Resetting to `initialState.cellSelection` rather than to empty means the\n* first row-model computation is a no-op, matching `table_autoResetExpanded`.\n*\n* @example\n* ```ts\n* table_autoResetCellSelection(table)\n* ```\n*/\nfunction table_autoResetCellSelection(table) {\n\tif (!table.atoms.cellSelection) return;\n\tif (table.options.autoResetAll ?? table.options.autoResetCellSelection ?? true) table._reactivity.schedule(() => table_resetCellSelection(table));\n}\n/**\n* Returns the visible leaf columns in the order their cells actually render.\n*\n* This is deliberately not `getVisibleLeafColumns()`, which is\n* visibility-filtered but *not* pinning-reordered, and not `column_getIndex()`,\n* which indexes that same unpinned list. Cells render start-pinned first, then\n* center, then end (see `row_getVisibleCells`), so indexing a selection in the\n* unpinned order would make a dragged rectangle contiguous in index space but\n* visually scattered the moment a column is pinned.\n*\n* The pinning read is inlined rather than delegated to the column pinning\n* utils so this stays correct when that feature is absent, and so the ordering\n* provably matches `row_getVisibleCells`.\n*/\nfunction getDisplayOrderedColumns(table) {\n\tconst columns = callMemoOrStaticFn(table, \"getVisibleLeafColumns\", table_getVisibleLeafColumns);\n\tconst pinning = table.atoms.columnPinning?.get();\n\tif (!pinning || !pinning.start.length && !pinning.end.length) return columns;\n\tconst byId = makeObjectMap();\n\tfor (let i = 0; i < columns.length; i++) byId[columns[i].id] = columns[i];\n\tconst start = [];\n\tfor (let i = 0; i < pinning.start.length; i++) {\n\t\tconst column = byId[pinning.start[i]];\n\t\tif (column) start.push(column);\n\t}\n\tconst end = [];\n\tfor (let i = 0; i < pinning.end.length; i++) {\n\t\tconst column = byId[pinning.end[i]];\n\t\tif (column) end.push(column);\n\t}\n\tconst center = [];\n\tfor (let i = 0; i < columns.length; i++) {\n\t\tconst column = columns[i];\n\t\tif (!pinning.start.includes(column.id) && !pinning.end.includes(column.id)) center.push(column);\n\t}\n\treturn [\n\t\t...start,\n\t\t...center,\n\t\t...end\n\t];\n}\n/**\n* Builds a column id to render-order index map.\n*\n* Registered by this feature so the lookup stays memoized even when\n* `columnOrderingFeature` is absent, since that feature's `getColumnIndexes`\n* static rebuilds all four maps on every call, which would make per-cell reads\n* O(columns).\n*\n* @example\n* ```ts\n* const index = table_getCellSelectionColumnIndexes(table)[columnId]\n* ```\n*/\nfunction table_getCellSelectionColumnIndexes(table) {\n\tconst columns = getDisplayOrderedColumns(table);\n\tconst indexes = makeObjectMap();\n\tfor (let i = 0; i < columns.length; i++) indexes[columns[i].id] = i;\n\treturn indexes;\n}\nconst EMPTY_MERGE_BOUNDS = [];\nfunction probeCellSpanIndex(table) {\n\treturn table.getCellSpanIndex?.();\n}\n/**\n* Resolves the merged-cell rectangles of the rendered rows into selection's\n* own index space.\n*\n* The span index positions rows by their paginated render order while\n* selection positions them by pre-paginated display order, so each merge is\n* mapped through `row.getDisplayIndex()`. A merge whose rows do not map to a\n* contiguous display range is skipped defensively; it then behaves like\n* unmerged cells instead of corrupting the geometry.\n*\n* Returns an empty array when `cellSpanningFeature` is not registered, which\n* keeps every selection code path identical to the span-unaware behavior.\n*\n* @example\n* ```ts\n* const merges = table_getCellSelectionMergeBounds(table)\n* ```\n*/\nfunction table_getCellSelectionMergeBounds(table) {\n\tconst spanIndex = probeCellSpanIndex(table);\n\tif (!spanIndex) return EMPTY_MERGE_BOUNDS;\n\tconst columnIndexes = callMemoOrStaticFn(table, \"getCellSelectionColumnIndexes\", table_getCellSelectionColumnIndexes);\n\tconst merges = [];\n\tfor (const columnId in spanIndex.rowSpans) {\n\t\tconst columnIndex = columnIndexes[columnId];\n\t\tif (columnIndex === void 0) continue;\n\t\tconst spans = spanIndex.rowSpans[columnId];\n\t\tconst spanColumnIndex = spanIndex.columnIndexes[columnId];\n\t\tfor (let r = 0; r < spans.length; r++) {\n\t\t\tconst span = spans[r];\n\t\t\tif (span <= 1) continue;\n\t\t\tconst startRow = spanIndex.rows[r].getDisplayIndex();\n\t\t\tconst endRow = spanIndex.rows[r + span - 1].getDisplayIndex();\n\t\t\tif (startRow < 0 || endRow - startRow !== span - 1) continue;\n\t\t\tconst colSpan = spanColumnIndex === void 0 ? 1 : Math.max(spanIndex.colSpans[r]?.[spanColumnIndex] ?? 1, 1);\n\t\t\tmerges.push({\n\t\t\t\tminRowIndex: startRow,\n\t\t\t\tmaxRowIndex: endRow,\n\t\t\t\tminColumnIndex: columnIndex,\n\t\t\t\tmaxColumnIndex: columnIndex + colSpan - 1\n\t\t\t});\n\t\t}\n\t}\n\tif (spanIndex.colSpans.length) {\n\t\tconst columnIdBySpanIndex = [];\n\t\tfor (const columnId in spanIndex.columnIndexes) columnIdBySpanIndex[spanIndex.columnIndexes[columnId]] = columnId;\n\t\tfor (let r = 0; r < spanIndex.colSpans.length; r++) {\n\t\t\tconst rowColSpans = spanIndex.colSpans[r];\n\t\t\tif (!rowColSpans) continue;\n\t\t\tconst displayRow = spanIndex.rows[r]?.getDisplayIndex() ?? -1;\n\t\t\tif (displayRow < 0) continue;\n\t\t\tfor (let c = 0; c < rowColSpans.length; c++) {\n\t\t\t\tconst span = rowColSpans[c];\n\t\t\t\tif (span <= 1) continue;\n\t\t\t\tconst columnId = columnIdBySpanIndex[c];\n\t\t\t\tif (columnId === void 0) continue;\n\t\t\t\tconst vertical = spanIndex.rowSpans[columnId];\n\t\t\t\tif (vertical && vertical[r] !== 1) continue;\n\t\t\t\tconst columnIndex = columnIndexes[columnId];\n\t\t\t\tif (columnIndex === void 0) continue;\n\t\t\t\tmerges.push({\n\t\t\t\t\tminRowIndex: displayRow,\n\t\t\t\t\tmaxRowIndex: displayRow,\n\t\t\t\t\tminColumnIndex: columnIndex,\n\t\t\t\t\tmaxColumnIndex: columnIndex + span - 1\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\treturn merges;\n}\nfunction findMergeBoundsAt(merges, rowIndex, columnIndex) {\n\tfor (let i = 0; i < merges.length; i++) {\n\t\tconst merge = merges[i];\n\t\tif (rowIndex >= merge.minRowIndex && rowIndex <= merge.maxRowIndex && columnIndex >= merge.minColumnIndex && columnIndex <= merge.maxColumnIndex) return merge;\n\t}\n}\n/**\n* Resolves a row id to its display-order index, or `-1` when it no longer\n* identifies a row in the current order.\n*\n* Callers must have already called `table.getRowsInDisplayOrder()`, which is\n* what populates the display index cache each row reads.\n*/\nfunction resolveRowIndex(table, rows, rowId) {\n\tconst row = table.getPrePaginatedRowModel().rowsById[rowId] ?? table.getCoreRowModel().rowsById[rowId];\n\tif (!row) return -1;\n\tconst index = row.getDisplayIndex();\n\tif (index < 0 || index >= rows.length || rows[index]?.id !== rowId) return -1;\n\treturn index;\n}\n/**\n* Resolves ordered range operations into disjoint, positive display-order\n* index rectangles.\n*\n* This is the single cache every per-cell read goes through, so index lookups\n* happen once per invalidation rather than once per cell. A range whose corners\n* no longer resolve, for example because its anchor row was filtered out, is\n* omitted rather than clamped, so it contributes nothing while remaining in\n* state and returns intact when the filter clears.\n*\n* @example\n* ```ts\n* const bounds = table_getCellSelectionBounds(table)\n* ```\n*/\nfunction table_getCellSelectionBounds(table) {\n\tconst ranges = table.atoms.cellSelection?.get();\n\tif (!ranges?.length) return [];\n\tconst rows = table.getRowsInDisplayOrder();\n\tconst columnIndexes = callMemoOrStaticFn(table, \"getCellSelectionColumnIndexes\", table_getCellSelectionColumnIndexes);\n\tconst operations = [];\n\tfor (let i = 0; i < ranges.length; i++) {\n\t\tconst range = ranges[i];\n\t\tconst anchorRowIndex = resolveRowIndex(table, rows, range.anchorRowId);\n\t\tconst focusRowIndex = resolveRowIndex(table, rows, range.focusRowId);\n\t\tconst anchorColumnIndex = columnIndexes[range.anchorColumnId] ?? -1;\n\t\tconst focusColumnIndex = columnIndexes[range.focusColumnId] ?? -1;\n\t\tif (anchorRowIndex < 0 || focusRowIndex < 0 || anchorColumnIndex < 0 || focusColumnIndex < 0) continue;\n\t\toperations.push({\n\t\t\tminRowIndex: Math.min(anchorRowIndex, focusRowIndex),\n\t\t\tmaxRowIndex: Math.max(anchorRowIndex, focusRowIndex),\n\t\t\tminColumnIndex: Math.min(anchorColumnIndex, focusColumnIndex),\n\t\t\tmaxColumnIndex: Math.max(anchorColumnIndex, focusColumnIndex),\n\t\t\toperation: range.operation ?? \"include\"\n\t\t});\n\t}\n\tconst merges = callMemoOrStaticFn(table, \"getCellSelectionMergeBounds\", table_getCellSelectionMergeBounds);\n\tif (merges.length) for (let i = 0; i < operations.length; i++) {\n\t\tconst operation = operations[i];\n\t\tconst expanded = expandCellSelectionBounds(operation, merges);\n\t\toperation.minRowIndex = expanded.minRowIndex;\n\t\toperation.maxRowIndex = expanded.maxRowIndex;\n\t\toperation.minColumnIndex = expanded.minColumnIndex;\n\t\toperation.maxColumnIndex = expanded.maxColumnIndex;\n\t}\n\treturn applyCellSelectionBoundsOperations(operations);\n}\n/**\n* Tests whether an index pair falls inside any resolved rectangle.\n*/\nfunction isWithinBounds(bounds, rowIndex, columnIndex) {\n\tfor (let i = 0; i < bounds.length; i++) {\n\t\tconst bound = bounds[i];\n\t\tif (rowIndex >= bound.minRowIndex && rowIndex <= bound.maxRowIndex && columnIndex >= bound.minColumnIndex && columnIndex <= bound.maxColumnIndex) return true;\n\t}\n\treturn false;\n}\n/**\n* Checks whether this cell can currently be selected.\n*\n* A column def opting out with `enableCellSelection: false` wins over the table\n* option, matching how the other per-column enable flags resolve.\n*\n* @example\n* ```ts\n* const canSelect = cell_getCanSelect(cell)\n* ```\n*/\nfunction cell_getCanSelect(cell) {\n\tif (cell.column.columnDef.enableCellSelection === false) return false;\n\tconst enabled = cell.table.options.enableCellSelection;\n\tif (typeof enabled === \"function\") return enabled(cell);\n\treturn enabled ?? true;\n}\n/**\n* Resolves a cell to the coordinates every selection read needs.\n*\n* Shared by `getIsSelected` and `getSelectionEdges` so a render pass resolves\n* each cell once. Resolving in both meant every cell paid for the bounds memo,\n* the display index, and the column index map twice over.\n*\n* Returns `null` when the cell cannot participate in a selection at all.\n*/\nfunction resolveCellPosition(cell) {\n\tconst table = cell.table;\n\tconst bounds = callMemoOrStaticFn(table, \"getCellSelectionBounds\", table_getCellSelectionBounds);\n\tif (!bounds.length) return null;\n\tif (!callMemoOrStaticFn(cell, \"getCanSelect\", cell_getCanSelect)) return null;\n\tconst rowIndex = cell.row.getDisplayIndex();\n\tif (rowIndex < 0) return null;\n\tconst columnIndex = callMemoOrStaticFn(table, \"getCellSelectionColumnIndexes\", table_getCellSelectionColumnIndexes)[cell.column.id] ?? -1;\n\tif (columnIndex < 0) return null;\n\treturn {\n\t\tbounds,\n\t\trowIndex,\n\t\tcolumnIndex\n\t};\n}\n/**\n* Checks whether this cell falls inside the final positive selection.\n*\n* Deliberately not memoized. Registering this through `assignPrototypeAPIs`\n* with `memoDeps` would allocate a memo closure and dependency array per cell,\n* which costs more than the handful of integer comparisons it would save.\n*\n* @example\n* ```ts\n* const isSelected = cell_getIsSelected(cell)\n* ```\n*/\nfunction cell_getIsSelected(cell) {\n\tconst position = resolveCellPosition(cell);\n\tif (!position) return false;\n\treturn isWithinBounds(position.bounds, position.rowIndex, position.columnIndex);\n}\n/**\n* Checks whether this cell is the active cell.\n*\n* @example\n* ```ts\n* const isFocused = cell_getIsFocused(cell)\n* ```\n*/\nfunction cell_getIsFocused(cell) {\n\tconst ranges = cell.table.atoms.cellSelection?.get();\n\tconst active = ranges?.[ranges.length - 1];\n\tif (!active) return false;\n\treturn active.anchorRowId === cell.row.id && active.anchorColumnId === cell.column.id;\n}\n/**\n* Returns `0` for the focused cell and `-1` otherwise, for roving tabindex.\n*\n* @example\n* ```ts\n* const tabIndex = cell_getTabIndex(cell)\n* ```\n*/\nfunction cell_getTabIndex(cell) {\n\treturn callMemoOrStaticFn(cell, \"getIsFocused\", cell_getIsFocused) ? 0 : -1;\n}\n/**\n* Returns which sides of this cell sit on the outer boundary of the selection.\n*\n* A side is an edge when the neighbouring cell in that direction is not itself\n* covered by a range, which is what lets a consumer draw a single outline\n* around an arbitrary union of rectangles.\n*\n* @example\n* ```ts\n* const { top, right, bottom, left } = cell_getSelectionEdges(cell)\n* ```\n*/\nfunction cell_getSelectionEdges(cell) {\n\tconst none = {\n\t\ttop: false,\n\t\tright: false,\n\t\tbottom: false,\n\t\tleft: false\n\t};\n\tconst position = resolveCellPosition(cell);\n\tif (!position) return none;\n\tconst { bounds, rowIndex, columnIndex } = position;\n\tif (!isWithinBounds(bounds, rowIndex, columnIndex)) return none;\n\tconst merges = callMemoOrStaticFn(cell.table, \"getCellSelectionMergeBounds\", table_getCellSelectionMergeBounds);\n\tconst merge = merges.length ? findMergeBoundsAt(merges, rowIndex, columnIndex) : void 0;\n\tif (!merge) return {\n\t\ttop: !isWithinBounds(bounds, rowIndex - 1, columnIndex),\n\t\tright: !isWithinBounds(bounds, rowIndex, columnIndex + 1),\n\t\tbottom: !isWithinBounds(bounds, rowIndex + 1, columnIndex),\n\t\tleft: !isWithinBounds(bounds, rowIndex, columnIndex - 1)\n\t};\n\treturn {\n\t\ttop: isStripOutside(bounds, merge.minRowIndex - 1, merge.minColumnIndex, merge.maxColumnIndex, true),\n\t\tright: isStripOutside(bounds, merge.maxColumnIndex + 1, merge.minRowIndex, merge.maxRowIndex, false),\n\t\tbottom: isStripOutside(bounds, merge.maxRowIndex + 1, merge.minColumnIndex, merge.maxColumnIndex, true),\n\t\tleft: isStripOutside(bounds, merge.minColumnIndex - 1, merge.minRowIndex, merge.maxRowIndex, false)\n\t};\n}\nfunction isStripOutside(bounds, fixedIndex, from, to, fixedIsRow) {\n\tfor (let i = from; i <= to; i++) if (!isWithinBounds(bounds, fixedIsRow ? fixedIndex : i, fixedIsRow ? i : fixedIndex)) return true;\n\treturn false;\n}\n/**\n* Returns the active cell, i.e. the anchor of the most recent operation.\n*\n* Focus is derived rather than stored: in spreadsheet semantics, dragging from\n* A1 to C5 leaves the active cell at A1, so the active range's anchor already\n* is the active cell.\n*\n* @example\n* ```ts\n* const cell = table_getFocusedCell(table)\n* ```\n*/\nfunction table_getFocusedCell(table) {\n\tconst ranges = table.atoms.cellSelection?.get();\n\tconst active = ranges?.[ranges.length - 1];\n\tif (!active) return void 0;\n\treturn (table.getPrePaginatedRowModel().rowsById[active.anchorRowId] ?? table.getCoreRowModel().rowsById[active.anchorRowId])?.getAllCellsByColumnId()[active.anchorColumnId];\n}\n/**\n* Collapses the selection to a single cell at the given coordinates.\n*\n* @example\n* ```ts\n* table_setFocusedCell(table, '3', 'firstName')\n* ```\n*/\nfunction table_setFocusedCell(table, rowId, columnId) {\n\ttable_selectCellRange(table, {\n\t\tanchorRowId: rowId,\n\t\tanchorColumnId: columnId,\n\t\tfocusRowId: rowId,\n\t\tfocusColumnId: columnId\n\t});\n}\n/**\n* Selects a rectangle using replace, include, or exclude semantics.\n*\n* @example\n* ```ts\n* table_selectCellRange(table, range, { mode: 'exclude' })\n* ```\n*/\nfunction table_selectCellRange(table, range, opts) {\n\tconst mode = opts?.mode ?? (opts?.additive ? \"include\" : \"replace\");\n\tconst { operation: _operation, ...coordinates } = range;\n\tconst nextRange = mode === \"exclude\" ? {\n\t\t...coordinates,\n\t\toperation: \"exclude\"\n\t} : coordinates;\n\ttable_setCellSelection(table, (old) => mode === \"replace\" ? [nextRange] : [...old, nextRange]);\n}\n/**\n* Returns the visible leaf columns that permit selection, in display order.\n*\n* A column-level opt-out is enough to exclude a column here; a per-cell\n* predicate is not consulted, since navigation and select-all work in column\n* space rather than cell space.\n*/\nfunction getSelectableColumns(table) {\n\tconst columns = getDisplayOrderedColumns(table);\n\tif (table.options.enableCellSelection === false) return [];\n\treturn columns.filter((column) => column.columnDef.enableCellSelection !== false);\n}\n/**\n* Selects every selectable cell in the table as one range.\n*\n* @example\n* ```ts\n* table_selectAllCells(table)\n* ```\n*/\nfunction table_selectAllCells(table) {\n\tconst rows = table.getRowsInDisplayOrder();\n\tconst columns = getSelectableColumns(table);\n\tif (!rows.length || !columns.length) return;\n\ttable_selectCellRange(table, {\n\t\tanchorRowId: rows[0].id,\n\t\tanchorColumnId: columns[0].id,\n\t\tfocusRowId: rows[rows.length - 1].id,\n\t\tfocusColumnId: columns[columns.length - 1].id\n\t});\n}\n/**\n* Resolves a direction into row and column deltas.\n*/\nfunction getDirectionDelta(direction) {\n\tswitch (direction) {\n\t\tcase \"up\": return {\n\t\t\trowDelta: -1,\n\t\t\tcolumnDelta: 0\n\t\t};\n\t\tcase \"down\": return {\n\t\t\trowDelta: 1,\n\t\t\tcolumnDelta: 0\n\t\t};\n\t\tcase \"left\": return {\n\t\t\trowDelta: 0,\n\t\t\tcolumnDelta: -1\n\t\t};\n\t\tdefault: return {\n\t\t\trowDelta: 0,\n\t\t\tcolumnDelta: 1\n\t\t};\n\t}\n}\n/**\n* Steps one cell in a direction from a starting coordinate.\n*\n* Columns that cannot be selected are skipped over rather than landed on, so\n* arrow navigation never parks on an opted-out column. Returns `null` when the\n* step would leave the grid or find no selectable column.\n*/\nfunction stepCoordinate(table, rowId, columnId, direction) {\n\tconst rows = table.getRowModel().rows;\n\tconst columns = getDisplayOrderedColumns(table);\n\tif (!rows.length || !columns.length) return null;\n\tconst { rowDelta, columnDelta } = getDirectionDelta(direction);\n\tconst rowIndex = rows.findIndex((row) => row.id === rowId);\n\tconst columnIndex = columns.findIndex((column) => column.id === columnId);\n\tif (rowIndex < 0 || columnIndex < 0) return null;\n\tconst merges = callMemoOrStaticFn(table, \"getCellSelectionMergeBounds\", table_getCellSelectionMergeBounds);\n\tlet fromRowIndex = rows[rowIndex].getDisplayIndex();\n\tlet fromColumnIndex = columnIndex;\n\tif (merges.length) {\n\t\tconst startMerge = findMergeBoundsAt(merges, rowIndex, columnIndex);\n\t\tif (startMerge) {\n\t\t\tif (rowDelta > 0) fromRowIndex = startMerge.maxRowIndex;\n\t\t\tif (rowDelta < 0) fromRowIndex = startMerge.minRowIndex;\n\t\t\tif (columnDelta > 0) fromColumnIndex = startMerge.maxColumnIndex;\n\t\t\tif (columnDelta < 0) fromColumnIndex = startMerge.minColumnIndex;\n\t\t}\n\t}\n\tlet nextRowIndex = rowIndex + rowDelta;\n\tif (rowDelta && fromRowIndex !== rows[rowIndex].getDisplayIndex()) {\n\t\tconst edgeRowIndex = rows.findIndex((row) => row.getDisplayIndex() === fromRowIndex);\n\t\tif (edgeRowIndex < 0) return null;\n\t\tnextRowIndex = edgeRowIndex + rowDelta;\n\t}\n\tif (nextRowIndex < 0 || nextRowIndex >= rows.length) return null;\n\tconst selectableColumnIds = new Set(getSelectableColumns(table).map((column) => column.id));\n\tif (!selectableColumnIds.size) return null;\n\tlet nextColumnIndex = fromColumnIndex;\n\tif (columnDelta) do\n\t\tnextColumnIndex += columnDelta;\n\twhile (nextColumnIndex >= 0 && nextColumnIndex < columns.length && !selectableColumnIds.has(columns[nextColumnIndex].id));\n\telse if (!selectableColumnIds.has(columnId)) for (let distance = 1; distance < columns.length; distance++) {\n\t\tconst before = columns[columnIndex - distance];\n\t\tconst after = columns[columnIndex + distance];\n\t\tif (before && selectableColumnIds.has(before.id)) {\n\t\t\tnextColumnIndex = columnIndex - distance;\n\t\t\tbreak;\n\t\t}\n\t\tif (after && selectableColumnIds.has(after.id)) {\n\t\t\tnextColumnIndex = columnIndex + distance;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (nextColumnIndex < 0 || nextColumnIndex >= columns.length || !selectableColumnIds.has(columns[nextColumnIndex].id)) return null;\n\tlet landingRowIndex = nextRowIndex;\n\tlet landingColumnIndex = nextColumnIndex;\n\tif (merges.length) {\n\t\tconst landingMerge = findMergeBoundsAt(merges, rows[nextRowIndex].getDisplayIndex(), nextColumnIndex);\n\t\tif (landingMerge) {\n\t\t\tlandingRowIndex = rows.findIndex((row) => row.getDisplayIndex() === landingMerge.minRowIndex);\n\t\t\tif (landingRowIndex < 0) return null;\n\t\t\tlandingColumnIndex = landingMerge.minColumnIndex;\n\t\t}\n\t}\n\tconst landingRow = rows[landingRowIndex];\n\tconst landingColumn = columns[landingColumnIndex];\n\tif (!landingRow || !landingColumn) return null;\n\treturn {\n\t\trowId: landingRow.id,\n\t\tcolumnId: landingColumn.id\n\t};\n}\n/**\n* Moves the selection one step in a direction, collapsing it to a single cell.\n*\n* With nothing selected, this selects the first selectable cell so keyboard\n* navigation has somewhere to start.\n*\n* @example\n* ```ts\n* table_moveCellSelection(table, 'down')\n* ```\n*/\nfunction table_moveCellSelection(table, direction) {\n\tconst ranges = table.atoms.cellSelection?.get();\n\tconst active = ranges?.[ranges.length - 1];\n\tif (!active) {\n\t\tconst rows = table.getRowModel().rows;\n\t\tconst columns = getSelectableColumns(table);\n\t\tif (!rows.length || !columns.length) return;\n\t\ttable_setFocusedCell(table, rows[0].id, columns[0].id);\n\t\treturn;\n\t}\n\tconst next = stepCoordinate(table, active.anchorRowId, active.anchorColumnId, direction);\n\tif (!next) return;\n\ttable_setFocusedCell(table, next.rowId, next.columnId);\n}\n/**\n* Extends the active range one step in a direction, keeping its anchor fixed.\n*\n* @example\n* ```ts\n* table_extendCellSelection(table, 'right')\n* ```\n*/\nfunction table_extendCellSelection(table, direction) {\n\tconst ranges = table.atoms.cellSelection?.get();\n\tconst active = ranges?.[ranges.length - 1];\n\tif (!active) {\n\t\ttable_moveCellSelection(table, direction);\n\t\treturn;\n\t}\n\tconst next = stepCoordinate(table, active.focusRowId, active.focusColumnId, direction);\n\tif (!next) return;\n\ttable_setCellSelection(table, (old) => {\n\t\tif (!old.length) return old;\n\t\tconst nextRanges = old.slice(0, -1);\n\t\tnextRanges.push({\n\t\t\t...old[old.length - 1],\n\t\t\tfocusRowId: next.rowId,\n\t\t\tfocusColumnId: next.columnId\n\t\t});\n\t\treturn nextRanges;\n\t});\n}\n/**\n* Walks each final positive region, invoking a visitor per selectable cell.\n*\n* Every expansion API shares this so the per-cell enable predicate is applied\n* in exactly one place.\n*/\nfunction forEachSelectedCell(table, visit, skipCovered = false) {\n\tconst bounds = callMemoOrStaticFn(table, \"getCellSelectionBounds\", table_getCellSelectionBounds);\n\tif (!bounds.length) return;\n\tconst rows = table.getRowsInDisplayOrder();\n\tconst columns = getDisplayOrderedColumns(table);\n\tfor (let i = 0; i < bounds.length; i++) {\n\t\tconst bound = bounds[i];\n\t\tfor (let rowIndex = bound.minRowIndex; rowIndex <= bound.maxRowIndex; rowIndex++) {\n\t\t\tconst row = rows[rowIndex];\n\t\t\tif (!row) continue;\n\t\t\tconst cellsByColumnId = row.getAllCellsByColumnId();\n\t\t\tfor (let columnIndex = bound.minColumnIndex; columnIndex <= bound.maxColumnIndex; columnIndex++) {\n\t\t\t\tconst column = columns[columnIndex];\n\t\t\t\tif (!column) continue;\n\t\t\t\tconst cell = cellsByColumnId[column.id];\n\t\t\t\tif (!cell) continue;\n\t\t\t\tif (!callMemoOrStaticFn(cell, \"getCanSelect\", cell_getCanSelect)) continue;\n\t\t\t\tif (skipCovered && cell.getIsCovered?.()) continue;\n\t\t\t\tvisit(cell, i, rowIndex - bound.minRowIndex, columnIndex - bound.minColumnIndex);\n\t\t\t}\n\t\t}\n\t}\n}\n/**\n* Returns the ids of all selected cells, in row-major order.\n*\n* Cells covered by overlapping ranges are returned once, at their first\n* occurrence.\n*\n* @example\n* ```ts\n* const ids = table_getSelectedCellIds(table)\n* ```\n*/\nfunction table_getSelectedCellIds(table) {\n\tconst ids = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tforEachSelectedCell(table, (cell) => {\n\t\tif (seen.has(cell.id)) return;\n\t\tseen.add(cell.id);\n\t\tids.push(cell.id);\n\t}, true);\n\treturn ids;\n}\n/**\n* Returns each final positive region's values as a row-major grid.\n*\n* This is the raw material for clipboard export. Serializing it to text is left\n* to userland, since the delimiter, the null representation, and whether values\n* containing delimiters get quoted are all application decisions.\n*\n* @example\n* ```ts\n* const [firstRange] = table_getSelectedCellRangesData(table)\n* ```\n*/\nfunction table_getSelectedCellRangesData(table) {\n\tconst grids = [];\n\tforEachSelectedCell(table, (cell, rangeIndex, rowOffset) => {\n\t\tconst grid = grids[rangeIndex] ??= [];\n\t\t(grid[rowOffset] ??= []).push(cell.getValue());\n\t});\n\treturn grids;\n}\n/**\n* Returns the number of selected cells.\n*\n* Uses rectangle arithmetic over the normalized, disjoint positive regions.\n* A per-cell `enableCellSelection` predicate requires enumeration.\n*\n* @example\n* ```ts\n* const count = table_getSelectedCellCount(table)\n* ```\n*/\nfunction table_getSelectedCellCount(table) {\n\tif (table.options.enableCellSelection === false) return 0;\n\tconst bounds = callMemoOrStaticFn(table, \"getCellSelectionBounds\", table_getCellSelectionBounds);\n\tif (!bounds.length) return 0;\n\tconst merges = callMemoOrStaticFn(table, \"getCellSelectionMergeBounds\", table_getCellSelectionMergeBounds);\n\tif (typeof table.options.enableCellSelection === \"function\" || merges.length) {\n\t\tconst ids = /* @__PURE__ */ new Set();\n\t\tforEachSelectedCell(table, (cell) => ids.add(cell.id), true);\n\t\treturn ids.size;\n\t}\n\tconst columns = getDisplayOrderedColumns(table);\n\tlet count = 0;\n\tfor (const bound of bounds) {\n\t\tlet selectableColumns = 0;\n\t\tfor (let columnIndex = bound.minColumnIndex; columnIndex <= bound.maxColumnIndex; columnIndex++) {\n\t\t\tconst column = columns[columnIndex];\n\t\t\tif (!column) continue;\n\t\t\tif (column.columnDef.enableCellSelection !== false) selectableColumns++;\n\t\t}\n\t\tcount += (bound.maxRowIndex - bound.minRowIndex + 1) * selectableColumns;\n\t}\n\treturn count;\n}\n/**\n* Returns the ids of all rows intersected by the selection.\n*\n* @example\n* ```ts\n* const rowIds = table_getCellSelectionRowIds(table)\n* ```\n*/\nfunction table_getCellSelectionRowIds(table) {\n\tconst bounds = callMemoOrStaticFn(table, \"getCellSelectionBounds\", table_getCellSelectionBounds);\n\tif (!bounds.length) return [];\n\tconst rows = table.getRowsInDisplayOrder();\n\tconst seen = /* @__PURE__ */ new Set();\n\tconst ids = [];\n\tfor (let i = 0; i < bounds.length; i++) {\n\t\tconst bound = bounds[i];\n\t\tfor (let index = bound.minRowIndex; index <= bound.maxRowIndex; index++) {\n\t\t\tconst row = rows[index];\n\t\t\tif (!row || seen.has(row.id)) continue;\n\t\t\tseen.add(row.id);\n\t\t\tids.push(row.id);\n\t\t}\n\t}\n\treturn ids;\n}\n/**\n* Returns the ids of all columns intersected by the selection.\n*\n* @example\n* ```ts\n* const columnIds = table_getCellSelectionColumnIds(table)\n* ```\n*/\nfunction table_getCellSelectionColumnIds(table) {\n\tconst bounds = callMemoOrStaticFn(table, \"getCellSelectionBounds\", table_getCellSelectionBounds);\n\tif (!bounds.length) return [];\n\tconst columns = getDisplayOrderedColumns(table);\n\tconst seen = /* @__PURE__ */ new Set();\n\tconst ids = [];\n\tfor (let i = 0; i < bounds.length; i++) {\n\t\tconst bound = bounds[i];\n\t\tfor (let index = bound.minColumnIndex; index <= bound.maxColumnIndex; index++) {\n\t\t\tconst column = columns[index];\n\t\t\tif (!column || seen.has(column.id)) continue;\n\t\t\tif (column.columnDef.enableCellSelection === false) continue;\n\t\t\tseen.add(column.id);\n\t\t\tids.push(column.id);\n\t\t}\n\t}\n\treturn ids;\n}\n/**\n* Creates a handler that begins a selection at this cell.\n*\n* Follows `header_getResizeHandler`: the enable check is resolved once outside\n* the returned closure and guarded again inside it, the document is injectable\n* for SSR and cross-document rendering, and the document-level `mouseup`\n* listener is attached here so a drag released outside the table still ends.\n*\n* @example\n* ```tsx\n* <td onMouseDown={cell.getSelectionStartHandler()} />\n* ```\n*/\nfunction cell_getSelectionStartHandler(cell, _contextDocument) {\n\tconst canSelect = cell_getCanSelect(cell);\n\treturn (e) => {\n\t\tif (!canSelect) return;\n\t\tconst table = cell.table;\n\t\tconst options = table.options;\n\t\tconst contextDocument = _contextDocument ?? (typeof document !== \"undefined\" ? document : null);\n\t\tconst isRangeEvent = options.enableCellRangeSelection !== false && (options.isCellRangeSelectionEvent?.(e) ?? false);\n\t\tconst isMultiRangeEvent = options.enableMultiCellRangeSelection !== false && (options.isMultiCellRangeSelectionEvent?.(e) ?? false);\n\t\tif (options.enableCellSelectionDrag !== false && options.enableCellRangeSelection !== false && contextDocument) {\n\t\t\ttable._isSelectingCells = true;\n\t\t\tconst upHandler = () => {\n\t\t\t\tcontextDocument.removeEventListener(\"mouseup\", upHandler);\n\t\t\t\ttable._isSelectingCells = false;\n\t\t\t};\n\t\t\tcontextDocument.addEventListener(\"mouseup\", upHandler);\n\t\t}\n\t\tconst rowId = cell.row.id;\n\t\tconst columnId = cell.column.id;\n\t\tconst shouldExclude = isMultiRangeEvent && callMemoOrStaticFn(cell, \"getIsSelected\", cell_getIsSelected);\n\t\ttable_setCellSelection(table, (old) => {\n\t\t\tconst active = old[old.length - 1];\n\t\t\tif (isRangeEvent && active) {\n\t\t\t\tconst ranges = old.slice(0, -1);\n\t\t\t\tranges.push({\n\t\t\t\t\t...active,\n\t\t\t\t\tfocusRowId: rowId,\n\t\t\t\t\tfocusColumnId: columnId\n\t\t\t\t});\n\t\t\t\treturn ranges;\n\t\t\t}\n\t\t\tconst range = {\n\t\t\t\tanchorRowId: rowId,\n\t\t\t\tanchorColumnId: columnId,\n\t\t\t\tfocusRowId: rowId,\n\t\t\t\tfocusColumnId: columnId,\n\t\t\t\t...shouldExclude ? { operation: \"exclude\" } : {}\n\t\t\t};\n\t\t\treturn isMultiRangeEvent ? [...old, range] : [range];\n\t\t});\n\t};\n}\n/**\n* Creates a handler that extends the active range to this cell during a drag.\n*\n* No rAF coalescing is needed here, unlike the resize handler: `mouseenter`\n* fires once per cell boundary crossed rather than continuously, and deferring\n* it by a frame would only delay the highlight.\n*\n* @example\n* ```tsx\n* <td onMouseEnter={cell.getSelectionExtendHandler()} />\n* ```\n*/\nfunction cell_getSelectionExtendHandler(cell) {\n\tconst canSelect = cell_getCanSelect(cell);\n\treturn (_e) => {\n\t\tif (!canSelect) return;\n\t\tconst table = cell.table;\n\t\tif (!table._isSelectingCells) return;\n\t\tconst ranges = table.atoms.cellSelection?.get();\n\t\tconst active = ranges?.[ranges.length - 1];\n\t\tif (!active) return;\n\t\tconst rowId = cell.row.id;\n\t\tconst columnId = cell.column.id;\n\t\tif (active.focusRowId === rowId && active.focusColumnId === columnId) return;\n\t\ttable_setCellSelection(table, (old) => {\n\t\t\tif (!old.length) return old;\n\t\t\tconst next = old.slice(0, -1);\n\t\t\tnext.push({\n\t\t\t\t...old[old.length - 1],\n\t\t\t\tfocusRowId: rowId,\n\t\t\t\tfocusColumnId: columnId\n\t\t\t});\n\t\t\treturn next;\n\t\t});\n\t};\n}\n\n//#endregion\nexport { cell_getCanSelect, cell_getIsFocused, cell_getIsSelected, cell_getSelectionEdges, cell_getSelectionExtendHandler, cell_getSelectionStartHandler, cell_getTabIndex, getDefaultCellSelectionState, table_autoResetCellSelection, table_extendCellSelection, table_getCellSelectionBounds, table_getCellSelectionColumnIds, table_getCellSelectionColumnIndexes, table_getCellSelectionMergeBounds, table_getCellSelectionRowIds, table_getFocusedCell, table_getSelectedCellCount, table_getSelectedCellIds, table_getSelectedCellRangesData, table_moveCellSelection, table_resetCellSelection, table_selectAllCells, table_selectCellRange, table_setCellSelection, table_setFocusedCell };","import { cloneState, hasOwn, makeObjectMap, setStateSlice } from \"../../utils.js\";\n\n//#region src/features/row-expanding/rowExpandingFeature.utils.ts\n/**\n* Creates the default expanded state.\n*\n* The feature default is an empty map, meaning no rows are expanded. Reset APIs\n* use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const expanded = getDefaultExpandedState()\n* ```\n*/\nfunction getDefaultExpandedState() {\n\treturn makeObjectMap();\n}\n/**\n* Schedules an expanded-state reset after row-structure changes.\n*\n* The reset runs when `autoResetAll`, `autoResetExpanded`, or the default\n* client-side expanding behavior allows it. Manual expanding opts out unless\n* the reset options explicitly opt back in.\n*\n* @example\n* ```ts\n* table_autoResetExpanded(table)\n* ```\n*/\nfunction table_autoResetExpanded(table) {\n\tif (!table.atoms.expanded) return;\n\tif (table.options.autoResetAll ?? table.options.autoResetExpanded ?? !table.options.manualExpanding) table._reactivity.schedule(() => table_resetExpanded(table));\n}\n/**\n* Routes an expanded-state updater through the table's expanded change handler.\n*\n* The updater may be `true`, a row-id map, or a function of the previous\n* expanded state, matching the instance `table.setExpanded` behavior.\n*\n* @example\n* ```ts\n* table_setExpanded(table, (old) => ({ ...old, [rowId]: true }))\n* ```\n*/\nfunction table_setExpanded(table, updater) {\n\ttable.options.onExpandedChange?.(updater);\n}\n/**\n* Expands or collapses every row.\n*\n* Passing `true` stores the special expanded-all state. Passing `false` stores\n* an empty map. Omitting the value toggles based on whether all rows are\n* currently expanded.\n*\n* The call is a no-op (no `onExpandedChange`) when no row can expand or when\n* the requested state matches the current state exactly.\n*\n* @example\n* ```ts\n* table_toggleAllRowsExpanded(table)\n* ```\n*/\nfunction table_toggleAllRowsExpanded(table, expanded) {\n\tconst currentExpanded = table.atoms.expanded?.get() ?? {};\n\tif (expanded ?? !table_getIsAllRowsExpanded(table)) {\n\t\tif (currentExpanded === true) return;\n\t\tif (!table_getCanSomeRowsExpand(table)) return;\n\t\ttable_setExpanded(table, true);\n\t} else {\n\t\tif (currentExpanded !== true && !Object.keys(currentExpanded).length) return;\n\t\ttable_setExpanded(table, makeObjectMap());\n\t}\n}\n/**\n* Resets `expanded` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.expanded` when it\n* exists. Passing `true` ignores initial state and resets to `{}`.\n*\n* @example\n* ```ts\n* table_resetExpanded(table)\n* table_resetExpanded(table, true)\n* ```\n*/\nfunction table_resetExpanded(table, defaultState) {\n\tconst initialExpanded = table.initialState.expanded;\n\tsetStateSlice(table, \"expanded\", defaultState ? makeObjectMap() : initialExpanded === true ? true : Object.assign(makeObjectMap(), cloneState(initialExpanded ?? {})));\n}\n/**\n* Checks whether at least one pre-paginated row can expand.\n*\n* Pagination is intentionally ignored so controls can reflect expandable rows\n* that may not be on the current page.\n*\n* @example\n* ```ts\n* const canExpand = table_getCanSomeRowsExpand(table)\n* ```\n*/\nfunction table_getCanSomeRowsExpand(table) {\n\treturn table.getPrePaginatedRowModel().flatRows.some((row) => row_getCanExpand(row));\n}\n/**\n* Creates an event handler that toggles all rows expanded.\n*\n* @example\n* ```ts\n* const onClick = table_getToggleAllRowsExpandedHandler(table)\n* ```\n*/\nfunction table_getToggleAllRowsExpandedHandler(table) {\n\treturn (_e) => {\n\t\ttable_toggleAllRowsExpanded(table);\n\t};\n}\n/**\n* Checks whether any row is expanded.\n*\n* The special expanded-all value `true` counts as some rows expanded.\n*\n* @example\n* ```ts\n* const someExpanded = table_getIsSomeRowsExpanded(table)\n* ```\n*/\nfunction table_getIsSomeRowsExpanded(table) {\n\tconst expanded = table.atoms.expanded?.get() ?? {};\n\treturn expanded === true || Object.values(expanded).some(Boolean);\n}\n/**\n* Checks whether every expandable row in the current row model is expanded.\n*\n* The special expanded-all value `true` returns true immediately. Empty\n* expanded state returns false. Rows that cannot expand are ignored, so a\n* materialized expanded-all map (which only contains expandable row ids)\n* still counts as all rows expanded.\n*\n* @example\n* ```ts\n* const allExpanded = table_getIsAllRowsExpanded(table)\n* ```\n*/\nfunction table_getIsAllRowsExpanded(table) {\n\tconst expanded = table.atoms.expanded?.get() ?? {};\n\tif (expanded === true) return true;\n\tif (!Object.keys(expanded).length) return false;\n\tconst expandableRows = table.getRowModel().flatRows.filter((row) => row_getCanExpand(row));\n\tif (!expandableRows.length) return false;\n\tif (expandableRows.some((row) => !row_getIsExpanded(row))) return false;\n\treturn true;\n}\n/**\n* Computes the deepest expanded row id depth.\n*\n* Row ids are split on `.`; expanded-all state scans the current row model's\n* expandable rows, while explicit expanded state scans its expanded id keys.\n*\n* @example\n* ```ts\n* const depth = table_getExpandedDepth(table)\n* ```\n*/\nfunction table_getExpandedDepth(table) {\n\tlet maxDepth = 0;\n\tconst expanded = table.atoms.expanded?.get();\n\t(expanded === true ? Object.values(table.getRowModel().rowsById).filter((row) => row_getCanExpand(row)).map((row) => row.id) : Object.keys(expanded ?? {})).forEach((id) => {\n\t\tconst splitId = id.split(\".\");\n\t\tmaxDepth = Math.max(maxDepth, splitId.length);\n\t});\n\treturn maxDepth;\n}\n/**\n* Expands or collapses this row.\n*\n* Omitting `expanded` toggles the row. If the current state is expanded-all,\n* the function first materializes that state into a row-id map (containing\n* only expandable row ids) before applying the row-specific change.\n*\n* The call is a no-op (no `onExpandedChange`) when the requested state matches\n* the current state, or when expanding a row that cannot expand. Collapsing is\n* always allowed so stale expanded ids can be cleaned up.\n*\n* @example\n* ```ts\n* row_toggleExpanded(row)\n* ```\n*/\nfunction row_toggleExpanded(row, expanded) {\n\tconst currentExpanded = row.table.atoms.expanded?.get() ?? {};\n\tconst currentExists = currentExpanded === true || isExpandedRowId(currentExpanded, row.id);\n\tconst targetExpanded = expanded ?? !currentExists;\n\tif (targetExpanded === currentExists) return;\n\tif (targetExpanded && !row_getCanExpand(row)) return;\n\ttable_setExpanded(row.table, (old) => {\n\t\tconst exists = old === true ? true : isExpandedRowId(old, row.id);\n\t\tlet oldExpanded = makeObjectMap();\n\t\tif (old === true) Object.values(row.table.getRowModel().rowsById).forEach((rowModelRow) => {\n\t\t\tif (row_getCanExpand(rowModelRow)) oldExpanded[rowModelRow.id] = true;\n\t\t});\n\t\telse oldExpanded = Object.assign(makeObjectMap(), old);\n\t\tif (!exists && targetExpanded) {\n\t\t\toldExpanded[row.id] = true;\n\t\t\treturn oldExpanded;\n\t\t}\n\t\tif (exists && !targetExpanded) {\n\t\t\tconst rest = makeObjectMap();\n\t\t\tconst rowIds = Object.keys(oldExpanded);\n\t\t\tfor (let i = 0; i < rowIds.length; i++) {\n\t\t\t\tconst rowId = rowIds[i];\n\t\t\t\tif (rowId !== row.id && oldExpanded[rowId]) rest[rowId] = true;\n\t\t\t}\n\t\t\treturn rest;\n\t\t}\n\t\treturn old;\n\t});\n}\n/**\n* Checks whether this row is expanded.\n*\n* `options.getIsRowExpanded` can override state-derived behavior. Otherwise\n* the row is expanded when expanded state is `true` or contains this row id.\n*\n* @example\n* ```ts\n* const expanded = row_getIsExpanded(row)\n* ```\n*/\nfunction row_getIsExpanded(row) {\n\tconst expanded = row.table.atoms.expanded?.get() ?? {};\n\treturn !!(row.table.options.getIsRowExpanded?.(row) ?? (expanded === true || isExpandedRowId(expanded, row.id)));\n}\nfunction isExpandedRowId(expanded, rowId) {\n\treturn !!(expanded && expanded !== true && hasOwn(expanded, rowId) && expanded[rowId]);\n}\n/**\n* Checks whether this row can be expanded.\n*\n* `options.getRowCanExpand` wins when provided. Otherwise rows can expand when\n* expanding is enabled and the row has subRows.\n*\n* @example\n* ```ts\n* const canExpand = row_getCanExpand(row)\n* ```\n*/\nfunction row_getCanExpand(row) {\n\treturn row.table.options.getRowCanExpand?.(row) ?? ((row.table.options.enableExpanding ?? true) && !!row.subRows.length);\n}\n/**\n* Checks whether every ancestor of this row is expanded.\n*\n* The current row is not considered; only its parent chain is walked.\n*\n* @example\n* ```ts\n* const parentsExpanded = row_getIsAllParentsExpanded(row)\n* ```\n*/\nfunction row_getIsAllParentsExpanded(row) {\n\tlet isFullyExpanded = true;\n\tlet currentRow = row;\n\twhile (isFullyExpanded && currentRow.parentId) {\n\t\tcurrentRow = row.table.getRow(currentRow.parentId, true);\n\t\tisFullyExpanded = row_getIsExpanded(currentRow);\n\t}\n\treturn isFullyExpanded;\n}\n/**\n* Creates a row control handler that toggles this row's expanded state.\n*\n* The handler is a no-op when the row cannot expand.\n*\n* @example\n* ```ts\n* const onClick = row_getToggleExpandedHandler(row)\n* ```\n*/\nfunction row_getToggleExpandedHandler(row) {\n\tconst canExpand = row_getCanExpand(row);\n\treturn () => {\n\t\tif (!canExpand) return;\n\t\trow_toggleExpanded(row);\n\t};\n}\n\n//#endregion\nexport { getDefaultExpandedState, row_getCanExpand, row_getIsAllParentsExpanded, row_getIsExpanded, row_getToggleExpandedHandler, row_toggleExpanded, table_autoResetExpanded, table_getCanSomeRowsExpand, table_getExpandedDepth, table_getIsAllRowsExpanded, table_getIsSomeRowsExpanded, table_getToggleAllRowsExpandedHandler, table_resetExpanded, table_setExpanded, table_toggleAllRowsExpanded };","import { cloneState, functionalUpdate, setStateSlice } from \"../../utils.js\";\n\n//#region src/features/row-pagination/rowPaginationFeature.utils.ts\nconst defaultPageIndex = 0;\nconst defaultPageSize = 10;\n/**\n* Creates the default pagination state used by the pagination feature.\n*\n* The feature default starts at the first page with a page size of 10. Reset\n* APIs use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const pagination = getDefaultPaginationState()\n* ```\n*/\nfunction getDefaultPaginationState() {\n\treturn {\n\t\tpageIndex: defaultPageIndex,\n\t\tpageSize: defaultPageSize\n\t};\n}\n/**\n* Resets the page index when a page-altering change should return to page 0.\n*\n* The reset runs when `autoResetAll`, `autoResetPageIndex`, or the default\n* client-side pagination behavior allows it. Manual pagination opts out unless\n* the reset options explicitly opt back in.\n*\n* @example\n* ```ts\n* table_autoResetPageIndex(table)\n* ```\n*/\nfunction table_autoResetPageIndex(table) {\n\tif (table.options.autoResetAll ?? table.options.autoResetPageIndex ?? !table.options.manualPagination) {\n\t\tif ((table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex) === defaultPageIndex) return;\n\t\ttable_resetPageIndex(table, true);\n\t}\n}\n/**\n* Routes a pagination updater through the table's pagination change handler.\n*\n* The updater may be a next state object or a function of the previous\n* `PaginationState`; controlled state and external atoms observe the same\n* updater path as the instance API.\n*\n* @example\n* ```ts\n* table_setPagination(table, (old) => old)\n* ```\n*/\nfunction table_setPagination(table, updater) {\n\tsetStateSlice(table, \"pagination\", updater);\n}\n/**\n* Resets `pagination` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.pagination` when it\n* exists. Passing `true` ignores initial state and resets to\n* `{ pageIndex: 0, pageSize: 10 }`.\n*\n* @example\n* ```ts\n* table_resetPagination(table)\n* table_resetPagination(table, true)\n* ```\n*/\nfunction table_resetPagination(table, defaultState) {\n\ttable_setPagination(table, defaultState ? getDefaultPaginationState() : cloneState(table.initialState.pagination ?? getDefaultPaginationState()));\n}\n/**\n* Updates `pagination.pageIndex` and clamps it to the known page range.\n*\n* Unknown page counts (`undefined` or `-1`) allow any non-negative page index.\n* Known page counts clamp the index between `0` and `pageCount - 1`.\n*\n* @example\n* ```ts\n* table_setPageIndex(table, (old) => old)\n* ```\n*/\nfunction table_setPageIndex(table, updater) {\n\ttable_setPagination(table, (old) => {\n\t\tlet pageIndex = functionalUpdate(updater, old.pageIndex);\n\t\tconst maxPageIndex = typeof table.options.pageCount === \"undefined\" || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;\n\t\tpageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));\n\t\treturn {\n\t\t\t...old,\n\t\t\tpageIndex\n\t\t};\n\t});\n}\n/**\n* Resets only `pagination.pageIndex`.\n*\n* With no argument, the reset uses `table.initialState.pagination?.pageIndex`\n* or `0`. Passing `true` always resets the page index to `0`.\n*\n* @example\n* ```ts\n* table_resetPageIndex(table)\n* table_resetPageIndex(table, true)\n* ```\n*/\nfunction table_resetPageIndex(table, defaultState) {\n\ttable_setPageIndex(table, defaultState ? defaultPageIndex : table.initialState.pagination?.pageIndex ?? defaultPageIndex);\n}\n/**\n* Resets only `pagination.pageSize`.\n*\n* With no argument, the reset uses `table.initialState.pagination?.pageSize`\n* or `10`. Passing `true` always resets the page size to `10`.\n*\n* @example\n* ```ts\n* table_resetPageSize(table)\n* table_resetPageSize(table, true)\n* ```\n*/\nfunction table_resetPageSize(table, defaultState) {\n\ttable_setPageSize(table, defaultState ? defaultPageSize : table.initialState.pagination?.pageSize ?? defaultPageSize);\n}\n/**\n* Updates `pagination.pageSize` while preserving the current top row.\n*\n* The new size is clamped to at least `1`, and `pageIndex` is recalculated so\n* the row that was previously at the top of the page remains in view.\n*\n* @example\n* ```ts\n* table_setPageSize(table, (old) => old)\n* ```\n*/\nfunction table_setPageSize(table, updater) {\n\ttable_setPagination(table, (old) => {\n\t\tconst pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));\n\t\tconst topRowIndex = old.pageSize === Infinity ? 0 : old.pageSize * old.pageIndex;\n\t\tconst pageIndex = pageSize === Infinity ? 0 : Math.floor(topRowIndex / pageSize);\n\t\treturn {\n\t\t\t...old,\n\t\t\tpageIndex,\n\t\t\tpageSize\n\t\t};\n\t});\n}\n/**\n* Builds the zero-based page indexes available for the current page count.\n*\n* Unknown or empty page counts return an empty array; otherwise the result is\n* `[0, 1, ...pageCount - 1]`.\n*\n* @example\n* ```ts\n* const pageIndexes = table_getPageOptions(table)\n* ```\n*/\nfunction table_getPageOptions(table) {\n\tconst pageCount = table_getPageCount(table);\n\tlet pageOptions = [];\n\tif (pageCount && pageCount > 0) pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);\n\treturn pageOptions;\n}\n/**\n* Checks whether the current page index can move backward.\n*\n* The first page is page index `0`, so only positive page indexes can navigate\n* to a previous page.\n*\n* @example\n* ```ts\n* const canGoBack = table_getCanPreviousPage(table)\n* ```\n*/\nfunction table_getCanPreviousPage(table) {\n\treturn (table.atoms.pagination?.get()?.pageIndex ?? 0) > 0;\n}\n/**\n* Checks whether the current page index can move forward.\n*\n* A `pageCount` of `-1` means the caller does not know the total page count, so\n* this returns `true`. A page count of `0` returns `false`.\n*\n* @example\n* ```ts\n* const canGoForward = table_getCanNextPage(table)\n* ```\n*/\nfunction table_getCanNextPage(table) {\n\tconst pageIndex = table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex;\n\tconst pageCount = table_getPageCount(table);\n\tif (pageCount === -1) return true;\n\tif (pageCount === 0) return false;\n\treturn pageIndex < pageCount - 1;\n}\n/**\n* Checks whether a known, finite last page exists after the current page.\n*\n* Unknown (`-1`), empty, and non-finite page counts do not have a navigable\n* last page.\n*\n* @example\n* ```ts\n* const canGoToLastPage = table_getCanLastPage(table)\n* ```\n*/\nfunction table_getCanLastPage(table) {\n\tconst pageIndex = table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex;\n\tconst pageCount = table_getPageCount(table);\n\treturn Number.isFinite(pageCount) && pageCount > 0 && pageIndex < pageCount - 1;\n}\n/**\n* Moves the table to the previous page.\n*\n* This delegates to `table_setPageIndex` so pagination state ownership and\n* updater semantics remain consistent.\n*\n* @example\n* ```ts\n* table_previousPage(table)\n* ```\n*/\nfunction table_previousPage(table) {\n\treturn table_setPageIndex(table, (old) => old - 1);\n}\n/**\n* Moves the table to the next page.\n*\n* This delegates to `table_setPageIndex` so pagination state ownership and\n* updater semantics remain consistent.\n*\n* @example\n* ```ts\n* table_nextPage(table)\n* ```\n*/\nfunction table_nextPage(table) {\n\treturn table_setPageIndex(table, (old) => {\n\t\treturn old + 1;\n\t});\n}\n/**\n* Moves the table to the first page.\n*\n* This is a convenience wrapper around `table_setPageIndex(table, 0)`.\n*\n* @example\n* ```ts\n* table_firstPage(table)\n* ```\n*/\nfunction table_firstPage(table) {\n\treturn table_setPageIndex(table, 0);\n}\n/**\n* Moves the table to the last known page.\n*\n* Unknown, empty, and non-finite page counts do not have a navigable last\n* page, so this does nothing for those states.\n*\n* @example\n* ```ts\n* table_lastPage(table)\n* ```\n*/\nfunction table_lastPage(table) {\n\tconst pageCount = table_getPageCount(table);\n\tif (!Number.isFinite(pageCount) || pageCount <= 0) return;\n\treturn table_setPageIndex(table, pageCount - 1);\n}\n/**\n* Resolves the number of pages for the current pagination state.\n*\n* `options.pageCount` wins for manual pagination. Otherwise the value is\n* calculated from `table_getRowCount(table)` and the current `pageSize`.\n*\n* @example\n* ```ts\n* const pages = table_getPageCount(table)\n* ```\n*/\nfunction table_getPageCount(table) {\n\tconst configuredPageCount = table.options.pageCount;\n\tif (configuredPageCount != null) return configuredPageCount;\n\tconst rowCount = table_getRowCount(table);\n\tconst pageSize = table.atoms.pagination?.get()?.pageSize ?? defaultPageSize;\n\tif (pageSize === Infinity && Number.isFinite(rowCount) && rowCount > 0) return 1;\n\treturn Math.ceil(rowCount / pageSize);\n}\n/**\n* Resolves the total row count used for pagination math.\n*\n* `options.rowCount` wins for manual pagination. Otherwise the count comes\n* from the pre-paginated row model so filtering, grouping, sorting, and\n* expansion are reflected before the page slice is applied.\n*\n* @example\n* ```ts\n* const rows = table_getRowCount(table)\n* ```\n*/\nfunction table_getRowCount(table) {\n\treturn table.options.rowCount ?? table.getPrePaginatedRowModel().rows.length;\n}\n\n//#endregion\nexport { getDefaultPaginationState, table_autoResetPageIndex, table_firstPage, table_getCanLastPage, table_getCanNextPage, table_getCanPreviousPage, table_getPageCount, table_getPageOptions, table_getRowCount, table_lastPage, table_nextPage, table_previousPage, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_setPageIndex, table_setPageSize, table_setPagination };","import { cloneState, isFunction, setStateSlice } from \"../../utils.js\";\nimport { reSplitAlphaNumeric, sortFn_basic } from \"./sortFns.js\";\n\n//#region src/features/row-sorting/rowSortingFeature.utils.ts\n/**\n* Creates the default sorting state.\n*\n* The feature default is an empty array, meaning no columns are sorted. Reset\n* APIs use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const sorting = getDefaultSortingState()\n* ```\n*/\nfunction getDefaultSortingState() {\n\treturn [];\n}\n/**\n* Routes a sorting updater through the table's sorting change handler.\n*\n* The updater may be a next `SortingState` array or a function of the previous\n* sorting state, matching the instance `table.setSorting` behavior. State\n* owners receive an equality-guarded updater so structurally equal sorting\n* values preserve the owner's existing reference.\n*\n* @example\n* ```ts\n* table_setSorting(table, (old) => [...old, { id: 'age', desc: true }])\n* ```\n*/\nfunction table_setSorting(table, updater) {\n\tsetStateSlice(table, \"sorting\", updater);\n}\n/**\n* Resets `sorting` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.sorting` when it\n* exists. Passing `true` ignores initial state and resets to `[]`.\n*\n* @example\n* ```ts\n* table_resetSorting(table)\n* table_resetSorting(table, true)\n* ```\n*/\nfunction table_resetSorting(table, defaultState) {\n\ttable_setSorting(table, defaultState ? [] : cloneState(table.initialState.sorting ?? []));\n}\n/**\n* Resets sorting after the table data changes when explicitly enabled.\n*\n* Unlike other auto-reset behaviors, sorting is preserved by default. An\n* explicit `autoResetAll` value takes precedence over `autoResetSorting`.\n*\n* @example\n* ```ts\n* table_autoResetSorting(table)\n* ```\n*/\nfunction table_autoResetSorting(table) {\n\tif (!table.atoms.sorting) return;\n\tif (table.options.autoResetAll ?? table.options.autoResetSorting ?? false) table_resetSorting(table);\n}\n/**\n* Chooses a built-in sorting function from sampled filtered row values.\n*\n* Date-like values use `datetime`, mixed text/numeric strings use\n* `alphanumeric`, plain strings use `text`, and unknown values fall back to\n* `basic`.\n*\n* @example\n* ```ts\n* const sortFn = column_getAutoSortFn(column)\n* ```\n*/\nfunction column_getAutoSortFn(column) {\n\tconst sortFns = column.table._rowModelFns.sortFns;\n\tconst firstRows = column.table.getFilteredRowModel().flatRows.slice(0, 10);\n\tlet sortFnName;\n\tlet isString = false;\n\tfor (let i = 0; i < firstRows.length; i++) {\n\t\tconst value = firstRows[i].getValue(column.id);\n\t\tif (Object.prototype.toString.call(value) === \"[object Date]\") {\n\t\t\tsortFnName = \"datetime\";\n\t\t\tbreak;\n\t\t}\n\t\tif (typeof value === \"string\") {\n\t\t\tisString = true;\n\t\t\tif (value.split(reSplitAlphaNumeric).length > 1) {\n\t\t\t\tsortFnName = \"alphanumeric\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!sortFnName && isString) sortFnName = \"text\";\n\tif (sortFnName) {\n\t\tlet sortFn = sortFns?.[sortFnName];\n\t\tif (!sortFn) {\n\t\t\tif (process.env.NODE_ENV === \"development\") console.warn(`sortFn '${sortFnName}' (auto) for column '${column.id}' is not registered`);\n\t\t\tif (sortFnName === \"alphanumeric\") sortFn = sortFns?.text;\n\t\t}\n\t\tif (sortFn) return sortFn;\n\t}\n\treturn sortFn_basic;\n}\n/**\n* Chooses the default first sort direction from sampled filtered row values.\n*\n* The first non-nullish value among the sampled rows decides: string columns\n* start ascending so alphabetical order is natural; other value types (or\n* columns with no non-nullish sample) start descending. Sampling past leading\n* nullish values keeps the toggle cycle stable when sorting or a data swap\n* moves an empty value into the first row.\n*\n* @example\n* ```ts\n* const direction = column_getAutoSortDir(column)\n* ```\n*/\nfunction column_getAutoSortDir(column) {\n\tconst firstRows = column.table.getFilteredRowModel().flatRows.slice(0, 10);\n\tfor (let i = 0; i < firstRows.length; i++) {\n\t\tconst value = firstRows[i].getValue(column.id);\n\t\tif (value == null) continue;\n\t\treturn typeof value === \"string\" ? \"asc\" : \"desc\";\n\t}\n\treturn \"desc\";\n}\n/**\n* Resolves the sorting function configured for a column.\n*\n* Function-valued `columnDef.sortFn` is returned directly, `'auto'` delegates\n* to `column_getAutoSortFn`, and string values are looked up in the table's\n* sorting function registry before falling back to `basic`.\n*\n* @example\n* ```ts\n* const sortFn = column_getSortFn(column)\n* ```\n*/\nfunction column_getSortFn(column) {\n\tconst sortFns = column.table._rowModelFns.sortFns;\n\tif (isFunction(column.columnDef.sortFn)) return column.columnDef.sortFn;\n\tif (column.columnDef.sortFn === \"auto\") return column_getAutoSortFn(column);\n\tconst sortFn = sortFns?.[column.columnDef.sortFn];\n\tif (process.env.NODE_ENV === \"development\" && !sortFn) console.warn(`sortFn '${String(column.columnDef.sortFn)}' for column '${column.id}' is not registered`);\n\treturn sortFn ?? sortFn_basic;\n}\n/**\n* Applies the next sorting state for this column.\n*\n* The toggle can add, replace, flip, or remove this column's sort entry. Multi\n* sorting respects `enableMultiSort`, `enableMultiRemove`,\n* `maxMultiSortColCount`, and the `multi` argument.\n*\n* @example\n* ```ts\n* column_toggleSorting(column, undefined, true)\n* ```\n*/\nfunction column_toggleSorting(column, desc, multi) {\n\tconst nextSortingOrder = column_getNextSortingOrder(column, multi && column_getCanMultiSort(column));\n\tconst hasManualValue = typeof desc !== \"undefined\";\n\ttable_setSorting(column.table, (old) => {\n\t\tconst existingIndex = old.findIndex((d) => d.id === column.id);\n\t\tconst existingSorting = existingIndex === -1 ? void 0 : old[existingIndex];\n\t\tlet newSorting = [];\n\t\tlet sortAction;\n\t\tconst nextDesc = hasManualValue ? desc : nextSortingOrder === \"desc\";\n\t\tconst isMultiMode = !!(old.length && column_getCanMultiSort(column) && multi);\n\t\tif (isMultiMode) if (existingSorting) sortAction = \"toggle\";\n\t\telse sortAction = \"add\";\n\t\telse if (existingSorting) sortAction = \"toggle\";\n\t\telse sortAction = \"replace\";\n\t\tif (sortAction === \"toggle\") {\n\t\t\tif (!hasManualValue) {\n\t\t\t\tif (!nextSortingOrder) sortAction = \"remove\";\n\t\t\t}\n\t\t}\n\t\tif (sortAction === \"add\") {\n\t\t\tnewSorting = [...old, {\n\t\t\t\tid: column.id,\n\t\t\t\tdesc: nextDesc\n\t\t\t}];\n\t\t\tnewSorting.splice(0, newSorting.length - (column.table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER));\n\t\t} else if (sortAction === \"toggle\") newSorting = isMultiMode ? old.map((d) => {\n\t\t\tif (d.id === column.id) return {\n\t\t\t\t...d,\n\t\t\t\tdesc: nextDesc\n\t\t\t};\n\t\t\treturn d;\n\t\t}) : [{\n\t\t\tid: column.id,\n\t\t\tdesc: nextDesc\n\t\t}];\n\t\telse if (sortAction === \"remove\") newSorting = isMultiMode ? old.filter((d) => d.id !== column.id) : [];\n\t\telse newSorting = [{\n\t\t\tid: column.id,\n\t\t\tdesc: nextDesc\n\t\t}];\n\t\treturn newSorting;\n\t});\n}\n/**\n* Resolves the first direction used when this column begins sorting.\n*\n* Column-level `sortDescFirst` wins, then table-level `sortDescFirst`, then the\n* auto direction inferred from sampled values.\n*\n* @example\n* ```ts\n* const firstDirection = column_getFirstSortDir(column)\n* ```\n*/\nfunction column_getFirstSortDir(column) {\n\treturn column.columnDef.sortDescFirst ?? column.table.options.sortDescFirst ?? column_getAutoSortDir(column) === \"desc\" ? \"desc\" : \"asc\";\n}\n/**\n* Resolves the next sort order for this column's toggle cycle.\n*\n* The cycle starts with the first sort direction, flips between `asc` and\n* `desc`, and can return `false` when sorting removal is enabled.\n*\n* @example\n* ```ts\n* const nextOrder = column_getNextSortingOrder(column)\n* ```\n*/\nfunction column_getNextSortingOrder(column, multi) {\n\tconst firstSortDirection = column_getFirstSortDir(column);\n\tconst isSorted = column_getIsSorted(column);\n\tif (!isSorted) return firstSortDirection;\n\tif (isSorted !== firstSortDirection && (column.table.options.enableSortingRemoval ?? true) && (multi ? column.table.options.enableMultiRemove ?? true : true)) return false;\n\treturn isSorted === \"desc\" ? \"asc\" : \"desc\";\n}\n/**\n* Checks whether this accessor column can participate in sorting.\n*\n* The column must have an accessor and sorting must be enabled by both the\n* column definition and table options.\n*\n* @example\n* ```ts\n* const canSort = column_getCanSort(column)\n* ```\n*/\nfunction column_getCanSort(column) {\n\treturn (column.columnDef.enableSorting ?? true) && (column.table.options.enableSorting ?? true) && !!column.accessorFn;\n}\n/**\n* Checks whether this column can be added to a multi-sort state.\n*\n* Column-level `enableMultiSort` wins over table-level `enableMultiSort`; if\n* neither is set, accessor columns can multi-sort by default.\n*\n* @example\n* ```ts\n* const canMultiSort = column_getCanMultiSort(column)\n* ```\n*/\nfunction column_getCanMultiSort(column) {\n\treturn column.columnDef.enableMultiSort ?? column.table.options.enableMultiSort ?? !!column.accessorFn;\n}\n/**\n* Reads this column's current sort direction.\n*\n* The result is `false` when the column is not sorted, otherwise `'asc'` or\n* `'desc'` based on the column's entry in `state.sorting`.\n*\n* @example\n* ```ts\n* const direction = column_getIsSorted(column)\n* ```\n*/\nfunction column_getIsSorted(column) {\n\tconst columnSort = column.table.atoms.sorting?.get()?.find((d) => d.id === column.id);\n\treturn !columnSort ? false : columnSort.desc ? \"desc\" : \"asc\";\n}\n/**\n* Finds this column's position in the ordered `state.sorting` array.\n*\n* The result is `-1` when the column is not sorted.\n*\n* @example\n* ```ts\n* const index = column_getSortIndex(column)\n* ```\n*/\nfunction column_getSortIndex(column) {\n\treturn column.table.atoms.sorting?.get()?.findIndex((d) => d.id === column.id) ?? -1;\n}\n/**\n* Removes this column from the sorting state.\n*\n* Other sorted columns are preserved, including their relative order.\n*\n* @example\n* ```ts\n* column_clearSorting(column)\n* ```\n*/\nfunction column_clearSorting(column) {\n\ttable_setSorting(column.table, (old) => old.length ? old.filter((d) => d.id !== column.id) : []);\n}\n/**\n* Creates a header event handler that toggles this column's sorting.\n*\n* The handler ignores events when the column cannot sort, and asks\n* `options.isMultiSortEvent` whether the event should add to a multi-sort.\n*\n* @example\n* ```ts\n* const onClick = column_getToggleSortingHandler(column)\n* ```\n*/\nfunction column_getToggleSortingHandler(column) {\n\tconst canSort = column_getCanSort(column);\n\treturn (e) => {\n\t\tif (!canSort) return;\n\t\tcolumn_toggleSorting(column, void 0, column_getCanMultiSort(column) ? column.table.options.isMultiSortEvent?.(e) : false);\n\t};\n}\n\n//#endregion\nexport { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_autoResetSorting, table_resetSorting, table_setSorting };","import { makeObjectMap, skipFirstRun, tableMemo } from \"../../utils.js\";\nimport { constructRow } from \"../rows/constructRow.js\";\nimport { table_autoResetCellSelection } from \"../../features/cell-selection/cellSelectionFeature.utils.js\";\nimport { table_autoResetExpanded } from \"../../features/row-expanding/rowExpandingFeature.utils.js\";\nimport { table_autoResetPageIndex } from \"../../features/row-pagination/rowPaginationFeature.utils.js\";\nimport { table_autoResetSorting } from \"../../features/row-sorting/rowSortingFeature.utils.js\";\n\n//#region src/core/row-models/createCoreRowModel.ts\n/**\n* Creates a memoized core row model factory.\n*\n* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n*/\nfunction createCoreRowModel() {\n\treturn (table) => {\n\t\treturn tableMemo({\n\t\t\tfeature: \"coreRowModelsFeature\",\n\t\t\ttable,\n\t\t\tfnName: \"table.getCoreRowModel\",\n\t\t\tmemoDeps: () => [table.options.data],\n\t\t\tfn: () => _createCoreRowModel(table, table.options.data),\n\t\t\tonAfterUpdate: skipFirstRun(() => {\n\t\t\t\ttable_autoResetExpanded(table);\n\t\t\t\ttable_autoResetPageIndex(table);\n\t\t\t\ttable_autoResetSorting(table);\n\t\t\t\ttable_autoResetCellSelection(table);\n\t\t\t})\n\t\t});\n\t};\n}\nfunction accessRows(table, rowModel, originalRows, depth = 0, parentRow) {\n\tconst rows = [];\n\tfor (let i = 0; i < originalRows.length; i++) {\n\t\tconst originalRow = originalRows[i];\n\t\tconst row = constructRow(table, table.getRowId(originalRow, i, parentRow), originalRow, i, depth, void 0, parentRow?.id);\n\t\trowModel.flatRows.push(row);\n\t\trowModel.rowsById[row.id] = row;\n\t\trows.push(row);\n\t\tif (table.options.getSubRows) {\n\t\t\trow.originalSubRows = table.options.getSubRows(originalRow, i);\n\t\t\tif (row.originalSubRows?.length) row.subRows = accessRows(table, rowModel, row.originalSubRows, depth + 1, row);\n\t\t}\n\t}\n\treturn rows;\n}\nfunction _createCoreRowModel(table, data) {\n\tconst rowModel = {\n\t\trows: [],\n\t\tflatRows: [],\n\t\trowsById: makeObjectMap()\n\t};\n\trowModel.rows = accessRows(table, rowModel, data);\n\treturn rowModel;\n}\n\n//#endregion\nexport { createCoreRowModel };","import { createCoreRowModel } from \"./createCoreRowModel.js\";\n\n//#region src/core/row-models/coreRowModelsFeature.utils.ts\n/**\n* Resolves the table's unmodified core row model.\n*\n* The factory is created once per table, either from the `coreRowModel` slot on the `features` option\n* or the built-in `createCoreRowModel()`, then reused for later calls.\n*\n* @example\n* ```ts\n* const coreRows = table_getCoreRowModel(table)\n* ```\n*/\nfunction table_getCoreRowModel(table) {\n\tif (!table._rowModels.coreRowModel) table._rowModels.coreRowModel = table.options.features.coreRowModel?.(table) ?? createCoreRowModel()(table);\n\treturn table._rowModels.coreRowModel();\n}\n/**\n* Reads the row model immediately before column/global filtering.\n*\n* Filtering is the first derived row-model stage, so this currently aliases\n* `table.getCoreRowModel()`.\n*\n* @example\n* ```ts\n* const rowsBeforeFiltering = table_getPreFilteredRowModel(table)\n* ```\n*/\nfunction table_getPreFilteredRowModel(table) {\n\treturn table.getCoreRowModel();\n}\n/**\n* Resolves the row model after column and global filtering.\n*\n* When `manualFiltering` is enabled, or no filtered row-model factory was\n* registered, this returns the pre-filtered row model because filtering is\n* expected to happen outside the table.\n*\n* @example\n* ```ts\n* const filteredRows = table_getFilteredRowModel(table)\n* ```\n*/\nfunction table_getFilteredRowModel(table) {\n\tif (!table._rowModels.filteredRowModel) table._rowModels.filteredRowModel = table.options.features.filteredRowModel?.(table);\n\tif (table.options.manualFiltering || !table._rowModels.filteredRowModel) return table.getPreFilteredRowModel();\n\treturn table._rowModels.filteredRowModel();\n}\n/**\n* Reads the row model immediately before grouping.\n*\n* Grouping runs after filtering, so this aliases `table.getFilteredRowModel()`.\n*\n* @example\n* ```ts\n* const rowsBeforeGrouping = table_getPreGroupedRowModel(table)\n* ```\n*/\nfunction table_getPreGroupedRowModel(table) {\n\treturn table.getFilteredRowModel();\n}\n/**\n* Resolves the row model after grouping has produced grouped rows.\n*\n* When `manualGrouping` is enabled, or no grouped row-model factory was\n* registered, this returns the pre-grouped row model unchanged.\n*\n* @example\n* ```ts\n* const groupedRows = table_getGroupedRowModel(table)\n* ```\n*/\nfunction table_getGroupedRowModel(table) {\n\tif (!table._rowModels.groupedRowModel) table._rowModels.groupedRowModel = table.options.features.groupedRowModel?.(table);\n\tif (table.options.manualGrouping || !table._rowModels.groupedRowModel) return table.getPreGroupedRowModel();\n\treturn table._rowModels.groupedRowModel();\n}\n/**\n* Reads the row model immediately before sorting.\n*\n* Sorting runs after grouping, so this aliases `table.getGroupedRowModel()`.\n*\n* @example\n* ```ts\n* const rowsBeforeSorting = table_getPreSortedRowModel(table)\n* ```\n*/\nfunction table_getPreSortedRowModel(table) {\n\treturn table.getGroupedRowModel();\n}\n/**\n* Resolves the row model after sorting has been applied.\n*\n* When `manualSorting` is enabled, or no sorted row-model factory was\n* registered, this returns the pre-sorted row model because sorted data is\n* expected to be supplied by the caller.\n*\n* @example\n* ```ts\n* const sortedRows = table_getSortedRowModel(table)\n* ```\n*/\nfunction table_getSortedRowModel(table) {\n\tif (!table._rowModels.sortedRowModel) table._rowModels.sortedRowModel = table.options.features.sortedRowModel?.(table);\n\tif (table.options.manualSorting || !table._rowModels.sortedRowModel) return table.getPreSortedRowModel();\n\treturn table._rowModels.sortedRowModel();\n}\n/**\n* Reads the row model immediately before row expansion.\n*\n* Expansion runs after sorting, so this aliases `table.getSortedRowModel()`.\n*\n* @example\n* ```ts\n* const rowsBeforeExpansion = table_getPreExpandedRowModel(table)\n* ```\n*/\nfunction table_getPreExpandedRowModel(table) {\n\treturn table.getSortedRowModel();\n}\n/**\n* Resolves the row model after expanded rows have been flattened into view.\n*\n* When `manualExpanding` is enabled, or no expanded row-model factory was\n* registered, this returns the pre-expanded row model unchanged.\n*\n* @example\n* ```ts\n* const expandedRows = table_getExpandedRowModel(table)\n* ```\n*/\nfunction table_getExpandedRowModel(table) {\n\tif (!table._rowModels.expandedRowModel) table._rowModels.expandedRowModel = table.options.features.expandedRowModel?.(table);\n\tif (table.options.manualExpanding || !table._rowModels.expandedRowModel) return table.getPreExpandedRowModel();\n\treturn table._rowModels.expandedRowModel();\n}\n/**\n* Reads the row model immediately before pagination.\n*\n* Pagination is the final built-in row-model stage, so this aliases\n* `table.getExpandedRowModel()`.\n*\n* @example\n* ```ts\n* const rowsBeforePagination = table_getPrePaginatedRowModel(table)\n* ```\n*/\nfunction table_getPrePaginatedRowModel(table) {\n\treturn table.getExpandedRowModel();\n}\n/**\n* Resolves the row model after pagination has sliced rows for the current page.\n*\n* When `manualPagination` is enabled, or no paginated row-model factory was\n* registered, this returns the pre-paginated row model because pagination is\n* expected to happen before data reaches the table.\n*\n* @example\n* ```ts\n* const pageRows = table_getPaginatedRowModel(table)\n* ```\n*/\nfunction table_getPaginatedRowModel(table) {\n\tif (!table._rowModels.paginatedRowModel) table._rowModels.paginatedRowModel = table.options.features.paginatedRowModel?.(table);\n\tif (table.options.manualPagination || !table._rowModels.paginatedRowModel) return table.getPrePaginatedRowModel();\n\treturn table._rowModels.paginatedRowModel();\n}\n/**\n* Resolves the final row model consumed by renderers.\n*\n* This is the end of the built-in row-model pipeline: core -> filtering ->\n* grouping -> sorting -> expanding -> pagination.\n*\n* @example\n* ```ts\n* const visibleRows = table_getRowModel(table)\n* ```\n*/\nfunction table_getRowModel(table) {\n\treturn table.getPaginatedRowModel();\n}\n\n//#endregion\nexport { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel };","import { assignTableAPIs } from \"../../utils.js\";\nimport { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel } from \"./coreRowModelsFeature.utils.js\";\n\n//#region src/core/row-models/coreRowModelsFeature.ts\n/**\n* Core feature that wires table row-model accessors and row-model caches.\n*/\nconst coreRowModelsFeature = { constructTableAPIs: (table) => {\n\tassignTableAPIs(\"coreRowModelsFeature\", table, {\n\t\ttable_getCoreRowModel: { fn: () => table_getCoreRowModel(table) },\n\t\ttable_getPreFilteredRowModel: { fn: () => table_getPreFilteredRowModel(table) },\n\t\ttable_getFilteredRowModel: { fn: () => table_getFilteredRowModel(table) },\n\t\ttable_getPreGroupedRowModel: { fn: () => table_getPreGroupedRowModel(table) },\n\t\ttable_getGroupedRowModel: { fn: () => table_getGroupedRowModel(table) },\n\t\ttable_getPreSortedRowModel: { fn: () => table_getPreSortedRowModel(table) },\n\t\ttable_getSortedRowModel: { fn: () => table_getSortedRowModel(table) },\n\t\ttable_getPreExpandedRowModel: { fn: () => table_getPreExpandedRowModel(table) },\n\t\ttable_getExpandedRowModel: { fn: () => table_getExpandedRowModel(table) },\n\t\ttable_getPrePaginatedRowModel: { fn: () => table_getPrePaginatedRowModel(table) },\n\t\ttable_getPaginatedRowModel: { fn: () => table_getPaginatedRowModel(table) },\n\t\ttable_getRowModel: { fn: () => table_getRowModel(table) }\n\t});\n} };\n\n//#endregion\nexport { coreRowModelsFeature };","//#region src/core/cells/constructCell.ts\n/**\n* Creates or retrieves the cell prototype for a table.\n* The prototype is cached on the table and shared by all cell instances.\n*/\nfunction getCellPrototype(table) {\n\tif (!table._cellPrototype) {\n\t\ttable._cellPrototype = { table };\n\t\tconst features = Object.values(table._features);\n\t\tfor (let i = 0; i < features.length; i++) features[i].assignCellPrototype?.(table._cellPrototype, table);\n\t}\n\treturn table._cellPrototype;\n}\n/**\n* Constructs a cell instance from normalized table internals.\n*\n* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n*/\nfunction constructCell(column, row, table) {\n\tconst cellPrototype = getCellPrototype(table);\n\tconst cell = Object.create(cellPrototype);\n\tcell.column = column;\n\tcell.id = `${row.id}_${column.id}`;\n\tcell.row = row;\n\tconst initFns = table._cellInstanceInitFns;\n\tfor (let i = 0; i < initFns.length; i++) initFns[i](cell);\n\treturn cell;\n}\n\n//#endregion\nexport { constructCell };","import { flattenBy, hasOwn, makeObjectMap } from \"../../utils.js\";\nimport { constructCell } from \"../cells/constructCell.js\";\n\n//#region src/core/rows/coreRowsFeature.utils.ts\n/**\n* Returns this row's zero-based position in the current pre-pagination row\n* model. Rows outside that model return `-1`.\n*/\nfunction row_getDisplayIndex(row) {\n\tconst rows = row.table.getRowsInDisplayOrder();\n\tconst displayIndex = row._displayIndexCache;\n\treturn rows[displayIndex] === row ? displayIndex : -1;\n}\n/**\n* Returns the rows in the current display order after assigning their\n* zero-based display indexes.\n*\n* When expanded rows bypass pagination, expanded descendants are inserted into\n* the returned order even though they are absent from the pre-pagination row\n* model.\n*/\nfunction table_getRowsInDisplayOrder(table) {\n\tconst rows = table.getPrePaginatedRowModel().rows;\n\tif (table.options.paginateExpandedRows === false) {\n\t\tconst displayRows = [];\n\t\tconst handleRow = (row) => {\n\t\t\trow._displayIndexCache = displayRows.length;\n\t\t\tdisplayRows.push(row);\n\t\t\tif (row.subRows.length && row.getIsExpanded?.()) row.subRows.forEach(handleRow);\n\t\t};\n\t\trows.forEach(handleRow);\n\t\treturn displayRows;\n\t}\n\tfor (let i = 0; i < rows.length; i++) rows[i]._displayIndexCache = i;\n\treturn rows;\n}\n/**\n* Reads and caches this row's value for a column.\n*\n* The value is produced by the column accessor. Missing columns or display\n* columns without an accessor return `undefined`.\n*\n* @example\n* ```ts\n* const firstName = row_getValue(row, 'firstName')\n* ```\n*/\nfunction row_getValue(row, columnId) {\n\tif (hasOwn(row._valuesCache, columnId)) return row._valuesCache[columnId];\n\tconst column = row.table.getColumn(columnId);\n\tif (!column?.accessorFn) return;\n\trow._valuesCache[columnId] = column.accessorFn(row.original, row.index);\n\treturn row._valuesCache[columnId];\n}\n/**\n* Reads and caches the values used by faceting/grouping for a column.\n*\n* If the column defines `getUniqueValues`, that result is used. Otherwise the\n* row's accessor value is wrapped in a single-item array.\n*\n* @example\n* ```ts\n* const values = row_getUniqueValues(row, 'tags')\n* ```\n*/\nfunction row_getUniqueValues(row, columnId) {\n\tif (hasOwn(row._uniqueValuesCache, columnId)) return row._uniqueValuesCache[columnId];\n\tconst column = row.table.getColumn(columnId);\n\tif (!column?.accessorFn) return;\n\tif (!column.columnDef.getUniqueValues) {\n\t\trow._uniqueValuesCache[columnId] = [row.getValue(columnId)];\n\t\treturn row._uniqueValuesCache[columnId];\n\t}\n\trow._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, row.index);\n\treturn row._uniqueValuesCache[columnId];\n}\n/**\n* Returns a renderable row value for a column.\n*\n* If the accessor value is nullish, the table's `renderFallbackValue` is used\n* instead.\n*\n* @example\n* ```ts\n* const value = row_renderValue(row, 'firstName')\n* ```\n*/\nfunction row_renderValue(row, columnId) {\n\treturn row.getValue(columnId) ?? row.table.options.renderFallbackValue;\n}\n/**\n* Flattens this row's descendant tree into leaf rows.\n*\n* The row itself is not included; only nested `subRows` are walked.\n*\n* @example\n* ```ts\n* const descendants = row_getLeafRows(row)\n* ```\n*/\nfunction row_getLeafRows(row) {\n\treturn flattenBy(row.subRows, (d) => d.subRows);\n}\n/**\n* Returns the deepest structural row depth in the core row model.\n* Root rows are depth `0`, their direct sub-rows are depth `1`, and so on.\n*/\nfunction table_getMaxSubRowDepth(table) {\n\tconst rows = table.getCoreRowModel().flatRows;\n\tlet maxDepth = 0;\n\tfor (let i = 0; i < rows.length; i++) maxDepth = Math.max(maxDepth, rows[i].depth);\n\treturn maxDepth;\n}\n/**\n* Looks up this row's direct parent, if it has one.\n*\n* Parent lookup prefers the core row model for structural parents, then falls\n* back to the pre-pagination row model for generated parent rows.\n*\n* @example\n* ```ts\n* const parent = row_getParentRow(row)\n* ```\n*/\nfunction row_getParentRow(row) {\n\tif (!row.parentId) return;\n\treturn row.table.getCoreRowModel().rowsById[row.parentId] ?? row.table.getRow(row.parentId, true);\n}\n/**\n* Collects this row's ancestor chain from root to direct parent.\n*\n* The current row is not included. Rows without a parent return an empty array.\n*\n* @example\n* ```ts\n* const ancestors = row_getParentRows(row)\n* ```\n*/\nfunction row_getParentRows(row) {\n\tconst parentRows = [];\n\tlet currentRow = row;\n\twhile (true) {\n\t\tconst parentRow = currentRow.getParentRow();\n\t\tif (!parentRow) break;\n\t\tparentRows.push(parentRow);\n\t\tcurrentRow = parentRow;\n\t}\n\treturn parentRows.reverse();\n}\n/**\n* Constructs one cell for each leaf column in this row.\n*\n* The result follows `table.getAllLeafColumns()` order and includes hidden\n* columns; visibility-specific APIs filter this list later.\n*\n* @example\n* ```ts\n* const cells = row_getAllCells(row)\n* ```\n*/\nfunction row_getAllCells(row) {\n\tconst columns = row.table.getAllLeafColumns();\n\tlet cache = row._cellsCache;\n\tif (!cache) cache = row._cellsCache = /* @__PURE__ */ new WeakMap();\n\tconst cells = new Array(columns.length);\n\tfor (let i = 0; i < columns.length; i++) {\n\t\tconst column = columns[i];\n\t\tlet cell = cache.get(column);\n\t\tif (!cell) {\n\t\t\tcell = constructCell(column, row, row.table);\n\t\t\tcache.set(column, cell);\n\t\t}\n\t\tcells[i] = cell;\n\t}\n\treturn cells;\n}\n/**\n* Builds a lookup map of this row's cells keyed by column id.\n*\n* This is the static implementation behind `row.getAllCellsByColumnId()`.\n*\n* @example\n* ```ts\n* const cellsById = row_getAllCellsByColumnId(row)\n* ```\n*/\nfunction row_getAllCellsByColumnId(row) {\n\tconst result = makeObjectMap();\n\tconst cells = row.getAllCells();\n\tfor (let i = 0; i < cells.length; i++) {\n\t\tconst cell = cells[i];\n\t\tresult[cell.column.id] = cell;\n\t}\n\treturn result;\n}\n/**\n* Resolves the stable id for a row.\n*\n* `options.getRowId` wins when provided. Otherwise root rows use their index\n* and child rows append their index to the parent id, such as `0.2`.\n*\n* @example\n* ```ts\n* const id = table_getRowId(originalRow, table, index, parentRow)\n* ```\n*/\nfunction table_getRowId(originalRow, table, index, parent) {\n\treturn table.options.getRowId?.(originalRow, index, parent) ?? (parent ? `${parent.id}.${index}` : String(index));\n}\n/**\n* Looks up a row by id from the current or full row model.\n*\n* By default this searches `table.getRowModel()`. Passing `searchAll` searches\n* the pre-pagination model first, then falls back to the core model.\n*\n* @example\n* ```ts\n* const row = table_getRow(table, rowId, true)\n* ```\n*/\nfunction table_getRow(table, rowId, searchAll) {\n\tlet row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel()).rowsById[rowId];\n\tif (!row) {\n\t\trow = table.getCoreRowModel().rowsById[rowId];\n\t\tif (!row) {\n\t\t\tif (process.env.NODE_ENV === \"development\") throw new Error(`getRow could not find row with ID: ${rowId}`);\n\t\t\tthrow new Error();\n\t\t}\n\t}\n\treturn row;\n}\n\n//#endregion\nexport { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getMaxSubRowDepth, table_getRow, table_getRowId, table_getRowsInDisplayOrder };","import { assignPrototypeAPIs, assignTableAPIs } from \"../../utils.js\";\nimport { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getMaxSubRowDepth, table_getRow, table_getRowId, table_getRowsInDisplayOrder } from \"./coreRowsFeature.utils.js\";\n\n//#region src/core/rows/coreRowsFeature.ts\n/**\n* Core feature that creates row APIs for values, cells, and tree traversal.\n*/\nconst coreRowsFeature = {\n\tassignRowPrototype: (prototype, table) => {\n\t\tassignPrototypeAPIs(\"coreRowsFeature\", prototype, table, {\n\t\t\trow_getDisplayIndex: { fn: (row) => row_getDisplayIndex(row) },\n\t\t\trow_getAllCellsByColumnId: {\n\t\t\t\tfn: (row) => row_getAllCellsByColumnId(row),\n\t\t\t\tmemoDeps: (row) => [row.getAllCells()]\n\t\t\t},\n\t\t\trow_getAllCells: {\n\t\t\t\tfn: (row) => row_getAllCells(row),\n\t\t\t\tmemoDeps: (row) => [row.table.getAllLeafColumns()]\n\t\t\t},\n\t\t\trow_getLeafRows: {\n\t\t\t\tfn: (row) => row_getLeafRows(row),\n\t\t\t\tmemoDeps: (row) => [row.subRows]\n\t\t\t},\n\t\t\trow_getParentRow: { fn: (row) => row_getParentRow(row) },\n\t\t\trow_getParentRows: { fn: (row) => row_getParentRows(row) },\n\t\t\trow_getUniqueValues: { fn: (row, columnId) => row_getUniqueValues(row, columnId) },\n\t\t\trow_getValue: { fn: (row, columnId) => row_getValue(row, columnId) },\n\t\t\trow_renderValue: { fn: (row, columnId) => row_renderValue(row, columnId) }\n\t\t});\n\t},\n\tconstructTableAPIs: (table) => {\n\t\tassignTableAPIs(\"coreRowsFeature\", table, {\n\t\t\ttable_getRowsInDisplayOrder: {\n\t\t\t\tfn: () => table_getRowsInDisplayOrder(table),\n\t\t\t\tmemoDeps: () => [\n\t\t\t\t\ttable.getPrePaginatedRowModel().rows,\n\t\t\t\t\ttable.options.paginateExpandedRows,\n\t\t\t\t\ttable.options.paginateExpandedRows === false ? table.atoms.expanded?.get() : void 0\n\t\t\t\t]\n\t\t\t},\n\t\t\ttable_getRowId: { fn: (originalRow, index, parent) => table_getRowId(originalRow, table, index, parent) },\n\t\t\ttable_getRow: { fn: (id, searchAll) => table_getRow(table, id, searchAll) },\n\t\t\ttable_getMaxSubRowDepth: {\n\t\t\t\tfn: () => table_getMaxSubRowDepth(table),\n\t\t\t\tmemoDeps: () => [table.getCoreRowModel()]\n\t\t\t}\n\t\t});\n\t}\n};\n\n//#endregion\nexport { coreRowsFeature };","import { cloneState, functionalUpdate } from \"../../utils.js\";\n\n//#region src/core/table/coreTablesFeature.utils.ts\n/**\n* Synchronizes externally controlled state slices into the table's base atoms.\n*\n* This keeps `options.state` values mirrored in the atom graph so derived\n* atoms, stores, and table APIs read a consistent snapshot.\n*\n* Adapters that update options during their host's render phase pass the\n* state snapshot captured by the committed render as `capturedState` — the\n* shared options object may already hold values from a newer render that\n* never commits. Pass `null` to publish nothing (a captured \"no controlled\n* state\"); omitting the argument reads the current `table.options.state`\n* instead. An optional `compare` suppresses semantically unchanged slice\n* writes; the default remains reference equality.\n*\n* @example\n* ```ts\n* table_syncExternalStateToBaseAtoms(table)\n* table_syncExternalStateToBaseAtoms(table, capturedState ?? null, shallow)\n* ```\n*/\nfunction table_syncExternalStateToBaseAtoms(table, capturedState, compare = (currentState, externalState) => currentState === externalState) {\n\tconst state = capturedState === void 0 ? table.options.state : capturedState;\n\ttable._reactivity.batch(() => {\n\t\tif (state) for (const key in state) {\n\t\t\tconst baseAtom = table.baseAtoms[key];\n\t\t\tif (!baseAtom) continue;\n\t\t\tconst rawExternalState = state[key];\n\t\t\tconst externalState = rawExternalState === void 0 ? table.initialState[key] : rawExternalState;\n\t\t\tif (!compare(table._reactivity.untrack(() => baseAtom.get()), externalState)) baseAtom.set(() => externalState);\n\t\t}\n\t});\n}\n/**\n* Publishes captured controlled state after a host framework commits.\n*\n* Render-phase adapters stage options without synchronizing base atoms, then\n* pass the state captured by the committed render here. The commit signal also\n* invalidates ownership changes when no base atom was written.\n*/\nfunction table_publishExternalState(table, state, compare = (currentState, externalState) => currentState === externalState) {\n\ttable._reactivity.batch(() => {\n\t\ttable_syncExternalStateToBaseAtoms(table, state, compare);\n\t\ttable._reactivity.commit?.();\n\t});\n}\n/**\n* Resets all internal table base atoms to `table.initialState`, then clears\n* transient instance data through registered feature reset hooks.\n*\n* This resets internally owned state slices in a single reactivity batch. Use\n* feature-specific reset APIs when a slice may be externally owned.\n*\n* @example\n* ```ts\n* table_reset(table)\n* ```\n*/\nfunction table_reset(table) {\n\tconst snap = cloneState(table.initialState);\n\ttable._reactivity.batch(() => {\n\t\tconst keys = Object.keys(snap);\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key = keys[i];\n\t\t\ttable.baseAtoms[key].set(snap[key]);\n\t\t}\n\t});\n\tconst features = Object.values(table._features);\n\tfor (let i = 0; i < features.length; i++) features[i].resetTableInstanceData?.(table);\n}\n/**\n* Merges new table options with the current resolved options.\n*\n* If `options.mergeOptions` is provided, it owns the merge behavior; otherwise\n* options are shallow-merged. Static options that should never change after\n* initialization are restored on a fresh object so framework merge helpers may\n* return readonly getter/proxy objects.\n*\n* @example\n* ```ts\n* const options = table_mergeOptions(table, nextOptions)\n* ```\n*/\nfunction table_mergeOptions(table, newOptions) {\n\tconst { features, atoms, initialState } = table.options;\n\tif (!table.options.mergeOptions) return {\n\t\t...table.options,\n\t\t...newOptions,\n\t\tfeatures,\n\t\tatoms,\n\t\tinitialState\n\t};\n\tconst mergedOptions = table.options.mergeOptions(table.options, newOptions);\n\tconst descriptors = { ...Object.getOwnPropertyDescriptors(mergedOptions) };\n\treturn Object.defineProperties(Object.create(Object.getPrototypeOf(mergedOptions)), {\n\t\t...descriptors,\n\t\tfeatures: {\n\t\t\tvalue: features,\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t},\n\t\tatoms: {\n\t\t\tvalue: atoms,\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t},\n\t\tinitialState: {\n\t\t\tvalue: initialState,\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t}\n\t});\n}\n/**\n* Updates the table options object.\n*\n* The updater receives the current resolved options and the merged result is\n* immediately assigned to the table instance.\n*\n* @example\n* ```ts\n* table_setOptions(table, (old) => old)\n* table_setOptions(table, (old) => old, { syncExternalState: false })\n* ```\n*/\nfunction table_setOptions(table, updater, options) {\n\tconst mergedOptions = table_mergeOptions(table, functionalUpdate(updater, table.options));\n\tif (table.optionsStore) table.optionsStore.set(() => mergedOptions);\n\telse table.options = mergedOptions;\n\tif (options?.syncExternalState !== false) table_publishExternalState(table, mergedOptions.state ?? null);\n}\n\n//#endregion\nexport { table_mergeOptions, table_publishExternalState, table_reset, table_setOptions, table_syncExternalStateToBaseAtoms };","import { assignTableAPIs } from \"../../utils.js\";\nimport { table_reset, table_setOptions } from \"./coreTablesFeature.utils.js\";\n\n//#region src/core/table/coreTablesFeature.ts\n/**\n* Core feature that adds base table instance APIs such as reset and setOptions.\n*/\nconst coreTablesFeature = { constructTableAPIs: (table) => {\n\tassignTableAPIs(\"coreTablesFeature\", table, {\n\t\ttable_reset: { fn: () => table_reset(table) },\n\t\ttable_setOptions: { fn: (updater) => table_setOptions(table, updater) }\n\t});\n} };\n\n//#endregion\nexport { coreTablesFeature };","import { coreCellsFeature } from \"./cells/coreCellsFeature.js\";\nimport { coreColumnsFeature } from \"./columns/coreColumnsFeature.js\";\nimport { coreHeadersFeature } from \"./headers/coreHeadersFeature.js\";\nimport { coreRowModelsFeature } from \"./row-models/coreRowModelsFeature.js\";\nimport { coreRowsFeature } from \"./rows/coreRowsFeature.js\";\nimport { coreTablesFeature } from \"./table/coreTablesFeature.js\";\n\n//#region src/core/coreFeatures.ts\n/**\n* The built-in core feature set required by every table.\n*\n* These features provide table, column, row, header, cell, and core row-model behavior before optional feature plugins are added.\n*/\nconst coreFeatures = {\n\tcoreCellsFeature,\n\tcoreColumnsFeature,\n\tcoreHeadersFeature,\n\tcoreRowModelsFeature,\n\tcoreRowsFeature,\n\tcoreTablesFeature\n};\n\n//#endregion\nexport { coreFeatures };","//#region src/helpers/columnHelper.ts\n/**\n* Creates helper functions for authoring column definitions with stronger value\n* inference.\n*\n* `accessor` infers `TValue` from an accessor key or accessor function,\n* `display` creates non-data columns, `group` creates parent columns, and\n* `columns` preserves tuple-level value types for arrays. At runtime these\n* helpers only return column definition objects.\n*\n* @example\n* ```tsx\n* const helper = createColumnHelper<typeof features, Person>() // features is the result of `tableFeatures({})` helper\n* const columns = [\n* helper.display({ id: 'actions', header: 'Actions' }),\n* helper.accessor('firstName', {}),\n* helper.accessor((row) => row.lastName, { id: 'lastName' }),\n* ]\n* ```\n*/\nfunction createColumnHelper() {\n\treturn {\n\t\taccessor: (accessor, column) => {\n\t\t\treturn typeof accessor === \"function\" ? {\n\t\t\t\t...column,\n\t\t\t\taccessorFn: accessor\n\t\t\t} : {\n\t\t\t\t...column,\n\t\t\t\taccessorKey: accessor\n\t\t\t};\n\t\t},\n\t\tcolumns: (columns) => columns,\n\t\tdisplay: (column) => column,\n\t\tgroup: (column) => column\n\t};\n}\n\n//#endregion\nexport { createColumnHelper };","//#region src/helpers/tableFeatures.ts\n/**\n* A helper function to help define the features that are to be imported and applied to a table instance.\n* Use this utility to make it easier to have the correct type inference for the features that are being imported.\n* **Note:** It is recommended to use this utility statically outside of a component.\n*\n* Alongside feature modules, this object carries everything else that is\n* statically stitched into the table:\n*\n* - Row model factories (`sortedRowModel`, `filteredRowModel`, etc.)\n* - Row model function registries (`sortFns`, `filterFns`, `aggregationFns`),\n* whose keys become the valid string values for `sortFn`, `filterFn`,\n* `globalFilterFn`, and `aggregationFn` with full inference\n* - Type-only `tableMeta`/`columnMeta` slots for declaring per-table meta types\n* instead of using global declaration merging. The values are phantom\n* (ignored and stripped at runtime); only their types are used.\n* @example\n* ```\n* import {\n* columnFilteringFeature,\n* createFilteredRowModel,\n* createSortedRowModel,\n* filterFn_includesString,\n* rowSortingFeature,\n* sortFn_alphanumeric,\n* sortFn_text,\n* tableFeatures,\n* } from '@tanstack/react-table'\n* const features = tableFeatures({\n* columnFilteringFeature,\n* rowSortingFeature,\n* filteredRowModel: createFilteredRowModel(),\n* sortedRowModel: createSortedRowModel(),\n* filterFns: { includesString: filterFn_includesString, myCustomFilterFn },\n* sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },\n* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },\n* columnMeta: {} as { align?: 'left' | 'right' },\n* });\n* const table = useTable({ features, columns, data });\n* ```\n*/\nfunction tableFeatures(features) {\n\treturn features;\n}\n\n//#endregion\nexport { tableFeatures };","import { cloneState, hasOwn } from \"../../utils.js\";\nimport { table_syncExternalStateToBaseAtoms } from \"./coreTablesFeature.utils.js\";\nimport { coreFeatures } from \"../coreFeatures.js\";\nimport { atomToStore } from \"../reactivity/coreReactivityFeature.utils.js\";\nimport { shallow } from \"@tanstack/store\";\n\n//#region src/core/table/constructTable.ts\n/**\n* Builds the initial table state from registered features and user initial state.\n*\n* Each feature contributes its default state before user-provided `initialState` values are merged in.\n*/\nfunction getInitialTableState(features, initialState = {}) {\n\tObject.values(features).forEach((feature) => {\n\t\tinitialState = feature.getInitialState?.(initialState) ?? initialState;\n\t});\n\treturn cloneState(initialState);\n}\n/**\n* Constructs a table instance from normalized table internals.\n*\n* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n*/\nfunction constructTable(tableOptions) {\n\tconst _reactivity = tableOptions.features.coreReactivityFeature;\n\tconst { aggregationFns, columnMeta: _columnMeta, coreRowModel, expandedRowModel, facetedMinMaxValues, facetedRowModel, facetedUniqueValues, filterFns, filterMeta: _filterMeta, filteredRowModel, groupedRowModel, paginatedRowModel, sortFns, sortedRowModel, tableMeta: _tableMeta, ...features } = tableOptions.features;\n\tconst table = {\n\t\t_cellInstanceInitFns: [],\n\t\t_columnInstanceInitFns: [],\n\t\t_features: {\n\t\t\t...coreFeatures,\n\t\t\t...features\n\t\t},\n\t\t_headerGroupInstanceInitFns: [],\n\t\t_headerInstanceInitFns: [],\n\t\t_reactivity,\n\t\t_rowInstanceInitFns: [],\n\t\t_rowModelFns: {\n\t\t\taggregationFns,\n\t\t\tfilterFns,\n\t\t\tsortFns\n\t\t},\n\t\t_rowModels: {},\n\t\tatoms: {},\n\t\tbaseAtoms: {}\n\t};\n\tconst featuresList = Object.values(table._features);\n\tconst mergedOptions = {\n\t\t...featuresList.reduce((obj, feature) => {\n\t\t\treturn Object.assign(obj, feature.getDefaultTableOptions?.(table));\n\t\t}, {}),\n\t\t...tableOptions\n\t};\n\tif (_reactivity.wrapExternalAtoms && mergedOptions.atoms) for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n\t\tconst atom = _atom;\n\t\tconst wrappedAtom = _reactivity.createWritableAtom(atom.get(), { debugName: `externalAtom/${atomKey}` });\n\t\tmergedOptions.atoms[atomKey] = wrappedAtom;\n\t\tlet syncExternal = false;\n\t\tconst syncAtomToWrappedSub = atom.subscribe((value) => {\n\t\t\tif (syncExternal) return;\n\t\t\twrappedAtom.set(value);\n\t\t});\n\t\tconst syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n\t\t\tsyncExternal = true;\n\t\t\tatom.set(value);\n\t\t\tsyncExternal = false;\n\t\t});\n\t\t_reactivity.addSubscription(syncAtomToWrappedSub);\n\t\t_reactivity.addSubscription(syncWrappedToAtomSub);\n\t}\n\tif (_reactivity.createOptionsStore) {\n\t\ttable.optionsStore = _reactivity.createWritableAtom(mergedOptions, { debugName: \"table/optionsStore\" });\n\t\tObject.defineProperty(table, \"options\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tget() {\n\t\t\t\treturn table.optionsStore.get();\n\t\t\t},\n\t\t\tset(value) {\n\t\t\t\ttable.optionsStore.set(() => value);\n\t\t\t}\n\t\t});\n\t} else table.options = mergedOptions;\n\ttable.initialState = getInitialTableState(table._features, table.options.initialState);\n\tconst stateKeys = Object.keys(table.initialState);\n\tfor (let i = 0; i < stateKeys.length; i++) {\n\t\tconst key = stateKeys[i];\n\t\ttable.baseAtoms[key] = _reactivity.createWritableAtom(table.initialState[key], { debugName: `table/baseAtoms/${key}` });\n\t\ttable.atoms[key] = _reactivity.createReadonlyAtom(() => {\n\t\t\tconst options = table.options;\n\t\t\tconst externalAtom = options.atoms?.[key];\n\t\t\tconst reactiveState = externalAtom ? externalAtom.get() : table.baseAtoms[key].get();\n\t\t\tif (externalAtom) return reactiveState;\n\t\t\tconst controlledState = options.state;\n\t\t\tif (controlledState && hasOwn(controlledState, key)) {\n\t\t\t\tconst controlledValue = controlledState[key];\n\t\t\t\treturn controlledValue === void 0 ? table.initialState[key] : controlledValue;\n\t\t\t}\n\t\t\treturn reactiveState;\n\t\t}, { debugName: `table/atoms/${key}` });\n\t}\n\ttable_syncExternalStateToBaseAtoms(table);\n\ttable.store = atomToStore(_reactivity.createReadonlyAtom(() => {\n\t\tconst snapshot = {};\n\t\tfor (let i = 0; i < stateKeys.length; i++) {\n\t\t\tconst key = stateKeys[i];\n\t\t\tsnapshot[key] = table.atoms[key].get();\n\t\t}\n\t\treturn snapshot;\n\t}, {\n\t\tcompare: shallow,\n\t\tdebugName: \"table/store\"\n\t}));\n\tfor (let i = 0; i < featuresList.length; i++) {\n\t\tconst feature = featuresList[i];\n\t\tfeature.initTableInstanceData?.(table);\n\t\tif (feature.initCellInstanceData) table._cellInstanceInitFns.push(feature.initCellInstanceData.bind(feature));\n\t\tif (feature.initColumnInstanceData) table._columnInstanceInitFns.push(feature.initColumnInstanceData.bind(feature));\n\t\tif (feature.initHeaderGroupInstanceData) table._headerGroupInstanceInitFns.push(feature.initHeaderGroupInstanceData.bind(feature));\n\t\tif (feature.initHeaderInstanceData) table._headerInstanceInitFns.push(feature.initHeaderInstanceData.bind(feature));\n\t\tif (feature.initRowInstanceData) table._rowInstanceInitFns.push(feature.initRowInstanceData.bind(feature));\n\t\tfeature.constructTableAPIs?.(table);\n\t}\n\tif (process.env.NODE_ENV === \"development\" && (tableOptions.debugAll || tableOptions.debugTable)) {\n\t\tconst features = Object.keys(table._features);\n\t\tconst rowModels = Object.entries({\n\t\t\tcoreRowModel,\n\t\t\tfilteredRowModel,\n\t\t\tgroupedRowModel,\n\t\t\tsortedRowModel,\n\t\t\texpandedRowModel,\n\t\t\tpaginatedRowModel,\n\t\t\tfacetedRowModel,\n\t\t\tfacetedMinMaxValues,\n\t\t\tfacetedUniqueValues\n\t\t}).filter(([, factory]) => factory).map(([key]) => key);\n\t\tconst states = Object.keys(table.initialState);\n\t\tconsole.log(`Constructing Table Instance\n\n Features: ${features.join(\"\\n \")}\n\n Row Models: ${rowModels.length ? rowModels.join(\"\\n \") : \"(none)\"}\n\n States: ${states.join(\"\\n \")}\\n`, { table });\n\t}\n\treturn table;\n}\n\n//#endregion\nexport { constructTable, getInitialTableState };","import { cloneState, functionalUpdate, isFunction, setStateSlice } from \"../../utils.js\";\n\n//#region src/features/column-filtering/columnFilteringFeature.utils.ts\n/**\n* Creates the default column filter state.\n*\n* The feature default is an empty array, meaning no column filters are active.\n* Reset APIs use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const filters = getDefaultColumnFiltersState()\n* ```\n*/\nfunction getDefaultColumnFiltersState() {\n\treturn [];\n}\n/**\n* Chooses a built-in filter function from the column's first core row value.\n*\n* Strings use `includesString`, numbers use `inNumberRange`, booleans and\n* objects use `equals`, dates use `inDateRange`, arrays use `arrIncludes`,\n* and unknown values fall back to `weakEquals`.\n*\n* The chosen filter function is looked up in the table's `filterFns`\n* registry. When it is not registered there, this returns `undefined` and\n* warns in development instead of substituting a different filter function.\n*\n* @example\n* ```ts\n* const filterFn = column_getAutoFilterFn(column)\n* ```\n*/\nfunction column_getAutoFilterFn(column) {\n\tconst filterFns = column.table._rowModelFns.filterFns;\n\tconst rows = column.table.getCoreRowModel().flatRows;\n\tlet value;\n\tfor (let i = 0; i < rows.length; i++) {\n\t\tconst rowValue = rows[i].getValue(column.id);\n\t\tif (rowValue !== null && rowValue !== void 0) {\n\t\t\tvalue = rowValue;\n\t\t\tbreak;\n\t\t}\n\t}\n\tlet filterFnName;\n\tif (typeof value === \"string\") filterFnName = \"includesString\";\n\telse if (typeof value === \"number\") filterFnName = \"inNumberRange\";\n\telse if (typeof value === \"boolean\") filterFnName = \"equals\";\n\telse if (Array.isArray(value)) filterFnName = \"arrIncludes\";\n\telse if (Object.prototype.toString.call(value) === \"[object Date]\") filterFnName = \"inDateRange\";\n\telse if (value !== null && typeof value === \"object\") filterFnName = \"equals\";\n\telse filterFnName = \"weakEquals\";\n\tconst filterFn = filterFns?.[filterFnName];\n\tif (process.env.NODE_ENV === \"development\" && !filterFn) console.warn(`filterFn '${filterFnName}' (auto) for column '${column.id}' is not registered`);\n\treturn filterFn;\n}\n/**\n* Resolves the filter function configured for a column.\n*\n* Function-valued `columnDef.filterFn` is returned directly, `'auto'` delegates\n* to `column_getAutoFilterFn`, and string values are looked up in the table's\n* filter function registry.\n*\n* @example\n* ```ts\n* const filterFn = column_getFilterFn(column)\n* ```\n*/\nfunction column_getFilterFn(column) {\n\tlet filterFn = null;\n\tconst filterFns = column.table._rowModelFns.filterFns;\n\tfilterFn = isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === \"auto\" ? column_getAutoFilterFn(column) : filterFns?.[column.columnDef.filterFn];\n\tif (process.env.NODE_ENV === \"development\" && !filterFn && column.columnDef.filterFn !== \"auto\") console.warn(`filterFn '${String(column.columnDef.filterFn)}' for column '${column.id}' is not registered`);\n\treturn filterFn ?? void 0;\n}\n/**\n* Checks whether column filtering is enabled for this accessor column.\n*\n* The column must have an accessor and filtering must be enabled by the column\n* definition, `enableColumnFilters`, and the table-wide `enableFilters` option.\n*\n* @example\n* ```ts\n* const canFilter = column_getCanFilter(column)\n* ```\n*/\nfunction column_getCanFilter(column) {\n\treturn (column.columnDef.enableColumnFilter ?? true) && (column.table.options.enableColumnFilters ?? true) && (column.table.options.enableFilters ?? true) && !!column.accessorFn;\n}\n/**\n* Checks whether this column currently has an entry in `state.columnFilters`.\n*\n* This only reflects filter state presence; it does not indicate whether the\n* filter removes any rows.\n*\n* @example\n* ```ts\n* const isFiltered = column_getIsFiltered(column)\n* ```\n*/\nfunction column_getIsFiltered(column) {\n\treturn column_getFilterIndex(column) > -1;\n}\n/**\n* Reads this column's current filter value from `state.columnFilters`.\n*\n* Missing filter entries return `undefined`.\n*\n* @example\n* ```ts\n* const value = column_getFilterValue(column)\n* ```\n*/\nfunction column_getFilterValue(column) {\n\treturn column.table.atoms.columnFilters?.get()?.find((d) => d.id === column.id)?.value;\n}\n/**\n* Finds this column's position in the ordered `state.columnFilters` array.\n*\n* The result is `-1` when the column has no active filter.\n*\n* @example\n* ```ts\n* const index = column_getFilterIndex(column)\n* ```\n*/\nfunction column_getFilterIndex(column) {\n\treturn column.table.atoms.columnFilters?.get()?.findIndex((d) => d.id === column.id) ?? -1;\n}\n/**\n* Adds, updates, or removes this column's filter value.\n*\n* The incoming value may be an updater. After resolution, `autoRemove` rules\n* decide whether the filter should be removed instead of stored.\n*\n* @example\n* ```ts\n* column_setFilterValue(column, (old) => String(old ?? '').trim())\n* ```\n*/\nfunction column_setFilterValue(column, value) {\n\ttable_setColumnFilters(column.table, (old) => {\n\t\tconst filterFn = column_getFilterFn(column);\n\t\tconst previousFilter = old.find((d) => d.id === column.id);\n\t\tconst newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : void 0);\n\t\tif (shouldAutoRemoveFilter(filterFn, newFilter, column)) return old.filter((d) => d.id !== column.id);\n\t\tconst newFilterObj = {\n\t\t\tid: column.id,\n\t\t\tvalue: newFilter\n\t\t};\n\t\tif (previousFilter) return old.map((d) => {\n\t\t\tif (d.id === column.id) return newFilterObj;\n\t\t\treturn d;\n\t\t});\n\t\tif (old.length) return [...old, newFilterObj];\n\t\treturn [newFilterObj];\n\t});\n}\n/**\n* Routes a column filter updater through the table's filter change handler.\n*\n* The resolved filters are cleaned before they are emitted: filters for known\n* columns are removed when their filter function says the value should be\n* auto-removed.\n*\n* @example\n* ```ts\n* table_setColumnFilters(table, (old) => old.filter((filter) => filter.id !== 'age'))\n* ```\n*/\nfunction table_setColumnFilters(table, updater) {\n\tconst leafColumnsById = table.getAllLeafColumnsById();\n\tconst updateFn = (old) => {\n\t\treturn functionalUpdate(updater, old).filter((filter) => {\n\t\t\tconst column = leafColumnsById[filter.id];\n\t\t\tif (column) {\n\t\t\t\tif (shouldAutoRemoveFilter(column_getFilterFn(column), filter.value, column)) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t};\n\tsetStateSlice(table, \"columnFilters\", updateFn);\n}\n/**\n* Resets `columnFilters` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.columnFilters` when it\n* exists. Passing `true` ignores initial state and resets to `[]`.\n*\n* @example\n* ```ts\n* table_resetColumnFilters(table)\n* table_resetColumnFilters(table, true)\n* ```\n*/\nfunction table_resetColumnFilters(table, defaultState) {\n\ttable_setColumnFilters(table, defaultState ? [] : cloneState(table.initialState.columnFilters ?? []));\n}\n/**\n* Returns whether a filter value should be removed from filter state.\n*\n* `undefined` always removes: it is the universal \"clear this filter\"\n* sentinel used by `setFilterValue(undefined)` and functional updaters. For\n* any other value, a filter function's `autoRemove` hook is authoritative\n* when provided, so custom filter functions can keep values (such as empty\n* strings) that the default heuristic would drop. Without an `autoRemove`\n* hook, empty strings are removed.\n*\n* @example\n* ```ts\n* const removeFilter = shouldAutoRemoveFilter(filterFn, value, column)\n* ```\n*/\nfunction shouldAutoRemoveFilter(filterFn, value, column) {\n\tif (typeof value === \"undefined\") return true;\n\tif (filterFn?.autoRemove) return !!filterFn.autoRemove(value, column);\n\treturn typeof value === \"string\" && !value;\n}\n\n//#endregion\nexport { column_getAutoFilterFn, column_getCanFilter, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getIsFiltered, column_setFilterValue, getDefaultColumnFiltersState, shouldAutoRemoveFilter, table_resetColumnFilters, table_setColumnFilters };","import { assignPrototypeAPIs, assignTableAPIs, makeObjectMap, makeStateUpdater } from \"../../utils.js\";\nimport { column_getAutoFilterFn, column_getCanFilter, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getIsFiltered, column_setFilterValue, getDefaultColumnFiltersState, table_resetColumnFilters, table_setColumnFilters } from \"./columnFilteringFeature.utils.js\";\n\n//#region src/features/column-filtering/columnFilteringFeature.ts\n/**\n* Feature that adds per-column filtering state, options, and column/table filter APIs.\n*/\nconst columnFilteringFeature = {\n\tgetInitialState: (initialState) => {\n\t\treturn {\n\t\t\tcolumnFilters: getDefaultColumnFiltersState(),\n\t\t\t...initialState\n\t\t};\n\t},\n\tgetDefaultColumnDef: () => {\n\t\treturn { filterFn: \"auto\" };\n\t},\n\tgetDefaultTableOptions: (table) => {\n\t\treturn {\n\t\t\tonColumnFiltersChange: makeStateUpdater(\"columnFilters\", table),\n\t\t\tfilterFromLeafRows: false,\n\t\t\tmaxLeafRowFilterDepth: 100\n\t\t};\n\t},\n\tassignColumnPrototype: (prototype, table) => {\n\t\tassignPrototypeAPIs(\"columnFilteringFeature\", prototype, table, {\n\t\t\tcolumn_getAutoFilterFn: { fn: (column) => column_getAutoFilterFn(column) },\n\t\t\tcolumn_getFilterFn: { fn: (column) => column_getFilterFn(column) },\n\t\t\tcolumn_getCanFilter: { fn: (column) => column_getCanFilter(column) },\n\t\t\tcolumn_getIsFiltered: { fn: (column) => column_getIsFiltered(column) },\n\t\t\tcolumn_getFilterValue: { fn: (column) => column_getFilterValue(column) },\n\t\t\tcolumn_getFilterIndex: { fn: (column) => column_getFilterIndex(column) },\n\t\t\tcolumn_setFilterValue: { fn: (column, value) => column_setFilterValue(column, value) }\n\t\t});\n\t},\n\tinitRowInstanceData: (row) => {\n\t\trow.columnFilters = makeObjectMap();\n\t\trow.columnFiltersMeta = makeObjectMap();\n\t},\n\tconstructTableAPIs: (table) => {\n\t\tassignTableAPIs(\"columnFilteringFeature\", table, {\n\t\t\ttable_setColumnFilters: { fn: (updater) => table_setColumnFilters(table, updater) },\n\t\t\ttable_resetColumnFilters: { fn: (defaultState) => table_resetColumnFilters(table, defaultState) }\n\t\t});\n\t}\n};\n\n//#endregion\nexport { columnFilteringFeature };","//#region src/features/column-filtering/filterFns.ts\n/**\n* Builds a `FilterFn` from a value-level comparator plus optional resolvers.\n*\n* The `filter` comparator receives the row's data value (already passed\n* through `resolveDataValue` when one is defined) and the filter value\n* (already passed through `resolveFilterValue` by the table). Keeping\n* normalization in the resolvers means a variant of an existing filter\n* function only has to swap the resolvers, not re-implement the comparison.\n*\n* The definition is attached to the returned function, so a variant can be\n* created by spreading a built-in filter function and overriding what differs:\n*\n* ```ts\n* const normalize = (value: unknown) =>\n* String(value ?? '')\n* .toLowerCase()\n* .normalize('NFD')\n* .replace(/\\p{Diacritic}/gu, '')\n*\n* const includesStringIgnoreDiacritics = constructFilterFn({\n* ...filterFn_includesString,\n* resolveFilterValue: normalize,\n* resolveDataValue: normalize,\n* })\n* ```\n*\n* Note: the table applies `resolveFilterValue` once per filter before any rows\n* are tested. When calling a filter function directly (outside of a table),\n* apply it yourself: `fn(row, columnId, fn.resolveFilterValue?.(value) ?? value)`.\n*/\nfunction constructFilterFn(def) {\n\tconst filterFn = Object.assign((row, columnId, filterValue, addMeta) => {\n\t\tconst rawValue = row.getValue(columnId);\n\t\tconst dataValue = filterFn.resolveDataValue ? filterFn.resolveDataValue(rawValue) : rawValue;\n\t\treturn filterFn.filter(dataValue, filterValue, row, columnId, addMeta);\n\t}, def);\n\treturn filterFn;\n}\n/**\n* Keeps rows whose column value is strictly equal to the filter value.\n*\n* Uses JavaScript `===` comparison and auto-removes empty filter values.\n*/\nconst filterFn_equals = constructFilterFn({\n\tfilter: (dataValue, filterValue) => dataValue === filterValue,\n\tautoRemove: (val) => testFalsy(val)\n});\n/**\n* Keeps rows whose column value is loosely equal to the filter value.\n*\n* Uses JavaScript `==` comparison and auto-removes empty filter values. This is\n* useful for matching string input against numeric row values.\n*/\nconst filterFn_weakEquals = constructFilterFn({\n\tfilter: (dataValue, filterValue) => dataValue == filterValue,\n\tautoRemove: (val) => testFalsy(val)\n});\n/**\n* Keeps rows whose stringified column value includes the filter text.\n*\n* Matching is case-sensitive and empty filter values are auto-removed.\n*/\nconst filterFn_includesStringSensitive = constructFilterFn({\n\tfilter: (dataValue, filterValue) => Boolean(dataValue?.includes(filterValue)),\n\tautoRemove: (val) => testFalsy(val),\n\tresolveFilterValue: (val) => String(val),\n\tresolveDataValue: (val) => val == null ? void 0 : String(val)\n});\n/**\n* Keeps rows whose stringified column value includes the filter text.\n*\n* Both values are lowercased before comparison, and empty filter values are\n* auto-removed.\n*/\nconst filterFn_includesString = constructFilterFn({\n\tfilter: (dataValue, filterValue) => Boolean(dataValue?.includes(filterValue)),\n\tautoRemove: (val) => testFalsy(val),\n\tresolveFilterValue: (val) => String(val).toLowerCase(),\n\tresolveDataValue: (val) => val == null ? void 0 : String(val).toLowerCase()\n});\n/**\n* Keeps rows whose stringified column value equals the filter text.\n*\n* Both values are lowercased before comparison, and empty filter values are\n* auto-removed.\n*/\nconst filterFn_equalsString = constructFilterFn({\n\tfilter: (dataValue, filterValue) => dataValue === filterValue,\n\tautoRemove: (val) => testFalsy(val),\n\tresolveFilterValue: (val) => String(val).toLowerCase(),\n\tresolveDataValue: (val) => val == null ? void 0 : String(val).toLowerCase()\n});\n/**\n* Keeps rows whose stringified column value exactly equals the filter text.\n*\n* Matching is case-sensitive and empty filter values are auto-removed.\n*/\nconst filterFn_equalsStringSensitive = constructFilterFn({\n\tfilter: (dataValue, filterValue) => dataValue === filterValue,\n\tautoRemove: (val) => testFalsy(val),\n\tresolveFilterValue: (val) => String(val),\n\tresolveDataValue: (val) => val == null ? void 0 : String(val)\n});\n/**\n* Keeps rows whose stringified column value starts with the filter text.\n*\n* Both values are lowercased before comparison, and empty filter values are\n* auto-removed.\n*/\nconst filterFn_startsWith = constructFilterFn({\n\tfilter: (dataValue, filterValue) => Boolean(dataValue?.startsWith(filterValue)),\n\tautoRemove: (val) => testFalsy(val),\n\tresolveFilterValue: (val) => String(val).toLowerCase(),\n\tresolveDataValue: (val) => val == null ? void 0 : String(val).toLowerCase()\n});\n/**\n* Keeps rows whose stringified column value ends with the filter text.\n*\n* Both values are lowercased before comparison, and empty filter values are\n* auto-removed.\n*/\nconst filterFn_endsWith = constructFilterFn({\n\tfilter: (dataValue, filterValue) => Boolean(dataValue?.endsWith(filterValue)),\n\tautoRemove: (val) => testFalsy(val),\n\tresolveFilterValue: (val) => String(val).toLowerCase(),\n\tresolveDataValue: (val) => val == null ? void 0 : String(val).toLowerCase()\n});\n/**\n* Keeps rows whose column value is empty.\n*\n* A value is empty when it is nullish or stringifies to whitespace only. The\n* filter value acts as an on/off flag: `false` and blank values are\n* auto-removed.\n*/\nconst filterFn_empty = constructFilterFn({\n\tfilter: (dataValue) => testValueEmpty(dataValue),\n\tautoRemove: (val) => testFalsy(val) || val === false\n});\n/**\n* Keeps rows whose column value is not empty.\n*\n* A value is empty when it is nullish or stringifies to whitespace only. The\n* filter value acts as an on/off flag: `false` and blank values are\n* auto-removed.\n*/\nconst filterFn_notEmpty = constructFilterFn({\n\tfilter: (dataValue) => !testValueEmpty(dataValue),\n\tautoRemove: (val) => testFalsy(val) || val === false\n});\n/**\n* Keeps rows whose value is greater than the filter value.\n*\n* Numeric values are compared numerically when both sides can be coerced to\n* numbers; otherwise normalized strings are compared.\n*/\nconst filterFn_greaterThan = constructFilterFn({\n\tfilter: (dataValue, filterValue) => compareGreaterThan(dataValue, filterValue),\n\tautoRemove: (val) => testFalsy(val)\n});\n/**\n* Keeps rows whose value is greater than or equal to the filter value.\n*\n* Delegates to the built-in greater-than and strict-equality comparisons.\n*/\nconst filterFn_greaterThanOrEqualTo = constructFilterFn({\n\tfilter: (dataValue, filterValue) => compareGreaterThanOrEqualTo(dataValue, filterValue),\n\tautoRemove: (val) => testFalsy(val)\n});\n/**\n* Keeps rows whose value is less than the filter value.\n*\n* This is implemented as the inverse of greater-than-or-equal comparison.\n*/\nconst filterFn_lessThan = constructFilterFn({\n\tfilter: (dataValue, filterValue) => !compareGreaterThanOrEqualTo(dataValue, filterValue),\n\tautoRemove: (val) => testFalsy(val)\n});\n/**\n* Keeps rows whose value is less than or equal to the filter value.\n*\n* This is implemented as the inverse of greater-than comparison.\n*/\nconst filterFn_lessThanOrEqualTo = constructFilterFn({\n\tfilter: (dataValue, filterValue) => !compareGreaterThan(dataValue, filterValue),\n\tautoRemove: (val) => testFalsy(val)\n});\n/**\n* Keeps rows whose value falls between an exclusive min/max pair.\n*\n* Blank range endpoints are treated as open-ended.\n*/\nconst filterFn_between = constructFilterFn({\n\tfilter: (dataValue, filterValues) => compareBetween(dataValue, filterValues, false),\n\tautoRemove: (val) => testFalsy(val) || Array.isArray(val) && testFalsy(val[0]) && testFalsy(val[1])\n});\n/**\n* Keeps rows whose value falls between an inclusive min/max pair.\n*\n* Blank range endpoints are treated as open-ended.\n*/\nconst filterFn_betweenInclusive = constructFilterFn({\n\tfilter: (dataValue, filterValues) => compareBetween(dataValue, filterValues, true),\n\tautoRemove: (val) => testFalsy(val) || Array.isArray(val) && testFalsy(val[0]) && testFalsy(val[1])\n});\n/**\n* Keeps rows whose numeric value is inside an inclusive `[min, max]` range.\n*\n* Filter values are normalized so blank endpoints become open-ended and\n* reversed endpoints are swapped. Only real numbers can fall inside the\n* range: non-numeric row values (`null`, `undefined`, strings, booleans)\n* never match.\n*/\nconst filterFn_inNumberRange = constructFilterFn({\n\tfilter: (dataValue, filterValue) => {\n\t\tif (typeof dataValue !== \"number\" || Number.isNaN(dataValue)) return false;\n\t\tconst [min, max] = filterValue;\n\t\treturn dataValue >= min && dataValue <= max;\n\t},\n\tresolveFilterValue: (val) => {\n\t\tconst [unsafeMin, unsafeMax] = val;\n\t\tconst parsedMin = typeof unsafeMin !== \"number\" ? parseFloat(unsafeMin) : unsafeMin;\n\t\tconst parsedMax = typeof unsafeMax !== \"number\" ? parseFloat(unsafeMax) : unsafeMax;\n\t\tlet min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;\n\t\tlet max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;\n\t\tif (min > max) {\n\t\t\tconst temp = min;\n\t\t\tmin = max;\n\t\t\tmax = temp;\n\t\t}\n\t\treturn [min, max];\n\t},\n\tautoRemove: (val) => testFalsy(val) || Array.isArray(val) && testFalsy(val[0]) && testFalsy(val[1])\n});\n/**\n* Keeps rows whose date value is inside an inclusive `[min, max]` date range.\n*\n* Row values and range endpoints may be `Date` objects, timestamps, or\n* parseable date strings. Blank or invalid endpoints become open-ended and\n* reversed endpoints are swapped. Rows without a valid date never match.\n*/\nconst filterFn_inDateRange = constructFilterFn({\n\tfilter: (dataValue, filterValue) => {\n\t\tconst [min, max] = filterValue;\n\t\treturn dataValue >= min && dataValue <= max;\n\t},\n\tresolveFilterValue: (val) => {\n\t\tconst [unsafeMin, unsafeMax] = val;\n\t\tconst parsedMin = toDateTimestamp(unsafeMin);\n\t\tconst parsedMax = toDateTimestamp(unsafeMax);\n\t\tlet min = Number.isNaN(parsedMin) ? -Infinity : parsedMin;\n\t\tlet max = Number.isNaN(parsedMax) ? Infinity : parsedMax;\n\t\tif (min > max) {\n\t\t\tconst temp = min;\n\t\t\tmin = max;\n\t\t\tmax = temp;\n\t\t}\n\t\treturn [min, max];\n\t},\n\tresolveDataValue: (val) => toDateTimestamp(val),\n\tautoRemove: (val) => testFalsy(val) || Array.isArray(val) && testFalsy(val[0]) && testFalsy(val[1])\n});\n/**\n* Keeps rows whose scalar column value equals at least one filter value.\n*/\nconst filterFn_arrHas = constructFilterFn({\n\tfilter: (dataValue, filterValue) => {\n\t\tfor (let i = 0; i < filterValue.length; i++) if (dataValue === filterValue[i]) return true;\n\t\treturn false;\n\t},\n\tautoRemove: (val) => testFalsy(val) || !val?.length\n});\n/**\n* Keeps rows whose array or string column value includes at least one filter value.\n*/\nconst filterFn_arrIncludes = constructFilterFn({\n\tfilter: (dataValue, filterValue) => {\n\t\tif (typeof dataValue !== \"string\" && !Array.isArray(dataValue)) return false;\n\t\tfor (let i = 0; i < filterValue.length; i++) if (dataValue.includes(filterValue[i])) return true;\n\t\treturn false;\n\t},\n\tautoRemove: (val) => testFalsy(val) || !val?.length\n});\n/**\n* Keeps rows whose array column value includes every filter value.\n*/\nconst filterFn_arrIncludesAll = constructFilterFn({\n\tfilter: (dataValue, filterValue) => {\n\t\tif (!Array.isArray(dataValue)) return false;\n\t\tfor (let i = 0; i < filterValue.length; i++) if (!dataValue.includes(filterValue[i])) return false;\n\t\treturn true;\n\t},\n\tautoRemove: (val) => testFalsy(val) || !val?.length\n});\n/**\n* Keeps rows whose array column value includes at least one filter value.\n*/\nconst filterFn_arrIncludesSome = constructFilterFn({\n\tfilter: (dataValue, filterValue) => {\n\t\tif (!Array.isArray(dataValue)) return false;\n\t\tfor (let i = 0; i < filterValue.length; i++) if (dataValue.includes(filterValue[i])) return true;\n\t\treturn false;\n\t},\n\tautoRemove: (val) => testFalsy(val) || !val?.length\n});\n/**\n* The built-in filter function registry.\n*\n* Registering this full object opts out of tree-shaking: every built-in\n* filter function ends up in your bundle. Prefer importing the `filterFn_*`\n* functions you actually use and registering just those in the `filterFns`\n* slot, or passing them directly to the `filterFn` column option.\n*\n* @deprecated Import individual `filterFn_*` functions instead for a smaller\n* bundle. This export still works and is not going away in v9, but built-in\n* name resolution (including `filterFn: 'auto'`) only finds functions you\n* register yourself.\n*/\nconst filterFns = {\n\tarrIncludes: filterFn_arrIncludes,\n\tarrIncludesAll: filterFn_arrIncludesAll,\n\tarrHas: filterFn_arrHas,\n\tarrIncludesSome: filterFn_arrIncludesSome,\n\tbetween: filterFn_between,\n\tbetweenInclusive: filterFn_betweenInclusive,\n\tempty: filterFn_empty,\n\tendsWith: filterFn_endsWith,\n\tequals: filterFn_equals,\n\tequalsString: filterFn_equalsString,\n\tequalsStringSensitive: filterFn_equalsStringSensitive,\n\tinDateRange: filterFn_inDateRange,\n\tinNumberRange: filterFn_inNumberRange,\n\tincludesString: filterFn_includesString,\n\tincludesStringSensitive: filterFn_includesStringSensitive,\n\tnotEmpty: filterFn_notEmpty,\n\tstartsWith: filterFn_startsWith,\n\tweakEquals: filterFn_weakEquals\n};\nfunction testFalsy(val) {\n\treturn val === void 0 || val === null || val === \"\";\n}\nfunction testValueEmpty(dataValue) {\n\treturn dataValue == null || String(dataValue).trim() === \"\";\n}\nfunction toDateTimestamp(value) {\n\tif (value instanceof Date) return value.getTime();\n\tif (typeof value === \"number\") return value;\n\tif (value == null || value === \"\") return NaN;\n\treturn new Date(value).getTime();\n}\nfunction compareGreaterThan(dataValue, filterValue) {\n\tconst numericDataValue = dataValue == null ? 0 : +dataValue;\n\tconst numericFilterValue = Number(filterValue);\n\tif (!isNaN(numericFilterValue) && !isNaN(numericDataValue)) return numericDataValue > numericFilterValue;\n\treturn String(dataValue ?? \"\").toLowerCase().trim() > String(filterValue).toLowerCase().trim();\n}\nfunction compareGreaterThanOrEqualTo(dataValue, filterValue) {\n\treturn dataValue === filterValue || compareGreaterThan(dataValue, filterValue);\n}\nfunction compareBetween(dataValue, filterValues, inclusive) {\n\tconst min = filterValues[0];\n\tconst hasMin = min !== \"\" && min !== void 0;\n\tif (hasMin) {\n\t\tif (!(inclusive ? compareGreaterThanOrEqualTo(dataValue, min) : compareGreaterThan(dataValue, min))) return false;\n\t}\n\tconst max = filterValues[1];\n\tif (max === \"\" || max === void 0) return true;\n\tif (hasMin) {\n\t\tconst numericMin = Number(min);\n\t\tconst numericMax = Number(max);\n\t\tif (!isNaN(numericMin) && !isNaN(numericMax) && numericMin > numericMax) return true;\n\t}\n\treturn inclusive ? !compareGreaterThan(dataValue, max) : !compareGreaterThanOrEqualTo(dataValue, max);\n}\n\n//#endregion\nexport { constructFilterFn, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, filterFns };","import { cloneState, isFunction } from \"../../utils.js\";\nimport { filterFn_includesString } from \"../column-filtering/filterFns.js\";\n\n//#region src/features/global-filtering/globalFilteringFeature.utils.ts\n/**\n* Checks whether this accessor column participates in global filtering.\n*\n* The column must have an accessor and pass column-level, table-level, and\n* optional `getColumnCanGlobalFilter` checks.\n*\n* @example\n* ```ts\n* const canGlobalFilter = column_getCanGlobalFilter(column)\n* ```\n*/\nfunction column_getCanGlobalFilter(column) {\n\treturn (column.columnDef.enableGlobalFilter ?? true) && (column.table.options.enableGlobalFilter ?? true) && (column.table.options.enableFilters ?? true) && (column.table.options.getColumnCanGlobalFilter?.(column) ?? true) && !!column.accessorFn;\n}\n/**\n* Provides the built-in automatic global filter function.\n*\n* Global filtering defaults to `includesString`, which gives search-box style\n* matching across globally filterable columns.\n*\n* @example\n* ```ts\n* const filterFn = table_getGlobalAutoFilterFn()\n* ```\n*/\nfunction table_getGlobalAutoFilterFn() {\n\treturn filterFn_includesString;\n}\n/**\n* Resolves the filter function used for global filtering.\n*\n* Function-valued `options.globalFilterFn` is returned directly, `'auto'`\n* delegates to `table_getGlobalAutoFilterFn`, and string values are looked up in\n* the table's filter function registry.\n*\n* @example\n* ```ts\n* const filterFn = table_getGlobalFilterFn(table)\n* ```\n*/\nfunction table_getGlobalFilterFn(table) {\n\tconst { globalFilterFn } = table.options;\n\tconst filterFns = table._rowModelFns.filterFns;\n\tconst filterFn = isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === \"auto\" ? table_getGlobalAutoFilterFn() : filterFns?.[globalFilterFn];\n\tif (process.env.NODE_ENV === \"development\" && !filterFn && globalFilterFn != null) console.warn(`globalFilterFn '${String(globalFilterFn)}' is not registered`);\n\treturn filterFn;\n}\n/**\n* Routes a global filter updater through the table's global filter handler.\n*\n* The updater may be a next value or a function of the previous value, matching\n* the instance `table.setGlobalFilter` behavior.\n*\n* @example\n* ```ts\n* table_setGlobalFilter(table, 'search text')\n* ```\n*/\nfunction table_setGlobalFilter(table, updater) {\n\ttable.options.onGlobalFilterChange?.(updater);\n}\n/**\n* Resets `globalFilter` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.globalFilter`. Passing\n* `true` ignores initial state and resets to `undefined`.\n*\n* @example\n* ```ts\n* table_resetGlobalFilter(table)\n* table_resetGlobalFilter(table, true)\n* ```\n*/\nfunction table_resetGlobalFilter(table, defaultState) {\n\ttable_setGlobalFilter(table, defaultState ? void 0 : cloneState(table.initialState.globalFilter));\n}\n\n//#endregion\nexport { column_getCanGlobalFilter, table_getGlobalAutoFilterFn, table_getGlobalFilterFn, table_resetGlobalFilter, table_setGlobalFilter };","import { assignPrototypeAPIs, assignTableAPIs, makeStateUpdater } from \"../../utils.js\";\nimport { column_getCanGlobalFilter, table_getGlobalAutoFilterFn, table_getGlobalFilterFn, table_resetGlobalFilter, table_setGlobalFilter } from \"./globalFilteringFeature.utils.js\";\n\n//#region src/features/global-filtering/globalFilteringFeature.ts\n/**\n* Feature that adds global filtering state, defaults, and global filter APIs.\n*/\nconst globalFilteringFeature = {\n\tgetInitialState: (initialState) => {\n\t\treturn {\n\t\t\tglobalFilter: void 0,\n\t\t\t...initialState\n\t\t};\n\t},\n\tgetDefaultTableOptions: (table) => {\n\t\treturn {\n\t\t\tonGlobalFilterChange: makeStateUpdater(\"globalFilter\", table),\n\t\t\tglobalFilterFn: \"auto\",\n\t\t\tgetColumnCanGlobalFilter: (column) => {\n\t\t\t\tif (\"enableGlobalFilter\" in column.columnDef && column.columnDef.enableGlobalFilter === true) return true;\n\t\t\t\tconst value = table.getCoreRowModel().flatRows.find((row) => row.getAllCellsByColumnId()[column.id]?.getValue() != null)?.getAllCellsByColumnId()[column.id]?.getValue();\n\t\t\t\treturn typeof value === \"string\" || typeof value === \"number\";\n\t\t\t}\n\t\t};\n\t},\n\tassignColumnPrototype: (prototype, table) => {\n\t\tassignPrototypeAPIs(\"globalFilteringFeature\", prototype, table, { column_getCanGlobalFilter: { fn: (column) => column_getCanGlobalFilter(column) } });\n\t},\n\tconstructTableAPIs: (table) => {\n\t\tassignTableAPIs(\"globalFilteringFeature\", table, {\n\t\t\ttable_getGlobalAutoFilterFn: { fn: () => table_getGlobalAutoFilterFn() },\n\t\t\ttable_getGlobalFilterFn: { fn: () => table_getGlobalFilterFn(table) },\n\t\t\ttable_setGlobalFilter: { fn: (updater) => table_setGlobalFilter(table, updater) },\n\t\t\ttable_resetGlobalFilter: { fn: (defaultState) => table_resetGlobalFilter(table, defaultState) }\n\t\t});\n\t}\n};\n\n//#endregion\nexport { globalFilteringFeature };","import { callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, hasOwn, makeObjectMap } from \"../../utils.js\";\n\n//#region src/features/row-selection/rowSelectionFeature.utils.ts\n/**\n* Creates the default row selection state.\n*\n* The feature default is an empty map, meaning no rows are selected. Reset APIs\n* use this value when `defaultState` is `true`.\n*\n* @example\n* ```ts\n* const selection = getDefaultRowSelectionState()\n* ```\n*/\nfunction getDefaultRowSelectionState() {\n\treturn makeObjectMap();\n}\n/**\n* Routes a row selection updater through the table's selection change handler.\n*\n* The updater may be a next selection map or a function of the previous map,\n* matching the instance `table.setRowSelection` behavior.\n*\n* @example\n* ```ts\n* table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n* ```\n*/\nfunction table_setRowSelection(table, updater) {\n\ttable.options.onRowSelectionChange?.(updater);\n}\n/**\n* Resets `rowSelection` to the configured initial state or feature default.\n*\n* With no argument, the reset clones `table.initialState.rowSelection` when it\n* exists. Passing `true` ignores initial state and resets to `{}`.\n*\n* @example\n* ```ts\n* table_resetRowSelection(table)\n* table_resetRowSelection(table, true)\n* ```\n*/\nfunction table_resetRowSelection(table, defaultState) {\n\ttable._lastSelectedRowId = null;\n\ttable_setRowSelection(table, defaultState ? makeObjectMap() : Object.assign(makeObjectMap(), cloneState(table.initialState.rowSelection ?? {})));\n}\n/**\n* Selects or deselects every selectable row before grouping.\n*\n* Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n* Selecting skips sub-rows whose ancestors block descent via\n* `enableSubRowSelection`. Deselecting removes matching selectable ids from the\n* existing selection map; rows that cannot be selected keep their selection\n* unless `opts.deselectAll` is `true`.\n*\n* @example\n* ```ts\n* table_toggleAllRowsSelected(table)\n* ```\n*/\nfunction table_toggleAllRowsSelected(table, value, opts) {\n\ttable._lastSelectedRowId = null;\n\ttable_setRowSelection(table, (old) => {\n\t\tvalue = typeof value !== \"undefined\" ? value : !callMemoOrStaticFn(table, \"getIsAllRowsSelected\", table_getIsAllRowsSelected);\n\t\tif (opts?.deselectAll && !value) return makeObjectMap();\n\t\tconst rowSelection = Object.assign(makeObjectMap(), old);\n\t\tconst preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;\n\t\tif (value) {\n\t\t\tconst subtreeCache = /* @__PURE__ */ new Map();\n\t\t\tpreGroupedFlatRows.forEach((row) => {\n\t\t\t\tif (isRowSelectableInSelectAll(row, subtreeCache)) rowSelection[row.id] = true;\n\t\t\t});\n\t\t} else preGroupedFlatRows.forEach((row) => {\n\t\t\tif (row_getCanSelect(row)) delete rowSelection[row.id];\n\t\t});\n\t\treturn rowSelection;\n\t});\n}\n/**\n* Selects or deselects every selectable row on the current page.\n*\n* Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n* Child rows are included when sub-row selection allows it.\n*\n* @example\n* ```ts\n* table_toggleAllPageRowsSelected(table)\n* ```\n*/\nfunction table_toggleAllPageRowsSelected(table, value, opts) {\n\ttable._lastSelectedRowId = null;\n\ttable_setRowSelection(table, (old) => {\n\t\tconst resolvedValue = typeof value !== \"undefined\" ? value : !callMemoOrStaticFn(table, \"getIsAllPageRowsSelected\", table_getIsAllPageRowsSelected);\n\t\tif (opts?.deselectAll && !resolvedValue) return makeObjectMap();\n\t\tconst rowSelection = Object.assign(makeObjectMap(), old);\n\t\ttable.getRowModel().rows.forEach((row) => {\n\t\t\tmutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table, true);\n\t\t});\n\t\treturn rowSelection;\n\t});\n}\n/**\n* Reads the row model before row selection is projected into selected rows.\n*\n* Selection does not alter the base row pipeline, so this returns the core row\n* model.\n*\n* @example\n* ```ts\n* const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n* ```\n*/\nfunction table_getPreSelectedRowModel(table) {\n\treturn table.getCoreRowModel();\n}\n/**\n* Builds a row model containing selected rows from the core row model.\n*\n* If no row ids are selected, an empty row model is returned without walking\n* the rows.\n*\n* @example\n* ```ts\n* const selectedRows = table_getSelectedRowModel(table)\n* ```\n*/\nfunction table_getSelectedRowModel(table) {\n\tconst rowModel = table.getCoreRowModel();\n\tif (!callMemoOrStaticFn(table, \"getIsSomeRowsSelected\", table_getIsSomeRowsSelected)) return {\n\t\trows: [],\n\t\tflatRows: [],\n\t\trowsById: makeObjectMap()\n\t};\n\treturn selectRowsFn(rowModel, table);\n}\n/**\n* Builds a row model containing selected rows from the filtered row model.\n*\n* If no row ids are selected, an empty row model is returned without walking\n* the rows.\n*\n* @example\n* ```ts\n* const selectedRows = table_getFilteredSelectedRowModel(table)\n* ```\n*/\nfunction table_getFilteredSelectedRowModel(table) {\n\tconst rowModel = table.getFilteredRowModel();\n\tif (!callMemoOrStaticFn(table, \"getIsSomeRowsSelected\", table_getIsSomeRowsSelected)) return {\n\t\trows: [],\n\t\tflatRows: [],\n\t\trowsById: makeObjectMap()\n\t};\n\treturn selectRowsFn(rowModel, table);\n}\n/**\n* Builds a row model containing selected rows from the grouped row model.\n*\n* If no row ids are selected, an empty row model is returned without walking\n* the rows.\n*\n* @example\n* ```ts\n* const selectedRows = table_getGroupedSelectedRowModel(table)\n* ```\n*/\nfunction table_getGroupedSelectedRowModel(table) {\n\tconst rowModel = table.getSortedRowModel();\n\tif (!callMemoOrStaticFn(table, \"getIsSomeRowsSelected\", table_getIsSomeRowsSelected)) return {\n\t\trows: [],\n\t\tflatRows: [],\n\t\trowsById: makeObjectMap()\n\t};\n\treturn selectRowsFn(rowModel, table);\n}\n/**\n* Returns the ids of all selected rows.\n*\n* @example\n* ```ts\n* const selectedRowIds = table_getSelectedRowIds(table)\n* ```\n*/\nfunction table_getSelectedRowIds(table) {\n\treturn Object.keys(table.atoms.rowSelection?.get() ?? {});\n}\n/**\n* Checks whether every selectable filtered row is selected.\n*\n* The result is false when there are no filtered rows or when selection state is\n* empty. Sub-rows whose ancestors block descent via `enableSubRowSelection` are\n* ignored, matching the rows that `table_toggleAllRowsSelected` selects.\n*\n* @example\n* ```ts\n* const allSelected = table_getIsAllRowsSelected(table)\n* ```\n*/\nfunction table_getIsAllRowsSelected(table) {\n\tconst preGroupedFlatRows = table.getFilteredRowModel().flatRows;\n\tconst rowSelection = table.atoms.rowSelection?.get() ?? {};\n\tlet isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);\n\tif (isAllRowsSelected) {\n\t\tconst subtreeCache = /* @__PURE__ */ new Map();\n\t\tif (preGroupedFlatRows.some((row) => !isRowSelected(row, rowSelection) && isRowSelectableInSelectAll(row, subtreeCache))) isAllRowsSelected = false;\n\t}\n\treturn isAllRowsSelected;\n}\n/**\n* Checks whether every selectable row on the current page is selected.\n*\n* Non-selectable rows are ignored for this calculation, as are sub-rows whose\n* ancestors block descent via `enableSubRowSelection`.\n*\n* @example\n* ```ts\n* const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n* ```\n*/\nfunction table_getIsAllPageRowsSelected(table) {\n\tconst paginationFlatRows = table.getPaginatedRowModel().flatRows;\n\tconst rowSelection = table.atoms.rowSelection?.get() ?? {};\n\tconst subtreeCache = /* @__PURE__ */ new Map();\n\tlet sawSelectableRow = false;\n\tfor (let i = 0; i < paginationFlatRows.length; i++) {\n\t\tconst row = paginationFlatRows[i];\n\t\tif (!isRowSelected(row, rowSelection)) {\n\t\t\tif (isRowSelectableInSelectAll(row, subtreeCache)) return false;\n\t\t} else if (!sawSelectableRow && isRowSelectableInSelectAll(row, subtreeCache)) sawSelectableRow = true;\n\t}\n\treturn sawSelectableRow;\n}\n/**\n* Checks whether at least one row id is selected.\n*\n* The result stays true when every row is selected.\n*\n* @example\n* ```ts\n* const someRowsSelected = table_getIsSomeRowsSelected(table)\n* ```\n*/\nfunction table_getIsSomeRowsSelected(table) {\n\treturn callMemoOrStaticFn(table, \"getSelectedRowIds\", table_getSelectedRowIds).length > 0;\n}\n/**\n* Checks whether at least one selectable row on the current page is selected.\n*\n* @example\n* ```ts\n* const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n* ```\n*/\nfunction table_getIsSomePageRowsSelected(table) {\n\treturn table.getPaginatedRowModel().flatRows.filter((row) => row_getCanSelect(row)).some((row) => row_getIsSelected(row) || callMemoOrStaticFn(row, \"getIsSomeSelected\", row_getIsSomeSelected));\n}\n/**\n* Creates a checkbox-style handler that selects or deselects all rows.\n*\n* The handler reads `event.target.checked`, so it is intended for controls whose\n* checked state means \"all rows selected\".\n*\n* @example\n* ```ts\n* const onChange = table_getToggleAllRowsSelectedHandler(table)\n* ```\n*/\nfunction table_getToggleAllRowsSelectedHandler(table) {\n\treturn (e) => {\n\t\ttable_toggleAllRowsSelected(table, e.target.checked);\n\t};\n}\n/**\n* Creates a checkbox-style handler that selects or deselects current page rows.\n*\n* The handler reads `event.target.checked`, so it is intended for controls whose\n* checked state means \"all page rows selected\".\n*\n* @example\n* ```ts\n* const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n* ```\n*/\nfunction table_getToggleAllPageRowsSelectedHandler(table) {\n\treturn (e) => {\n\t\ttable_toggleAllPageRowsSelected(table, e.target.checked);\n\t};\n}\n/**\n* Selects or deselects this row.\n*\n* Omitting `value` toggles the row. Child rows are selected recursively unless\n* `opts.selectChildren` is `false`, sub-row selection is disabled, or the row\n* only supports single selection. Pass `deselectParents: true` to also remove\n* ancestor row ids from the selection when this row is deselected.\n*\n* @example\n* ```ts\n* row_toggleSelected(row)\n* row_toggleSelected(row, true)\n* row_toggleSelected(row, false)\n* row_toggleSelected(row, true, { selectChildren: false })\n* row_toggleSelected(row, false, { deselectParents: true })\n* ```\n*/\nfunction row_toggleSelected(row, value, opts) {\n\tconst isSelected = row_getIsSelected(row);\n\ttable_setRowSelection(row.table, (old) => {\n\t\tvalue = typeof value !== \"undefined\" ? value : !isSelected;\n\t\tconst rowSelection = Object.assign(makeObjectMap(), old);\n\t\tmutateRowIsSelected(rowSelection, row.id, value, (opts?.selectChildren ?? true) && row_getCanMultiSelect(row), row.table);\n\t\tif (!value && opts?.deselectParents) pruneAncestorRowIds(rowSelection, row);\n\t\treturn rowSelection;\n\t});\n}\n/**\n* Checks whether this row id is selected in `state.rowSelection`.\n*\n* Missing row ids are treated as not selected.\n*\n* @example\n* ```ts\n* const selected = row_getIsSelected(row)\n* ```\n*/\nfunction row_getIsSelected(row) {\n\treturn isRowSelected(row, row.table.atoms.rowSelection?.get() ?? {});\n}\n/**\n* Checks whether some, but not all, selectable descendants are selected.\n*\n* This supports indeterminate selection UI for parent rows.\n*\n* @example\n* ```ts\n* const partial = row_getIsSomeSelected(row)\n* ```\n*/\nfunction row_getIsSomeSelected(row) {\n\treturn isSubRowSelected(row) === \"some\";\n}\n/**\n* Checks whether all selectable descendants are selected.\n*\n* Rows without selectable descendants return false.\n*\n* @example\n* ```ts\n* const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n* ```\n*/\nfunction row_getIsAllSubRowsSelected(row) {\n\treturn isSubRowSelected(row) === \"all\";\n}\n/**\n* Checks whether this row can be selected.\n*\n* `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n* to `true`.\n*\n* @example\n* ```ts\n* const canSelect = row_getCanSelect(row)\n* ```\n*/\nfunction row_getCanSelect(row) {\n\tconst options = row.table.options;\n\tif (typeof options.enableRowSelection === \"function\") return options.enableRowSelection(row);\n\treturn options.enableRowSelection ?? true;\n}\n/**\n* Checks whether selecting this row should also select its subRows.\n*\n* `options.enableSubRowSelection` may be a boolean or a row predicate; it\n* defaults to `true`.\n*\n* @example\n* ```ts\n* const canSelectChildren = row_getCanSelectSubRows(row)\n* ```\n*/\nfunction row_getCanSelectSubRows(row) {\n\tconst options = row.table.options;\n\tif (typeof options.enableSubRowSelection === \"function\") return options.enableSubRowSelection(row);\n\treturn options.enableSubRowSelection ?? true;\n}\n/**\n* Checks whether this row can be selected alongside other rows.\n*\n* `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n* defaults to `true`.\n*\n* @example\n* ```ts\n* const canMultiSelect = row_getCanMultiSelect(row)\n* ```\n*/\nfunction row_getCanMultiSelect(row) {\n\tconst options = row.table.options;\n\tif (typeof options.enableMultiRowSelection === \"function\") return options.enableMultiRowSelection(row);\n\treturn options.enableMultiRowSelection ?? true;\n}\n/**\n* Creates a checkbox-style handler that selects or deselects this row.\n*\n* The handler is a no-op when the row cannot be selected and reads\n* `event.target.checked`. Shift events select or deselect the inclusive range\n* from the most recent selectable row handled by this table. Pass\n* `selectChildren: false` to limit changes to rows explicitly present in the\n* display-order interval, and `deselectParents: true` to remove ancestor row\n* ids from the selection when rows are deselected.\n*\n* @example\n* ```ts\n* const onChange = row_getToggleSelectedHandler(row)\n* ```\n*/\nfunction row_getToggleSelectedHandler(row, opts) {\n\tconst canSelect = row_getCanSelect(row);\n\treturn (e) => {\n\t\tif (!canSelect) return;\n\t\tconst event = e;\n\t\tconst table = row.table;\n\t\tconst checked = event.target.checked;\n\t\tconst anchorId = table._lastSelectedRowId;\n\t\tif (!(table.options.enableRowRangeSelection !== false && anchorId !== null && row_getCanMultiSelect(row) && (table.options.isRowRangeSelectionEvent?.(e) ?? false)) || !selectRowRange(row, anchorId, checked, opts)) row_toggleSelected(row, checked, opts);\n\t\ttable._lastSelectedRowId = row.id;\n\t};\n}\n/**\n* Resolves and mutates an inclusive interval in the table's latest logical\n* display order.\n*\n* The anchor is resolved without throwing from the pre-pagination row model,\n* then the core row model. Both endpoint display indexes must still identify\n* those rows in the current order and both endpoints must support\n* multi-selection. Eligible interval rows are applied through one row\n* selection updater; non-selectable and non-multi-selectable rows are skipped.\n* Returns `false` when the interaction should fall back to an ordinary toggle.\n*/\nfunction selectRowRange(row, anchorId, value, opts) {\n\tconst includeChildren = opts?.selectChildren ?? true;\n\tconst table = row.table;\n\tconst rows = table.getRowsInDisplayOrder();\n\tconst anchorRow = table.getPrePaginatedRowModel().rowsById[anchorId] ?? table.getCoreRowModel().rowsById[anchorId];\n\tif (!anchorRow) return false;\n\tconst anchorIndex = anchorRow.getDisplayIndex();\n\tconst rowIndex = row.getDisplayIndex();\n\tconst anchorAtIndex = rows[anchorIndex];\n\tconst rowAtIndex = rows[rowIndex];\n\tif (anchorIndex < 0 || rowIndex < 0 || anchorIndex >= rows.length || rowIndex >= rows.length || anchorAtIndex?.id !== anchorRow.id || rowAtIndex?.id !== row.id || !row_getCanMultiSelect(anchorRow) || !row_getCanMultiSelect(row)) return false;\n\tconst start = Math.min(anchorIndex, rowIndex);\n\tconst end = Math.max(anchorIndex, rowIndex);\n\ttable_setRowSelection(table, (old) => {\n\t\tconst rowSelection = Object.assign(makeObjectMap(), old);\n\t\tfor (let index = start; index <= end; index++) {\n\t\t\tconst rangeRow = rows[index];\n\t\t\tif (!row_getCanSelect(rangeRow) || !row_getCanMultiSelect(rangeRow)) continue;\n\t\t\tmutateRowIsSelected(rowSelection, rangeRow.id, value, includeChildren, table);\n\t\t\tif (!value && opts?.deselectParents) pruneAncestorRowIds(rowSelection, rangeRow);\n\t\t}\n\t\treturn rowSelection;\n\t});\n\treturn true;\n}\nfunction mutateRowIsSelected(rowSelection, rowId, value, includeChildren, table, respectCanSelectOnDeselect) {\n\tconst row = table.getRow(rowId, true);\n\tif (value) {\n\t\tif (!row_getCanMultiSelect(row)) Object.keys(rowSelection).forEach((key) => delete rowSelection[key]);\n\t\tif (row_getCanSelect(row)) rowSelection[rowId] = true;\n\t} else if (!respectCanSelectOnDeselect || row_getCanSelect(row)) delete rowSelection[rowId];\n\tif (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) row.subRows.forEach((r) => mutateRowIsSelected(rowSelection, r.id, value, includeChildren, table, respectCanSelectOnDeselect));\n}\n/**\n* Returns whether a select-all cascade can reach this row: the row itself is\n* selectable and no ancestor blocks descent via `enableSubRowSelection`.\n*\n* `subtreeCache` memoizes the per-ancestor verdict for one select-all pass, so\n* ancestor chains shared by sibling rows are only walked (and the\n* `enableSubRowSelection` predicate only invoked) once per unique ancestor.\n*/\nfunction isRowSelectableInSelectAll(row, subtreeCache) {\n\tif (!row_getCanSelect(row)) return false;\n\tconst table = row.table;\n\tif (table.options.enableSubRowSelection === true) return true;\n\tconst parentId = row.parentId;\n\tif (parentId === void 0) return true;\n\tconst cached = subtreeCache.get(parentId);\n\tif (cached !== void 0) return cached;\n\tconst rowsById = table.getCoreRowModel().rowsById;\n\tconst visited = [];\n\tlet selectable = true;\n\tlet currentId = parentId;\n\twhile (currentId !== void 0) {\n\t\tconst known = subtreeCache.get(currentId);\n\t\tif (known !== void 0) {\n\t\t\tselectable = known;\n\t\t\tbreak;\n\t\t}\n\t\tvisited.push(currentId);\n\t\tconst parent = rowsById[currentId] ?? table.getRow(currentId, true);\n\t\tif (!row_getCanSelectSubRows(parent)) {\n\t\t\tselectable = false;\n\t\t\tbreak;\n\t\t}\n\t\tcurrentId = parent.parentId;\n\t}\n\tvisited.forEach((id) => subtreeCache.set(id, selectable));\n\treturn selectable;\n}\nfunction pruneAncestorRowIds(rowSelection, row) {\n\tconst rowsById = row.table.getCoreRowModel().rowsById;\n\tlet parentId = row.parentId;\n\twhile (parentId !== void 0) {\n\t\tdelete rowSelection[parentId];\n\t\tparentId = (rowsById[parentId] ?? row.table.getRow(parentId, true)).parentId;\n\t}\n}\nfunction selectRowsRecursively(rows, rowSelection, selectedFlatRows, selectedRowsById) {\n\tconst result = [];\n\tfor (let i = 0; i < rows.length; i++) {\n\t\tconst row = rows[i];\n\t\tconst isSelected = isRowSelected(row, rowSelection);\n\t\tif (isSelected) {\n\t\t\tselectedFlatRows.push(row);\n\t\t\tselectedRowsById[row.id] = row;\n\t\t}\n\t\tif (row.subRows.length) {\n\t\t\tconst newSubRows = selectRowsRecursively(row.subRows, rowSelection, selectedFlatRows, selectedRowsById);\n\t\t\tif (isSelected) {\n\t\t\t\tconst cloned = Object.create(Object.getPrototypeOf(row));\n\t\t\t\tcopyInstancePropertiesWithoutMemos(cloned, row);\n\t\t\t\tcloned.subRows = newSubRows;\n\t\t\t\tresult.push(cloned);\n\t\t\t}\n\t\t} else if (isSelected) result.push(row);\n\t}\n\treturn result;\n}\n/**\n* Builds a row model containing rows selected by the current row selection state.\n*\n* The result is derived from the supplied row model, so selected ids absent from\n* that model are not materialized as rows.\n*\n* @example\n* ```ts\n* const selectedRows = selectRowsFn(rowModel)\n* ```\n*/\nfunction selectRowsFn(rowModel, table) {\n\tconst newSelectedFlatRows = [];\n\tconst newSelectedRowsById = makeObjectMap();\n\tconst rowSelection = table.atoms.rowSelection?.get() ?? {};\n\treturn {\n\t\trows: selectRowsRecursively(rowModel.rows, rowSelection, newSelectedFlatRows, newSelectedRowsById),\n\t\tflatRows: newSelectedFlatRows,\n\t\trowsById: newSelectedRowsById\n\t};\n}\n/**\n* Returns whether a row id is selected in the current row selection state.\n*\n* @example\n* ```ts\n* const selected = isRowSelected(row)\n* ```\n*/\nfunction isRowSelected(row, rowSelection) {\n\treturn !!(hasOwn(rowSelection, row.id) && rowSelection[row.id]);\n}\n/**\n* Returns whether all, some, or none of a row's selectable descendants are selected.\n*\n* The result is used to drive indeterminate row selection UI.\n*\n* @example\n* ```ts\n* const selectedState = isSubRowSelected(row)\n* ```\n*/\nfunction isSubRowSelected(row) {\n\tif (!row.subRows.length) return false;\n\tconst rowSelection = row.table.atoms.rowSelection?.get() ?? {};\n\tlet someSelected = false;\n\tlet allChildrenSelected = true;\n\tlet someSelectable = false;\n\tfor (let i = 0; i < row.subRows.length; i++) {\n\t\tconst subRow = row.subRows[i];\n\t\tif (someSelected && !allChildrenSelected) break;\n\t\tif (row_getCanSelect(subRow)) {\n\t\t\tsomeSelectable = true;\n\t\t\tif (isRowSelected(subRow, rowSelection)) someSelected = true;\n\t\t\telse allChildrenSelected = false;\n\t\t}\n\t\tif (subRow.subRows.length) {\n\t\t\tconst subRowChildrenSelected = isSubRowSelected(subRow);\n\t\t\tif (subRowChildrenSelected === \"all\") {\n\t\t\t\tsomeSelected = true;\n\t\t\t\tsomeSelectable = true;\n\t\t\t} else if (subRowChildrenSelected === \"some\") {\n\t\t\t\tsomeSelected = true;\n\t\t\t\tallChildrenSelected = false;\n\t\t\t\tsomeSelectable = true;\n\t\t\t} else allChildrenSelected = false;\n\t\t}\n\t}\n\tif (!someSelectable) return false;\n\treturn allChildrenSelected ? \"all\" : someSelected ? \"some\" : false;\n}\n\n//#endregion\nexport { getDefaultRowSelectionState, isRowSelected, isSubRowSelected, row_getCanMultiSelect, row_getCanSelect, row_getCanSelectSubRows, row_getIsAllSubRowsSelected, row_getIsSelected, row_getIsSomeSelected, row_getToggleSelectedHandler, row_toggleSelected, selectRowsFn, table_getFilteredSelectedRowModel, table_getGroupedSelectedRowModel, table_getIsAllPageRowsSelected, table_getIsAllRowsSelected, table_getIsSomePageRowsSelected, table_getIsSomeRowsSelected, table_getPreSelectedRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsSelectedHandler, table_resetRowSelection, table_setRowSelection, table_toggleAllPageRowsSelected, table_toggleAllRowsSelected };","import { assignPrototypeAPIs, assignTableAPIs, makeStateUpdater } from \"../../utils.js\";\nimport { getDefaultRowSelectionState, row_getCanMultiSelect, row_getCanSelect, row_getCanSelectSubRows, row_getIsAllSubRowsSelected, row_getIsSelected, row_getIsSomeSelected, row_getToggleSelectedHandler, row_toggleSelected, table_getFilteredSelectedRowModel, table_getGroupedSelectedRowModel, table_getIsAllPageRowsSelected, table_getIsAllRowsSelected, table_getIsSomePageRowsSelected, table_getIsSomeRowsSelected, table_getPreSelectedRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsSelectedHandler, table_resetRowSelection, table_setRowSelection, table_toggleAllPageRowsSelected, table_toggleAllRowsSelected } from \"./rowSelectionFeature.utils.js\";\n\n//#region src/features/row-selection/rowSelectionFeature.ts\n/**\n* Feature that adds row selection state and APIs for row and page selection.\n*/\nconst rowSelectionFeature = {\n\tinitTableInstanceData: (table) => {\n\t\ttable._lastSelectedRowId = null;\n\t},\n\tresetTableInstanceData: (table) => {\n\t\ttable._lastSelectedRowId = null;\n\t},\n\tgetInitialState: (initialState) => {\n\t\treturn {\n\t\t\trowSelection: getDefaultRowSelectionState(),\n\t\t\t...initialState\n\t\t};\n\t},\n\tgetDefaultTableOptions: (table) => {\n\t\treturn {\n\t\t\tonRowSelectionChange: makeStateUpdater(\"rowSelection\", table),\n\t\t\tenableRowSelection: true,\n\t\t\tenableMultiRowSelection: true,\n\t\t\tenableRowRangeSelection: true,\n\t\t\tenableSubRowSelection: true,\n\t\t\tisRowRangeSelectionEvent: (event) => {\n\t\t\t\tconst rangeEvent = event;\n\t\t\t\treturn Boolean(rangeEvent.shiftKey || rangeEvent.nativeEvent?.shiftKey);\n\t\t\t}\n\t\t};\n\t},\n\tassignRowPrototype: (prototype, table) => {\n\t\tassignPrototypeAPIs(\"rowSelectionFeature\", prototype, table, {\n\t\t\trow_toggleSelected: { fn: (row, value, opts) => row_toggleSelected(row, value, opts) },\n\t\t\trow_getIsSelected: { fn: (row) => row_getIsSelected(row) },\n\t\t\trow_getIsSomeSelected: {\n\t\t\t\tfn: (row) => row_getIsSomeSelected(row),\n\t\t\t\tmemoDeps: (row) => [\n\t\t\t\t\trow.subRows,\n\t\t\t\t\trow.table.atoms.rowSelection?.get(),\n\t\t\t\t\trow.table.options.enableRowSelection\n\t\t\t\t]\n\t\t\t},\n\t\t\trow_getIsAllSubRowsSelected: {\n\t\t\t\tfn: (row) => row_getIsAllSubRowsSelected(row),\n\t\t\t\tmemoDeps: (row) => [\n\t\t\t\t\trow.subRows,\n\t\t\t\t\trow.table.atoms.rowSelection?.get(),\n\t\t\t\t\trow.table.options.enableRowSelection\n\t\t\t\t]\n\t\t\t},\n\t\t\trow_getCanSelect: { fn: (row) => row_getCanSelect(row) },\n\t\t\trow_getCanSelectSubRows: { fn: (row) => row_getCanSelectSubRows(row) },\n\t\t\trow_getCanMultiSelect: { fn: (row) => row_getCanMultiSelect(row) },\n\t\t\trow_getToggleSelectedHandler: { fn: (row, opts) => row_getToggleSelectedHandler(row, opts) }\n\t\t});\n\t},\n\tconstructTableAPIs: (table) => {\n\t\tassignTableAPIs(\"rowSelectionFeature\", table, {\n\t\t\ttable_setRowSelection: { fn: (updater) => table_setRowSelection(table, updater) },\n\t\t\ttable_resetRowSelection: { fn: (defaultState) => table_resetRowSelection(table, defaultState) },\n\t\t\ttable_toggleAllRowsSelected: { fn: (value, opts) => table_toggleAllRowsSelected(table, value, opts) },\n\t\t\ttable_toggleAllPageRowsSelected: { fn: (value, opts) => table_toggleAllPageRowsSelected(table, value, opts) },\n\t\t\ttable_getPreSelectedRowModel: { fn: () => table_getPreSelectedRowModel(table) },\n\t\t\ttable_getSelectedRowModel: {\n\t\t\t\tfn: () => table_getSelectedRowModel(table),\n\t\t\t\tmemoDeps: () => [table.atoms.rowSelection?.get(), table.getCoreRowModel()]\n\t\t\t},\n\t\t\ttable_getFilteredSelectedRowModel: {\n\t\t\t\tfn: () => table_getFilteredSelectedRowModel(table),\n\t\t\t\tmemoDeps: () => [table.atoms.rowSelection?.get(), table.getFilteredRowModel()]\n\t\t\t},\n\t\t\ttable_getGroupedSelectedRowModel: {\n\t\t\t\tfn: () => table_getGroupedSelectedRowModel(table),\n\t\t\t\tmemoDeps: () => [table.atoms.rowSelection?.get(), table.getSortedRowModel()]\n\t\t\t},\n\t\t\ttable_getSelectedRowIds: {\n\t\t\t\tfn: () => table_getSelectedRowIds(table),\n\t\t\t\tmemoDeps: () => [table.atoms.rowSelection?.get()]\n\t\t\t},\n\t\t\ttable_getIsAllRowsSelected: {\n\t\t\t\tfn: () => table_getIsAllRowsSelected(table),\n\t\t\t\tmemoDeps: () => [\n\t\t\t\t\ttable.atoms.rowSelection?.get(),\n\t\t\t\t\ttable.getFilteredRowModel(),\n\t\t\t\t\ttable.options.enableRowSelection,\n\t\t\t\t\ttable.options.enableSubRowSelection\n\t\t\t\t]\n\t\t\t},\n\t\t\ttable_getIsAllPageRowsSelected: {\n\t\t\t\tfn: () => table_getIsAllPageRowsSelected(table),\n\t\t\t\tmemoDeps: () => [\n\t\t\t\t\ttable.atoms.rowSelection?.get(),\n\t\t\t\t\ttable.getPaginatedRowModel(),\n\t\t\t\t\ttable.options.enableRowSelection,\n\t\t\t\t\ttable.options.enableSubRowSelection\n\t\t\t\t]\n\t\t\t},\n\t\t\ttable_getIsSomeRowsSelected: {\n\t\t\t\tfn: () => table_getIsSomeRowsSelected(table),\n\t\t\t\tmemoDeps: () => [table.atoms.rowSelection?.get()]\n\t\t\t},\n\t\t\ttable_getIsSomePageRowsSelected: {\n\t\t\t\tfn: () => table_getIsSomePageRowsSelected(table),\n\t\t\t\tmemoDeps: () => [\n\t\t\t\t\ttable.atoms.rowSelection?.get(),\n\t\t\t\t\ttable.getPaginatedRowModel(),\n\t\t\t\t\ttable.options.enableRowSelection\n\t\t\t\t]\n\t\t\t},\n\t\t\ttable_getToggleAllRowsSelectedHandler: { fn: () => table_getToggleAllRowsSelectedHandler(table) },\n\t\t\ttable_getToggleAllPageRowsSelectedHandler: { fn: () => table_getToggleAllPageRowsSelectedHandler(table) }\n\t\t});\n\t}\n};\n\n//#endregion\nexport { rowSelectionFeature };","import { assignPrototypeAPIs, assignTableAPIs, makeStateUpdater } from \"../../utils.js\";\nimport { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_resetSorting, table_setSorting } from \"./rowSortingFeature.utils.js\";\n\n//#region src/features/row-sorting/rowSortingFeature.ts\n/**\n* Feature that adds row sorting state, defaults, and column/table sorting APIs.\n*/\nconst rowSortingFeature = {\n\tgetInitialState(initialState) {\n\t\treturn {\n\t\t\tsorting: getDefaultSortingState(),\n\t\t\t...initialState\n\t\t};\n\t},\n\tgetDefaultColumnDef() {\n\t\treturn {\n\t\t\tsortFn: \"auto\",\n\t\t\tsortUndefined: 1\n\t\t};\n\t},\n\tgetDefaultTableOptions(table) {\n\t\treturn {\n\t\t\tautoResetSorting: false,\n\t\t\tonSortingChange: makeStateUpdater(\"sorting\", table),\n\t\t\tisMultiSortEvent: (e) => {\n\t\t\t\treturn e.shiftKey;\n\t\t\t}\n\t\t};\n\t},\n\tassignColumnPrototype(prototype, table) {\n\t\tassignPrototypeAPIs(\"rowSortingFeature\", prototype, table, {\n\t\t\tcolumn_getAutoSortFn: { fn: (column) => column_getAutoSortFn(column) },\n\t\t\tcolumn_getAutoSortDir: { fn: (column) => column_getAutoSortDir(column) },\n\t\t\tcolumn_getSortFn: { fn: (column) => column_getSortFn(column) },\n\t\t\tcolumn_toggleSorting: { fn: (column, desc, multi) => column_toggleSorting(column, desc, multi) },\n\t\t\tcolumn_getFirstSortDir: { fn: (column) => column_getFirstSortDir(column) },\n\t\t\tcolumn_getNextSortingOrder: { fn: (column, multi) => column_getNextSortingOrder(column, multi) },\n\t\t\tcolumn_getCanSort: { fn: (column) => column_getCanSort(column) },\n\t\t\tcolumn_getCanMultiSort: { fn: (column) => column_getCanMultiSort(column) },\n\t\t\tcolumn_getIsSorted: { fn: (column) => column_getIsSorted(column) },\n\t\t\tcolumn_getSortIndex: { fn: (column) => column_getSortIndex(column) },\n\t\t\tcolumn_clearSorting: { fn: (column) => column_clearSorting(column) },\n\t\t\tcolumn_getToggleSortingHandler: { fn: (column) => column_getToggleSortingHandler(column) }\n\t\t});\n\t},\n\tconstructTableAPIs(table) {\n\t\tassignTableAPIs(\"rowSortingFeature\", table, {\n\t\t\ttable_setSorting: { fn: (updater) => table_setSorting(table, updater) },\n\t\t\ttable_resetSorting: { fn: (defaultState) => table_resetSorting(table, defaultState) }\n\t\t});\n\t}\n};\n\n//#endregion\nexport { rowSortingFeature };","import { makeObjectMap } from \"../../utils.js\";\nimport { constructRow } from \"../../core/rows/constructRow.js\";\n\n//#region src/features/column-filtering/filterRowsUtils.ts\n/**\n* Filters a row model with the supplied row predicate.\n*\n* The helper supports both filtering from leaf rows upward and filtering parents before descendants, depending on table options.\n*/\nfunction filterRows(rows, filterRowImpl, table) {\n\tif (table.options.filterFromLeafRows) return filterRowModelFromLeafs(rows, filterRowImpl, table);\n\treturn filterRowModelFromRoot(rows, filterRowImpl, table);\n}\nfunction filterRowModelFromLeafs(rowsToFilter, filterRow, table) {\n\tconst newFilteredFlatRows = [];\n\tconst newFilteredRowsById = makeObjectMap();\n\tconst maxDepth = table.options.maxLeafRowFilterDepth ?? 100;\n\tconst recurseFilterRows = (rowsToFilter, depth = 0) => {\n\t\tconst filteredRows = [];\n\t\tfor (const row of rowsToFilter) {\n\t\t\tconst newRow = constructRow(table, row.id, row.original, row.index, row.depth, void 0, row.parentId);\n\t\t\tnewRow.columnFilters = row.columnFilters;\n\t\t\tnewRow.columnFiltersMeta = row.columnFiltersMeta;\n\t\t\tif (row.subRows.length && depth < maxDepth) {\n\t\t\t\tnewRow.subRows = recurseFilterRows(row.subRows, depth + 1);\n\t\t\t\tif (newRow.subRows.length || filterRow(newRow)) filteredRows.push(newRow);\n\t\t\t} else if (filterRow(newRow)) {\n\t\t\t\tnewRow.subRows = row.subRows;\n\t\t\t\tfilteredRows.push(newRow);\n\t\t\t}\n\t\t}\n\t\treturn filteredRows;\n\t};\n\tconst rows = recurseFilterRows(rowsToFilter);\n\taddSubRowsToFlatArrays(rows, newFilteredFlatRows, newFilteredRowsById);\n\treturn {\n\t\trows,\n\t\tflatRows: newFilteredFlatRows,\n\t\trowsById: newFilteredRowsById\n\t};\n}\nfunction filterRowModelFromRoot(rowsToFilter, filterRow, table) {\n\tconst newFilteredFlatRows = [];\n\tconst newFilteredRowsById = makeObjectMap();\n\tconst maxDepth = table.options.maxLeafRowFilterDepth ?? 100;\n\tconst recurseFilterRows = (rowsToFilter, depth = 0) => {\n\t\tconst filteredRows = [];\n\t\tfor (const row of rowsToFilter) if (filterRow(row)) if (row.subRows.length && depth < maxDepth) {\n\t\t\tconst newRow = constructRow(table, row.id, row.original, row.index, row.depth, void 0, row.parentId);\n\t\t\tconst filterData = row;\n\t\t\tnewRow.columnFilters = filterData.columnFilters;\n\t\t\tnewRow.columnFiltersMeta = filterData.columnFiltersMeta;\n\t\t\tfilteredRows.push(newRow);\n\t\t\tnewFilteredFlatRows.push(newRow);\n\t\t\tnewFilteredRowsById[newRow.id] = newRow;\n\t\t\tnewRow.subRows = recurseFilterRows(row.subRows, depth + 1);\n\t\t} else {\n\t\t\tfilteredRows.push(row);\n\t\t\tnewFilteredFlatRows.push(row);\n\t\t\tnewFilteredRowsById[row.id] = row;\n\t\t\tif (row.subRows.length && depth >= maxDepth) addSubRowsToFlatArrays(row.subRows, newFilteredFlatRows, newFilteredRowsById);\n\t\t}\n\t\treturn filteredRows;\n\t};\n\treturn {\n\t\trows: recurseFilterRows(rowsToFilter),\n\t\tflatRows: newFilteredFlatRows,\n\t\trowsById: newFilteredRowsById\n\t};\n}\nfunction addSubRowsToFlatArrays(subRows, flatRows, rowsById) {\n\tfor (const subRow of subRows) {\n\t\tflatRows.push(subRow);\n\t\trowsById[subRow.id] = subRow;\n\t\tif (subRow.subRows.length) addSubRowsToFlatArrays(subRow.subRows, flatRows, rowsById);\n\t}\n}\n\n//#endregion\nexport { filterRows };","import { makeObjectMap, skipFirstRun, tableMemo } from \"../../utils.js\";\nimport { table_getColumn } from \"../../core/columns/coreColumnsFeature.utils.js\";\nimport { table_autoResetPageIndex } from \"../row-pagination/rowPaginationFeature.utils.js\";\nimport { column_getFilterFn } from \"./columnFilteringFeature.utils.js\";\nimport { column_getCanGlobalFilter, table_getGlobalFilterFn } from \"../global-filtering/globalFilteringFeature.utils.js\";\nimport { filterRows } from \"./filterRowsUtils.js\";\n\n//#region src/features/column-filtering/createFilteredRowModel.ts\n/**\n* Creates a memoized filtered row model factory.\n*\n* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n*\n* Register the filter functions you use with the `filterFns` slot on the\n* `features` option:\n* `tableFeatures({ columnFilteringFeature, filteredRowModel: createFilteredRowModel(), filterFns: { includesString: filterFn_includesString } })`.\n* Importing individual `filterFn_*` functions keeps unused built-ins out of\n* your bundle; filter functions passed directly to the `filterFn` column\n* option need no registration at all.\n*/\nfunction createFilteredRowModel() {\n\treturn (_table) => {\n\t\tconst table = _table;\n\t\treturn tableMemo({\n\t\t\tfeature: \"columnFilteringFeature\",\n\t\t\ttable,\n\t\t\tfnName: \"table.getFilteredRowModel\",\n\t\t\tmemoDeps: () => [\n\t\t\t\ttable.getPreFilteredRowModel(),\n\t\t\t\ttable.atoms.columnFilters?.get(),\n\t\t\t\ttable.atoms.globalFilter?.get()\n\t\t\t],\n\t\t\tfn: () => _createFilteredRowModel(table),\n\t\t\tonAfterUpdate: skipFirstRun(() => table_autoResetPageIndex(table))\n\t\t});\n\t};\n}\nfunction _createFilteredRowModel(table) {\n\tconst rowModel = table.getPreFilteredRowModel();\n\tconst columnFilters = table.atoms.columnFilters?.get();\n\tconst globalFilter = table.atoms.globalFilter?.get();\n\tconst hasGlobalFilter = globalFilter !== void 0 && globalFilter !== null && globalFilter !== \"\";\n\tif (!rowModel.rows.length || !columnFilters?.length && !hasGlobalFilter) {\n\t\tconst flatRows = rowModel.flatRows;\n\t\tfor (let i = 0; i < flatRows.length; i++) {\n\t\t\tconst row = flatRows[i];\n\t\t\trow.columnFilters = makeObjectMap();\n\t\t\trow.columnFiltersMeta = makeObjectMap();\n\t\t}\n\t\treturn rowModel;\n\t}\n\tconst resolvedColumnFilters = [];\n\tconst resolvedGlobalFilters = [];\n\tcolumnFilters?.forEach((columnFilter) => {\n\t\tconst column = table_getColumn(table, columnFilter.id);\n\t\tif (!column) return;\n\t\tconst filterFn = column_getFilterFn(column);\n\t\tif (!filterFn) return;\n\t\tresolvedColumnFilters.push({\n\t\t\tid: columnFilter.id,\n\t\t\tfilterFn,\n\t\t\tresolvedValue: filterFn.resolveFilterValue?.(columnFilter.value) ?? columnFilter.value\n\t\t});\n\t});\n\tconst filterableIds = columnFilters?.map((d) => d.id) ?? [];\n\tconst globalFilterFn = table_getGlobalFilterFn(table);\n\tconst globallyFilterableColumns = table.getAllLeafColumns().filter((column) => column_getCanGlobalFilter(column));\n\tif (hasGlobalFilter && globalFilterFn && globallyFilterableColumns.length) {\n\t\tfilterableIds.push(\"__global__\");\n\t\tgloballyFilterableColumns.forEach((column) => {\n\t\t\tresolvedGlobalFilters.push({\n\t\t\t\tid: column.id,\n\t\t\t\tfilterFn: globalFilterFn,\n\t\t\t\tresolvedValue: globalFilterFn.resolveFilterValue?.(globalFilter) ?? globalFilter\n\t\t\t});\n\t\t});\n\t}\n\tconst flatRows = rowModel.flatRows;\n\tfor (let i = 0; i < flatRows.length; i++) {\n\t\tconst row = flatRows[i];\n\t\trow.columnFilters = makeObjectMap();\n\t\trow.columnFiltersMeta = makeObjectMap();\n\t\tif (resolvedColumnFilters.length) for (let j = 0; j < resolvedColumnFilters.length; j++) {\n\t\t\tconst currentColumnFilter = resolvedColumnFilters[j];\n\t\t\tconst id = currentColumnFilter.id;\n\t\t\trow.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, (filterMeta) => {\n\t\t\t\tif (!row.columnFiltersMeta) row.columnFiltersMeta = makeObjectMap();\n\t\t\t\trow.columnFiltersMeta[id] = filterMeta;\n\t\t\t});\n\t\t}\n\t\tif (resolvedGlobalFilters.length) {\n\t\t\tfor (let j = 0; j < resolvedGlobalFilters.length; j++) {\n\t\t\t\tconst currentGlobalFilter = resolvedGlobalFilters[j];\n\t\t\t\tconst id = currentGlobalFilter.id;\n\t\t\t\tif (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, (filterMeta) => {\n\t\t\t\t\tif (!row.columnFiltersMeta) row.columnFiltersMeta = makeObjectMap();\n\t\t\t\t\trow.columnFiltersMeta[id] = filterMeta;\n\t\t\t\t})) {\n\t\t\t\t\trow.columnFilters.__global__ = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (row.columnFilters.__global__ !== true) row.columnFilters.__global__ = false;\n\t\t}\n\t}\n\tconst filterRowsImpl = (row) => {\n\t\tfor (let i = 0; i < filterableIds.length; i++) if (row.columnFilters[filterableIds[i]] === false) return false;\n\t\treturn true;\n\t};\n\treturn filterRows(rowModel.rows, filterRowsImpl, table);\n}\n\n//#endregion\nexport { createFilteredRowModel };","import { copyInstancePropertiesWithoutMemos, skipFirstRun, tableMemo } from \"../../utils.js\";\nimport { table_autoResetPageIndex } from \"../row-pagination/rowPaginationFeature.utils.js\";\nimport { column_getCanSort, column_getSortFn } from \"./rowSortingFeature.utils.js\";\n\n//#region src/features/row-sorting/createSortedRowModel.ts\n/**\n* Creates a memoized sorted row model factory.\n*\n* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n*\n* Register the sorting functions you use with the `sortFns` slot on the\n* `features` option:\n* `tableFeatures({ rowSortingFeature, sortedRowModel: createSortedRowModel(), sortFns: { alphanumeric: sortFn_alphanumeric } })`.\n* Importing individual `sortFn_*` functions keeps unused built-ins out of\n* your bundle; sorting functions passed directly to the `sortFn` column\n* option need no registration at all.\n*/\nfunction createSortedRowModel() {\n\treturn (_table) => {\n\t\tconst table = _table;\n\t\treturn tableMemo({\n\t\t\tfeature: \"rowSortingFeature\",\n\t\t\ttable,\n\t\t\tfnName: \"table.getSortedRowModel\",\n\t\t\tmemoDeps: () => [table.atoms.sorting?.get(), table.getPreSortedRowModel()],\n\t\t\tfn: () => _createSortedRowModel(table),\n\t\t\tonAfterUpdate: skipFirstRun(() => table_autoResetPageIndex(table))\n\t\t});\n\t};\n}\nfunction _createSortedRowModel(table) {\n\tconst preSortedRowModel = table.getPreSortedRowModel();\n\tconst sorting = table.atoms.sorting?.get();\n\tif (!preSortedRowModel.rows.length || !sorting?.length) return preSortedRowModel;\n\tconst sortedFlatRows = [];\n\tconst availableSorting = sorting.filter((sort) => {\n\t\tconst column = table.getColumn(sort.id);\n\t\treturn column ? column_getCanSort(column) : false;\n\t});\n\tif (!availableSorting.length) return preSortedRowModel;\n\tconst resolvedSorting = [];\n\tfor (let i = 0; i < availableSorting.length; i++) {\n\t\tconst sortEntry = availableSorting[i];\n\t\tconst column = table.getColumn(sortEntry.id);\n\t\tif (!column) continue;\n\t\tresolvedSorting.push({\n\t\t\tid: sortEntry.id,\n\t\t\tdesc: sortEntry.desc,\n\t\t\tsortUndefined: column.columnDef.sortUndefined,\n\t\t\tinvertSorting: column.columnDef.invertSorting,\n\t\t\tsortFn: column_getSortFn(column)\n\t\t});\n\t}\n\tconst compareRows = (rowA, rowB) => {\n\t\tfor (let i = 0; i < resolvedSorting.length; i++) {\n\t\t\tconst sortEntry = resolvedSorting[i];\n\t\t\tconst sortUndefined = sortEntry.sortUndefined;\n\t\t\tconst isDesc = sortEntry.desc;\n\t\t\tlet sortInt = 0;\n\t\t\tif (sortUndefined) {\n\t\t\t\tconst aValue = rowA.getValue(sortEntry.id);\n\t\t\t\tconst bValue = rowB.getValue(sortEntry.id);\n\t\t\t\tconst aUndefined = aValue === void 0;\n\t\t\t\tconst bUndefined = bValue === void 0;\n\t\t\t\tif (aUndefined && bUndefined) continue;\n\t\t\t\tif (aUndefined || bUndefined) {\n\t\t\t\t\tif (sortUndefined === \"first\") return aUndefined ? -1 : 1;\n\t\t\t\t\tif (sortUndefined === \"last\") return aUndefined ? 1 : -1;\n\t\t\t\t\tsortInt = aUndefined ? sortUndefined : -sortUndefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (sortInt === 0) sortInt = sortEntry.sortFn(rowA, rowB, sortEntry.id);\n\t\t\tif (sortInt !== 0) {\n\t\t\t\tif (isDesc) sortInt *= -1;\n\t\t\t\tif (sortEntry.invertSorting) sortInt *= -1;\n\t\t\t\treturn sortInt;\n\t\t\t}\n\t\t}\n\t\treturn rowA.index - rowB.index;\n\t};\n\tconst sortData = (rows) => {\n\t\tconst sortedData = rows.slice();\n\t\tsortedData.sort(compareRows);\n\t\tlet changed = false;\n\t\tfor (let i = 0; i < sortedData.length; i++) {\n\t\t\tconst row = sortedData[i];\n\t\t\tif (row !== rows[i]) changed = true;\n\t\t\tconst flatIndex = sortedFlatRows.length;\n\t\t\tsortedFlatRows.push(row);\n\t\t\tif (row.subRows.length) {\n\t\t\t\tconst sortedSubRows = sortData(row.subRows);\n\t\t\t\tif (sortedSubRows.changed) {\n\t\t\t\t\tconst cloned = Object.create(Object.getPrototypeOf(row));\n\t\t\t\t\tcopyInstancePropertiesWithoutMemos(cloned, row);\n\t\t\t\t\tcloned.subRows = sortedSubRows.rows;\n\t\t\t\t\tsortedData[i] = cloned;\n\t\t\t\t\tsortedFlatRows[flatIndex] = cloned;\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\trows: sortedData,\n\t\t\tchanged\n\t\t};\n\t};\n\treturn {\n\t\trows: sortData(preSortedRowModel.rows).rows,\n\t\tflatRows: sortedFlatRows,\n\t\trowsById: preSortedRowModel.rowsById\n\t};\n}\n\n//#endregion\nexport { createSortedRowModel };","'use client';\n\nimport { FlexRender } from \"./FlexRender.js\";\nimport { Subscribe } from \"./Subscribe.js\";\nimport { reactReactivity } from \"./reactivity.js\";\nimport { constructTable } from \"@tanstack/table-core\";\nimport { useEffect, useLayoutEffect, useMemo, useState } from \"react\";\nimport { shallow, useSelector } from \"@tanstack/react-store\";\nimport { createRenderPhaseSource } from \"@tanstack/table-core/reactivity\";\nimport { table_publishExternalState, table_setOptions } from \"@tanstack/table-core/static-functions\";\n\n//#region src/useTable.ts\nconst useIsomorphicLayoutEffect = typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n/**\n* Creates a React table instance backed by TanStack Store atoms.\n*\n* The optional selector projects from `table.store`; the selected value is\n* exposed on `table.state` and compared shallowly for React re-renders. Omit\n* the selector to subscribe to every registered table state slice, or pass a\n* narrower selector and use `table.Subscribe` lower in the tree for targeted\n* subscriptions.\n*\n* @example\n* ```tsx\n* const table = useTable(\n* {\n* features,\n* columns,\n* data,\n* },\n* (state) => ({ pagination: state.pagination }),\n* )\n*\n* table.state.pagination\n* ```\n*/\nfunction useTable(tableOptions, selector) {\n\tconst [{ table, rootSource }] = useState(() => {\n\t\tconst tableInstance = constructTable({\n\t\t\t...tableOptions,\n\t\t\tfeatures: {\n\t\t\t\tcoreReactivityFeature: reactReactivity(),\n\t\t\t\t...tableOptions.features\n\t\t\t}\n\t\t});\n\t\ttableInstance.Subscribe = ((props) => {\n\t\t\treturn Subscribe({\n\t\t\t\t...props,\n\t\t\t\tsource: props.source ?? tableInstance.store\n\t\t\t});\n\t\t});\n\t\ttableInstance.FlexRender = FlexRender;\n\t\treturn {\n\t\t\ttable: tableInstance,\n\t\t\trootSource: createRenderPhaseSource(tableInstance.store, shallow)\n\t\t};\n\t});\n\tconst coreTable = table;\n\ttable_setOptions(coreTable, (prev) => ({\n\t\t...prev,\n\t\t...tableOptions\n\t}), { syncExternalState: false });\n\tconst controlledState = coreTable.options.state;\n\tconst renderSnapshot = rootSource.get();\n\tconst state = useSelector(rootSource, selector, { compare: shallow });\n\tuseIsomorphicLayoutEffect(() => {\n\t\trootSource.markCommitted(renderSnapshot);\n\t\ttable_publishExternalState(coreTable, controlledState ?? null, shallow);\n\t});\n\treturn useMemo(() => ({\n\t\t...table,\n\t\toptions: tableOptions,\n\t\tstate\n\t}), [\n\t\ttable,\n\t\ttableOptions,\n\t\tstate\n\t]);\n}\n\n//#endregion\nexport { useTable };","import {\n createContext,\n Fragment,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n columnFilteringFeature,\n createColumnHelper,\n createFilteredRowModel,\n createSortedRowModel,\n filterFn_includesString,\n FlexRender,\n globalFilteringFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_alphanumeric,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n tableFeatures,\n useTable,\n type ColumnDef,\n type RowData,\n type SortingState,\n} from \"@tanstack/react-table\";\nimport {\n IconChevronDown,\n IconChevronUp,\n IconSearch,\n IconSelector,\n} from \"@tabler/icons-react\";\nimport { Skeleton } from \"../skeleton\";\nimport { Checkbox } from \"../checkbox\";\nimport { SPRING_ENTRANCE } from \"../../motion\";\nimport { AnimatedHeight } from \"../../utils/animated-height\";\nimport { cn } from \"../../utils/cn\";\nimport { useLinkComponent } from \"../../utils/link-provider\";\n\n/**\n * DataTable — a table of records with column semantics: sortable headers,\n * aligned cells, rows that are links into a subpage. TanStack Table (v9)\n * does the thinking — column defs, sorting, row identity — and renders\n * nothing; every pixel here is Pho's.\n *\n * Design notes:\n * - The surface is `BasicPage.Card`'s: hairline border, `base` radius, the\n * page's primary fill, hairline rules between rows. A table is a card of\n * rows that happen to line up in columns, so it sits in a page's `Stack`\n * as any card does.\n * - Header cells are description ink at body size — never small caps, never\n * bold. Hierarchy comes from ink alone; the header is a label row, not a\n * banner.\n * - A sortable header is a button inside the cell: the label and its\n * indicator (`IconSelector` at rest, a chevron once sorted). `aria-sort`\n * sits on the `th`.\n * - Rows that navigate stretch one link across the row (the first cell's\n * link, extended with a pseudo-element), so the whole row is one target\n * for pointer and one stop for keyboard. Hover washes the row; the row\n * whose page is open beside the table (`current`) keeps the wash — the\n * same cue `BasicPage.RowLink` gives under `aria-current`.\n * - Numbers align to the end with tabular figures (`meta.align: \"end\"`).\n * - `search` is one box over every column — plain contains matching, and\n * the body says when nothing matches. In a page, `BasicPage.Search` in\n * the section header adopts the box; alone, the table keeps one in a\n * toolbar row inside its frame. Server-side search keeps its own box\n * outside.\n * - A wide table scrolls sideways inside its own frame; the page never does.\n * `contain: inline-size` keeps the table's intrinsic width out of the\n * page's — a host that sizes to content (a scroll area's fit-content\n * pane, a grid's auto column) would otherwise grow to the widest row.\n *\n * Reach for it when a list needs column semantics — sorting, aligned\n * figures, several fields side by side. A list where each row is one\n * label and a chevron stays `BasicPage.RowLink`.\n */\n\n/** Column metadata a `DataTable` understands. */\nexport interface DataTableColumnMeta {\n /** Cell alignment — `end` for figures (right-aligned, tabular). */\n align?: \"start\" | \"end\";\n}\n\n/**\n * The feature set every `DataTable` runs on — sorting with the stock sort\n * functions, the column meta above. Fixed, so column definitions written\n * once fit every table.\n */\nconst features = tableFeatures({\n rowSortingFeature,\n rowSelectionFeature,\n columnFilteringFeature,\n globalFilteringFeature,\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n filterFns: { includesString: filterFn_includesString },\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n },\n columnMeta: {} as DataTableColumnMeta,\n});\n\nexport type DataTableFeatures = typeof features;\n\n/** A column definition for a `DataTable` of `TData` rows. */\nexport type DataTableColumn<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<DataTableFeatures, TData, TValue>;\n\n/**\n * The column helper, bound to the table's feature set — `accessor`,\n * `display`, `group`, and `columns` to collect them with their types\n * intact.\n *\n * @example\n * const col = createColumns<Request>();\n * const columns = col.columns([\n * col.accessor(\"actor\", { header: \"Actor\" }),\n * col.accessor(\"amount\", { header: \"Amount\", meta: { align: \"end\" } }),\n * ]);\n */\nexport function createColumns<TData extends RowData>() {\n return createColumnHelper<DataTableFeatures, TData>();\n}\n\n/**\n * The leading checkbox column selection adds. The header checkbox works\n * the visible set: everything the search still shows toggles together,\n * while rows selected earlier and then hidden stay selected.\n */\nconst SELECT_COLUMN = createColumns<RowData>().display({\n id: \"select\",\n enableSorting: false,\n header: ({ table }) => {\n const visible = table.getRowModel().rows;\n const chosen = visible.filter((row) => row.getIsSelected()).length;\n const all = visible.length > 0 && chosen === visible.length;\n return (\n <Checkbox\n size=\"sm\"\n aria-label=\"Select all\"\n checked={all}\n indeterminate={chosen > 0 && !all}\n onCheckedChange={(checked) => {\n table.setRowSelection((old) => {\n const next = { ...old };\n for (const row of visible) {\n if (checked === true) next[row.id] = true;\n else delete next[row.id];\n }\n return next;\n });\n }}\n />\n );\n },\n cell: ({ row }) => (\n // Above a row link's stretched overlay — the box stays clickable.\n // `relative` alone makes no stacking context; without `z-10` the\n // overlay's ::after paints later and eats the click.\n <span className=\"relative z-10 flex\">\n <Checkbox\n size=\"sm\"\n aria-label=\"Select row\"\n checked={row.getIsSelected()}\n onCheckedChange={(checked) => row.toggleSelected(checked === true)}\n />\n </span>\n ),\n});\n\nexport interface DataTableProps<TData extends RowData> extends Omit<\n ComponentProps<\"div\">,\n \"children\"\n> {\n columns: ReadonlyArray<DataTableColumn<TData, any>>;\n data: ReadonlyArray<TData>;\n /**\n * A row's identity — what `current` is matched against, and what keeps a\n * row itself across sorts. Defaults to the row's `id` field, else its\n * index.\n */\n getRowId?: (row: TData) => string;\n /**\n * Rows that navigate: each row is one link into a subpage, through the\n * host's `LinkProvider`. Beside a `BasicPage.Aside`, the subpage opens\n * next to the table.\n */\n rowHref?: (row: TData) => string;\n /** The row whose page is open (its id) — it keeps the wash. */\n current?: string | null;\n /**\n * Sorting is on for every accessor column (`enableSorting: false` on a\n * column turns it off there). Uncontrolled by default; `defaultSort`\n * seeds it. Pass `sort` with `onSortChange` to own it — the way to sort\n * on the server.\n */\n defaultSort?: SortingState;\n sort?: SortingState;\n onSortChange?: (sort: SortingState) => void;\n /**\n * A search box on the table — `true`, or the placeholder it should\n * show. One box searches every column (a column opts out with\n * `enableGlobalFilter: false`); matching is a plain case-insensitive\n * contains, on the client. With no matches the body says so. When the\n * list doesn't all come down, keep the box outside and ask the server.\n */\n search?: boolean | string;\n /**\n * Controls in the frame's top band — a `BasicPage.Search` first, then a\n * filter or two. The band is part of the table (one surface, a hairline\n * above the header row), so nothing floats over the page and the\n * spacing above and below is the frame's own. A `Search` here adopts\n * the table's box the way a header one does.\n */\n toolbar?: ReactNode;\n /**\n * Row selection: hand either of these and rows grow a leading checkbox\n * column. The header checkbox works the visible set — everything the\n * search still shows — so select-all after a search means what it says;\n * rows selected earlier and then hidden stay selected. `selected` is\n * the selected ids (ids come from `getRowId`; pair with\n * `onSelectedChange` to own the state); `onSelectedChange` alone\n * listens while the table keeps it. The page renders its own bulk\n * actions from the ids — the table only keeps the score.\n */\n selected?: readonly string[];\n onSelectedChange?: (ids: string[]) => void;\n /**\n * File rows into labeled groups: return a label and the row renders\n * under it, `null` and it stays in the main body. Groups follow the\n * main body, in the order their labels first appear in `data`, each\n * under a quiet label row — and only while they have rows, so a group\n * a search empties simply leaves. Sorting orders rows within their\n * group.\n */\n group?: (row: TData) => string | null;\n /**\n * Glide the frame's height when the rows change — a search narrowing,\n * a filter, bones becoming rows. The height follows the content on the\n * page spring instead of jumping; reserve it for tables whose rows\n * change while mounted (same contract as `BasicPage.Card`'s).\n */\n animateHeight?: boolean;\n /** Bones while the rows are on their way — `true` for five, or a count. */\n loading?: boolean | number;\n /** What the body says when there are no rows. */\n empty?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * A host that sizes itself around tables provides this; each table\n * announces itself while mounted. `BasicPage.Root` runs wide when the\n * page carries one and `width` was left unsaid.\n */\nexport const TableHostContext = createContext<\n ((present: boolean) => void) | null\n>(null);\n\n/** A searchable table's search, published for a header to adopt. */\nexport interface TableSearchApi {\n placeholder: string;\n query: string;\n setQuery: (query: string) => void;\n /** Rows still showing after the current query. */\n matched: number;\n /** Rows in the list, before search. */\n total: number;\n}\n\ninterface TableSearchState {\n api: TableSearchApi | null;\n adopted: boolean;\n}\n\n/**\n * The channel between a searchable table and a `BasicPage.Search` placed\n * in a section header: the table publishes its search (placeholder,\n * query, the setter); a mounted `Search` adopts it, and the table's own\n * box yields. Provided by `BasicPage.Root`; a table outside any page\n * keeps its built-in box. One searchable table per page — a later\n * publisher takes the slot.\n */\nexport interface TableSearchStore {\n get: () => TableSearchState;\n subscribe: (listener: () => void) => () => void;\n publish: (api: TableSearchApi | null) => void;\n adopt: (adopted: boolean) => void;\n}\n\nexport function createTableSearchStore(): TableSearchStore {\n let state: TableSearchState = { api: null, adopted: false };\n const listeners = new Set<() => void>();\n const emit = () => {\n for (const listener of listeners) listener();\n };\n return {\n get: () => state,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n publish(api) {\n state = { ...state, api };\n emit();\n },\n adopt(adopted) {\n state = { ...state, adopted };\n emit();\n },\n };\n}\n\nexport const TableSearchContext = createContext<TableSearchStore | null>(null);\n\nconst subscribeToNothing = () => () => {};\n\nexport interface GhostSearchProps extends Omit<\n ComponentProps<\"input\">,\n \"value\" | \"onChange\" | \"type\" | \"children\"\n> {\n value: string;\n onChange: (value: string) => void;\n}\n\n/**\n * The search's ghost face — a magnifier and a bare field, quiet ink on a\n * text line, no box around it. What a table wears in its own toolbar\n * band; `BasicPage.Search variant=\"ghost\"` is the same face wherever a\n * page wants it. Presentational: hand it the value and the setter.\n */\nexport function GhostSearch({\n value,\n onChange,\n className,\n ...props\n}: GhostSearchProps) {\n return (\n <label className={cn(\"flex min-w-40 flex-1 items-center gap-2\", className)}>\n <IconSearch\n aria-hidden\n className=\"text-pho-description size-4 shrink-0\"\n />\n <input\n type=\"search\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n className=\"text-pho-primary placeholder:text-pho-description outline-pho-brand w-full min-w-0 rounded-sm bg-transparent text-sm focus-visible:outline-2 focus-visible:outline-offset-2\"\n {...props}\n />\n </label>\n );\n}\n\n/** Same chrome as `BasicPage.Card`, minus its dividers — rows draw their own. */\nconst DATA_TABLE_SURFACE =\n \"rounded-base border border-pho-secondary bg-pho-primary\";\n\nconst DEFAULT_BONES = 5;\n\nfunction defaultRowId(row: unknown, index: number): string {\n const id = (row as { id?: unknown } | null)?.id;\n return typeof id === \"string\" || typeof id === \"number\"\n ? String(id)\n : String(index);\n}\n\nfunction DataTable<TData extends RowData>({\n columns,\n data,\n getRowId,\n rowHref,\n current,\n selected,\n onSelectedChange,\n defaultSort,\n sort,\n onSortChange,\n search,\n toolbar,\n group,\n animateHeight,\n loading,\n empty = \"Nothing here yet.\",\n className,\n ...props\n}: DataTableProps<TData>) {\n const Link = useLinkComponent();\n const announce = useContext(TableHostContext);\n const searching = search === true || typeof search === \"string\";\n const [query, setQuery] = useState(\"\");\n const placeholder = typeof search === \"string\" ? search : \"Search\";\n // A `BasicPage.Search` in a section header adopts the box; the table\n // then renders no toolbar of its own.\n const searchStore = useContext(TableSearchContext);\n const adopted = useSyncExternalStore(\n searchStore?.subscribe ?? subscribeToNothing,\n () => searchStore?.get().adopted ?? false,\n () => false,\n );\n useLayoutEffect(() => {\n if (announce == null) return;\n announce(true);\n return () => announce(false);\n }, [announce]);\n const selecting = selected != null || onSelectedChange != null;\n const [ownSelection, setOwnSelection] = useState<Record<string, true>>({});\n const rowSelection: Record<string, true> =\n selected != null\n ? Object.fromEntries(selected.map((id) => [id, true as const]))\n : ownSelection;\n // Sorting mirrors selection: the component always owns a fallback state,\n // so `defaultSort` + `onSortChange` without `sort` still sorts — a custom\n // `onSortingChange` replaces the table's own updater entirely.\n const [ownSort, setOwnSort] = useState<SortingState>(defaultSort ?? []);\n const sorting: SortingState = sort ?? ownSort;\n const table = useTable<DataTableFeatures, TData>({\n features,\n columns: (selecting\n ? [SELECT_COLUMN as DataTableColumn<TData, any>, ...columns]\n : columns) as Array<DataTableColumn<TData, any>>,\n data: data as Array<TData>,\n getRowId: getRowId ? (row) => getRowId(row) : defaultRowId,\n // Keys only when meant: a present-but-undefined slice of `state` reads\n // as \"controlled, with nobody listening\".\n state: {\n sorting,\n ...(searching ? { globalFilter: query } : {}),\n ...(selecting ? { rowSelection } : {}),\n },\n ...(selecting\n ? {\n enableRowSelection: true,\n onRowSelectionChange: (\n updater:\n | Record<string, true>\n | ((old: Record<string, true>) => Record<string, true>),\n ) => {\n const next =\n typeof updater === \"function\" ? updater(rowSelection) : updater;\n if (selected == null) setOwnSelection(next);\n onSelectedChange?.(Object.keys(next));\n },\n }\n : {}),\n ...(searching\n ? {\n onGlobalFilterChange: setQuery,\n globalFilterFn: \"includesString\" as const,\n }\n : {}),\n onSortingChange: (\n updater: SortingState | ((prev: SortingState) => SortingState),\n ) => {\n const next = typeof updater === \"function\" ? updater(sorting) : updater;\n if (sort == null) setOwnSort(next);\n onSortChange?.(next);\n },\n });\n const rows = table.getRowModel().rows;\n const total = data.length;\n const matched = searching ? rows.length : total;\n useLayoutEffect(() => {\n if (!searching || searchStore == null) return;\n searchStore.publish({ placeholder, query, setQuery, matched, total });\n }, [searching, searchStore, placeholder, query, matched, total]);\n useEffect(() => {\n if (searchStore == null) return;\n return () => searchStore.publish(null);\n }, [searchStore]);\n const leafCount = table.getAllLeafColumns().length;\n const bones = useMemo(\n () =>\n loading\n ? Array.from({ length: loading === true ? DEFAULT_BONES : loading })\n : [],\n [loading],\n );\n\n const renderRow = (row: (typeof rows)[number]) => {\n const href = rowHref?.(row.original);\n const isCurrent = current != null && current === row.id;\n return (\n <tr\n key={row.id}\n className={cn(\n \"relative\",\n href != null &&\n \"hover:bg-pho-primary-hover outline-pho-brand transition-colors has-[a:focus-visible]:outline-2 has-[a:focus-visible]:-outline-offset-2\",\n (isCurrent || row.getIsSelected()) && \"bg-pho-primary-hover\",\n )}\n >\n {row.getAllCells().map((cell, index) => {\n const align = cell.column.columnDef.meta?.align ?? \"start\";\n return (\n <td\n key={cell.id}\n className={cn(\n \"text-pho-primary h-12 px-5 align-middle whitespace-nowrap\",\n align === \"end\" && \"text-right tabular-nums\",\n )}\n >\n {/* The link lives in the first data cell; with selection on,\n cell 0 is the checkbox and must stay outside the anchor. */}\n {index === (selecting ? 1 : 0) && href != null ? (\n // The row's one link, stretched over the row; the\n // ring is the row's (`has-[a:focus-visible]`).\n <Link\n href={href}\n aria-current={isCurrent ? \"page\" : undefined}\n className=\"outline-none after:absolute after:inset-0 after:content-['']\"\n >\n <FlexRender cell={cell} />\n </Link>\n ) : (\n <FlexRender cell={cell} />\n )}\n </td>\n );\n })}\n </tr>\n );\n };\n\n // Partition the (sorted, filtered) rows: the main body, then each\n // labeled group in the order labels first appear in `data`.\n let mainRows = rows;\n let groupSections: Array<[string, typeof rows]> = [];\n if (group != null) {\n mainRows = [];\n const byLabel = new Map<string, typeof rows>();\n const order: string[] = [];\n for (const item of data) {\n const label = group(item);\n if (label != null && !byLabel.has(label)) {\n byLabel.set(label, []);\n order.push(label);\n }\n }\n for (const row of rows) {\n const label = group(row.original);\n if (label == null) {\n mainRows.push(row);\n } else {\n if (!byLabel.has(label)) {\n byLabel.set(label, []);\n order.push(label);\n }\n byLabel.get(label)!.push(row);\n }\n }\n groupSections = order\n .map((label) => [label, byLabel.get(label)!] as [string, typeof rows])\n .filter(([, sectionRows]) => sectionRows.length > 0);\n }\n\n const grid = (\n <table\n className=\"w-full border-collapse text-sm\"\n aria-busy={loading ? true : undefined}\n >\n <thead>\n {table.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const align = header.column.columnDef.meta?.align ?? \"start\";\n const sorted = header.column.getIsSorted();\n const sortable =\n !header.isPlaceholder && header.column.getCanSort();\n return (\n <th\n key={header.id}\n scope=\"col\"\n colSpan={header.colSpan}\n aria-sort={\n sorted === \"asc\"\n ? \"ascending\"\n : sorted === \"desc\"\n ? \"descending\"\n : undefined\n }\n className={cn(\n \"text-pho-description h-10 px-5 text-left align-middle font-normal whitespace-nowrap\",\n align === \"end\" && \"text-right\",\n )}\n >\n {header.isPlaceholder ? null : sortable ? (\n <button\n type=\"button\"\n onClick={header.column.getToggleSortingHandler()}\n className={cn(\n \"group/sort outline-pho-brand hover:text-pho-primary -mx-1 inline-flex items-center gap-1 rounded-sm px-1 transition-colors focus-visible:outline-2\",\n align === \"end\" && \"flex-row-reverse\",\n sorted && \"text-pho-primary\",\n )}\n >\n <FlexRender header={header} />\n <SortIndicator sorted={sorted} />\n </button>\n ) : (\n <FlexRender header={header} />\n )}\n </th>\n );\n })}\n </tr>\n ))}\n </thead>\n <tbody className=\"divide-pho-secondary border-pho-secondary divide-y border-t\">\n {bones.length > 0 ? (\n bones.map((_, index) => (\n <tr key={index}>\n {table.getAllLeafColumns().map((column) => (\n <td key={column.id} className=\"h-12 px-5 align-middle\">\n <Skeleton\n className={cn(\n \"h-3.5 w-24\",\n column.columnDef.meta?.align === \"end\" && \"ml-auto\",\n )}\n />\n </td>\n ))}\n </tr>\n ))\n ) : rows.length === 0 ? (\n <tr>\n <td\n colSpan={leafCount}\n className=\"text-pho-description px-5 py-10 text-center\"\n >\n {searching && query !== \"\" && data.length > 0 ? (\n <>Nothing matches “{query}”.</>\n ) : (\n empty\n )}\n </td>\n </tr>\n ) : (\n <>\n {mainRows.map(renderRow)}\n {groupSections.map(([label, sectionRows]) => (\n <Fragment key={label}>\n <tr data-table-group=\"\">\n <td\n colSpan={leafCount}\n // A tinted band, not spacing: the wash marks the group\n // off, the height stays compact.\n className=\"bg-pho-page text-pho-description h-9 px-5 align-middle text-xs font-medium\"\n >\n {label}\n </td>\n </tr>\n {sectionRows.map(renderRow)}\n </Fragment>\n ))}\n </>\n )}\n </tbody>\n </table>\n );\n\n return (\n <div\n data-data-table=\"\"\n className={cn(\n DATA_TABLE_SURFACE,\n \"scroll-mt-12 contain-inline-size\",\n !animateHeight && \"overflow-x-auto\",\n className,\n )}\n {...props}\n >\n {(toolbar != null || (searching && !adopted)) && (\n // The toolbar band — table chrome, like the header row: the ghost\n // search on the cells' text line (`px-5`), filters at the end.\n // Quiet ink, no boxes in the box; the hairline below is the only\n // border it brings.\n <div className=\"border-pho-secondary flex min-h-11 flex-wrap items-center gap-x-4 gap-y-1 border-b px-5 py-2\">\n {searching && !adopted && (\n <GhostSearch\n value={query}\n onChange={setQuery}\n placeholder={placeholder}\n aria-label={placeholder}\n />\n )}\n {toolbar}\n </div>\n )}\n {animateHeight ? (\n // The height glides on the page spring while the rows inside swap;\n // sideways scrolling moves onto the measured layer so the frame\n // clips height only.\n <AnimatedHeight\n transition={SPRING_ENTRANCE}\n className=\"overflow-x-auto\"\n >\n {grid}\n </AnimatedHeight>\n ) : (\n grid\n )}\n </div>\n );\n}\n\n/**\n * The sort cue beside a sortable header: the two-way glyph at rest (shown\n * on hover and focus, so a header reads as plain text until it matters), a\n * chevron pointing the way once the column is sorted.\n */\nfunction SortIndicator({ sorted }: { sorted: false | \"asc\" | \"desc\" }) {\n return (\n <span\n aria-hidden\n className={cn(\n \"inline-flex shrink-0 [&>svg]:size-3.5\",\n !sorted &&\n \"opacity-0 transition-opacity group-hover/sort:opacity-100 group-focus-visible/sort:opacity-100\",\n )}\n >\n {sorted === \"asc\" ? (\n <IconChevronUp />\n ) : sorted === \"desc\" ? (\n <IconChevronDown />\n ) : (\n <IconSelector />\n )}\n </span>\n );\n}\n\nexport { DataTable, DATA_TABLE_SURFACE };\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],"mappings":";;;;;;;;;;;;;AASA,IAAMA,KAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAkB,KAAO;AAAQ,CAAC,CAAC,GACjE,KAAgB,GAAqB,WAAW,cAAc,aAAaA,EAAU,GCDrF,KAAa,CA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